glsl: allow the #extension directive within code blocks for the dri option

Submitted by Marek Olšák on April 9, 2019, 11:39 p.m.

Details

Message ID 20190409233908.10368-1-maraeo@gmail.com
State New
Headers show
Series "glsl: allow the #extension directive within code blocks for the dri option" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák April 9, 2019, 11:39 p.m.
From: Marek Olšák <marek.olsak@amd.com>

for Viewperf 13
---
 src/compiler/glsl/glsl_parser.yy | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 8d6c47fb6a3..b91c24ebe97 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2531,20 +2531,29 @@  statement_list:
    }
    | statement_list statement
    {
       if ($2 == NULL) {
          _mesa_glsl_error(& @2, state, "<nil> statement");
          assert($2 != NULL);
       }
       $$ = $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:
    ';'
    {
       void *ctx = state->linalloc;
       $$ = new(ctx) ast_expression_statement(NULL);
       $$->set_location(@1);
    }
    | expression ';'

Comments

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>

On 10/4/19 9:39 am, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak@amd.com>
> 
> for Viewperf 13
> ---
>   src/compiler/glsl/glsl_parser.yy | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
> index 8d6c47fb6a3..b91c24ebe97 100644
> --- a/src/compiler/glsl/glsl_parser.yy
> +++ b/src/compiler/glsl/glsl_parser.yy
> @@ -2531,20 +2531,29 @@ statement_list:
>      }
>      | statement_list statement
>      {
>         if ($2 == NULL) {
>            _mesa_glsl_error(& @2, state, "<nil> statement");
>            assert($2 != NULL);
>         }
>         $$ = $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:
>      ';'
>      {
>         void *ctx = state->linalloc;
>         $$ = new(ctx) ast_expression_statement(NULL);
>         $$->set_location(@1);
>      }
>      | expression ';'
>