rsx: Decompiler fixups for conditional execution

- Cond actually obeys vector mask
This commit is contained in:
kd-11 2019-08-14 19:35:03 +03:00 committed by kd-11
parent f9aea076ae
commit fe6ff8622a
3 changed files with 16 additions and 2 deletions

View File

@ -460,7 +460,9 @@ void FragmentProgramDecompiler::AddCodeCond(const std::string& dst, const std::s
}
// NOTE: dst = _select(dst, src, cond) is equivalent to dst = cond? src : dst;
const auto cond = ShaderVariable(dst).match_size(GetRawCond());
const auto dst_var = ShaderVariable(dst);
const auto raw_cond = dst_var.add_mask(GetRawCond());
const auto cond = dst_var.match_size(raw_cond);
AddCode(dst + " = _select(" + dst + ", " + src_prefix + src + ", " + cond + ");");
}

View File

@ -311,6 +311,16 @@ public:
return result;
}
}
std::string add_mask(const std::string& other_var) const
{
if (swizzles.back() != "xyzw")
{
return other_var + "." + swizzles.back();
}
return other_var;
}
};
struct vertex_reg_info

View File

@ -310,7 +310,9 @@ void VertexProgramDecompiler::AddCodeCond(const std::string& dst, const std::str
}
// NOTE: dst = _select(dst, src, cond) is equivalent to dst = cond? src : dst;
const auto cond = ShaderVariable(dst).match_size(GetRawCond());
const auto dst_var = ShaderVariable(dst);
const auto raw_cond = dst_var.add_mask(GetRawCond());
const auto cond = dst_var.match_size(raw_cond);
AddCode(dst + " = _select(" + dst + ", " + src + ", " + cond + ");");
}