From afc132e7a9c2b2c870b61ef10311272b36ea9bf2 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 23 Apr 2007 22:01:34 -0600 Subject: remove SWvertex->fog field, use attrib field --- src/mesa/swrast/s_aalinetemp.h | 4 +++- src/mesa/swrast/s_aatritemp.h | 6 +++++- src/mesa/swrast/s_context.c | 2 +- src/mesa/swrast/s_linetemp.h | 5 +++-- src/mesa/swrast/s_pointtemp.h | 2 +- src/mesa/swrast/s_tritemp.h | 12 ++++++------ src/mesa/swrast/swrast.h | 1 - 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index b0b73e816d..ef26e9edc8 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -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; diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index f6c8e68a9b..8ff52cb932 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -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 diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index d4782aacb9..522a66fad8 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -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"); diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index 6c52e8dd47..76da446710 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -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; diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h index 23ac571236..500b3fef9d 100644 --- a/src/mesa/swrast/s_pointtemp.h +++ b/src/mesa/swrast/s_pointtemp.h @@ -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 diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index deab7edbed..97c79428c0 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -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 diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 9e1fe24bb4..12264a159a 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -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 */ -- cgit v1.2.3