aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast.h
diff options
context:
space:
mode:
authorAndres Gomez <[email protected]>2016-10-22 17:01:11 +0300
committerAndres Gomez <[email protected]>2016-11-25 13:18:30 +0200
commitbe54a58da3ee5485d18c04e1ccc0a1c6137a46a3 (patch)
treec1ed597cc1e13800535a63688357b024b1360dcc /src/compiler/glsl/ast.h
parentb95793b9a7e8b18eb9b5d80eb79c4913063c8840 (diff)
glsl: ignore all but the rightmost layout qualifier name from the rightmost layout qualifier
From page 46 (page 52 of the PDF) of the GLSL 4.20 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." Consider this example: " #version 150 #extension GL_ARB_shading_language_420pack: enable layout(max_vertices=2) layout(max_vertices=3) out; layout(max_vertices=3) out;" Although different values for "max_vertices" results in a compilation error. The above code is valid because max_vertices=2 is ignored. Hence, when merging qualifiers in an ast_type_qualifier, we now ignore new appearances of a same layout-qualifier-name if the new "is_multiple_layouts_merge" parameter is on, since the GLSL parser works in this case from right to left. In addition, any special treatment for the buffer, uniform, in or out layout defaults has been moved in the GLSL parser to the rule triggered just after any previous processing/merging on the layout-qualifiers has happened in a single declaration since it was run too soon previously. Fixes GL44-CTS.shading_language_420pack.qualifier_override_layout Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Andres Gomez <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ast.h')
-rw-r--r--src/compiler/glsl/ast.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 62ccb9d4d34..7bbb58800a7 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -753,7 +753,8 @@ struct ast_type_qualifier {
bool merge_qualifier(YYLTYPE *loc,
_mesa_glsl_parse_state *state,
const ast_type_qualifier &q,
- bool is_single_layout_merge);
+ bool is_single_layout_merge,
+ bool is_multiple_layouts_merge = false);
/**
* Validate current qualifier against the global out one.