d3d12: Fix m_ctrl not being properly passed to fragement decompiler

Fix Retro City Rampage
This commit is contained in:
vlj 2015-06-27 19:06:22 +02:00 committed by Vincent Lejeune
parent 45b7da6666
commit 3cc3974466
2 changed files with 9 additions and 28 deletions

View File

@ -71,25 +71,16 @@ void D3D12FragmentDecompiler::insertOutputs(std::stringstream & OS)
OS << "{" << std::endl;
const std::pair<std::string, std::string> 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<std::string, std::string> 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<std::string, std::string> table[] =
{
{ "ocol0", "r0" },
{ "ocol1", "r2" },
{ "ocol2", "r3" },
{ "ocol3", "r4" },
};
const std::pair<std::string, std::string> 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;

View File

@ -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;