[Piglit] [PATCH 3/6] arb_gpu_shader_fp64: add a truncate DBL_MAX test

Dave Airlie airlied at gmail.com
Wed Jul 23 15:56:54 PDT 2014


From: Dave Airlie <airlied at redhat.com>

This just tests that trunc doesn't go via a float conversion
like I was doing when I wrote it originally.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 .../fs-trunc-double-large.shader_test              | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-trunc-double-large.shader_test

diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-trunc-double-large.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-trunc-double-large.shader_test
new file mode 100644
index 0000000..716fcaa
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-trunc-double-large.shader_test
@@ -0,0 +1,39 @@
+# test truncating a double holds precision
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#version 150
+in vec4 vertex;
+void main()
+{
+        gl_Position = vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+uniform double arg0;
+uniform double tolerance;
+uniform double expected;
+
+void main()
+{
+  double result = trunc(arg0);
+  gl_FragColor = distance(result, expected) <= tolerance ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform double arg0 1.7976931348623157E+308
+uniform double expected 1.7976931348623157E+308
+uniform double tolerance 2.0000000000000002e-05
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.0 1.0 0.0 1.0
-- 
1.8.5.3



More information about the Piglit mailing list