[Piglit] [PATCH 22/23] arb_shading_language_420pack: Test initialized matrices are identical

Matt Turner mattst88 at gmail.com
Sat Jun 29 19:43:15 PDT 2013


---
 .../aggregate-initializer-matrix.shader_test       | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-matrix.shader_test

diff --git a/tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-matrix.shader_test b/tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-matrix.shader_test
new file mode 100644
index 0000000..ddb2297
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/execution/aggregate-initializer-matrix.shader_test
@@ -0,0 +1,56 @@
+/* The ARB_shading_language_420pack suggests:
+ *
+ *     Verify that the following three matrices are identical:
+ *
+ *         mat2x2 a = mat2(  vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) );
+ *         mat2x2 b =      { vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) };
+ *         mat2x2 c =      {     { 1.0, 0.0 },     { 0.0, 1.0 } };
+ */
+
+[require]
+GLSL >= 1.30
+GL_ARB_shading_language_420pack
+
+[vertex shader]
+#extension GL_ARB_shading_language_420pack: enable
+
+in vec4 vertex;
+out vec4 color;
+
+void main()
+{
+    mat2x2 a = mat2(  vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) );
+    mat2x2 b =      { vec2( 1.0, 0.0 ), vec2( 0.0, 1.0 ) };
+    mat2x2 c =      {     { 1.0, 0.0 },     { 0.0, 1.0 } };
+
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+
+    if (a.length() != b.length() || a.length() != c.length()) {
+        color = vec4(0.0, 0.0, 1.0, 1.0);
+    } else {
+        for (int i = 0; i < a.length(); i++) {
+            if (a[i] != b[i] || a[i] != c[i]) {
+                color = vec4(1.0, 0.0, 0.0, 1.0);
+            }
+        }
+    }
+    gl_Position = vertex;
+}
+
+[fragment shader]
+in vec4 color;
+
+void main() {
+    gl_FragColor = color;;
+}
+
+[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.1.5



More information about the Piglit mailing list