i915g: Fix point sprites.
[mesa.git] / src / gallium / drivers / i915 / i915_context.c
index 707b2e9f95640c81494797a7c3d927ef48a1aa81..ab4ea9a412ebc32bf782473123279e2b8f7a72eb 100644 (file)
@@ -39,7 +39,7 @@
 #include "pipe/p_screen.h"
 
 
-DEBUG_GET_ONCE_BOOL_OPTION(i915_no_vbuf, "I915_NO_VBUF", FALSE);
+DEBUG_GET_ONCE_BOOL_OPTION(i915_no_vbuf, "I915_NO_VBUF", FALSE)
 
 
 /*
@@ -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);
    }
 
    /*
@@ -100,7 +103,10 @@ static void i915_destroy(struct pipe_context *pipe)
    int i;
 
    draw_destroy(i915->draw);
-   
+
+   if (i915->blitter)
+      util_blitter_destroy(i915->blitter);
+
    if(i915->batch)
       i915->iws->batchbuffer_destroy(i915->batch);
 
@@ -134,13 +140,22 @@ i915_create_context(struct pipe_screen *screen, void *priv)
 
    i915->base.destroy = i915_destroy;
 
-   i915->base.clear = i915_clear;
+   if (i915_screen(screen)->debug.use_blitter)
+      i915->base.clear = i915_clear_blitter;
+   else
+      i915->base.clear = i915_clear_render;
 
    i915->base.draw_vbo = i915_draw_vbo;
 
    /* init this before draw */
    util_slab_create(&i915->transfer_pool, sizeof(struct pipe_transfer),
                     16, UTIL_SLAB_SINGLETHREADED);
+   util_slab_create(&i915->texture_transfer_pool, sizeof(struct i915_transfer),
+                    16, UTIL_SLAB_SINGLETHREADED);
+
+   /* Batch stream debugging is a bit hacked up at the moment:
+    */
+   i915->batch = i915->iws->batchbuffer_create(i915->iws);
 
    /*
     * Create drawing context and plug our rendering stage into it.
@@ -160,15 +175,21 @@ i915_create_context(struct pipe_screen *screen, void *priv)
 
    draw_install_aaline_stage(i915->draw, &i915->base);
    draw_install_aapoint_stage(i915->draw, &i915->base);
+   draw_enable_point_sprites(i915->draw, TRUE);
+
+   /* augmented draw pipeline clobbers state functions */
+   i915_init_fixup_state_functions(i915);
+
+   /* Create blitter last - calls state creation functions. */
+   i915->blitter = util_blitter_create(&i915->base);
+   assert(i915->blitter);
 
    i915->dirty = ~0;
    i915->hardware_dirty = ~0;
    i915->immediate_dirty = ~0;
    i915->dynamic_dirty = ~0;
-
-   /* Batch stream debugging is a bit hacked up at the moment:
-    */
-   i915->batch = i915->iws->batchbuffer_create(i915->iws);
+   i915->static_dirty = ~0;
+   i915->flush_dirty = 0;
 
    return &i915->base;
 }