[Piglit] [PATCH 11/13] nv_shader_atomic_float: Simple negative compile tests

Ian Romanick idr at freedesktop.org
Fri Jun 1 22:43:16 UTC 2018


From: Ian Romanick <ian.d.romanick at intel.com>

If the extension isn't enabled in the shader, the functions should not
be availale.  Yes, I botched the SSBO and shared variable parts in the
initial implementation.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../imageAtomicAdd-float-image2D-fail.frag         | 20 ++++++++++++++++++++
 .../imageAtomicExchange-float-image2D-fail.frag    | 20 ++++++++++++++++++++
 .../compiler/shared-atomicAdd-float-fail.comp      | 20 ++++++++++++++++++++
 .../compiler/shared-atomicExchange-float-fail.comp | 20 ++++++++++++++++++++
 .../compiler/ssbo-atomicAdd-float-fail.frag        | 22 ++++++++++++++++++++++
 .../compiler/ssbo-atomicExchange-float-fail.frag   | 22 ++++++++++++++++++++++
 6 files changed, 124 insertions(+)
 create mode 100644 tests/spec/nv_shader_atomic_float/compiler/imageAtomicAdd-float-image2D-fail.frag
 create mode 100644 tests/spec/nv_shader_atomic_float/compiler/imageAtomicExchange-float-image2D-fail.frag
 create mode 100644 tests/spec/nv_shader_atomic_float/compiler/shared-atomicAdd-float-fail.comp
 create mode 100644 tests/spec/nv_shader_atomic_float/compiler/shared-atomicExchange-float-fail.comp
 create mode 100644 tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicAdd-float-fail.frag
 create mode 100644 tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicExchange-float-fail.frag

diff --git a/tests/spec/nv_shader_atomic_float/compiler/imageAtomicAdd-float-image2D-fail.frag b/tests/spec/nv_shader_atomic_float/compiler/imageAtomicAdd-float-image2D-fail.frag
new file mode 100644
index 000000000..720317280
--- /dev/null
+++ b/tests/spec/nv_shader_atomic_float/compiler/imageAtomicAdd-float-image2D-fail.frag
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_NV_shader_atomic_float GL_ARB_shader_image_load_store
+// [end config]
+//
+// The extension is supported by the implementation, but it is not enabled in
+// the shader.  This should fail to compile.
+
+#version 150
+#extension GL_ARB_shader_image_load_store: require
+
+layout(r32f) uniform image2D img;
+uniform float v;
+out vec4 color;
+
+void main()
+{
+        color = vec4(imageAtomicAdd(img, ivec2(gl_FragCoord.xy), v));
+}
diff --git a/tests/spec/nv_shader_atomic_float/compiler/imageAtomicExchange-float-image2D-fail.frag b/tests/spec/nv_shader_atomic_float/compiler/imageAtomicExchange-float-image2D-fail.frag
new file mode 100644
index 000000000..356a7518a
--- /dev/null
+++ b/tests/spec/nv_shader_atomic_float/compiler/imageAtomicExchange-float-image2D-fail.frag
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_NV_shader_atomic_float GL_ARB_shader_image_load_store
+// [end config]
+//
+// The extension is supported by the implementation, but it is not enabled in
+// the shader.  This should fail to compile.
+
+#version 150
+#extension GL_ARB_shader_image_load_store: require
+
+layout(r32f) uniform image2D img;
+uniform float v;
+out vec4 color;
+
+void main()
+{
+        color = vec4(imageAtomicExchange(img, ivec2(gl_FragCoord.xy), v));
+}
diff --git a/tests/spec/nv_shader_atomic_float/compiler/shared-atomicAdd-float-fail.comp b/tests/spec/nv_shader_atomic_float/compiler/shared-atomicAdd-float-fail.comp
new file mode 100644
index 000000000..a0d5cda8a
--- /dev/null
+++ b/tests/spec/nv_shader_atomic_float/compiler/shared-atomicAdd-float-fail.comp
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_compute_shader GL_NV_shader_atomic_float
+// [end config]
+//
+// The extension is supported by the implementation, but it is not enabled in
+// the shader.  This should fail to compile.
+
+#version 150
+#extension GL_ARB_compute_shader: require
+
+layout(local_size_x = 32) in;
+
+shared float a;
+
+void main()
+{
+	atomicAdd(a, 1.7);
+}
diff --git a/tests/spec/nv_shader_atomic_float/compiler/shared-atomicExchange-float-fail.comp b/tests/spec/nv_shader_atomic_float/compiler/shared-atomicExchange-float-fail.comp
new file mode 100644
index 000000000..3ce370a7b
--- /dev/null
+++ b/tests/spec/nv_shader_atomic_float/compiler/shared-atomicExchange-float-fail.comp
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_compute_shader GL_NV_shader_atomic_float
+// [end config]
+//
+// The extension is supported by the implementation, but it is not enabled in
+// the shader.  This should fail to compile.
+
+#version 150
+#extension GL_ARB_compute_shader: require
+
+layout(local_size_x = 32) in;
+
+shared float a;
+
+void main()
+{
+	atomicExchange(a, 1.7);
+}
diff --git a/tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicAdd-float-fail.frag b/tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicAdd-float-fail.frag
new file mode 100644
index 000000000..6a7a6a5b0
--- /dev/null
+++ b/tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicAdd-float-fail.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shader_storage_buffer_object GL_NV_shader_atomic_float
+// [end config]
+//
+// The extension is supported by the implementation, but it is not enabled in
+// the shader.  This should fail to compile.
+
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer bufblock {
+       float a;
+};
+
+out vec4 color;
+
+void main()
+{
+	color = vec4(atomicAdd(a, 1.7));
+}
diff --git a/tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicExchange-float-fail.frag b/tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicExchange-float-fail.frag
new file mode 100644
index 000000000..a49a15961
--- /dev/null
+++ b/tests/spec/nv_shader_atomic_float/compiler/ssbo-atomicExchange-float-fail.frag
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shader_storage_buffer_object GL_NV_shader_atomic_float
+// [end config]
+//
+// The extension is supported by the implementation, but it is not enabled in
+// the shader.  This should fail to compile.
+
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+
+buffer bufblock {
+       float a;
+};
+
+out vec4 color;
+
+void main()
+{
+	color = vec4(atomicExchange(a, 1.7));
+}
-- 
2.14.4



More information about the Piglit mailing list