From 49c0c081c47fd0b56f4e026e8a6998dff20b32c4 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 12 Jul 2018 20:03:45 -0400 Subject: [PATCH] gl_shader_decompiler: Implement PredCondition::LessThanWithNan. --- src/video_core/engines/shader_bytecode.h | 1 + .../renderer_opengl/gl_shader_decompiler.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index ab978c2e24..77c4656943 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -142,6 +142,7 @@ enum class PredCondition : u64 { GreaterThan = 4, NotEqual = 5, GreaterEqual = 6, + LessThanWithNan = 9, NotEqualWithNan = 13, // TODO(Subv): Other condition types }; diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index c29cabb845..c1efca23b5 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -728,10 +728,10 @@ private: const std::string& op_a, const std::string& op_b) const { using Tegra::Shader::PredCondition; static const std::unordered_map PredicateComparisonStrings = { - {PredCondition::LessThan, "<"}, {PredCondition::Equal, "=="}, - {PredCondition::LessEqual, "<="}, {PredCondition::GreaterThan, ">"}, - {PredCondition::NotEqual, "!="}, {PredCondition::GreaterEqual, ">="}, - {PredCondition::NotEqualWithNan, "!="}, + {PredCondition::LessThan, "<"}, {PredCondition::Equal, "=="}, + {PredCondition::LessEqual, "<="}, {PredCondition::GreaterThan, ">"}, + {PredCondition::NotEqual, "!="}, {PredCondition::GreaterEqual, ">="}, + {PredCondition::LessThanWithNan, "<"}, {PredCondition::NotEqualWithNan, "!="}, }; const auto& comparison{PredicateComparisonStrings.find(condition)}; @@ -739,7 +739,8 @@ private: "Unknown predicate comparison operation"); std::string predicate{'(' + op_a + ") " + comparison->second + " (" + op_b + ')'}; - if (condition == PredCondition::NotEqualWithNan) { + if (condition == PredCondition::LessThanWithNan || + condition == PredCondition::NotEqualWithNan) { predicate += " || isnan(" + op_a + ") || isnan(" + op_b + ')'; }