summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_state_derived.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_derived.c')
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 4284a955ab..c4f56627c3 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -139,7 +139,7 @@ static void r300_update_vertex_layout(struct r300_context* r300)
}
for (i = 0; i < texs; i++) {
- draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR,
+ draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE,
draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i));
vinfo.hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i);
vinfo.hwfmt[3] |= (4 << (3 * i));
@@ -159,7 +159,9 @@ static void r300_update_vertex_layout(struct r300_context* r300)
for (i = 0; i < vinfo.num_attribs; i++) {
/* Make sure we have a proper destination for our attribute */
- //assert(tab[i] != -1);
+ if (tab[i] != -1) {
+ assert(0);
+ }
temp = translate_vertex_data_type(vinfo.attrib[i].emit) |
(tab[i] << R300_DST_VEC_LOC_SHIFT) | R300_SIGNED;
@@ -189,6 +191,48 @@ static void r300_update_vertex_layout(struct r300_context* r300)
* chipset that locks up if any part of it is even slightly wrong. */
static void r300_update_rs_block(struct r300_context* r300)
{
+ struct r300_rs_block* rs = r300->rs_block;
+ struct vertex_info* vinfo = &r300->vertex_info.vinfo;
+ int col_count = 0, fp_offset = 0, i, tex_count = 0;
+
+ memset(rs, 0, sizeof(struct r300_rs_block));
+
+ for (i = 0; i < vinfo->num_attribs; i++) {
+ switch (vinfo->attrib[i].interp_mode) {
+ case INTERP_LINEAR:
+ rs->ip[col_count] |=
+ R300_RS_COL_PTR(vinfo->attrib[i].src_index) |
+ R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
+ col_count++;
+ break;
+ case INTERP_PERSPECTIVE:
+ rs->ip[tex_count] |=
+ R300_RS_TEX_PTR(vinfo->attrib[i].src_index) |
+ R300_RS_SEL_S(R300_RS_SEL_C0) |
+ R300_RS_SEL_T(R300_RS_SEL_C1) |
+ R300_RS_SEL_R(R300_RS_SEL_C2) |
+ R300_RS_SEL_Q(R300_RS_SEL_C3);
+ tex_count += 4;
+ break;
+ }
+ }
+
+ for (i = 0; i < tex_count; i++) {
+ rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE |
+ R300_RS_INST_TEX_ADDR(fp_offset);
+ fp_offset++;
+ }
+
+ for (i = 0; i < col_count; i++) {
+ rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE |
+ R300_RS_INST_COL_ADDR(fp_offset);
+ fp_offset++;
+ }
+
+ rs->count = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) |
+ R300_HIRES_EN;
+
+ rs->inst_count = MAX2(col_count, tex_count);
}
void r300_update_derived_state(struct r300_context* r300)