Don't use roundEven() to implement round() in DX9 compatibility mode

This commit is contained in:
rdb 2020-11-05 17:53:38 +01:00
parent a5be11bd8b
commit 589aaff11c
7 changed files with 145 additions and 1 deletions

View file

@ -5492,6 +5492,10 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
op = fnCandidate->getBuiltInOp();
if (builtIn && op != EOpNull) {
// SM 4.0 and above guarantees roundEven semantics for round()
if (!hlslDX9Compatible() && op == EOpRound)
op = EOpRoundEven;
// A function call mapped to a built-in operation.
result = intermediate.addBuiltInFunctionCall(loc, op, fnCandidate->getParamCount() == 1, arguments,
fnCandidate->getType());

View file

@ -1123,7 +1123,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
symbolTable.relateToOperator("reflect", EOpReflect);
symbolTable.relateToOperator("refract", EOpRefract);
symbolTable.relateToOperator("reversebits", EOpBitFieldReverse);
symbolTable.relateToOperator("round", EOpRoundEven);
symbolTable.relateToOperator("round", EOpRound);
symbolTable.relateToOperator("rsqrt", EOpInverseSqrt);
symbolTable.relateToOperator("saturate", EOpSaturate);
symbolTable.relateToOperator("sign", EOpSign);