llvmpipe: Cope with null Vertex element cso.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 10 Mar 2010 07:23:29 +0000 (07:23 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 10 Mar 2010 07:23:29 +0000 (07:23 +0000)
CSO can often be null.

For example:
1. at initialization
2. using an util module (u_blit) right after initialization (it will push
   state and pop the previous null state)
3. at shutdown time (state shouldn't be bound when being destroyed)

Glean was hitting 2.

src/gallium/drivers/llvmpipe/lp_state_vertex.c

index 2ddd110a5f9c292739fb22b963526fce15ea0bb4..f6427aa908e2c84c8acddf3738a9bccc672901d0 100644 (file)
@@ -61,7 +61,8 @@ llvmpipe_bind_vertex_elements_state(struct pipe_context *pipe,
 
    llvmpipe->dirty |= LP_NEW_VERTEX;
 
-   draw_set_vertex_elements(llvmpipe->draw, lp_velems->count, lp_velems->velem);
+   if (velems)
+      draw_set_vertex_elements(llvmpipe->draw, lp_velems->count, lp_velems->velem);
 }
 
 void