diff options
author | Timothy Arceri <[email protected]> | 2019-01-31 15:59:18 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-02-01 15:56:02 +1100 |
commit | 0f3a8e1b64f52586e904b42e2d73148d8547713a (patch) | |
tree | 1b6e81780d595a2e64164763c5c1bea77a9b60bb /src/mesa | |
parent | 4052142de7a566db65fb0153b55e085c0df87e3a (diff) |
st/glsl_to_nir: remove dead local variables
Without this we do not end up with a deterministic NIR because
temporary register variables are added in random order. NIR must
be deterministic because we use it to produce a sha for the
radeonsi backends disk cache.
This fixes the shader cache for a bunch of shaders.
Another positive is that this results in a large reduction in the
size of the NIR that the state tracker stores to the disk cache.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index d7f2e3e6eaa..271a30eab70 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -463,6 +463,9 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, NIR_PASS_V(nir, st_nir_lower_builtin); NIR_PASS_V(nir, gl_nir_lower_atomics, shader_program, true); + nir_variable_mode mask = nir_var_function_temp; + nir_remove_dead_variables(nir, mask); + if (st->ctx->_Shader->Flags & GLSL_DUMP) { _mesa_log("\n"); _mesa_log("NIR IR for linked %s program %d:\n", |