pan/midgard: Ensure fragment writeout is in the final block

This ensures the block only has exactly one branch, which makes
scheduling happy.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-08-27 12:20:06 -07:00
parent cfd5bd2c7d
commit a8eafb0b74
2 changed files with 6 additions and 9 deletions

View file

@ -427,8 +427,9 @@ mir_exit_block(struct compiler_context *ctx)
midgard_block *last = list_last_entry(&ctx->blocks,
struct midgard_block, link);
/* The last block must be empty (the exit block) */
assert(list_empty(&last->instructions));
/* The last block must be empty logically but contains branch writeout
* for fragment shaders */
assert(last->nr_successors == 0);
return last;

View file

@ -2294,13 +2294,6 @@ emit_block(compiler_context *ctx, nir_block *block)
midgard_opt_promote_fmov(ctx, ctx->current_block);
embedded_to_inline_constant(ctx);
/* Append fragment shader epilogue (value writeout) */
if (ctx->stage == MESA_SHADER_FRAGMENT) {
if (block == nir_impl_last_block(ctx->func->impl)) {
emit_fragment_epilogue(ctx);
}
}
/* Allow the next control flow to access us retroactively, for
* branching etc */
ctx->current_block = this_block;
@ -2582,6 +2575,9 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga
struct midgard_block *end =
emit_block(ctx, func->impl->end_block);
if (ctx->stage == MESA_SHADER_FRAGMENT)
emit_fragment_epilogue(ctx);
midgard_block_add_successor(semi_end, end);
break; /* TODO: Multi-function shaders */