[Piglit] [PATCH] arb_separate_shader_objects: test explicit locations work correctly for interface blocks
Timothy Arceri
timothy.arceri at collabora.com
Tue Jan 5 20:30:45 PST 2016
Test results:
Nvidia GeForce 840M - NVIDIA 352.41
layout-location-block-with-aoa-member.shader_test - pass
layout-location-block-with-single-line-declaration-members.shader_test - fail
layout-location-block-with-struct-member.shader_test - pass
Mesa (master)
layout-location-block-with-aoa-member.shader_test - fail
layout-location-block-with-single-line-declaration-members.shader_test - pass
layout-location-block-with-struct-member.shader_test - fail
---
...yout-location-block-with-aoa-member.shader_test | 80 ++++++++++++++++++++++
...ith-single-line-declaration-members.shader_test | 76 ++++++++++++++++++++
...t-location-block-with-struct-member.shader_test | 76 ++++++++++++++++++++
3 files changed, 232 insertions(+)
create mode 100644 tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-aoa-member.shader_test
create mode 100644 tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-single-line-declaration-members.shader_test
create mode 100644 tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-struct-member.shader_test
diff --git a/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-aoa-member.shader_test b/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-aoa-member.shader_test
new file mode 100644
index 0000000..d32a5b5
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-aoa-member.shader_test
@@ -0,0 +1,80 @@
+// Test that inputs and outputs are not assigned overlapping locations when
+// using interface blocks and explicit locations.
+
+[require]
+GLSL >= 1.50
+GL_ARB_separate_shader_objects
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_separate_shader_objects: require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) out block {
+ vec4 a[2][2];
+ vec4 b;
+};
+
+void main()
+{
+ a[0][0] = vec4(1.0, 0.0, 0.0, 1.0);
+ a[0][1] = vec4(0.0, 1.0, 0.0, 1.0);
+ a[1][0] = vec4(0.0, 0.0, 1.0, 1.0);
+ a[1][1] = vec4(1.0, 0.0, 1.0, 1.0);
+ b = vec4(1.0, 1.0, 1.0, 1.0);
+
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(location = 0) in block {
+ vec4 a[2][2];
+ vec4 b;
+};
+
+uniform int i;
+
+out vec4 color;
+
+void main()
+{
+ if (i < 4)
+ color = a[i/2][int(mod(i, 2))];
+ else
+ color = b;
+}
+
+[test]
+uniform int i 0
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int i 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int i 2
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int i 3
+draw rect -1 -0.5 1 0.5
+
+# shader runner has a window size of 250 * 250 so we need to tweak our
+# probe values to work around this.
+relative probe rect rgb (0.0, 0.3, 0.5, 0.20) (1.0, 0.0, 1.0)
+
+uniform int i 4
+draw rect -1 -1 1 0.5
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.25) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-single-line-declaration-members.shader_test b/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-single-line-declaration-members.shader_test
new file mode 100644
index 0000000..bb7714c
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-single-line-declaration-members.shader_test
@@ -0,0 +1,76 @@
+// Test that inputs and outputs are not assigned overlapping locations when
+// using interface blocks and explicit locations.
+
+[require]
+GLSL >= 1.50
+GL_ARB_separate_shader_objects
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_separate_shader_objects: require
+
+in vec4 piglit_vertex;
+
+layout(location = 0) out block {
+ vec4 a, b, c;
+ vec4 d;
+};
+
+void main()
+{
+ a = vec4(1.0, 0.0, 0.0, 1.0);
+ b = vec4(0.0, 1.0, 0.0, 1.0);
+ c = vec4(0.0, 0.0, 1.0, 1.0);
+ d = vec4(1.0, 1.0, 1.0, 1.0);
+
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(location = 0) in block {
+ vec4 a, b, c;
+ vec4 d;
+};
+
+uniform int i;
+
+out vec4 color;
+
+void main()
+{
+ if (i == 0)
+ color = a;
+ else if (i == 1)
+ color = b;
+ else if (i == 2)
+ color = c;
+ else if (i == 3)
+ color = d;
+}
+
+[test]
+uniform int i 0
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int i 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int i 2
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int i 3
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-struct-member.shader_test b/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-struct-member.shader_test
new file mode 100644
index 0000000..2346a88
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/execution/layout-location-block-with-struct-member.shader_test
@@ -0,0 +1,76 @@
+// Test that inputs and outputs are not assigned overlapping locations when
+// using interface blocks and explicit locations.
+
+[require]
+GLSL >= 1.50
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 150
+#extension GL_ARB_separate_shader_objects: require
+
+in vec4 piglit_vertex;
+
+struct S {
+ vec4 a;
+ vec4 b;
+};
+
+layout(location = 0) out block {
+ S s;
+ vec4 c;
+};
+
+void main()
+{
+ s.a = vec4(1.0, 0.0, 0.0, 1.0);
+ s.b = vec4(0.0, 1.0, 0.0, 1.0);
+ c = vec4(1.0, 1.0, 1.0, 1.0);
+
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_separate_shader_objects: require
+
+struct S {
+ vec4 a;
+ vec4 b;
+};
+
+layout(location = 0) in block {
+ S s;
+ vec4 c;
+};
+
+uniform int i;
+
+out vec4 color;
+
+void main()
+{
+ if (i == 0)
+ color = s.a;
+ else if (i == 1)
+ color = s.b;
+ else
+ color = c;
+}
+
+[test]
+uniform int i 0
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int i 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int i 2
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
+
--
2.4.3
More information about the Piglit
mailing list