diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.h b/src/gallium/drivers/panfrost/pan_blend_cso.h index bf3c53d1afe..a2e02a497ac 100644 --- a/src/gallium/drivers/panfrost/pan_blend_cso.h +++ b/src/gallium/drivers/panfrost/pan_blend_cso.h @@ -53,6 +53,9 @@ struct panfrost_blend_state { /* info.load presented as a bitfield for draw call hot paths */ unsigned load_dest_mask : PIPE_MAX_COLOR_BUFS; + + /* info.enabled presented as a bitfield for draw call hot paths */ + unsigned enabled_mask : PIPE_MAX_COLOR_BUFS; }; mali_ptr panfrost_get_blend(struct panfrost_batch *batch, unsigned rt, diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 8b86ad4612e..a5e1000a075 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -500,7 +500,8 @@ pan_allow_forward_pixel_to_kill(struct panfrost_context *ctx, * from reading it directly, or from failing to write it */ unsigned rt_mask = ctx->fb_rt_mask; - uint64_t rt_written = (fs->info.outputs_written >> FRAG_RESULT_DATA0); + uint64_t rt_written = (fs->info.outputs_written >> FRAG_RESULT_DATA0) & + ctx->blend->enabled_mask; bool blend_reads_dest = (ctx->blend->load_dest_mask & rt_mask); bool alpha_to_coverage = ctx->blend->base.alpha_to_coverage; @@ -4281,6 +4282,11 @@ panfrost_create_blend_state(struct pipe_context *pipe, if (so->info[c].load_dest) so->load_dest_mask |= BITFIELD_BIT(c); + /* Bifrost needs to know if any render target loads its + * destination in the hot draw path, so precompute this */ + if (so->info[c].enabled) + so->enabled_mask |= BITFIELD_BIT(c); + /* Converting equations to Mali style is expensive, do it at * CSO create time instead of draw-time */ if (so->info[c].fixed_function) {