Reviewed-by: Ilia Mirkin <[email protected]>
On Wed, Feb 18, 2015 at 5:32 PM, Jordan Justen <[email protected]> wrote: > Simple test of atomicCounterIncrement, atomicCounterDecrement and > atomicCounter being used in the VS. > > v2: > * Drop CORE requirement > * Add GL_ARB_shader_atomic_counters requirement > * Require INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2 > > Signed-off-by: Jordan Justen <[email protected]> > Cc: Ilia Mirkin <[email protected]> > --- > tests/all.py | 3 + > .../execution/vs-simple-inc-dec-read.shader_test | 71 > ++++++++++++++++++++++ > 2 files changed, 74 insertions(+) > create mode 100644 > tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test > > diff --git a/tests/all.py b/tests/all.py > index 949b023..b2499d1 100644 > --- a/tests/all.py > +++ b/tests/all.py > @@ -4392,6 +4392,9 @@ spec['ARB_shader_atomic_counters'] = > arb_shader_atomic_counters > import_glsl_parser_tests(spec['ARB_shader_atomic_counters'], > os.path.join(TESTS_DIR, 'spec', > 'arb_shader_atomic_counters'), > ['']) > +add_shader_test_dir(spec['ARB_shader_atomic_counters'], > + os.path.join(TESTS_DIR, 'spec', > 'arb_shader_atomic_counters'), > + recursive=True) > arb_shader_atomic_counters['active-counters'] = > PiglitGLTest(['arb_shader_atomic_counters-active-counters'], > run_concurrent=True) > arb_shader_atomic_counters['array-indexing'] = > PiglitGLTest(['arb_shader_atomic_counters-array-indexing'], > run_concurrent=True) > arb_shader_atomic_counters['buffer-binding'] = > PiglitGLTest(['arb_shader_atomic_counters-buffer-binding'], > run_concurrent=True) > diff --git > a/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test > > b/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test > new file mode 100644 > index 0000000..16ea9db > --- /dev/null > +++ > b/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test > @@ -0,0 +1,71 @@ > +# Simple test of atomicCounterIncrement, atomicCounterDecrement and > +# atomicCounter being used in the VS. > + > +[require] > +GLSL >= 1.40 > +GL_ARB_shader_atomic_counters > +INT GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS >= 2 > + > +[vertex shader] > +#version 140 > +#extension GL_ARB_shader_atomic_counters: require > + > +layout(binding = 0) uniform atomic_uint a0; > +layout(binding = 0) uniform atomic_uint a1; > + > +in vec4 piglit_vertex; > +out vec4 vcolor; > + > +void main() > +{ > + bool passed = true; > + uint v0, v1; > + > + /* Test that incrementing, followed by a read of an atomic > + * counter results in a larger value. > + * > + * Note: atomicCounterIncrement return the old value > + */ > + v0 = atomicCounterIncrement(a0); > + v1 = atomicCounter(a0); > + if (v1 <= v0) > + passed = false; > + > + /* Skip one decrement since it may be the 0 => 0xffffffff > + * transition. > + */ > + atomicCounterDecrement(a1); > + > + /* Test that a read, followed by a decrement of an atomic > + * counter results in a smaller value. > + * > + * Note: atomicCounterDecrement return the new value > + */ > + v0 = atomicCounter(a1); > + v1 = atomicCounterDecrement(a1); > + if (v1 >= v0) > + 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 > + > +draw rect -1 -1 2 2 > +probe all rgba 0.0 1.0 0.0 1.0 > -- > 2.1.4 > _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
