[Piglit] [PATCH 4/8] arb_enhanced_layouts: basic component layout execution tests

Timothy Arceri timothy.arceri at collabora.com
Sun Nov 29 14:19:53 PST 2015


---
 .../vs-to-fs-array-interleave.shader_test          | 70 ++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave.shader_test

diff --git a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave.shader_test b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave.shader_test
new file mode 100644
index 0000000..f2944b9
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave.shader_test
@@ -0,0 +1,70 @@
+# Test for successful interleaving of components in two arrays between vertex
+# and fragment shaders.
+
+[require]
+GLSL >= 1.40
+GL_ARB_enhanced_layouts
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) out vec3 a[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) out float b[6];
+
+in vec4 piglit_vertex;
+
+void main()
+{
+  a[0] = vec3(0.0);
+  a[1] = vec3(1.0);
+  a[2] = vec3(2.0);
+  a[3] = vec3(3.0);
+  a[4] = vec3(4.0);
+  a[5] = vec3(5.0);
+  b[0] = 6.0;
+  b[1] = 7.0;
+  b[2] = 8.0;
+  b[3] = 9.0;
+  b[4] = 10.0;
+  b[5] = 11.0;
+
+  gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+out vec4 color;
+
+// consume X/Y/Z components of 6 vectors
+layout(location = 0) in vec3 a[6];
+
+// consumes W component of 6 vectors
+layout(location = 0, component = 3) in float b[6];
+
+void main()
+{
+  color = vec4(1, 0, 0, 1);
+
+  for (int i = 0; i < 6; i++) {
+    if (a[i] != vec3(float(i)))
+      color = vec4(0, 1, 0, 1);
+  }
+
+  for (int i = 6; i < 12; i++) {
+    if (b[i-6] != float(i))
+      color = vec4(0, 1, 0, 1);
+  }
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 1 0 0
-- 
2.4.3



More information about the Piglit mailing list