diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-06-19 11:39:24 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-06-19 12:50:41 -0700 |
commit | feb0cdcb5249f60522ce024c578b92f11d5269bd (patch) | |
tree | df2dd9c3280b534e637b2aeda011e36368375f3b /src | |
parent | d7ea433a5fc13ef1f622fddf01afb1f1de7bc6b4 (diff) |
glsl/nir_opt_access: Update uniforms correctly when only vars change
Even if only variables access flags are changed, the existing NIR
infrastructure expects metadata to be explicitly preserved, so do
that. Don't care about avoiding preserve to be called twice since the
cost is negligible.
This scenario can be triggered by dead variables, and also by other
intrinsics that read the variables -- but not cause progress to be
made when processing the intrinsics.
Fixes: f2d0e48ddc7 "glsl/nir: Add optimization pass for access flags"
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/gl_nir_opt_access.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/glsl/gl_nir_opt_access.c b/src/compiler/glsl/gl_nir_opt_access.c index 7f8672faf13..760214fbbff 100644 --- a/src/compiler/glsl/gl_nir_opt_access.c +++ b/src/compiler/glsl/gl_nir_opt_access.c @@ -293,6 +293,7 @@ gl_nir_opt_access(nir_shader *shader) .vars_written = _mesa_pointer_set_create(NULL), }; + bool var_progress = false; bool progress = false; nir_foreach_function(func, shader) { @@ -307,14 +308,25 @@ gl_nir_opt_access(nir_shader *shader) } nir_foreach_variable(var, &shader->uniforms) - progress |= process_variable(&state, var); + var_progress |= process_variable(&state, var); nir_foreach_function(func, shader) { if (func->impl) { progress |= opt_access_impl(&state, func->impl); + + /* If we make a change to the uniforms, update all the impls. */ + if (var_progress) { + nir_metadata_preserve(func->impl, + nir_metadata_block_index | + nir_metadata_dominance | + nir_metadata_live_ssa_defs | + nir_metadata_loop_analysis); + } } } + progress |= var_progress; + _mesa_set_destroy(state.vars_written, NULL); return progress; } |