[Mesa-dev] [PATCH] glsl: Allow layout qualifiers in GLSL 3.00 ES

Ian Romanick idr at freedesktop.org
Fri Nov 16 14:53:35 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Note that while 'packed' is a reserved word in GLSL ES, row_major is not.
This means that we have to use the string-based matching for that.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/glsl_lexer.ll          | 2 +-
 src/glsl/glsl_parser.yy         | 2 ++
 src/glsl/glsl_parser_extras.cpp | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 817007b..fd5eb0a 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -430,7 +430,7 @@ enum		KEYWORD(110, 100, 0, 0, ENUM);
 typedef		KEYWORD(110, 100, 0, 0, TYPEDEF);
 template	KEYWORD(110, 100, 0, 0, TEMPLATE);
 this		KEYWORD(110, 100, 0, 0, THIS);
-packed		KEYWORD_WITH_ALT(110, 100, 140, 0, yyextra->ARB_uniform_buffer_object_enable, PACKED_TOK);
+packed		KEYWORD_WITH_ALT(110, 100, 140, 300, yyextra->ARB_uniform_buffer_object_enable, PACKED_TOK);
 goto		KEYWORD(110, 100, 0, 0, GOTO);
 switch		KEYWORD(110, 100, 130, 300, SWITCH);
 default		KEYWORD(110, 100, 130, 300, DEFAULT);
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 2ff68d6..81946f5 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1136,6 +1136,8 @@ layout_qualifier_id:
 	         $$.flags.q.shared = 1;
 	      } else if (strcmp($1, "column_major") == 0) {
 	         $$.flags.q.column_major = 1;
+	      } else if (strcmp($1, "row_major") == 0) {
+	         $$.flags.q.row_major = 1;
 	      }
 
 	      if ($$.flags.i && state->ARB_uniform_buffer_object_warn) {
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 9eaf961..e332216 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -260,6 +260,10 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
    if (this->language_version >= 140) {
       this->ARB_uniform_buffer_object_enable = true;
    }
+
+   if (this->language_version == 300 && this->es_shader) {
+      this->ARB_explicit_attrib_location_enable = true;
+   }
 }
 
 const char *
-- 
1.7.11.7



More information about the mesa-dev mailing list