summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 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:
2325 explicit ExprDecompiler(GLSLDecompiler& decomp) : decomp{decomp} {} 2325 explicit ExprDecompiler(GLSLDecompiler& decomp) : decomp{decomp} {}
2326 2326
2327 void operator()(const ExprAnd& expr) { 2327 void operator()(const ExprAnd& expr) {
2328 inner += "( "; 2328 inner += '(';
2329 std::visit(*this, *expr.operand1); 2329 std::visit(*this, *expr.operand1);
2330 inner += " && "; 2330 inner += " && ";
2331 std::visit(*this, *expr.operand2); 2331 std::visit(*this, *expr.operand2);
@@ -2333,7 +2333,7 @@ public:
2333 } 2333 }
2334 2334
2335 void operator()(const ExprOr& expr) { 2335 void operator()(const ExprOr& expr) {
2336 inner += "( "; 2336 inner += '(';
2337 std::visit(*this, *expr.operand1); 2337 std::visit(*this, *expr.operand1);
2338 inner += " || "; 2338 inner += " || ";
2339 std::visit(*this, *expr.operand2); 2339 std::visit(*this, *expr.operand2);
@@ -2351,28 +2351,7 @@ public:
2351 } 2351 }
2352 2352
2353 void operator()(const ExprCondCode& expr) { 2353 void operator()(const ExprCondCode& expr) {
2354 const Node cc = decomp.ir.GetConditionCode(expr.cc); 2354 inner += decomp.Visit(decomp.ir.GetConditionCode(expr.cc)).AsBool();
2355 std::string target;
2356
2357 if (const auto pred = std::get_if<PredicateNode>(&*cc)) {
2358 const auto index = pred->GetIndex();
2359 switch (index) {
2360 case Tegra::Shader::Pred::NeverExecute:
2361 target = "false";
2362 break;
2363 case Tegra::Shader::Pred::UnusedIndex:
2364 target = "true";
2365 break;
2366 default:
2367 target = decomp.GetPredicate(index);
2368 break;
2369 }
2370 } else if (const auto flag = std::get_if<InternalFlagNode>(&*cc)) {
2371 target = decomp.GetInternalFlag(flag->GetFlag());
2372 } else {
2373 UNREACHABLE();
2374 }
2375 inner += target;
2376 } 2355 }
2377 2356
2378 void operator()(const ExprVar& expr) { 2357 void operator()(const ExprVar& expr) {
@@ -2384,8 +2363,7 @@ public:
2384 } 2363 }
2385 2364
2386 void operator()(VideoCommon::Shader::ExprGprEqual& expr) { 2365 void operator()(VideoCommon::Shader::ExprGprEqual& expr) {
2387 inner += 2366 inner += fmt::format("(ftou({}) == {})", decomp.GetRegister(expr.gpr), expr.value);
2388 "( ftou(" + decomp.GetRegister(expr.gpr) + ") == " + std::to_string(expr.value) + ')';
2389 } 2367 }
2390 2368
2391 const std::string& GetResult() const { 2369 const std::string& GetResult() const {
@@ -2393,8 +2371,8 @@ public:
2393 } 2371 }
2394 2372
2395private: 2373private:
2396 std::string inner;
2397 GLSLDecompiler& decomp; 2374 GLSLDecompiler& decomp;
2375 std::string inner;
2398}; 2376};
2399 2377
2400class ASTDecompiler { 2378class ASTDecompiler {