const struct fp_machine *machine,
const struct gl_fragment_program *program )
{
+ /* XXX relative addressing... */
switch (source->File) {
case PROGRAM_TEMPORARY:
ASSERT(source->Index < MAX_PROGRAM_TEMPS);
}
/* Add derivatives */
- if (program->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) {
+ if (program->Base.InputsRead & FRAG_BIT_WPOS) {
GLfloat *wpos = (GLfloat*) machine->Inputs[FRAG_ATTRIB_WPOS];
if (xOrY == 'X') {
wpos[0] += 1.0F;
wpos[3] += span->dwdy;
}
}
- if (program->Base.InputsRead & (1 << FRAG_ATTRIB_COL0)) {
+ if (program->Base.InputsRead & FRAG_BIT_COL0) {
GLfloat *col0 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL0];
if (xOrY == 'X') {
col0[0] += span->drdx * (1.0F / CHAN_MAXF);
col0[3] += span->dady * (1.0F / CHAN_MAXF);
}
}
- if (program->Base.InputsRead & (1 << FRAG_ATTRIB_COL1)) {
+ if (program->Base.InputsRead & FRAG_BIT_COL1) {
GLfloat *col1 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL1];
if (xOrY == 'X') {
col1[0] += span->dsrdx * (1.0F / CHAN_MAXF);
col1[3] += 0.0; /*XXX fix */
}
}
- if (program->Base.InputsRead & (1 << FRAG_ATTRIB_FOGC)) {
+ if (program->Base.InputsRead & FRAG_BIT_FOGC) {
GLfloat *fogc = (GLfloat*) machine->Inputs[FRAG_ATTRIB_FOGC];
if (xOrY == 'X') {
fogc[0] += span->dfogdx;
}
}
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- if (program->Base.InputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) {
+ if (program->Base.InputsRead & FRAG_BIT_TEX(u)) {
GLfloat *tex = (GLfloat*) machine->Inputs[FRAG_ATTRIB_TEX0 + u];
/* XXX perspective-correct interpolation */
if (xOrY == 'X') {
}
for (v = 0; v < ctx->Const.MaxVarying; v++) {
- if (program->Base.InputsRead & (1 << (FRAG_ATTRIB_VAR0 + v))) {
+ if (program->Base.InputsRead & FRAG_BIT_VAR(v)) {
GLfloat *var = (GLfloat*) machine->Inputs[FRAG_ATTRIB_VAR0 + v];
- /* XXXX finish this */
- var[0] += span->varStepX[v][0];
- var[1] += span->varStepX[v][1];
- var[2] += span->varStepX[v][2];
- var[3] += span->varStepX[v][3];
+ if (xOrY == 'X') {
+ var[0] += span->varStepX[v][0];
+ var[1] += span->varStepX[v][1];
+ var[2] += span->varStepX[v][2];
+ var[3] += span->varStepX[v][3];
+ }
+ else {
+ var[0] += span->varStepY[v][0];
+ var[1] += span->varStepY[v][1];
+ var[2] += span->varStepY[v][2];
+ var[3] += span->varStepY[v][3];
+ }
}
}
}
/* Load input registers */
- if (inputsRead & (1 << FRAG_ATTRIB_WPOS)) {
+ if (inputsRead & FRAG_BIT_WPOS) {
GLfloat *wpos = machine->Inputs[FRAG_ATTRIB_WPOS];
ASSERT(span->arrayMask & SPAN_Z);
if (span->arrayMask & SPAN_XY) {
wpos[2] = (GLfloat) span->array->z[col] / ctx->DrawBuffer->_DepthMaxF;
wpos[3] = span->w + col * span->dwdx;
}
- if (inputsRead & (1 << FRAG_ATTRIB_COL0)) {
+ if (inputsRead & FRAG_BIT_COL0) {
ASSERT(span->arrayMask & SPAN_RGBA);
COPY_4V(machine->Inputs[FRAG_ATTRIB_COL0],
span->array->color.sz4.rgba[col]);
}
- if (inputsRead & (1 << FRAG_ATTRIB_COL1)) {
+ if (inputsRead & FRAG_BIT_COL1) {
ASSERT(span->arrayMask & SPAN_SPEC);
COPY_4V(machine->Inputs[FRAG_ATTRIB_COL1],
span->array->color.sz4.spec[col]);
}
- if (inputsRead & (1 << FRAG_ATTRIB_FOGC)) {
+ if (inputsRead & FRAG_BIT_FOGC) {
GLfloat *fogc = machine->Inputs[FRAG_ATTRIB_FOGC];
ASSERT(span->arrayMask & SPAN_FOG);
fogc[0] = span->array->fog[col];
fogc[3] = 0.0F;
}
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- if (inputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) {
+ if (inputsRead & FRAG_BIT_TEX(u)) {
GLfloat *tex = machine->Inputs[FRAG_ATTRIB_TEX0 + u];
/*ASSERT(ctx->Texture._EnabledCoordUnits & (1 << u));*/
COPY_4V(tex, span->array->texcoords[u][col]);
}
}
for (v = 0; v < ctx->Const.MaxVarying; v++) {
- if (inputsRead & (1 << (FRAG_ATTRIB_VAR0 + v))) {
+ if (inputsRead & FRAG_BIT_VAR(v)) {
#if 0
printf("Frag Var %d at y=%d: %f %f %f\n", v, col,
- span->array->varying[col][v][0],
- span->array->varying[col][v][1],
- span->array->varying[col][v][2]);
+ span->array->varying[v][col][0],
+ span->array->varying[v][col][1],
+ span->array->varying[v][col][2]);
#endif
COPY_4V(machine->Inputs[FRAG_ATTRIB_VAR0 + v],
- span->array->varying[col][v]);
+ span->array->varying[v][col]);
}
}