summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2005-09-09 15:43:11 +0000
committerRoland Scheidegger <[email protected]>2005-09-09 15:43:11 +0000
commitb346213960057a25edf404e3323fc9da4dc54c0e (patch)
tree1991fab2c5608d8bce1a44964d838b3d999f0837
parent95db1f01273bcc4ab4f5405eaa0bc87b63c1f297 (diff)
fix some bugs with handling of GL_DOT4_ATI, GL_DOT3_ATI and GL_DOT2_ADD_ATI ATI_fs instructions.
-rw-r--r--src/mesa/swrast/s_atifragshader.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index c3d9af8c171..4b53ff6587e 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -98,7 +98,7 @@ apply_src_rep(GLint optype, GLuint rep, GLfloat * val)
return;
start = optype ? 3 : 0;
- end = optype ? 4 : 3;
+ end = 4;
for (i = start; i < end; i++) {
switch (rep) {
@@ -128,7 +128,7 @@ apply_src_mod(GLint optype, GLuint mod, GLfloat * val)
return;
start = optype ? 3 : 0;
- end = optype ? 4 : 3;
+ end = 4;
for (i = start; i < end; i++) {
if (mod & GL_COMP_BIT_ATI)
@@ -474,6 +474,7 @@ execute_shader(GLcontext * ctx,
GLfloat result;
/* DOT 2 always uses the source from the color op */
+ /* could save recalculation of dot products for alpha inst */
result = src[0][0][0] * src[0][1][0] +
src[0][0][1] * src[0][1][1] + src[0][2][2];
if (!optype) {
@@ -483,7 +484,6 @@ execute_shader(GLcontext * ctx,
}
else
dst[optype][3] = result;
-
}
break;
case GL_DOT3_ATI:
@@ -509,7 +509,7 @@ execute_shader(GLcontext * ctx,
GLfloat result;
/* DOT 4 always uses the source from the color op */
- result = src[optype][0][0] * src[0][1][0] +
+ result = src[0][0][0] * src[0][1][0] +
src[0][0][1] * src[0][1][1] +
src[0][0][2] * src[0][1][2] +
src[0][0][3] * src[0][1][3];
@@ -533,9 +533,13 @@ execute_shader(GLcontext * ctx,
dstreg = inst->DstReg[optype].Index;
dstp = machine->Registers[dstreg - GL_REG_0_ATI];
- write_dst_addr(optype, inst->DstReg[optype].dstMod,
+ if ((optype == 0) || ((inst->Opcode[1] != GL_DOT2_ADD_ATI) &&
+ (inst->Opcode[1] != GL_DOT3_ATI) && (inst->Opcode[1] != GL_DOT4_ATI)))
+ write_dst_addr(optype, inst->DstReg[optype].dstMod,
inst->DstReg[optype].dstMask, dst[optype],
dstp);
+ else
+ write_dst_addr(1, inst->DstReg[0].dstMod, 0, dst[1], dstp);
}
}
}