<div dir="ltr">On 5 October 2013 12:25, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 10/02/2013 05:45 PM, Paul Berry wrote:<br>
> This patch modifies the get_variable_being_redeclared() function so<br>
> that it no longer relies on the ast_declaration for the variable being<br>
> redeclared.  In future patches, this will allow<br>
> get_variable_being_redeclared() to be used for processing<br>
> redeclarations of the built-in gl_PerVertex interface block.<br>
> ---<br>
>  src/glsl/ast_to_hir.cpp | 13 ++++++-------<br>
>  1 file changed, 6 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp<br>
> index 8fb7f2f..de65c71 100644<br>
> --- a/src/glsl/ast_to_hir.cpp<br>
> +++ b/src/glsl/ast_to_hir.cpp<br>
> @@ -2327,7 +2327,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,<br>
>   * is a redeclaration, \c NULL otherwise.<br>
>   */<br>
>  ir_variable *<br>
> -get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,<br>
> +get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,<br>
>                             struct _mesa_glsl_parse_state *state)<br>
<br>
</div>While you're at it, would you mind making this function static?<br></blockquote><div><br></div><div>Done.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Either way, patches 5-12 are:<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
<div class="HOEnZb"><div class="h5"><br>
>  {<br>
>     /* Check if this declaration is actually a re-declaration, either to<br>
> @@ -2336,16 +2336,14 @@ get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,<br>
>      * This is allowed for variables in the current scope, or when at<br>
>      * global scope (for built-ins in the implicit outer scope).<br>
>      */<br>
> -   ir_variable *earlier = state->symbols->get_variable(decl->identifier);<br>
> +   ir_variable *earlier = state->symbols->get_variable(var->name);<br>
>     if (earlier == NULL ||<br>
>         (state->current_function != NULL &&<br>
> -     !state->symbols->name_declared_this_scope(decl->identifier))) {<br>
> +     !state->symbols->name_declared_this_scope(var->name))) {<br>
>        return NULL;<br>
>     }<br>
><br>
><br>
> -   YYLTYPE loc = decl->get_location();<br>
> -<br>
>     /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec,<br>
>      *<br>
>      * "It is legal to declare an array without a size and then<br>
> @@ -2434,7 +2432,7 @@ get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,<br>
>        earlier->depth_layout = var->depth_layout;<br>
><br>
>     } else {<br>
> -      _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier);<br>
> +      _mesa_glsl_error(&loc, state, "`%s' redeclared", var->name);<br>
>     }<br>
><br>
>     return earlier;<br>
> @@ -3221,7 +3219,8 @@ ast_declarator_list::hir(exec_list *instructions,<br>
>         * instruction stream.<br>
>         */<br>
>        exec_list initializer_instructions;<br>
> -      ir_variable *earlier = get_variable_being_redeclared(var, decl, state);<br>
> +      ir_variable *earlier =<br>
> +         get_variable_being_redeclared(var, decl->get_location(), state);<br>
><br>
>        if (decl->initializer != NULL) {<br>
>        result = process_initializer((earlier == NULL) ? var : earlier,<br>
><br>
<br>
</div></div></blockquote></div><br></div></div>