mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 00:30:11 +01:00
nir/opt_peephole_select: handle nir_terminate{_if}
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27617>
This commit is contained in:
parent
f3d8bd18dd
commit
073e69c7dc
1 changed files with 10 additions and 6 deletions
|
|
@ -78,12 +78,14 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count,
|
|||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
switch (intr->intrinsic) {
|
||||
case nir_intrinsic_terminate:
|
||||
case nir_intrinsic_terminate_if:
|
||||
case nir_intrinsic_discard:
|
||||
case nir_intrinsic_discard_if:
|
||||
/* For non-CF hardware, we need to be able to move discards up
|
||||
* and flatten, so let them pass.
|
||||
*/
|
||||
continue;
|
||||
/* For non-CF hardware, we need to be able to move discards up
|
||||
* and flatten, so let them pass.
|
||||
*/
|
||||
continue;
|
||||
default:
|
||||
if (!nir_intrinsic_can_reorder(intr))
|
||||
return false;
|
||||
|
|
@ -392,7 +394,8 @@ rewrite_discard_conds(nir_instr *instr, nir_def *if_cond, bool is_else)
|
|||
return;
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
|
||||
if (intr->intrinsic != nir_intrinsic_discard_if && intr->intrinsic != nir_intrinsic_discard)
|
||||
if (intr->intrinsic != nir_intrinsic_discard_if && intr->intrinsic != nir_intrinsic_discard &&
|
||||
intr->intrinsic != nir_intrinsic_terminate_if && intr->intrinsic != nir_intrinsic_terminate)
|
||||
return;
|
||||
|
||||
nir_builder b = nir_builder_at(nir_before_instr(instr));
|
||||
|
|
@ -400,7 +403,8 @@ rewrite_discard_conds(nir_instr *instr, nir_def *if_cond, bool is_else)
|
|||
if (is_else)
|
||||
if_cond = nir_inot(&b, if_cond);
|
||||
|
||||
if (intr->intrinsic == nir_intrinsic_discard_if) {
|
||||
if (intr->intrinsic == nir_intrinsic_discard_if ||
|
||||
intr->intrinsic == nir_intrinsic_terminate_if) {
|
||||
nir_src_rewrite(&intr->src[0], nir_iand(&b, intr->src[0].ssa, if_cond));
|
||||
} else {
|
||||
nir_discard_if(&b, if_cond);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue