Looks correct -- exercises reads and writes, and only works if std430's
tighter packing works.

Reviewed-by: Chris Forbes <[email protected]>

On Wed, Sep 30, 2015 at 1:10 PM, Jordan Justen <[email protected]>
wrote:

> Signed-off-by: Jordan Justen <[email protected]>
> ---
>  .../execution/basic-ssbo.shader_test               | 74
> ++++++++++++++++++++++
>  1 file changed, 74 insertions(+)
>  create mode 100644
> tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
>
> diff --git
> a/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
> b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
> new file mode 100644
> index 0000000..4bf7e1c
> --- /dev/null
> +++ b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
> @@ -0,0 +1,74 @@
> +[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)
> +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 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.5.1
>
> _______________________________________________
> Piglit mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to