summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_execute.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-11-07 09:41:00 -0700
committerBrian Paul <[email protected]>2008-11-07 09:51:25 -0700
commit65cb74ecc0287d766493fd3649295e2e1b20099b (patch)
treed277ee691c80a00d96b399090806f2ac86718e06 /src/mesa/shader/prog_execute.c
parent37eef7b474c5d9a7c566f9edf35c797c5a98d065 (diff)
mesa: added DP2, DP2A instructions
Diffstat (limited to 'src/mesa/shader/prog_execute.c')
-rw-r--r--src/mesa/shader/prog_execute.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index b47421d5a11..ef17ed128a7 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -776,6 +776,33 @@ _mesa_execute_program(GLcontext * ctx,
store_vector4(inst, machine, result);
}
break;
+ case OPCODE_DP2:
+ {
+ GLfloat a[4], b[4], result[4];
+ fetch_vector4(&inst->SrcReg[0], machine, a);
+ fetch_vector4(&inst->SrcReg[1], machine, b);
+ result[0] = result[1] = result[2] = result[3] = DOT2(a, b);
+ store_vector4(inst, machine, result);
+ if (DEBUG_PROG) {
+ printf("DP2 %g = (%g %g) . (%g %g)\n",
+ result[0], a[0], a[1], b[0], b[1]);
+ }
+ }
+ break;
+ case OPCODE_DP2A:
+ {
+ GLfloat a[4], b[4], c, result[4];
+ fetch_vector4(&inst->SrcReg[0], machine, a);
+ fetch_vector4(&inst->SrcReg[1], machine, b);
+ fetch_vector1(&inst->SrcReg[1], machine, &c);
+ result[0] = result[1] = result[2] = result[3] = DOT2(a, b) + c;
+ store_vector4(inst, machine, result);
+ if (DEBUG_PROG) {
+ printf("DP2A %g = (%g %g) . (%g %g) + %g\n",
+ result[0], a[0], a[1], b[0], b[1], c);
+ }
+ }
+ break;
case OPCODE_DP3:
{
GLfloat a[4], b[4], result[4];
@@ -808,8 +835,7 @@ _mesa_execute_program(GLcontext * ctx,
GLfloat a[4], b[4], result[4];
fetch_vector4(&inst->SrcReg[0], machine, a);
fetch_vector4(&inst->SrcReg[1], machine, b);
- result[0] = result[1] = result[2] = result[3] =
- a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + b[3];
+ result[0] = result[1] = result[2] = result[3] = DOT3(a, b) + b[3];
store_vector4(inst, machine, result);
}
break;