From: Emil Velikov <[email protected]>

Check if one member is (attempted to be) positioned on top of another,
and that the assigned offset(s) increase naturally.

Signed-off-by: Emil Velikov <[email protected]>
---
 .../explicit-offsets/decreasing-offset.vert        | 27 ++++++++++++++++++++
 .../members-stamping-each-other.vert               | 29 ++++++++++++++++++++++
 .../multiple-members-same-offset.vert              | 29 ++++++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 
tests/spec/arb_enhanced_layout/compiler/explicit-offsets/decreasing-offset.vert
 create mode 100644 
tests/spec/arb_enhanced_layout/compiler/explicit-offsets/members-stamping-each-other.vert
 create mode 100644 
tests/spec/arb_enhanced_layout/compiler/explicit-offsets/multiple-members-same-offset.vert

diff --git 
a/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/decreasing-offset.vert
 
b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/decreasing-offset.vert
new file mode 100644
index 0000000..86a1fae
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/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_layout/compiler/explicit-offsets/members-stamping-each-other.vert
 
b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/members-stamping-each-other.vert
new file mode 100644
index 0000000..826ac20
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/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_layout/compiler/explicit-offsets/multiple-members-same-offset.vert
 
b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/multiple-members-same-offset.vert
new file mode 100644
index 0000000..e4630b2
--- /dev/null
+++ 
b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/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

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to