[Piglit] [PATCH 1/3] arb_arrays_of_arrays: add some atomic counter indirect indexing tests

Timothy Arceri t_arceri at yahoo.com.au
Mon Aug 3 01:43:55 PDT 2015


On Sun, 2015-08-02 at 10:22 -0400, Ilia Mirkin wrote:
> On Sun, Aug 2, 2015 at 8:04 AM, Timothy Arceri <t_arceri at yahoo.com.au> 
> wrote:
> > ---
> >  .../atomic_counters/fs-indirect-index.shader_test  | 72 
> > +++++++++++++++++++
> >  .../atomic_counters/vs-indirect-index.shader_test  | 82 
> > ++++++++++++++++++++++
> >  2 files changed, 154 insertions(+)
> >  create mode 100644 
> > tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect
> > -index.shader_test
> >  create mode 100644 
> > tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect
> > -index.shader_test
> > 
> > diff --git a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs
> > -indirect-index.shader_test 
> > b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect
> > -index.shader_test
> > new file mode 100644
> > index 0000000..0039855
> > --- /dev/null
> > +++ b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs
> > -indirect-index.shader_test
> > @@ -0,0 +1,72 @@
> > +# Simple test of accessing an atomic counter with dynamic indicies.
> > +#
> > +
> > +[require]
> > +GLSL >= 1.40
> > +GL_ARB_shader_atomic_counters
> > +GL_ARB_arrays_of_arrays
> > +INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2
> 
> why?

Because I copy an pasted :( the test in the vertex shader is still needed as
its allowed to be 0 by the spec (FS is required to be at least 1) but the test
only needs to be >= 1

I'll update these and the atomic counters value and send a v2
> 
> > +
> > +[vertex shader passthrough]
> > +
> > +[fragment shader]
> > +#version 140
> > +#extension GL_ARB_shader_atomic_counters: require
> > +#extension GL_ARB_arrays_of_arrays: require
> > +
> > +layout(binding = 0) uniform atomic_uint a0[2][4];
> > +
> > +uniform int n;
> > +uniform int m;
> > +
> > +in vec4 vcolor;
> > +out vec4 fcolor;
> > +
> > +void main()
> > +{
> > +       bool passed = true;
> > +       uint v0[12];
> > +       uint v1[12];
> > +
> > +       /* Get all initail values of a0 */
> > +       v0[0] = atomicCounter(a0[0][0]);
> > +       v0[1] = atomicCounter(a0[0][1]);
> > +       v0[2] = atomicCounter(a0[0][2]);
> > +       v0[3] = atomicCounter(a0[0][3]);
> > +       v0[4] = atomicCounter(a0[1][0]);
> > +       v0[5] = atomicCounter(a0[1][1]);
> > +       v0[6] = atomicCounter(a0[1][2]);
> > +       v0[7] = atomicCounter(a0[1][3]);
> > +
> > +       /* Test that incrementing, followed by a read of an atomic
> > +        * counter results in a larger value.
> > +        * Also test that all other array elements are unaffected. */
> > +       atomicCounterIncrement(a0[0][0]);
> > +       atomicCounterIncrement(a0[n][m]);
> > +       v1[0] = atomicCounter(a0[0][0]);
> > +       v1[1] = atomicCounter(a0[0][1]);
> > +       v1[2] = atomicCounter(a0[0][2]);
> > +       v1[3] = atomicCounter(a0[0][3]);
> > +       v1[4] = atomicCounter(a0[1][0]);
> > +       v1[5] = atomicCounter(a0[1][1]);
> > +       v1[6] = atomicCounter(a0[1][2]);
> > +       v1[7] = atomicCounter(a0[1][3]);
> > +       if(v1[0] <= v0[0] || v1[1] != v0[1] || v1[2] != v0[2] ||
> > +          v1[3] != v0[3] || v1[4] != v0[4] || v1[5] != v0[5] ||
> > +          v1[6] <= v0[6] || v1[7] != v0[7])
> > +               passed = false;
> > +
> > +       if (passed)
> > +               fcolor = vec4(0.0, 1.0, 0.0, 1.0);
> > +       else
> > +               fcolor = vec4(1.0, 0.0, 0.0, 1.0);
> > +}
> > +
> > +[test]
> > +atomic counters 2
> > +
> > +uniform int n 1
> > +uniform int m 2
> > +
> > +draw rect -1 -1 2 2
> > +probe all rgba 0.0 1.0 0.0 1.0
> > diff --git a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs
> > -indirect-index.shader_test 
> > b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect
> > -index.shader_test
> > new file mode 100644
> > index 0000000..cadba11
> > --- /dev/null
> > +++ b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs
> > -indirect-index.shader_test
> > @@ -0,0 +1,82 @@
> > +# Simple test of accessing an atomic counter with dynamic indicies.
> > +#
> > +
> > +[require]
> > +GLSL >= 1.40
> > +GL_ARB_shader_atomic_counters
> > +GL_ARB_arrays_of_arrays
> > +INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2
> > +
> > +[vertex shader]
> > +#version 140
> > +#extension GL_ARB_shader_atomic_counters: require
> > +#extension GL_ARB_arrays_of_arrays: require
> > +
> > +layout(binding = 0) uniform atomic_uint a0[2][4];
> > +
> > +uniform int n;
> > +uniform int m;
> > +
> > +in vec4 piglit_vertex;
> > +out vec4 vcolor;
> > +
> > +void main()
> > +{
> > +       bool passed = true;
> > +       uint v0[12];
> > +       uint v1[12];
> > +
> > +       /* Get all initail values of a0 */
> > +       v0[0] = atomicCounter(a0[0][0]);
> > +       v0[1] = atomicCounter(a0[0][1]);
> > +       v0[2] = atomicCounter(a0[0][2]);
> > +       v0[3] = atomicCounter(a0[0][3]);
> > +       v0[4] = atomicCounter(a0[1][0]);
> > +       v0[5] = atomicCounter(a0[1][1]);
> > +       v0[6] = atomicCounter(a0[1][2]);
> > +       v0[7] = atomicCounter(a0[1][3]);
> > +
> > +       /* Test that incrementing, followed by a read of an atomic
> > +        * counter results in a larger value.
> > +        * Also test that all other array elements are unaffected. */
> > +       atomicCounterIncrement(a0[0][0]);
> > +       atomicCounterIncrement(a0[n][m]);
> > +       v1[0] = atomicCounter(a0[0][0]);
> > +       v1[1] = atomicCounter(a0[0][1]);
> > +       v1[2] = atomicCounter(a0[0][2]);
> > +       v1[3] = atomicCounter(a0[0][3]);
> > +       v1[4] = atomicCounter(a0[1][0]);
> > +       v1[5] = atomicCounter(a0[1][1]);
> > +       v1[6] = atomicCounter(a0[1][2]);
> > +       v1[7] = atomicCounter(a0[1][3]);
> > +       if(v1[0] <= v0[0] || v1[1] != v0[1] || v1[2] != v0[2] ||
> > +          v1[3] != v0[3] || v1[4] != v0[4] || v1[5] != v0[5] ||
> > +          v1[6] <= v0[6] || v1[7] != v0[7])
> > +               passed = false;
> > +
> > +       if (passed)
> > +               vcolor = vec4(0.0, 1.0, 0.0, 1.0);
> > +       else
> > +               vcolor = vec4(1.0, 0.0, 0.0, 1.0);
> > +
> > +       gl_Position = piglit_vertex;
> > +}
> > +
> > +[fragment shader]
> > +#version 140
> > +in vec4 vcolor;
> > +out vec4 fcolor;
> > +
> > +void main()
> > +{
> > +       fcolor = vcolor;
> > +}
> > +
> > +[test]
> > +atomic counters 2
> > +
> > +uniform int n 1
> > +uniform int m 2
> > +
> > +draw rect -1 -1 2 2
> > +probe all rgba 0.0 1.0 0.0 1.0
> > --
> > 2.4.3
> > 
> > _______________________________________________
> > Piglit mailing list
> > Piglit at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list