intel/fs: Emit HALT_TARGET in emit_nir_code()

Instead of making it a fragment-specific thing based on uses_kill, track
whether or not we need one in fs_visitor and emit HALT_TARGET at the end
of emit_nir_code() if needed.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5071>
This commit is contained in:
Jason Ekstrand 2020-11-19 10:26:44 -06:00
parent 4a7f0aa2e0
commit 6992d2f625
2 changed files with 6 additions and 10 deletions

View File

@ -7960,13 +7960,10 @@ fs_visitor::fixup_3src_null_dest()
static const fs_inst *
find_halt_control_flow_region_start(const fs_visitor *v)
{
if (v->stage == MESA_SHADER_FRAGMENT &&
brw_wm_prog_data(v->prog_data)->uses_kill) {
foreach_block_and_inst(block, fs_inst, inst, v->cfg) {
if (inst->opcode == BRW_OPCODE_HALT ||
inst->opcode == SHADER_OPCODE_HALT_TARGET)
return inst;
}
foreach_block_and_inst(block, fs_inst, inst, v->cfg) {
if (inst->opcode == BRW_OPCODE_HALT ||
inst->opcode == SHADER_OPCODE_HALT_TARGET)
return inst;
}
return NULL;
@ -8539,9 +8536,6 @@ fs_visitor::run_fs(bool allow_spilling, bool do_rep_send)
if (failed)
return false;
if (wm_prog_data->uses_kill)
bld.emit(SHADER_OPCODE_HALT_TARGET);
if (wm_key->alpha_test_func)
emit_alpha_test();

View File

@ -46,6 +46,8 @@ fs_visitor::emit_nir_code()
last_scratch = ALIGN(nir->scratch_size, 4) * dispatch_width;
nir_emit_impl(nir_shader_get_entrypoint((nir_shader *)nir));
bld.emit(SHADER_OPCODE_HALT_TARGET);
}
void