r300g: Atomize UCP.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 10 Jan 2010 18:36:57 +0000 (10:36 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 10 Jan 2010 19:17:34 +0000 (11:17 -0800)
Meh.

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 d16889de3498674c27a08feaf4f2f5367357efa3..489f701e46d02907a69e5c2a2e1b300c745ac669 100644 (file)
@@ -71,6 +71,7 @@ static void r300_destroy_context(struct pipe_context* context)
     }
 
     FREE(r300->blend_color_state.state);
+    FREE(r300->clip_state.state);
     FREE(r300->rs_block);
     FREE(r300->scissor_state);
     FREE(r300->vertex_info);
@@ -119,6 +120,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);
+    R300_INIT_ATOM(clip);
 }
 
 struct pipe_context* r300_create_context(struct pipe_screen* screen,
@@ -170,6 +172,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
         r300_shader_key_compare);
 
     r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
+    r300->clip_state.state = CALLOC_STRUCT(pipe_clip_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 c916a860f64492af651314bef27585100e0ad352..3a54659df416c62ae4d0ec9210d11f72be58b9ac 100644 (file)
@@ -144,7 +144,6 @@ struct r300_ztop_state {
     uint32_t z_buffer_top;      /* R300_ZB_ZTOP: 0x4f14 */
 };
 
-#define R300_NEW_CLIP            0x00000004
 #define R300_NEW_DSA             0x00000008
 #define R300_NEW_FRAMEBUFFERS    0x00000010
 #define R300_NEW_FRAGMENT_SHADER 0x00000020
@@ -287,7 +286,7 @@ struct r300_context {
     /* Blend color state. */
     struct r300_atom blend_color_state;
     /* User clip planes. */
-    struct pipe_clip_state clip_state;
+    struct r300_atom clip_state;
     /* Shader constants. */
     struct r300_constant_buffer shader_constants[PIPE_SHADER_TYPES];
     /* Depth, stencil, and alpha state. */
index 5ae9c2a9bdba91e653ee620af648b16389a36931..1517eed92350454585620a72a98314eb4c83def8 100644 (file)
@@ -77,9 +77,9 @@ 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)
+void r300_emit_clip_state(struct r300_context* r300, void* state)
 {
+    struct pipe_clip_state* clip = (struct pipe_clip_state*)state;
     int i;
     struct r300_screen* r300screen = r300_screen(r300->context.screen);
     CS_LOCALS(r300);
@@ -1069,11 +1069,6 @@ validate:
         }
     }
 
-    if (r300->dirty_state & R300_NEW_CLIP) {
-        r300_emit_clip_state(r300, &r300->clip_state);
-        r300->dirty_state &= ~R300_NEW_CLIP;
-    }
-
     if (r300->dirty_state & R300_NEW_DSA) {
         r300_emit_dsa_state(r300, r300->dsa_state);
         r300->dirty_state &= ~R300_NEW_DSA;
index 005a9d50b08515ae8772eb6dcb8c45423c7727d4..81b5f735eff73950f12d20dd788d611eb983c756 100644 (file)
@@ -35,8 +35,7 @@ void r300_emit_blend_state(struct r300_context* r300, void* state);
 
 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);
+void r300_emit_clip_state(struct r300_context* r300, void* state);
 
 void r300_emit_dsa_state(struct r300_context* r300,
                          struct r300_dsa_state* dsa);
index 35d698b8206217b353ff1f2ae2fae1ffc66766d2..732292fdaf8ccd8a318ab2af1326c8e3afa79d00 100644 (file)
@@ -364,8 +364,8 @@ static void r300_set_clip_state(struct pipe_context* pipe,
     struct r300_context* r300 = r300_context(pipe);
 
     if (r300_screen(pipe->screen)->caps->has_tcl) {
-        r300->clip_state = *state;
-        r300->dirty_state |= R300_NEW_CLIP;
+        memcpy(r300->clip_state.state, state, sizeof(struct pipe_clip_state));
+        r300->clip_state.dirty = TRUE;
     } else {
         draw_flush(r300->draw);
         draw_set_clip_state(r300->draw, state);