From 016a699fa9e920e44432e709c0d0db642cbf5148 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 23 Oct 2022 10:54:33 -0400 Subject: [PATCH] asahi: Fix agx_set_framebuffer_state for MRT Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 3d0b51348ee..3acc433c8a6 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -786,15 +786,19 @@ agx_set_framebuffer_state(struct pipe_context *pctx, ctx->batch->width = state->width; ctx->batch->height = state->height; ctx->batch->nr_cbufs = state->nr_cbufs; - ctx->batch->cbufs[0] = state->cbufs[0]; ctx->batch->zsbuf = state->zsbuf; ctx->dirty = ~0; if (state->zsbuf) agx_batch_writes(ctx->batch, agx_resource(state->zsbuf->texture)); + /* Clear out stale pointers */ + memset(ctx->batch->cbufs, 0, sizeof(ctx->batch->cbufs)); + for (unsigned i = 0; i < state->nr_cbufs; ++i) { struct pipe_surface *surf = state->cbufs[i]; + ctx->batch->cbufs[i] = surf; + struct agx_resource *tex = agx_resource(surf->texture); const struct util_format_description *desc = util_format_description(surf->format);