Implement isnan/isinf
This change adds ANGLE support for isnan/isinf.
BUG=angle:922
TEST=dEQP tests:
dEQP-GLES3.functional.shaders.builtin_functions.common.isnan.*
(high precision tests still fail)
Tests passing 100% because of this change:
dEQP-GLES3.functional.shaders.builtin_functions.common.isinf.*
Reduced number of errors in tests:
EQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.isnan.*
dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.common.isinf_*
Change-Id: I52bf18b59365ea7031746ae840550162d7e6b96e
Reviewed-on: https://chromium-review.googlesource.com/250761
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Nicolas Capens <capn@chromium.org>
diff --git a/src/compiler/translator/Initialize.cpp b/src/compiler/translator/Initialize.cpp
index ad7b822..8300be6 100644
--- a/src/compiler/translator/Initialize.cpp
+++ b/src/compiler/translator/Initialize.cpp
@@ -280,6 +280,21 @@
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float1, float1, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float1, float1, float4);
+ TType *bool1 = new TType(EbtBool);
+ TType *bool2 = new TType(EbtBool, 2);
+ TType *bool3 = new TType(EbtBool, 3);
+ TType *bool4 = new TType(EbtBool, 4);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool1, "isnan", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool2, "isnan", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool3, "isnan", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool4, "isnan", float4);
+
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool1, "isinf", float1);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool2, "isinf", float2);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool3, "isinf", float3);
+ symbolTable.insertBuiltIn(ESSL3_BUILTINS, bool4, "isinf", float4);
+
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int1, "floatBitsToInt", float1);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "floatBitsToInt", float2);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "floatBitsToInt", float3);
@@ -397,11 +412,6 @@
symbolTable.insertBuiltIn(ESSL3_BUILTINS, mat3, "inverse", mat3);
symbolTable.insertBuiltIn(ESSL3_BUILTINS, mat4, "inverse", mat4);
- TType *bool1 = new TType(EbtBool);
- TType *bool2 = new TType(EbtBool, 2);
- TType *bool3 = new TType(EbtBool, 3);
- TType *bool4 = new TType(EbtBool, 4);
-
//
// Vector relational functions.
//
@@ -886,6 +896,8 @@
symbolTable.relateToOperator(ESSL3_BUILTINS, "min", EOpMin);
symbolTable.relateToOperator(ESSL3_BUILTINS, "max", EOpMax);
symbolTable.relateToOperator(ESSL3_BUILTINS, "clamp", EOpClamp);
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "isnan", EOpIsNan);
+ symbolTable.relateToOperator(ESSL3_BUILTINS, "isinf", EOpIsInf);
symbolTable.relateToOperator(ESSL3_BUILTINS, "floatBitsToInt", EOpFloatBitsToInt);
symbolTable.relateToOperator(ESSL3_BUILTINS, "floatBitsToUint", EOpFloatBitsToUint);