[Piglit] [PATCH v2 4/5] arb-enhanced-layouts: explicit-offset: test offset wrt (self) alignment

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


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

As per the spec hunk:
   "The specified offset must be a
   multiple of the base alignment of the type of the block member it
   qualifies, or a compile-time error results."

v2:
 - Fix typo - enhanced-layout > enhanced-layouts
 - Prefix uniform tests with ubo
 - Add ssbo equivalent tests
 - Quote the correct spec hunk in commit msg

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 .../ssbo-offset-multiple-of-base-member-align.vert | 27 ++++++++++++++++++++++
 .../ubo-offset-multiple-of-base-member-align.vert  | 26 +++++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-offset-multiple-of-base-member-align.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-offset-multiple-of-base-member-align.vert

diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-offset-multiple-of-base-member-align.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-offset-multiple-of-base-member-align.vert
new file mode 100644
index 0000000..283f7b7
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-offset-multiple-of-base-member-align.vert
@@ -0,0 +1,27 @@
+// [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:
+//    "The specified offset must be a 
+//    multiple of the base alignment of the type of the block member it 
+//    qualifies, or a compile-time error results."
+//
+// Tests for successful compilation, when the block is of std140 layout.
+//
+
+#version 430
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+layout(std430) buffer b {
+       layout(offset = 0) float f1;
+       layout(offset = 2) float f2; // Wrong: offset must be aligned to multiple of sizeof(float)
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-offset-multiple-of-base-member-align.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-offset-multiple-of-base-member-align.vert
new file mode 100644
index 0000000..b3ce2e2
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-offset-multiple-of-base-member-align.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+//    "The specified offset must be a 
+//    multiple of the base alignment of the type of the block member it 
+//    qualifies, or a compile-time error results."
+//
+// Tests for successful compilation, when the block is of std140 layout.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform block {
+       layout(offset = 0) float f1;
+       layout(offset = 2) float f2; // Wrong: offset must be aligned to multiple of sizeof(float)
+};
+
+void main()
+{
+}
-- 
2.6.1



More information about the Piglit mailing list