summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2015-10-25 16:29:01 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2015-11-12 11:39:00 +0000
commit2edc10a4871631e360494e5c002230ef6bf63a25 (patch)
tree8fb9a2dd813ab22cf956d89c4061abc6cf5ee56b
parent3f7eade3a12339e0bd7cc2fab0f9ea1c4d8e3eac (diff)
arb_enhanced_layouts: explicit-offset: relative offset values
Check if one member is (attempted to be) positioned on top of another, and that the assigned offset(s) increase naturally. v2: - Fix typo - enhanced-layout > enhanced-layouts - Prefix uniform tests with ubo - Add ssbo equivalent tests v3: - Remove trailing whitespace (Tim) - Drop glsl versoin to 1.40 for the ssbo tests (Tim, Ilia) - Tweak glsl shader comment (Tim) - Drop XXX and Note(s) (Tim) - Change check_link to true to match below test results (Tim) v4: - Use underscores in extension name (Tim) - Revert check_link to false. Note: these tests fail with the following setup, as it relies on link-time, as opposed to compile-time checking. Nvidia GeForce 840M - NVIDIA 352.41 Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
-rw-r--r--tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-decreasing-offset.vert29
-rw-r--r--tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-members-stamping-each-other.vert29
-rw-r--r--tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-multiple-members-same-offset.vert29
-rw-r--r--tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-decreasing-offset.vert27
-rw-r--r--tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-members-stamping-each-other.vert28
-rw-r--r--tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-multiple-members-same-offset.vert28
6 files changed, 170 insertions, 0 deletions
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-decreasing-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-decreasing-offset.vert
new file mode 100644
index 000000000..9ad72d949
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-decreasing-offset.vert
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_shader_storage_buffer_object
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+// "It is a compile-time error to
+// specify an *offset* that is smaller than the offset of the previous
+// member in the block..."
+//
+// Tests whether assigning a smaller offset for sequential member triggers
+// a compile-time error.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+
+layout(std430) buffer b {
+ layout(offset = 32) vec4 var1;
+ layout(offset = 0) vec4 var2; // Wrong: offset must be larger than that of a previous member
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-members-stamping-each-other.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-members-stamping-each-other.vert
new file mode 100644
index 000000000..473fae975
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-members-stamping-each-other.vert
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_shader_storage_buffer_object
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+// "It is a compile-time error to
+// specify an *offset* that is smaller than the offset of the previous
+// member in the block or that lies within the previous member of the
+// block."
+//
+// Tests whether assigning the same offsets for multiple members trigger
+// a compile-time error.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 8) vec4 var2; // Wrong: must use 16+ as offset
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-multiple-members-same-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-multiple-members-same-offset.vert
new file mode 100644
index 000000000..f9013f5cd
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-multiple-members-same-offset.vert
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_shader_storage_buffer_object
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+// "It is a compile-time error to
+// specify an *offset* that is smaller than the offset of the previous
+// member in the block or that lies within the previous member of the
+// block."
+//
+// Tests whether assigning the same offsets for multiple members trigger
+// a compile-time error.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+ layout(offset = 32) vec4 var1;
+ layout(offset = 32) vec4 var2; // Wrong; cannot have the same offset
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-decreasing-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-decreasing-offset.vert
new file mode 100644
index 000000000..a72f5728e
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-decreasing-offset.vert
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+// "It is a compile-time error to
+// specify an *offset* that is smaller than the offset of the previous
+// member in the block..."
+//
+// Tests whether assigning a smaller offset for sequential member triggers
+// a compile-time error.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform block {
+ layout(offset = 32) vec4 var1;
+ layout(offset = 0) vec4 var2; // Wrong: offset must be larger than that of a previous member
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-members-stamping-each-other.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-members-stamping-each-other.vert
new file mode 100644
index 000000000..ff6f91024
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-members-stamping-each-other.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+// "It is a compile-time error to
+// specify an *offset* that is smaller than the offset of the previous
+// member in the block or that lies within the previous member of the
+// block."
+//
+// Tests whether assigning the same offsets for multiple members trigger
+// a compile-time error.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform block {
+ layout(offset = 0) vec4 var1;
+ layout(offset = 8) vec4 var2; // Wrong: must use 16+ as offset
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-multiple-members-same-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-multiple-members-same-offset.vert
new file mode 100644
index 000000000..1ca135af0
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-multiple-members-same-offset.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+// "It is a compile-time error to
+// specify an *offset* that is smaller than the offset of the previous
+// member in the block or that lies within the previous member of the
+// block."
+//
+// Tests whether assigning the same offsets for multiple members trigger
+// a compile-time error.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform block {
+ layout(offset = 32) vec4 var1;
+ layout(offset = 32) vec4 var2; // Wrong; cannot have the same offset
+};
+
+void main()
+{
+}