[Piglit] [PATCH] arb_enhanced_layouts: test packing of floats in the same slots as an array

Timothy Arceri tarceri at itsqueeze.com
Tue Oct 10 06:52:57 UTC 2017


This test causes an assert to be thrown on i965 currently.
---
 ...fs-array-interleave-single-location.shader_test | 93 ++++++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave-single-location.shader_test

diff --git a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave-single-location.shader_test b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave-single-location.shader_test
new file mode 100644
index 000000000..43b6a05e8
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-to-fs-array-interleave-single-location.shader_test
@@ -0,0 +1,93 @@
+# Test for successful interleaving of components in arrays with a single float
+# 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;
+layout(location = 1, component = 3) out float c;
+layout(location = 2, component = 3) out float d;
+layout(location = 3, component = 3) out float e;
+layout(location = 4, component = 3) out float f;
+layout(location = 5, component = 3) out float g;
+
+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 = 6.0;
+  c = 7.0;
+  d = 8.0;
+  e = 9.0;
+  f = 10.0;
+  g = 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;
+layout(location = 1, component = 3) in float c;
+layout(location = 2, component = 3) in float d;
+layout(location = 3, component = 3) in float e;
+layout(location = 4, component = 3) in float f;
+layout(location = 5, component = 3) in float g;
+
+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);
+  }
+
+    if (b != 6.0)
+      color = vec4(0, 1, 0, 1);
+
+    if (c != 7.0)
+      color = vec4(0, 1, 0, 1);
+
+    if (d != 8.0)
+      color = vec4(0, 1, 0, 1);
+
+    if (e != 9.0)
+      color = vec4(0, 1, 0, 1);
+
+    if (f != 10.0)
+      color = vec4(0, 1, 0, 1);
+
+    if (g != 11.0)
+      color = vec4(0, 1, 0, 1);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 1 0 0
-- 
2.13.6



More information about the Piglit mailing list