diff options
author | Brian <brian@yutani.localnet.net> | 2007-03-09 11:43:53 -0700 |
---|---|---|
committer | Brian <brian@yutani.localnet.net> | 2007-03-09 11:43:53 -0700 |
commit | 2cf5fd48d1586f961910a14324a457854cb66221 (patch) | |
tree | 6b8690b1e3ac2b59369356d692214cc7d6a889c6 /src/mesa/drivers/dri/r300 | |
parent | 9f44247acf62b91669f77974a4bbad687d58859e (diff) | |
parent | f9f79c8d770e696249bd98c68b563f887562c974 (diff) |
Merge branch 'origin' into glsl-compiler-1
Conflicts:
src/mesa/main/context.c
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_cmdbuf.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog.c | 314 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_ioctl.c | 183 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_reg.h | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_context.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_lock.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_mm.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_state.c | 2 |
10 files changed, 186 insertions, 378 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index ace9b66724..2c7b5aa011 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -292,13 +292,13 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( vpt, always, R300_VPT_CMDSIZE, "vpt", 0 ); r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6); ALLOC_STATE( unk2080, always, 2, "unk2080", 0 ); - r300->hw.unk2080.cmd[0] = cmdpacket0(0x2080, 1); + r300->hw.unk2080.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1); ALLOC_STATE( vte, always, 3, "vte", 0 ); r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2); ALLOC_STATE( unk2134, always, 3, "unk2134", 0 ); r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2); ALLOC_STATE( unk2140, always, 2, "unk2140", 0 ); - r300->hw.unk2140.cmd[0] = cmdpacket0(0x2140, 1); + r300->hw.unk2140.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1); ALLOC_STATE( vir[0], variable, R300_VIR_CMDSIZE, "vir/0", 0 ); r300->hw.vir[0].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1); ALLOC_STATE( vir[1], variable, R300_VIR_CMDSIZE, "vir/1", 1 ); @@ -308,11 +308,11 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( unk21DC, always, 2, "unk21DC", 0 ); r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1); ALLOC_STATE( unk221C, always, 2, "unk221C", 0 ); - r300->hw.unk221C.cmd[0] = cmdpacket0(0x221C, 1); + r300->hw.unk221C.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_221C, 1); ALLOC_STATE( unk2220, always, 5, "unk2220", 0 ); r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4); ALLOC_STATE( unk2288, always, 2, "unk2288", 0 ); - r300->hw.unk2288.cmd[0] = cmdpacket0(0x2288, 1); + r300->hw.unk2288.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_2288, 1); ALLOC_STATE( vof, always, R300_VOF_CMDSIZE, "vof", 0 ); r300->hw.vof.cmd[R300_VOF_CMD_0] = cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2); ALLOC_STATE( pvs, always, R300_PVS_CMDSIZE, "pvs", 0 ); @@ -336,9 +336,9 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( unk4260, always, 4, "unk4260", 0 ); r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3); ALLOC_STATE( unk4274, always, 5, "unk4274", 0 ); - r300->hw.unk4274.cmd[0] = cmdpacket0(0x4274, 4); + r300->hw.unk4274.cmd[0] = cmdpacket0(R300_RE_SHADE, 4); ALLOC_STATE( unk4288, always, 4, "unk4288", 0 ); - r300->hw.unk4288.cmd[0] = cmdpacket0(0x4288, 3); + r300->hw.unk4288.cmd[0] = cmdpacket0(R300_RE_POLYGON_MODE, 3); ALLOC_STATE( fogp, always, 3, "fogp", 0 ); r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2); ALLOC_STATE( unk42A0, always, 2, "unk42A0", 0 ); @@ -346,7 +346,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( zbs, always, R300_ZBS_CMDSIZE, "zbs", 0 ); r300->hw.zbs.cmd[R300_ZBS_CMD_0] = cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4); ALLOC_STATE( unk42B4, always, 2, "unk42B4", 0 ); - r300->hw.unk42B4.cmd[0] = cmdpacket0(0x42B4, 1); + r300->hw.unk42B4.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1); ALLOC_STATE( cul, always, R300_CUL_CMDSIZE, "cul", 0 ); r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1); ALLOC_STATE( unk42C0, always, 3, "unk42C0", 0 ); @@ -393,7 +393,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( cmk, always, R300_CMK_CMDSIZE, "cmk", 0 ); r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1); ALLOC_STATE( unk4E10, always, 4, "unk4E10", 0 ); - r300->hw.unk4E10.cmd[0] = cmdpacket0(0x4E10, 3); + r300->hw.unk4E10.cmd[0] = cmdpacket0(R300_RB3D_BLEND_COLOR, 3); ALLOC_STATE( cb, always, R300_CB_CMDSIZE, "cb", 0 ); r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1); r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1); @@ -406,7 +406,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( zs, always, R300_ZS_CMDSIZE, "zstencil", 0 ); r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3); ALLOC_STATE( unk4F10, always, 5, "unk4F10", 0 ); - r300->hw.unk4F10.cmd[0] = cmdpacket0(0x4F10, 4); + r300->hw.unk4F10.cmd[0] = cmdpacket0(R300_RB3D_ZSTENCIL_FORMAT, 4); ALLOC_STATE( zb, always, R300_ZB_CMDSIZE, "zb", 0 ); r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2); ALLOC_STATE( unk4F28, always, 2, "unk4F28", 0 ); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 48b50bca65..a339b2f9c1 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -60,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif //#define OPTIMIZE_ELTS -#define CB_DPATH struct r300_context; typedef struct r300_context r300ContextRec; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 9330ec5b95..f18a982deb 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -1215,8 +1215,8 @@ static void make_sin_const(struct r300_fragment_program *rp) cnstv[3] = 0.2225; // weight rp->const_sin[0] = emit_const4fv(rp, cnstv); - cnstv[0] = 0.5; - cnstv[1] = -1.5; + cnstv[0] = 0.75; + cnstv[1] = 0.0; cnstv[2] = 0.159154943; // 1/(2*PI) cnstv[3] = 6.283185307; // 2*PI rp->const_sin[1] = emit_const4fv(rp, cnstv); @@ -1228,7 +1228,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp) struct gl_fragment_program *mp = &rp->mesa_program; const struct prog_instruction *inst = mp->Base.Instructions; struct prog_instruction *fpi; - GLuint src[3], dest, temp; + GLuint src[3], dest, temp[2]; GLuint cnst; int flags, mask = 0; GLfloat cnstv[4] = {0.0, 0.0, 0.0, 0.0}; @@ -1278,70 +1278,63 @@ static GLboolean parse_program(struct r300_fragment_program *rp) /* * cos using a parabola (see SIN): * cos(x): - * x += PI/2 - * x = (x/(2*PI))+0.5 + * x = (x/(2*PI))+0.75 * x = frac(x) * x = (x*2*PI)-PI * result = sin(x) */ - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); make_sin_const(rp); src[0] = t_scalar_src(rp, fpi->SrcReg[0]); /* add 0.5*PI and do range reduction */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(rp->const_sin[0], Z, Z, Z, Z), //PI - pfs_half, - swizzle(keep(src[0]), X, X, X, X), - 0); - - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + swizzle(src[0], X, X, X, X), swizzle(rp->const_sin[1], Z, Z, Z, Z), - pfs_half, + swizzle(rp->const_sin[1], X, X, X, X), 0); - emit_arith(rp, PFS_OP_FRC, temp, WRITEMASK_X, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_FRC, temp[0], WRITEMASK_X, + swizzle(temp[0], X, X, X, X), undef, undef, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Z, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, + swizzle(temp[0], X, X, X, X), swizzle(rp->const_sin[1], W, W, W, W), //2*PI negate(swizzle(rp->const_sin[0], Z, Z, Z, Z)), //-PI 0); /* SIN */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(temp, Z, Z, Z, Z), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[0], Z, Z, Z, Z), rp->const_sin[0], pfs_zero, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(temp, Z, Z, Z, Z)), - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + swizzle(temp[0], Y, Y, Y, Y), + absolute(swizzle(temp[0], Z, Z, Z, Z)), + swizzle(temp[0], X, X, X, X), 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Y, - swizzle(temp, X, X, X, X), - absolute(swizzle(temp, X, X, X, X)), - negate(swizzle(temp, X, X, X, X)), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Y, + swizzle(temp[0], X, X, X, X), + absolute(swizzle(temp[0], X, X, X, X)), + negate(swizzle(temp[0], X, X, X, X)), 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - swizzle(temp, Y, Y, Y, Y), + swizzle(temp[0], Y, Y, Y, Y), swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, X, X, X, X), + swizzle(temp[0], X, X, X, X), flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_DP3: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1364,15 +1357,15 @@ static GLboolean parse_program(struct r300_fragment_program *rp) * DP4 dest, temp, src1 */ #if 0 - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); src[0].s_swz = SWIZZLE_ONE; - emit_arith(rp, PFS_OP_MAD, temp, mask, + emit_arith(rp, PFS_OP_MAD, temp[0], mask, src[0], pfs_one, pfs_zero, 0); emit_arith(rp, PFS_OP_DP4, dest, mask, - temp, src[1], undef, + temp[0], src[1], undef, flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); #else emit_arith(rp, PFS_OP_DP4, dest, mask, swizzle(src[0], X, Y, Z, ONE), src[1], @@ -1409,17 +1402,17 @@ static GLboolean parse_program(struct r300_fragment_program *rp) break; case OPCODE_FLR: src[0] = t_src(rp, fpi->SrcReg[0]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* FRC temp, src0 * MAD dest, src0, 1.0, -temp */ - emit_arith(rp, PFS_OP_FRC, temp, mask, + emit_arith(rp, PFS_OP_FRC, temp[0], mask, keep(src[0]), undef, undef, 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - src[0], pfs_one, negate(temp), + src[0], pfs_one, negate(temp[0]), flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_FRC: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1451,44 +1444,44 @@ static GLboolean parse_program(struct r300_fragment_program *rp) */ cnstv[0] = cnstv[1] = cnstv[2] = cnstv[3] = 0.50001; src[0] = t_src(rp, fpi->SrcReg[0]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); cnst = emit_const4fv(rp, cnstv); - emit_arith(rp, PFS_OP_CMP, temp, + emit_arith(rp, PFS_OP_CMP, temp[0], WRITEMASK_X | WRITEMASK_Y, src[0], pfs_zero, src[0], flags); - emit_arith(rp, PFS_OP_MIN, temp, WRITEMASK_Z, + emit_arith(rp, PFS_OP_MIN, temp[0], WRITEMASK_Z, swizzle(keep(src[0]), W, W, W, W), cnst, undef, flags); - emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W, - swizzle(temp, Y, Y, Y, Y), + emit_arith(rp, PFS_OP_LG2, temp[0], WRITEMASK_W, + swizzle(temp[0], Y, Y, Y, Y), undef, undef, flags); - emit_arith(rp, PFS_OP_MAX, temp, WRITEMASK_Z, - temp, negate(cnst), undef, flags); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - temp, swizzle(temp, Z, Z, Z, Z), + emit_arith(rp, PFS_OP_MAX, temp[0], WRITEMASK_Z, + temp[0], negate(cnst), undef, flags); + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, + temp[0], swizzle(temp[0], Z, Z, Z, Z), pfs_zero, flags); - emit_arith(rp, PFS_OP_EX2, temp, WRITEMASK_W, - temp, undef, undef, flags); + emit_arith(rp, PFS_OP_EX2, temp[0], WRITEMASK_W, + temp[0], undef, undef, flags); emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_Y, - swizzle(keep(temp), X, X, X, X), + swizzle(keep(temp[0]), X, X, X, X), pfs_one, pfs_zero, flags); #if 0 - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - temp, pfs_one, pfs_half, flags); - emit_arith(rp, PFS_OP_CMPH, temp, WRITEMASK_Z, - swizzle(keep(temp), W, W, W, W), - pfs_zero, swizzle(keep(temp), X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + temp[0], pfs_one, pfs_half, flags); + emit_arith(rp, PFS_OP_CMPH, temp[0], WRITEMASK_Z, + swizzle(keep(temp[0]), W, W, W, W), + pfs_zero, swizzle(keep(temp[0]), X, X, X, X), flags); #else - emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_Z, + emit_arith(rp, PFS_OP_CMP, temp[0], WRITEMASK_Z, pfs_zero, - swizzle(keep(temp), W, W, W, W), - negate(swizzle(keep(temp), X, X, X, X)), + swizzle(keep(temp[0]), W, W, W, W), + negate(swizzle(keep(temp[0]), X, X, X, X)), flags); #endif emit_arith(rp, PFS_OP_CMP, dest, WRITEMASK_Z, - pfs_zero, temp, - negate(swizzle(keep(temp), Y, Y, Y, Y)), + pfs_zero, temp[0], + negate(swizzle(keep(temp[0]), Y, Y, Y, Y)), flags); emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_X | WRITEMASK_W, @@ -1496,7 +1489,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp) pfs_one, pfs_zero, flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_LRP: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1507,14 +1500,14 @@ static GLboolean parse_program(struct r300_fragment_program *rp) * MAD temp, -tmp0, tmp2, tmp2 * MAD result, tmp0, tmp1, temp */ - temp = get_temp_reg(rp); - emit_arith(rp, PFS_OP_MAD, temp, mask, + temp[0] = get_temp_reg(rp); + emit_arith(rp, PFS_OP_MAD, temp[0], mask, negate(keep(src[0])), keep(src[2]), src[2], 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - src[0], src[1], temp, + src[0], src[1], temp[0], flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_MAD: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1555,17 +1548,17 @@ static GLboolean parse_program(struct r300_fragment_program *rp) case OPCODE_POW: src[0] = t_scalar_src(rp, fpi->SrcReg[0]); src[1] = t_scalar_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); - emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W, + temp[0] = get_temp_reg(rp); + emit_arith(rp, PFS_OP_LG2, temp[0], WRITEMASK_W, src[0], undef, undef, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - temp, src[1], pfs_zero, + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, + temp[0], src[1], pfs_zero, 0); emit_arith(rp, PFS_OP_EX2, dest, fpi->DstReg.WriteMask, - temp, undef, undef, + temp[0], undef, undef, 0); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_RCP: src[0] = t_scalar_src(rp, fpi->SrcReg[0]); @@ -1581,107 +1574,91 @@ static GLboolean parse_program(struct r300_fragment_program *rp) break; case OPCODE_SCS: /* - * cos using a parabola (see SIN): - * cos(x): - * x += PI/2 - * x = (x/(2*PI))+0.5 - * x = frac(x) - * x = (x*2*PI)-PI - * result = sin(x) + * scs using a parabola : + * scs(x): + * result.x = sin(-abs(x)+0.5*PI) (cos) + * result.y = sin(x) (sin) + * */ - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); + temp[1] = get_temp_reg(rp); make_sin_const(rp); src[0] = t_scalar_src(rp, fpi->SrcReg[0]); - /* add 0.5*PI and do range reduction */ + /* x = -abs(x)+0.5*PI */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, + swizzle(rp->const_sin[0], Z, Z, Z, Z), //PI + pfs_half, + negate(abs(swizzle(keep(src[0]), X, X, X, X))), + 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X|WRITEMASK_Y, - swizzle(rp->const_sin[0], Z, Z, Z, Z), - rp->const_sin[1], + /* C*x (sin) */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, + swizzle(rp->const_sin[0], Y, Y, Y, Y), swizzle(keep(src[0]), X, X, X, X), + pfs_zero, 0); - emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_W, - swizzle(rp->const_sin[0], Z, Z, Z, Z), - negate(pfs_half), - swizzle(keep(src[0]), X, X, X, X), + /* B*x, C*x (cos) */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[0], Z, Z, Z, Z), + rp->const_sin[0], + pfs_zero, 0); - emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_Z, - swizzle(temp, X, X, X, X), - swizzle(temp, Y, Y, Y, Y), - swizzle(temp, W, W, W, W), + /* B*x (sin) */ + emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_W, + swizzle(rp->const_sin[0], X, X, X, X), + keep(src[0]), + pfs_zero, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(temp, Z, Z, Z, Z), - rp->const_sin[0], - pfs_zero, + /* y = B*x + C*x*abs(x) (sin)*/ + emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_Z, + absolute(src[0]), + swizzle(temp[0], W, W, W, W), + swizzle(temp[1], W, W, W, W), 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(temp, Z, Z, Z, Z)), - swizzle(temp, X, X, X, X), + /* y = B*x + C*x*abs(x) (cos)*/ + emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_W, + swizzle(temp[0], Y, Y, Y, Y), + absolute(swizzle(temp[0], Z, Z, Z, Z)), + swizzle(temp[0], X, X, X, X), 0); - if(mask & WRITEMASK_Y) - { - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(keep(src[0]), X, X, X, X), - rp->const_sin[0], - pfs_zero, - 0); - - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(keep(src[0]), X, X, X, X)), - swizzle(temp, X, X, X, X), - 0); - } + /* y*abs(y) - y (cos), y*abs(y) - y (sin) */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[1], W, Z, Y, X), + absolute(swizzle(temp[1], W, Z, Y, X)), + negate(swizzle(temp[1], W, Z, Y, X)), - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Z, - swizzle(temp, W, W, W, W), - absolute(swizzle(temp, W, W, W, W)), - negate(swizzle(temp, W, W, W, W)), 0); - emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_X, - swizzle(temp, Z, Z, Z, Z), + /* dest.xy = mad(temp.xy, P, temp2.wz) */ + emit_arith(rp, PFS_OP_MAD, dest, mask & (WRITEMASK_X | WRITEMASK_Y), + temp[0], swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, W, W, W, W), + swizzle(temp[1], W, Z, Y, X), flags); - if(mask & WRITEMASK_Y) - { - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - swizzle(temp, X, X, X, X), - absolute(swizzle(temp, X, X, X, X)), - negate(swizzle(temp, X, X, X, X)), - 0); - - emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_Y, - swizzle(temp, W, W, W, W), - swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, X, X, X, X), - flags); - } - free_temp(rp, temp); + free_temp(rp, temp[0]); + free_temp(rp, temp[1]); break; case OPCODE_SGE: src[0] = t_src(rp, fpi->SrcReg[0]); src[1] = t_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* temp = src0 - src1 * dest.c = (temp.c < 0.0) ? 0 : 1 */ - emit_arith(rp, PFS_OP_MAD, temp, mask, + emit_arith(rp, PFS_OP_MAD, temp[0], mask, src[0], pfs_one, negate(src[1]), 0); emit_arith(rp, PFS_OP_CMP, dest, mask, - pfs_one, pfs_zero, temp, + pfs_one, pfs_zero, temp[0], 0); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_SIN: /* @@ -1691,73 +1668,74 @@ static GLboolean parse_program(struct r300_fragment_program *rp) * itself squared. */ - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); make_sin_const(rp); src[0] = t_scalar_src(rp, fpi->SrcReg[0]); + /* do range reduction */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, swizzle(keep(src[0]), X, X, X, X), swizzle(rp->const_sin[1], Z, Z, Z, Z), pfs_half, 0); - emit_arith(rp, PFS_OP_FRC, temp, WRITEMASK_X, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_FRC, temp[0], WRITEMASK_X, + swizzle(temp[0], X, X, X, X), undef, undef, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Z, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, + swizzle(temp[0], X, X, X, X), swizzle(rp->const_sin[1], W, W, W, W), //2*PI negate(swizzle(rp->const_sin[0], Z, Z, Z, Z)), //PI 0); /* SIN */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(temp, Z, Z, Z, Z), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[0], Z, Z, Z, Z), rp->const_sin[0], pfs_zero, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(temp, Z, Z, Z, Z)), - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + swizzle(temp[0], Y, Y, Y, Y), + absolute(swizzle(temp[0], Z, Z, Z, Z)), + swizzle(temp[0], X, X, X, X), 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Y, - swizzle(temp, X, X, X, X), - absolute(swizzle(temp, X, X, X, X)), - negate(swizzle(temp, X, X, X, X)), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Y, + swizzle(temp[0], X, X, X, X), + absolute(swizzle(temp[0], X, X, X, X)), + negate(swizzle(temp[0], X, X, X, X)), 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - swizzle(temp, Y, Y, Y, Y), + swizzle(temp[0], Y, Y, Y, Y), swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, X, X, X, X), + swizzle(temp[0], X, X, X, X), flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_SLT: src[0] = t_src(rp, fpi->SrcReg[0]); src[1] = t_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* temp = src0 - src1 * dest.c = (temp.c < 0.0) ? 1 : 0 */ - emit_arith(rp, PFS_OP_MAD, temp, mask, + emit_arith(rp, PFS_OP_MAD, temp[0], mask, src[0], pfs_one, negate(src[1]), 0); emit_arith(rp, PFS_OP_CMP, dest, mask, - pfs_zero, pfs_one, temp, + pfs_zero, pfs_one, temp[0], 0); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_SUB: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1778,9 +1756,9 @@ static GLboolean parse_program(struct r300_fragment_program *rp) case OPCODE_XPD: { src[0] = t_src(rp, fpi->SrcReg[0]); src[1] = t_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* temp = src0.zxy * src1.yzx */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_XYZ, + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_XYZ, swizzle(keep(src[0]), Z, X, Y, W), swizzle(keep(src[1]), Y, Z, X, W), pfs_zero, @@ -1791,10 +1769,10 @@ static GLboolean parse_program(struct r300_fragment_program *rp) emit_arith(rp, PFS_OP_MAD, dest, mask & WRITEMASK_XYZ, swizzle(src[0], Y, Z, X, W), swizzle(src[1], Z, X, Y, W), - negate(temp), + negate(temp[0]), flags); /* cleanup */ - free_temp(rp, temp); + free_temp(rp, temp[0]); break; } default: diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 0774a2af6b..6fa34ee482 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -70,10 +70,6 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) drm_radeon_cmd_header_t *cmd = NULL; r300ContextPtr rmesa=r300; -#ifndef CB_DPATH - int i; -#endif - if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n", __FUNCTION__, buffer ? "back" : "front", @@ -89,168 +85,8 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) cboffset += r300->radeon.radeonScreen->fbLocation; -#ifndef CB_DPATH - R300_STATECHANGE(r300, vir[0]); - ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = 1; - r300->hw.vir[0].cmd[1] = 0x21030003; - - R300_STATECHANGE(r300, vir[1]); - ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = 1; - r300->hw.vir[1].cmd[1] = 0xF688F688; - - R300_STATECHANGE(r300, vic); - r300->hw.vic.cmd[R300_VIC_CNTL_0] = 0x00000001; - r300->hw.vic.cmd[R300_VIC_CNTL_1] = 0x00000405; - - R300_STATECHANGE(r300, vof); - r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT - | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT; - r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */ - - R300_STATECHANGE(r300, txe); - r300->hw.txe.cmd[R300_TXE_ENABLE] = 0; - - R300_STATECHANGE(r300, vpt); - r300->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(dPriv->x); - r300->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(dPriv->y); - r300->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(0.0); - - R300_STATECHANGE(r300, at); - r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0; - - R300_STATECHANGE(r300, bld); - r300->hw.bld.cmd[R300_BLD_CBLEND] = 0; - r300->hw.bld.cmd[R300_BLD_ABLEND] = 0; - - if (r300->radeon.radeonScreen->cpp == 4) - cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else - cbpitch |= R300_COLOR_FORMAT_RGB565; - - if (r300->radeon.sarea->tiling_enabled) - cbpitch |= R300_COLOR_TILE_ENABLE; - - R300_STATECHANGE(r300, cb); - r300->hw.cb.cmd[R300_CB_OFFSET] = cboffset; - r300->hw.cb.cmd[R300_CB_PITCH] = cbpitch; - - R300_STATECHANGE(r300, unk221C); - r300->hw.unk221C.cmd[1] = R300_221C_CLEAR; - - R300_STATECHANGE(r300, ps); - r300->hw.ps.cmd[R300_PS_POINTSIZE] = - ((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) | - ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT); - - R300_STATECHANGE(r300, ri); - for(i = 1; i <= 8; ++i) - r300->hw.ri.cmd[i] = R300_RS_INTERP_USED; - - R300_STATECHANGE(r300, rc); - /* The second constant is needed to get glxgears display anything .. */ - r300->hw.rc.cmd[1] = (1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18; - r300->hw.rc.cmd[2] = 0; - - R300_STATECHANGE(r300, rr); - ((drm_r300_cmd_header_t*)r300->hw.rr.cmd)->packet0.count = 1; - r300->hw.rr.cmd[1] = 0x00004000; - - R300_STATECHANGE(r300, cmk); - if (flags & CLEARBUFFER_COLOR) { - r300->hw.cmk.cmd[R300_CMK_COLORMASK] = - (ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) | - (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) | - (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) | - (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0); - } else { - r300->hw.cmk.cmd[R300_CMK_COLORMASK] = 0; - } - - R300_STATECHANGE(r300, fp); - r300->hw.fp.cmd[R300_FP_CNTL0] = 0; /* 1 pass, no textures */ - r300->hw.fp.cmd[R300_FP_CNTL1] = 0; /* no temporaries */ - r300->hw.fp.cmd[R300_FP_CNTL2] = 0; /* no offset, one ALU instr */ - r300->hw.fp.cmd[R300_FP_NODE0] = 0; - r300->hw.fp.cmd[R300_FP_NODE1] = 0; - r300->hw.fp.cmd[R300_FP_NODE2] = 0; - r300->hw.fp.cmd[R300_FP_NODE3] = R300_PFS_NODE_OUTPUT_COLOR; - - R300_STATECHANGE(r300, fpi[0]); - R300_STATECHANGE(r300, fpi[1]); - R300_STATECHANGE(r300, fpi[2]); - R300_STATECHANGE(r300, fpi[3]); - ((drm_r300_cmd_header_t*)r300->hw.fpi[0].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[1].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[2].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[3].cmd)->packet0.count = 1; - - /* MOV o0, t0 */ - r300->hw.fpi[0].cmd[1] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)); - r300->hw.fpi[1].cmd[1] = FP_SELC(0,NO,XYZ,FP_TMP(0),0,0); - r300->hw.fpi[2].cmd[1] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)); - r300->hw.fpi[3].cmd[1] = FP_SELA(0,NO,W,FP_TMP(0),0,0); - - R300_STATECHANGE(r300, pvs); - r300->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | - (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); - r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; /* no parameters */ - r300->hw.pvs.cmd[R300_PVS_CNTL_3] = - (1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT); - - R300_STATECHANGE(r300, vpi); - ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->packet0.count = 8; - - /* MOV o0, i0; */ - r300->hw.vpi.cmd[1] = VP_OUT(ADD,OUT,0,XYZW); - r300->hw.vpi.cmd[2] = VP_IN(IN,0); - r300->hw.vpi.cmd[3] = VP_ZERO(); - r300->hw.vpi.cmd[4] = 0; - - /* MOV o1, i1; */ - r300->hw.vpi.cmd[5] = VP_OUT(ADD,OUT,1,XYZW); - r300->hw.vpi.cmd[6] = VP_IN(IN,1); - r300->hw.vpi.cmd[7] = VP_ZERO(); - r300->hw.vpi.cmd[8] = 0; - - R300_STATECHANGE(r300, zs); - r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0; - r300->hw.zs.cmd[R300_ZS_CNTL_1] = 0; - if (flags & CLEARBUFFER_DEPTH) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_WRITE_ONLY; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= (R300_ZS_ALWAYS<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT); - } else { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; // disable - } - - R300_STATECHANGE(r300, zs); - if (flags & CLEARBUFFER_STENCIL) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_STENCIL_ENABLE; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= - (R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) | - (R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ; - r300->hw.zs.cmd[R300_ZS_CNTL_2] = r300->state.stencil.clear; - } - - /* Make sure we have enough space */ - r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9+8, __FUNCTION__); - - r300EmitState(r300); -#else -#if 1 cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN); end_3d(rmesa); -#endif R300_STATECHANGE(r300, cb); reg_start(R300_RB3D_COLOROFFSET0, 0); @@ -313,8 +149,6 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) e32(r300->state.stencil.clear); } -#endif - cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__); cmd2[0].packet3.cmd_type = R300_CMD_PACKET3; cmd2[0].packet3.packet = R300_CMD_PACKET3_CLEAR; @@ -327,7 +161,6 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]); cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]); -#if 1 reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); @@ -335,10 +168,8 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) reg_start(0x4f18,0); e32(0x00000003); cp_wait(rmesa, R300_WAIT_3D | R300_WAIT_3D_CLEAN); -#endif } -#ifdef CB_DPATH static void r300EmitClearState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -397,7 +228,7 @@ static void r300EmitClearState(GLcontext * ctx) e32(0); R300_STATECHANGE(r300, unk221C); - reg_start(0x221C, 0); + reg_start(R300_VAP_UNKNOWN_221C, 0); e32(R300_221C_CLEAR); R300_STATECHANGE(r300, ps); @@ -472,7 +303,6 @@ static void r300EmitClearState(GLcontext * ctx) /*reg_start(0x4500,0); e32(2560-1);*/ } -#endif /** * Buffer clear @@ -524,12 +354,10 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1); -#ifdef CB_DPATH /* Make sure it fits there. */ r300EnsureCmdBufSpace(r300, 421*3, __FUNCTION__); if(flags || bits) r300EmitClearState(ctx); -#endif if (flags & BUFFER_BIT_FRONT_LEFT) { r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, swapped); @@ -544,15 +372,6 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) if (bits) r300ClearBuffer(r300, bits, 0); -#ifndef CB_DPATH - /* Recalculate the hardware state. This could be done more efficiently, - * but do keep it like this for now. - */ - r300ResetHwState(r300); - - /* r300ClearBuffer has trampled all over the hardware state.. */ - r300->hw.all_dirty=GL_TRUE; -#endif } diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 9f636ec1d2..69bc994cf6 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -63,6 +63,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_SE_VPORT_ZOFFSET 0x1DAC +/* + * Vertex Array Processing (VAP) Control + * Stolen from r200 code from Christoph Brill (It's a guess!) + */ +#define R300_VAP_CNTL 0x2080 + /* This register is written directly and also starts data section * in many 3d CP_PACKET3's */ @@ -135,7 +141,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* gap */ -#define R300_VAP_CNTL 0x2140 +#define R300_VAP_CNTL_STATUS 0x2140 # define R300_VC_NO_SWAP (0 << 0) # define R300_VC_16BIT_SWAP (1 << 0) # define R300_VC_32BIT_SWAP (2 << 0) @@ -538,6 +544,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Some sort of scale or clamp value for texcoordless textures. */ #define R300_RE_UNK4238 0x4238 +/* Something shade related */ +#define R300_RE_SHADE 0x4274 + #define R300_RE_SHADE_MODEL 0x4278 # define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa # define R300_RE_SHADE_MODEL_FLAT 0x39595 @@ -1273,6 +1282,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_BLEND_MASK (63) # define R300_SRC_BLEND_SHIFT (16) # define R300_DST_BLEND_SHIFT (24) +#define R300_RB3D_BLEND_COLOR 0x4E10 #define R300_RB3D_COLORMASK 0x4E0C # define R300_COLORMASK0_B (1<<0) # define R300_COLORMASK0_G (1<<1) @@ -1378,6 +1388,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 16 bit format or some aditional bit ? */ # define R300_DEPTH_FORMAT_UNK32 (32 << 0) +#define R300_RB3D_EARLY_Z 0x4F14 +# define R300_EARLY_Z_DISABLE (0 << 0) +# define R300_EARLY_Z_ENABLE (1 << 0) + /* gap */ #define R300_RB3D_DEPTHOFFSET 0x4F20 diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 62bbc96544..50dcee4755 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -330,24 +330,24 @@ static void r300UpdateCulling(GLcontext* ctx) static void update_early_z(GLcontext *ctx) { - /* updates register 0x4f14 - if depth test is not enabled it should be 0x00000000 - if depth is enabled and alpha not it should be 0x00000001 - if depth and alpha is enabled it should be 0x00000000 + /* updates register R300_RB3D_EARLY_Z (0x4F14) + if depth test is not enabled it should be R300_EARLY_Z_DISABLE + if depth is enabled and alpha not it should be R300_EARLY_Z_ENABLE + if depth and alpha is enabled it should be R300_EARLY_Z_DISABLE */ r300ContextPtr r300 = R300_CONTEXT(ctx); R300_STATECHANGE(r300, unk4F10); if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS) /* disable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000000; + r300->hw.unk4F10.cmd[2] = R300_EARLY_Z_DISABLE; else { if (ctx->Depth.Test && ctx->Depth.Func != GL_NEVER) /* enable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000001; + r300->hw.unk4F10.cmd[2] = R300_EARLY_Z_ENABLE; else /* disable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000000; + r300->hw.unk4F10.cmd[2] = R300_EARLY_Z_DISABLE; } } @@ -1772,9 +1772,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) GLcontext *ctx; ctx = rmesa->radeon.glCtx; -#ifdef CB_DPATH r300UpdateTextureState(ctx); -#endif r300SetupPixelShader(rmesa); r300_setup_textures(ctx); @@ -1899,10 +1897,6 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) r300UpdateStateParameters(ctx, new_state); -#ifndef CB_DPATH - /* Go inefficiency! */ - r300ResetHwState(r300); -#endif #ifdef HW_VBOS if(new_state & _NEW_ARRAY) r300->state.VB.lock_uptodate = GL_FALSE; diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 3a6bde8fc3..66d1b153b3 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -51,6 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_macros.h" #include "radeon_reg.h" +#include "radeon_state.h" #include "r300_state.h" #include "utils.h" @@ -272,11 +273,13 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, &radeon->vbl_seq); } + radeon->dri.readable = driReadPriv; + if (radeon->dri.drawable != driDrawPriv || - radeon->dri.readable != driReadPriv) { + radeon->lastStamp != driDrawPriv->lastStamp) { radeon->dri.drawable = driDrawPriv; - radeon->dri.readable = driReadPriv; + radeonSetCliprects(radeon); r300UpdateWindow(radeon->glCtx); r300UpdateViewportOffset(radeon->glCtx); } diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c index a00da6c8bc..1a2dfca7b0 100644 --- a/src/mesa/drivers/dri/r300/radeon_lock.c +++ b/src/mesa/drivers/dri/r300/radeon_lock.c @@ -90,7 +90,6 @@ static void r300RegainedLock(radeonContextPtr radeon) #else radeonUpdateScissor(radeon->glCtx); #endif - radeon->lastStamp = drawable->lastStamp; } if (sarea->ctx_owner != radeon->dri.hwContext) { diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c index f86a1b4e72..32ed1f4393 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.c +++ b/src/mesa/drivers/dri/r300/radeon_mm.c @@ -283,7 +283,7 @@ static void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long s size -= cp_size; } - reg_start(0x4e4c,0); + reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); reg_start(0x342c,0); diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c index ddadf83a00..902e9583a6 100644 --- a/src/mesa/drivers/dri/r300/radeon_state.c +++ b/src/mesa/drivers/dri/r300/radeon_state.c @@ -185,6 +185,8 @@ void radeonSetCliprects(radeonContextPtr radeon) if (radeon->state.scissor.enabled) radeonRecalcScissorRects(radeon); + + radeon->lastStamp = drawable->lastStamp; } |