[Piglit] [PATCH 4/5] arb_enhanced_layouts: test negative compile time constants

Timothy Arceri timothy.arceri at collabora.com
Sun Nov 1 17:54:40 PST 2015


---
 .../binding-separate-shader-objects.frag           | 25 +++++++++++++++++++
 .../negative-qualifiers/index-subroutine.vert      | 21 ++++++++++++++++
 .../negative-qualifiers/index.frag                 | 23 ++++++++++++++++++
 .../negative-layout-qualifier-invocation.geom      | 27 +++++++++++++++++++++
 .../negative-layout-qualifier-local_size_x.comp    | 15 ++++++++++++
 .../negative-layout-qualifier-local_size_y.comp    | 15 ++++++++++++
 .../negative-layout-qualifier-local_size_z.comp    | 15 ++++++++++++
 .../negative-layout-qualifier-location.vert        | 21 ++++++++++++++++
 .../negative-layout-qualifier-max_vertices.geom    | 15 ++++++++++++
 .../negative-layout-qualifier-stream.geom          | 28 ++++++++++++++++++++++
 .../negative-layout-qualifier-vertices.tesc        | 19 +++++++++++++++
 .../negative-qualifiers/offset-atomic.frag         | 16 +++++++++++++
 12 files changed, 240 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/binding-separate-shader-objects.frag
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index-subroutine.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index.frag
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-invocation.geom
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_x.comp
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_y.comp
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_z.comp
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-location.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-max_vertices.geom
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-stream.geom
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-vertices.tesc
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/offset-atomic.frag

diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/binding-separate-shader-objects.frag b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/binding-separate-shader-objects.frag
new file mode 100644
index 0000000..710b2be
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/binding-separate-shader-objects.frag
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shader_storage_buffer_object GL_ARB_enhanced_layouts
+// [end config]
+//
+// From Section 4.4.5 (Uniform and Shader Storage Block Layout Qualifiers)
+// of the GLSL 4.5 spec:
+// 
+// "If the binding point for any uniform or shader storage block instance is
+// less than zero, or greater than or equal to the implementation-dependent
+// maximum number of uniform buffer bindings, a compile-time error will occur."
+
+#version 150
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_enhanced_layouts: require
+
+const int start = 3;
+layout(binding = start - 4) buffer buf {
+	float f;
+};
+
+float foo(void) {
+	return f;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index-subroutine.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index-subroutine.vert
new file mode 100644
index 0000000..505b089
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index-subroutine.vert
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shader_subroutine GL_ARB_enhanced_layouts GL_ARB_explicit_uniform_location
+// [end config]
+//
+// From the ARB_explicit_uniform_location spec:
+//
+// "The subroutine functions can be assigned an explicit index in the shader
+// between 0 and MAX_SUBROUTINES minus one."
+
+#version 150
+#extension GL_ARB_shader_subroutine: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_explicit_uniform_location: require
+
+const int start = -3;
+subroutine void func_type();
+
+/* A subroutine matching the above type */
+layout(index = start + 2) subroutine (func_type) void f() {}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index.frag b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index.frag
new file mode 100644
index 0000000..f16d757
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/index.frag
@@ -0,0 +1,23 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.20
+// require_extensions: GL_ARB_explicit_attrib_location GL_ARB_enhanced_layouts
+// [end config]
+//
+// While the GL_ARB_explicit_attrib_location specification does not say
+// anything about generating errors for invalid indices, the GLSL 4.30
+// spec clarifies this: "It is also a compile-time error if a fragment shader
+// sets a layout index to less than 0 or greater than 1."  This matches the
+// behavior of the equivalent API call, glBindFragDataLocationIndexed, which
+// generates an INVALID_VALUE error if <index> is not 0 or 1.
+
+#version 120
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+layout(location = 0, index = -5) varying vec4 color;
+
+void main()
+{
+	color = vec4(1.0);
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-invocation.geom b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-invocation.geom
new file mode 100644
index 0000000..0822b8a
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-invocation.geom
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// Test to detect negative value of layout qualifier 'stream'
+//
+// From ARB_gpu_shader5 spec:
+//
+// "If an implementation supports <N> vertex streams, the
+//     individual streams are numbered 0 through <N>-1"
+//
+// "If any stream declaration specifies a non-existent stream number,
+//  the shader will fail to compile."
+
+#version 150
+#extension GL_ARB_gpu_shader5: enable
+#extension GL_ARB_enhanced_layouts: require
+
+const int start = 3;
+layout(lines, invocations = start - 5) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_x.comp b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_x.comp
new file mode 100644
index 0000000..af4f569
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_x.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_enhanced_layouts: require
+
+layout(local_size_x = -1, local_size_y = 1, local_size_z = 1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_y.comp b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_y.comp
new file mode 100644
index 0000000..263da11
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_y.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_enhanced_layouts: require
+
+layout(local_size_x = 1, local_size_y = -1, local_size_z = 1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_z.comp b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_z.comp
new file mode 100644
index 0000000..42ea327
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-local_size_z.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: fail
+// glsl_version: 3.30
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_enhanced_layouts: require
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = -1) in;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-location.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-location.vert
new file mode 100644
index 0000000..29847ff
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-location.vert
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// From the ARB_explicit_uniform_location spec:
+//
+// "Valid locations for default-block uniform variable locations are in the
+// range of 0 to the implementation-defined maximum number of uniform
+// locations."
+
+#version 110
+#extension GL_ARB_explicit_attrib_location: require
+#extension GL_ARB_enhanced_layouts: require
+
+layout(location = -1) in vec4 attrb;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-max_vertices.geom b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-max_vertices.geom
new file mode 100644
index 0000000..b6b69ca
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-max_vertices.geom
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_enhanced_layouts
+// [end config]
+
+#version 150
+#extension GL_ARB_enhanced_layouts: require
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = -1) out;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-stream.geom b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-stream.geom
new file mode 100644
index 0000000..c4f3379
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-stream.geom
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5 GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// Test to detect negative value of layout qualifier 'stream'
+//
+// From ARB_gpu_shader5 spec:
+//
+// "If an implementation supports <N> vertex streams, the
+//     individual streams are numbered 0 through <N>-1"
+//
+// "If any stream declaration specifies a non-existent stream number,
+//  the shader will fail to compile."
+
+#version 150
+#extension GL_ARB_gpu_shader5: enable
+#extension GL_ARB_enhanced_layouts: require
+
+layout(points) in;
+layout(points, stream=-2, max_vertices=3) out;
+out vec4 streamout;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-vertices.tesc b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-vertices.tesc
new file mode 100644
index 0000000..dbd2af2
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/negative-layout-qualifier-vertices.tesc
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_tessellation_shader
+// [end config]
+//
+// From the GLSL 4.5 spec:
+//
+// "It is a compile- or link-time error for the output vertex count to be less
+// than or equal to zero"
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_enhanced_layouts: require
+layout(vertices = -1) out;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/offset-atomic.frag b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/offset-atomic.frag
new file mode 100644
index 0000000..28c9945
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/negative-qualifiers/offset-atomic.frag
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_shader_atomic_counters GL_ARB_enhanced_layouts
+// [end config]
+
+#version 140
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_ARB_enhanced_layouts: require
+
+const int start = 3;
+layout(binding = 0, offset = start - 4) uniform atomic_uint x;
+
+void main()
+{
+}
-- 
2.4.3



More information about the Piglit mailing list