radeonsi: unset PIPE_CLEAR_* flags for non-existent buffers

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9795>
This commit is contained in:
Marek Olšák 2021-03-21 11:12:39 -04:00 committed by Marge Bot
parent 0580d4c1a2
commit 5ba77c4a5d

View file

@ -626,6 +626,16 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
struct si_texture *zstex = zsbuf ? (struct si_texture *)zsbuf->texture : NULL;
bool needs_db_flush = false;
/* Unset clear flags for non-existent buffers. */
for (unsigned i = 0; i < 8; i++) {
if (i >= fb->nr_cbufs || !fb->cbufs[i])
buffers &= ~(PIPE_CLEAR_COLOR0 << i);
}
if (!zsbuf)
buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
else if (!util_format_has_stencil(util_format_description(zsbuf->format)))
buffers &= ~PIPE_CLEAR_STENCIL;
if (buffers & PIPE_CLEAR_COLOR) {
si_do_fast_color_clear(sctx, &buffers, color);
if (!buffers)