nir: Add a halt instruction type

Halt is like a return for the entire shader or exit() if you prefer to
think of it that way.  Once an invocation hits a halt, it's 100% dead.
Any writes to output variables which happened before the halt do,
however, still apply.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7356>
This commit is contained in:
Jason Ekstrand
2020-05-15 15:46:08 -05:00
committed by Marge Bot
parent a1281f8a99
commit 630e54a08b
7 changed files with 87 additions and 4 deletions

View File

@@ -595,6 +595,9 @@ visit_jump(nir_jump_instr *jump, struct divergence_state *state)
if (state->divergent_loop_cf)
state->divergent_loop_break = true;
return state->divergent_loop_break;
case nir_jump_halt:
/* This totally kills invocations so it doesn't add divergence */
break;
case nir_jump_return:
unreachable("NIR divergence analysis: Unsupported return instruction.");
break;