arb_enhanced_layouts: test packing of floats in the same slots as an array

Submitted by Timothy Arceri on Oct. 10, 2017, 6:52 a.m.

Details

Message ID 20171010065257.25802-1-tarceri@itsqueeze.com
State New
Headers show
Series "arb_enhanced_layouts: test packing of floats in the same slots as an array" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Timothy Arceri Oct. 10, 2017, 6:52 a.m.
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

Patch hide | download patch | download mbox

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

Comments

It's traditional for green to mean good, red to mean bad. You have those
flipped here.

On Oct 10, 2017 2:58 AM, "Timothy Arceri" <tarceri@itsqueeze.com> wrote:

> 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
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
On 10/10/17 23:39, Ilia Mirkin wrote:
> It's traditional for green to mean good, red to mean bad. You have those 
> flipped here.

Right. I'd fixed this locally but forgot to commit before sending.

> 
> On Oct 10, 2017 2:58 AM, "Timothy Arceri" <tarceri@itsqueeze.com 
> <mailto:tarceri@itsqueeze.com>> wrote:
> 
>     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
> 
>     _______________________________________________
>     Piglit mailing list
>     Piglit@lists.freedesktop.org <mailto:Piglit@lists.freedesktop.org>
>     https://lists.freedesktop.org/mailman/listinfo/piglit
>     <https://lists.freedesktop.org/mailman/listinfo/piglit>
>