[Mesa-dev] [PATCH v2 02/73] nir: fix nir_lower_wpos_ytransform when gl_FragCoord is a system value

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 5 10:47:46 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/compiler/nir/nir_lower_wpos_ytransform.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c b/src/compiler/nir/nir_lower_wpos_ytransform.c
index 873d259..771c6ff 100644
--- a/src/compiler/nir/nir_lower_wpos_ytransform.c
+++ b/src/compiler/nir/nir_lower_wpos_ytransform.c
@@ -295,22 +295,24 @@ lower_load_sample_pos(lower_wpos_ytransform_state *state,
 static void
 lower_wpos_ytransform_block(lower_wpos_ytransform_state *state, nir_block *block)
 {
    nir_foreach_instr_safe(instr, block) {
       if (instr->type == nir_instr_type_intrinsic) {
          nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
          if (intr->intrinsic == nir_intrinsic_load_var) {
             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);
             } else if (var->data.mode == nir_var_system_value &&
                        var->data.location == SYSTEM_VALUE_SAMPLE_POS) {
                assert(dvar->deref.child == NULL);
                lower_load_sample_pos(state, intr);
             }
          } else if (intr->intrinsic == nir_intrinsic_interp_var_at_offset) {
             lower_interp_var_at_offset(state, intr);
-- 
2.9.3



More information about the mesa-dev mailing list