glsl: Don't attempt to do dead varying elimination on gl_LastFragData arrays.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 20 Jul 2016 03:23:17 +0000 (20:23 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 24 Aug 2016 20:28:31 +0000 (13:28 -0700)
Apparently this pass can only handle elimination of a single built-in
fragment output array, so the presence of gl_LastFragData (which it
wouldn't split correctly anyway) could prevent it from splitting the
actual gl_FragData array.  Just match gl_FragData by name since it's
the only built-in it can handle.

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

index 900a09697bb48cd56c42265e5c9c76171c754d91..4526f2bca009e3b631c1fda3a94c19e59ec1de2a 100644 (file)
@@ -89,9 +89,10 @@ public:
           !is_gl_identifier(var->name))
          return visit_continue;
 
-      /* Only match gl_FragData[], not gl_SecondaryFragDataEXT[] */
-      if (this->find_frag_outputs && var->data.location == FRAG_RESULT_DATA0 &&
-          var->data.index == 0) {
+      /* Only match gl_FragData[], not gl_SecondaryFragDataEXT[] or
+       * gl_LastFragData[].
+       */
+      if (this->find_frag_outputs && strcmp(var->name, "gl_FragData") == 0) {
          this->fragdata_array = var;
 
          ir_constant *index = ir->array_index->as_constant();