move lower_deref_instrs
authorRob Clark <robdclark@gmail.com>
Thu, 17 May 2018 14:37:37 +0000 (10:37 -0400)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Jun 2018 03:54:00 +0000 (20:54 -0700)
Signed-off-by: Rob Clark <robdclark@gmail.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/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_shader.c
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 1f01d2ff4d633ea815279fa13d313b6c2bdfede6..1609b800208fb17472fae864f0a0cafb5ae3d213 100644 (file)
@@ -2034,6 +2034,8 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                        nir[i] = nir_shader_clone(NULL, nir[i]);
                }
 
+               NIR_PASS_V(nir[i], nir_lower_deref_instrs, ~0);
+
                if (first != last) {
                        nir_variable_mode mask = 0;
 
index 147092511deecc5e862d5995ce646a7a7ec49850..a0069de49d041d4c5975289debcecab96c58df91 100644 (file)
@@ -177,8 +177,6 @@ radv_shader_compile_to_nir(struct radv_device *device,
                assert(exec_list_length(&nir->functions) == 1);
                struct exec_node *node = exec_list_get_head(&nir->functions);
                entry_point = exec_node_data(nir_function, node, node);
-
-               NIR_PASS_V(nir, nir_lower_deref_instrs, ~0);
        } else {
                uint32_t *spirv = (uint32_t *) module->data;
                assert(module->size % 4 == 0);
@@ -253,8 +251,6 @@ radv_shader_compile_to_nir(struct radv_device *device,
                assert(exec_list_length(&nir->functions) == 1);
                entry_point->name = ralloc_strdup(entry_point, "main");
 
-               NIR_PASS_V(nir, nir_lower_deref_instrs, ~0);
-
                /* Make sure we lower constant initializers on output variables so that
                 * nir_remove_dead_variables below sees the corresponding stores
                 */
index 57db63defd63b408e45d63b88109e27b02387824..e7ef80cd61b20523737640cd234dfab8166b12a9 100644 (file)
@@ -589,8 +589,6 @@ st_nir_get_mesa_program(struct gl_context *ctx,
 
    nir_shader *nir = st_glsl_to_nir(st, prog, shader_program, shader->Stage);
 
-   nir_lower_deref_instrs(nir, (nir_lower_deref_flags)~0);
-
    set_st_program(prog, shader_program, nir);
    prog->nir = nir;
 }
@@ -676,6 +674,7 @@ st_link_nir(struct gl_context *ctx,
          mask = (nir_variable_mode)(mask | nir_var_shader_out);
 
       nir_shader *nir = shader->Program->nir;
+      NIR_PASS_V(nir, nir_lower_deref_instrs, (nir_lower_deref_flags)~0);
       NIR_PASS_V(nir, nir_lower_io_to_scalar_early, mask);
       st_nir_opts(nir, is_scalar[i]);
    }