[Piglit] [PATCH] ARB_shader_atomic_counters: Add simple VS test with inc/dec/read
Jordan Justen
jordan.l.justen at intel.com
Tue Feb 17 16:12:45 PST 2015
Simple test of atomicCounterIncrement, atomicCounterDecrement and
atomicCounter being used in the VS.
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
tests/all.py | 3 +
.../execution/vs-simple-inc-dec-read.shader_test | 70 ++++++++++++++++++++++
2 files changed, 73 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 d2ae5ea..dc6e60d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4383,6 +4383,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..4a8f50e
--- /dev/null
+++ b/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test
@@ -0,0 +1,70 @@
+# Simple test of atomicCounterIncrement, atomicCounterDecrement and
+# atomicCounter being used in the VS.
+
+[require]
+GL CORE >= 3.1
+GLSL >= 1.40
+
+[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
\ No newline at end of file
--
2.1.4
More information about the Piglit
mailing list