diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 9684203fb0d..2a93a7fd401 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -8389,6 +8389,59 @@ ast_interface_block::hir(exec_list *instructions, const glsl_type *block_array_type = process_array_type(&loc, block_type, this->array_specifier, state); + /* From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec: + * + * "For some blocks declared as arrays, the location can only be applied + * at the block level: When a block is declared as an array where + * additional locations are needed for each member for each block array + * element, it is a compile-time error to specify locations on the block + * members. That is, when locations would be under specified by applying + * them on block members, they are not allowed on block members. For + * arrayed interfaces (those generally having an extra level of + * arrayness due to interface expansion), the outer array is stripped + * before applying this rule" + * + * From 4.4.1 (Input Layout Qualifiers) and + * 4.4.2 (Output Layout Qualifiers) of GLSL ES 3.20 + * + * "If an input is declared as an array of blocks, excluding + * per-vertex-arrays as required for tessellation, it is an error + * to declare a member of the block with a location qualifier." + * + * "If an output is declared as an array of blocks, excluding + * per-vertex-arrays as required for tessellation, it is an error + * to declare a member of the block with a location qualifier." + */ + if (!redeclaring_per_vertex && + (state->has_enhanced_layouts() || state->has_shader_io_blocks())) { + bool allow_location; + switch (state->stage) + { + case MESA_SHADER_TESS_CTRL: + allow_location = this->array_specifier->is_single_dimension(); + break; + case MESA_SHADER_TESS_EVAL: + case MESA_SHADER_GEOMETRY: + allow_location = (this->array_specifier->is_single_dimension() + && var_mode == ir_var_shader_in); + break; + default: + allow_location = false; + break; + } + + if (!allow_location) { + for (unsigned i = 0; i < num_variables; i++) { + if (fields[i].location != -1) { + _mesa_glsl_error(&loc, state, + "explicit member locations are not allowed in " + "blocks declared as arrays %s shader", + _mesa_shader_stage_to_string(state->stage)); + } + } + } + } + /* Section 4.3.7 (Interface Blocks) of the GLSL 1.50 spec says: * * For uniform blocks declared an array, each individual array diff --git a/src/gallium/drivers/llvmpipe/ci/llvmpipe-fails.txt b/src/gallium/drivers/llvmpipe/ci/llvmpipe-fails.txt index 6e9fb356550..7c9f03921e0 100644 --- a/src/gallium/drivers/llvmpipe/ci/llvmpipe-fails.txt +++ b/src/gallium/drivers/llvmpipe/ci/llvmpipe-fails.txt @@ -36,8 +36,6 @@ dEQP-GLES31.functional.primitive_bounding_box.wide_points.tessellation_set_per_p # Got wrong error code: GL_INVALID_OPERATION, expected: GL_INVALID_VALUE after step 0 at glcCompressedFormatTests.cpp:1463 (Fail) KHR-GLES31.core.compressed_format.api.invalid_teximage_with_compressed_format,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.frag,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.vert,Fail spec@glsl-1.20@compiler@invalid-vec4-array-to-vec3-array-conversion.vert,Fail spec@oes_shader_io_blocks@compiler@layout-location-aliasing.vert,Fail diff --git a/src/gallium/drivers/radeonsi/ci/navi10-piglit-quick-fail.csv b/src/gallium/drivers/radeonsi/ci/navi10-piglit-quick-fail.csv index ef65cd083d0..960e56867de 100644 --- a/src/gallium/drivers/radeonsi/ci/navi10-piglit-quick-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/navi10-piglit-quick-fail.csv @@ -37,8 +37,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-first,Fail spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail spec@arb_bindless_texture@compiler@images@arith-bound-image.frag,Crash spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.frag,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.vert,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2-mat2,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x3-mat2x3,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x4-mat2x4,Fail diff --git a/src/gallium/drivers/radeonsi/ci/raven-piglit-quick-fail.csv b/src/gallium/drivers/radeonsi/ci/raven-piglit-quick-fail.csv index 5a67d197786..4cb33831ae3 100644 --- a/src/gallium/drivers/radeonsi/ci/raven-piglit-quick-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/raven-piglit-quick-fail.csv @@ -56,8 +56,6 @@ spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,C spec@arb_bindless_texture@illegal,Fail spec@arb_bindless_texture@illegal@Call glCopyTexImage* when a texture handle is referenced,Fail spec@arb_bindless_texture@illegal@Call glTexImage* when a texture handle is referenced,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.frag,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.vert,Fail spec@arb_gl_spirv@execution@ssbo@aoa,Fail spec@arb_gl_spirv@execution@ssbo@aoa-2,Fail spec@arb_gl_spirv@execution@ssbo@array,Fail diff --git a/src/gallium/drivers/radeonsi/ci/sienna_cichlid-piglit-quick-fail.csv b/src/gallium/drivers/radeonsi/ci/sienna_cichlid-piglit-quick-fail.csv index a576fdcccd5..0e670f49de0 100644 --- a/src/gallium/drivers/radeonsi/ci/sienna_cichlid-piglit-quick-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/sienna_cichlid-piglit-quick-fail.csv @@ -37,8 +37,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-first,Fail spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail spec@arb_bindless_texture@compiler@images@arith-bound-image.frag,Crash spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.frag,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.vert,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2-mat2,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x3-mat2x3,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x4-mat2x4,Fail diff --git a/src/gallium/drivers/radeonsi/ci/vega20-piglit-quick-fail.csv b/src/gallium/drivers/radeonsi/ci/vega20-piglit-quick-fail.csv index 2fd6268a73f..77c5e9d53d2 100644 --- a/src/gallium/drivers/radeonsi/ci/vega20-piglit-quick-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/vega20-piglit-quick-fail.csv @@ -48,8 +48,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail spec@!opengl 3.2@gl-3.2-adj-prims pv-last,Fail spec@arb_bindless_texture@compiler@images@arith-bound-image.frag,Crash spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.frag,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.vert,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2-mat2,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x3-mat2x3,Fail spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x4-mat2x4,Fail diff --git a/src/gallium/drivers/zink/ci/zink-radv-fails.txt b/src/gallium/drivers/zink/ci/zink-radv-fails.txt index 47ece7c0882..9b59e840099 100644 --- a/src/gallium/drivers/zink/ci/zink-radv-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-radv-fails.txt @@ -1345,8 +1345,6 @@ spec@arb_depth_texture@texwrap formats offset@GL_DEPTH_COMPONENT24- swizzled,Fai spec@arb_depth_texture@texwrap formats offset@GL_DEPTH_COMPONENT32,Fail spec@arb_depth_texture@texwrap formats offset@GL_DEPTH_COMPONENT32- NPOT,Fail spec@arb_depth_texture@texwrap formats offset@GL_DEPTH_COMPONENT32- swizzled,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.frag,Fail -spec@arb_enhanced_layouts@compiler@block-member-locations@arrayed-block-member-location.vert,Fail spec@arb_enhanced_layouts@execution@component-layout@vs-fs-array-dvec3,Crash spec@arb_enhanced_layouts@execution@component-layout@vs-gs-fs-double,Fail spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail