diff options
author | Corbin Simpson <[email protected]> | 2009-02-27 12:23:16 -0800 |
---|---|---|
committer | Corbin Simpson <[email protected]> | 2009-02-27 12:25:09 -0800 |
commit | 49de8ec2eac7da8520c73d1a0f132b26e2fd1b9f (patch) | |
tree | 7bb6f5615f0e5a352a30c2c276bae6bbd9c65441 /src | |
parent | 991c945e726311c9db6bea72a63e2a5cfb7ab37b (diff) |
r300-gallium: Properly split up RS into r300 and r500 variants.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r300/r300_emit.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_reg.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state_derived.c | 90 |
3 files changed, 69 insertions, 28 deletions
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 86fa46df42c..2f9ec2c3beb 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -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; } diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 8f31bd5d6e0..b3b8f494999 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -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 */ diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index dcf0990934d..d17050e0d76 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -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] |= 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 < 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 < 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) | |