glsl: do not raise unitialized variable warnings on builtins/reserved GL variables
authorAlejandro Piñeiro <apinheiro@igalia.com>
Fri, 1 Apr 2016 07:11:15 +0000 (09:11 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Fri, 1 Apr 2016 07:54:09 +0000 (09:54 +0200)
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)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/glsl/ast_to_hir.cpp

index a03123191616f30aa103ad75765bb437c372ccb7..3fe90079420ba3c19ea0d17acd8ace8ce266e394 100644 (file)
@@ -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);
          }