aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_glsl_to_nir.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-11-14 12:56:20 +1100
committerTimothy Arceri <[email protected]>2017-12-04 09:10:30 +1100
commit90abaf8a214affa2bffdc04ee24f941caedb29c0 (patch)
tree9098538851dadbfc3e9c4af857170682dfc5a680 /src/mesa/state_tracker/st_glsl_to_nir.cpp
parentbd98b8c74ef9d404f98b77519eaf327b938a150a (diff)
st/glsl_to_nir: call some lowering passes earlier
This is required so that we can enbale NIR linking optimisations. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_glsl_to_nir.cpp')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index 1b4f07111cf..5f92bcef004 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -300,7 +300,11 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
if (prog->nir)
return prog->nir;
- return glsl_to_nir(shader_program, stage, options);
+ nir_shader *nir = glsl_to_nir(shader_program, stage, options);
+
+ st_nir_opts(nir);
+
+ return nir;
}
/* Second third of converting glsl_to_nir. This creates uniforms, gathers
@@ -343,13 +347,6 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
*/
_mesa_associate_uniform_storage(st->ctx, shader_program, prog, true);
- NIR_PASS_V(nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(nir),
- true, true);
- NIR_PASS_V(nir, nir_lower_global_vars_to_local);
- NIR_PASS_V(nir, nir_split_var_copies);
- NIR_PASS_V(nir, nir_lower_var_copies);
-
/* fragment shaders may need : */
if (prog->info.stage == MESA_SHADER_FRAGMENT) {
static const gl_state_index wposTransformState[STATE_LENGTH] = {
@@ -497,6 +494,13 @@ st_nir_get_mesa_program(struct gl_context *ctx,
set_st_program(prog, shader_program, nir);
prog->nir = nir;
+
+ NIR_PASS_V(nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(nir),
+ true, true);
+ NIR_PASS_V(nir, nir_lower_global_vars_to_local);
+ NIR_PASS_V(nir, nir_split_var_copies);
+ NIR_PASS_V(nir, nir_lower_var_copies);
}
extern "C" {