From: Emil Velikov <[email protected]> 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 v3: - Remove trailing whitespace (Tim) - Drop glsl versoin to 1.40 for the ssbo tests (Tim, Ilia) - Swap offsets for negative-offset test. Test results (Tim): Nvidia GeForce 840M - NVIDIA 352.41: pass Signed-off-by: Emil Velikov <[email protected]> --- .../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..5139537 --- /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: 1.40 +// 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 140 +#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..4eab958 --- /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: 1.40 +// 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 140 +#extension GL_ARB_enhanced_layouts : enable +#extension GL_ARB_shader_storage_buffer_object : enable + +layout(std430) buffer b { + layout(offset = -2) vec4 var1; // Wrong: offset cannot be negative value + layout(offset = 0) vec4 var2; +}; + +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..2fa724d --- /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: 1.40 +// 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 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 = 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..3739dea --- /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..2e411b6 --- /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 = -2) vec4 var1; // Wrong: offset cannot be negative value + layout(offset = 0) vec4 var2; +}; + +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..4bdf002 --- /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.2 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
