summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-02-01 09:51:48 -0700
committerBrian <brian@yutani.localnet.net>2007-02-01 09:51:48 -0700
commitf3e507ef9f75dbfc58ccd07b5fe8cfca10d9a9e3 (patch)
tree52aaa2c8e7f9688752f2010254cd04aa5b117743 /src/mesa/swrast
parent81ef03be65f1458d627528a13cb86feb992d758f (diff)
New SWspanarrays attribs[] array.
Replace texcoord[], varying[], etc. arrays with single attribs[] array, indexed by FRAG_ATTRIB_* values. Eliminates need to copy data into fragment program machine input registers. Will lead to future clean-ups.
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_aalinetemp.h14
-rw-r--r--src/mesa/swrast/s_aatritemp.h39
-rw-r--r--src/mesa/swrast/s_alpha.c2
-rw-r--r--src/mesa/swrast/s_atifragshader.c11
-rw-r--r--src/mesa/swrast/s_copypix.c2
-rw-r--r--src/mesa/swrast/s_drawpix.c2
-rw-r--r--src/mesa/swrast/s_fog.c18
-rw-r--r--src/mesa/swrast/s_fragprog.c84
-rw-r--r--src/mesa/swrast/s_logic.c2
-rw-r--r--src/mesa/swrast/s_masking.c2
-rw-r--r--src/mesa/swrast/s_pointtemp.h14
-rw-r--r--src/mesa/swrast/s_readpix.c2
-rw-r--r--src/mesa/swrast/s_span.c65
-rw-r--r--src/mesa/swrast/s_span.h38
-rw-r--r--src/mesa/swrast/s_texcombine.c6
-rw-r--r--src/mesa/swrast/s_zoom.c10
16 files changed, 140 insertions, 171 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index 68291afeea..b977ab8325 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -61,7 +61,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
line->span.array->z[i] = (GLuint) solve_plane(fx, fy, line->zPlane);
#endif
#ifdef DO_FOG
- line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane);
+ line->span.array->attribs[FRAG_ATTRIB_FOGC][i][0] = solve_plane(fx, fy, line->fPlane);
#endif
#ifdef DO_RGBA
line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
@@ -86,9 +86,9 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
else {
invQ = solve_plane_recip(fx, fy, line->vPlane[0]);
}
- line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
- line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
- line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
+ line->span.array->attribs[FRAG_ATTRIB_TEX0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
+ line->span.array->attribs[FRAG_ATTRIB_TEX0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
+ line->span.array->attribs[FRAG_ATTRIB_TEX0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0],
line->tPlane[0], invQ,
line->texWidth[0],
@@ -106,9 +106,9 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
else {
invQ = solve_plane_recip(fx, fy, line->vPlane[unit]);
}
- line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
- line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
- line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
+ line->span.array->attribs[FRAG_ATTRIB_TEX0 + unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
+ line->span.array->attribs[FRAG_ATTRIB_TEX0 + unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
+ line->span.array->attribs[FRAG_ATTRIB_TEX0 + unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit],
line->tPlane[unit], invQ,
line->texWidth[unit], line->texHeight[unit]);
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index b5470a0298..3359a919e5 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -289,7 +289,7 @@
array->z[count] = (GLuint) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- array->fog[count] = solve_plane(cx, cy, fogPlane);
+ array->attribs[FRAG_ATTRIB_FOGC][count][0] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
@@ -308,9 +308,9 @@
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
- array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
- array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
- array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + 0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + 0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + 0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
cx, cy, invQ,
texWidth, texHeight);
@@ -321,9 +321,9 @@
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
- array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
- array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
- array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
array->lambda[unit][count] = compute_lambda(sPlane[unit],
tPlane[unit], vPlane[unit], cx, cy, invQ,
texWidth[unit], texHeight[unit]);
@@ -393,7 +393,7 @@
array->z[ix] = (GLuint) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- array->fog[ix] = solve_plane(cx, cy, fogPlane);
+ array->attribs[FRAG_ATTRIB_FOGC][ix][0] = solve_plane(cx, cy, fogPlane);
#endif
#ifdef DO_RGBA
array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
@@ -412,9 +412,9 @@
#ifdef DO_TEX
{
const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
- array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
- array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
- array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
cx, cy, invQ, texWidth, texHeight);
}
@@ -424,9 +424,9 @@
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
- array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
- array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
- array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
array->lambda[unit][ix] = compute_lambda(sPlane[unit],
tPlane[unit],
vPlane[unit],
@@ -468,10 +468,11 @@
array->z[j] = array->z[j + left];
#endif
#ifdef DO_FOG
- array->fog[j] = array->fog[j + left];
+ array->attribs[FRAG_ATTRIB_FOGC][j][0]
+ = array->attribs[FRAG_ATTRIB_FOGC][j + left][0];
#endif
#ifdef DO_TEX
- COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]);
+ COPY_4V(array->attribs[FRAG_ATTRIB_TEX0 + 0][j], array->attribs[FRAG_ATTRIB_TEX0 + 0][j + left]);
#endif
#if defined(DO_MULTITEX) || defined(DO_TEX)
array->lambda[0][j] = array->lambda[0][j + left];
@@ -488,9 +489,9 @@
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
GLint j;
for (j = 0; j < (GLint) n; j++) {
- array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0];
- array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1];
- array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2];
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][j][0] = array->attribs[FRAG_ATTRIB_TEX0 + unit][j + left][0];
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][j][1] = array->attribs[FRAG_ATTRIB_TEX0 + unit][j + left][1];
+ array->attribs[FRAG_ATTRIB_TEX0 + unit][j][2] = array->attribs[FRAG_ATTRIB_TEX0 + unit][j + left][2];
array->lambda[unit][j] = array->lambda[unit][j + left];
}
}
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index 87a016512c..af8a6baddc 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -123,7 +123,7 @@ _swrast_alpha_test(const GLcontext *ctx, SWspan *span)
ALPHA_TEST(rgba[i][ACOMP], ;);
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
const GLfloat ref = ctx->Color.AlphaRef;
ALPHA_TEST(rgba[i][ACOMP], ;);
}
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 75df50b0ba..1ac6528a91 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -268,7 +268,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
pass_tex -= GL_TEXTURE0_ARB;
COPY_4V(machine->Registers[idx],
- span->array->texcoords[pass_tex][column]);
+ span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]);
}
else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
pass_tex -= GL_REG_0_ATI;
@@ -290,7 +290,8 @@ handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
coord_source -= GL_TEXTURE0_ARB;
- COPY_4V(tex_coords, span->array->texcoords[coord_source][column]);
+ COPY_4V(tex_coords,
+ span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]);
}
else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
coord_source -= GL_REG_0_ATI;
@@ -572,8 +573,8 @@ init_machine(GLcontext * ctx, struct atifs_machine *machine,
machine->Registers[i][j] = 0.0;
}
- COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->color.sz4.rgba[col]);
- COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->color.sz4.spec[col]);
+ COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]);
+ COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]);
}
@@ -604,7 +605,7 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
const GLfloat *colOut = machine.Registers[0];
/*fprintf(stderr,"outputs %f %f %f %f\n",
colOut[0], colOut[1], colOut[2], colOut[3]); */
- COPY_4V(span->array->color.sz4.rgba[i], colOut);
+ COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut);
}
}
}
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 761ab724e9..a9bc6433de 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -263,7 +263,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
ASSERT(width < MAX_WIDTH);
for (row = 0; row < height; row++, sy += stepy, dy += stepy) {
- GLvoid *rgba = span.array->color.sz4.rgba;
+ GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0];
/* Get row/span of source pixels */
if (overlapping) {
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index bdb2558351..dd2b57c7d3 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -635,7 +635,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
= _mesa_image_row_stride(unpack, width, format, type);
GLint skipPixels = 0;
/* use span array for temp color storage */
- GLfloat *rgba = (GLfloat *) span.array->color.sz4.rgba;
+ GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0];
/* if the span is wider than MAX_WIDTH we have to do it in chunks */
while (skipPixels < width) {
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index f4c3fe4f2d..93d2ab469f 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -154,7 +154,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
FOG_LOOP(GLushort, COMPUTE_F);
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, COMPUTE_F);
}
@@ -172,7 +172,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
FOG_LOOP(GLushort, COMPUTE_F);
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, COMPUTE_F);
}
@@ -194,7 +194,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
FOG_LOOP(GLushort, COMPUTE_F);
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, COMPUTE_F);
}
@@ -214,7 +214,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
GLubyte (*rgba)[4] = span->array->color.sz1.rgba;
for (i = 0; i < span->end; i++) {
- const GLfloat f = span->array->fog[i];
+ const GLfloat f = span->array->attribs[FRAG_ATTRIB_FOGC][i][0];
const GLfloat oneMinusF = 1.0F - f;
rgba[i][RCOMP] = (GLubyte) (f * rgba[i][RCOMP] + oneMinusF * rFog);
rgba[i][GCOMP] = (GLubyte) (f * rgba[i][GCOMP] + oneMinusF * gFog);
@@ -224,7 +224,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
GLushort (*rgba)[4] = span->array->color.sz2.rgba;
for (i = 0; i < span->end; i++) {
- const GLfloat f = span->array->fog[i];
+ const GLfloat f = span->array->attribs[FRAG_ATTRIB_FOGC][i][0];
const GLfloat oneMinusF = 1.0F - f;
rgba[i][RCOMP] = (GLushort) (f * rgba[i][RCOMP] + oneMinusF * rFog);
rgba[i][GCOMP] = (GLushort) (f * rgba[i][GCOMP] + oneMinusF * gFog);
@@ -232,10 +232,10 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
}
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
for (i = 0; i < span->end; i++) {
- const GLfloat f = span->array->fog[i];
+ const GLfloat f = span->array->attribs[FRAG_ATTRIB_FOGC][i][0];
const GLfloat oneMinusF = 1.0F - f;
rgba[i][RCOMP] = f * rgba[i][RCOMP] + oneMinusF * rFog;
rgba[i][GCOMP] = f * rgba[i][GCOMP] + oneMinusF * gFog;
@@ -258,7 +258,7 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
FOG_LOOP(GLushort, COMPUTE_F);
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
ASSERT(span->array->ChanType == GL_FLOAT);
FOG_LOOP(GLfloat, COMPUTE_F);
}
@@ -360,7 +360,7 @@ _swrast_fog_ci_span( const GLcontext *ctx, SWspan *span )
*/
GLuint i;
for (i = 0; i < span->end; i++) {
- const GLfloat f = span->array->fog[i];
+ const GLfloat f = span->array->attribs[FRAG_ATTRIB_FOGC][i][0];
index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * fogIndex);
}
}
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 12afb5ea0e..9ae423dde9 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -47,8 +47,11 @@
*/
struct fp_machine
{
+ /** Fragment Input attributes */
+ GLfloat (*Attribs)[MAX_WIDTH][4];
+ GLuint CurFrag; /**< Index into Attribs arrays */
+
GLfloat Temporaries[MAX_PROGRAM_TEMPS][4];
- GLfloat Inputs[FRAG_ATTRIB_MAX][4];
GLfloat Outputs[FRAG_RESULT_MAX][4];
GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */
@@ -72,7 +75,7 @@ _swrast_get_program_register(GLcontext *ctx, enum register_file file,
if (CurrentMachine) {
switch (file) {
case PROGRAM_INPUT:
- COPY_4V(val, CurrentMachine->Inputs[index]);
+ COPY_4V(val, CurrentMachine->Attribs[index][CurrentMachine->CurFrag]);
break;
case PROGRAM_OUTPUT:
COPY_4V(val, CurrentMachine->Outputs[index]);
@@ -160,7 +163,7 @@ get_register_pointer( GLcontext *ctx,
return machine->Temporaries[source->Index];
case PROGRAM_INPUT:
ASSERT(source->Index < FRAG_ATTRIB_MAX);
- return machine->Inputs[source->Index];
+ return machine->Attribs[source->Index][machine->CurFrag];
case PROGRAM_OUTPUT:
/* This is only for PRINT */
ASSERT(source->Index < FRAG_RESULT_MAX);
@@ -554,7 +557,7 @@ init_machine_deriv( GLcontext *ctx,
/* Add derivatives */
if (program->Base.InputsRead & FRAG_BIT_WPOS) {
- GLfloat *wpos = (GLfloat*) machine->Inputs[FRAG_ATTRIB_WPOS];
+ GLfloat *wpos = machine->Attribs[FRAG_ATTRIB_WPOS][machine->CurFrag];
if (xOrY == 'X') {
wpos[0] += 1.0F;
wpos[1] += 0.0F;
@@ -569,7 +572,7 @@ init_machine_deriv( GLcontext *ctx,
}
}
if (program->Base.InputsRead & FRAG_BIT_COL0) {
- GLfloat *col0 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL0];
+ GLfloat *col0 = machine->Attribs[FRAG_ATTRIB_COL0][machine->CurFrag];
if (xOrY == 'X') {
col0[0] += span->drdx * (1.0F / CHAN_MAXF);
col0[1] += span->dgdx * (1.0F / CHAN_MAXF);
@@ -584,7 +587,7 @@ init_machine_deriv( GLcontext *ctx,
}
}
if (program->Base.InputsRead & FRAG_BIT_COL1) {
- GLfloat *col1 = (GLfloat*) machine->Inputs[FRAG_ATTRIB_COL1];
+ GLfloat *col1 = machine->Attribs[FRAG_ATTRIB_COL1][machine->CurFrag];
if (xOrY == 'X') {
col1[0] += span->dsrdx * (1.0F / CHAN_MAXF);
col1[1] += span->dsgdx * (1.0F / CHAN_MAXF);
@@ -599,7 +602,7 @@ init_machine_deriv( GLcontext *ctx,
}
}
if (program->Base.InputsRead & FRAG_BIT_FOGC) {
- GLfloat *fogc = (GLfloat*) machine->Inputs[FRAG_ATTRIB_FOGC];
+ GLfloat *fogc = machine->Attribs[FRAG_ATTRIB_FOGC][machine->CurFrag];
if (xOrY == 'X') {
fogc[0] += span->dfogdx;
}
@@ -609,7 +612,7 @@ init_machine_deriv( GLcontext *ctx,
}
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
if (program->Base.InputsRead & FRAG_BIT_TEX(u)) {
- GLfloat *tex = (GLfloat*) machine->Inputs[FRAG_ATTRIB_TEX0 + u];
+ GLfloat *tex = machine->Attribs[FRAG_ATTRIB_TEX0 + u][machine->CurFrag];
/* XXX perspective-correct interpolation */
if (xOrY == 'X') {
tex[0] += span->texStepX[u][0];
@@ -628,7 +631,7 @@ init_machine_deriv( GLcontext *ctx,
for (v = 0; v < ctx->Const.MaxVarying; v++) {
if (program->Base.InputsRead & FRAG_BIT_VAR(v)) {
- GLfloat *var = (GLfloat*) machine->Inputs[FRAG_ATTRIB_VAR0 + v];
+ GLfloat *var = machine->Attribs[FRAG_ATTRIB_VAR0 + v][machine->CurFrag];
if (xOrY == 'X') {
var[0] += span->varStepX[v][0];
var[1] += span->varStepX[v][1];
@@ -1686,7 +1689,6 @@ init_machine( GLcontext *ctx, struct fp_machine *machine,
const SWspan *span, GLuint col )
{
GLuint inputsRead = program->Base.InputsRead;
- GLuint u, v;
if (ctx->FragmentProgram.CallbackEnabled)
inputsRead = ~0;
@@ -1697,63 +1699,9 @@ init_machine( GLcontext *ctx, struct fp_machine *machine,
MAX_NV_FRAGMENT_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
}
- /* Load input registers */
- if (inputsRead & FRAG_BIT_WPOS) {
- GLfloat *wpos = machine->Inputs[FRAG_ATTRIB_WPOS];
- ASSERT(span->arrayMask & SPAN_Z);
- if (span->arrayMask & SPAN_XY) {
- wpos[0] = (GLfloat) span->array->x[col];
- wpos[1] = (GLfloat) span->array->y[col];
- }
- else {
- wpos[0] = (GLfloat) span->x + col;
- wpos[1] = (GLfloat) span->y;
- }
- wpos[2] = (GLfloat) span->array->z[col] / ctx->DrawBuffer->_DepthMaxF;
- wpos[3] = span->w + col * span->dwdx;
- }
- 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 & FRAG_BIT_COL1) {
- ASSERT(span->arrayMask & SPAN_SPEC);
- COPY_4V(machine->Inputs[FRAG_ATTRIB_COL1],
- span->array->color.sz4.spec[col]);
- }
- if (inputsRead & FRAG_BIT_FOGC) {
- GLfloat *fogc = machine->Inputs[FRAG_ATTRIB_FOGC];
- ASSERT(span->arrayMask & SPAN_FOG);
- fogc[0] = span->array->fog[col];
- fogc[1] = 0.0F;
- fogc[2] = 0.0F;
- fogc[3] = 0.0F;
- }
- for (u = 0; u < ctx->Const.MaxTextureCoordUnits; 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]);
- /*ASSERT(tex[0] != 0 || tex[1] != 0 || tex[2] != 0);*/
-#if 0
- printf("Texcoord %d: %g %g %g %g\n", u,
- tex[0], tex[1], tex[2], tex[3]);
-#endif
- }
- }
- for (v = 0; v < ctx->Const.MaxVarying; 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[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[v][col]);
- }
- }
+ /* Setup pointer to input attributes */
+ machine->Attribs = span->array->attribs;
+ machine->CurFrag = col;
/* init condition codes */
machine->CondCodes[0] = COND_EQ;
@@ -1784,7 +1732,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
if (execute_program(ctx, program, ~0, &machine, span, i)) {
/* Store result color */
- COPY_4V(span->array->color.sz4.rgba[i],
+ COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
machine.Outputs[FRAG_RESULT_COLR]);
/* Store result depth/z */
diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c
index 719b17962d..e680732bee 100644
--- a/src/mesa/swrast/s_logic.c
+++ b/src/mesa/swrast/s_logic.c
@@ -240,7 +240,7 @@ _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
}
else {
logicop_uint4(ctx, 4 * span->end,
- (GLuint *) span->array->color.sz4.rgba,
+ (GLuint *) span->array->attribs[FRAG_ATTRIB_COL0],
(const GLuint *) rbPixels, span->array->mask);
}
}
diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c
index 65c984dd3e..8800f7d8e3 100644
--- a/src/mesa/swrast/s_masking.c
+++ b/src/mesa/swrast/s_masking.c
@@ -91,7 +91,7 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
const GLuint bMask = ctx->Color.ColorMask[BCOMP] ? ~0x0 : 0x0;
const GLuint aMask = ctx->Color.ColorMask[ACOMP] ? ~0x0 : 0x0;
const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels;
- GLuint (*src)[4] = (GLuint (*)[4]) span->array->color.sz4.rgba;
+ GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0];
GLuint i;
for (i = 0; i < n; i++) {
src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask);
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index b41776b017..f68630af93 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -280,7 +280,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & TEXTURE
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
- COPY_4V(span->array->texcoords[u][count], texcoord[u]);
+ COPY_4V(span->array->attribs[FRAG_ATTRIB_TEX0 + u][count], texcoord[u]);
span->array->lambda[u][count] = 0.0;
}
}
@@ -342,14 +342,14 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
r = vert->texcoord[u][0];
else /* GL_R */
r = vert->texcoord[u][2];
- span->array->texcoords[u][count][0] = s;
- span->array->texcoords[u][count][1] = t;
- span->array->texcoords[u][count][2] = r;
- span->array->texcoords[u][count][3] = 1.0F;
+ span->array->attribs[FRAG_ATTRIB_TEX0 + u][count][0] = s;
+ span->array->attribs[FRAG_ATTRIB_TEX0 + u][count][1] = t;
+ span->array->attribs[FRAG_ATTRIB_TEX0 + u][count][2] = r;
+ span->array->attribs[FRAG_ATTRIB_TEX0 + u][count][3] = 1.0F;
span->array->lambda[u][count] = 0.0; /* XXX fix? */
}
else {
- COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]);
+ COPY_4V(span->array->attribs[FRAG_ATTRIB_TEX0 + u][count], vert->texcoord[u]);
}
}
}
@@ -402,7 +402,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
#if FLAGS & TEXTURE
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
- COPY_4V(span->array->texcoords[u][count], texcoord[u]);
+ COPY_4V(span->array->attribs[FRAG_ATTRIB_TEX0 + u][count], texcoord[u]);
}
}
#endif
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 128ce0afb3..75134ab462 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -394,7 +394,7 @@ read_rgba_pixels( GLcontext *ctx,
/* no convolution */
const GLint dstStride
= _mesa_image_row_stride(packing, width, format, type);
- GLfloat (*rgba)[4] = swrast->SpanArrays->color.sz4.rgba;
+ GLfloat (*rgba)[4] = swrast->SpanArrays->attribs[FRAG_ATTRIB_COL0];
GLint row;
GLubyte *dst = _mesa_image_address2d(packing, pixels, width, height,
format, type, 0, 0);
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index d97c1672c2..5c552e6288 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -239,7 +239,7 @@ interpolate_colors(SWspan *span)
#endif
case GL_FLOAT:
{
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
GLfloat r, g, b, a, dr, dg, db, da;
r = span->red;
g = span->green;
@@ -351,7 +351,7 @@ interpolate_specular(SWspan *span)
#endif
case GL_FLOAT:
{
- GLfloat (*spec)[4] = span->array->color.sz4.spec;
+ GLfloat (*spec)[4] = span->array->attribs[FRAG_ATTRIB_COL1];
#if CHAN_BITS <= 16
GLfloat r = CHAN_TO_FLOAT(FixedToChan(span->specRed));
GLfloat g = CHAN_TO_FLOAT(FixedToChan(span->specGreen));
@@ -430,7 +430,7 @@ interpolate_indexes(GLcontext *ctx, SWspan *span)
static INLINE void
interpolate_fog(const GLcontext *ctx, SWspan *span)
{
- GLfloat *fog = span->array->fog;
+ GLfloat (*fog)[4] = span->array->attribs[FRAG_ATTRIB_FOGC];
const GLfloat fogStep = span->fogStep;
GLfloat fogCoord = span->fog;
const GLuint haveW = (span->interpMask & SPAN_W);
@@ -438,7 +438,7 @@ interpolate_fog(const GLcontext *ctx, SWspan *span)
GLfloat w = haveW ? span->w : 1.0F;
GLuint i;
for (i = 0; i < span->end; i++) {
- fog[i] = fogCoord / w;
+ fog[i][0] = fogCoord / w;
fogCoord += fogStep;
w += wStep;
}
@@ -565,7 +565,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span)
needLambda = GL_FALSE;
}
if (needLambda) {
- GLfloat (*texcoord)[4] = span->array->texcoords[u];
+ GLfloat (*texcoord)[4] = span->array->attribs[FRAG_ATTRIB_TEX0 + u];
GLfloat *lambda = span->array->lambda[u];
const GLfloat dsdx = span->texStepX[u][0];
const GLfloat dsdy = span->texStepY[u][0];
@@ -620,7 +620,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span)
span->arrayMask |= SPAN_LAMBDA;
}
else {
- GLfloat (*texcoord)[4] = span->array->texcoords[u];
+ GLfloat (*texcoord)[4] = span->array->attribs[FRAG_ATTRIB_TEX0 + u];
GLfloat *lambda = span->array->lambda[u];
const GLfloat dsdx = span->texStepX[u][0];
const GLfloat dtdx = span->texStepX[u][1];
@@ -701,7 +701,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span)
span->arrayMask |= SPAN_TEXTURE;
if (needLambda) {
/* just texture unit 0, with lambda */
- GLfloat (*texcoord)[4] = span->array->texcoords[0];
+ GLfloat (*texcoord)[4] = span->array->attribs[FRAG_ATTRIB_TEX0];
GLfloat *lambda = span->array->lambda[0];
const GLfloat dsdx = span->texStepX[0][0];
const GLfloat dsdy = span->texStepY[0][0];
@@ -757,7 +757,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span)
}
else {
/* just texture 0, without lambda */
- GLfloat (*texcoord)[4] = span->array->texcoords[0];
+ GLfloat (*texcoord)[4] = span->array->attribs[FRAG_ATTRIB_TEX0];
const GLfloat dsdx = span->texStepX[0][0];
const GLfloat dtdx = span->texStepX[0][1];
const GLfloat drdx = span->texStepX[0][2];
@@ -841,7 +841,7 @@ interpolate_varying(GLcontext *ctx, SWspan *span)
GLuint k;
for (k = 0; k < span->end; k++) {
GLfloat invW = 1.0f / w;
- span->array->varying[var][k][j] = v * invW;
+ span->array->attribs[FRAG_ATTRIB_VAR0 + var][k][j] = v * invW;
v += dvdx;
w += dwdx;
}
@@ -852,6 +852,33 @@ interpolate_varying(GLcontext *ctx, SWspan *span)
/**
+ * Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array.
+ */
+static INLINE void
+interpolate_wpos(GLcontext *ctx, SWspan *span)
+{
+ GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
+ GLuint i;
+ if (span->arrayMask & SPAN_XY) {
+ for (i = 0; i < span->end; i++) {
+ wpos[i][0] = (GLfloat) span->array->x[i];
+ wpos[i][1] = (GLfloat) span->array->y[i];
+ }
+ }
+ else {
+ for (i = 0; i < span->end; i++) {
+ wpos[i][0] = (GLfloat) span->x + i;
+ wpos[i][1] = (GLfloat) span->y;
+ }
+ }
+ for (i = 0; i < span->end; i++) {
+ wpos[i][2] = (GLfloat) span->array->z[i] / ctx->DrawBuffer->_DepthMaxF;
+ wpos[i][3] = span->w + i * span->dwdx;
+ }
+}
+
+
+/**
* Apply the current polygon stipple pattern to a span of pixels.
*/
static INLINE void
@@ -1238,8 +1265,8 @@ add_specular(GLcontext *ctx, SWspan *span)
break;
case GL_FLOAT:
{
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
- GLfloat (*spec)[4] = span->array->color.sz4.spec;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
+ GLfloat (*spec)[4] = span->array->attribs[FRAG_ATTRIB_COL1];
GLuint i;
for (i = 0; i < span->end; i++) {
rgba[i][RCOMP] += spec[i][RCOMP];
@@ -1280,7 +1307,7 @@ apply_aa_coverage(SWspan *span)
}
}
else {
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
for (i = 0; i < span->end; i++) {
rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i];
}
@@ -1294,7 +1321,7 @@ apply_aa_coverage(SWspan *span)
static INLINE void
clamp_colors(SWspan *span)
{
- GLfloat (*rgba)[4] = span->array->color.sz4.rgba;
+ GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
GLuint i;
ASSERT(span->array->ChanType == GL_FLOAT);
for (i = 0; i < span->end; i++) {
@@ -1320,7 +1347,7 @@ convert_color_type(SWspan *span, GLenum newType)
src = span->array->color.sz2.rgba;
}
else {
- src = span->array->color.sz4.rgba;
+ src = span->array->attribs[FRAG_ATTRIB_COL0];
}
if (newType == GL_UNSIGNED_BYTE) {
dst = span->array->color.sz1.rgba;
@@ -1329,7 +1356,7 @@ convert_color_type(SWspan *span, GLenum newType)
dst = span->array->color.sz2.rgba;
}
else {
- dst = span->array->color.sz4.rgba;
+ dst = span->array->attribs[FRAG_ATTRIB_COL0];
}
_mesa_convert_colors(span->array->ChanType, src,
@@ -1365,7 +1392,7 @@ shade_texture_span(GLcontext *ctx, SWspan *span)
? (GLvoid *) span->array->color.sz1.rgba
: (GLvoid *) span->array->color.sz2.rgba;
_mesa_convert_colors(oldType, src,
- newType, span->array->color.sz4.rgba,
+ newType, span->array->attribs[FRAG_ATTRIB_COL0],
span->end, span->array->mask);
span->array->ChanType = newType;
}
@@ -1383,6 +1410,10 @@ shade_texture_span(GLcontext *ctx, SWspan *span)
if (ctx->Shader.CurrentProgram && span->interpMask & SPAN_VARYING)
interpolate_varying(ctx, span);
+ if (ctx->FragmentProgram._Current &&
+ (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_WPOS))
+ interpolate_wpos(ctx, span);
+
/* Run fragment program/shader now */
if (ctx->FragmentProgram._Current) {
_swrast_exec_fragment_program(ctx, span);
@@ -1938,7 +1969,7 @@ _swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
rbPixels = span->array->color.sz2.spec;
}
else {
- rbPixels = span->array->color.sz4.spec;
+ rbPixels = span->array->attribs[FRAG_ATTRIB_COL1];
}
/* Get destination values from renderbuffer */
diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h
index 7c514afb0b..292679bda1 100644
--- a/src/mesa/swrast/s_span.h
+++ b/src/mesa/swrast/s_span.h
@@ -32,7 +32,7 @@
/**
- * \defgroup SpanFlags SPAN_*-flags
+ * \defgroup SpanFlags
* Bitflags used for interpMask and arrayMask fields below to indicate
* which interpolant values and fragment arrays are in use, respectively.
*/
@@ -60,12 +60,10 @@ struct arrays2 {
union {
GLubyte sz1[MAX_WIDTH][4]; /* primary color */
GLushort sz2[MAX_WIDTH][4];
- GLfloat sz4[MAX_WIDTH][4];
} rgba;
union {
GLubyte sz1[MAX_WIDTH][4]; /* specular color and temp storage */
GLushort sz2[MAX_WIDTH][4];
- GLfloat sz4[MAX_WIDTH][4];
} spec;
};
#endif
@@ -80,7 +78,14 @@ struct arrays2 {
* filled in by glDraw/CopyPixels, etc.
* These arrays are separated out of sw_span to conserve memory.
*/
-typedef struct sw_span_arrays {
+typedef struct sw_span_arrays
+{
+ /** Per-fragment attributes (indexed by FRAG_ATTRIB_* tokens) */
+ GLfloat attribs[FRAG_ATTRIB_MAX][MAX_WIDTH][4];
+
+ /** This mask indicates which fragments are alive or culled */
+ GLubyte mask[MAX_WIDTH];
+
GLenum ChanType; /**< Color channel type, GL_UNSIGNED_BYTE, GL_FLOAT */
union {
struct {
@@ -91,37 +96,17 @@ typedef struct sw_span_arrays {
GLushort rgba[MAX_WIDTH][4];
GLushort spec[MAX_WIDTH][4];
} sz2;
- struct {
- GLfloat rgba[MAX_WIDTH][4];
- GLfloat spec[MAX_WIDTH][4];
- } sz4;
} color;
/** XXX these are temporary fields, pointing into above color arrays */
GLchan (*rgba)[4];
GLchan (*spec)[4];
-#if 0
- /* XXX rearrange and unify these arrays to so that we can
- * index all fragment inputs with the FRAG_ATTRIB_* values:
- */
- GLfloat attribs[FRAG_ATTRIB_MAX][MAX_WIDTH][4];
- /*OR*/
- typedef GLfloat (*array4f)[4];
- array4f attribs[FRAG_ATTRIB_MAX];
-#endif
-
GLint x[MAX_WIDTH]; /**< fragment X coords */
GLint y[MAX_WIDTH]; /**< fragment Y coords */
GLuint z[MAX_WIDTH]; /**< fragment Z coords */
GLuint index[MAX_WIDTH]; /**< Color indexes */
- GLfloat fog[MAX_WIDTH];
- GLfloat texcoords[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH][4];
- GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH];
+ GLfloat lambda[MAX_TEXTURE_COORD_UNITS][MAX_WIDTH]; /**< Texture LOD */
GLfloat coverage[MAX_WIDTH]; /**< Fragment coverage for AA/smoothing */
- GLfloat varying[MAX_VARYING][MAX_WIDTH][4]; /**< For shaders */
-
- /** This mask indicates which fragments are alive or culled */
- GLubyte mask[MAX_WIDTH];
} SWspanarrays;
@@ -137,7 +122,8 @@ typedef struct sw_span_arrays {
* stream of these structures which would be consumed by one or more
* span-processing threads which could run in parallel.
*/
-typedef struct sw_span {
+typedef struct sw_span
+{
GLint x, y;
/** Only need to process pixels between start <= i < end */
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 2a3455f35e..ebb4c0d936 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -1094,6 +1094,9 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
+ const GLfloat (*texcoords)[4]
+ = (const GLfloat (*)[4])
+ span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
const struct gl_texture_object *curObj = texUnit->_Current;
GLfloat *lambda = span->array->lambda[unit];
@@ -1127,8 +1130,7 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
/* Sample the texture (span->end = number of fragments) */
swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end,
- (const GLfloat (*)[4]) span->array->texcoords[unit],
- lambda, texels );
+ texcoords, lambda, texels );
/* GL_SGI_texture_color_table */
if (texUnit->ColorTableEnabled) {
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index 29b8df41b7..34732a67e6 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -230,7 +230,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
ASSERT(j >= 0);
ASSERT(j < span->end);
- COPY_4V(zoomed.array->color.sz4.rgba[i], rgba[j]);
+ COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL0][i], rgba[j]);
}
}
}
@@ -268,10 +268,10 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
ASSERT(j >= 0);
ASSERT(j < span->end);
- zoomed.array->color.sz4.rgba[i][0] = rgb[j][0];
- zoomed.array->color.sz4.rgba[i][1] = rgb[j][1];
- zoomed.array->color.sz4.rgba[i][2] = rgb[j][2];
- zoomed.array->color.sz4.rgba[i][3] = 1.0F;
+ zoomed.array->attribs[FRAG_ATTRIB_COL0][i][0] = rgb[j][0];
+ zoomed.array->attribs[FRAG_ATTRIB_COL0][i][1] = rgb[j][1];
+ zoomed.array->attribs[FRAG_ATTRIB_COL0][i][2] = rgb[j][2];
+ zoomed.array->attribs[FRAG_ATTRIB_COL0][i][3] = 1.0F;
}
}
}