Fragment Shader Decompiler: fixed condition registers.

This commit is contained in:
DH 2014-06-07 19:20:39 +03:00
parent e0046671f1
commit 03d2798dba
2 changed files with 12 additions and 7 deletions

View File

@ -39,16 +39,21 @@ void GLFragmentDecompilerThread::SetDst(std::string code, bool append_mask)
std::string dest;
if(dst.no_dest)
if (dst.no_dest)
{
if(dst.set_cond)
if (dst.set_cond)
{
dest = m_parr.AddParam(PARAM_NONE , "vec4", std::string(dst.fp16 ? "hc" : "rc") + std::to_string(src0.cond_reg_index));
dest = m_parr.AddParam(PARAM_NONE, "vec4", "cc" + std::to_string(src0.cond_mod_reg_index));
}
}
else
{
dest = AddReg(dst.dest_reg, dst.fp16);
if (dst.set_cond)
{
dest = m_parr.AddParam(PARAM_NONE, "vec4", "cc" + std::to_string(src0.cond_mod_reg_index)) + mask + " = " + dest;
}
}
AddCode(cond + (dest.length() ? dest + mask + " = " : "") + code + (append_mask ? mask : "") + ";");
@ -87,9 +92,9 @@ bool GLFragmentDecompilerThread::HasReg(u32 index, int fp16)
std::string(fp16 ? "h" : "r") + std::to_string(index));
}
std::string GLFragmentDecompilerThread::AddCond(int fp16)
std::string GLFragmentDecompilerThread::AddCond()
{
return m_parr.AddParam(PARAM_NONE , "vec4", std::string(fp16 ? "hc" : "rc") + std::to_string(src0.cond_mod_reg_index));
return m_parr.AddParam(PARAM_NONE , "vec4", "cc" + std::to_string(src0.cond_reg_index));
}
std::string GLFragmentDecompilerThread::AddConst()
@ -178,7 +183,7 @@ std::string GLFragmentDecompilerThread::GetCond()
cond = "equal";
}
return "any(" + cond + "(" + AddCond(dst.no_dest) + swizzle + ", vec4(0.0)))";
return "any(" + cond + "(" + AddCond() + swizzle + ", vec4(0.0)))";
}
template<typename T> std::string GLFragmentDecompilerThread::GetSRC(T src)

View File

@ -148,7 +148,7 @@ struct GLFragmentDecompilerThread : public ThreadBase
void AddCode(const std::string& code);
std::string AddReg(u32 index, int fp16);
bool HasReg(u32 index, int fp16);
std::string AddCond(int fp16);
std::string AddCond();
std::string AddConst();
std::string AddTex();
std::string Format(std::string code);