[Piglit] [PATCH 2/5] arb_enhanced_layouts: add basic compile time constant compile tests

Ilia Mirkin imirkin at alum.mit.edu
Sun Nov 1 18:15:12 PST 2015


On Sun, Nov 1, 2015 at 8:54 PM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> ---
>  .../binding-separate-shader-objects.frag              | 18 ++++++++++++++++++
>  .../compiler-time-constants/index-subroutine.vert     | 16 ++++++++++++++++
>  .../compiler/compiler-time-constants/index.frag       | 17 +++++++++++++++++
>  .../compiler-time-constants/input-location.vert       | 17 +++++++++++++++++
>  .../compiler/compiler-time-constants/invocation.geom  | 17 +++++++++++++++++
>  .../compiler-time-constants/local_size_x.comp         | 16 ++++++++++++++++
>  .../compiler-time-constants/local_size_y.comp         | 16 ++++++++++++++++
>  .../compiler-time-constants/local_size_z.comp         | 16 ++++++++++++++++
>  .../compiler-time-constants/max_vertices.geom         | 17 +++++++++++++++++
>  .../compiler-time-constants/offset-atomic.frag        | 16 ++++++++++++++++
>  .../compiler/compiler-time-constants/stream.geom      | 19 +++++++++++++++++++
>  .../compiler-time-constants/uniform-location.vert     | 18 ++++++++++++++++++
>  .../compiler/compiler-time-constants/vertices.tesc    | 16 ++++++++++++++++
>  13 files changed, 219 insertions(+)
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/binding-separate-shader-objects.frag
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index-subroutine.vert
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index.frag
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location.vert
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invocation.geom
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_x.comp
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_y.comp
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_z.comp
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/max_vertices.geom
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/offset-atomic.frag
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/stream.geom
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/uniform-location.vert
>  create mode 100644 tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/vertices.tesc
>
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/binding-separate-shader-objects.frag b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/binding-separate-shader-objects.frag
> new file mode 100644
> index 0000000..468fb93
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/binding-separate-shader-objects.frag

These are generally known as compile-time constants, not compiler-time.

> @@ -0,0 +1,18 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shader_storage_buffer_object GL_ARB_enhanced_layouts
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_shader_storage_buffer_object: require
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout (binding = start + 4) buffer buf {
> +       float f;
> +};
> +
> +float foo(void) {
> +       return f;
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index-subroutine.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index-subroutine.vert
> new file mode 100644
> index 0000000..33a24d3
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index-subroutine.vert
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_shader_subroutine GL_ARB_enhanced_layouts GL_ARB_explicit_uniform_location
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_shader_subroutine: require
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_explicit_uniform_location: require
> +
> +const int start = 3;
> +subroutine void func_type();
> +
> +/* A subroutine matching the above type */
> +layout(index = start + 2) subroutine (func_type) void f() {}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index.frag b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index.frag
> new file mode 100644
> index 0000000..0ef0b3c
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/index.frag
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.20

1.40

> +// require_extensions: GL_ARB_explicit_attrib_location GL_ARB_enhanced_layouts
> +// [end config]
> +
> +#version 120
> +#extension GL_ARB_explicit_attrib_location: require
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 0;
> +layout(location = 0, index = start + 1) varying vec4 color;
> +
> +void main()
> +{
> +       color = vec4(1.0);
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location.vert
> new file mode 100644
> index 0000000..f934595
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/input-location.vert
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.10

1.40

> +// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
> +// [end config]
> +
> +#version 110
> +#extension GL_ARB_explicit_attrib_location: require
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(location = start + 2) in vec4 b;
> +
> +void main()
> +{
> +       gl_Position = b;
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invocation.geom b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invocation.geom
> new file mode 100644
> index 0000000..aeb221c
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/invocation.geom
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_gpu_shader5 GL_ARB_enhanced_layouts
> +// check_link: false
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_gpu_shader5: enable
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(lines, invocations = start + 2) in;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_x.comp b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_x.comp
> new file mode 100644
> index 0000000..efe028f
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_x.comp
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 3.30

Why 3.30? ARB_cs claims it needs 4.2 but that's probably BS.

> +// require_extensions: GL_ARB_enhanced_layouts GL_ARB_compute_shader
> +// [end config]
> +
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(local_size_x = start + 1, local_size_y = 1, local_size_z = 1) in;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_y.comp b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_y.comp
> new file mode 100644
> index 0000000..36a3516
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_y.comp
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 3.30
> +// require_extensions: GL_ARB_enhanced_layouts GL_ARB_compute_shader
> +// [end config]
> +
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(local_size_x = 1, local_size_y = start + 1, local_size_z = 1) in;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_z.comp b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_z.comp
> new file mode 100644
> index 0000000..6fd3b5e
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/local_size_z.comp
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 3.30
> +// require_extensions: GL_ARB_enhanced_layouts GL_ARB_compute_shader
> +// [end config]
> +
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(local_size_x = 1, local_size_y = 1, local_size_z = start - 1) in;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/max_vertices.geom b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/max_vertices.geom
> new file mode 100644
> index 0000000..cd542ae
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/max_vertices.geom
> @@ -0,0 +1,17 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_enhanced_layouts
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +const int offset = 1;
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = start - offset) out;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/offset-atomic.frag b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/offset-atomic.frag
> new file mode 100644
> index 0000000..c2859d3
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/offset-atomic.frag
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.40
> +// require_extensions: GL_ARB_shader_atomic_counters GL_ARB_enhanced_layouts
> +// [end config]
> +
> +#version 140
> +#extension GL_ARB_shader_atomic_counters: require
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(binding = 0, offset = start + 1) uniform atomic_uint x;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/stream.geom b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/stream.geom
> new file mode 100644
> index 0000000..346b5c4
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/stream.geom
> @@ -0,0 +1,19 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_gpu_shader5 GL_ARB_enhanced_layouts
> +// check_link: false
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_gpu_shader5: enable
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(points) in;
> +layout(points, stream= start + 2, max_vertices=3) out;
> +out vec4 streamout;
> +
> +void main()
> +{
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/uniform-location.vert b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/uniform-location.vert
> new file mode 100644
> index 0000000..822655c
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/uniform-location.vert
> @@ -0,0 +1,18 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.10

1.40

> +// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_uniform_location GL_ARB_explicit_attrib_location
> +// [end config]
> +
> +#version 110
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_explicit_attrib_location: require
> +#extension GL_ARB_explicit_uniform_location: require
> +
> +const int start = 3;
> +layout(location = start + 2) uniform vec4 b;
> +
> +void main()
> +{
> +       gl_Position = b;
> +}
> diff --git a/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/vertices.tesc b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/vertices.tesc
> new file mode 100644
> index 0000000..a88d297
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/compiler/compiler-time-constants/vertices.tesc
> @@ -0,0 +1,16 @@
> +// [config]
> +// expect_result: pass
> +// glsl_version: 1.50
> +// require_extensions: GL_ARB_enhanced_layouts GL_ARB_tessellation_shader
> +// [end config]
> +
> +#version 150
> +#extension GL_ARB_tessellation_shader: require
> +#extension GL_ARB_enhanced_layouts: require
> +
> +const int start = 3;
> +layout(vertices = start - 1) out;
> +
> +void main()
> +{
> +}

With the above version fixes, this patch is

Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>


More information about the Piglit mailing list