i915g: Handle null constants properly
authorJakob Bornecrantz <wallbraker@gmail.com>
Sat, 26 Feb 2011 14:45:13 +0000 (15:45 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Sat, 26 Feb 2011 14:45:47 +0000 (15:45 +0100)
src/gallium/drivers/i915/i915_context.c

index 707b2e9f95640c81494797a7c3d927ef48a1aa81..f970f8a700931cddeaf77ab12687d2c6407e2936 100644 (file)
@@ -73,10 +73,13 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    draw_set_mapped_index_buffer(draw, mapped_indices);
 
    if (cbuf_dirty) {
-      draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
-                                      i915_buffer(i915->constants[PIPE_SHADER_VERTEX])->data,
-                                      (i915->current.num_user_constants[PIPE_SHADER_VERTEX] * 
+      if (i915->constants[PIPE_SHADER_VERTEX])
+         draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
+                                         i915_buffer(i915->constants[PIPE_SHADER_VERTEX])->data,
+                                         (i915->current.num_user_constants[PIPE_SHADER_VERTEX] * 
                                          4 * sizeof(float)));
+      else
+         draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0, NULL, 0);
    }
 
    /*