r300g: Atomize blend color.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 10 Jan 2010 18:26:15 +0000 (10:26 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 10 Jan 2010 19:17:34 +0000 (11:17 -0800)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h
src/gallium/drivers/r300/r300_state.c

index 2cdc946e907ce6f5ed151c97cbe5d84e7460a2b8..d16889de3498674c27a08feaf4f2f5367357efa3 100644 (file)
@@ -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);
index 41582504fd95aa51f6b7d2a7fc44bcec51f0b066..c916a860f64492af651314bef27585100e0ad352 100644 (file)
@@ -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. */
index 8c9c7e9d0375b86cbe7d2e774df263fe104a8657..5ae9c2a9bdba91e653ee620af648b16389a36931 100644 (file)
@@ -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;
index 34356438e4469b8fb9afc3fabfeed5ca80737add..005a9d50b08515ae8772eb6dcb8c45423c7727d4 100644 (file)
@@ -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);
index db8aca6c9f2bebab335a9063956563ed522a1745..35d698b8206217b353ff1f2ae2fae1ffc66766d2 100644 (file)
@@ -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,