[Piglit] [PATCH] glsl-1.10: Test reductions of integer vectors

Ian Romanick idr at freedesktop.org
Tue Jun 24 19:15:13 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

Mesa has an optimization that converts expressions like "v.x + v.y + v.z
+ v.w" into dot(v, 1.0).  And therein lies the rub: the other operand to
the dot-product is always a float... even if the vector is an ivec or
uvec.  The result is not pretty:

    shader_runner: ../../src/glsl/ir_builder.cpp:257: ir_expression* ir_builder::dot(ir_builder::operand, ir_builder::operand): Assertion `a.val->type == b.val->type' failed.
    Aborted (core dumped)

NOTE: This test currently fails on Mesa.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Matt Turner <mattst88 at gmail.com>
---
 .../execution/vs-integer-reduction.shader_test     | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/execution/vs-integer-reduction.shader_test

diff --git a/tests/spec/glsl-1.10/execution/vs-integer-reduction.shader_test b/tests/spec/glsl-1.10/execution/vs-integer-reduction.shader_test
new file mode 100644
index 0000000..b30337b
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-integer-reduction.shader_test
@@ -0,0 +1,28 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform ivec4 v;
+varying vec4 color;
+
+void main()
+{
+	int i = v.x + v.y + v.z + v.w;
+
+	color = (i == 27) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[test]
+uniform ivec4 v -2 -1 25 5
+
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 1
-- 
1.8.1.4



More information about the Piglit mailing list