[Piglit] [PATCH 2/3] arb_uniform_buffer_object: Add test for row-major matrix inside array of struct

Ian Romanick idr at freedesktop.org
Wed Sep 10 15:17:40 PDT 2014


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

NOTE: On Mesa we get the correct locations, but the shader doesn't
generate the correct results.  The test fails.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83506
---
 ...major-matrix-inside-array-of-struct.shader_test | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 tests/spec/arb_uniform_buffer_object/row-major-matrix-inside-array-of-struct.shader_test

diff --git a/tests/spec/arb_uniform_buffer_object/row-major-matrix-inside-array-of-struct.shader_test b/tests/spec/arb_uniform_buffer_object/row-major-matrix-inside-array-of-struct.shader_test
new file mode 100644
index 0000000..2985e49
--- /dev/null
+++ b/tests/spec/arb_uniform_buffer_object/row-major-matrix-inside-array-of-struct.shader_test
@@ -0,0 +1,54 @@
+[require]
+GLSL >= 1.30
+GL_ARB_uniform_buffer_object
+
+[vertex shader]
+#extension GL_ARB_uniform_buffer_object: require
+
+/* Setting the COLUMN_MAJOR define will cause the test to pass.  The problem
+ * appears to be that the i965 backend generates the load of s[1].bv2.x from
+ * offset 80 even when m41_1 is row-major.  When m41_1 is row-major,
+ * s[1].bv2.x should be at offset 64.  This is correctly reported via the GL
+ * API.
+ */
+//#define COLUMN_MAJOR
+
+struct S {
+    bvec2       bv2;
+    mat4x2      m42_1;
+};
+
+layout(std140
+#ifndef COLUMN_MAJOR
+       , row_major
+#endif
+      ) uniform UB1 {
+    S[2] s;
+};
+
+flat out int vertex_pass;
+in vec4 piglit_vertex;
+
+void main()
+{
+    vertex_pass = int(s[1].bv2.x);
+    gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+out vec4 piglit_fragcolor;
+flat in int vertex_pass;
+
+void main()
+{
+    piglit_fragcolor = vec4(1 - vertex_pass, vertex_pass, 0, 1);
+}
+
+[test]
+active uniform s[1].m42_1 GL_UNIFORM_OFFSET 64
+active uniform s[1].m42_1 GL_UNIFORM_IS_ROW_MAJOR 1
+
+uniform ivec2 s[1].bv2 1 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.1.4



More information about the Piglit mailing list