From: Arcady Goldmints-Orlov <agoldmi...@igalia.com> The difference with arb_compute_shader/execution/basic-ssbo.shader_test is that we explicitly assign a binding to the SSBO. Without a binding number specified, glslang implicitly assigns a binding number of 1 to the SSBO, while Mesa assigns a binding number of 0. To ensure the test runs consistently in both cases, assign the binding explicitly. --- .../execution/cs-basic-ssbo.shader_test | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 tests/spec/arb_gl_spirv/execution/cs-basic-ssbo.shader_test
diff --git a/tests/spec/arb_gl_spirv/execution/cs-basic-ssbo.shader_test b/tests/spec/arb_gl_spirv/execution/cs-basic-ssbo.shader_test new file mode 100644 index 000000000..2f286f3f6 --- /dev/null +++ b/tests/spec/arb_gl_spirv/execution/cs-basic-ssbo.shader_test @@ -0,0 +1,82 @@ +# This is copied from arb_compute_shader/execution/basic-ssbo.shader_test +# +# The difference is that we explicitly assign a binding to the SSBO. +# Without a binding number specified, glslang implicitly assigns a +# binding number of 1 to the SSBO, while Mesa assigns a binding number +# of 0. To ensure the test runs consistently in both cases, assign the +# binding explicitly. + +[require] +GLSL >= 3.30 +GL_ARB_compute_shader +GL_ARB_shader_storage_buffer_object +GL_ARB_shader_atomic_counters + +[compute shader] +#version 330 +#extension GL_ARB_compute_shader: enable +#extension GL_ARB_shader_storage_buffer_object: require +#extension GL_ARB_shader_atomic_counters: require + +#define SIZE 256u + +layout(local_size_x = SIZE) in; + +layout(binding = 0) uniform atomic_uint counter; + +layout(std430, binding = 0) +buffer SSBO { + uint u[SIZE]; +}; + +uniform uint mode; + +void main() +{ + uint index = gl_LocalInvocationIndex; + + switch (mode) { + case 0u: + u[index] = SIZE; + break; + case 1u: + u[index] = index; + break; + case 2u: + if (u[index] == SIZE) + atomicCounterIncrement(counter); + break; + case 3u: + if (u[index] == index) + atomicCounterIncrement(counter); + break; + } +} + +[test] +atomic counters 1 +ssbo 0 1024 + +uniform uint mode 0 +compute 1 1 1 +probe atomic counter 0 == 0 + +uniform uint mode 3 +compute 1 1 1 +probe atomic counter 0 == 0 + +uniform uint mode 2 +compute 1 1 1 +probe atomic counter 0 == 256 + +uniform uint mode 1 +compute 1 1 1 +probe atomic counter 0 == 256 + +uniform uint mode 2 +compute 1 1 1 +probe atomic counter 0 == 256 + +uniform uint mode 3 +compute 1 1 1 +probe atomic counter 0 == 512 -- 2.19.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit