Mesa (master): i915g: Don't emit state when it's already bound.

Stephane Marchesin marcheu at kemper.freedesktop.org
Mon Feb 13 00:37:30 UTC 2012


Module: Mesa
Branch: master
Commit: c1896cdc9182af45a4a1fea087f013f29fca4008
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1896cdc9182af45a4a1fea087f013f29fca4008

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Tue Feb  7 14:33:31 2012 -0800

i915g: Don't emit state when it's already bound.

---

 src/gallium/drivers/i915/i915_state.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 764547e..02cb3ea 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -177,6 +177,10 @@ static void i915_bind_blend_state(struct pipe_context *pipe,
                                   void *blend)
 {
    struct i915_context *i915 = i915_context(pipe);
+
+   if (i915->blend == blend)
+      return;
+
    draw_flush(i915->draw);
 
    i915->blend = (struct i915_blend_state*)blend;
@@ -194,6 +198,10 @@ static void i915_set_blend_color( struct pipe_context *pipe,
                                   const struct pipe_blend_color *blend_color )
 {
    struct i915_context *i915 = i915_context(pipe);
+
+   if (!blend_color)
+      return;
+
    draw_flush(i915->draw);
 
    i915->blend_color = *blend_color;
@@ -205,6 +213,7 @@ static void i915_set_stencil_ref( struct pipe_context *pipe,
                                   const struct pipe_stencil_ref *stencil_ref )
 {
    struct i915_context *i915 = i915_context(pipe);
+
    draw_flush(i915->draw);
 
    i915->stencil_ref = *stencil_ref;
@@ -527,6 +536,10 @@ static void i915_bind_depth_stencil_state(struct pipe_context *pipe,
                                           void *depth_stencil)
 {
    struct i915_context *i915 = i915_context(pipe);
+
+   if (i915->depth_stencil == depth_stencil)
+      return;
+
    draw_flush(i915->draw);
 
    i915->depth_stencil = (const struct i915_depth_stencil_state *)depth_stencil;
@@ -545,6 +558,7 @@ static void i915_set_scissor_state( struct pipe_context *pipe,
                                  const struct pipe_scissor_state *scissor )
 {
    struct i915_context *i915 = i915_context(pipe);
+
    draw_flush(i915->draw);
 
    memcpy( &i915->scissor, scissor, sizeof(*scissor) );
@@ -586,6 +600,10 @@ static void
 i915_fixup_bind_fs_state(struct pipe_context *pipe, void *shader)
 {
    struct i915_context *i915 = i915_context(pipe);
+
+   if (i915->saved_fs == shader)
+      return;
+
    draw_flush(i915->draw);
 
    i915->saved_fs = shader;
@@ -597,6 +615,10 @@ static void
 i915_bind_fs_state(struct pipe_context *pipe, void *shader)
 {
    struct i915_context *i915 = i915_context(pipe);
+
+   if (i915->fs == shader)
+      return;
+
    draw_flush(i915->draw);
 
    i915->fs = (struct i915_fragment_shader*) shader;
@@ -643,6 +665,9 @@ static void i915_bind_vs_state(struct pipe_context *pipe, void *shader)
 {
    struct i915_context *i915 = i915_context(pipe);
 
+   if (i915->saved_vs == shader)
+      return;
+
    i915->saved_vs = shader;
 
    /* just pass-through to draw module */
@@ -848,6 +873,7 @@ static void i915_set_clip_state( struct pipe_context *pipe,
 			     const struct pipe_clip_state *clip )
 {
    struct i915_context *i915 = i915_context(pipe);
+
    draw_flush(i915->draw);
 
    i915->saved_clip = *clip;
@@ -949,6 +975,9 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe,
 {
    struct i915_context *i915 = i915_context(pipe);
 
+   if (i915->rasterizer == raster)
+      return;
+
    i915->rasterizer = (struct i915_rasterizer_state *)raster;
 
    /* pass-through to draw module */
@@ -1016,6 +1045,9 @@ i915_bind_vertex_elements_state(struct pipe_context *pipe,
    struct i915_context *i915 = i915_context(pipe);
    struct i915_velems_state *i915_velems = (struct i915_velems_state *) velems;
 
+   if (i915->saved_velems == velems)
+      return;
+
    i915->saved_velems = velems;
 
    /* pass-through to draw module */




More information about the mesa-commit mailing list