[Mesa-dev] [PATCH 4/5] glsl: partially add missing support for duplicate layouts on globals

Timothy Arceri timothy.arceri at collabora.com
Thu Jan 14 18:45:51 PST 2016


>From the ARB_shading_language_420pack 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."

Full support will require merging to be made more generic, but at
least with this the error messages will be more informative.

Cc: Matt Turner <mattst88 at gmail.com>
---
 src/glsl/glsl_parser.yy | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 51796a6..d1f80d0 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -2738,7 +2738,19 @@ member_declaration:
    ;
 
 layout_defaults:
-   layout_qualifier UNIFORM ';'
+   layout_qualifier layout_defaults
+   {
+      if (!state->has_420pack_or_es31()) {
+         _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
+         YYERROR;
+      } else {
+         _mesa_glsl_error(&@1, state, "Mesa lacks support for duplicate "
+                          "layout(...) qualifiers on globals FIXME");
+         YYERROR;
+      }
+   }
+
+   | layout_qualifier UNIFORM ';'
    {
       if (!state->default_uniform_qualifier->merge_qualifier(& @1, state, $1)) {
          YYERROR;
-- 
2.4.3



More information about the mesa-dev mailing list