i965: Move nir_lower_deref_instrs to right before locals_to_regs
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 20 Mar 2018 01:00:14 +0000 (18:00 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Jun 2018 03:15:57 +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/intel/blorp/blorp.c
src/intel/compiler/brw_nir.c
src/mesa/drivers/dri/i965/brw_program.c

index 58d858dff00afba3a6f0e56645290b8300f71d87..73f8c67802ee0c44f94ae14f2abb6c34638270e3 100644 (file)
@@ -204,7 +204,6 @@ blorp_compile_fs(struct blorp_context *blorp, void *mem_ctx,
     */
    wm_prog_data->base.binding_table.texture_start = BLORP_TEXTURE_BT_INDEX;
 
-   nir_lower_deref_instrs(nir, ~0);
    nir = brw_preprocess_nir(compiler, nir);
    nir_remove_dead_variables(nir, nir_var_shader_in);
    nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
@@ -234,7 +233,6 @@ blorp_compile_vs(struct blorp_context *blorp, void *mem_ctx,
    nir->options =
       compiler->glsl_compiler_options[MESA_SHADER_VERTEX].NirOptions;
 
-   nir_lower_deref_instrs(nir, ~0);
    nir = brw_preprocess_nir(compiler, nir);
    nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
 
index 227c94d83b9b88f7f58cb3ff0cbb361de42a8543..971854add4d97f1751117728c9a91fb694a73f46 100644 (file)
@@ -766,6 +766,8 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler,
    OPT(nir_opt_dce);
    OPT(nir_opt_move_comparisons);
 
+   OPT(nir_lower_deref_instrs, ~0);
+
    OPT(nir_lower_locals_to_regs);
 
    if (unlikely(debug_enabled)) {
index faf706c7d15d34487de823db07ba524d371194d3..aa2d86d1aa3a4f40d329b844efbec64896f65768 100644 (file)
@@ -79,10 +79,10 @@ brw_create_nir(struct brw_context *brw,
    if (shader_prog) {
       if (shader_prog->data->spirv) {
          nir = _mesa_spirv_to_nir(ctx, shader_prog, stage, options);
-         nir_lower_deref_instrs(nir, ~0);
+         nir_lower_deref_instrs(nir, nir_lower_texture_derefs);
       } else {
          nir = glsl_to_nir(shader_prog, stage, options);
-         nir_lower_deref_instrs(nir, ~0);
+         nir_lower_deref_instrs(nir, nir_lower_texture_derefs);
       }
       assert (nir);
 
@@ -93,7 +93,6 @@ brw_create_nir(struct brw_context *brw,
                  nir_shader_get_entrypoint(nir), true, false);
    } else {
       nir = prog_to_nir(prog, options);
-      nir_lower_deref_instrs(nir, ~0);
       NIR_PASS_V(nir, nir_lower_regs_to_ssa); /* turn registers into SSA */
    }
    nir_validate_shader(nir);