[Mesa-dev] [PATCH v3 0/8] deal with multiple appearances of the same layout-qualifier-name in a single declaration

Andres Gomez agomez at igalia.com
Wed Oct 26 15:30:43 UTC 2016


In the case of layout-qualifier-names that can appear multiple times
in different declarations of the same shader or, even, the same
program, but that have to consistently hold the same value we are
using the ast_layout_expression class which holds a list to store all
the appearances to be able to check for coherence later.

Until now, we were also holding inside the ast_layout_expression
values of the same layout-qualifier-name that could appear inside a
single layout-qualifier or across multiple layout-qualifiers in a
single declaration.

This was a problem since, inside a declaration, only the last
appearance should be taken into account. As we were not doing this,
the compilation or linking was failing due to different values of the
same layout-qualifier-name in a single declaration when such
layout-qualifier-name had as a constraint to hold the same value
across the same shader or program.

Now, we only hold the last appearanace of a repeated
layout-qualifier-name inside a single declaration.

These following 2 example will help to illustrate the problem:

- " #version 150
    #extension GL_ARB_shading_language_420pack: enable
    #extension GL_ARB_enhanced_layouts: enable

    layout(max_vertices=2, max_vertices=3) out;
    layout(max_vertices=3) out;"

- " #version 150
    #extension GL_ARB_shading_language_420pack: enable
    #extension GL_ARB_enhanced_layouts: enable

    layout(max_vertices=2) layout(max_vertices=3) out;
    layout(max_vertices=3) out;"

Although different values for "max_vertices" should result in a
compilation error. The above code is valid because max_vertices=2 is
ignored.

The main changes in this v3 series are:
  Patch 2/8 has been modified to use an additional default_layout
    variable instead of a layout_helper and the merges are done
    directly on the layout one.
  Old patch v2 5/9 has been removed, which was allowing multiple
    layout-qualifiers in the same declaration with
    ARB_enhanced_layouts in addition to ARB_shading_language_420pack.

Fixes:
- GL44-CTS.shading_language_420pack.qualifier_override_layout
- GL44-CTS.enhanced_layouts.xfb_duplicated_stride

Andres Gomez (8):
  glsl: ignore all but the rightmost layout-qualifier-name
  glsl: merge layouts into the default one as the last step in interface
    blocks
  glsl: ignore all but the rightmost layout qualifier name from the
    rightmost layout qualifier
  glsl: simplified error checking for duplicated layout-qualifiers
  glsl: push layout-qualifier-name values from variable declarations to
    global
  Revert "glsl: geom shader max_vertices layout must match."
  Revert "glsl: allow layout qualifier overrides with
    ARB_shading_language_420pack"
  glsl: simplified ast_type_qualifier::merge_[in|out]_qualifier API

 src/compiler/glsl/ast.h                  |  25 +++--
 src/compiler/glsl/ast_type.cpp           | 126 ++++++++++++----------
 src/compiler/glsl/glsl_parser.yy         | 172 +++++++++++++++----------------
 src/compiler/glsl/glsl_parser_extras.cpp |  22 ++--
 4 files changed, 185 insertions(+), 160 deletions(-)

-- 
2.9.3



More information about the mesa-dev mailing list