mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 21:30:09 +01:00
aco: create exit block for p_end_with_regs to branch to
To handle ps discard in radeonsi part mode shader. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24973>
This commit is contained in:
parent
bf25a7f59b
commit
5ba68f92b4
1 changed files with 20 additions and 0 deletions
|
|
@ -2303,6 +2303,8 @@ lower_to_hw_instr(Program* program)
|
|||
Block* discard_exit_block = NULL;
|
||||
Block* discard_pops_done_and_exit_block = NULL;
|
||||
|
||||
int end_with_regs_block_index = -1;
|
||||
|
||||
bool should_dealloc_vgprs = dealloc_vgprs(program);
|
||||
|
||||
for (int block_idx = program->blocks.size() - 1; block_idx >= 0; block_idx--) {
|
||||
|
|
@ -2868,6 +2870,10 @@ lower_to_hw_instr(Program* program)
|
|||
V_008DFC_SQ_EXP_MRT + 22, false);
|
||||
break;
|
||||
}
|
||||
case aco_opcode::p_end_with_regs: {
|
||||
end_with_regs_block_index = block->index;
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
} else if (instr->isBranch()) {
|
||||
|
|
@ -3046,6 +3052,20 @@ lower_to_hw_instr(Program* program)
|
|||
|
||||
block->instructions = std::move(ctx.instructions);
|
||||
}
|
||||
|
||||
/* If block with p_end_with_regs is not the last block (i.e. p_exit_early_if may append exit
|
||||
* block at last), create an exit block for it to branch to.
|
||||
*/
|
||||
int last_block_index = program->blocks.size() - 1;
|
||||
if (end_with_regs_block_index >= 0 && end_with_regs_block_index != last_block_index) {
|
||||
Block* exit_block = program->create_and_insert_block();
|
||||
Block* end_with_regs_block = &program->blocks[end_with_regs_block_index];
|
||||
exit_block->linear_preds.push_back(end_with_regs_block->index);
|
||||
end_with_regs_block->linear_succs.push_back(exit_block->index);
|
||||
|
||||
Builder bld(program, end_with_regs_block);
|
||||
bld.sopp(aco_opcode::s_branch, exit_block->index);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace aco
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue