remove SWvertex->fog field, use attrib field

This commit is contained in:
Brian 2007-04-23 22:01:34 -06:00
parent 335769a875
commit afc132e7a9
7 changed files with 19 additions and 13 deletions

View file

@ -153,7 +153,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
#ifdef DO_FOG
line.span.arrayMask |= SPAN_FOG;
compute_plane(line.x0, line.y0, line.x1, line.y1,
v0->fog, v1->fog, line.fPlane);
v0->attrib[FRAG_ATTRIB_FOGC][0],
v1->attrib[FRAG_ATTRIB_FOGC][0],
line.fPlane);
#endif
#ifdef DO_RGBA
line.span.arrayMask |= SPAN_RGBA;

View file

@ -136,7 +136,11 @@
span.arrayMask |= SPAN_Z;
#endif
#ifdef DO_FOG
compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
compute_plane(p0, p1, p2,
v0->attrib[FRAG_ATTRIB_FOGC][0],
v1->attrib[FRAG_ATTRIB_FOGC][0],
v2->attrib[FRAG_ATTRIB_FOGC][0],
fogPlane);
span.arrayMask |= SPAN_FOG;
#endif
#ifdef DO_RGBA

View file

@ -910,7 +910,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
v->specular[0], v->specular[1],
v->specular[2], v->specular[3]);
#endif
_mesa_debug(ctx, "fog %f\n", v->fog);
_mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
_mesa_debug(ctx, "index %d\n", v->index);
_mesa_debug(ctx, "pointsize %f\n", v->pointSize);
_mesa_debug(ctx, "\n");

View file

@ -280,8 +280,9 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
#endif
#ifdef INTERP_FOG
interpFlags |= SPAN_FOG;
span.attrStart[FRAG_ATTRIB_FOGC][0] = vert0->fog;
span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->fog - vert0->fog) / numPixels;
span.attrStart[FRAG_ATTRIB_FOGC][0] = vert0->attrib[FRAG_ATTRIB_FOGC][0];
span.attrStepX[FRAG_ATTRIB_FOGC][0] = (vert1->attrib[FRAG_ATTRIB_FOGC][0]
- vert0->attrib[FRAG_ATTRIB_FOGC][0]) / numPixels;
#endif
#ifdef INTERP_TEX
interpFlags |= SPAN_TEXTURE;

View file

@ -105,7 +105,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
*/
span->interpMask = SPAN_FOG;
span->arrayMask = SPAN_XY | SPAN_Z;
span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->fog;
span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->attrib[FRAG_ATTRIB_FOGC][0];
span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
#if FLAGS & RGBA

View file

@ -458,11 +458,11 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
{
# ifdef INTERP_W
const GLfloat wMax = vMax->win[3], wMin = vMin->win[3], wMid = vMid->win[3];
const GLfloat eMaj_dfog = vMax->fog * wMax - vMin->fog * wMin;
const GLfloat eBot_dfog = vMid->fog * wMid - vMin->fog * wMin;
const GLfloat eMaj_dfog = vMax->attrib[FRAG_ATTRIB_FOGC][0] * wMax - vMin->attrib[FRAG_ATTRIB_FOGC][0] * wMin;
const GLfloat eBot_dfog = vMid->attrib[FRAG_ATTRIB_FOGC][0] * wMid - vMin->attrib[FRAG_ATTRIB_FOGC][0] * wMin;
# else
const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
const GLfloat eBot_dfog = vMid->fog - vMin->fog;
const GLfloat eMaj_dfog = vMax->attrib[FRAG_ATTRIB_FOGC][0] - vMin->attrib[FRAG_ATTRIB_FOGC][0];
const GLfloat eBot_dfog = vMid->attrib[FRAG_ATTRIB_FOGC][0] - vMin->attrib[FRAG_ATTRIB_FOGC][0];
# endif
span.attrStepX[FRAG_ATTRIB_FOGC][0] = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
span.attrStepY[FRAG_ATTRIB_FOGC][0] = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx);
@ -867,9 +867,9 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#endif
#ifdef INTERP_FOG
# ifdef INTERP_W
fogLeft = vLower->fog * vLower->win[3] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
fogLeft = vLower->attrib[FRAG_ATTRIB_FOGC][0] * vLower->win[3] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
# else
fogLeft = vLower->fog + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
fogLeft = vLower->attrib[FRAG_ATTRIB_FOGC][0] + (span.attrStepX[FRAG_ATTRIB_FOGC][0] * adjx + span.attrStepY[FRAG_ATTRIB_FOGC][0] * adjy) * (1.0F/FIXED_SCALE);
# endif
dfogOuter = span.attrStepY[FRAG_ATTRIB_FOGC][0] + dxOuter * span.attrStepX[FRAG_ATTRIB_FOGC][0];
#endif

View file

@ -69,7 +69,6 @@ typedef struct {
GLfloat win[4];
GLchan color[4];
GLchan specular[4];
GLfloat fog;
GLfloat index;
GLfloat pointSize;
GLfloat attrib[FRAG_ATTRIB_MAX][4]; /**< texcoords & varying, more to come */