2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

gl_shader_decompiler: Implement PredCondition::LessThanWithNan.

This commit is contained in:
bunnei 2018-07-12 20:03:45 -04:00
parent 274d1fb0fc
commit 49c0c081c4
2 changed files with 7 additions and 5 deletions

View file

@ -142,6 +142,7 @@ enum class PredCondition : u64 {
GreaterThan = 4, GreaterThan = 4,
NotEqual = 5, NotEqual = 5,
GreaterEqual = 6, GreaterEqual = 6,
LessThanWithNan = 9,
NotEqualWithNan = 13, NotEqualWithNan = 13,
// TODO(Subv): Other condition types // TODO(Subv): Other condition types
}; };

View file

@ -728,10 +728,10 @@ private:
const std::string& op_a, const std::string& op_b) const { const std::string& op_a, const std::string& op_b) const {
using Tegra::Shader::PredCondition; using Tegra::Shader::PredCondition;
static const std::unordered_map<PredCondition, const char*> PredicateComparisonStrings = { static const std::unordered_map<PredCondition, const char*> PredicateComparisonStrings = {
{PredCondition::LessThan, "<"}, {PredCondition::Equal, "=="}, {PredCondition::LessThan, "<"}, {PredCondition::Equal, "=="},
{PredCondition::LessEqual, "<="}, {PredCondition::GreaterThan, ">"}, {PredCondition::LessEqual, "<="}, {PredCondition::GreaterThan, ">"},
{PredCondition::NotEqual, "!="}, {PredCondition::GreaterEqual, ">="}, {PredCondition::NotEqual, "!="}, {PredCondition::GreaterEqual, ">="},
{PredCondition::NotEqualWithNan, "!="}, {PredCondition::LessThanWithNan, "<"}, {PredCondition::NotEqualWithNan, "!="},
}; };
const auto& comparison{PredicateComparisonStrings.find(condition)}; const auto& comparison{PredicateComparisonStrings.find(condition)};
@ -739,7 +739,8 @@ private:
"Unknown predicate comparison operation"); "Unknown predicate comparison operation");
std::string predicate{'(' + op_a + ") " + comparison->second + " (" + op_b + ')'}; 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 + ')'; predicate += " || isnan(" + op_a + ") || isnan(" + op_b + ')';
} }