From 3cc397446630154754ffec4e49bd5b20db4dcf16 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 27 Jun 2015 19:06:22 +0200 Subject: [PATCH] d3d12: Fix m_ctrl not being properly passed to fragement decompiler Fix Retro City Rampage --- .../D3D12/D3D12FragmentProgramDecompiler.cpp | 35 +++++-------------- rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h | 2 +- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp index 8916a9738b..a99747f81d 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12FragmentProgramDecompiler.cpp @@ -71,25 +71,16 @@ void D3D12FragmentDecompiler::insertOutputs(std::stringstream & OS) OS << "{" << std::endl; const std::pair table[] = { - { "ocol0", "r0" }, - { "ocol1", "r2" }, - { "ocol2", "r3" }, - { "ocol3", "r4" }, + { "ocol0", m_ctrl & 0x40 ? "r0" : "h0" }, + { "ocol1", m_ctrl & 0x40 ? "r2" : "h4" }, + { "ocol2", m_ctrl & 0x40 ? "r3" : "h6" }, + { "ocol3", m_ctrl & 0x40 ? "r4" : "h8" }, }; - const std::pair table2[] = - { - { "ocol0", "h0" }, - { "ocol1", "h2" }, - { "ocol2", "h3" }, - { "ocol3", "h4" }, - }; for (int i = 0; i < sizeof(table) / sizeof(*table); ++i) { if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second)) OS << " " << "float4" << " " << table[i].first << " : SV_TARGET" << i << ";" << std::endl; - else if (m_parr.HasParam(PF_PARAM_NONE, "float4", table2[i].second)) - OS << " " << "float4" << " " << table2[i].first << " : SV_TARGET" << i << ";" << std::endl; } OS << "};" << std::endl; } @@ -141,18 +132,10 @@ void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS) { const std::pair table[] = { - { "ocol0", "r0" }, - { "ocol1", "r2" }, - { "ocol2", "r3" }, - { "ocol3", "r4" }, - }; - - const std::pair table2[] = - { - { "ocol0", "h0" }, - { "ocol1", "h2" }, - { "ocol2", "h3" }, - { "ocol3", "h4" }, + { "ocol0", m_ctrl & 0x40 ? "r0" : "h0" }, + { "ocol1", m_ctrl & 0x40 ? "r2" : "h4" }, + { "ocol2", m_ctrl & 0x40 ? "r3" : "h6" }, + { "ocol3", m_ctrl & 0x40 ? "r4" : "h8" }, }; OS << " PixelOutput Out;" << std::endl; @@ -160,8 +143,6 @@ void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS) { if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second)) OS << " Out." << table[i].first << " = " << table[i].second << ";" << std::endl; - else if (m_parr.HasParam(PF_PARAM_NONE, "float4", table2[i].second)) - OS << " Out." << table2[i].first << " = " << table2[i].second << ";" << std::endl; } OS << " if (isAlphaTested && Out.ocol0.a <= alphaRef) discard;" << std::endl; OS << " return Out;" << std::endl; diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h index 655ba0622f..4fe0e4734e 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.h @@ -91,7 +91,7 @@ struct D3D12Traits static void RecompileFragmentProgram(RSXFragmentProgram *RSXFP, FragmentProgramData& fragmentProgramData, size_t ID) { - D3D12FragmentDecompiler FS(RSXFP->addr, RSXFP->size, RSXFP->offset); + D3D12FragmentDecompiler FS(RSXFP->addr, RSXFP->size, RSXFP->ctrl); const std::string &shader = FS.Decompile(); fragmentProgramData.Compile(shader, Shader::SHADER_TYPE::SHADER_TYPE_FRAGMENT); fragmentProgramData.m_textureCount = 0;