From: Emil Velikov <[email protected]> Check if both numberical and const expressions are accepted as valid offset. Also try a negative value as offset.
Signed-off-by: Emil Velikov <[email protected]> --- .../integral-constant-expression-offset.vert | 28 ++++++++++++++++++++++ .../compiler/explicit-offsets/negative-offset.vert | 27 +++++++++++++++++++++ .../explicit-offsets/numerical-offset.vert | 26 ++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 tests/spec/arb_enhanced_layout/compiler/explicit-offsets/integral-constant-expression-offset.vert create mode 100644 tests/spec/arb_enhanced_layout/compiler/explicit-offsets/negative-offset.vert create mode 100644 tests/spec/arb_enhanced_layout/compiler/explicit-offsets/numerical-offset.vert diff --git a/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/integral-constant-expression-offset.vert b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/integral-constant-expression-offset.vert new file mode 100644 index 0000000..f6d5f46 --- /dev/null +++ b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/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_layout/compiler/explicit-offsets/negative-offset.vert b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/negative-offset.vert new file mode 100644 index 0000000..39a0b10 --- /dev/null +++ b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/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_layout/compiler/explicit-offsets/numerical-offset.vert b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/numerical-offset.vert new file mode 100644 index 0000000..737e6f9 --- /dev/null +++ b/tests/spec/arb_enhanced_layout/compiler/explicit-offsets/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 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
