glsl: don't try to lower non-gl builtins as if they were gl_FragData
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 1 Jul 2016 23:10:36 +0000 (19:10 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 6 Jul 2016 01:22:01 +0000 (21:22 -0400)
If a shader has an output array, it will get treated as though it were
gl_FragData and rewritten into gl_out_FragData instances. We only want
this to happen on the actual gl_FragData and not everything else.

This is a small part of the problem pointed out by the below bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96765
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
src/compiler/glsl/opt_dead_builtin_varyings.cpp

index 7feea3ba18b5c93076a68c45689e1182efdeb00c..a28887f7cff8b28494ab2a17d722c7ff4f578280 100644 (file)
@@ -85,7 +85,8 @@ public:
    {
       ir_variable *var = ir->variable_referenced();
 
-      if (!var || var->data.mode != this->mode || !var->type->is_array())
+      if (!var || var->data.mode != this->mode || !var->type->is_array() ||
+          !is_gl_identifier(var->name))
          return visit_continue;
 
       /* Only match gl_FragData[], not gl_SecondaryFragDataEXT[] */