From 1b3528fe635242f782fbcdde3ba74b5b7359a362 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 May 2001 22:13:32 +0000 Subject: interpolate fog valus as floats, not fixed - fixed the swrast fog problem --- src/mesa/swrast/s_triangle.c | 119 +++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 62 deletions(-) (limited to 'src/mesa/swrast/s_triangle.c') diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index e61b576592..82c690502b 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.24 2001/03/29 16:50:32 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.25 2001/05/03 22:13:32 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -83,13 +83,13 @@ static void flat_ci_triangle( GLcontext *ctx, const GLint n = RIGHT-LEFT; \ GLint i; \ GLdepth zspan[MAX_WIDTH]; \ - GLfixed fogspan[MAX_WIDTH]; \ + GLfloat fogspan[MAX_WIDTH]; \ if (n>0) { \ for (i=0;iindex, GL_POLYGON ); \ @@ -118,7 +118,7 @@ static void smooth_ci_triangle( GLcontext *ctx, const GLint n = RIGHT-LEFT; \ GLint i; \ GLdepth zspan[MAX_WIDTH]; \ - GLfixed fogspan[MAX_WIDTH]; \ + GLfloat fogspan[MAX_WIDTH]; \ GLuint index[MAX_WIDTH]; \ if (n>0) { \ for (i=0;i0) { \ for (i=0;icolor, \ @@ -199,7 +199,7 @@ static void smooth_rgba_triangle( GLcontext *ctx, GLint i; \ GLdepth zspan[MAX_WIDTH]; \ GLchan rgba[MAX_WIDTH][4]; \ - GLfixed fogspan[MAX_WIDTH]; \ + GLfloat fogspan[MAX_WIDTH]; \ if (n>0) { \ for (i=0;i0) { \ ffs -= FIXED_HALF; /* off-by-one error? */ \ fft -= FIXED_HALF; \ @@ -505,9 +503,9 @@ static void affine_textured_triangle( GLcontext *ctx, GLint pos = (t << twidth_log2) + s; \ const GLchan *tex00 = texture + COMP * pos; \ zspan[i] = FixedToDepth(ffz); \ - fogspan[i] = fffog / 256; \ + fogspan[i] = ffog;; \ DO_TEX; \ - fffog += fdfogdx; \ + ffog += dfogdx; \ ffz += fdzdx; \ ffr += fdrdx; \ ffg += fdgdx; \ @@ -540,9 +538,9 @@ static void affine_textured_triangle( GLcontext *ctx, tex11 -= tbytesline; \ } \ zspan[i] = FixedToDepth(ffz); \ - fogspan[i] = fffog / 256; \ + fogspan[i] = ffog; \ DO_TEX; \ - fffog += fdfogdx; \ + ffog += dfogdx; \ ffz += fdzdx; \ ffr += fdrdx; \ ffg += fdgdx; \ @@ -559,7 +557,7 @@ static void affine_textured_triangle( GLcontext *ctx, CONST GLint n = RIGHT-LEFT; \ GLint i; \ GLdepth zspan[MAX_WIDTH]; \ - GLfixed fogspan[MAX_WIDTH]; \ + GLfloat fogspan[MAX_WIDTH]; \ GLchan rgba[MAX_WIDTH][4]; \ if (n>0) { \ GLchan *dest = rgba[0]; \ @@ -740,9 +738,9 @@ static void near_persp_textured_triangle(GLcontext *ctx, GLint pos = COMP * ((t << twidth_log2) + s); \ const GLchan *tex00 = texture + pos; \ zspan[i] = FixedToDepth(ffz); \ - fogspan[i] = fffog / 256; \ + fogspan[i] = ffog; \ DO_TEX; \ - fffog += fdfogdx; \ + ffog += dfogdx; \ ffz += fdzdx; \ ffr += fdrdx; \ ffg += fdgdx; \ @@ -910,9 +908,9 @@ static void near_persp_textured_triangle(GLcontext *ctx, j = n; \ while (i 0) { \ @@ -1510,9 +1508,9 @@ static void lin_persp_textured_triangle( GLcontext *ctx, tex11 -= tbytesline; \ } \ zspan[i] = FixedToDepth(ffz); \ - fogspan[i] = fffog / 256; \ + fogspan[i] = ffog; \ DO_TEX; \ - fffog += fdfogdx; \ + ffog += dfogdx; \ ffz += fdzdx; \ ffr += fdrdx; \ ffg += fdgdx; \ @@ -1529,7 +1527,7 @@ static void lin_persp_textured_triangle( GLcontext *ctx, GLint i; \ const GLint n = RIGHT-LEFT; \ GLdepth zspan[MAX_WIDTH]; \ - GLfixed fogspan[MAX_WIDTH]; \ + GLfloat fogspan[MAX_WIDTH]; \ GLchan rgba[MAX_WIDTH][4]; \ (void) uu; /* please GCC */ \ if (n > 0) { \ @@ -1625,7 +1623,7 @@ static void general_textured_triangle( GLcontext *ctx, GLint i; \ const GLint n = RIGHT-LEFT; \ GLdepth zspan[MAX_WIDTH]; \ - GLfixed fogspan[MAX_WIDTH]; \ + GLfloat fogspan[MAX_WIDTH]; \ GLchan rgba[MAX_WIDTH][4]; \ GLfloat s[MAX_WIDTH], t[MAX_WIDTH], u[MAX_WIDTH]; \ if (n>0) { \ @@ -1633,7 +1631,7 @@ static void general_textured_triangle( GLcontext *ctx, for (i=0;i0) { \ @@ -1841,7 +1838,7 @@ static void lambda_textured_triangle1( GLcontext *ctx, for (i=0;i 0) { \ if (flat_shade) { \ for (i=0;iOcclusionResult = GL_TRUE; \ return; \ -- cgit v1.2.3