cell: handle NULL cso vertex_elements state object on bind
authorRoland Scheidegger <sroland@vmware.com>
Wed, 10 Mar 2010 15:53:07 +0000 (16:53 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 10 Mar 2010 15:53:07 +0000 (16:53 +0100)
drivers need to handle NULL cso vertex elements (and others) objects.
It is possible the cso code saves/restores NULL objects (if no normal
cso object was bound before this was invoked).
This led to segfaults (for example demos/cubemap) for apps which were using
things like creating mipmaps before drawing anything.

src/gallium/drivers/cell/ppu/cell_state_vertex.c

index d3efb8ecea21fce5f8e2add2a1e1d37ce26b0ed8..9510ea9ac2baf06d531ae50261aeab4ae4f83ae8 100644 (file)
@@ -62,7 +62,8 @@ cell_bind_vertex_elements_state(struct pipe_context *pipe,
 
    cell->dirty |= CELL_NEW_VERTEX;
 
-   draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem);
+   if (cell_velems)
+      draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem);
 }
 
 void