Also do state-change checks. ZTOP's too important to not check.
FREE(r300->scissor_state);
FREE(r300->vertex_info);
FREE(r300->viewport_state);
+ FREE(r300->ztop_state.state);
FREE(r300);
}
static void r300_setup_atoms(struct r300_context* r300)
{
make_empty_list(&r300->atom_list);
+ R300_INIT_ATOM(ztop);
R300_INIT_ATOM(blend);
R300_INIT_ATOM(blend_color);
R300_INIT_ATOM(clip);
r300->shader_hash_table = util_hash_table_create(r300_shader_key_hash,
r300_shader_key_compare);
+ r300_setup_atoms(r300);
+
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);
r300->viewport_state = CALLOC_STRUCT(r300_viewport_state);
+ r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
/* Open up the OQ BO. */
r300->oqbo = screen->buffer_create(screen, 4096,
PIPE_BUFFER_USAGE_VERTEX, 4096);
make_empty_list(&r300->query_list);
- r300_setup_atoms(r300);
-
r300_init_flush_functions(r300);
r300_init_query_functions(r300);
/* Viewport state. */
struct r300_viewport_state* viewport_state;
/* ZTOP state. */
- struct r300_ztop_state ztop_state;
+ struct r300_atom ztop_state;
/* Vertex buffers for Gallium. */
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
- BEGIN_CS(r300screen->caps->is_r500 ? 10 : 8);
+ BEGIN_CS(r300screen->caps->is_r500 ? 8 : 6);
OUT_CS_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function);
/* not needed since we use the 8bit alpha ref */
}
OUT_CS(dsa->stencil_ref_mask);
- OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top);
/* XXX it seems r3xx doesn't support STENCILREFMASK_BF */
if (r300screen->caps->is_r500) {
}
+void r300_emit_ztop_state(struct r300_context* r300, void* state)
+{
+ struct r300_ztop_state* ztop = (struct r300_ztop_state*)state;
+ CS_LOCALS(r300);
+
+ BEGIN_CS(2);
+ OUT_CS_REG(R300_ZB_ZTOP, ztop->z_buffer_top);
+ END_CS;
+}
+
void r300_flush_textures(struct r300_context* r300)
{
CS_LOCALS(r300);
void r300_emit_texture_count(struct r300_context* r300);
+void r300_emit_ztop_state(struct r300_context* r300, void* state);
+
void r300_flush_textures(struct r300_context* r300);
/* Emit all dirty state. */
static void r300_update_ztop(struct r300_context* r300)
{
- uint32_t ztop = r300->ztop_state.z_buffer_top;
+ struct r300_ztop_state* ztop_state =
+ (struct r300_ztop_state*)r300->ztop_state.state;
+ uint32_t ztop = ztop_state->z_buffer_top;
/* This is important enough that I felt it warranted a comment.
*
ztop = R300_ZTOP_ENABLE;
}
- if (r300->ztop_state.z_buffer_top != ztop) {
- r300->ztop_state.z_buffer_top = ztop;
+ if (ztop_state->z_buffer_top != ztop) {
+ ztop_state->z_buffer_top = ztop;
+ r300->ztop_state.dirty = TRUE;
}
}