Don't reemit hardware state *every* primitive.
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 9 Aug 2007 11:02:45 +0000 (12:02 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 9 Aug 2007 14:46:15 +0000 (15:46 +0100)
src/mesa/pipe/i915simple/i915_context.h
src/mesa/pipe/i915simple/i915_prim_emit.c
src/mesa/pipe/i915simple/i915_state_derived.c
src/mesa/pipe/i915simple/i915_state_emit.c

index dab5423190451b52c302efb0843e6d57db879039..c298f0f581e318ad7df04b54aa46fb5ecf464301 100644 (file)
@@ -56,6 +56,7 @@ struct i915_context
    struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
    struct pipe_viewport_state viewport;
    GLuint dirty;
+   GLuint hw_dirty;
 
    GLuint *batch_start;
 
index 6d7cfe2e3ec4591412919f217a23d707480c11c2..a1e0e851969402e2970b470cc6df809f708906d5 100644 (file)
@@ -120,7 +120,11 @@ emit_prim( struct draw_stage *stage,
    unsigned *ptr;
    unsigned i;
 
-   i915_emit_hardware_state( i915 );
+   if (i915->dirty)
+      i915_update_derived( i915 );
+
+   if (i915->hw_dirty)
+      i915_emit_hardware_state( i915 );
 
    ptr = winsys->batch_start( winsys, nr * vertex_size, 0 );
    if (ptr == 0) {
index 6e91e4448f386800c8603adbb7bf4cb389f8e46e..f1f798b5069effb2a74c193e0625c63febfe229c 100644 (file)
@@ -182,5 +182,8 @@ void i915_update_derived( struct i915_context *i915 )
                      I915_NEW_FRAMEBUFFER))
       compute_cliprect(i915);
 
+   if (i915->dirty)
+      i915->hw_dirty = 1;
+
    i915->dirty = 0;
 }
index aeb2d6753f2d0b1cbdc1a7e75e43c318ceca7be8..3553d565c56568a20f736c7a43f4da72d23d6525 100644 (file)
@@ -250,5 +250,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
       for (i = 0; i < dwords; i++)
         OUT_BATCH( prog[i] );
    }
+
+   i915->hw_dirty = 0;
 }