[Mesa-dev] [PATCH 10/14] st/glsl_to_nir: call some lowering passes earlier
Timothy Arceri
tarceri at itsqueeze.com
Tue Nov 21 03:37:31 UTC 2017
This is required so that we can enbale NIR linking optimisations.
---
src/mesa/state_tracker/st_glsl_to_nir.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index e83b5dd2ef..746dfff396 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -340,27 +340,20 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
* This should be enough for Bitmap and DrawPixels constants.
*/
_mesa_reserve_parameter_storage(prog->Parameters, 8);
/* This has to be done last. Any operation the can cause
* prog->ParameterValues to get reallocated (e.g., anything that adds a
* program constant) has to happen before creating this linkage.
*/
_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] = {
STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
};
nir_lower_wpos_ytransform_options wpos_options = { { 0 } };
struct pipe_screen *pscreen = st->pipe->screen;
memcpy(wpos_options.state_tokens, wposTransformState,
sizeof(wpos_options.state_tokens));
@@ -495,20 +488,27 @@ st_nir_get_mesa_program(struct gl_context *ctx,
}
prog->ExternalSamplersUsed = gl_external_samplers(prog);
_mesa_update_shader_textures_used(shader_program, prog);
nir_shader *nir = st_glsl_to_nir(st, prog, shader_program, shader->Stage);
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);
+
return nir;
}
extern "C" {
bool
st_link_nir(struct gl_context *ctx,
struct gl_shader_program *shader_program)
{
struct st_context *st = st_context(ctx);
--
2.14.3
More information about the mesa-dev
mailing list