Mesa (master): nir/lower_io_to_scalar: 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: 867fe35a16c309374d68530a415b1aca1d0f1975
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=867fe35a16c309374d68530a415b1aca1d0f1975

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

nir/lower_io_to_scalar: 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_io_to_scalar.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c
index 929761fa88..d58805294b 100644
--- a/src/compiler/nir/nir_lower_io_to_scalar.c
+++ b/src/compiler/nir/nir_lower_io_to_scalar.c
@@ -308,9 +308,12 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask)
                    intr->intrinsic != nir_intrinsic_interp_deref_at_offset)
                   continue;
 
-               nir_variable *var =
-                  nir_deref_instr_get_variable(nir_src_as_deref(intr->src[0]));
-               nir_variable_mode mode = var->data.mode;
+               nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
+               nir_variable_mode mode = deref->mode;
+               if (!(mode & mask))
+                  continue;
+
+               nir_variable *var = nir_deref_instr_get_variable(deref);
 
                /* TODO: add patch support */
                if (var->data.patch)




More information about the mesa-commit mailing list