From eeb5eeb2a62627d2a547f6739105c1418caf6d9d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 29 Mar 2004 16:01:18 +0000 Subject: Accomodate ARB_fp XPD opcode separately from NV_fp's X2D. --- src/mesa/main/nvfragprog.h | 3 ++- src/mesa/shader/arbfragparse.c | 2 +- src/mesa/shader/arbprogparse.c | 2 +- src/mesa/shader/nvfragprog.h | 3 ++- src/mesa/swrast/s_nvfragprog.c | 12 ++++++++++++ 5 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/nvfragprog.h b/src/mesa/main/nvfragprog.h index fa817d4b9c..85909c9a28 100644 --- a/src/mesa/main/nvfragprog.h +++ b/src/mesa/main/nvfragprog.h @@ -112,7 +112,8 @@ enum fp_opcode { 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 */ }; diff --git a/src/mesa/shader/arbfragparse.c b/src/mesa/shader/arbfragparse.c index 46d80dd2e2..d876946a25 100644 --- a/src/mesa/shader/arbfragparse.c +++ b/src/mesa/shader/arbfragparse.c @@ -145,7 +145,7 @@ _mesa_debug_fp_inst(GLint num, struct fp_instruction *fp) 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: diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 7fa2569c64..c2365a281c 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -2903,7 +2903,7 @@ parse_fp_instruction (GLcontext * ctx, GLubyte ** inst, case OP_XPD_SAT: fp->Saturate = 1; case OP_XPD: - fp->Opcode = FP_OPCODE_X2D; + fp->Opcode = FP_OPCODE_XPD; break; } diff --git a/src/mesa/shader/nvfragprog.h b/src/mesa/shader/nvfragprog.h index fa817d4b9c..e83827d1a1 100644 --- a/src/mesa/shader/nvfragprog.h +++ b/src/mesa/shader/nvfragprog.h @@ -112,7 +112,8 @@ enum fp_opcode { 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 */ }; diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index 4083581ab0..127cc4f0b4 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -1233,6 +1233,18 @@ execute_program( GLcontext *ctx, 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]; -- cgit v1.2.3