r300g: Move ZTOP to its own state atom.

It may seem pointless, but this avoids a fair amount of predicted CSO pain.
This commit is contained in:
Corbin Simpson 2009-10-14 20:06:38 -07:00
parent 91bd87c06e
commit a82fc97c64
4 changed files with 12 additions and 7 deletions

View File

@ -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. */

View File

@ -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); */
}

View File

@ -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;
}
}

View File

@ -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,
};