diff options
author | Kenneth Graunke <[email protected]> | 2012-11-27 23:45:17 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-01-25 09:07:33 -0500 |
commit | 34f966bdcb22733a159fb680859a83f88ef01d2a (patch) | |
tree | 2e43d668ad60ef98960e72bab1c77e05fd8305b0 /src/glsl/glsl_parser.yy | |
parent | 0d2e6336a21e20afe37861030ac2161aadd0499e (diff) |
glsl: Parse non-array uniform block instance names in GLSL ES 3.00.
In GLSL ES 3.00 (and GLSL 1.50), uniform blocks can have an associated
"instance name", which essentially namespaces the variables inside.
This patch adds basic parsing for this new feature, but doesn't yet hook
it up to actually do anything yet.
It does not support for arrays of interface blocks; a later commit will
take care of that.
This change temporarily regresses the piglit test
interface-name-access-without-interface-name.vert. This shader failed
to compile before (the expected result), but it failed to compile for
the wrong reason. This is not a real regression.
v2: Add some comments to ast_uniform_block::instance_name. Suggested by
Paul Berry.
Reviewed-by: Carl Worth <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser.yy')
-rw-r--r-- | src/glsl/glsl_parser.yy | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 16173660cac..81ae5d51948 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -112,6 +112,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token STRUCT VOID_TOK WHILE %token <identifier> IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER %type <identifier> any_identifier +%type <identifier> instance_name_opt %token <real> FLOATCONSTANT %token <n> INTCONSTANT UINTCONSTANT BOOLCONSTANT %token <identifier> FIELD_SELECTION @@ -1899,11 +1900,11 @@ uniform_block: ; basic_uniform_block: - UNIFORM NEW_IDENTIFIER '{' member_list '}' ';' + UNIFORM NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';' { void *ctx = state; $$ = new(ctx) ast_uniform_block(*state->default_uniform_qualifier, - $2, $4); + $2, $4, $6); if (!state->ARB_uniform_buffer_object_enable) { _mesa_glsl_error(& @1, state, @@ -1917,6 +1918,21 @@ basic_uniform_block: } ; +instance_name_opt: + /* empty */ + { + $$ = NULL; + } + | NEW_IDENTIFIER + { + if (!(state->language_version == 300 && state->es_shader)) { + _mesa_glsl_error(& @1, state, + "#version 300 es required for using uniform " + "blocks with an instance name\n"); + } + } + ; + member_list: member_declaration { |