interpolate fog valus as floats, not fixed - fixed the swrast fog problem
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 3 May 2001 22:13:32 +0000 (22:13 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 3 May 2001 22:13:32 +0000 (22:13 +0000)
14 files changed:
src/mesa/swrast/s_aalinetemp.h
src/mesa/swrast/s_aatritemp.h
src/mesa/swrast/s_bitmap.c
src/mesa/swrast/s_fog.c
src/mesa/swrast/s_fog.h
src/mesa/swrast/s_lines.c
src/mesa/swrast/s_linetemp.h
src/mesa/swrast/s_span.c
src/mesa/swrast/s_span.h
src/mesa/swrast/s_texstore.c
src/mesa/swrast/s_triangle.c
src/mesa/swrast/s_tritemp.h
src/mesa/swrast/s_zoom.c
src/mesa/swrast/s_zoom.h

index 9ab1abb292eab08f59c5971a8f2041fead1999d5..53a2b55ddf5225f3f4553a206be6874c68a44846 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_aalinetemp.h,v 1.7 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_aalinetemp.h,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -41,7 +41,7 @@ NAME(plot)(GLcontext *ctx, const struct LineInfo *line,
    const GLfloat fy = (GLfloat) iy;
    const GLfloat coverage = compute_coveragef(line, ix, iy);
    GLdepth z;
-   GLfixed fog;
+   GLfloat fog;
    GLchan red, green, blue, alpha;
    GLint frac, indx, index;
    GLchan specRed, specGreen, specBlue;
@@ -60,9 +60,9 @@ NAME(plot)(GLcontext *ctx, const struct LineInfo *line,
    z = 0.0;
 #endif
 #ifdef DO_FOG
-   fog = FloatToFixed( solve_plane(fx, fy, line->fPlane) );
+   fog = solve_plane(fx, fy, line->fPlane);
 #else
-   fog = 0;
+   fog = 0.0;
 #endif
 #ifdef DO_RGBA
    red   = solve_plane_chan(fx, fy, line->rPlane);
index 41ef99cbfbd63fc3147433254b2c930c6d650e81..ae5abfcd7eab89e131bb4d5bc27873211432725e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_aatritemp.h,v 1.9 2001/03/28 21:36:31 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.10 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -56,7 +56,7 @@
    GLfloat zPlane[4];                                       /* Z (depth) */
    GLdepth z[MAX_WIDTH];
    GLfloat fogPlane[4];
-   GLfixed fog[MAX_WIDTH];
+   GLfloat fog[MAX_WIDTH];
 #endif
 #ifdef DO_RGBA
    GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4];      /* color */
          while (coverage > 0.0F) {
 #ifdef DO_Z
             z[count] = (GLdepth) solve_plane(ix, iy, zPlane);
-           fog[count] = FloatToFixed(solve_plane(ix, iy, fogPlane));
+           fog[count] = solve_plane(ix, iy, fogPlane);
 #endif
 #ifdef DO_RGBA
             rgba[count][RCOMP] = solve_plane_chan(ix, iy, rPlane);
          while (coverage > 0.0F) {
 #ifdef DO_Z
             z[ix] = (GLdepth) solve_plane(ix, iy, zPlane);
-            fog[ix] = FloatToFixed(solve_plane(ix, iy, fogPlane));
+            fog[ix] = solve_plane(ix, iy, fogPlane);
 #endif
 #ifdef DO_RGBA
             rgba[ix][RCOMP] = solve_plane_chan(ix, iy, rPlane);
index d22579c02f38d855b2f172def88e938b17998baa..d91319c01b8268e2a089ff04a8cac16c75fac17e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_bitmap.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_bitmap.c,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -49,7 +49,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    struct pixel_buffer *PB = swrast->PB;
    GLint row, col;
    GLdepth fragZ;
-   GLfixed fogCoord;
+   GLfloat fogCoord;
 
    ASSERT(ctx->RenderMode == GL_RENDER);
    ASSERT(bitmap);
index cc55913f37d0c982806e2f47d6a461e878ef6030..4b8c4f0c71e26893c49228d68857aeb2f21a201c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_fog.c,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_fog.c,v 1.12 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -46,7 +46,7 @@
 void
 _mesa_fog_rgba_pixels( const GLcontext *ctx,
                        GLuint n,
-                      const GLfixed fog[],
+                      const GLfloat fog[],
                       GLchan rgba[][4] )
 {
    GLuint i;
@@ -56,24 +56,13 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx,
    UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]);
    UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]);
 
-#if CHAN_TYPE == GL_FLOAT
    for (i = 0; i < n; i++) {
-      const GLfixed cf = CLAMP(fog[i], 0, FIXED_ONE);
-      const GLfloat f = FixedToFloat(cf);
-      const GLfloat g = 1.0F - f;
+      const GLfloat f = fog[i];
+      const GLfloat g = 1.0 - f;
       rgba[i][RCOMP] = f * rgba[i][RCOMP] + g * rFog;
       rgba[i][GCOMP] = f * rgba[i][GCOMP] + g * gFog;
       rgba[i][BCOMP] = f * rgba[i][BCOMP] + g * bFog;
    }
-#else
-   for (i = 0; i < n; i++) {
-      const GLfixed f = CLAMP(fog[i], 0, FIXED_ONE);
-      const GLfixed g = FIXED_ONE - f;
-      rgba[i][0] = (f * rgba[i][0] + g * rFog) >> FIXED_SHIFT;
-      rgba[i][1] = (f * rgba[i][1] + g * gFog) >> FIXED_SHIFT;
-      rgba[i][2] = (f * rgba[i][2] + g * bFog) >> FIXED_SHIFT;
-   }
-#endif
 }
 
 
@@ -87,14 +76,14 @@ _mesa_fog_rgba_pixels( const GLcontext *ctx,
  */
 void
 _mesa_fog_ci_pixels( const GLcontext *ctx,
-                     GLuint n, const GLfixed fog[], GLuint index[] )
+                     GLuint n, const GLfloat fog[], GLuint index[] )
 {
    GLuint idx = (GLuint) ctx->Fog.Index;
    GLuint i;
 
-   for (i=0;i<n;i++) {
-      GLfloat f = FixedToFloat(CLAMP(fog[i], 0, FIXED_ONE));
-      index[i] = (GLuint) ((GLfloat) index[i] + (1.0F-f) * idx);
+   for (i = 0; i < n; i++) {
+      const GLfloat f = CLAMP(fog[i], 0.0, 1.0);
+      index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx);
    }
 }
 
@@ -113,7 +102,7 @@ void
 _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                             GLuint n,
                             const GLdepth z[],
-                            GLfixed fogcoord[] )
+                            GLfloat fogcoord[] )
 {
    const GLboolean ortho = (ctx->ProjectionMatrix.m[15] != 0.0F);
    const GLfloat p10 = ctx->ProjectionMatrix.m[10];
@@ -165,7 +154,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                   GLfloat eyez = (ndcz - p14) / p10;
                   if (eyez < 0.0)
                      eyez = -eyez;
-                  fogcoord[i] = FloatToFixed((fogEnd - eyez) * fogScale);
+                  fogcoord[i] = (fogEnd - eyez) * fogScale;
                }
             }
             else {
@@ -175,7 +164,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                   GLfloat eyez = p14 / (ndcz + p10);
                   if (eyez < 0.0)
                      eyez = -eyez;
-                  fogcoord[i] = FloatToFixed((fogEnd - eyez) * fogScale);
+                  fogcoord[i] = (fogEnd - eyez) * fogScale;
                }
             }
          }
@@ -187,7 +176,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                GLfloat eyez = (ndcz - p14) / p10;
                if (eyez < 0.0)
                   eyez = -eyez;
-               fogcoord[i] = FloatToFixed(exp( -ctx->Fog.Density * eyez ));
+               fogcoord[i] = exp( -ctx->Fog.Density * eyez );
             }
          }
          else {
@@ -197,7 +186,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                GLfloat eyez = p14 / (ndcz + p10);
                if (eyez < 0.0)
                   eyez = -eyez;
-               fogcoord[i] = FloatToFixed(exp( -ctx->Fog.Density * eyez ));
+               fogcoord[i] = exp( -ctx->Fog.Density * eyez );
             }
          }
         break;
@@ -214,7 +203,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                   if (tmp < FLT_MIN_10_EXP)
                      tmp = FLT_MIN_10_EXP;
 #endif
-                  fogcoord[i] = FloatToFixed(exp( tmp ));
+                  fogcoord[i] = exp( tmp );
                }
             }
             else {
@@ -228,7 +217,7 @@ _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                   if (tmp < FLT_MIN_10_EXP)
                      tmp = FLT_MIN_10_EXP;
 #endif
-                  fogcoord[i] = FloatToFixed(exp( tmp ));
+                  fogcoord[i] = exp( tmp );
                }
             }
          }
@@ -251,7 +240,7 @@ void
 _mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
                             GLuint n, const GLdepth z[], GLchan rgba[][4] )
 {
-   GLfixed fog[PB_SIZE];
+   GLfloat fog[PB_SIZE];
    ASSERT(n <= PB_SIZE);
    _mesa_win_fog_coords_from_z( ctx, n, z, fog );
    _mesa_fog_rgba_pixels( ctx, n, fog, rgba );
@@ -269,7 +258,7 @@ void
 _mesa_depth_fog_ci_pixels( const GLcontext *ctx,
                      GLuint n, const GLdepth z[], GLuint index[] )
 {
-   GLfixed fog[PB_SIZE];
+   GLfloat fog[PB_SIZE];
    ASSERT(n <= PB_SIZE);
    _mesa_win_fog_coords_from_z( ctx, n, z, fog );
    _mesa_fog_ci_pixels( ctx, n, fog, index );
index 9c487e13d11731a474c5cfd4ae8daf5919b6c6bf..88f9964cb5b21e6056a7e62d6410737f54bcbbfe 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_fog.h,v 1.3 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_fog.h,v 1.4 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
 #include "swrast.h"
 
 
-
-
 extern void
 _mesa_fog_rgba_pixels( const GLcontext *ctx,
-                       GLuint n, const GLfixed fog[],
+                       GLuint n, const GLfloat fog[],
                        GLchan rgba[][4] );
 
 extern void
 _mesa_fog_ci_pixels( const GLcontext *ctx,
-                     GLuint n, const GLfixed fog[], GLuint indx[] );
+                     GLuint n, const GLfloat fog[], GLuint indx[] );
 
 extern void
 _mesa_win_fog_coords_from_z( const GLcontext *ctx,
                             GLuint n,
                             const GLdepth z[],
-                            GLfixed fogcoord[] );
+                            GLfloat fogcoord[] );
 
 extern void
 _mesa_depth_fog_rgba_pixels( const GLcontext *ctx,
@@ -59,5 +57,4 @@ _mesa_depth_fog_ci_pixels( const GLcontext *ctx,
                           GLuint n, const GLdepth z[], GLuint index[] );
 
 
-
 #endif
index 8971993ef56e7281929df2032e213a3854f5e063..eec354b84ad0db84484c1fb07e67c0ea23c5f1ca 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_lines.c,v 1.15 2001/03/29 16:50:32 brianp Exp $ */
+/* $Id: s_lines.c,v 1.16 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -239,7 +239,7 @@ static void smooth_rgba_z_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLchan (*pbrgba)[4] = PB->rgba;
 
 
@@ -288,7 +288,7 @@ static void general_smooth_ci_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLuint *pbi = PB->index;
 
    PB->mono = GL_FALSE;
@@ -371,7 +371,7 @@ static void general_flat_ci_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    PB_SET_INDEX( PB, vert0->index );
    count = PB->count;
 
@@ -446,7 +446,7 @@ static void general_smooth_rgba_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLchan (*pbrgba)[4] = PB->rgba;
 
    PB->mono = GL_FALSE;
@@ -598,7 +598,7 @@ static void flat_textured_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLfloat *pbs = PB->s[0];
    GLfloat *pbt = PB->t[0];
    GLfloat *pbu = PB->u[0];
@@ -666,7 +666,7 @@ static void smooth_textured_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLfloat *pbs = PB->s[0];
    GLfloat *pbt = PB->t[0];
    GLfloat *pbu = PB->u[0];
@@ -747,7 +747,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLchan (*pbrgba)[4] = PB->rgba;
    GLchan (*pbspec)[3] = PB->spec;
 
@@ -846,7 +846,7 @@ static void flat_multitextured_line( GLcontext *ctx,
    GLint *pbx = PB->x;
    GLint *pby = PB->y;
    GLdepth *pbz = PB->z;
-   GLfixed *pbfog = PB->fog;
+   GLfloat *pbfog = PB->fog;
    GLchan (*pbrgba)[4] = PB->rgba;
    GLchan (*pbspec)[3] = PB->spec;
    GLchan *color = (GLchan*) vert1->color;
index 5792b46a4a9103abf7b064488ee1badf1c568264..f8fa310d765d04012cd8fdb38df090b2336f6da5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_linetemp.h,v 1.7 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_linetemp.h,v 1.8 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -95,8 +95,8 @@
 #  endif
 #endif
 #ifdef INTERP_FOG
-   GLfixed fog0 = FloatToFixed(vert0->fog);
-   GLfixed dfog = FloatToFixed(vert1->fog) - fog0;
+   GLfloat fog0 = vert0->fog;
+   GLfloat dfog = vert1->fog - fog0;
 #endif
 #ifdef INTERP_RGB
    GLfixed r0 = IntToFixed(vert0->color[0]);
index d26b04218749ca99988774b7c0b42f7dd01ff123..c0c47f82b1869fe965a1d0bc8d25d43fe5c0f0d6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_span.c,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
+/* $Id: s_span.c,v 1.13 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -180,7 +180,7 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n,
  */
 void _mesa_write_index_span( GLcontext *ctx,
                           GLuint n, GLint x, GLint y, const GLdepth z[],
-                         const GLfixed fog[],
+                         const GLfloat fog[],
                          GLuint indexIn[], GLenum primitive )
 {
    const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | LOGIC_OP_BIT;
@@ -272,7 +272,7 @@ void _mesa_write_index_span( GLcontext *ctx,
 void _mesa_write_monoindex_span( GLcontext *ctx,
                               GLuint n, GLint x, GLint y,
                              const GLdepth z[],
-                             const GLfixed fog[],
+                             const GLfloat fog[],
                              GLuint index, GLenum primitive )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
@@ -444,7 +444,7 @@ static void multi_write_rgba_span( GLcontext *ctx, GLuint n,
 
 void _mesa_write_rgba_span( GLcontext *ctx,
                          GLuint n, GLint x, GLint y, const GLdepth z[],
-                        const GLfixed *fog,
+                        const GLfloat *fog,
                          GLchan rgbaIn[][4],
                          GLenum primitive )
 {
@@ -580,7 +580,7 @@ void _mesa_write_rgba_span( GLcontext *ctx,
  */
 void _mesa_write_monocolor_span( GLcontext *ctx,
                               GLuint n, GLint x, GLint y, const GLdepth z[],
-                             const GLfixed fog[],
+                             const GLfloat fog[],
                              const GLchan color[4],
                               GLenum primitive )
 {
@@ -763,7 +763,7 @@ static void add_colors(GLuint n, GLchan rgba[][4], CONST GLchan specular[][4] )
  */
 void _mesa_write_texture_span( GLcontext *ctx,
                             GLuint n, GLint x, GLint y, const GLdepth z[],
-                           const GLfixed fog[],
+                           const GLfloat fog[],
                            const GLfloat s[], const GLfloat t[],
                             const GLfloat u[], GLfloat lambda[],
                            GLchan rgbaIn[][4], CONST GLchan spec[][4],
@@ -906,7 +906,7 @@ void
 _mesa_write_multitexture_span( GLcontext *ctx,
                             GLuint n, GLint x, GLint y,
                             const GLdepth z[],
-                           const GLfixed fog[],
+                           const GLfloat fog[],
                             CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
                             CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
                             CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
index aa7e3b3664b0b4631a0f954fa8d7277f2e1d1122..b1bb847bf6712b7308b65ae695d42930684625c5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_span.h,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_span.h,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
 
 extern void _mesa_write_index_span( GLcontext *ctx,
                                  GLuint n, GLint x, GLint y, const GLdepth z[],
-                                const GLfixed fog[],
+                                const GLfloat fog[],
                                 GLuint index[], GLenum primitive );
 
 
 extern void _mesa_write_monoindex_span( GLcontext *ctx,
                                      GLuint n, GLint x, GLint y,
                                      const GLdepth z[],
-                                    const GLfixed fog[],
+                                    const GLfloat fog[],
                                     GLuint index, GLenum primitive );
 
 
 extern void _mesa_write_rgba_span( GLcontext *ctx,
                                 GLuint n, GLint x, GLint y, const GLdepth z[],
-                               const GLfixed fog[],
+                               const GLfloat fog[],
                                 GLchan rgba[][4], GLenum primitive );
 
 
 extern void _mesa_write_monocolor_span( GLcontext *ctx,
                                      GLuint n, GLint x, GLint y,
                                      const GLdepth z[],
-                                    const GLfixed fog[],
+                                    const GLfloat fog[],
                                     const GLchan color[4],
                                      GLenum primitive );
 
@@ -66,7 +66,7 @@ extern void _mesa_write_monocolor_span( GLcontext *ctx,
 extern void _mesa_write_texture_span( GLcontext *ctx,
                                    GLuint n, GLint x, GLint y,
                                    const GLdepth z[],
-                                  const GLfixed fog[],
+                                  const GLfloat fog[],
                                   const GLfloat s[], const GLfloat t[],
                                    const GLfloat u[], GLfloat lambda[],
                                   GLchan rgba[][4], CONST GLchan spec[][4],
@@ -77,7 +77,7 @@ extern void
 _mesa_write_multitexture_span( GLcontext *ctx,
                             GLuint n, GLint x, GLint y,
                             const GLdepth z[],
-                           const GLfixed fog[],
+                           const GLfloat fog[],
                             CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
                             CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
                             CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH],
index f01dab5fdd3ce91425a7699d71f3c5a9c3e98a07..b7ca0abf3589ac172080fc34e54189bd0eb0c59b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_texstore.c,v 1.3 2001/04/13 00:13:51 brianp Exp $ */
+/* $Id: s_texstore.c,v 1.4 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -274,6 +274,7 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
          return;
       }
 
+#if 0
       /*
        * XXX this is a bit of a hack.  We need to be sure that the alpha
        * channel is 1.0 if the internal texture format is not supposed to
@@ -289,7 +290,7 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
             image[i + 3] = CHAN_MAX;
          }
       }
-
+#endif
       /* now call glTexSubImage1D to do the real work */
       (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
                                    GL_RGBA, CHAN_TYPE, image,
@@ -342,6 +343,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
          return;
       }
 
+#if  0
       /*
        * XXX this is a bit of a hack.  We need to be sure that the alpha
        * channel is 1.0 if the internal texture format is not supposed to
@@ -357,7 +359,7 @@ _swrast_copy_texsubimage2d( GLcontext *ctx,
             image[i + 3] = CHAN_MAX;
          }
       }
-
+#endif
       /* now call glTexSubImage2D to do the real work */
       (*ctx->Driver.TexSubImage2D)(ctx, target, level,
                                    xoffset, yoffset, width, height,
@@ -411,7 +413,7 @@ _swrast_copy_texsubimage3d( GLcontext *ctx,
          _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
          return;
       }
-
+#if 0
       /*
        * XXX this is a bit of a hack.  We need to be sure that the alpha
        * channel is 1.0 if the internal texture format is not supposed to
@@ -427,7 +429,7 @@ _swrast_copy_texsubimage3d( GLcontext *ctx,
             image[i + 3] = CHAN_MAX;
          }
       }
-
+#endif
       /* now call glTexSubImage3D to do the real work */
       (*ctx->Driver.TexSubImage3D)(ctx, target, level,
                                    xoffset, yoffset, zoffset, width, height, 1,
index e61b5765926a93ab481f62684386acfc659318c1..82c690502bff8e539016179136e2607f06b9c4cb 100644 (file)
@@ -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;i<n;i++) {                               \
                 zspan[i] = FixedToDepth(ffz);                  \
                 ffz += fdzdx;                                  \
-                fogspan[i] = fffog / 256;                      \
-                fffog += fdfogdx;                              \
+                fogspan[i] = ffog;                             \
+                 ffog += dfogdx;                               \
              }                                                 \
              _mesa_write_monoindex_span( ctx, n, LEFT, Y, zspan,       \
                          fogspan, v0->index, 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;i<n;i++) {                               \
@@ -126,8 +126,8 @@ static void smooth_ci_triangle( GLcontext *ctx,
                 ffz += fdzdx;                                  \
                  index[i] = FixedToInt(ffi);                   \
                 ffi += fdidx;                                  \
-                fogspan[i] = fffog / 256;                      \
-                fffog += fdfogdx;                              \
+                fogspan[i] = ffog;                             \
+                ffog += dfogdx;                                \
              }                                                 \
              _mesa_write_index_span( ctx, n, LEFT, Y, zspan, fogspan,  \
                                   index, GL_POLYGON );         \
@@ -156,13 +156,13 @@ static void flat_rgba_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;i<n;i++) {                               \
                 zspan[i] = FixedToDepth(ffz);                  \
                 ffz += fdzdx;                                  \
-                fogspan[i] = fffog / 256;                      \
-                fffog += fdfogdx;                              \
+                fogspan[i] = ffog;                             \
+                ffog += dfogdx;                                \
              }                                                 \
               _mesa_write_monocolor_span( ctx, n, LEFT, Y, zspan,      \
                                        fogspan, v2->color,     \
@@ -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;i<n;i++) {                               \
                 zspan[i] = FixedToDepth(ffz);                  \
@@ -207,13 +207,13 @@ static void smooth_rgba_triangle( GLcontext *ctx,
                 rgba[i][GCOMP] = FixedToInt(ffg);              \
                 rgba[i][BCOMP] = FixedToInt(ffb);              \
                 rgba[i][ACOMP] = FixedToInt(ffa);              \
-                fogspan[i] = fffog / 256;                      \
-                fffog += fdfogdx;                              \
+                fogspan[i] = ffog;;                            \
                 ffz += fdzdx;                                  \
                 ffr += fdrdx;                                  \
                 ffg += fdgdx;                                  \
                 ffb += fdbdx;                                  \
                 ffa += fdadx;                                  \
+                ffog += dfogdx;                                \
              }                                                 \
              _mesa_write_rgba_span( ctx, n, LEFT, Y,           \
                                   (CONST GLdepth *) zspan,     \
@@ -299,7 +299,6 @@ 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
@@ -325,7 +324,6 @@ static void simple_z_textured_triangle( GLcontext *ctx,
           GLint i;                                             \
           GLchan rgb[MAX_WIDTH][3];                            \
            GLubyte mask[MAX_WIDTH];                            \
-           (void) fffog;                                        \
           if (n>0) {                                           \
               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<j) {                    \
          zspan[i] = FixedToDepth(ffz); \
-         fogspan[i] = fffog / 256;      \
+         fogspan[i] = ffog;             \
          DO_TEX;                       \
-         fffog += fdfogdx;              \
+         ffog += dfogdx;                \
          ffz += fdzdx;                 \
          ffr += fdrdx;                 \
          ffg += fdgdx;                 \
@@ -928,7 +926,7 @@ static void near_persp_textured_triangle(GLcontext *ctx,
       GLint i = 0;                                                     \
       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) {                                                     \
@@ -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;i<n;i++) {                           \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;      \
                    zspan[i] = FixedToDepth(ffz);               \
-                   fogspan[i] = fffog / 256;                   \
+                   fogspan[i] = ffog;                          \
                    rgba[i][RCOMP] = r;                         \
                    rgba[i][GCOMP] = g;                         \
                    rgba[i][BCOMP] = b;                         \
@@ -1641,7 +1639,7 @@ static void general_textured_triangle( GLcontext *ctx,
                    s[i] = ss*invQ;                             \
                    t[i] = tt*invQ;                             \
                    u[i] = uu*invQ;                             \
-                   fffog += fdfogdx;                           \
+                   ffog += dfogdx;                             \
                    ffz += fdzdx;                               \
                    ss += dsdx;                                 \
                    tt += dtdx;                                 \
@@ -1657,11 +1655,11 @@ static void general_textured_triangle( GLcontext *ctx,
                    rgba[i][GCOMP] = FixedToInt(ffg);           \
                    rgba[i][BCOMP] = FixedToInt(ffb);           \
                    rgba[i][ACOMP] = FixedToInt(ffa);           \
-                   fogspan[i] = fffog / 256;                   \
+                   fogspan[i] = ffog;                          \
                    s[i] = ss*invQ;                             \
                    t[i] = tt*invQ;                             \
                    u[i] = uu*invQ;                             \
-                   fffog += fdfogdx;                           \
+                   ffog += dfogdx;                             \
                    ffz += fdzdx;                               \
                    ffr += fdrdx;                               \
                    ffg += fdgdx;                               \
@@ -1673,10 +1671,9 @@ static void general_textured_triangle( GLcontext *ctx,
                    vv += dvdx;                                 \
                 }                                              \
               }                                                        \
-             _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, fogspan,        \
-                                     s, t, u, NULL,            \
-                                    rgba, \
-                                     NULL, GL_POLYGON );       \
+             _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, \
+                                     fogspan, s, t, u, NULL,   \
+                                    rgba, NULL, GL_POLYGON );  \
           }                                                    \
        }
 
@@ -1696,7 +1693,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx,
                                             const SWvertex *v1,
                                             const SWvertex *v2,
                                              GLdepth zspan[MAX_WIDTH],
-                                             GLfixed fogspan[MAX_WIDTH],
+                                             GLfloat fogspan[MAX_WIDTH],
                                              GLchan rgba[MAX_WIDTH][4],
                                              GLchan spec[MAX_WIDTH][4] )
 {
@@ -1729,7 +1726,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx,
                  for (i=0;i<n;i++) {                           \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;      \
                    zspan[i] = FixedToDepth(ffz);               \
-                   fogspan[i] = fffog / 256;                   \
+                   fogspan[i] = ffog;                          \
                    rgba[i][RCOMP] = r;                         \
                    rgba[i][GCOMP] = g;                         \
                    rgba[i][BCOMP] = b;                         \
@@ -1740,7 +1737,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx,
                    s[i] = ss*invQ;                             \
                    t[i] = tt*invQ;                             \
                    u[i] = uu*invQ;                             \
-                   fffog += fdfogdx;                           \
+                   ffog += dfogdx;                             \
                    ffz += fdzdx;                               \
                    ss += dsdx;                                 \
                    tt += dtdx;                                 \
@@ -1752,7 +1749,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx,
                  for (i=0;i<n;i++) {                           \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;      \
                    zspan[i] = FixedToDepth(ffz);               \
-                   fogspan[i] = fffog / 256;                   \
+                   fogspan[i] = ffog;                          \
                    rgba[i][RCOMP] = FixedToInt(ffr);           \
                    rgba[i][GCOMP] = FixedToInt(ffg);           \
                    rgba[i][BCOMP] = FixedToInt(ffb);           \
@@ -1763,7 +1760,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx,
                    s[i] = ss*invQ;                             \
                    t[i] = tt*invQ;                             \
                    u[i] = uu*invQ;                             \
-                   fffog += fdfogdx;                           \
+                   ffog += dfogdx;                             \
                    ffz += fdzdx;                               \
                    ffr += fdrdx;                               \
                    ffg += fdgdx;                               \
@@ -1833,7 +1830,7 @@ static void lambda_textured_triangle1( 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 lambda[MAX_WIDTH];                                   \
           if (n>0) {                                                   \
@@ -1841,7 +1838,7 @@ static void lambda_textured_triangle1( GLcontext *ctx,
                 for (i=0;i<n;i++) {                                    \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;              \
                    zspan[i] = FixedToDepth(ffz);                       \
-                   fogspan[i] = fffog / 256;                           \
+                   fogspan[i] = ffog;                                  \
                    rgba[i][RCOMP] = r;                                 \
                    rgba[i][GCOMP] = g;                                 \
                    rgba[i][BCOMP] = b;                                 \
@@ -1851,7 +1848,7 @@ static void lambda_textured_triangle1( GLcontext *ctx,
                    u[i] = uu*invQ;                                     \
                     COMPUTE_LAMBDA(lambda[i], invQ);                   \
                    ffz += fdzdx;                                       \
-                   fffog += fdfogdx;                                   \
+                   ffog += dfogdx;                                     \
                    ss += dsdx;                                         \
                    tt += dtdx;                                         \
                    uu += dudx;                                         \
@@ -1862,7 +1859,7 @@ static void lambda_textured_triangle1( GLcontext *ctx,
                 for (i=0;i<n;i++) {                                    \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;              \
                    zspan[i] = FixedToDepth(ffz);                       \
-                   fogspan[i] = fffog / 256;                           \
+                   fogspan[i] = ffog;                                  \
                    rgba[i][RCOMP] = FixedToInt(ffr);                   \
                    rgba[i][GCOMP] = FixedToInt(ffg);                   \
                    rgba[i][BCOMP] = FixedToInt(ffb);                   \
@@ -1872,7 +1869,7 @@ static void lambda_textured_triangle1( GLcontext *ctx,
                    u[i] = uu*invQ;                                     \
                     COMPUTE_LAMBDA(lambda[i], invQ);                   \
                    ffz += fdzdx;                                       \
-                   fffog += fdfogdx;                                   \
+                   ffog += dfogdx;                                     \
                    ffr += fdrdx;                                       \
                    ffg += fdgdx;                                       \
                    ffb += fdbdx;                                       \
@@ -1941,7 +1938,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
           GLint i;                                                     \
            const GLint n = RIGHT-LEFT;                                 \
           GLdepth zspan[MAX_WIDTH];                                    \
-          GLfixed fogspan[MAX_WIDTH];                                  \
+          GLfloat fogspan[MAX_WIDTH];                                  \
           GLchan spec[MAX_WIDTH][4];                                   \
            GLchan rgba[MAX_WIDTH][4];                                  \
           GLfloat lambda[MAX_WIDTH];                                   \
@@ -1950,7 +1947,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
                 for (i=0;i<n;i++) {                                    \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;              \
                    zspan[i] = FixedToDepth(ffz);                       \
-                   fogspan[i] = fffog / 256;                           \
+                   fogspan[i] = ffog;                                  \
                    rgba[i][RCOMP] = r;                                 \
                    rgba[i][GCOMP] = g;                                 \
                    rgba[i][BCOMP] = b;                                 \
@@ -1962,7 +1959,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
                    t[i] = tt*invQ;                                     \
                    u[i] = uu*invQ;                                     \
                     COMPUTE_LAMBDA(lambda[i], invQ);                   \
-                   fffog += fdfogdx;                                   \
+                   ffog += dfogdx;                                     \
                    ffz += fdzdx;                                       \
                    ss += dsdx;                                         \
                    tt += dtdx;                                         \
@@ -1974,7 +1971,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
                 for (i=0;i<n;i++) {                                    \
                    GLdouble invQ = vv ? (1.0 / vv) : 1.0;              \
                    zspan[i] = FixedToDepth(ffz);                       \
-                   fogspan[i] = fffog / 256;                           \
+                   fogspan[i] = ffog;                                  \
                    rgba[i][RCOMP] = FixedToInt(ffr);                   \
                    rgba[i][GCOMP] = FixedToInt(ffg);                   \
                    rgba[i][BCOMP] = FixedToInt(ffb);                   \
@@ -1986,7 +1983,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
                    t[i] = tt*invQ;                                     \
                    u[i] = uu*invQ;                                     \
                     COMPUTE_LAMBDA(lambda[i], invQ);                   \
-                   fffog += fdfogdx;                                   \
+                   ffog += dfogdx;                                     \
                    ffz += fdzdx;                                       \
                    ffr += fdrdx;                                       \
                    ffg += fdgdx;                                       \
@@ -2001,8 +1998,8 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx,
                    vv += dvdx;                                         \
                 }                                                      \
               }                                                                \
-             _mesa_write_texture_span( ctx, n, LEFT, Y, zspan, fogspan,        \
-                                     s, t, u, lambda,                  \
+             _mesa_write_texture_span( ctx, n, LEFT, Y, zspan,         \
+                                     fogspan, s, t, u, lambda,         \
                                     rgba, (CONST GLchan (*)[4]) spec,  \
                                      GL_POLYGON );                     \
           }                                                            \
@@ -2063,15 +2060,15 @@ lambda_multitextured_triangle1( GLcontext *ctx,
       GLint i;                                                         \
       const GLint n = RIGHT-LEFT;                                      \
       GLdepth zspan[MAX_WIDTH];                                                \
-      GLfixed fogspan[MAX_WIDTH];                                      \
+      GLfloat fogspan[MAX_WIDTH];                                      \
       GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];                    \
       if (n > 0) {                                                     \
          if (flat_shade) {                                             \
            for (i=0;i<n;i++) {                                         \
                GLuint unit;                                            \
               zspan[i] = FixedToDepth(ffz);                            \
-              fogspan[i] = fffog / 256;                                \
-               fffog += fdfogdx;                                       \
+              fogspan[i] = ffog;                                       \
+               ffog += dfogdx;                                         \
               ffz += fdzdx;                                            \
               rgba[i][RCOMP] = r;                                      \
               rgba[i][GCOMP] = g;                                      \
@@ -2096,9 +2093,9 @@ lambda_multitextured_triangle1( GLcontext *ctx,
            for (i=0;i<n;i++) {                                         \
                GLuint unit;                                            \
               zspan[i] = FixedToDepth(ffz);                            \
-              fogspan[i] = fffog / 256;                                \
+              fogspan[i] = ffog;                                       \
               ffz += fdzdx;                                            \
-              fffog += fdfogdx;                                        \
+              ffog += dfogdx;                                          \
               rgba[i][RCOMP] = FixedToInt(ffr);                        \
               rgba[i][GCOMP] = FixedToInt(ffg);                        \
               rgba[i][BCOMP] = FixedToInt(ffb);                        \
@@ -2146,7 +2143,7 @@ static void general_textured_spec_triangle(GLcontext *ctx,
                                           const SWvertex *v2 )
 {
    GLdepth zspan[MAX_WIDTH];
-   GLfixed fogspan[MAX_WIDTH];
+   GLfloat fogspan[MAX_WIDTH];
    GLchan rgba[MAX_WIDTH][4], spec[MAX_WIDTH][4];
    general_textured_spec_triangle1(ctx,v0,v1,v2,zspan,fogspan,rgba,spec);
 }
@@ -2201,7 +2198,6 @@ 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 )           \
    {                                           \
@@ -2209,7 +2205,6 @@ static void occlusion_zless_triangle( GLcontext *ctx,
       const GLint len = RIGHT-LEFT;            \
       for (i=0;i<len;i++) {                    \
         GLdepth z = FixedToDepth(ffz);         \
-         (void) fffog;                          \
         if (z < zRow[i]) {                     \
            ctx->OcclusionResult = GL_TRUE;     \
            return;                             \
index 062795debb2b8c857539053a4b49125fa0a2c70a..3bdb1537a0102f1b457ac997913b389f24655786 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_tritemp.h,v 1.14 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_tritemp.h,v 1.15 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
       GLfloat dzdx, dzdy;      GLfixed fdzdx;
 #endif
 #ifdef INTERP_FOG
-      GLfloat dfogdx, dfogdy;      GLfixed fdfogdx;
+      GLfloat dfogdx, dfogdy;
 #endif
 #ifdef INTERP_RGB
       GLfloat drdx, drdy;      GLfixed fdrdx;
 #endif
 #ifdef INTERP_FOG
       {
-         GLfloat eMaj_dfog, eBot_dfog;
-         eMaj_dfog = (vMax->fog - vMin->fog) * 256;
-         eBot_dfog = (vMid->fog - vMin->fog) * 256;
+         const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
+         const GLfloat eBot_dfog = vMid->fog - vMin->fog;
          dfogdx = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
-         fdfogdx = SignedFloatToFixed(dfogdx);
          dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx);
       }
 #endif
 
       {
          int subTriangle;
-         GLfixed fx, fxLeftEdge, fxRightEdge, fdxLeftEdge, fdxRightEdge;
+         GLfixed fx;
+         GLfixed fxLeftEdge=0, fxRightEdge=0, fdxLeftEdge=0, fdxRightEdge=0;
          GLfixed fdxOuter;
          int idxOuter;
          float dxOuter;
-         GLfixed fError, fdError;
+         GLfixed fError=0, fdError=0;
          float adjx, adjy;
          GLfixed fy;
-         int iy;
+         int iy=0;
 #ifdef PIXEL_ADDRESS
-         PIXEL_TYPE *pRow;
-         int dPRowOuter, dPRowInner;  /* offset in bytes */
+         PIXEL_TYPE *pRow=NULL;
+         int dPRowOuter=0, dPRowInner=0;  /* offset in bytes */
 #endif
 #ifdef INTERP_Z
 #  ifdef DEPTH_TYPE
-         DEPTH_TYPE *zRow;
-         int dZRowOuter, dZRowInner;  /* offset in bytes */
+         DEPTH_TYPE *zRow=NULL;
+         int dZRowOuter=0, dZRowInner=0;  /* offset in bytes */
 #  endif
-         GLfixed fz, fdzOuter, fdzInner;
+         GLfixed fz=0, fdzOuter=0, fdzInner;
 #endif
 #ifdef INTERP_FOG
-         GLfixed ffog, fdfogOuter, fdfogInner;
+         GLfloat fogLeft, dfogOuter, dfogInner;
 #endif
 #ifdef INTERP_RGB
-         GLfixed fr, fdrOuter, fdrInner;
-         GLfixed fg, fdgOuter, fdgInner;
-         GLfixed fb, fdbOuter, fdbInner;
+         GLfixed fr=0, fdrOuter=0, fdrInner;
+         GLfixed fg=0, fdgOuter=0, fdgInner;
+         GLfixed fb=0, fdbOuter=0, fdbInner;
 #endif
 #ifdef INTERP_SPEC
-         GLfixed fsr, fdsrOuter, fdsrInner;
-         GLfixed fsg, fdsgOuter, fdsgInner;
-         GLfixed fsb, fdsbOuter, fdsbInner;
+         GLfixed fsr=0, fdsrOuter=0, fdsrInner;
+         GLfixed fsg=0, fdsgOuter=0, fdsgInner;
+         GLfixed fsb=0, fdsbOuter=0, fdsbInner;
 #endif
 #ifdef INTERP_ALPHA
-         GLfixed fa, fdaOuter, fdaInner;
+         GLfixed fa=0, fdaOuter=0, fdaInner;
 #endif
 #ifdef INTERP_INDEX
-         GLfixed fi, fdiOuter, fdiInner;
+         GLfixed fi=0, fdiOuter=0, fdiInner;
 #endif
 #ifdef INTERP_INT_TEX
-         GLfixed fs, fdsOuter, fdsInner;
-         GLfixed ft, fdtOuter, fdtInner;
+         GLfixed fs=0, fdsOuter=0, fdsInner;
+         GLfixed ft=0, fdtOuter=0, fdtInner;
 #endif
 #ifdef INTERP_TEX
-         GLfloat sLeft, dsOuter, dsInner;
-         GLfloat tLeft, dtOuter, dtInner;
-         GLfloat uLeft, duOuter, duInner;
-         GLfloat vLeft, dvOuter, dvInner;
+         GLfloat sLeft=0, dsOuter=0, dsInner;
+         GLfloat tLeft=0, dtOuter=0, dtInner;
+         GLfloat uLeft=0, duOuter=0, duInner;
+         GLfloat vLeft=0, dvOuter=0, dvInner;
 #endif
 #ifdef INTERP_MULTITEX
          GLfloat sLeft[MAX_TEXTURE_UNITS];
                }
 #endif
 #ifdef INTERP_FOG
-               ffog = FloatToFixed(vLower->fog * 256 + dfogdx * adjx
-                                   + dfogdy * adjy) + FIXED_HALF;
-               fdfogOuter = SignedFloatToFixed(dfogdy + dxOuter * dfogdx);
+               fogLeft = vLower->fog + (dfogdx * adjx + dfogdy * adjy)
+                                       * (1.0F/FIXED_SCALE);
+               dfogOuter = dfogdy + dxOuter * dfogdx;
 #endif
 #ifdef INTERP_RGB
                fr = (GLfixed)(IntToFixed(vLower->color[0])
             fdzInner = fdzOuter + fdzdx;
 #endif
 #ifdef INTERP_FOG
-            fdfogInner = fdfogOuter + fdfogdx;
+            dfogInner = dfogOuter + dfogdx;
 #endif
 #ifdef INTERP_RGB
             fdrInner = fdrOuter + fdrdx;
                GLfixed ffz = fz;
 #endif
 #ifdef INTERP_FOG
-               GLfixed fffog = ffog;
+               GLfloat ffog = fogLeft;
 #endif
 #ifdef INTERP_RGB
                GLfixed ffr = fr,  ffg = fg,  ffb = fb;
                   fz += fdzOuter;
 #endif
 #ifdef INTERP_FOG
-                  ffog += fdfogOuter;
+                  fogLeft += dfogOuter;
 #endif
 #ifdef INTERP_RGB
                   fr += fdrOuter;   fg += fdgOuter;   fb += fdbOuter;
                   fz += fdzInner;
 #endif
 #ifdef INTERP_FOG
-                  ffog += fdfogInner;
+                  fogLeft += dfogInner;
 #endif
 #ifdef INTERP_RGB
                   fr += fdrInner;   fg += fdgInner;   fb += fdbInner;
index daace6920fd2fdca36135cf4e1a877cc6cff44ee..74053d0a5b29a1c8804c876fe5281930d97e2449 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_zoom.c,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_zoom.c,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -46,7 +46,7 @@
 void
 _mesa_write_zoomed_rgba_span( GLcontext *ctx,
                               GLuint n, GLint x, GLint y, const GLdepth z[],
-                              const GLfixed *fog,
+                              const GLfloat *fog,
                               CONST GLchan rgba[][4], GLint y0 )
 {
    GLint m;
@@ -54,7 +54,7 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
    GLint i, j, skipcol;
    GLchan zrgba[MAX_WIDTH][4];  /* zoomed pixel colors */
    GLdepth zdepth[MAX_WIDTH];  /* zoomed depth values */
-   GLfixed zfog[MAX_WIDTH];  /* zoomed fog values */
+   GLfloat zfog[MAX_WIDTH];  /* zoomed fog values */
    GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
    const GLuint *srcRGBA32 = (const GLuint *) rgba;
    GLuint *dstRGBA32 = (GLuint *) zrgba;
@@ -153,7 +153,7 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx,
 void
 _mesa_write_zoomed_rgb_span( GLcontext *ctx,
                              GLuint n, GLint x, GLint y, const GLdepth z[],
-                             const GLfixed *fog,
+                             const GLfloat *fog,
                              CONST GLchan rgb[][3], GLint y0 )
 {
    GLint m;
@@ -161,7 +161,7 @@ _mesa_write_zoomed_rgb_span( GLcontext *ctx,
    GLint i, j, skipcol;
    GLchan zrgba[MAX_WIDTH][4];  /* zoomed pixel colors */
    GLdepth zdepth[MAX_WIDTH];  /* zoomed depth values */
-   GLfixed zfog[MAX_WIDTH];  /* zoomed fog values */
+   GLfloat zfog[MAX_WIDTH];  /* zoomed fog values */
    GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
 
    /* compute width of output row */
@@ -266,7 +266,7 @@ _mesa_write_zoomed_rgb_span( GLcontext *ctx,
 void
 _mesa_write_zoomed_index_span( GLcontext *ctx,
                                GLuint n, GLint x, GLint y, const GLdepth z[],
-                               const GLfixed *fog,
+                               const GLfloat *fog,
                                const GLuint indexes[], GLint y0 )
 {
    GLint m;
@@ -274,7 +274,7 @@ _mesa_write_zoomed_index_span( GLcontext *ctx,
    GLint i, j, skipcol;
    GLuint zindexes[MAX_WIDTH];  /* zoomed color indexes */
    GLdepth zdepth[MAX_WIDTH];  /* zoomed depth values */
-   GLfixed zfog[MAX_WIDTH];  /* zoomed fog values */
+   GLfloat zfog[MAX_WIDTH];  /* zoomed fog values */
    GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
 
    /* compute width of output row */
index 170133c3dffddd608432ce0c879f9dae5de46f30..940970d7abf6bef646f1c2cfc18d44b3e7683a5c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_zoom.h,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_zoom.h,v 1.5 2001/05/03 22:13:32 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
 extern void
 _mesa_write_zoomed_rgba_span( GLcontext *ctx,
                               GLuint n, GLint x, GLint y, const GLdepth z[],
-                              const GLfixed *fog,
+                              const GLfloat *fog,
                               CONST GLchan rgba[][4], GLint y0 );
 
 
 extern void
 _mesa_write_zoomed_rgb_span( GLcontext *ctx,
                              GLuint n, GLint x, GLint y, const GLdepth z[],
-                             const GLfixed *fog,
+                             const GLfloat *fog,
                              CONST GLchan rgb[][3], GLint y0 );
 
 
 extern void
 _mesa_write_zoomed_index_span( GLcontext *ctx,
                                GLuint n, GLint x, GLint y, const GLdepth z[],
-                               const GLfixed *fog,
+                               const GLfloat *fog,
                                const GLuint indexes[], GLint y0 );