shader_decompiler: Visit source nodes even when they assign to RZ

Some operations like atomicMin were ignored because they returned were
being stored to RZ. This operations have a side effect and it was being
ignored.
This commit is contained in:
ReinUsesLisp 2020-05-14 21:26:37 -03:00
parent 434856c636
commit ed4e324991
2 changed files with 6 additions and 2 deletions

View file

@ -1538,7 +1538,9 @@ private:
Expression target; Expression target;
if (const auto gpr = std::get_if<GprNode>(&*dest)) { if (const auto gpr = std::get_if<GprNode>(&*dest)) {
if (gpr->GetIndex() == Register::ZeroIndex) { if (gpr->GetIndex() == Register::ZeroIndex) {
// Writing to Register::ZeroIndex is a no op // Writing to Register::ZeroIndex is a no op but we still have to visit the source
// as it might have side effects.
code.AddLine("{};", Visit(src).GetCode());
return {}; return {};
} }
target = {GetRegister(gpr->GetIndex()), Type::Float}; target = {GetRegister(gpr->GetIndex()), Type::Float};

View file

@ -1361,7 +1361,9 @@ private:
Expression target{}; Expression target{};
if (const auto gpr = std::get_if<GprNode>(&*dest)) { if (const auto gpr = std::get_if<GprNode>(&*dest)) {
if (gpr->GetIndex() == Register::ZeroIndex) { if (gpr->GetIndex() == Register::ZeroIndex) {
// Writing to Register::ZeroIndex is a no op // Writing to Register::ZeroIndex is a no op but we still have to visit its source
// because it might have side effects.
Visit(src);
return {}; return {};
} }
target = {registers.at(gpr->GetIndex()), Type::Float}; target = {registers.at(gpr->GetIndex()), Type::Float};