glsl: allow the #extension directive within code blocks for the dri option
authorMarek Olšák <marek.olsak@amd.com>
Tue, 9 Apr 2019 22:15:34 +0000 (18:15 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 12 Apr 2019 15:34:39 +0000 (11:34 -0400)
for Viewperf 13

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/glsl_parser.yy

index 8d6c47fb6a3ac29516c9df9fe7fe084168e0683c..b91c24ebe9706ef53254371c5a779c8875695b2a 100644 (file)
@@ -2538,6 +2538,15 @@ statement_list:
       $$ = $1;
       $$->link.insert_before(& $2->link);
    }
       $$ = $1;
       $$->link.insert_before(& $2->link);
    }
+   | statement_list extension_statement
+   {
+      if (!state->allow_extension_directive_midshader) {
+         _mesa_glsl_error(& @1, state,
+                          "#extension directive is not allowed "
+                          "in the middle of a shader");
+         YYERROR;
+      }
+   }
    ;
 
 expression_statement:
    ;
 
 expression_statement: