[Mesa-dev] [PATCH 8/9] Revert "glsl: allow layout qualifier overrides with ARB_shading_language_420pack"

Andres Gomez agomez at igalia.com
Sat Oct 22 20:09:15 UTC 2016

This reverts commit aaa69c79cd584db4d9c6ea7794e93d29f3d54572.

The commit was erroneous because the ast_layout_expression class is
meant to hold a list used for an after check that all the declared
values for a layout-qualifier-name are consistent.

Therefore, the check for the possibility of duplicated values was
previously fixed to happen much sooner, in the GLSL parser and the
merge of layout qualifiers, and the process_qualifier_constant method
only needs to check that the values are consistent.

By now, those layout-qualifier-name represented as a
ast_layout_expression are "max_vertices", "invocations", "vertices",
"local_size_[x|y|z]" and "xfb_stride".

>From page 40 (page 46 of the PDF) of the GLSL 1.50 spec:

  " All geometry shader output layout declarations in a program must
    declare the same layout and same value for max_vertices."

>From page 44 (page 50 of the PDF) of the GLSL 4.00 spec:

  " If an invocation count is declared, all such declarations must
    specify the same count."

>From page 47 (page 53 of the PDF) of the GLSL 4.00 spec:

  " All tessellation control shader layout declarations in a program
    must specify the same output patch vertex count."

>From page 60 (page 66 of the PDF) of the GLSL 4.30 spec:

  " Also, if such a layout qualifier is declared more than once in the
    same shader, all those declarations must set the same set of local
    work-group sizes and set them to the same values; otherwise a
    compile-time error results. If multiple compute shaders attached
    to a single program object declare local work-group size, the
    declarations must be identical; otherwise a link-time error

>From page 73 (page 79 of the PDF) of the GLSL 4.40 spec:

  " While xfb_stride can be declared multiple times for the same
    buffer, it is a compile-time or link-time error to have different
    values specified for the stride for the same buffer."

Fixes GL44-CTS.enhanced_layouts.xfb_duplicated_stride

Signed-off-by: Andres Gomez <agomez at igalia.com>
 src/compiler/glsl/ast_type.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index 0bd30ca..c0c7ec7 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -744,12 +744,7 @@ ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state
          return false;
-      /* From section 4.4 "Layout Qualifiers" of the GLSL 4.50 spec:
-       * "When the same layout-qualifier-name occurs multiple times,
-       *  in a single declaration, the last occurrence overrides the
-       *  former occurrence(s)."
-       */
-      if (!state->has_420pack() && !first_pass && *value != const_int->value.u[0]) {
+      if (!first_pass && *value != const_int->value.u[0]) {
          YYLTYPE loc = const_expression->get_location();
          _mesa_glsl_error(&loc, state, "%s layout qualifier does not "
 		          "match previous declaration (%d vs %d)",

More information about the mesa-dev mailing list