summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-06 09:03:18 -0700
committerBrian <brian@yutani.localnet.net>2007-03-06 09:03:18 -0700
commit330d7e2080ec3f4385f83a6b68e4b46f28aee7a8 (patch)
tree5a74458a65182a840c4dc80406d4308c66d2798d /src/mesa
parenta8ba888a351ceb4242fa334f3c41ef76d7f25bc8 (diff)
parent6f9b1afc862851532e4820705c412388b497ad58 (diff)
Merge branch 'master' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c3
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c1
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c18
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.c314
-rw-r--r--src/mesa/drivers/dri/r300/r300_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h16
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c14
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.c3
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.c1
-rw-r--r--src/mesa/drivers/dri/r300/radeon_mm.c2
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.c2
-rw-r--r--src/mesa/shader/arbprogparse.c1
15 files changed, 194 insertions, 192 deletions
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index d0e58f667c..ebe2615fe8 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -398,7 +398,8 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void
i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
+ _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 107cf137ff..942e1e9c22 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -449,7 +449,8 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
+ _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c
index efa1b014a6..bc538902b4 100644
--- a/src/mesa/drivers/dri/i915tex/intel_screen.c
+++ b/src/mesa/drivers/dri/i915tex/intel_screen.c
@@ -609,7 +609,8 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
static void
intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
+ _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 092c6bafc2..4eb2eedd42 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -458,6 +458,7 @@ void brw_draw_prims( GLcontext *ctx,
* swrast to do the drawing.
*/
if (!retval) {
+ _swsetup_Wakeup(ctx);
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 08f0bb340f..06e5d0c5bd 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -457,7 +457,8 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
{
- _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+ /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */
+ _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
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_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index 8e45bd5403..a1c634a54d 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -1214,8 +1214,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);
@@ -1227,7 +1227,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};
@@ -1277,70 +1277,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]);
@@ -1363,15 +1356,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],
@@ -1408,17 +1401,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]);
@@ -1450,44 +1443,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,
@@ -1495,7 +1488,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]);
@@ -1506,14 +1499,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]);
@@ -1554,17 +1547,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]);
@@ -1580,107 +1573,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:
/*
@@ -1690,73 +1667,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]);
@@ -1777,9 +1755,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,
@@ -1790,10 +1768,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 c5ad026045..6fa34ee482 100644
--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
+++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
@@ -228,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);
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 b30ece160a..0e33e51ef3 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -328,24 +328,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;
}
}
diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c
index 3a6bde8fc3..d66f1dc49e 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"
@@ -279,6 +280,8 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
r300UpdateWindow(radeon->glCtx);
r300UpdateViewportOffset(radeon->glCtx);
+
+ radeonSetCliprects(radeon);
}
_mesa_make_current(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;
}
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index b9ff08de5f..c6ea5c4f97 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -4038,6 +4038,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
program->TexturesUsed[i] = ap.TexturesUsed[i];
program->FogOption = ap.FogOption;
+ program->UsesKill = ap.UsesKill;
if (program->Base.Instructions)
_mesa_free(program->Base.Instructions);