[Piglit] [PATCH] glsl-3.30: Add a coverage test for bitcasting functions.

Kenneth Graunke kenneth at whitecape.org
Fri Aug 23 16:57:01 PDT 2013


This ensures that the bitcasting functions are available in 3.30 without
having to use #extension GL_ARB_shader_bit_encoding: require.

Serious functional testing of those functions is left to Matt's thorough
generated tests for the GL_ARB_shader_bit_encoding extension.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 .../shader-bit-encoding-coverage.shader_test       | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 tests/spec/glsl-3.30/execution/shader-bit-encoding-coverage.shader_test

diff --git a/tests/spec/glsl-3.30/execution/shader-bit-encoding-coverage.shader_test b/tests/spec/glsl-3.30/execution/shader-bit-encoding-coverage.shader_test
new file mode 100644
index 0000000..152203e
--- /dev/null
+++ b/tests/spec/glsl-3.30/execution/shader-bit-encoding-coverage.shader_test
@@ -0,0 +1,44 @@
+# In GLSL 3.30, ARB_shader_bit_encoding functionality is now part of the main
+# spec, so shaders no longer have to enable the extension.  This essentially
+# just checks that all the functions are there, but leaves the real testing
+# to the extension tests.
+#
+[require]
+GLSL >= 3.30
+
+[vertex shader]
+#version 330
+
+in vec4 vertex;
+
+out float v;
+
+void main()
+{
+    v = uintBitsToFloat(floatBitsToUint(intBitsToFloat(floatBitsToInt(0.3))));
+    gl_Position = vertex;
+}
+
+[fragment shader]
+#version 330
+
+in float v;
+
+void main()
+{
+    float f;
+    f = uintBitsToFloat(floatBitsToUint(intBitsToFloat(floatBitsToInt(0.7))));
+    gl_FragColor = vec4(0.0, f + v, 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]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
+
-- 
1.8.3.4



More information about the Piglit mailing list