-/* $Id: s_nvfragprog.c,v 1.15 2003/04/11 01:20:15 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
}
}
}
+
+ /* init condition codes */
+ dMachine->CondCodes[0] = COND_EQ;
+ dMachine->CondCodes[1] = COND_EQ;
+ dMachine->CondCodes[2] = COND_EQ;
+ dMachine->CondCodes[3] = COND_EQ;
}
for (pc = 0; pc < maxInst; pc++) {
const struct fp_instruction *inst = program->Instructions + pc;
+
+ if (ctx->FragmentProgram.CallbackEnabled &&
+ ctx->FragmentProgram.Callback) {
+ ctx->FragmentProgram.CurrentPosition = inst->StringPos;
+ ctx->FragmentProgram.Callback(program->Base.Target,
+ ctx->FragmentProgram.CallbackData);
+ }
+
switch (inst->Opcode) {
case FP_OPCODE_ADD:
{
* Finally, find the difference in the register values for
* the original and derivative runs.
*/
+ fetch_vector4( &inst->SrcReg[0], machine, program, a);
init_machine_deriv(ctx, machine, program, span,
'X', &dMachine);
execute_program(ctx, program, pc, &dMachine, span, column);
if (!fetch_vector4_deriv(&inst->SrcReg[0], span, 'Y', result)) {
init_machine_deriv(ctx, machine, program, span,
'Y', &dMachine);
+ fetch_vector4( &inst->SrcReg[0], machine, program, a);
execute_program(ctx, program, pc, &dMachine, span, column);
fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
result[0] = aNext[0] - a[0];
if (test_cc(machine->CondCodes[swizzle[0]], condMask) ||
test_cc(machine->CondCodes[swizzle[1]], condMask) ||
test_cc(machine->CondCodes[swizzle[2]], condMask) ||
- test_cc(machine->CondCodes[swizzle[3]], condMask))
+ test_cc(machine->CondCodes[swizzle[3]], condMask)) {
return GL_FALSE;
+ }
}
break;
case FP_OPCODE_LG2: /* log base 2 */
const struct fragment_program *program,
const struct sw_span *span, GLuint col )
{
+ GLuint inputsRead = program->InputsRead;
GLuint j, u;
+ if (ctx->FragmentProgram.CallbackEnabled)
+ inputsRead = ~0;
+
/* Clear temporary registers */
_mesa_bzero(machine->Registers + FP_TEMP_REG_START,
MAX_NV_FRAGMENT_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
}
/* Load input registers */
- if (program->InputsRead & (1 << FRAG_ATTRIB_WPOS)) {
+ if (inputsRead & (1 << FRAG_ATTRIB_WPOS)) {
GLfloat *wpos = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_WPOS];
wpos[0] = span->x + col;
wpos[1] = span->y;
wpos[2] = (GLfloat) span->array->z[col] / ctx->DepthMaxF;
wpos[3] = span->w + col * span->dwdx;
}
- if (program->InputsRead & (1 << FRAG_ATTRIB_COL0)) {
+ if (inputsRead & (1 << FRAG_ATTRIB_COL0)) {
GLfloat *col0 = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_COL0];
col0[0] = CHAN_TO_FLOAT(span->array->rgba[col][RCOMP]);
col0[1] = CHAN_TO_FLOAT(span->array->rgba[col][GCOMP]);
col0[2] = CHAN_TO_FLOAT(span->array->rgba[col][BCOMP]);
col0[3] = CHAN_TO_FLOAT(span->array->rgba[col][ACOMP]);
}
- if (program->InputsRead & (1 << FRAG_ATTRIB_COL1)) {
+ if (inputsRead & (1 << FRAG_ATTRIB_COL1)) {
GLfloat *col1 = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_COL1];
col1[0] = CHAN_TO_FLOAT(span->array->spec[col][RCOMP]);
col1[1] = CHAN_TO_FLOAT(span->array->spec[col][GCOMP]);
col1[2] = CHAN_TO_FLOAT(span->array->spec[col][BCOMP]);
col1[3] = CHAN_TO_FLOAT(span->array->spec[col][ACOMP]);
}
- if (program->InputsRead & (1 << FRAG_ATTRIB_FOGC)) {
+ if (inputsRead & (1 << FRAG_ATTRIB_FOGC)) {
GLfloat *fogc = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_FOGC];
fogc[0] = span->array->fog[col];
fogc[1] = 0.0F;
fogc[3] = 0.0F;
}
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- if (program->InputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) {
+ if (inputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) {
GLfloat *tex = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_TEX0+u];
- ASSERT(ctx->Texture._EnabledCoordUnits & (1 << u));
+ /*ASSERT(ctx->Texture._EnabledCoordUnits & (1 << u));*/
COPY_4V(tex, span->array->texcoords[u][col]);
- ASSERT(tex[0] != 0 || tex[1] != 0 || tex[2] != 0);
+ /*ASSERT(tex[0] != 0 || tex[1] != 0 || tex[2] != 0);*/
}
}
+
+ /* init condition codes */
+ machine->CondCodes[0] = COND_EQ;
+ machine->CondCodes[1] = COND_EQ;
+ machine->CondCodes[2] = COND_EQ;
+ machine->CondCodes[3] = COND_EQ;
}
const struct fragment_program *program = ctx->FragmentProgram.Current;
GLuint i;
+ ctx->_CurrentProgram = GL_FRAGMENT_PROGRAM_ARB; /* or NV, doesn't matter */
+
for (i = 0; i < span->end; i++) {
if (span->array->mask[i]) {
init_machine(ctx, &ctx->FragmentProgram.Machine,
ctx->FragmentProgram.Current, span, i);
if (!execute_program(ctx, program, ~0,
- &ctx->FragmentProgram.Machine, span, i))
+ &ctx->FragmentProgram.Machine, span, i)) {
span->array->mask[i] = GL_FALSE; /* killed fragment */
+ }
/* Store output registers */
{
UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]);
}
/* depth value */
- if (ctx->FragmentProgram.Current->OutputsWritten & 2)
+ if (program->OutputsWritten & (1 << FRAG_OUTPUT_DEPR))
span->array->z[i] = IROUND(ctx->FragmentProgram.Machine.Registers[FP_OUTPUT_REG_START + 2][0] * ctx->DepthMaxF);
}
}
+
+ ctx->_CurrentProgram = 0;
}