r300-gallium: Properly split up RS into r300 and r500 variants.

This commit is contained in:
Corbin Simpson 2009-02-27 12:23:16 -08:00
parent 991c945e72
commit 49de8ec2ea
3 changed files with 69 additions and 28 deletions

View File

@ -216,7 +216,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
CS_LOCALS(r300);
int i;
BEGIN_CS(0);
BEGIN_CS(21);
if (r300screen->caps->is_r500) {
OUT_CS_REG_SEQ(R500_RS_IP_0, 8);
} else {
@ -238,6 +238,7 @@ void r300_emit_rs_block_state(struct r300_context* r300,
for (i = 0; i < 8; i++) {
OUT_CS(rs->inst[i]);
}
END_CS;
}

View File

@ -732,6 +732,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R500_RS_IP_TEX_PTR_Q_SHIFT 18
#define R500_RS_IP_COL_PTR_SHIFT 24
#define R500_RS_IP_COL_FMT_SHIFT 27
# define R500_RS_SEL_S(x) ((x) << 0)
# define R500_RS_SEL_T(x) ((x) << 6)
# define R500_RS_SEL_R(x) ((x) << 12)
# define R500_RS_SEL_Q(x) ((x) << 18)
# define R500_RS_COL_PTR(x) ((x) << 24)
# define R500_RS_COL_FMT(x) ((x) << 27)
/* gap */

View File

@ -197,36 +197,72 @@ static void r300_update_rs_block(struct r300_context* r300)
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;
if (r300_screen(r300->context.screen)->caps->is_r500) {
for (i = 0; i < vinfo->num_attribs; i++) {
switch (vinfo->attrib[i].interp_mode) {
case INTERP_LINEAR:
rs->ip[col_count] |=
R500_RS_COL_PTR(vinfo->attrib[i].src_index) |
R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA);
col_count++;
break;
case INTERP_PERSPECTIVE:
rs->ip[tex_count] |=
R500_RS_TEX_PTR(vinfo->attrib[i].src_index) |
R500_RS_SEL_S(tex_count) |
R500_RS_SEL_T(tex_count + 1) |
R500_RS_SEL_R(tex_count + 2) |
R500_RS_SEL_Q(tex_count + 3);
tex_count++;
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 < tex_count; i++) {
rs->inst[i] |= R500_RS_INST_TEX_ID(i) | R500_RS_INST_TEX_CN_WRITE |
R500_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++;
for (i = 0; i < col_count; i++) {
rs->inst[i] |= R500_RS_INST_COL_ID(i) | R500_RS_INST_COL_CN_WRITE |
R500_RS_INST_COL_ADDR(fp_offset);
fp_offset++;
}
rs->inst_count = MAX2(col_count, tex_count);
} else {
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) |