hook in state tracking for blend color
authorBrian <brian.paul@tungstengraphics.com>
Tue, 3 Jul 2007 23:19:30 +0000 (17:19 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 3 Jul 2007 23:19:30 +0000 (17:19 -0600)
src/mesa/pipe/p_context.h
src/mesa/pipe/softpipe/sp_context.c
src/mesa/pipe/softpipe/sp_state.h
src/mesa/pipe/softpipe/sp_state_blend.c
src/mesa/state_tracker/st_atom_blend.c
src/mesa/state_tracker/st_context.h

index b87c42844c486b72024e459fc14465007b613561..e4115226e7e55b779ae1f558b60a47c1dddbbd18 100644 (file)
@@ -66,6 +66,9 @@ struct pipe_context {
    void (*set_blend_state)( struct pipe_context *,
                             const struct pipe_blend_state * );
 
+   void (*set_blend_color)( struct pipe_context *,
+                            const struct pipe_blend_color * );
+
    void (*set_clip_state)( struct pipe_context *,
                           const struct pipe_clip_state * );
 
index 5bd652f3a3c8d1eeff206b5acd99c61b37cdf8a6..6bd1d9f16eb5993699d176941db73bb6d0c38913 100644 (file)
@@ -67,6 +67,7 @@ struct pipe_context *softpipe_create( void )
    softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
    softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state;
    softpipe->pipe.set_blend_state = softpipe_set_blend_state;
+   softpipe->pipe.set_blend_color = softpipe_set_blend_color;
    softpipe->pipe.set_clip_state = softpipe_set_clip_state;
    softpipe->pipe.set_clear_color_state = softpipe_set_clear_color_state;
    softpipe->pipe.set_depth_state = softpipe_set_depth_test_state;
index 60c24885e442cf979531cf536bc0e132efd28637..38a212b79ad98eb1858353c2fa24cb9bc4650696 100644 (file)
@@ -44,6 +44,9 @@ void softpipe_set_alpha_test_state( struct pipe_context *,
 void softpipe_set_blend_state( struct pipe_context *,
                                const struct pipe_blend_state * );
 
+void softpipe_set_blend_color( struct pipe_context *pipe,
+                               const struct pipe_blend_color *blend_color );
+
 void softpipe_set_clear_color_state( struct pipe_context *,
                                      const struct pipe_clear_color_state * );
 
index c364d8a31968ba3e6cc1fef32e87b72e6ce85029..6ca42e8a01fac69af9c677835966edf56172bbff 100644 (file)
@@ -46,6 +46,17 @@ void softpipe_set_blend_state( struct pipe_context *pipe,
 }
 
 
+void softpipe_set_blend_color( struct pipe_context *pipe,
+                            const struct pipe_blend_color *blend_color )
+{
+   struct softpipe_context *softpipe = softpipe_context(pipe);
+
+   softpipe->blend_color = *blend_color;
+
+   softpipe->dirty |= G_NEW_BLEND;
+}
+
+
 /** XXX move someday?  Or consolidate all these simple state setters
  * into one file.
  */
index e0215c9eefe1029e008531ada9f831e886a1cb85..3e5410cfab29920acb38d16edf3c8764ff3f4da0 100644 (file)
@@ -201,6 +201,15 @@ update_blend( struct st_context *st )
       st->state.blend = blend;  /* struct copy */
       st->pipe->set_blend_state(st->pipe, &blend); /* set new state */
    }
+
+   if (memcmp(st->ctx->Color.BlendColor, &st->state.blend_color, 4 * sizeof(GLfloat)) != 0) {
+      /* state has changed */
+      st->state.blend_color.color[0] = st->ctx->Color.BlendColor[0];
+      st->state.blend_color.color[1] = st->ctx->Color.BlendColor[1];
+      st->state.blend_color.color[2] = st->ctx->Color.BlendColor[2];
+      st->state.blend_color.color[3] = st->ctx->Color.BlendColor[3];
+      st->pipe->set_blend_color(st->pipe, (struct pipe_blend_color *) st->ctx->Color.BlendColor);
+   }
 }
 
 
index 3b47785a9a7c1614ddfbf479693380bc9b45ca51..c1d868604cfe3972b0db9fc6669cd8505ad8b35e 100644 (file)
@@ -67,6 +67,7 @@ struct st_context
    struct {
       struct pipe_alpha_test_state  alpha_test;
       struct pipe_blend_state  blend;
+      struct pipe_blend_color  blend_color;
       struct pipe_clear_color_state clear_color;
       struct pipe_clip_state clip;
       struct pipe_depth_state depth;