Mesa (master): r300g: Atomize blend color.

Corbin Simpson csimpson at kemper.freedesktop.org
Sun Jan 10 19:17:50 UTC 2010


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

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Sun Jan 10 10:26:15 2010 -0800

r300g: Atomize blend color.

---

 src/gallium/drivers/r300/r300_context.c |    5 +++--
 src/gallium/drivers/r300/r300_context.h |    3 +--
 src/gallium/drivers/r300/r300_emit.c    |    9 ++-------
 src/gallium/drivers/r300/r300_emit.h    |    6 ++----
 src/gallium/drivers/r300/r300_state.c   |   10 ++++++----
 5 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 2cdc946..d16889d 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -70,7 +70,7 @@ static void r300_destroy_context(struct pipe_context* context)
         FREE(query);
     }
 
-    FREE(r300->blend_color_state);
+    FREE(r300->blend_color_state.state);
     FREE(r300->rs_block);
     FREE(r300->scissor_state);
     FREE(r300->vertex_info);
@@ -118,6 +118,7 @@ static void r300_setup_atoms(struct r300_context* r300)
 {
     make_empty_list(&r300->atom_list);
     R300_INIT_ATOM(blend);
+    R300_INIT_ATOM(blend_color);
 }
 
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
@@ -168,7 +169,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300->shader_hash_table = util_hash_table_create(r300_shader_key_hash,
         r300_shader_key_compare);
 
-    r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
+    r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
     r300->rs_block = CALLOC_STRUCT(r300_rs_block);
     r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
     r300->vertex_info = CALLOC_STRUCT(r300_vertex_info);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 4158250..c916a86 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -144,7 +144,6 @@ struct r300_ztop_state {
     uint32_t z_buffer_top;      /* R300_ZB_ZTOP: 0x4f14 */
 };
 
-#define R300_NEW_BLEND_COLOR     0x00000002
 #define R300_NEW_CLIP            0x00000004
 #define R300_NEW_DSA             0x00000008
 #define R300_NEW_FRAMEBUFFERS    0x00000010
@@ -286,7 +285,7 @@ struct r300_context {
     /* Blend state. */
     struct r300_atom blend_state;
     /* Blend color state. */
-    struct r300_blend_color_state* blend_color_state;
+    struct r300_atom blend_color_state;
     /* User clip planes. */
     struct pipe_clip_state clip_state;
     /* Shader constants. */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 8c9c7e9..5ae9c2a 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -58,9 +58,9 @@ void r300_emit_blend_state(struct r300_context* r300, void* state)
     END_CS;
 }
 
-void r300_emit_blend_color_state(struct r300_context* r300,
-                                 struct r300_blend_color_state* bc)
+void r300_emit_blend_color_state(struct r300_context* r300, void* state)
 {
+    struct r300_blend_color_state* bc = (struct r300_blend_color_state*)state;
     struct r300_screen* r300screen = r300_screen(r300->context.screen);
     CS_LOCALS(r300);
 
@@ -1069,11 +1069,6 @@ validate:
         }
     }
 
-    if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
-        r300_emit_blend_color_state(r300, r300->blend_color_state);
-        r300->dirty_state &= ~R300_NEW_BLEND_COLOR;
-    }
-
     if (r300->dirty_state & R300_NEW_CLIP) {
         r300_emit_clip_state(r300, &r300->clip_state);
         r300->dirty_state &= ~R300_NEW_CLIP;
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 3435643..005a9d5 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -31,11 +31,9 @@ struct r300_vertex_program_code;
 
 void r300_emit_aos(struct r300_context* r300, unsigned offset);
 
-void r300_emit_blend_state(struct r300_context* r300,
-                           void* blend);
+void r300_emit_blend_state(struct r300_context* r300, void* state);
 
-void r300_emit_blend_color_state(struct r300_context* r300,
-                                 struct r300_blend_color_state* bc);
+void r300_emit_blend_color_state(struct r300_context* r300, void* state);
 
 void r300_emit_clip_state(struct r300_context* r300,
                           struct pipe_clip_state* clip);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index db8aca6..35d698b 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -340,20 +340,22 @@ static void r300_set_blend_color(struct pipe_context* pipe,
                                  const struct pipe_blend_color* color)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct r300_blend_color_state* state =
+        (struct r300_blend_color_state*)r300->blend_color_state.state;
     union util_color uc;
 
     util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
-    r300->blend_color_state->blend_color = uc.ui;
+    state->blend_color = uc.ui;
 
     /* XXX if FP16 blending is enabled, we should use the FP16 format */
-    r300->blend_color_state->blend_color_red_alpha =
+    state->blend_color_red_alpha =
         float_to_fixed10(color->color[0]) |
         (float_to_fixed10(color->color[3]) << 16);
-    r300->blend_color_state->blend_color_green_blue =
+    state->blend_color_green_blue =
         float_to_fixed10(color->color[2]) |
         (float_to_fixed10(color->color[1]) << 16);
 
-    r300->dirty_state |= R300_NEW_BLEND_COLOR;
+    r300->blend_color_state.dirty = TRUE;
 }
 
 static void r300_set_clip_state(struct pipe_context* pipe,




More information about the mesa-commit mailing list