nir: Consider deref instructions in lower_phis_to_scalar
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 27 Mar 2018 01:13:59 +0000 (18:13 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Jun 2018 03:15:56 +0000 (20:15 -0700)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir_lower_phis_to_scalar.c

index d055e781074773e16b36e625799860f890afde75..6cb9420d0f2102817d3bd52f9e7dba4c91209405 100644 (file)
@@ -83,10 +83,19 @@ is_phi_src_scalarizable(nir_phi_src *src,
       nir_intrinsic_instr *src_intrin = nir_instr_as_intrinsic(src_instr);
 
       switch (src_intrin->intrinsic) {
+      case nir_intrinsic_load_deref: {
+         nir_deref_instr *deref = nir_src_as_deref(src_intrin->src[0]);
+         return deref->mode == nir_var_shader_in ||
+                deref->mode == nir_var_uniform;
+      }
+
       case nir_intrinsic_load_var:
          return src_intrin->variables[0]->var->data.mode == nir_var_shader_in ||
                 src_intrin->variables[0]->var->data.mode == nir_var_uniform;
 
+      case nir_intrinsic_interp_deref_at_centroid:
+      case nir_intrinsic_interp_deref_at_sample:
+      case nir_intrinsic_interp_deref_at_offset:
       case nir_intrinsic_interp_var_at_centroid:
       case nir_intrinsic_interp_var_at_sample:
       case nir_intrinsic_interp_var_at_offset:
@@ -299,8 +308,6 @@ nir_lower_phis_to_scalar(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs);
-
    nir_foreach_function(function, shader) {
       if (function->impl)
          progress = lower_phis_to_scalar_impl(function->impl) || progress;