summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-10-23 10:53:17 -0400
committerYong He <yonghe@outlook.com>2017-10-23 10:53:17 -0400
commitc8bda84077a73564e3ac05d8b886632b2b2561be (patch)
tree9ff6039902ef3c9ab94f04398ba3541dc8c92b07
parent4d6be3588ac5b5b62e19900b12de90ce1e1ff744 (diff)
fix compute shader test result comparison
-rw-r--r--tests/compute/generics-simple.slang.expected.txt8
-rw-r--r--tools/slang-test/main.cpp12
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/compute/generics-simple.slang.expected.txt b/tests/compute/generics-simple.slang.expected.txt
index fdaa30664..98798bd61 100644
--- a/tests/compute/generics-simple.slang.expected.txt
+++ b/tests/compute/generics-simple.slang.expected.txt
@@ -1,4 +1,4 @@
-0.0
-1.0
-2.0
-3.0 \ No newline at end of file
+0
+3F800000
+40000000
+40400000 \ No newline at end of file
diff --git a/tools/slang-test/main.cpp b/tools/slang-test/main.cpp
index 676cb6875..cdea6b4dc 100644
--- a/tools/slang-test/main.cpp
+++ b/tools/slang-test/main.cpp
@@ -1168,8 +1168,16 @@ TestResult doComputeComparisonTestRunImpl(TestInput& input, const char * langOpt
{
auto reference = referenceProgramOutput[i];
auto actual = actualProgramOutput[i];
- if (actual != reference)
- return kTestResult_Fail;
+ if (actual != reference)
+ {
+ // try to parse reference as float, and compare again
+ auto val = StringToFloat(reference);
+ auto uval = String((unsigned int)FloatAsInt(val), 16).ToUpper();
+ if (actual != uval)
+ return kTestResult_Fail;
+ else
+ return kTestResult_Pass;
+ }
}
return kTestResult_Pass;
}