FP_OPCODE_UP2US, /* NV_f_p only */
FP_OPCODE_UP4B, /* NV_f_p only */
FP_OPCODE_UP4UB, /* NV_f_p only */
- FP_OPCODE_X2D, /* XPD in ARB_f_p */
+ FP_OPCODE_XPD, /* ARB_f_p only - cross product */
+ FP_OPCODE_X2D, /* NV_f_p only - 2D matrix multiply */
FP_OPCODE_END /* private opcode */
};
case FP_OPCODE_TXP:
fprintf(stderr, "FP_OPCODE_TXP"); break;
- case FP_OPCODE_X2D:
+ case FP_OPCODE_XPD:
fprintf(stderr, "FP_OPCODE_XPD"); break;
default:
case OP_XPD_SAT:
fp->Saturate = 1;
case OP_XPD:
- fp->Opcode = FP_OPCODE_X2D;
+ fp->Opcode = FP_OPCODE_XPD;
break;
}
FP_OPCODE_UP2US, /* NV_f_p only */
FP_OPCODE_UP4B, /* NV_f_p only */
FP_OPCODE_UP4UB, /* NV_f_p only */
- FP_OPCODE_X2D, /* XPD in ARB_f_p */
+ FP_OPCODE_X2D, /* NV_f_p only - 2d mat mul */
+ FP_OPCODE_XPD, /* ARB_f_p only - cross product */
FP_OPCODE_END /* private opcode */
};
store_vector4( inst, machine, result );
}
break;
+ case FP_OPCODE_XPD: /* cross product */
+ {
+ GLfloat a[4], b[4], result[4];
+ fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( ctx, &inst->SrcReg[1], machine, program, b );
+ result[0] = a[1] * b[2] - a[2] * b[1];
+ result[1] = a[2] * b[0] - a[0] * b[2];
+ result[2] = a[0] * b[1] - a[1] * b[0];
+ result[3] = 1.0;
+ store_vector4( inst, machine, result );
+ }
+ break;
case FP_OPCODE_X2D: /* 2-D matrix transform */
{
GLfloat a[4], b[4], c[4], result[4];