From 277e4989f348913e3852f3d8c4efb82ba1380fcb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 9 Aug 2007 12:02:45 +0100 Subject: Don't reemit hardware state *every* primitive. --- src/mesa/pipe/i915simple/i915_context.h | 1 + src/mesa/pipe/i915simple/i915_prim_emit.c | 6 +++++- src/mesa/pipe/i915simple/i915_state_derived.c | 3 +++ src/mesa/pipe/i915simple/i915_state_emit.c | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h index dab5423190..c298f0f581 100644 --- a/src/mesa/pipe/i915simple/i915_context.h +++ b/src/mesa/pipe/i915simple/i915_context.h @@ -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; diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/mesa/pipe/i915simple/i915_prim_emit.c index 6d7cfe2e3e..a1e0e85196 100644 --- a/src/mesa/pipe/i915simple/i915_prim_emit.c +++ b/src/mesa/pipe/i915simple/i915_prim_emit.c @@ -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) { diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c index 6e91e4448f..f1f798b506 100644 --- a/src/mesa/pipe/i915simple/i915_state_derived.c +++ b/src/mesa/pipe/i915simple/i915_state_derived.c @@ -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; } diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/mesa/pipe/i915simple/i915_state_emit.c index aeb2d6753f..3553d565c5 100644 --- a/src/mesa/pipe/i915simple/i915_state_emit.c +++ b/src/mesa/pipe/i915simple/i915_state_emit.c @@ -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; } -- cgit v1.2.3