r300g: fix crash since the set_vertex_buffers(start_slot) change
authorMarek Olšák <maraeo@gmail.com>
Tue, 13 Nov 2012 14:44:46 +0000 (15:44 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 13 Nov 2012 14:53:16 +0000 (15:53 +0100)
src/gallium/drivers/r300/r300_state.c

index 85d05bd2ce30fd1d52f537e0f572571fac24fee8..e5e68d22dd05e4b4a3a4c872ec7463f29f533502 100644 (file)
@@ -1632,16 +1632,17 @@ static void r300_set_vertex_buffers_hwtcl(struct pipe_context* pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
 
-    /* There must be at least one vertex buffer set, otherwise it locks up. */
-    if (!count) {
-        buffers = &r300->dummy_vb;
-        count = 1;
-    }
-
     util_set_vertex_buffers_count(r300->vertex_buffer,
                                   &r300->nr_vertex_buffers,
                                   buffers, start_slot, count);
 
+    /* There must be at least one vertex buffer set, otherwise it locks up. */
+    if (!r300->nr_vertex_buffers) {
+        util_set_vertex_buffers_count(r300->vertex_buffer,
+                                      &r300->nr_vertex_buffers,
+                                      &r300->dummy_vb, 0, 1);
+    }
+
     r300->vertex_arrays_dirty = TRUE;
 }