diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 31cd444c873..c2a0064f857 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -1153,7 +1153,7 @@ panfrost_batch_clear(struct panfrost_batch *batch, struct panfrost_context *ctx = batch->ctx; if (buffers & PIPE_CLEAR_COLOR) { - for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) { + for (unsigned i = 0; i < ctx->pipe_framebuffer.nr_cbufs; ++i) { if (!(buffers & (PIPE_CLEAR_COLOR0 << i))) continue;