[Piglit] [PATCH] ARB_shader_bit_encoding: add a test which exercises an nvidia bug
Brian Paul
brianp at vmware.com
Tue Jun 10 07:47:55 PDT 2014
With nvidia's 325.15 driver (at least) the GLSL compiler generates invalid
code.
---
tests/all.py | 8 ++++
.../execution/and-clamp.shader_test | 43 ++++++++++++++++++++
2 files changed, 51 insertions(+)
create mode 100644 tests/spec/arb_shader_bit_encoding/execution/and-clamp.shader_test
diff --git a/tests/all.py b/tests/all.py
index 3830013..59ca861 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1815,6 +1815,14 @@ add_plain_test(arb_robustness, 'arb_robustness_client-mem-bounds')
# TODO: robust vertex buffer access
#add_plain_test(arb_robustness, 'arb_robustness_draw-vbo-bounds')
+# Group ARB_shader_bit_encoding
+arb_shader_bit_encoding = {}
+spec['ARB_shader_bit_encoding'] = arb_shader_bit_encoding
+arb_shader_bit_encoding['execution'] = {}
+add_shader_test_dir(arb_shader_bit_encoding['execution'],
+ os.path.join(testsDir, 'spec', 'arb_shader_bit_encoding', 'execution'),
+ recursive=True)
+
# Group ARB_shader_texture_lod
arb_shader_texture_lod = {}
spec['ARB_shader_texture_lod'] = arb_shader_texture_lod
diff --git a/tests/spec/arb_shader_bit_encoding/execution/and-clamp.shader_test b/tests/spec/arb_shader_bit_encoding/execution/and-clamp.shader_test
new file mode 100644
index 0000000..f450eb0
--- /dev/null
+++ b/tests/spec/arb_shader_bit_encoding/execution/and-clamp.shader_test
@@ -0,0 +1,43 @@
+[require]
+GLSL >= 1.30
+GL_ARB_shader_bit_encoding
+
+[vertex shader]
+#version 130
+#extension GL_ARB_shader_bit_encoding : enable
+
+// nvidia's 325.15 driver (and other versions) generate an invalid
+// AND.U.SAT instruction for the bit-wise AND followed by a clamp/saturate.
+
+in vec4 piglit_vertex;
+out vec4 color;
+uniform vec4 x, y;
+
+vec4 and(vec4 v0, vec4 v1)
+{
+ return uintBitsToFloat(floatBitsToUint(v0) & floatBitsToUint(v1));
+}
+
+void main()
+{
+ gl_Position = piglit_vertex;
+ vec4 r = and(x, y);
+ color = clamp(r, 0.0, 1.0);
+}
+
+[fragment shader]
+#version 130
+in vec4 color;
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+ortho
+uniform vec4 x 0.0 .25 .50. .75
+uniform vec4 y 0.0 .25 .50. .75
+draw rect -1 -1 2 2
+probe rgba 2 2 0.0 .25 .50. .75
--
1.7.10.4
More information about the Piglit
mailing list