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

Timothy Arceri t_arceri at yahoo.com.au
Wed Nov 11 12:44:27 PST 2015


On Wed, 2015-11-11 at 18:14 +0000, Emil Velikov wrote:
> 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
> 
> 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 <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..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.

This test is exactly the same as explicit-offsets/ssbo-std430-layout.vert
right? Same goes for the UBO test.

If so and you drop those two then this patch is:
 
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>


> +//
> +
> +#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()
> +{
> +}


More information about the Piglit mailing list