[Mesa-dev] [PATCH 3/3] svga: check for and skip null vertex buffer pointers

Brian Paul brianp at vmware.com
Mon Apr 30 14:34:06 PDT 2012


Fixes regressions with google earth and other things.
---
 src/gallium/drivers/svga/svga_swtnl_draw.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
index 3770264..bb6870f 100644
--- a/src/gallium/drivers/svga/svga_swtnl_draw.c
+++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
@@ -66,12 +66,14 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
     * Map vertex buffers
     */
    for (i = 0; i < svga->curr.num_vertex_buffers; i++) {
-      map = pipe_buffer_map(&svga->pipe,
-                            svga->curr.vb[i].buffer,
-                            PIPE_TRANSFER_READ,
-			    &vb_transfer[i]);
-
-      draw_set_mapped_vertex_buffer(draw, i, map);
+      if (svga->curr.vb[i].buffer) {
+         map = pipe_buffer_map(&svga->pipe,
+                               svga->curr.vb[i].buffer,
+                               PIPE_TRANSFER_READ,
+                               &vb_transfer[i]);
+
+         draw_set_mapped_vertex_buffer(draw, i, map);
+      }
    }
 
    /* TODO move this to update_swtnl_draw */
@@ -109,8 +111,10 @@ svga_swtnl_draw_vbo(struct svga_context *svga,
     * unmap vertex/index buffers
     */
    for (i = 0; i < svga->curr.num_vertex_buffers; i++) {
-      pipe_buffer_unmap(&svga->pipe, vb_transfer[i]);
-      draw_set_mapped_vertex_buffer(draw, i, NULL);
+      if (svga->curr.vb[i].buffer) {
+         pipe_buffer_unmap(&svga->pipe, vb_transfer[i]);
+         draw_set_mapped_vertex_buffer(draw, i, NULL);
+      }
    }
 
    if (ib_transfer) {
-- 
1.7.7.3



More information about the mesa-dev mailing list