[Piglit] [PATCH 2/2] arb_compute_shader: A simple CS test with SSBO
Chris Forbes
chrisf at ijw.co.nz
Wed Sep 30 01:12:49 PDT 2015
Looks correct -- exercises reads and writes, and only works if std430's
tighter packing works.
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
On Wed, Sep 30, 2015 at 1:10 PM, Jordan Justen <jordan.l.justen at intel.com>
wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
> .../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
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150930/47e05007/attachment.html>
More information about the Piglit
mailing list