[Mesa-dev] [PATCH v5 00/14] deal with multiple appearances of the same layout-qualifier-name in a single declaration

Andres Gomez agomez at igalia.com
Wed Nov 23 12:20:02 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 v5 series are:
  In patch 7/14, instead of adding comments, we replace the if
    condition with an assert.
  New patch 8/14.

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

Andres Gomez (14):
  glsl: ignore all but the rightmost layout-qualifier-name
  glsl: merge layouts into the default one as the last step in interface
    blocks
  glsl: split default out layout qualifier merge
  glsl: split default in layout qualifier merge
  glsl: simplifies the merge of the default in layout qualifier
  glsl: remove unneeded check for incompatible primitive types in GS
  glsl: assert on incoherent point mode layout-id-qualifier validation
  glsl: refactor duplicated validations between 2 layout-qualifiers
  glsl: ignore all but the rightmost layout qualifier name from the
    rightmost layout qualifier
  glsl: simplified ast_type_qualifier::merge_into_[in|out]_qualifier API
  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"

 src/compiler/glsl/ast.h                  |  53 +++-
 src/compiler/glsl/ast_to_hir.cpp         |  13 +-
 src/compiler/glsl/ast_type.cpp           | 424 ++++++++++++++++++-------------
 src/compiler/glsl/glsl_parser.yy         | 184 +++++++-------
 src/compiler/glsl/glsl_parser_extras.cpp |  22 +-
 5 files changed, 404 insertions(+), 292 deletions(-)

-- 
2.9.3



More information about the mesa-dev mailing list