nir: fix nir_lower_wpos_ytransform when gl_FragCoord is a system value
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 25 Jun 2017 13:26:01 +0000 (15:26 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 31 Jul 2017 12:55:28 +0000 (14:55 +0200)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_lower_wpos_ytransform.c

index 873d259d7fc201e52fe150f0c4f7b38a19a87320..771c6ffe4a5cb237e8de0dfc6df020cef47c5598 100644 (file)
@@ -302,8 +302,10 @@ lower_wpos_ytransform_block(lower_wpos_ytransform_state *state, nir_block *block
             nir_deref_var *dvar = intr->variables[0];
             nir_variable *var = dvar->var;
 
-            if (var->data.mode == nir_var_shader_in &&
-                var->data.location == VARYING_SLOT_POS) {
+            if ((var->data.mode == nir_var_shader_in &&
+                 var->data.location == VARYING_SLOT_POS) ||
+                (var->data.mode == nir_var_system_value &&
+                 var->data.location == SYSTEM_VALUE_FRAG_COORD)) {
                /* gl_FragCoord should not have array/struct derefs: */
                assert(dvar->deref.child == NULL);
                lower_fragcoord(state, intr);