From a82fc97c643c4309a10cfefb108c4c0f11a2e55a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 14 Oct 2009 20:06:38 -0700 Subject: r300g: Move ZTOP to its own state atom. It may seem pointless, but this avoids a fair amount of predicted CSO pain. --- src/gallium/drivers/r300/r300_context.h | 8 +++++++- src/gallium/drivers/r300/r300_emit.c | 2 +- src/gallium/drivers/r300/r300_state_derived.c | 8 ++++---- src/gallium/drivers/r300/r300_surface.h | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index d2e88755037..2acce0fd4a4 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -62,7 +62,6 @@ struct r300_dsa_state { uint32_t z_buffer_control; /* R300_ZB_CNTL: 0x4f00 */ uint32_t z_stencil_control; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */ uint32_t stencil_ref_mask; /* R300_ZB_STENCILREFMASK: 0x4f08 */ - uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */ uint32_t stencil_ref_bf; /* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */ }; @@ -124,6 +123,10 @@ struct r300_viewport_state { uint32_t vte_control; /* R300_VAP_VTE_CNTL: 0x20b0 */ }; +struct r300_ztop_state { + uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */ +}; + #define R300_NEW_BLEND 0x00000001 #define R300_NEW_BLEND_COLOR 0x00000002 #define R300_NEW_CLIP 0x00000004 @@ -281,6 +284,9 @@ struct r300_context { struct r300_vertex_shader* vs; /* Viewport state. */ struct r300_viewport_state* viewport_state; + /* ZTOP state. */ + struct r300_ztop_state ztop_state; + /* Bitmask of dirty state objects. */ uint32_t dirty_state; /* Flag indicating whether or not the HW is dirty. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index feffadd0ee8..2c3bba952d8 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -106,7 +106,7 @@ void r300_emit_dsa_state(struct r300_context* r300, OUT_CS(dsa->z_buffer_control); OUT_CS(dsa->z_stencil_control); OUT_CS(dsa->stencil_ref_mask); - OUT_CS_REG(R300_ZB_ZTOP, dsa->z_buffer_top); + OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top); if (r300screen->caps->is_r500) { /* OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf); */ } diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5d323a26b14..f0861a9cf1d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -446,7 +446,7 @@ static void r300_update_rs_block(struct r300_context* r300) static void r300_update_ztop(struct r300_context* r300) { - r300->dsa_state->z_buffer_top = R300_ZTOP_ENABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE; /* This is important enough that I felt it warranted a comment. * @@ -467,11 +467,11 @@ static void r300_update_ztop(struct r300_context* r300) * ~C. */ if (r300->dsa_state->alpha_function) { - r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } else if (r300_fragment_shader_writes_depth(r300->fs)) { - r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } else if (r300->query_current) { - r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } } diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index f9e98b2ec9c..d5998e6e6da 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -54,7 +54,6 @@ static struct r300_dsa_state dsa_clear_state = { .z_buffer_control = 0x0, .z_stencil_control = 0x0, .stencil_ref_mask = R300_STENCILWRITEMASK_MASK, - .z_buffer_top = R300_ZTOP_ENABLE, .stencil_ref_bf = 0x0, }; -- cgit v1.2.3