nir/lower_discard_or_demote: Fix metadata

Passes generally shouldn't use nir_metadata_all unless they don't change
the program in any significant way.  Some of these passes insert new
instructions so they should definitely not be preserving most of it.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13261>
This commit is contained in:
Jason Ekstrand 2021-10-07 16:53:03 -05:00 committed by Marge Bot
parent 7ba338e253
commit 878d8d96c7

View file

@ -164,7 +164,10 @@ nir_lower_discard_or_demote(nir_shader *shader,
*/
progress = nir_shader_instructions_pass(shader,
nir_lower_discard_to_demote_instr,
nir_metadata_all,
nir_metadata_block_index |
nir_metadata_dominance |
nir_metadata_live_ssa_defs |
nir_metadata_instr_index,
NULL);
shader->info.fs.uses_demote = true;
} else if (!shader->info.fs.needs_quad_helper_invocations &&
@ -173,7 +176,8 @@ nir_lower_discard_or_demote(nir_shader *shader,
/* If we don't need any helper invocations, convert demote to discard. */
progress = nir_shader_instructions_pass(shader,
nir_lower_demote_to_discard_instr,
nir_metadata_all,
nir_metadata_block_index |
nir_metadata_dominance,
NULL);
shader->info.fs.uses_demote = false;
} else if (shader->info.fs.uses_demote &&
@ -184,7 +188,8 @@ nir_lower_discard_or_demote(nir_shader *shader,
nir_ssa_def *is_helper = NULL;
progress = nir_shader_instructions_pass(shader,
nir_lower_load_helper_to_is_helper,
nir_metadata_all,
nir_metadata_block_index |
nir_metadata_dominance,
&is_helper);
BITSET_CLEAR(shader->info.system_values_read,
nir_system_value_from_intrinsic(nir_intrinsic_load_helper_invocation));