[Mesa-dev] [PATCH] glsl: do not raise unitialized variable warnings on builtins/reserved GL variables

Kenneth Graunke kenneth at whitecape.org
Fri Apr 1 07:46:26 UTC 2016


On Friday, April 1, 2016 9:40:03 AM PDT Alejandro PiƱeiro wrote:
> Needed because not all the built-in variables are marked as system
> values, so they still have the mode ir_var_auto. Right now it fixes
> raising the warning when gl_GlobalInvocationID and
> gl_LocalInvocationIndex are used.
> 
> v2: use is_gl_identifier instead of filtering for some names (Ilia
>     Mirkin)
> ---
> 
>  src/compiler/glsl/ast_to_hir.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/
ast_to_hir.cpp
> index a031231..3fe9007 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -1905,7 +1905,8 @@ ast_expression::do_hir(exec_list *instructions,
>  
>           if ((var->data.mode == ir_var_auto || var->data.mode == 
ir_var_shader_out)
>               && !this->is_lhs
> -             && result->variable_referenced()->data.assigned != true) {
> +             && result->variable_referenced()->data.assigned != true
> +             && !is_gl_identifier(var->name)) {
>              _mesa_glsl_warning(&loc, state, "`%s' used uninitialized",
>                                 this->primary_expression.identifier);
>           }
> 

Looks good, thanks :)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160401/df99963f/attachment.sig>


More information about the mesa-dev mailing list