yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Added predicate comparison LessEqualWithNan (#1736)

* Added predicate comparison LessEqualWithNan

* oops

* Clang fix
This commit is contained in:
Hexagon12 2018-11-23 18:51:32 +02:00 committed by bunnei
parent c4b5319446
commit 3135dbc29c
2 changed files with 13 additions and 5 deletions

View File

@ -153,6 +153,7 @@ enum class PredCondition : u64 {
NotEqual = 5, NotEqual = 5,
GreaterEqual = 6, GreaterEqual = 6,
LessThanWithNan = 9, LessThanWithNan = 9,
LessEqualWithNan = 11,
GreaterThanWithNan = 12, GreaterThanWithNan = 12,
NotEqualWithNan = 13, NotEqualWithNan = 13,
GreaterEqualWithNan = 14, GreaterEqualWithNan = 14,

View File

@ -1059,11 +1059,17 @@ 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::LessEqual, "<="}, {PredCondition::GreaterThan, ">"}, {PredCondition::Equal, "=="},
{PredCondition::NotEqual, "!="}, {PredCondition::GreaterEqual, ">="}, {PredCondition::LessEqual, "<="},
{PredCondition::LessThanWithNan, "<"}, {PredCondition::NotEqualWithNan, "!="}, {PredCondition::GreaterThan, ">"},
{PredCondition::GreaterThanWithNan, ">"}, {PredCondition::GreaterEqualWithNan, ">="}}; {PredCondition::NotEqual, "!="},
{PredCondition::GreaterEqual, ">="},
{PredCondition::LessThanWithNan, "<"},
{PredCondition::NotEqualWithNan, "!="},
{PredCondition::LessEqualWithNan, "<="},
{PredCondition::GreaterThanWithNan, ">"},
{PredCondition::GreaterEqualWithNan, ">="}};
const auto& comparison{PredicateComparisonStrings.find(condition)}; const auto& comparison{PredicateComparisonStrings.find(condition)};
UNIMPLEMENTED_IF_MSG(comparison == PredicateComparisonStrings.end(), UNIMPLEMENTED_IF_MSG(comparison == PredicateComparisonStrings.end(),
@ -1072,6 +1078,7 @@ private:
std::string predicate{'(' + op_a + ") " + comparison->second + " (" + op_b + ')'}; std::string predicate{'(' + op_a + ") " + comparison->second + " (" + op_b + ')'};
if (condition == PredCondition::LessThanWithNan || if (condition == PredCondition::LessThanWithNan ||
condition == PredCondition::NotEqualWithNan || condition == PredCondition::NotEqualWithNan ||
condition == PredCondition::LessEqualWithNan ||
condition == PredCondition::GreaterThanWithNan || condition == PredCondition::GreaterThanWithNan ||
condition == PredCondition::GreaterEqualWithNan) { condition == PredCondition::GreaterEqualWithNan) {
predicate += " || isnan(" + op_a + ") || isnan(" + op_b + ')'; predicate += " || isnan(" + op_a + ") || isnan(" + op_b + ')';