summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2020-01-07 10:27:36 -0800
committerEric Anholt <eric@anholt.net>2020-02-20 13:48:56 -0800
commitb85ddb8d7de79bb956ac7399a22767e19e866caf (patch)
treebecd25e59645a535578ae8204e109ea5f3000433
parent72aaa713bde32a8d2f5f41828344e82fc2baefb9 (diff)
arb_shader_atomic_counters: Add a test for sparsely-used bindings.
Derived from fs-layout, this should hopefully catch the regression I temporarily had in the ssbo-numbering series on the old CTS, which the new CTS didn't find. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/piglit/merge_requests/206> Part-of: <https://gitlab.freedesktop.org/mesa/piglit/merge_requests/206>
-rw-r--r--tests/spec/arb_shader_atomic_counters/execution/sparse-binding.shader_test66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/spec/arb_shader_atomic_counters/execution/sparse-binding.shader_test b/tests/spec/arb_shader_atomic_counters/execution/sparse-binding.shader_test
new file mode 100644
index 000000000..0ac55c394
--- /dev/null
+++ b/tests/spec/arb_shader_atomic_counters/execution/sparse-binding.shader_test
@@ -0,0 +1,66 @@
+# Test handling of atomic counters with sparse and reordered bindings.
+# Drivers may compact sparse bindings in their descriptors or not, and it's
+# easy to break since sparse bindings are uncommon (the CTS used to incidentally
+# test this, but in 1d7f9648eada ("Use binding 0 for atomic counter buffers")
+# it stopped).
+
+[require]
+GLSL >= 1.40
+GL_ARB_shader_atomic_counters
+INT GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS >= 3
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 140
+#extension GL_ARB_shader_atomic_counters: require
+
+layout(binding = 2, offset = 4) uniform atomic_uint b;
+layout(binding = 1, offset = 0) uniform atomic_uint a[2];
+
+uniform uint a0_expected;
+uniform uint a1_expected;
+uniform uint b_expected;
+uniform uint idx;
+
+out vec4 color;
+
+void main()
+{
+ uint old_a0 = atomicCounterIncrement(a[0]);
+ uint old_a1 = atomicCounterIncrement(a[idx]);
+ uint old_b = atomicCounterIncrement(b);
+
+ if (old_a0 != a0_expected) {
+ color = vec4(1.0, 0.0, float(old_a0) / 255.0, 1.0);
+ return;
+ }
+ if (old_a1 != a1_expected) {
+ color = vec4(1.0, 0.1, float(old_a1) / 255.0, 1.0);
+ return;
+ }
+ if (old_b != b_expected) {
+ color = vec4(1.0, 0.2, float(old_b) / 255.0, 1.0);
+ return;
+ }
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+atomic counter buffer 1 2
+atomic counter buffer 2 2
+
+clear color 0.0 0.0 0.0 0.0
+clear
+
+atomic counter 1 0 17
+atomic counter 1 1 31
+atomic counter 2 1 4
+
+uniform uint a0_expected 17
+uniform uint a1_expected 31
+uniform uint b_expected 4
+uniform uint idx 1
+
+draw rect ortho 0 0 1 1
+probe rgba 0 0 0.0 1.0 0.0 1.0