i915g: Submit direct vertex buffers
authorJakob Bornecrantz <wallbraker@gmail.com>
Sun, 27 Sep 2009 20:12:11 +0000 (13:12 -0700)
committerJakob Bornecrantz <wallbraker@gmail.com>
Sun, 27 Sep 2009 20:19:49 +0000 (13:19 -0700)
src/gallium/drivers/i915simple/i915_prim_vbuf.c

index aee8819ed912ee867ff2ced95e7c5e7b3de368a9..d50201642bdc213c8b26a055380fcea32e246802 100644 (file)
@@ -389,14 +389,43 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render,
                              uint nr)
 {
    struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
+   struct i915_context *i915 = i915_render->i915;
 
    if (i915_render->fallback) {
       draw_arrays_fallback(render, start, nr);
       return;
    }
 
-   /* JB: TODO submit direct cmds */
-   draw_arrays_fallback(render, start, nr);
+   if (i915->dirty)
+      i915_update_derived(i915);
+
+   if (i915->hardware_dirty)
+      i915_emit_hardware_state(i915);
+
+   if (!BEGIN_BATCH(2, 0)) {
+      FLUSH_BATCH(NULL);
+
+      /* Make sure state is re-emitted after a flush:
+       */
+      i915_update_derived(i915);
+      i915_emit_hardware_state(i915);
+      i915->vbo_flushed = 1;
+
+      if (!BEGIN_BATCH(2, 0)) {
+         assert(0);
+         goto out;
+      }
+   }
+
+   OUT_BATCH(_3DPRIMITIVE |
+             PRIM_INDIRECT |
+             PRIM_INDIRECT_SEQUENTIAL |
+             i915_render->hwprim |
+             nr);
+   OUT_BATCH(start); /* Beginning vertex index */
+
+out:
+   return;
 }
 
 /**