shader_ir: Corrections to outward movements and misc stuffs

This commit is contained in:
Fernando Sahmkow
2019-06-28 20:54:21 -04:00
committed by FernandoS27
parent 4fde66e609
commit 8be6e1c522
8 changed files with 314 additions and 58 deletions

View File

@ -423,7 +423,16 @@ void InsertBranch(ASTManager& mm, const BlockBranchInfo& branch) {
result = MakeExpr<ExprCondCode>(cond.cc);
}
if (cond.predicate != Pred::UnusedIndex) {
Expr extra = MakeExpr<ExprPredicate>(cond.predicate);
u32 pred = static_cast<u32>(cond.predicate);
bool negate;
if (pred > 7) {
negate = true;
pred -= 8;
}
Expr extra = MakeExpr<ExprPredicate>(pred);
if (negate) {
extra = MakeExpr<ExprNot>(extra);
}
if (result) {
return MakeExpr<ExprAnd>(extra, result);
}
@ -460,8 +469,9 @@ void DecompileShader(CFGRebuildState& state) {
InsertBranch(manager, block.branch);
}
}
//manager.ShowCurrentState("Before Decompiling");
manager.Decompile();
LOG_CRITICAL(HW_GPU, "Decompiled Shader:\n{} \n", manager.Print());
//manager.ShowCurrentState("After Decompiling");
}
std::optional<ShaderCharacteristics> ScanFlow(const ProgramCode& program_code,