ir3/legalize: Handle inserting (ei) with preamble

Make sure that shaders with a preamble are still considered
early-release so that we don't regress them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13148>
This commit is contained in:
Connor Abbott
2021-09-29 12:36:49 +02:00
committed by Marge Bot
parent ccc64b7e00
commit 00d7ad334a
2 changed files with 15 additions and 2 deletions

View File

@@ -661,6 +661,19 @@ ir3_start_block(struct ir3 *ir)
return list_first_entry(&ir->block_list, struct ir3_block, node);
}
static inline struct ir3_block *
ir3_after_preamble(struct ir3 *ir)
{
struct ir3_block *block = ir3_start_block(ir);
/* The preamble will have a usually-empty else branch, and we want to skip
* that to get to the block after the preamble.
*/
if (block->brtype == IR3_BRANCH_SHPS)
return block->successors[1]->successors[0];
else
return block;
}
void ir3_block_add_predecessor(struct ir3_block *block, struct ir3_block *pred);
void ir3_block_add_physical_predecessor(struct ir3_block *block,
struct ir3_block *pred);

View File

@@ -136,7 +136,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
* with the end of the program.
*/
assert(input_count == 0 || !ctx->early_input_release ||
block == ir3_start_block(block->shader));
block == ir3_after_preamble(block->shader));
/* remove all the instructions from the list, we'll be adding
* them back in as we go
@@ -953,7 +953,7 @@ ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary)
* a5xx and a6xx do automatically release varying storage at the end.
*/
ctx->early_input_release = true;
struct ir3_block *start_block = ir3_start_block(ir);
struct ir3_block *start_block = ir3_after_preamble(ir);
foreach_block (block, &ir->block_list) {
foreach_instr (instr, &block->instr_list) {
if (is_input(instr) && block != start_block) {