panfrost: Check blend enabled state in pan_allow_forward_pixel_to_kill()

The shader can write to a specific RT, but the blend descriptor gets
to decide if the RT is really updated. We need to take that into
account when initializing the rt_written local variable in
pan_allow_forward_pixel_to_kill() otherwise we might get inconsistent
results.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22465>
This commit is contained in:
Boris Brezillon 2023-04-07 15:16:17 +02:00 committed by Marge Bot
parent 300327ba19
commit e6bcbd57e3
2 changed files with 10 additions and 1 deletions

View file

@ -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,

View file

@ -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) {