[Piglit] [PATCH] arb_shader_atomic_counter_ops: add some basic tests
Ilia Mirkin
imirkin at alum.mit.edu
Sat Feb 20 05:13:14 UTC 2016
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
.../compiler/functions.frag | 29 ++++++++++++++++++++++
.../execution/add.shader_test | 27 ++++++++++++++++++++
.../preprocessor/define.frag | 19 ++++++++++++++
.../preprocessor/define.vert | 19 ++++++++++++++
4 files changed, 94 insertions(+)
create mode 100644 tests/spec/arb_shader_atomic_counter_ops/compiler/functions.frag
create mode 100644 tests/spec/arb_shader_atomic_counter_ops/execution/add.shader_test
create mode 100644 tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.frag
create mode 100644 tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.vert
diff --git a/tests/spec/arb_shader_atomic_counter_ops/compiler/functions.frag b/tests/spec/arb_shader_atomic_counter_ops/compiler/functions.frag
new file mode 100644
index 0000000..b991fe1
--- /dev/null
+++ b/tests/spec/arb_shader_atomic_counter_ops/compiler/functions.frag
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.40
+ * require_extensions: GL_ARB_shader_atomic_counter_ops
+ * [end config]
+ *
+ * Check that the builtin functions defined by the extension
+ * are present.
+ */
+#version 150
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_ARB_shader_atomic_counter_ops: require
+
+layout (binding=0) uniform atomic_uint c;
+out uvec4 fcolor;
+uniform uint data, comp;
+
+void main()
+{
+ fcolor.x = atomicCounterAddARB(c, data) +
+ atomicCounterSubtractARB(c, data) +
+ atomicCounterMinARB(c, data) +
+ atomicCounterMaxARB(c, data) +
+ atomicCounterAndARB(c, data) +
+ atomicCounterOrARB(c, data) +
+ atomicCounterXorARB(c, data) +
+ atomicCounterExchangeARB(c, data) +
+ atomicCounterCompSwapARB(c, comp, data);
+}
diff --git a/tests/spec/arb_shader_atomic_counter_ops/execution/add.shader_test b/tests/spec/arb_shader_atomic_counter_ops/execution/add.shader_test
new file mode 100644
index 0000000..9e0edb2
--- /dev/null
+++ b/tests/spec/arb_shader_atomic_counter_ops/execution/add.shader_test
@@ -0,0 +1,27 @@
+[require]
+GLSL >= 1.40
+GL_ARB_shader_atomic_counters
+GL_ARB_shader_atomic_counter_ops
+SIZE 16 16
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 140
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_ARB_shader_atomic_counter_ops: require
+
+out vec4 color;
+layout(binding = 0) uniform atomic_uint counter;
+
+void main() {
+ atomicCounterAddARB(counter,
+ uint(gl_FragCoord.x) + 16u * uint(gl_FragCoord.y));
+ color = vec4(0, 1, 0, 1);
+}
+
+[test]
+atomic counters 1
+
+draw rect -1 -1 2 2
+probe atomic counter 0 == 32640
diff --git a/tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.frag b/tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.frag
new file mode 100644
index 0000000..69633af
--- /dev/null
+++ b/tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.frag
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// require_extensions: GL_ARB_shader_atomic_counter_ops
+// [end config]
+
+#version 140
+#extension GL_ARB_shader_atomic_counter_ops: require
+
+#if !defined GL_ARB_shader_atomic_counter_ops
+# error GL_ARB_shader_atomic_counter_ops is not defined
+#elif GL_ARB_shader_atomic_counter_ops != 1
+# error GL_ARB_shader_atomic_counter_ops is not equal to 1
+#endif
+
+/* Some compilers generate spurious errors if a shader does not contain
+ * any code or declarations.
+ */
+int foo(void) { return 1; }
diff --git a/tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.vert b/tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.vert
new file mode 100644
index 0000000..69633af
--- /dev/null
+++ b/tests/spec/arb_shader_atomic_counter_ops/preprocessor/define.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// require_extensions: GL_ARB_shader_atomic_counter_ops
+// [end config]
+
+#version 140
+#extension GL_ARB_shader_atomic_counter_ops: require
+
+#if !defined GL_ARB_shader_atomic_counter_ops
+# error GL_ARB_shader_atomic_counter_ops is not defined
+#elif GL_ARB_shader_atomic_counter_ops != 1
+# error GL_ARB_shader_atomic_counter_ops is not equal to 1
+#endif
+
+/* Some compilers generate spurious errors if a shader does not contain
+ * any code or declarations.
+ */
+int foo(void) { return 1; }
--
2.4.10
More information about the Piglit
mailing list