rsx/fp: src3 workaround

This commit is contained in:
kd-11 2017-03-21 14:53:52 +03:00
parent f7d767d0e8
commit ef822d785e
2 changed files with 12 additions and 1 deletions

View File

@ -159,6 +159,11 @@ std::string FragmentProgramDecompiler::AddTex()
return m_parr.AddParam(PF_PARAM_UNIFORM, sampler, std::string("tex") + std::to_string(dst.tex_num));
}
std::string FragmentProgramDecompiler::AddType3()
{
return m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "src3", getFloatTypeName(4) + "(1., 1., 1., 1.)");
}
//Both of these were tested with a trace SoulCalibur IV title screen
//Failure to catch causes infinite values since theres alot of rcp(0)
std::string FragmentProgramDecompiler::NotZero(const std::string& code)
@ -358,7 +363,10 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
break;
case RSX_FP_REGISTER_TYPE_UNKNOWN: // ??? Used by a few games, what is it?
LOG_ERROR(RSX, "Src type 3 used, please report this to a developer.");
LOG_ERROR(RSX, "Src type 3 used, opcode=0x%X, dst=0x%X s0=0x%X s1=0x%X s2=0x%X",
dst.opcode, dst.HEX, src0.HEX, src1.HEX, src2.HEX);
ret += AddType3();
break;
default:

View File

@ -46,6 +46,9 @@ class FragmentProgramDecompiler
std::string AddTex();
std::string Format(const std::string& code);
//Technically a temporary workaround until we know what type3 is
std::string AddType3();
//Prevent division by zero by catching denormals
//Simpler variant where input and output are expected to be positive
std::string NotZero(const std::string& code);