static void r300_setup_atoms(struct r300_context* r300)
{
+ boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
+ boolean has_tcl = r300_screen(r300->context.screen)->caps->has_tcl;
+
/* Create the actual atom list.
*
* Each atom is examined and emitted in the order it appears here, which
* can affect performance and conformance if not handled with care.
*
- * Some atoms never change size, others change every emit. This is just
- * an upper bound on each atom, to keep the emission machinery from
- * underallocating space. */
+ * Some atoms never change size, others change every emit - those have
+ * the size of 0 here. */
make_empty_list(&r300->atom_list);
R300_INIT_ATOM(invariant_state, 71);
R300_INIT_ATOM(ztop_state, 2);
R300_INIT_ATOM(blend_state, 8);
- R300_INIT_ATOM(blend_color_state, 3);
- R300_INIT_ATOM(clip_state, 29);
- R300_INIT_ATOM(dsa_state, 8);
- R300_INIT_ATOM(fb_state, 56);
- R300_INIT_ATOM(rs_state, 25);
+ R300_INIT_ATOM(blend_color_state, is_r500 ? 3 : 2);
+ R300_INIT_ATOM(clip_state, has_tcl ? 5 + (6 * 4) : 2);
+ R300_INIT_ATOM(dsa_state, is_r500 ? 8 : 6);
+ R300_INIT_ATOM(fb_state, 0);
+ R300_INIT_ATOM(rs_state, 0);
R300_INIT_ATOM(scissor_state, 3);
R300_INIT_ATOM(viewport_state, 9);
- R300_INIT_ATOM(rs_block_state, 21);
+ R300_INIT_ATOM(rs_block_state, 0);
R300_INIT_ATOM(vertex_format_state, 26);
R300_INIT_ATOM(pvs_flush, 2);
- R300_INIT_ATOM(vs_state, 1031);
+ R300_INIT_ATOM(vs_state, 0);
R300_INIT_ATOM(texture_cache_inval, 2);
/* Some non-CSO atoms need explicit space to store the state locally. */
(struct pipe_framebuffer_state*)r300->fb_state.state;
CS_LOCALS(r300);
- BEGIN_CS(8);
+ BEGIN_CS(size);
OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 3);
if (fb->nr_cbufs) {
CS_LOCALS(r300);
if (r300screen->caps->is_r500) {
- BEGIN_CS(3);
+ BEGIN_CS(size);
OUT_CS_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR, 2);
OUT_CS(bc->blend_color_red_alpha);
OUT_CS(bc->blend_color_green_blue);
END_CS;
} else {
- BEGIN_CS(2);
+ BEGIN_CS(size);
OUT_CS_REG(R300_RB3D_BLEND_COLOR, bc->blend_color);
END_CS;
}
CS_LOCALS(r300);
if (r300screen->caps->has_tcl) {
- BEGIN_CS(5 + (6 * 4));
+ BEGIN_CS(size);
OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
(r300screen->caps->is_r500 ?
R500_PVS_UCP_START : R300_PVS_UCP_START));
R300_PS_UCP_MODE_CLIP_AS_TRIFAN);
END_CS;
} else {
- BEGIN_CS(2);
+ BEGIN_CS(size);
OUT_CS_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE);
END_CS;
}
struct pipe_stencil_ref stencil_ref = r300->stencil_ref;
CS_LOCALS(r300);
- BEGIN_CS(r300screen->caps->is_r500 ? 8 : 6);
+ BEGIN_CS(size);
OUT_CS_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function);
OUT_CS_REG_SEQ(R300_ZB_CNTL, 3);
int i;
CS_LOCALS(r300);
- BEGIN_CS((10 * fb->nr_cbufs) + (2 * (4 - fb->nr_cbufs)) +
- (fb->zsbuf ? 10 : 0) + 8);
+ BEGIN_CS(size);
/* Flush and free renderbuffer caches. */
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
float scale, offset;
CS_LOCALS(r300);
- BEGIN_CS(17 + (rs->polygon_offset_enable ? 5 : 0));
+ BEGIN_CS(size);
OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status);
OUT_CS_REG(R300_GB_AA_CONFIG, rs->antialiasing_config);
DBG(r300, DBG_DRAW, "r300: RS emit:\n");
- BEGIN_CS(5 + count*2);
+ BEGIN_CS(size);
if (r300screen->caps->is_r500) {
OUT_CS_REG_SEQ(R500_RS_IP_0, count);
} else {
(((maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT);
}
- BEGIN_CS(3);
+ BEGIN_CS(size);
OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
OUT_CS(top_left);
OUT_CS(bottom_right);
DBG(r300, DBG_DRAW, "r300: VAP/PSC emit:\n");
- BEGIN_CS(26);
+ BEGIN_CS(size);
OUT_CS_REG(R300_VAP_VTX_SIZE, vertex_info->vinfo.size);
OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2);
{
CS_LOCALS(r300);
- BEGIN_CS(2);
+ BEGIN_CS(size);
OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
END_CS;
}
return;
}
- BEGIN_CS(9 + code->length);
+ BEGIN_CS(size);
/* R300_VAP_PVS_CODE_CNTL_0
* R300_VAP_PVS_CONST_CNTL
* R300_VAP_PVS_CODE_CNTL_1
CS_LOCALS(r300);
if (r300->tcl_bypass) {
- BEGIN_CS(2);
+ BEGIN_CS(2); /* XXX tcl_bypass will be removed in gallium anyway */
OUT_CS_REG(R300_VAP_VTE_CNTL, 0);
END_CS;
} else {
- BEGIN_CS(9);
+ BEGIN_CS(size);
OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
OUT_CS_32F(viewport->xscale);
OUT_CS_32F(viewport->xoffset);
struct r300_ztop_state* ztop = (struct r300_ztop_state*)state;
CS_LOCALS(r300);
- BEGIN_CS(2);
+ BEGIN_CS(size);
OUT_CS_REG(R300_ZB_ZTOP, ztop->z_buffer_top);
END_CS;
}
{
CS_LOCALS(r300);
- BEGIN_CS(2);
+ BEGIN_CS(size);
OUT_CS_REG(R300_TX_INVALTAGS, 0);
END_CS;
}