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

Emil Velikov emil.l.velikov at gmail.com
Wed Nov 11 10:14:55 PST 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

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)

Test results (Tim):
Nvidia GeForce 840M - NVIDIA 352.41: pass

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 .../explicit-offsets/ssbo-decreasing-offset.vert   | 29 ++++++++++++++++++++++
 .../ssbo-members-stamping-each-other.vert          | 29 ++++++++++++++++++++++
 .../ssbo-multiple-members-same-offset.vert         | 29 ++++++++++++++++++++++
 .../explicit-offsets/ubo-decreasing-offset.vert    | 27 ++++++++++++++++++++
 .../ubo-members-stamping-each-other.vert           | 28 +++++++++++++++++++++
 .../ubo-multiple-members-same-offset.vert          | 28 +++++++++++++++++++++
 6 files changed, 170 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..dc6583e
--- /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: true
+// [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 0000000..34afc06
--- /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: true
+// [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 0000000..c5030ef
--- /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: true
+// [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 0000000..d32a761
--- /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: true
+// [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 0000000..e339868
--- /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: true
+// [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 0000000..94446aa
--- /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: true
+// [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()
+{
+}
-- 
2.6.2



More information about the Piglit mailing list