glsl: Treat gl_FragCoord as a varying even when it's a system value
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 19 Jul 2019 15:42:56 +0000 (10:42 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Mon, 29 Jul 2019 23:30:26 +0000 (23:30 +0000)
This fixes glsl-fcoord-invariant-pass.shader_test on drivers that set
GLSLFragCoordIsSysVal which includes radeonsi among others.

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

index 9cd67ab7885121fb8af0e6d620c3cf2465e056e6..d7c396aa0ebdf0ab82b4da6ac09705362131ba69 100644 (file)
@@ -2706,7 +2706,9 @@ is_varying_var(ir_variable *var, gl_shader_stage target)
    case MESA_SHADER_VERTEX:
       return var->data.mode == ir_var_shader_out;
    case MESA_SHADER_FRAGMENT:
-      return var->data.mode == ir_var_shader_in;
+      return var->data.mode == ir_var_shader_in ||
+             (var->data.mode == ir_var_system_value &&
+              var->data.location == SYSTEM_VALUE_FRAG_COORD);
    default:
       return var->data.mode == ir_var_shader_out || var->data.mode == ir_var_shader_in;
    }