summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-01-17 23:06:27 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-01-18 01:23:01 +0100
commitf34e519da3025d8203e2206ba931de57115fbc1e (patch)
tree18cae62c59e21f698488492e1279be299486f4c5
parentMerge pull request #3311 from ReinUsesLisp/z32fx24s8 (diff)
downloadyuzu-f34e519da3025d8203e2206ba931de57115fbc1e.tar
yuzu-f34e519da3025d8203e2206ba931de57115fbc1e.tar.gz
yuzu-f34e519da3025d8203e2206ba931de57115fbc1e.tar.bz2
yuzu-f34e519da3025d8203e2206ba931de57115fbc1e.tar.lz
yuzu-f34e519da3025d8203e2206ba931de57115fbc1e.tar.xz
yuzu-f34e519da3025d8203e2206ba931de57115fbc1e.tar.zst
yuzu-f34e519da3025d8203e2206ba931de57115fbc1e.zip
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp32
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 f9f7a97b5..e9ceca768 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -2313,7 +2313,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);
@@ -2321,7 +2321,7 @@ public:
}
void operator()(const ExprOr& expr) {
- inner += "( ";
+ inner += '(';
std::visit(*this, *expr.operand1);
inner += " || ";
std::visit(*this, *expr.operand2);
@@ -2339,28 +2339,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) {
@@ -2372,8 +2351,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 {
@@ -2381,8 +2359,8 @@ public:
}
private:
- std::string inner;
GLSLDecompiler& decomp;
+ std::string inner;
};
class ASTDecompiler {