Skip to content

Commit

Permalink
Debug DX12
Browse files Browse the repository at this point in the history
  • Loading branch information
Zangetsu38 committed Jan 12, 2016
1 parent 85fd00f commit 9436b28
Show file tree
Hide file tree
Showing 21 changed files with 140 additions and 90 deletions.
2 changes: 1 addition & 1 deletion Utilities/Thread.cpp
Expand Up @@ -1131,7 +1131,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
// Throw virtual memory access violation exception
[[noreturn]] void throw_access_violation(const char* cause, u32 address) // Don't change function definition
{
throw EXCEPTION("Access violation %s location 0x%08x", cause, address);
//throw EXCEPTION("Access violation %s location 0x%08x", cause, address);
}

// Modify context in order to convert hardware exception to C++ exception
Expand Down
8 changes: 5 additions & 3 deletions rpcs3/Emu/Cell/PPUInterpreter.cpp
Expand Up @@ -73,12 +73,14 @@ void ppu_interpreter::TWI(PPUThread& CPU, ppu_opcode_t op)

void ppu_interpreter::MFVSCR(PPUThread& CPU, ppu_opcode_t op)
{
throw EXCEPTION("");
CPU.VPR[op.vd]._u32[0] = CPU.VSCR.VSCR;
CPU.VPR[op.vd].clear();
}

void ppu_interpreter::MTVSCR(PPUThread& CPU, ppu_opcode_t op)
{
// ignored (MFVSCR disabled)
CPU.VSCR.VSCR = CPU.VPR[op.vb]._u32[0];
CPU.VSCR.X = CPU.VSCR.Y = 0;
}

void ppu_interpreter::VADDCUW(PPUThread& CPU, ppu_opcode_t op)
Expand Down Expand Up @@ -1696,7 +1698,7 @@ void ppu_interpreter::TW(PPUThread& CPU, ppu_opcode_t op)
((u32)a < (u32)b && (op.bo & 0x2)) ||
((u32)a >(u32)b && (op.bo & 0x1)))
{
throw EXCEPTION("");
//throw EXCEPTION("");

This comment has been minimized.

Copy link
@Zangetsu38

Zangetsu38 Jan 13, 2016

Author Owner

@vlj regarde, tu doit faire ca pour naruto

}
}

Expand Down
11 changes: 4 additions & 7 deletions rpcs3/Emu/Cell/PPUInterpreter.h
Expand Up @@ -2571,14 +2571,11 @@ class PPUInterpreter : public PPUOpcodes
s32 a = (s32)CPU.GPR[ra];
s32 b = (s32)CPU.GPR[rb];

if( (a < b && (to & 0x10)) ||
(a > b && (to & 0x8)) ||
(a == b && (to & 0x4)) ||
if ((a < b && (to & 0x10)) ||
(a > b && (to & 0x8)) ||
(a == b && (to & 0x4)) ||
((u32)a < (u32)b && (to & 0x2)) ||
((u32)a > (u32)b && (to & 0x1)) )
{
throw EXCEPTION("Trap! (tw 0x%x, r%d, r%d)", to, ra, rb);
}
((u32)a >(u32)b && (to & 0x1)));
}
void LVSL(u32 vd, u32 ra, u32 rb) override
{
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/SPUASMJITRecompiler.cpp
Expand Up @@ -918,7 +918,7 @@ void spu_recompiler::BISL(spu_opcode_t op)

void spu_recompiler::IRET(spu_opcode_t op)
{
throw EXCEPTION("Unimplemented instruction");
//throw EXCEPTION("Unimplemented instruction");
}

void spu_recompiler::BISLED(spu_opcode_t op)
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/Memory/vm.cpp
Expand Up @@ -811,7 +811,7 @@ namespace vm
{
if (used > this->size)
{
throw EXCEPTION("Unexpected memory amount used (0x%x)", used);
//throw EXCEPTION("Unexpected memory amount used (0x%x)", used);
}

if (used + size > this->size)
Expand Down
17 changes: 10 additions & 7 deletions rpcs3/Emu/RSX/D3D12/D3D12Formats.cpp
Expand Up @@ -40,11 +40,10 @@ D3D12_BLEND get_blend_factor(u16 factor)
case CELL_GCM_SRC_ALPHA_SATURATE: return D3D12_BLEND_SRC_ALPHA_SAT;
case CELL_GCM_CONSTANT_COLOR: return D3D12_BLEND_DEST_COLOR;
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR: return D3D12_BLEND_INV_DEST_COLOR;
case CELL_GCM_CONSTANT_ALPHA:
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
break;
case CELL_GCM_CONSTANT_ALPHA: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA: return D3D12_BLEND_INV_DEST_ALPHA;
}
throw EXCEPTION("Invalid or unsupported blend factor (0x%x)", factor);
throw EXCEPTION("Invalid blend factor (0x%x)", factor);
}

D3D12_BLEND get_blend_factor_alpha(u16 factor)
Expand All @@ -62,10 +61,10 @@ D3D12_BLEND get_blend_factor_alpha(u16 factor)
case CELL_GCM_DST_COLOR: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_DST_COLOR: return D3D12_BLEND_INV_DEST_ALPHA;
case CELL_GCM_SRC_ALPHA_SATURATE: return D3D12_BLEND_SRC_ALPHA_SAT;
case CELL_GCM_CONSTANT_ALPHA: return D3D12_BLEND_DEST_ALPHA;
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA: return D3D12_BLEND_INV_DEST_ALPHA;
case CELL_GCM_CONSTANT_COLOR:
case CELL_GCM_ONE_MINUS_CONSTANT_COLOR:
case CELL_GCM_CONSTANT_ALPHA:
case CELL_GCM_ONE_MINUS_CONSTANT_ALPHA:
break;
}
throw EXCEPTION("Invalid or unsupported blend alpha factor (0x%x)", factor);
Expand Down Expand Up @@ -162,7 +161,7 @@ DXGI_FORMAT get_texture_format(u8 format)
case CELL_GCM_TEXTURE_D8R8G8B8: return DXGI_FORMAT_R8G8B8A8_UNORM;
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: return DXGI_FORMAT_G8R8_G8B8_UNORM;
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return DXGI_FORMAT_R8G8_B8G8_UNORM;
case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
case CELL_GCM_TEXTURE_Y16_X16_FLOAT: return DXGI_FORMAT_R16G16_FLOAT;
case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
Expand Down Expand Up @@ -305,7 +304,9 @@ DXGI_FORMAT get_color_surface_format(u8 format)
case CELL_GCM_SURFACE_R5G6B5: return DXGI_FORMAT_B5G6R5_UNORM;
case CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8: return DXGI_FORMAT_B8G8R8X8_UNORM; //BIT.TRIP Runner2 use this
case CELL_GCM_SURFACE_A8R8G8B8: return DXGI_FORMAT_R8G8B8A8_UNORM;
case CELL_GCM_SURFACE_B8: return DXGI_FORMAT_R8_UNORM;
case CELL_GCM_SURFACE_F_W16Z16Y16X16: return DXGI_FORMAT_R16G16B16A16_FLOAT;
case CELL_GCM_SURFACE_F_W32Z32Y32X32: return DXGI_FORMAT_R32G32B32A32_FLOAT;
case CELL_GCM_SURFACE_F_X32: return DXGI_FORMAT_R32_FLOAT;
case CELL_GCM_SURFACE_A8B8G8R8: return DXGI_FORMAT_R8G8B8A8_UNORM;
}
Expand All @@ -326,6 +327,7 @@ DXGI_FORMAT get_depth_stencil_surface_clear_format(u8 format)
{
switch (format)
{
case 0: return DXGI_FORMAT_UNKNOWN;
case CELL_GCM_SURFACE_Z16: return DXGI_FORMAT_D16_UNORM;
case CELL_GCM_SURFACE_Z24S8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
}
Expand All @@ -336,6 +338,7 @@ DXGI_FORMAT get_depth_stencil_typeless_surface_format(u8 format)
{
switch (format)
{
case 0: return DXGI_FORMAT_UNKNOWN;
case CELL_GCM_SURFACE_Z16: return DXGI_FORMAT_R16_TYPELESS;
case CELL_GCM_SURFACE_Z24S8: return DXGI_FORMAT_R24G8_TYPELESS;
}
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h
Expand Up @@ -166,7 +166,7 @@ struct D3D12Traits
}
}

fs::file(fs::get_config_dir() + "FragmentProgram" + std::to_string(ID) + ".hlsl", fom::rewrite) << shader;
fs::file(fs::get_config_dir() + "/hlsl/FragmentProgram" + std::to_string(ID) + ".hlsl", fom::rewrite) << shader;
fragmentProgramData.id = (u32)ID;
}

Expand All @@ -177,7 +177,7 @@ struct D3D12Traits
std::string shaderCode = VS.Decompile();
vertexProgramData.Compile(shaderCode, Shader::SHADER_TYPE::SHADER_TYPE_VERTEX);
vertexProgramData.vertex_shader_inputs = VS.input_slots;
fs::file(fs::get_config_dir() + "VertexProgram" + std::to_string(ID) + ".hlsl", fom::rewrite) << shaderCode;
fs::file(fs::get_config_dir() + "/hlsl/VertexProgram" + std::to_string(ID) + ".hlsl", fom::rewrite) << shaderCode;
vertexProgramData.id = (u32)ID;
}

Expand Down
30 changes: 18 additions & 12 deletions rpcs3/Emu/SysCalls/Modules/cellAdec.cpp
Expand Up @@ -39,6 +39,8 @@ AudioDecoder::AudioDecoder(s32 type, u32 addr, u32 size, vm::ptr<CellAdecCbMsg>

switch (type)
{
case CELL_ADEC_TYPE_LPCM_PAMF:
case CELL_ADEC_TYPE_AC3:
case CELL_ADEC_TYPE_ATRACX:
case CELL_ADEC_TYPE_ATRACX_2CH:
case CELL_ADEC_TYPE_ATRACX_6CH:
Expand All @@ -49,6 +51,7 @@ AudioDecoder::AudioDecoder(s32 type, u32 addr, u32 size, vm::ptr<CellAdecCbMsg>
break;
}
case CELL_ADEC_TYPE_MP3:
case CELL_ADEC_TYPE_MPEG_L2:
{
codec = avcodec_find_decoder(AV_CODEC_ID_MP3);
input_format = av_find_input_format("mp3");
Expand Down Expand Up @@ -412,12 +415,12 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor

if (got_frame)
{
//u64 ts = av_frame_get_best_effort_timestamp(frame.data);
//if (ts != AV_NOPTS_VALUE)
//{
// frame.pts = ts/* - adec.first_pts*/;
// adec.last_pts = frame.pts;
//}
/*u64 ts = av_frame_get_best_effort_timestamp(frame.data);
if (ts != AV_NOPTS_VALUE)
{
frame.pts = ts/* - adec.first_pts;
adec.last_pts = frame.pts;
}*/
adec.last_pts += ((u64)frame.data->nb_samples) * 90000 / frame.data->sample_rate;
frame.pts = adec.last_pts;

Expand All @@ -436,8 +439,8 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
frame.userdata = task.au.userdata;
frame.size = frame.data->nb_samples * frame.data->channels * nbps;

//LOG_NOTICE(HLE, "got audio frame (pts=0x%llx, nb_samples=%d, ch=%d, sample_rate=%d, nbps=%d)",
//frame.pts, frame.data->nb_samples, frame.data->channels, frame.data->sample_rate, nbps);
/*LOG_NOTICE(HLE, "got audio frame (pts=0x%llx, nb_samples=%d, ch=%d, sample_rate=%d, nbps=%d)",
frame.pts, frame.data->nb_samples, frame.data->channels, frame.data->sample_rate, nbps);*/

if (adec.frames.push(frame, &adec.is_closed))
{
Expand Down Expand Up @@ -475,16 +478,16 @@ bool adecCheckType(s32 type)
{
switch (type)
{
case CELL_ADEC_TYPE_AC3: cellAdec.Notice("adecCheckType(): AC3"); break;
case CELL_ADEC_TYPE_ATRACX: cellAdec.Notice("adecCheckType(): ATRAC3plus"); break;
case CELL_ADEC_TYPE_ATRACX_2CH: cellAdec.Notice("adecCheckType(): ATRAC3plus 2ch"); break;
case CELL_ADEC_TYPE_ATRACX_6CH: cellAdec.Notice("adecCheckType(): ATRAC3plus 6ch"); break;
case CELL_ADEC_TYPE_ATRACX_8CH: cellAdec.Notice("adecCheckType(): ATRAC3plus 8ch"); break;
case CELL_ADEC_TYPE_MP3: cellAdec.Notice("adecCheckType(): MP3"); break;

case CELL_ADEC_TYPE_LPCM_PAMF:
case CELL_ADEC_TYPE_AC3:
case CELL_ADEC_TYPE_LPCM_PAMF: cellAdec.Notice("adecCheckType(): LPCM PAMF"); break;
case CELL_ADEC_TYPE_MPEG_L2: cellAdec.Notice("adecCheckType(): MPEG L2"); break;

case CELL_ADEC_TYPE_ATRAC3:
case CELL_ADEC_TYPE_MPEG_L2:
case CELL_ADEC_TYPE_CELP:
case CELL_ADEC_TYPE_M4AAC:
case CELL_ADEC_TYPE_CELP8:
Expand Down Expand Up @@ -592,6 +595,8 @@ s32 cellAdecStartSeq(u32 handle, u32 param)

switch (adec->type)
{
case CELL_ADEC_TYPE_LPCM_PAMF:
case CELL_ADEC_TYPE_AC3:
case CELL_ADEC_TYPE_ATRACX:
case CELL_ADEC_TYPE_ATRACX_2CH:
case CELL_ADEC_TYPE_ATRACX_6CH:
Expand All @@ -612,6 +617,7 @@ s32 cellAdecStartSeq(u32 handle, u32 param)
break;
}
case CELL_ADEC_TYPE_MP3:
case CELL_ADEC_TYPE_MPEG_L2:
{
const auto mp3 = vm::cptr<CellAdecParamMP3>::make(param);

Expand Down
32 changes: 16 additions & 16 deletions rpcs3/Emu/SysCalls/Modules/cellDmux.cpp
Expand Up @@ -656,26 +656,26 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
{
esAVC[es.fidMajor % 16] = task.es.es_ptr;
}
//else if ((es.fidMajor & -0x10) == 0xe0 && es.fidMinor == 0 && !es.sup1 && !es.sup2)
//{
// esM2V[es.fidMajor % 16] = task.es.es_ptr;
//}
else if ((es.fidMajor & -0x10) == 0xe0 && es.fidMinor == 0 && !es.sup1 && !es.sup2)
{
esM2V[es.fidMajor % 16] = task.es.es_ptr;
}
else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0 && !es.sup1 && !es.sup2)
{
esATX[es.fidMinor % 16] = task.es.es_ptr;
}
//else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x20 && !es.sup1 && !es.sup2)
//{
// esDATA[es.fidMinor % 16] = task.es.es_ptr;
//}
//else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x30 && !es.sup1 && !es.sup2)
//{
// esAC3[es.fidMinor % 16] = task.es.es_ptr;
//}
//else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x40 && !es.sup1 && !es.sup2)
//{
// esPCM[es.fidMinor % 16] = task.es.es_ptr;
//}
else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x20 && !es.sup1 && !es.sup2)
{
esDATA[es.fidMinor % 16] = task.es.es_ptr;
}
else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x30 && !es.sup1 && !es.sup2)
{
esAC3[es.fidMinor % 16] = task.es.es_ptr;
}
else if (es.fidMajor == 0xbd && (es.fidMinor & -0x10) == 0x40 && !es.sup1 && !es.sup2)
{
esPCM[es.fidMinor % 16] = task.es.es_ptr;
}
else
{
throw EXCEPTION("dmuxEnableEs: unknown filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2);
Expand Down
28 changes: 16 additions & 12 deletions rpcs3/Emu/SysCalls/Modules/cellFont.cpp
Expand Up @@ -453,7 +453,7 @@ s32 cellFontSetEffectWeight()

s32 cellFontGlyphSetupVertexesGlyph()
{
UNIMPLEMENTED_FUNC(cellFont);
//UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}

Expand All @@ -478,7 +478,7 @@ s32 cellFontSetScalePoint()
s32 cellFontSetupRenderEffectSlant()
{
UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
return -1;
}

s32 cellFontGraphicsSetLineRGBA()
Expand Down Expand Up @@ -508,30 +508,30 @@ s32 cellFontGraphicsSetupDrawContext()
s32 cellFontSetupRenderEffectWeight()
{
UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
return -1;
}

s32 cellFontGlyphGetOutlineControlDistance()
{
UNIMPLEMENTED_FUNC(cellFont);
//UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}

s32 cellFontGlyphGetVertexesGlyphSize()
{
UNIMPLEMENTED_FUNC(cellFont);
//UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}

s32 cellFontGenerateCharGlyph()
{
UNIMPLEMENTED_FUNC(cellFont);
//UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}

s32 cellFontDeleteGlyph()
{
UNIMPLEMENTED_FUNC(cellFont);
//UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK;
}

Expand All @@ -552,7 +552,7 @@ s32 cellFontExtend(u32 a1, u32 a2, u32 a3)
//Something happens
}
//Something happens?
return CELL_OK;
return -1;
}

s32 cellFontRenderCharGlyphImageVertical()
Expand Down Expand Up @@ -585,12 +585,14 @@ s32 cellFontGraphicsGetDrawType()

s32 cellFontGetKerning()
{
throw EXCEPTION("");
UNIMPLEMENTED_FUNC(cellFont);
return -1;//throw EXCEPTION("");
}

s32 cellFontGetRenderScaledKerning()
{
throw EXCEPTION("");
UNIMPLEMENTED_FUNC(cellFont);
return -1;//throw EXCEPTION("");
}

s32 cellFontGetRenderScalePixel()
Expand Down Expand Up @@ -620,7 +622,8 @@ s32 cellFontGetEffectWeight()

s32 cellFontGetScalePixel()
{
throw EXCEPTION("");
UNIMPLEMENTED_FUNC(cellFont);
return -1;//throw EXCEPTION("");
}

s32 cellFontClearFileCache()
Expand All @@ -635,7 +638,8 @@ s32 cellFontAdjustFontScaling()

s32 cellFontSetupRenderScalePoint()
{
throw EXCEPTION("");
UNIMPLEMENTED_FUNC(cellFont);
return CELL_OK; //throw EXCEPTION("");
}

s32 cellFontGlyphGetVerticalShift()
Expand Down

0 comments on commit 9436b28

Please sign in to comment.