diff options
author | Andres Gomez <agomez@igalia.com> | 2016-10-11 17:10:18 +0300 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2016-11-26 02:39:55 +0200 |
commit | 9269d4757a33a9e2f0b7bea8c69c23496efbcba0 (patch) | |
tree | d59c7b22fc1d50d5bb8e5e3d8ede9e88c9c76703 | |
parent | f90afe8a37f1b3995b32bbdd41d0704fb42bc625 (diff) | |
download | piglit-9269d4757a33a9e2f0b7bea8c69c23496efbcba0.tar.gz |
arb_shading_language_420pack: More multiple layout qualifiers in a single declaration tests
Added tests for the layout-qualifier-names "max_vertices",
"invocations", "vertices" and "local_size_[x|y|z]" which may have
redeclarations but all of them enforce that a redeclaration holds the
same value than in the previous declaration(s).
These tests check that multiple appearances of a layout-qualifier-name
across different layout qualifiers with different values in the same
declaration won't trigger a compile/link error.
From the ARB_shading_language_420pack spec:
"More than one layout qualifier may appear in a single declaration. If
the same layout-qualifier-name occurs in multiple layout qualifiers for
the same declaration, the last one overrides the former ones."
V2: Removed link check, as suggested by Timothy.
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 files changed, 238 insertions, 0 deletions
diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom new file mode 100644 index 000000000..e55f66702 --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration-mismatch.geom @@ -0,0 +1,31 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack +// check_link: false +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From the ARB_gpu_shader5 spec: +// +// "If an invocation count is declared, all such declarations must +// specify the same count." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable +#extension GL_ARB_gpu_shader5 : enable + +#version 150 + +layout(points, invocations=4) layout(invocations=3) in; +layout(invocations=4) in; +layout(triangle_strip, max_vertices=3) out; + +void main() +{ +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom new file mode 100644 index 000000000..07a13f7d7 --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-invocation-in-single-declaration.geom @@ -0,0 +1,29 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack GL_ARB_gpu_shader5 +// check_link: false +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From the ARB_gpu_shader5 spec: +// +// "If an invocation count is declared, all such declarations must +// specify the same count." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable +#extension GL_ARB_gpu_shader5 : enable + +layout(points, invocations=3) layout(invocations=4) in; +layout(invocations=4) in; +layout(triangle_strip, max_vertices=3) out; + +void main() +{ +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp new file mode 100644 index 000000000..fa96e55cd --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration-mismatch.comp @@ -0,0 +1,28 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack GL_ARB_compute_shader +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From the ARB_compute_shader spec: +// +// "[If an input layout qualifier] is declared more than once in +// the same shader, all those declarations must indicate the same +// local work-group size; otherwise a compile-time error results." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable +#extension GL_ARB_compute_shader: enable + +layout(local_size_z = 2) layout(local_size_z = 1) in; +layout(local_size_z = 2) in; + +void main() +{ +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp new file mode 100644 index 000000000..e2fba9cf6 --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-local_size-in-single-declaration.comp @@ -0,0 +1,28 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack GL_ARB_compute_shader +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From the ARB_compute_shader spec: +// +// "[If an input layout qualifier] is declared more than once in +// the same shader, all those declarations must indicate the same +// local work-group size; otherwise a compile-time error results." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable +#extension GL_ARB_compute_shader: enable + +layout(local_size_z = 1) layout(local_size_z = 2) in; +layout(local_size_z = 2) in; + +void main() +{ +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom new file mode 100644 index 000000000..097d7c7dd --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration-mismatch.geom @@ -0,0 +1,31 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack +// check_link: true +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// +// "All geometry shader output layout declarations in a program must declare the +// same layout and same value for max_vertices." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable + +layout(lines) in; +layout(line_strip, max_vertices=2) layout(max_vertices=3) out; + +in vec4 pos[]; + +layout(max_vertices=2) out; + +void main() +{ +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom new file mode 100644 index 000000000..88e1228c6 --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-max_vertices-in-single-declaration.geom @@ -0,0 +1,31 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack +// check_link: true +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From section 4.3.8.2(Output Layout Qualifiers) of the GLSL 1.50 spec says: +// +// "All geometry shader output layout declarations in a program must declare the +// same layout and same value for max_vertices." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable + +layout(lines) in; +layout(line_strip, max_vertices=2) layout(max_vertices=3) out; + +in vec4 pos[]; + +layout(max_vertices=3) out; + +void main() +{ +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc new file mode 100644 index 000000000..a4aa65a99 --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration-mismatch.tesc @@ -0,0 +1,30 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack GL_ARB_tessellation_shader +// check_link: true +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From the ARB_tessellation_shader spec: +// +// "All tessellation control shader layout declarations in a program must +// specify the same output patch vertex count." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable +#extension GL_ARB_tessellation_shader: require + +layout(vertices = 3) layout(vertices = 4) out; +layout(vertices = 3) out; + +void main() { + gl_out[gl_InvocationID].gl_Position = vec4(0.0); + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0); + gl_TessLevelInner = float[2](1.0, 1.0); +} diff --git a/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc new file mode 100644 index 000000000..f43f50fdc --- /dev/null +++ b/tests/spec/arb_shading_language_420pack/compiler/layout-qualifiers/multiple-vertices-in-single-declaration.tesc @@ -0,0 +1,30 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_shading_language_420pack GL_ARB_tessellation_shader +// check_link: true +// [end config] +// +// From the ARB_shading_language_420pack spec: +// +// "More than one layout qualifier may appear in a single declaration. If +// the same layout-qualifier-name occurs in multiple layout qualifiers for +// the same declaration, the last one overrides the former ones." +// +// From the ARB_tessellation_shader spec: +// +// "All tessellation control shader layout declarations in a program must +// specify the same output patch vertex count." + +#version 150 +#extension GL_ARB_shading_language_420pack: enable +#extension GL_ARB_tessellation_shader: require + +layout(vertices = 4) layout(vertices = 3) out; +layout(vertices = 3) out; + +void main() { + gl_out[gl_InvocationID].gl_Position = vec4(0.0); + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0); + gl_TessLevelInner = float[2](1.0, 1.0); +} |