asahi: Fix segfault with null drawbuffer
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 7 Jan 2023 20:25:49 +0000 (15:25 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 10 Jan 2023 00:17:12 +0000 (00:17 +0000)
Fixes fbo-drawbuffers-none piglit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20569>

src/gallium/drivers/asahi/agx_batch.c

index 600b733..a786451 100644 (file)
@@ -70,7 +70,8 @@ agx_batch_init(struct agx_context *ctx,
    }
 
    for (unsigned i = 0; i < key->nr_cbufs; ++i) {
-      agx_batch_writes(batch, agx_resource(key->cbufs[i]->texture));
+      if (key->cbufs[i])
+         agx_batch_writes(batch, agx_resource(key->cbufs[i]->texture));
    }
 
    unsigned batch_idx = agx_batch_idx(batch);