freedreno: fix problems if no color buf bound
authorRob Clark <robclark@freedesktop.org>
Mon, 10 Feb 2014 14:14:15 +0000 (09:14 -0500)
committerRob Clark <robclark@freedesktop.org>
Sun, 16 Feb 2014 13:17:23 +0000 (08:17 -0500)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
src/gallium/drivers/freedreno/freedreno_draw.c

index 2eb20247bb8a0e4dc235d6973be7a61ec834049d..d3ba6e6812ba9d7ecb328d657dc0a22cd466bc41 100644 (file)
@@ -65,7 +65,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
                uint32_t stride = 0;
                uint32_t base = 0;
 
-               if (i < nr_bufs) {
+               if ((i < nr_bufs) && bufs[i]) {
                        struct pipe_surface *psurf = bufs[i];
 
                        rsc = fd_resource(psurf->texture);
index 4382bf0d44e1142395265b1e3f80f7b9cab01b28..11bb8d8333ddec3b943f9c1f0fa762ae594612b0 100644 (file)
@@ -128,7 +128,12 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                ctx->gmem_reason |= FD_GMEM_LOGICOP_ENABLED;
 
        for (i = 0; i < pfb->nr_cbufs; i++) {
-               struct pipe_resource *surf = pfb->cbufs[i]->texture;
+               struct pipe_resource *surf;
+
+               if (!pfb->cbufs[i])
+                       continue;
+
+               surf = pfb->cbufs[i]->texture;
 
                fd_resource(surf)->dirty = true;
                buffers |= FD_BUFFER_COLOR;