[Piglit] [PATCH 2/2] arb_gpu_shader5: Test variable UBO indexing under non-uniform control flow.
Francisco Jerez
currojerez at riseup.net
Thu Feb 19 07:55:55 PST 2015
Both the FS and VS cases currently fail on Intel hardware with the i965 driver.
---
.../fs-nonuniform-control-flow.shader_test | 96 +++++++++++++
.../vs-nonuniform-control-flow.shader_test | 160 +++++++++++++++++++++
2 files changed, 256 insertions(+)
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-nonuniform-control-flow.shader_test
create mode 100644 tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow.shader_test
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-nonuniform-control-flow.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-nonuniform-control-flow.shader_test
new file mode 100644
index 0000000..d4a68d3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-nonuniform-control-flow.shader_test
@@ -0,0 +1,96 @@
+# The spec requires UBO array indexing expressions to be dynamically
+# uniform, as defined in section 3.8.3 of the GLSL 4.50 specification:
+#
+# "A fragment-shader expression is dynamically uniform if all
+# fragments evaluating it get the same resulting value. [...] This
+# is similarly defined for other shader stages, based on the
+# per-instance data they process."
+#
+# This however doesn't have any implications on the control flow that
+# leads to the evaluation of that expression being uniform, so it's
+# easy to get wrong. This test verifies that dynamically uniform UBO
+# indexing expressions are evaluated correctly in the fragment shader
+# under non-uniform control flow.
+#
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color;
+} arr[4];
+
+uniform int n;
+
+out vec4 color;
+
+void main()
+{
+ vec4 v = vec4(0);
+
+ if (int(gl_FragCoord.x) % 2 != int(gl_FragCoord.y) % 3) {
+ for (uint i = 0; i < 4; ++i)
+ v[i] = arr[(n + i) % 4u].color.x;
+ }
+
+ color = v;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color 0.2 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color 0.4 0.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color 0.6 0.0 0.0 0.0
+ubo array index 3
+uniform vec4 block.color 0.8 0.0 0.0 0.0
+
+uniform int n 1
+draw rect -1 -1 1 1
+
+# This is likely to give the expected result for some fragments even
+# if the implementation doesn't take this possibility into account.
+# Probe a bunch of pixels for good measure.
+#
+probe rgba 1 0 0.4 0.6 0.8 0.2
+probe rgba 3 0 0.4 0.6 0.8 0.2
+probe rgba 5 0 0.4 0.6 0.8 0.2
+probe rgba 7 0 0.4 0.6 0.8 0.2
+probe rgba 0 1 0.4 0.6 0.8 0.2
+probe rgba 2 1 0.4 0.6 0.8 0.2
+probe rgba 4 1 0.4 0.6 0.8 0.2
+probe rgba 6 1 0.4 0.6 0.8 0.2
+probe rgba 0 2 0.4 0.6 0.8 0.2
+probe rgba 1 2 0.4 0.6 0.8 0.2
+probe rgba 2 2 0.4 0.6 0.8 0.2
+probe rgba 3 2 0.4 0.6 0.8 0.2
+probe rgba 4 2 0.4 0.6 0.8 0.2
+probe rgba 5 2 0.4 0.6 0.8 0.2
+probe rgba 6 2 0.4 0.6 0.8 0.2
+probe rgba 7 2 0.4 0.6 0.8 0.2
+probe rgba 1 3 0.4 0.6 0.8 0.2
+probe rgba 3 3 0.4 0.6 0.8 0.2
+probe rgba 5 3 0.4 0.6 0.8 0.2
+probe rgba 7 3 0.4 0.6 0.8 0.2
+probe rgba 0 4 0.4 0.6 0.8 0.2
+probe rgba 2 4 0.4 0.6 0.8 0.2
+probe rgba 4 4 0.4 0.6 0.8 0.2
+probe rgba 6 4 0.4 0.6 0.8 0.2
+probe rgba 0 5 0.4 0.6 0.8 0.2
+probe rgba 1 5 0.4 0.6 0.8 0.2
+probe rgba 2 5 0.4 0.6 0.8 0.2
+probe rgba 3 5 0.4 0.6 0.8 0.2
+probe rgba 4 5 0.4 0.6 0.8 0.2
+probe rgba 5 5 0.4 0.6 0.8 0.2
+probe rgba 6 5 0.4 0.6 0.8 0.2
+probe rgba 7 5 0.4 0.6 0.8 0.2
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow.shader_test
new file mode 100644
index 0000000..af0a894
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow.shader_test
@@ -0,0 +1,160 @@
+# The spec requires UBO array indexing expressions to be dynamically
+# uniform, as defined in section 3.8.3 of the GLSL 4.50 specification:
+#
+# "A fragment-shader expression is dynamically uniform if all
+# fragments evaluating it get the same resulting value. [...] This
+# is similarly defined for other shader stages, based on the
+# per-instance data they process."
+#
+# This however doesn't have any implications on the control flow that
+# leads to the evaluation of that expression being uniform, so it's
+# easy to get wrong. This test verifies that dynamically uniform UBO
+# indexing expressions are evaluated correctly in the vertex shader
+# under non-uniform control flow.
+#
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+uniform block {
+ vec4 color;
+} arr[4];
+
+uniform uint n;
+
+in vec4 vertex;
+out vec4 color;
+
+void main()
+{
+ vec4 v = vec4(0);
+
+ if (int(round(10 * vertex.x)) % 2 != int(round(10 * vertex.y)) % 3) {
+ for (uint i = 0; i < 4; ++i)
+ v[i] = arr[(n + i) % 4u].color.x;
+ }
+
+ gl_Position = vec4(-1 + 1.0 / 250.0 + vertex.x * 2,
+ -1 + 1.0 / 250.0 + vertex.y * 2,
+ 0, 1);
+ color = v;
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+ out_color = color;
+}
+
+[vertex data]
+vertex/float/3
+0.0 0.0 0.0
+0.0 0.1 0.0
+0.0 0.2 0.0
+0.0 0.3 0.0
+0.0 0.4 0.0
+0.0 0.5 0.0
+0.1 0.0 0.0
+0.1 0.1 0.0
+0.1 0.2 0.0
+0.1 0.3 0.0
+0.1 0.4 0.0
+0.1 0.5 0.0
+0.2 0.0 0.0
+0.2 0.1 0.0
+0.2 0.2 0.0
+0.2 0.3 0.0
+0.2 0.4 0.0
+0.2 0.5 0.0
+0.3 0.0 0.0
+0.3 0.1 0.0
+0.3 0.2 0.0
+0.3 0.3 0.0
+0.3 0.4 0.0
+0.3 0.5 0.0
+0.4 0.0 0.0
+0.4 0.1 0.0
+0.4 0.2 0.0
+0.4 0.3 0.0
+0.4 0.4 0.0
+0.4 0.5 0.0
+0.5 0.0 0.0
+0.5 0.1 0.0
+0.5 0.2 0.0
+0.5 0.3 0.0
+0.5 0.4 0.0
+0.5 0.5 0.0
+0.6 0.0 0.0
+0.6 0.1 0.0
+0.6 0.2 0.0
+0.6 0.3 0.0
+0.6 0.4 0.0
+0.6 0.5 0.0
+0.7 0.0 0.0
+0.7 0.1 0.0
+0.7 0.2 0.0
+0.7 0.3 0.0
+0.7 0.4 0.0
+0.7 0.5 0.0
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ubo array index 0
+uniform vec4 block.color 0.2 0.0 0.0 0.0
+ubo array index 1
+uniform vec4 block.color 0.4 0.0 0.0 0.0
+ubo array index 2
+uniform vec4 block.color 0.6 0.0 0.0 0.0
+ubo array index 3
+uniform vec4 block.color 0.8 0.0 0.0 0.0
+
+uniform uint n 1
+draw arrays GL_POINTS 0 48
+
+# This is likely to give the expected result for some vertices even if
+# the implementation doesn't take this possibility into account.
+# Probe a bunch of pixels for good measure.
+#
+relative probe rgba (0.1, 0.0) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.3, 0.0) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.5, 0.0) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.7, 0.0) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.0, 0.1) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.2, 0.1) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.4, 0.1) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.6, 0.1) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.0, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.1, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.2, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.3, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.4, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.5, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.6, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.7, 0.2) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.1, 0.3) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.3, 0.3) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.5, 0.3) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.7, 0.3) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.0, 0.4) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.2, 0.4) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.4, 0.4) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.6, 0.4) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.0, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.1, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.2, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.3, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.4, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.5, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.6, 0.5) (0.4, 0.6, 0.8, 0.2)
+relative probe rgba (0.7, 0.5) (0.4, 0.6, 0.8, 0.2)
--
2.1.3
More information about the Piglit
mailing list