glsl: Don't remove XFB-only varyings.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 3 Apr 2016 07:48:03 +0000 (00:48 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 11 Apr 2016 02:03:06 +0000 (19:03 -0700)
Consider the case of linking a program with both a vertex and fragment
shader.  The VS may compute output varyings that are intended for
transform feedback, and not read by the fragment shader.

In this case, var->data.is_unmatched_generic_inout will be true,
but we still cannot eliminate the varyings.  We need to also check
!var->data.is_xfb_only.

Fixes failures in ES31-CTS.gpu_shader5.fma_precision_*, which happen
to use transform feedback in a way we apparently hadn't seen before.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/compiler/glsl/link_varyings.cpp

index e9d0067459a7c74fc59b69376d1572fb24c2cf9a..87606be9337be934e02097cf9b18f0e0534ac4bc 100644 (file)
@@ -488,7 +488,7 @@ remove_unused_shader_inputs_and_outputs(bool is_separate_shader_object,
        * its value is used by other shader stages. This will cause the
        * variable to have a location assigned.
        */
-      if (var->data.is_unmatched_generic_inout) {
+      if (var->data.is_unmatched_generic_inout && !var->data.is_xfb_only) {
          assert(var->data.mode != ir_var_temporary);
          var->data.mode = ir_var_auto;
       }