From 95e02a210ed339ad20b0c16284dcdcf9af2dc755 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 8 Mar 2001 17:33:33 +0000 Subject: do fog interpolation if INTERP_FOG is defined, not when INTERP_Z is defined --- src/mesa/drivers/osmesa/osmesa.c | 4 +--- src/mesa/drivers/x11/xm_tri.c | 24 +----------------------- src/mesa/swrast/s_lines.c | 27 +++++++++++++++++++++++++-- src/mesa/swrast/s_linetemp.h | 16 ++++++++++++++-- src/mesa/swrast/s_triangle.c | 17 ++++++++++++++++- src/mesa/swrast/s_tritemp.h | 29 +++++++++++++++++++++++------ 6 files changed, 80 insertions(+), 37 deletions(-) diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 5b3b942780..0473717a0d 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.49 2001/03/08 15:23:46 brianp Exp $ */ +/* $Id: osmesa.c,v 1.50 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1596,7 +1596,6 @@ static void smooth_rgba_z_triangle( GLcontext *ctx, { \ GLint i, len = RIGHT-LEFT; \ GLchan *img = PIXELADDR4(LEFT, Y); \ - (void) fffog; \ for (i = 0; i < len; i++, img += 4) { \ GLdepth z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ @@ -1638,7 +1637,6 @@ static void flat_rgba_z_triangle( GLcontext *ctx, { \ GLint i, len = RIGHT-LEFT; \ GLuint *img = (GLuint *) PIXELADDR4(LEFT, Y); \ - (void) fffog; \ for (i=0;ixm_buffer, Y); \ GLint len = RIGHT-LEFT; \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ - (void) fffog; \ for (i=0;ixm_buffer, Y); \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ XDITHER_SETUP(yy); \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ XDITHER_SETUP(yy); \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ - (void) fffog; \ for (i=0;ixm_buffer, Y); \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, yy)); \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ FLAT_DITHER_ROW_SETUP(yy); \ - (void) fffog; \ for (i=0;ixm_buffer,Y), len = RIGHT-LEFT; \ - (void) fffog; \ for (i=0;ifog); GLfixed dfog = FloatToFixed(vert1->fog) - fog0; #endif @@ -293,6 +296,8 @@ GLint errorDec = error-dx; #ifdef INTERP_Z dz = (z1-z0) / dx; +#endif +#ifdef INTERP_FOG dfog /= dx; #endif #ifdef INTERP_RGB @@ -398,6 +403,8 @@ zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrXstep); # endif z0 += dz; +#endif +#ifdef INTERP_FOG fog0 += dfog; #endif #ifdef INTERP_RGB @@ -464,6 +471,8 @@ GLint errorDec = error-dy; #ifdef INTERP_Z dz = (z1-z0) / dy; +#endif +#ifdef INTERP_FOG dfog /= dy; #endif #ifdef INTERP_RGB @@ -569,6 +578,8 @@ zPtr = (DEPTH_TYPE *) ((GLubyte*) zPtr + zPtrYstep); # endif z0 += dz; +#endif +#ifdef INTERP_FOG fog0 += dfog; #endif #ifdef INTERP_RGB @@ -632,6 +643,7 @@ #undef INTERP_XY #undef INTERP_Z +#undef INTERP_FOG #undef INTERP_RGB #undef INTERP_SPEC #undef INTERP_ALPHA diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 58609b0f40..fbacc7ddd4 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.16 2001/03/08 15:23:46 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.17 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -66,6 +66,7 @@ GLboolean _mesa_cull_triangle( GLcontext *ctx, } + /* * Render a flat-shaded color index triangle. */ @@ -75,6 +76,7 @@ static void flat_ci_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -108,6 +110,7 @@ static void smooth_ci_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define INTERP_INDEX 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ @@ -145,6 +148,7 @@ static void flat_rgba_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INNER_LOOP( LEFT, RIGHT, Y ) \ @@ -184,6 +188,7 @@ static void smooth_rgba_triangle( GLcontext *ctx, { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -293,6 +298,7 @@ static void simple_z_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_INT_TEX 1 #define S_SCALE twidth @@ -360,6 +366,7 @@ static void affine_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -689,6 +696,7 @@ static void near_persp_textured_triangle(GLcontext *ctx, #define BIAS 4096.0F #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1420,6 +1428,7 @@ static void lin_persp_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1595,6 +1604,7 @@ static void general_textured_triangle( GLcontext *ctx, const SWvertex *v2 ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1689,6 +1699,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx, GLchan spec[MAX_WIDTH][4] ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_SPEC 1 @@ -1793,6 +1804,7 @@ static void lambda_textured_triangle1( GLcontext *ctx, GLfloat u[MAX_WIDTH] ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -1896,6 +1908,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx, GLfloat u[MAX_WIDTH] ) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_SPEC 1 @@ -2012,6 +2025,7 @@ lambda_multitextured_triangle1( GLcontext *ctx, GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH]) { #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -2185,6 +2199,7 @@ static void occlusion_zless_triangle( GLcontext *ctx, #define DO_OCCLUSION_TEST #define INTERP_Z 1 +#define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 254f0fd2d2..a854b995b8 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_tritemp.h,v 1.12 2001/03/07 05:06:12 brianp Exp $ */ +/* $Id: s_tritemp.h,v 1.13 2001/03/08 17:33:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -33,9 +33,10 @@ * The following macros may be defined to indicate what auxillary information * must be interplated across the triangle: * INTERP_Z - if defined, interpolate Z values + * INTERP_FOG - if defined, interpolate fog values * INTERP_RGB - if defined, interpolate RGB values - * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_ALPHA - if defined, interpolate Alpha values + * INTERP_SPEC - if defined, interpolate specular RGB values * INTERP_INDEX - if defined, interpolate color index values * INTERP_INT_TEX - if defined, interpolate integer ST texcoords * (fast, simple 2-D texture mapping) @@ -253,6 +254,8 @@ GLint ltor; /* true if scanning left-to-right */ #ifdef INTERP_Z GLfloat dzdx, dzdy; GLfixed fdzdx; +#endif +#ifdef INTERP_FOG GLfloat dfogdx, dfogdy; GLfixed fdfogdx; #endif #ifdef INTERP_RGB @@ -332,6 +335,8 @@ else fdzdx = (GLint) dzdx; } +#endif +#ifdef INTERP_FOG { GLfloat eMaj_dfog, eBot_dfog; eMaj_dfog = (vMax->fog - vMin->fog) * 256; @@ -579,6 +584,8 @@ int dZRowOuter, dZRowInner; /* offset in bytes */ # endif GLfixed fz, fdzOuter, fdzInner; +#endif +#ifdef INTERP_FOG GLfixed ffog, fdfogOuter, fdfogInner; #endif #ifdef INTERP_RGB @@ -724,10 +731,11 @@ dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE); # endif } - { - ffog = FloatToFixed(vLower->fog * 256 + dfogdx * adjx + dfogdy * adjy) + FIXED_HALF; - fdfogOuter = SignedFloatToFixed(dfogdy + dxOuter * dfogdx); - } +#endif +#ifdef INTERP_FOG + ffog = FloatToFixed(vLower->fog * 256 + dfogdx * adjx + + dfogdy * adjy) + FIXED_HALF; + fdfogOuter = SignedFloatToFixed(dfogdy + dxOuter * dfogdx); #endif #ifdef INTERP_RGB fr = (GLfixed)(IntToFixed(vLower->color[0]) @@ -841,6 +849,8 @@ dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE); # endif fdzInner = fdzOuter + fdzdx; +#endif +#ifdef INTERP_FOG fdfogInner = fdfogOuter + fdfogdx; #endif #ifdef INTERP_RGB @@ -890,6 +900,8 @@ GLint right = FixedToInt(fxRightEdge); #ifdef INTERP_Z GLfixed ffz = fz; +#endif +#ifdef INTERP_FOG GLfixed fffog = ffog; #endif #ifdef INTERP_RGB @@ -1050,6 +1062,8 @@ zRow = (DEPTH_TYPE *) ((GLubyte*)zRow + dZRowOuter); # endif fz += fdzOuter; +#endif +#ifdef INTERP_FOG ffog += fdfogOuter; #endif #ifdef INTERP_RGB @@ -1096,6 +1110,8 @@ zRow = (DEPTH_TYPE *) ((GLubyte*)zRow + dZRowInner); # endif fz += fdzInner; +#endif +#ifdef INTERP_FOG ffog += fdfogInner; #endif #ifdef INTERP_RGB @@ -1149,6 +1165,7 @@ #undef PIXEL_ADDRESS #undef INTERP_Z +#undef INTERP_FOG #undef INTERP_RGB #undef INTERP_SPEC #undef INTERP_ALPHA -- cgit v1.2.3