[Piglit] [PATCH v2 2/5] arb-enhanced-layouts: explicit-offset: basic/sanity offset values

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


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

Check if both numberical and const expressions are accepted as valid
offset. Also try a negative value as offset.

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>
---
 .../ssbo-integral-constant-expression-offset.vert  | 29 ++++++++++++++++++++++
 .../explicit-offsets/ssbo-negative-offset.vert     | 28 +++++++++++++++++++++
 .../explicit-offsets/ssbo-numerical-offset.vert    | 27 ++++++++++++++++++++
 .../ubo-integral-constant-expression-offset.vert   | 28 +++++++++++++++++++++
 .../explicit-offsets/ubo-negative-offset.vert      | 27 ++++++++++++++++++++
 .../explicit-offsets/ubo-numerical-offset.vert     | 26 +++++++++++++++++++
 6 files changed, 165 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-integral-constant-expression-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-negative-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-numerical-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-integral-constant-expression-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-negative-offset.vert
 create mode 100644 tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-numerical-offset.vert

diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-integral-constant-expression-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-integral-constant-expression-offset.vert
new file mode 100644
index 0000000..68d3b28
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-integral-constant-expression-offset.vert
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: pass
+// 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 *offset* qualifier forces the qualified member to start at or after the 
+//    specified integral-constant-expression, which will be its byte offset 
+//    from the beginning of the buffer."
+//
+// Tests if constant expressions are accepted as offset.
+//
+
+#version 430
+#extension GL_ARB_enhanced_layouts : enable
+#extension GL_ARB_shader_storage_buffer_object : enable
+
+const int start = 8;
+
+layout(std430) buffer b {
+       layout(offset = start + 0) vec4 var1;
+       layout(offset = start + 32) vec4 var2;
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-negative-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-negative-offset.vert
new file mode 100644
index 0000000..6a97556
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-negative-offset.vert
@@ -0,0 +1,28 @@
+// [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 *offset* qualifier forces the qualified member to start at or after the 
+//    specified integral-constant-expression, which will be its byte offset 
+//    from the beginning of the buffer."
+//
+// Tests if negative offsets 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 = 0) vec4 var1;
+       layout(offset = -2) vec4 var2; // Wrong: offset cannot be negative value
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-numerical-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-numerical-offset.vert
new file mode 100644
index 0000000..4336a97
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ssbo-numerical-offset.vert
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: pass
+// 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 *offset* qualifier forces the qualified member to start at or after the 
+//    specified integral-constant-expression, which will be its byte offset 
+//    from the beginning of the buffer."
+//
+// Tests if numerical expressions are accepted as offset.
+//
+
+#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 = 32) vec4 var2;
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-integral-constant-expression-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-integral-constant-expression-offset.vert
new file mode 100644
index 0000000..f6d5f46
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-integral-constant-expression-offset.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+//    "The *offset* qualifier forces the qualified member to start at or after the 
+//    specified integral-constant-expression, which will be its byte offset 
+//    from the beginning of the buffer."
+//
+// Tests if constant expressions are accepted as offset.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+const int start = 8;
+
+layout(std140) uniform block {
+       layout(offset = start + 0) vec4 var1;
+       layout(offset = start + 32) vec4 var2;
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-negative-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-negative-offset.vert
new file mode 100644
index 0000000..39a0b10
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-negative-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:
+//    "The *offset* qualifier forces the qualified member to start at or after the 
+//    specified integral-constant-expression, which will be its byte offset 
+//    from the beginning of the buffer."
+//
+// Tests if negative offsets 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 = 0) vec4 var1;
+       layout(offset = -2) vec4 var2; // Wrong: offset cannot be negative value
+};
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-numerical-offset.vert b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-numerical-offset.vert
new file mode 100644
index 0000000..737e6f9
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/explicit-offsets/ubo-numerical-offset.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// require_extensions: GL_ARB_enhanced_layouts
+// check_link: false
+// [end config]
+//
+// ARB_enhanced_layouts spec says:
+//    "The *offset* qualifier forces the qualified member to start at or after the 
+//    specified integral-constant-expression, which will be its byte offset 
+//    from the beginning of the buffer."
+//
+// Tests if numerical expressions are accepted as offset.
+//
+
+#version 140
+#extension GL_ARB_enhanced_layouts : enable
+
+layout(std140) uniform block {
+       layout(offset = 0) vec4 var1;
+       layout(offset = 32) vec4 var2;
+};
+
+void main()
+{
+}
-- 
2.6.1



More information about the Piglit mailing list