summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_nvfragprog.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-04-05 00:38:09 +0000
committerBrian Paul <[email protected]>2003-04-05 00:38:09 +0000
commitce7f006e66533da9f6db61e368273f1ffcc12ace (patch)
treeb804a1077ea431d7ac4cca64232752ebef83e097 /src/mesa/swrast/s_nvfragprog.c
parent738318bb75dea8dac4465f53850987f6062a732d (diff)
fragment program named constants and named program parameters basically work now
Diffstat (limited to 'src/mesa/swrast/s_nvfragprog.c')
-rw-r--r--src/mesa/swrast/s_nvfragprog.c154
1 files changed, 85 insertions, 69 deletions
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 7d5180381a9..b34703b8579 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -1,4 +1,4 @@
-/* $Id: s_nvfragprog.c,v 1.12 2003/03/25 02:23:47 brianp Exp $ */
+/* $Id: s_nvfragprog.c,v 1.13 2003/04/05 00:38:10 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -99,9 +99,17 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
static void
fetch_vector4( const struct fp_src_register *source,
const struct fp_machine *machine,
+ const struct fragment_program *program,
GLfloat result[4] )
{
- const GLfloat *src = machine->Registers[source->Register];
+ const GLfloat *src;
+
+ if (source->IsParameter) {
+ src = program->Parameters[source->Register].Values;
+ }
+ else {
+ src = machine->Registers[source->Register];
+ }
result[0] = src[source->Swizzle[0]];
result[1] = src[source->Swizzle[1]];
@@ -260,9 +268,17 @@ fetch_vector4_deriv( const struct fp_src_register *source,
static void
fetch_vector1( const struct fp_src_register *source,
const struct fp_machine *machine,
+ const struct fragment_program *program,
GLfloat result[4] )
{
- const GLfloat *src = machine->Registers[source->Register];
+ const GLfloat *src;
+
+ if (source->IsParameter) {
+ src = program->Parameters[source->Register].Values;
+ }
+ else {
+ src = machine->Registers[source->Register];
+ }
result[0] = src[source->Swizzle[0]];
@@ -495,8 +511,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_ADD:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = a[0] + b[0];
result[1] = a[1] + b[1];
result[2] = a[2] + b[2];
@@ -507,7 +523,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_COS:
{
GLfloat a[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = result[1] = result[2] = result[3] = _mesa_cos(a[0]);
store_vector4( inst, machine, result );
}
@@ -527,7 +543,7 @@ execute_program( GLcontext *ctx,
init_machine_deriv(ctx, machine, program, span,
'X', &dMachine);
execute_program(ctx, program, pc, &dMachine, span);
- fetch_vector4( &inst->SrcReg[0], &dMachine, aNext );
+ fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
result[0] = aNext[0] - a[0];
result[1] = aNext[1] - a[1];
result[2] = aNext[2] - a[2];
@@ -544,7 +560,7 @@ execute_program( GLcontext *ctx,
init_machine_deriv(ctx, machine, program, span,
'Y', &dMachine);
execute_program(ctx, program, pc, &dMachine, span);
- fetch_vector4( &inst->SrcReg[0], &dMachine, aNext );
+ fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
result[0] = aNext[0] - a[0];
result[1] = aNext[1] - a[1];
result[2] = aNext[2] - a[2];
@@ -556,8 +572,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_DP3:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = result[1] = result[2] = result[3] =
a[0] + b[0] + a[1] * b[1] + a[2] * b[2];
store_vector4( inst, machine, result );
@@ -566,8 +582,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_DP4:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = result[1] = result[2] = result[3] =
a[0] + b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
store_vector4( inst, machine, result );
@@ -576,8 +592,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_DST: /* Distance vector */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = 1.0F;
result[1] = a[1] * b[1];
result[2] = a[2];
@@ -588,7 +604,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_EX2: /* Exponential base 2 */
{
GLfloat a[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = result[1] = result[2] = result[3] =
(GLfloat) _mesa_pow(2.0, a[0]);
store_vector4( inst, machine, result );
@@ -597,7 +613,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_FLR:
{
GLfloat a[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
result[0] = FLOORF(a[0]);
result[1] = FLOORF(a[1]);
result[2] = FLOORF(a[2]);
@@ -608,7 +624,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_FRC:
{
GLfloat a[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
result[0] = a[0] - FLOORF(a[0]);
result[1] = a[1] - FLOORF(a[1]);
result[2] = a[2] - FLOORF(a[2]);
@@ -630,7 +646,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_LG2: /* log base 2 */
{
GLfloat a[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = result[1] = result[2] = result[3]
= LOG2(a[0]);
store_vector4( inst, machine, result );
@@ -639,7 +655,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_LIT:
{
GLfloat a[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
if (a[0] < 0.0F)
a[0] = 0.0F;
if (a[1] < 0.0F)
@@ -654,9 +670,9 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_LRP:
{
GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
- fetch_vector4( &inst->SrcReg[2], machine, c );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
+ fetch_vector4( &inst->SrcReg[2], machine, program, c );
result[0] = a[0] * b[0] + (1.0F - a[0]) * c[0];
result[1] = a[1] * b[1] + (1.0F - a[1]) * c[1];
result[2] = a[2] * b[2] + (1.0F - a[2]) * c[2];
@@ -667,9 +683,9 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_MAD:
{
GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
- fetch_vector4( &inst->SrcReg[2], machine, c );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
+ fetch_vector4( &inst->SrcReg[2], machine, program, c );
result[0] = a[0] * b[0] + c[0];
result[1] = a[1] * b[1] + c[1];
result[2] = a[2] * b[2] + c[2];
@@ -680,8 +696,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_MAX:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = MAX2(a[0], b[0]);
result[1] = MAX2(a[1], b[1]);
result[2] = MAX2(a[2], b[2]);
@@ -692,8 +708,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_MIN:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = MIN2(a[0], b[0]);
result[1] = MIN2(a[1], b[1]);
result[2] = MIN2(a[2], b[2]);
@@ -704,15 +720,15 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_MOV:
{
GLfloat result[4];
- fetch_vector4( &inst->SrcReg[0], machine, result );
+ fetch_vector4( &inst->SrcReg[0], machine, program, result );
store_vector4( inst, machine, result );
}
break;
case FP_OPCODE_MUL:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = a[0] * b[0];
result[1] = a[1] * b[1];
result[2] = a[2] * b[2];
@@ -726,7 +742,7 @@ execute_program( GLcontext *ctx,
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
GLuint *rawResult = (GLuint *) result;
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
rawResult[0] = rawResult[1] = rawResult[2] = rawResult[3]
= rawBits[0] | (rawBits[1] << 16);
store_vector4( inst, machine, result );
@@ -736,7 +752,7 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
GLuint usx, usy, *rawResult = (GLuint *) result;
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
a[0] = CLAMP(a[0], 0.0F, 1.0F);
a[1] = CLAMP(a[0], 0.0F, 1.0F);
usx = IROUND(a[0] * 65535.0F);
@@ -750,7 +766,7 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result;
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F);
a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F);
a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F);
@@ -768,7 +784,7 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
GLuint ubx, uby, ubz, ubw, *rawResult = (GLuint *) result;
- fetch_vector4( &inst->SrcReg[0], machine, a );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
a[0] = CLAMP(a[0], 0.0F, 1.0F);
a[1] = CLAMP(a[1], 0.0F, 1.0F);
a[2] = CLAMP(a[2], 0.0F, 1.0F);
@@ -785,8 +801,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_POW:
{
GLfloat a[4], b[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
- fetch_vector1( &inst->SrcReg[1], machine, b );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
+ fetch_vector1( &inst->SrcReg[1], machine, program, b );
result[0] = result[1] = result[2] = result[3]
= _mesa_pow(a[0], b[0]);
store_vector4( inst, machine, result );
@@ -795,7 +811,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_RCP:
{
GLfloat a[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = result[1] = result[2] = result[3]
= 1.0F / a[0];
store_vector4( inst, machine, result );
@@ -804,8 +820,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_RFL:
{
GLfloat axis[4], dir[4], result[4], tmp[4];
- fetch_vector4( &inst->SrcReg[0], machine, axis );
- fetch_vector4( &inst->SrcReg[1], machine, dir );
+ fetch_vector4( &inst->SrcReg[0], machine, program, axis );
+ fetch_vector4( &inst->SrcReg[1], machine, program, dir );
tmp[3] = axis[0] * axis[0]
+ axis[1] * axis[1]
+ axis[2] * axis[2];
@@ -822,7 +838,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_RSQ: /* 1 / sqrt() */
{
GLfloat a[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
store_vector4( inst, machine, result );
}
@@ -830,8 +846,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SEQ: /* set on equal */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = (a[0] == b[0]) ? 1.0F : 0.0F;
result[1] = (a[1] == b[1]) ? 1.0F : 0.0F;
result[2] = (a[2] == b[2]) ? 1.0F : 0.0F;
@@ -848,8 +864,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SGE: /* set on greater or equal */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = (a[0] >= b[0]) ? 1.0F : 0.0F;
result[1] = (a[1] >= b[1]) ? 1.0F : 0.0F;
result[2] = (a[2] >= b[2]) ? 1.0F : 0.0F;
@@ -860,8 +876,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SGT: /* set on greater */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = (a[0] > b[0]) ? 1.0F : 0.0F;
result[1] = (a[1] > b[1]) ? 1.0F : 0.0F;
result[2] = (a[2] > b[2]) ? 1.0F : 0.0F;
@@ -872,7 +888,7 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SIN:
{
GLfloat a[4], result[4];
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = result[1] = result[2] = result[3] = _mesa_sin(a[0]);
store_vector4( inst, machine, result );
}
@@ -880,8 +896,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SLE: /* set on less or equal */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = (a[0] <= b[0]) ? 1.0F : 0.0F;
result[1] = (a[1] <= b[1]) ? 1.0F : 0.0F;
result[2] = (a[2] <= b[2]) ? 1.0F : 0.0F;
@@ -892,8 +908,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SLT: /* set on less */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = (a[0] < b[0]) ? 1.0F : 0.0F;
result[1] = (a[1] < b[1]) ? 1.0F : 0.0F;
result[2] = (a[2] < b[2]) ? 1.0F : 0.0F;
@@ -904,8 +920,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SNE: /* set on not equal */
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = (a[0] != b[0]) ? 1.0F : 0.0F;
result[1] = (a[1] != b[1]) ? 1.0F : 0.0F;
result[2] = (a[2] != b[2]) ? 1.0F : 0.0F;
@@ -922,8 +938,8 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_SUB:
{
GLfloat a[4], b[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
result[0] = a[0] - b[0];
result[1] = a[1] - b[1];
result[2] = a[2] - b[2];
@@ -935,7 +951,7 @@ execute_program( GLcontext *ctx,
/* Texel lookup */
{
GLfloat texcoord[4], color[4];
- fetch_vector4( &inst->SrcReg[0], machine, texcoord );
+ fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
/* XXX: Undo perspective divide from interpolate_texcoords() */
fetch_texel( ctx, texcoord, inst->TexSrcUnit, color );
store_vector4( inst, machine, color );
@@ -945,9 +961,9 @@ execute_program( GLcontext *ctx,
/* Texture lookup w/ partial derivatives for LOD */
{
GLfloat texcoord[4], dtdx[4], dtdy[4], color[4];
- fetch_vector4( &inst->SrcReg[0], machine, texcoord );
- fetch_vector4( &inst->SrcReg[1], machine, dtdx );
- fetch_vector4( &inst->SrcReg[2], machine, dtdy );
+ fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
+ fetch_vector4( &inst->SrcReg[1], machine, program, dtdx );
+ fetch_vector4( &inst->SrcReg[2], machine, program, dtdy );
fetch_texel_deriv( ctx, texcoord, dtdx, dtdy, inst->TexSrcUnit,
color );
store_vector4( inst, machine, color );
@@ -957,7 +973,7 @@ execute_program( GLcontext *ctx,
/* Texture lookup w/ perspective divide */
{
GLfloat texcoord[4], color[4];
- fetch_vector4( &inst->SrcReg[0], machine, texcoord );
+ fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
/* Already did perspective divide in interpolate_texcoords() */
fetch_texel( ctx, texcoord, inst->TexSrcUnit, color );
store_vector4( inst, machine, color );
@@ -969,7 +985,7 @@ execute_program( GLcontext *ctx,
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
GLuint *rawResult = (GLuint *) result;
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
rawResult[0] = rawBits[0] & 0xffff;
rawResult[1] = (rawBits[0] >> 16) & 0xffff;
rawResult[2] = rawBits[0] & 0xffff;
@@ -981,7 +997,7 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = (GLfloat) ((rawBits[0] >> 0) & 0xffff) / 65535.0F;
result[1] = (GLfloat) ((rawBits[0] >> 16) & 0xffff) / 65535.0F;
result[2] = result[0];
@@ -993,7 +1009,7 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = (((rawBits[0] >> 0) & 0xff) - 128) / 127.0F;
result[0] = (((rawBits[0] >> 8) & 0xff) - 128) / 127.0F;
result[0] = (((rawBits[0] >> 16) & 0xff) - 128) / 127.0F;
@@ -1005,7 +1021,7 @@ execute_program( GLcontext *ctx,
{
GLfloat a[4], result[4];
const GLuint *rawBits = (const GLuint *) a;
- fetch_vector1( &inst->SrcReg[0], machine, a );
+ fetch_vector1( &inst->SrcReg[0], machine, program, a );
result[0] = ((rawBits[0] >> 0) & 0xff) / 255.0F;
result[0] = ((rawBits[0] >> 8) & 0xff) / 255.0F;
result[0] = ((rawBits[0] >> 16) & 0xff) / 255.0F;
@@ -1016,9 +1032,9 @@ execute_program( GLcontext *ctx,
case FP_OPCODE_X2D: /* 2-D matrix transform */
{
GLfloat a[4], b[4], c[4], result[4];
- fetch_vector4( &inst->SrcReg[0], machine, a );
- fetch_vector4( &inst->SrcReg[1], machine, b );
- fetch_vector4( &inst->SrcReg[2], machine, c );
+ fetch_vector4( &inst->SrcReg[0], machine, program, a );
+ fetch_vector4( &inst->SrcReg[1], machine, program, b );
+ fetch_vector4( &inst->SrcReg[2], machine, program, c );
result[0] = a[0] + b[0] * c[0] + b[1] * c[1];
result[1] = a[1] + b[0] * c[2] + b[1] * c[3];
result[2] = a[2] + b[0] * c[0] + b[1] * c[1];