Mesa (main): nir/lower_discard_or_demote: Fix metadata
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 8 23:52:36 UTC 2021
Module: Mesa
Branch: main
Commit: 878d8d96c759bbc594218fea3d55a7db2c1bad13
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=878d8d96c759bbc594218fea3d55a7db2c1bad13
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Thu Oct 7 16:53:03 2021 -0500
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 at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13261>
---
src/compiler/nir/nir_lower_discard_or_demote.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/compiler/nir/nir_lower_discard_or_demote.c b/src/compiler/nir/nir_lower_discard_or_demote.c
index 5857dcaa76d..c3c3c3e17e5 100644
--- a/src/compiler/nir/nir_lower_discard_or_demote.c
+++ b/src/compiler/nir/nir_lower_discard_or_demote.c
@@ -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));
More information about the mesa-commit
mailing list