Mesa (10.1): llvmpipe: fix crash when not all attachments are populated in a fb

Carl Worth cworth at kemper.freedesktop.org
Tue Jun 3 20:33:59 UTC 2014


Module: Mesa
Branch: 10.1
Commit: cf08c24750819f7a1420119e7d7882c4bbe25bd4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf08c24750819f7a1420119e7d7882c4bbe25bd4

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Fri May 30 00:37:17 2014 +0200

llvmpipe: fix crash when not all attachments are populated in a fb

Framebuffers can have NULL attachments since a while. llvmpipe handled
that properly for lp_rast_shade_quads_mask but it seems the change didn't
make it to lp_rast_shade_tile.
This fixes piglit fbo-drawbuffers-none test (though I need to increase
the FB_SIZE from 32 to 256 so the tris cover some tiles fully).
https://bugs.freedesktop.org/show_bug.cgi?id=79421

Cc: "10.1 10.2" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
(cherry picked from commit 576868140bbb1abd177e7fd122720883d773137e)

---

 src/gallium/drivers/llvmpipe/lp_rast.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index 0ae5976..1b9b51d 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -376,9 +376,15 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
 
          /* color buffer */
          for (i = 0; i < scene->fb.nr_cbufs; i++){
-            stride[i] = scene->cbufs[i].stride;
-            color[i] = lp_rast_get_unswizzled_color_block_pointer(task, i, tile_x + x,
-                                                                  tile_y + y, inputs->layer);
+            if (scene->fb.cbufs[i]) {
+               stride[i] = scene->cbufs[i].stride;
+               color[i] = lp_rast_get_unswizzled_color_block_pointer(task, i, tile_x + x,
+                                                                     tile_y + y, inputs->layer);
+            }
+            else {
+               stride[i] = 0;
+               color[i] = NULL;
+            }
          }
 
          /* depth buffer */




More information about the mesa-commit mailing list