[Mesa-dev] [PATCH 12/61] anv, i965, radv, st, ir3: Call nir_lower_deref_instrs
Jason Ekstrand
jason at jlekstrand.net
Fri Mar 23 21:42:18 UTC 2018
This inserts a call to nir_lower_deref_instrs at every call site of
glsl_to_nir, spirv_to_nir, and prog_to_nir.
---
src/amd/vulkan/radv_shader.c | 2 ++
src/gallium/drivers/freedreno/ir3/ir3_cmdline.c | 3 +++
src/intel/vulkan/anv_pipeline.c | 2 ++
src/mesa/drivers/dri/i965/brw_program.c | 2 ++
src/mesa/state_tracker/st_glsl_to_nir.cpp | 1 +
5 files changed, 10 insertions(+)
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index c693580..d8cfd2e 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -228,6 +228,8 @@ radv_shader_compile_to_nir(struct radv_device *device,
free(spec_entries);
+ NIR_PASS_V(nir, nir_lower_deref_instrs, ~0);
+
/* We have to lower away local constant initializers right before we
* inline functions. That way they get properly initialized at the top
* of the function and not at the top of its caller.
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index 41bd1de..07e97c3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -112,6 +112,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage)
errx(1, "couldn't parse `%s'", files[0]);
nir_shader *nir = glsl_to_nir(prog, stage, ir3_get_compiler_options(compiler));
+ nir_lower_deref_instrs(nir, ~0);
/* required NIR passes: */
/* TODO cmdline args for some of the conditional lowering passes? */
@@ -231,6 +232,8 @@ load_spirv(const char *filename, const char *entry, gl_shader_stage stage)
&spirv_options,
ir3_get_compiler_options(compiler));
+ NIR_PASS_V(entry_point->shader, nir_lower_deref_instrs, ~0);
+
nir_print_shader(entry_point->shader, stdout);
return entry_point->shader;
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 4ca1e0b..4af304e 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -170,6 +170,8 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
nir_print_shader(nir, stderr);
}
+ NIR_PASS_V(nir, nir_lower_deref_instrs, ~0);
+
/* We have to lower away local constant initializers right before we
* inline functions. That way they get properly initialized at the top
* of the function and not at the top of its caller.
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 4ba46a3..a871432 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -77,6 +77,7 @@ brw_create_nir(struct brw_context *brw,
/* First, lower the GLSL IR or Mesa IR to NIR */
if (shader_prog) {
nir = glsl_to_nir(shader_prog, stage, options);
+ nir_lower_deref_instrs(nir, ~0);
nir_remove_dead_variables(nir, nir_var_shader_in | nir_var_shader_out);
nir_lower_returns(nir);
nir_validate_shader(nir);
@@ -84,6 +85,7 @@ 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);
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 9bb99f3..7d111d6 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -328,6 +328,7 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
return prog->nir;
nir_shader *nir = glsl_to_nir(shader_program, stage, options);
+ nir_lower_deref_instrs(nir, (nir_lower_deref_flags)~0);
nir_variable_mode mask =
(nir_variable_mode) (nir_var_shader_in | nir_var_shader_out);
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list