svga: check for and skip null vertex buffer pointers
authorBrian Paul <brianp@vmware.com>
Mon, 30 Apr 2012 20:44:26 +0000 (14:44 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 1 May 2012 14:14:23 +0000 (08:14 -0600)
Fixes regressions with google earth and other things.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/drivers/svga/svga_swtnl_draw.c

index 377026411f27e500b0ab34618d06526fe6825e20..bb6870f6572e9aeb8b5001b49f51d673e4805f32 100644 (file)
@@ -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) {