Mesa (master): nir/lower_wpos_center: Look at derefs for modes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 18 19:13:41 UTC 2018


Module: Mesa
Branch: master
Commit: cf7fb3980596f46c8376f1121043b98332eab62c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf7fb3980596f46c8376f1121043b98332eab62c

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Dec 13 15:03:28 2018 -0600

nir/lower_wpos_center: Look at derefs for modes

This is instead of looking all the way back to the variable which may
not exist for all derefs.  This makes this code properly ignore casts
with modes other than the mode[s] we care about (where casts aren't
allowed).

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

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

diff --git a/src/compiler/nir/nir_lower_wpos_center.c b/src/compiler/nir/nir_lower_wpos_center.c
index 74f4d2a970..3c114936f7 100644
--- a/src/compiler/nir/nir_lower_wpos_center.c
+++ b/src/compiler/nir/nir_lower_wpos_center.c
@@ -82,10 +82,12 @@ lower_wpos_center_block(nir_builder *b, nir_block *block,
          nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
          if (intr->intrinsic == nir_intrinsic_load_deref) {
             nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
+            if (deref->mode != nir_var_shader_in)
+               continue;
+
             nir_variable *var = nir_deref_instr_get_variable(deref);
 
-            if (var->data.mode == nir_var_shader_in &&
-                var->data.location == VARYING_SLOT_POS) {
+            if (var->data.location == VARYING_SLOT_POS) {
                /* gl_FragCoord should not have array/struct derefs: */
                assert(deref->deref_type == nir_deref_type_var);
                update_fragcoord(b, intr, for_sample_shading);




More information about the mesa-commit mailing list