summaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/midgard/compiler.h5
-rw-r--r--src/panfrost/midgard/midgard_compile.c10
2 files changed, 6 insertions, 9 deletions
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index e6b90e4aa48..7747764791f 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -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;
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 04d149f2b60..eaa5816cc7e 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -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 */