diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-01-19 00:56:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-19 00:56:55 +0100 |
commit | 51c8aea9793075f28b8f9515c37c077ce8de4e8d (patch) | |
tree | a1d2f7c44703a52eff21591ed145d9aa302ed139 /src | |
parent | Merge pull request #3323 from ReinUsesLisp/fix-template-res (diff) | |
parent | gl_shader_decompiler: Fix decompilation of condition codes (diff) | |
download | yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.tar yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.tar.gz yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.tar.bz2 yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.tar.lz yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.tar.xz yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.tar.zst yuzu-51c8aea9793075f28b8f9515c37c077ce8de4e8d.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 19751939a..2996aaf08 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -2325,7 +2325,7 @@ public: explicit ExprDecompiler(GLSLDecompiler& decomp) : decomp{decomp} {} void operator()(const ExprAnd& expr) { - inner += "( "; + inner += '('; std::visit(*this, *expr.operand1); inner += " && "; std::visit(*this, *expr.operand2); @@ -2333,7 +2333,7 @@ public: } void operator()(const ExprOr& expr) { - inner += "( "; + inner += '('; std::visit(*this, *expr.operand1); inner += " || "; std::visit(*this, *expr.operand2); @@ -2351,28 +2351,7 @@ public: } void operator()(const ExprCondCode& expr) { - const Node cc = decomp.ir.GetConditionCode(expr.cc); - std::string target; - - if (const auto pred = std::get_if<PredicateNode>(&*cc)) { - const auto index = pred->GetIndex(); - switch (index) { - case Tegra::Shader::Pred::NeverExecute: - target = "false"; - break; - case Tegra::Shader::Pred::UnusedIndex: - target = "true"; - break; - default: - target = decomp.GetPredicate(index); - break; - } - } else if (const auto flag = std::get_if<InternalFlagNode>(&*cc)) { - target = decomp.GetInternalFlag(flag->GetFlag()); - } else { - UNREACHABLE(); - } - inner += target; + inner += decomp.Visit(decomp.ir.GetConditionCode(expr.cc)).AsBool(); } void operator()(const ExprVar& expr) { @@ -2384,8 +2363,7 @@ public: } void operator()(VideoCommon::Shader::ExprGprEqual& expr) { - inner += - "( ftou(" + decomp.GetRegister(expr.gpr) + ") == " + std::to_string(expr.value) + ')'; + inner += fmt::format("(ftou({}) == {})", decomp.GetRegister(expr.gpr), expr.value); } const std::string& GetResult() const { @@ -2393,8 +2371,8 @@ public: } private: - std::string inner; GLSLDecompiler& decomp; + std::string inner; }; class ASTDecompiler { |