zink: don't add void clears if a full clear already exists

this otherwise may clobber other clears or add unnecessary duplicates

Fixes: 7ea7d0687b ("zink: inject a 0,0,0,1 clear for RGBX formats")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18627>
This commit is contained in:
Mike Blumenkrantz 2022-09-02 10:10:01 -04:00 committed by Marge Bot
parent f380a2d63e
commit 11a5297ef5
2 changed files with 8 additions and 1 deletions

View file

@ -89,6 +89,13 @@ zink_fb_clear_element_needs_explicit(struct zink_framebuffer_clear_data *clear)
return clear->has_scissor || clear->conditional;
}
static inline bool
zink_fb_clear_full_exists(struct zink_context *ctx, unsigned clear_buffer)
{
struct zink_framebuffer_clear *fb_clear = &ctx->fb_clears[clear_buffer];
return zink_fb_clear_count(fb_clear) && !zink_fb_clear_first_needs_explicit(fb_clear);
}
void
zink_clear_apply_conditionals(struct zink_context *ctx);

View file

@ -2929,7 +2929,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
}
res->fb_binds++;
if (util_format_has_alpha1(psurf->format)) {
if (!res->valid)
if (!res->valid && !zink_fb_clear_full_exists(ctx, i))
ctx->void_clears |= (PIPE_CLEAR_COLOR0 << i);
}
}