[Piglit] [PATCH v2 3/5] arb-enhanced-layouts: explicit-offset: relative offset values

Emil Velikov emil.l.velikov at gmail.com
Tue Oct 27 08:34:43 PDT 2015


From: Emil Velikov <emil.velikov at collabora.com>

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

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 .../explicit-offsets/ssbo-decreasing-offset.vert   | 29 +++++++++++++++++++++
 .../ssbo-members-stamping-each-other.vert          | 30 ++++++++++++++++++++++
 .../ssbo-multiple-members-same-offset.vert         | 30 ++++++++++++++++++++++
 .../explicit-offsets/ubo-decreasing-offset.vert    | 27 +++++++++++++++++++
 .../ubo-members-stamping-each-other.vert           | 29 +++++++++++++++++++++
 .../ubo-multiple-members-same-offset.vert          | 29 +++++++++++++++++++++
 6 files changed, 174 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-decreasing-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-members-stamping-each-other.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-multiple-members-same-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-decreasing-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-members-stamping-each-other.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-multiple-members-same-offset.vert

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 0000000..ba3678a
--- /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: 4.30
+// 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 430
+#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 but be larger than one of 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 0000000..5286297
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-members-stamping-each-other.vert
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: fail
+// glsl_version: 4.30
+// 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.
+// XXX: fuzz for other (all?) types ?
+//
+
+#version 430
+#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 0000000..7486ca7
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-multiple-members-same-offset.vert
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: fail
+// glsl_version: 4.30
+// 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.
+// Note: not explicitly mentioned in the spec.
+//
+
+#version 430
+#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 0000000..86a1fae
--- /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 but be larger than one of 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 0000000..826ac20
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-members-stamping-each-other.vert
@@ -0,0 +1,29 @@
+// [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.
+// XXX: fuzz for other (all?) types ?
+//
+
+#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 0000000..e4630b2
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-multiple-members-same-offset.vert
@@ -0,0 +1,29 @@
+// [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.
+// Note: not explicitly mentioned in the spec.
+//
+
+#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()
+{
+}
-- 
2.6.1



More information about the Piglit mailing list