summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStéphane Marchesin <[email protected]>2012-02-07 14:33:31 -0800
committerStéphane Marchesin <[email protected]>2012-02-12 16:32:15 -0800
commitc1896cdc9182af45a4a1fea087f013f29fca4008 (patch)
tree446b5b286e3272ad5389871b3d9a9d0af9638230 /src
parentbe6a02266d1a934c6eff9aaf12fc618588b2d586 (diff)
i915g: Don't emit state when it's already bound.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/i915/i915_state.c32
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 764547e3e06..02cb3eafa94 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 */