struct sw_span is again allocated on the stack, but the arrays of span
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 7 Aug 2002 00:45:07 +0000 (00:45 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 7 Aug 2002 00:45:07 +0000 (00:45 +0000)
data are broken out into a new struct span_arrays which is allocated
per-context (to avoid huge stack allocations - a problem on Windows).
This lets us use span.redStep instead of span->redStep (for example) to
hopefully get slightly better performance in the triangle functions.

25 files changed:
src/mesa/drivers/osmesa/osmesa.c
src/mesa/drivers/x11/xm_tri.c
src/mesa/swrast/s_aaline.c
src/mesa/swrast/s_aalinetemp.h
src/mesa/swrast/s_aatritemp.h
src/mesa/swrast/s_alpha.c
src/mesa/swrast/s_bitmap.c
src/mesa/swrast/s_blend.c
src/mesa/swrast/s_context.c
src/mesa/swrast/s_context.h
src/mesa/swrast/s_copypix.c
src/mesa/swrast/s_depth.c
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_fog.c
src/mesa/swrast/s_lines.c
src/mesa/swrast/s_logic.c
src/mesa/swrast/s_masking.c
src/mesa/swrast/s_pixeltex.c
src/mesa/swrast/s_pointtemp.h
src/mesa/swrast/s_span.c
src/mesa/swrast/s_stencil.c
src/mesa/swrast/s_texture.c
src/mesa/swrast/s_triangle.c
src/mesa/swrast/s_zoom.c
src/mesa/swrast/swrast.h

index 8a80ab75971b46ca851baab7a12ce6eec3c79533..51d6508283891ff416ecd24af9a926c2265913e8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.86 2002/07/09 01:22:51 brianp Exp $ */
+/* $Id: osmesa.c,v 1.87 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -1886,20 +1886,20 @@ static void smooth_rgba_z_triangle( GLcontext *ctx,
 #define INTERP_ALPHA 1
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLchan *img = PIXELADDR4(span->x, span->y);                         \
-   for (i = 0; i < span->end; i++, img += 4) {                 \
-      const GLdepth z = FixedToDepth(span->z);                 \
+   GLchan *img = PIXELADDR4(span.x, span.y);                   \
+   for (i = 0; i < span.end; i++, img += 4) {                  \
+      const GLdepth z = FixedToDepth(span.z);                  \
       if (z < zRow[i]) {                                       \
-         PACK_RGBA(img, FixedToChan(span->red),                        \
-            FixedToChan(span->green), FixedToChan(span->blue), \
-            FixedToChan(span->alpha));                         \
+         PACK_RGBA(img, FixedToChan(span.red),                 \
+            FixedToChan(span.green), FixedToChan(span.blue),   \
+            FixedToChan(span.alpha));                          \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                              \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->alpha += span->alphaStep;                          \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.alpha += span.alphaStep;                            \
+      span.z += span.zStep;                                    \
    }
 
 #ifdef WIN32
@@ -1930,14 +1930,14 @@ static void flat_rgba_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
-   GLuint *img = (GLuint *) PIXELADDR4(span->x, span->y);      \
-   for (i = 0; i < span->end; i++) {                   \
-      const GLdepth z = FixedToDepth(span->z);         \
+   GLuint *img = (GLuint *) PIXELADDR4(span.x, span.y);        \
+   for (i = 0; i < span.end; i++) {                    \
+      const GLdepth z = FixedToDepth(span.z);          \
       if (z < zRow[i]) {                               \
          img[i] = pixel;                               \
          zRow[i] = z;                                  \
       }                                                        \
-      span->z += span->zStep;                          \
+      span.z += span.zStep;                            \
    }
 
 #ifdef WIN32
index 8e68f708c0833a6a5a372f69757113511a750785..9184f0c08572990585dc7e404953007d107ddda6 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: xm_tri.c,v 1.26 2002/06/25 15:25:17 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.27 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  4.1
  *
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -68,21 +68,21 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx,
 #define INTERP_RGB 1
 
 #define RENDER_SPAN( span )                                    \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
          unsigned long p;                                      \
-         PACK_TRUECOLOR(p, FixedToInt(span->red),              \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         PACK_TRUECOLOR(p, FixedToInt(span.red),               \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          XMesaPutPixel(img, x, y, p);                          \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -108,17 +108,17 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++) {                            \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         pRow[i] = PACK_8B8G8R(FixedToInt(span->red),          \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         pRow[i] = PACK_8B8G8R(FixedToInt(span.red),           \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -143,17 +143,17 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++) {                            \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         pRow[i] = PACK_8R8G8B(FixedToInt(span->red),          \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         pRow[i] = PACK_8R8G8B(FixedToInt(span.red),           \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -178,19 +178,19 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++) {                            \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
         PIXEL_TYPE *ptr = pRow + i;                            \
-         ptr->r = FixedToInt(span->red);                               \
-         ptr->g = FixedToInt(span->green);                     \
-         ptr->b = FixedToInt(span->blue);                      \
+         ptr->r = FixedToInt(span.red);                                \
+         ptr->g = FixedToInt(span.green);                      \
+         ptr->b = FixedToInt(span.blue);                       \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -213,20 +213,20 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
          unsigned long p;                                      \
-         PACK_TRUEDITHER(p, x, y, FixedToInt(span->red),               \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         PACK_TRUEDITHER(p, x, y, FixedToInt(span.red),                \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          XMesaPutPixel(img, x, y, p);                          \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -251,17 +251,17 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++) {                            \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         pRow[i] = PACK_5R6G5B(FixedToInt(span->red),          \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         pRow[i] = PACK_5R6G5B(FixedToInt(span.red),           \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -286,18 +286,18 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span->red), \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red),  \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -322,19 +322,19 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    XDITHER_SETUP(y);                                           \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span->red),\
-            FixedToInt(span->green), FixedToInt(span->blue) ); \
+         pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),\
+            FixedToInt(span.green), FixedToInt(span.blue) );   \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -357,20 +357,20 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    XDITHER_SETUP(y);                                           \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         unsigned long p = XDITHER(x, FixedToInt(span->red),   \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         unsigned long p = XDITHER(x, FixedToInt(span.red),    \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
         XMesaPutPixel(img, x, y, p);                           \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -396,17 +396,17 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx,
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    LOOKUP_SETUP;                                               \
-   for (i = 0; i < span->end; i++) {                           \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++) {                            \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         pRow[i] = LOOKUP(FixedToInt(span->red),                       \
-            FixedToInt(span->green), FixedToInt(span->blue));  \
+         pRow[i] = LOOKUP(FixedToInt(span.red),                        \
+            FixedToInt(span.green), FixedToInt(span.blue));    \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -432,18 +432,18 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
-         pRow[i] = DITHER_HPCR(x, y, FixedToInt(span->red),    \
-            FixedToInt(span->green), FixedToInt(span->blue) ); \
+         pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red),     \
+            FixedToInt(span.green), FixedToInt(span.blue) );   \
          zRow[i] = z;                                          \
       }                                                                \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
-      span->z += span->zStep;                                  \
+      span.red += span.redStep;                                        \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -468,14 +468,14 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
          XMesaPutPixel(img, x, y, pixel);                      \
          zRow[i] = z;                                          \
       }                                                                \
-      span->z += span->zStep;                                  \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -501,13 +501,13 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx,
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
-   for (i = 0; i < span->end; i++) {                   \
-      const DEPTH_TYPE z = FixedToDepth(span->z);      \
+   for (i = 0; i < span.end; i++) {                    \
+      const DEPTH_TYPE z = FixedToDepth(span.z);       \
       if (z < zRow[i]) {                               \
         pRow[i] = (PIXEL_TYPE) p;                      \
          zRow[i] = z;                                  \
       }                                                        \
-      span->z += span->zStep;                          \
+      span.z += span.zStep;                            \
    }
 
 #include "swrast/s_tritemp.h"
@@ -533,13 +533,13 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx,
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                    \
    GLuint i;                                   \
-   for (i = 0; i < span->end; i++) {           \
-      DEPTH_TYPE z = FixedToDepth(span->z);    \
+   for (i = 0; i < span.end; i++) {            \
+      DEPTH_TYPE z = FixedToDepth(span.z);     \
       if (z < zRow[i]) {                       \
         pRow[i] = (PIXEL_TYPE) p;              \
          zRow[i] = z;                          \
       }                                                \
-      span->z += span->zStep;                  \
+      span.z += span.zStep;                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -563,8 +563,8 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
-   for (i = 0; i < span->end; i++) {                   \
-      const DEPTH_TYPE z = FixedToDepth(span->z);      \
+   for (i = 0; i < span.end; i++) {                    \
+      const DEPTH_TYPE z = FixedToDepth(span.z);       \
       if (z < zRow[i]) {                               \
         PIXEL_TYPE *ptr = pRow + i;                    \
          ptr->r = color[RCOMP];                                \
@@ -572,7 +572,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
          ptr->b = color[BCOMP];                                \
          zRow[i] = z;                                  \
       }                                                        \
-      span->z += span->zStep;                          \
+      span.z += span.zStep;                            \
    }
 
 #include "swrast/s_tritemp.h"
@@ -593,9 +593,9 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
          unsigned long p;                                      \
          PACK_TRUEDITHER(p, x, y, v2->color[0],                        \
@@ -603,7 +603,7 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
          XMesaPutPixel(img, x, y, p);                          \
          zRow[i] = z;                                          \
       }                                                                \
-      span->z += span->zStep;                                  \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -629,13 +629,13 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx,
             v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
-   for (i = 0; i < span->end; i++) {                   \
-      const DEPTH_TYPE z = FixedToDepth(span->z);      \
+   for (i = 0; i < span.end; i++) {                    \
+      const DEPTH_TYPE z = FixedToDepth(span.z);       \
       if (z < zRow[i]) {                               \
         pRow[i] = (PIXEL_TYPE) p;                      \
          zRow[i] = z;                                  \
       }                                                        \
-      span->z += span->zStep;                          \
+      span.z += span.zStep;                            \
    }
 
 #include "swrast/s_tritemp.h"
@@ -659,15 +659,15 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
         PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP],           \
                         color[GCOMP], color[BCOMP]);           \
          zRow[i] = z;                                          \
       }                                                                \
-      span->z += span->zStep;                                  \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -693,15 +693,15 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y));           \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
         pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x);                 \
          zRow[i] = z;                                          \
       }                                                                \
-      span->z += span->zStep;                                  \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -725,16 +725,16 @@ static void flat_DITHER_z_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    FLAT_DITHER_ROW_SETUP(y);                                   \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
          unsigned long p = FLAT_DITHER(x);                     \
         XMesaPutPixel(img, x, y, p);                           \
          zRow[i] = z;                                          \
       }                                                                \
-      span->z += span->zStep;                                  \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -761,14 +761,14 @@ static void flat_HPCR_z_triangle( GLcontext *ctx,
    GLubyte b = v2->color[2];
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      const DEPTH_TYPE z = FixedToDepth(span->z);              \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      const DEPTH_TYPE z = FixedToDepth(span.z);               \
       if (z < zRow[i]) {                                       \
         pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b);     \
          zRow[i] = z;                                          \
       }                                                                \
-      span->z += span->zStep;                                  \
+      span.z += span.zStep;                                    \
    }
 
 #include "swrast/s_tritemp.h"
@@ -797,13 +797,13 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx,
    GLubyte p = LOOKUP(r,g,b);
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
-   for (i = 0; i < span->end; i++) {                   \
-      const DEPTH_TYPE z = FixedToDepth(span->z);      \
+   for (i = 0; i < span.end; i++) {                    \
+      const DEPTH_TYPE z = FixedToDepth(span.z);       \
       if (z < zRow[i]) {                               \
         pRow[i] = p;                                   \
          zRow[i] = z;                                  \
       }                                                        \
-      span->z += span->zStep;                          \
+      span.z += span.zStep;                            \
    }
 
 #include "swrast/s_tritemp.h"
@@ -824,15 +824,15 @@ static void smooth_TRUECOLOR_triangle( GLcontext *ctx,
 #define INTERP_RGB 1
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
       unsigned long p;                                         \
-      PACK_TRUECOLOR(p, FixedToInt(span->red),                 \
-         FixedToInt(span->green), FixedToInt(span->blue));     \
+      PACK_TRUECOLOR(p, FixedToInt(span.red),                  \
+         FixedToInt(span.green), FixedToInt(span.blue));       \
       XMesaPutPixel(img, x, y, p);                             \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -854,12 +854,12 @@ static void smooth_8A8B8G8R_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      pRow[i] = PACK_8B8G8R(FixedToInt(span->red),             \
-         FixedToInt(span->green), FixedToInt(span->blue) );    \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+   for (i = 0; i < span.end; i++) {                            \
+      pRow[i] = PACK_8B8G8R(FixedToInt(span.red),              \
+         FixedToInt(span.green), FixedToInt(span.blue) );      \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }                                                           \
 
 #include "swrast/s_tritemp.h"
@@ -881,12 +881,12 @@ static void smooth_8R8G8B_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      pRow[i] = PACK_8R8G8B(FixedToInt(span->red),             \
-         FixedToInt(span->green), FixedToInt(span->blue) );    \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+   for (i = 0; i < span.end; i++) {                            \
+      pRow[i] = PACK_8R8G8B(FixedToInt(span.red),              \
+         FixedToInt(span.green), FixedToInt(span.blue) );      \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -909,13 +909,13 @@ static void smooth_8R8G8B24_triangle( GLcontext *ctx,
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
    PIXEL_TYPE *pixel = pRow;                           \
-   for (i = 0; i < span->end; i++, pixel++) {          \
-      pixel->r = FixedToInt(span->red);                        \
-      pixel->g = FixedToInt(span->green);              \
-      pixel->b = FixedToInt(span->blue);                       \
-      span->red += span->redStep;                              \
-      span->green += span->greenStep;                  \
-      span->blue += span->blueStep;                    \
+   for (i = 0; i < span.end; i++, pixel++) {           \
+      pixel->r = FixedToInt(span.red);                 \
+      pixel->g = FixedToInt(span.green);               \
+      pixel->b = FixedToInt(span.blue);                \
+      span.red += span.redStep;                        \
+      span.green += span.greenStep;                    \
+      span.blue += span.blueStep;                      \
    }
 
 #include "swrast/s_tritemp.h"
@@ -935,15 +935,15 @@ static void smooth_TRUEDITHER_triangle( GLcontext *ctx,
 #define INTERP_RGB 1
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
       unsigned long p;                                         \
-      PACK_TRUEDITHER(p, x, y, FixedToInt(span->red),          \
-         FixedToInt(span->green), FixedToInt(span->blue));     \
+      PACK_TRUEDITHER(p, x, y, FixedToInt(span.red),           \
+         FixedToInt(span.green), FixedToInt(span.blue));       \
       XMesaPutPixel(img, x, y, p );                            \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -965,12 +965,12 @@ static void smooth_5R6G5B_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   for (i = 0; i < span->end; i++) {                           \
-      pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span->red),        \
-         FixedToInt(span->green), FixedToInt(span->blue));     \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+   for (i = 0; i < span.end; i++) {                            \
+      pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \
+         FixedToInt(span.green), FixedToInt(span.blue));       \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -992,13 +992,13 @@ static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span->red),    \
-         FixedToInt(span->green), FixedToInt(span->blue));     \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red),     \
+         FixedToInt(span.green), FixedToInt(span.blue));       \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -1020,14 +1020,14 @@ static void smooth_DITHER8_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    XDITHER_SETUP(y);                                           \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span->red), \
-         FixedToInt(span->green), FixedToInt(span->blue) );    \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),  \
+         FixedToInt(span.green), FixedToInt(span.blue) );      \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -1044,19 +1044,18 @@ static void smooth_DITHER_triangle( GLcontext *ctx,
 {
    XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
    XMesaImage *img = xmesa->xm_buffer->backimage;
-
 #define INTERP_RGB 1
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    XDITHER_SETUP(y);                                           \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      unsigned long p = XDITHER(x, FixedToInt(span->red),      \
-         FixedToInt(span->green), FixedToInt(span->blue) );    \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      unsigned long p = XDITHER(x, FixedToInt(span.red),       \
+         FixedToInt(span.green), FixedToInt(span.blue) );      \
       XMesaPutPixel(img, x, y, p);                             \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -1072,7 +1071,6 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx,
                                     const SWvertex *v2 )
 {
    XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLubyte
@@ -1080,12 +1078,12 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx,
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
    LOOKUP_SETUP;                                       \
-   for (i = 0; i < span->end; i++) {                   \
-      pRow[i] = LOOKUP(FixedToInt(span->red),          \
-         FixedToInt(span->green), FixedToInt(span->blue));\
-      span->red += span->redStep;                              \
-      span->green += span->greenStep;                  \
-      span->blue += span->blueStep;                    \
+   for (i = 0; i < span.end; i++) {                    \
+      pRow[i] = LOOKUP(FixedToInt(span.red),           \
+         FixedToInt(span.green), FixedToInt(span.blue));\
+      span.red += span.redStep;                        \
+      span.green += span.greenStep;                    \
+      span.blue += span.blueStep;                      \
    }
 
 #include "swrast/s_tritemp.h"
@@ -1102,20 +1100,19 @@ static void smooth_HPCR_triangle( GLcontext *ctx,
                                  const SWvertex *v2 )
 {
    XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLubyte
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
-      pRow[i] = DITHER_HPCR(x, y, FixedToInt(span->red),               \
-         FixedToInt(span->green), FixedToInt(span->blue));     \
-      span->red += span->redStep;                                      \
-      span->green += span->greenStep;                          \
-      span->blue += span->blueStep;                            \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
+      pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red),        \
+         FixedToInt(span.green), FixedToInt(span.blue));       \
+      span.red += span.redStep;                                \
+      span.green += span.greenStep;                            \
+      span.blue += span.blueStep;                              \
    }
 
 #include "swrast/s_tritemp.h"
@@ -1138,8 +1135,8 @@ static void flat_TRUECOLOR_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
       XMesaPutPixel(img, x, y, pixel);                         \
    }
 
@@ -1164,7 +1161,7 @@ static void flat_8A8B8G8R_triangle( GLcontext *ctx,
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                    \
    GLuint i;                                   \
-   for (i = 0; i < span->end; i++) {           \
+   for (i = 0; i < span.end; i++) {            \
       pRow[i] = (PIXEL_TYPE) p;                        \
    }
 
@@ -1189,7 +1186,7 @@ static void flat_8R8G8B_triangle( GLcontext *ctx,
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                    \
    GLuint i;                                   \
-   for (i = 0; i < span->end; i++) {           \
+   for (i = 0; i < span.end; i++) {            \
       pRow[i] = (PIXEL_TYPE) p;                        \
    }
 
@@ -1213,7 +1210,7 @@ static void flat_8R8G8B24_triangle( GLcontext *ctx,
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
    PIXEL_TYPE *pixel = pRow;                           \
-   for (i = 0; i < span->end; i++, pixel++) {          \
+   for (i = 0; i < span.end; i++, pixel++) {           \
       pixel->r = color[RCOMP];                         \
       pixel->g = color[GCOMP];                         \
       pixel->b = color[BCOMP];                         \
@@ -1232,11 +1229,10 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx,
 {
    XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
    XMesaImage *img = xmesa->xm_buffer->backimage;
-
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
       unsigned long p;                                         \
       PACK_TRUEDITHER(p, x, y, v2->color[0],                   \
                v2->color[1], v2->color[2] );                   \
@@ -1260,12 +1256,12 @@ static void flat_5R6G5B_triangle( GLcontext *ctx,
 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLushort
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-#define SETUP_CODE                                     \
+#define SETUP_CODE                             \
    unsigned long p = PACK_5R6G5B( v2->color[0],        \
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                    \
    GLuint i;                                   \
-   for (i = 0; i < span->end; i++) {           \
+   for (i = 0; i < span.end; i++) {            \
       pRow[i] = (PIXEL_TYPE) p;                        \
    }
 
@@ -1288,8 +1284,8 @@ static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx,
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
       PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP],             \
          color[GCOMP], color[BCOMP]);                          \
    }
@@ -1315,9 +1311,9 @@ static void flat_DITHER8_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y));           \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   for (i = 0; i < span.end; i++, x++) {                       \
       pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x);                   \
    }
 
@@ -1340,9 +1336,9 @@ static void flat_DITHER_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
    FLAT_DITHER_ROW_SETUP(y);                                   \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   for (i = 0; i < span.end; i++, x++) {                       \
       unsigned long p = FLAT_DITHER(x);                                \
       XMesaPutPixel(img, x, y, p );                            \
    }
@@ -1363,14 +1359,14 @@ static void flat_HPCR_triangle( GLcontext *ctx,
 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLubyte
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-#define SETUP_CODE                             \
+#define SETUP_CODE             \
    GLubyte r = v2->color[0];   \
    GLubyte g = v2->color[1];   \
    GLubyte b = v2->color[2];
-#define RENDER_SPAN( span )                            \
+#define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
-   GLint x = span->x, y = FLIP(xmesa->xm_buffer, span->y);     \
-   for (i = 0; i < span->end; i++, x++) {                      \
+   GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
+   for (i = 0; i < span.end; i++, x++) {                       \
       pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b);       \
    }
 
@@ -1398,7 +1394,7 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx,
    GLubyte p = LOOKUP(r,g,b);
 #define RENDER_SPAN( span )                    \
    GLuint i;                                   \
-   for (i = 0; i < span->end; i++) {           \
+   for (i = 0; i < span.end; i++) {            \
       pRow[i] = (PIXEL_TYPE) p;                        \
    }
 
index 5805fb3d062d5b4c3928efe05a7e3d3dfd78d7a2..663d43ec87d8df9cd1507af991eff6afbaa3b481 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_aaline.c,v 1.15 2002/06/15 03:03:10 brianp Exp $ */
+/* $Id: s_aaline.c,v 1.16 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -76,7 +76,7 @@ struct LineInfo
    GLfloat lambda[MAX_TEXTURE_UNITS];
    GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS];
 
-   struct sw_span *span;
+   struct sw_span span;
 };
 
 
index 3bd516ba8748edbf860ca815cda9e59f19aa53d7..4fffd0423ed9a9f8221d1e6d62e980002b81cf43 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_aalinetemp.h,v 1.20 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.21 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -39,47 +39,47 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
    const GLfloat fx = (GLfloat) ix;
    const GLfloat fy = (GLfloat) iy;
    const GLfloat coverage = compute_coveragef(line, ix, iy);
-   const GLuint i = line->span->end;
+   const GLuint i = line->span.end;
 
    if (coverage == 0.0)
       return;
 
-   line->span->end++;
-   line->span->coverage[i] = coverage;
-   line->span->xArray[i] = ix;
-   line->span->yArray[i] = iy;
+   line->span.end++;
+   line->span.array->coverage[i] = coverage;
+   line->span.array->x[i] = ix;
+   line->span.array->y[i] = iy;
 
    /*
     * Compute Z, color, texture coords, fog for the fragment by
     * solving the plane equations at (ix,iy).
     */
 #ifdef DO_Z
-   line->span->zArray[i] = (GLdepth) solve_plane(fx, fy, line->zPlane);
+   line->span.array->z[i] = (GLdepth) solve_plane(fx, fy, line->zPlane);
 #endif
 #ifdef DO_FOG
-   line->span->fogArray[i] = solve_plane(fx, fy, line->fPlane);
+   line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane);
 #endif
 #ifdef DO_RGBA
-   line->span->color.rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
-   line->span->color.rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
-   line->span->color.rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
-   line->span->color.rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
+   line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane);
+   line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane);
+   line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane);
+   line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane);
 #endif
 #ifdef DO_INDEX
-   line->span->color.index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
+   line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
 #endif
 #ifdef DO_SPEC
-   line->span->specArray[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane);
-   line->span->specArray[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane);
-   line->span->specArray[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
+   line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane);
+   line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane);
+   line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane);
 #endif
 #ifdef DO_TEX
    {
       const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[0]);
-      line->span->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
-      line->span->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
-      line->span->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
-      line->span->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ,
+      line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ;
+      line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ;
+      line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ;
+      line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ,
                                           line->texWidth[0], line->texHeight[0]);
    }
 #elif defined(DO_MULTITEX)
@@ -88,10 +88,10 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
       for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
          if (ctx->Texture.Unit[unit]._ReallyEnabled) {
             const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[unit]);
-            line->span->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
-            line->span->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
-            line->span->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
-            line->span->lambda[unit][i] = compute_lambda(line->sPlane[unit],
+            line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ;
+            line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ;
+            line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ;
+            line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit],
                                                line->tPlane[unit], invQ,
                                                line->texWidth[unit], line->texHeight[unit]);
          }
@@ -99,15 +99,15 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
    }
 #endif
 
-   if (line->span->end == MAX_WIDTH) {
+   if (line->span.end == MAX_WIDTH) {
 #if defined(DO_TEX) || defined(DO_MULTITEX)
-      _mesa_write_texture_span(ctx, line->span);
+      _mesa_write_texture_span(ctx, &(line->span));
 #elif defined(DO_RGBA)
-      _mesa_write_rgba_span(ctx, line->span);
+      _mesa_write_rgba_span(ctx, &(line->span));
 #else
-      _mesa_write_index_span(ctx, line->span);
+      _mesa_write_index_span(ctx, &(line->span));
 #endif
-      line->span->end = 0; /* reset counter */
+      line->span.end = 0; /* reset counter */
    }
 }
 
@@ -138,24 +138,23 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
    if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
       return;
 
-   line.span = swrast->span; 
    INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE);
 
    line.xAdj = line.dx / line.len * line.halfWidth;
    line.yAdj = line.dy / line.len * line.halfWidth;
 
 #ifdef DO_Z
-   line.span->arrayMask |= SPAN_Z;
+   line.span.arrayMask |= SPAN_Z;
    compute_plane(line.x0, line.y0, line.x1, line.y1,
                  v0->win[2], v1->win[2], line.zPlane);
 #endif
 #ifdef DO_FOG
-   line.span->arrayMask |= SPAN_FOG;
+   line.span.arrayMask |= SPAN_FOG;
    compute_plane(line.x0, line.y0, line.x1, line.y1,
                  v0->fog, v1->fog, line.fPlane);
 #endif
 #ifdef DO_RGBA
-   line.span->arrayMask |= SPAN_RGBA;
+   line.span.arrayMask |= SPAN_RGBA;
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
       compute_plane(line.x0, line.y0, line.x1, line.y1,
                     v0->color[RCOMP], v1->color[RCOMP], line.rPlane);
@@ -174,7 +173,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
    }
 #endif
 #ifdef DO_SPEC
-   line.span->arrayMask |= SPAN_SPEC;
+   line.span.arrayMask |= SPAN_SPEC;
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
       compute_plane(line.x0, line.y0, line.x1, line.y1,
                     v0->specular[RCOMP], v1->specular[RCOMP], line.srPlane);
@@ -190,7 +189,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
    }
 #endif
 #ifdef DO_INDEX
-   line.span->arrayMask |= SPAN_INDEX;
+   line.span.arrayMask |= SPAN_INDEX;
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
       compute_plane(line.x0, line.y0, line.x1, line.y1,
                     (GLfloat) v0->index, (GLfloat) v1->index, line.iPlane);
@@ -213,7 +212,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
       const GLfloat r1 = v1->texcoord[0][2] * invW0;
       const GLfloat q0 = v0->texcoord[0][3] * invW0;
       const GLfloat q1 = v1->texcoord[0][3] * invW0;
-      line.span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+      line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
       compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]);
       compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]);
       compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]);
@@ -224,7 +223,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
 #elif defined(DO_MULTITEX)
    {
       GLuint u;
-      line.span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+      line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
       for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
          if (ctx->Texture.Unit[u]._ReallyEnabled) {
             const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
@@ -295,11 +294,11 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
    }
 
 #if defined(DO_TEX) || defined(DO_MULTITEX)
-   _mesa_write_texture_span(ctx, line.span);
+   _mesa_write_texture_span(ctx, &(line.span));
 #elif defined(DO_RGBA)
-   _mesa_write_rgba_span(ctx, line.span);
+   _mesa_write_rgba_span(ctx, &(line.span));
 #else
-   _mesa_write_index_span(ctx, line.span);
+   _mesa_write_index_span(ctx, &(line.span));
 #endif
 }
 
index 18c611e01768b39ae1e8b2c17e4dbf7855cd4a7b..0a70cf184f2113dd52c1e293581efcf3b0c6a0ac 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_aatritemp.h,v 1.29 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.30 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -53,7 +53,7 @@
    GLboolean ltor;
    GLfloat majDx, majDy;  /* major (i.e. long) edge dx and dy */
    
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
    
 #ifdef DO_Z
    GLfloat zPlane[4];
     */
 #ifdef DO_Z
    compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane);
-   span->arrayMask |= SPAN_Z;
+   span.arrayMask |= SPAN_Z;
 #endif
 #ifdef DO_FOG
    compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
-   span->arrayMask |= SPAN_FOG;
+   span.arrayMask |= SPAN_FOG;
 #endif
 #ifdef DO_RGBA
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
       constant_plane(v2->color[BCOMP], bPlane);
       constant_plane(v2->color[ACOMP], aPlane);
    }
-   span->arrayMask |= SPAN_RGBA;
+   span.arrayMask |= SPAN_RGBA;
 #endif
 #ifdef DO_INDEX
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
    else {
       constant_plane((GLfloat) v2->index, iPlane);
    }
-   span->arrayMask |= SPAN_INDEX;
+   span.arrayMask |= SPAN_INDEX;
 #endif
 #ifdef DO_SPEC
    if (ctx->Light.ShadeModel == GL_SMOOTH) {
       constant_plane(v2->specular[GCOMP], sgPlane);
       constant_plane(v2->specular[BCOMP], sbPlane);
    }
-   span->arrayMask |= SPAN_SPEC;
+   span.arrayMask |= SPAN_SPEC;
 #endif
 #ifdef DO_TEX
    {
       texWidth = (GLfloat) texImage->Width;
       texHeight = (GLfloat) texImage->Height;
    }
-   span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+   span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
 #elif defined(DO_MULTITEX)
    {
       GLuint u;
          }
       }
    }
-   span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+   span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
 #endif
 
    /* Begin bottom-to-top scan over the triangle.
          while (coverage > 0.0F) {
             /* (cx,cy) = center of fragment */
             const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+            struct span_arrays *array = span.array;
 #ifdef DO_INDEX
-            span->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
+            array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
 #else
-            span->coverage[count] = coverage;
+            array->coverage[count] = coverage;
 #endif
 #ifdef DO_Z
-            span->zArray[count] = (GLdepth) solve_plane(cx, cy, zPlane);
+            array->z[count] = (GLdepth) solve_plane(cx, cy, zPlane);
 #endif
 #ifdef DO_FOG
-           span->fogArray[count] = solve_plane(cx, cy, fogPlane);
+           array->fog[count] = solve_plane(cx, cy, fogPlane);
 #endif
 #ifdef DO_RGBA
-            span->color.rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
-            span->color.rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
-            span->color.rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
-            span->color.rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
+            array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane);
+            array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane);
+            array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane);
+            array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane);
 #endif
 #ifdef DO_INDEX
-            span->color.index[count] = (GLint) solve_plane(cx, cy, iPlane);
+            array->index[count] = (GLint) solve_plane(cx, cy, iPlane);
 #endif
 #ifdef DO_SPEC
-            span->specArray[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
-            span->specArray[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
-            span->specArray[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
+            array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane);
+            array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
+            array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
 #endif
 #ifdef DO_TEX
             {
                const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
-               span->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
-               span->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
-               span->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
-               span->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
+               array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ;
+               array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ;
+               array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ;
+               array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane,
                                                       cx, cy, invQ,
                                                       texWidth, texHeight);
             }
                for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
                   if (ctx->Texture.Unit[unit]._ReallyEnabled) {
                      GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
-                     span->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
-                     span->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
-                     span->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
-                     span->lambda[unit][count] = compute_lambda(sPlane[unit],
+                     array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+                     array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+                     array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+                     array->lambda[unit][count] = compute_lambda(sPlane[unit],
                                       tPlane[unit], vPlane[unit], cx, cy, invQ,
                                       texWidth[unit], texHeight[unit]);
                   }
          if (ix <= startX)
             continue;
          
-         span->x = startX;
-         span->y = iy;
-         span->end = (GLuint) ix - (GLuint) startX;
-         ASSERT(span->interpMask == 0);
+         span.x = startX;
+         span.y = iy;
+         span.end = (GLuint) ix - (GLuint) startX;
+         ASSERT(span.interpMask == 0);
 #if defined(DO_MULTITEX) || defined(DO_TEX)
-         _mesa_write_texture_span(ctx, span);
+         _mesa_write_texture_span(ctx, &span);
 #elif defined(DO_RGBA)
-         _mesa_write_rgba_span(ctx, span);
+         _mesa_write_rgba_span(ctx, &span);
 #elif defined(DO_INDEX)
-         _mesa_write_index_span(ctx, span);
+         _mesa_write_index_span(ctx, &span);
 #endif
       }
    }
          while (coverage > 0.0F) {
             /* (cx,cy) = center of fragment */
             const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
+            struct span_arrays *array = span.array;
 #ifdef DO_INDEX
-            span->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
+            array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
 #else
-            span->coverage[ix] = coverage;
+            array->coverage[ix] = coverage;
 #endif
 #ifdef DO_Z
-            span->zArray[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
+            array->z[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
 #endif
 #ifdef DO_FOG
-            span->fogArray[ix] = solve_plane(cx, cy, fogPlane);
+            array->fog[ix] = solve_plane(cx, cy, fogPlane);
 #endif
 #ifdef DO_RGBA
-            span->color.rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
-            span->color.rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
-            span->color.rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
-            span->color.rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
+            array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane);
+            array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane);
+            array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane);
+            array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane);
 #endif
 #ifdef DO_INDEX
-            span->color.index[ix] = (GLint) solve_plane(cx, cy, iPlane);
+            array->index[ix] = (GLint) solve_plane(cx, cy, iPlane);
 #endif
 #ifdef DO_SPEC
-            span->specArray[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
-            span->specArray[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
-            span->specArray[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
+            array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane);
+            array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane);
+            array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane);
 #endif
 #ifdef DO_TEX
             {
                const GLfloat invQ = solve_plane_recip(cx, cy, vPlane);
-               span->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
-               span->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
-               span->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
-               span->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
+               array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ;
+               array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ;
+               array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ;
+               array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane,
                                           cx, cy, invQ, texWidth, texHeight);
             }
 #elif defined(DO_MULTITEX)
                for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
                   if (ctx->Texture.Unit[unit]._ReallyEnabled) {
                      GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]);
-                     span->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
-                     span->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
-                     span->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
-                     span->lambda[unit][ix] = compute_lambda(sPlane[unit],
+                     array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ;
+                     array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ;
+                     array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ;
+                     array->lambda[unit][ix] = compute_lambda(sPlane[unit],
                                                             tPlane[unit],
                                                             vPlane[unit],
                                                             cx, cy, invQ,
          /* shift all values to the left */
          /* XXX this is temporary */
          {
+            struct span_arrays *array = span.array;
             GLint j;
             for (j = 0; j < (GLint) n; j++) {
 #ifdef DO_RGBA
-               COPY_4V(span->color.rgba[j], span->color.rgba[j + left]);
+               COPY_4V(array->rgba[j], array->rgba[j + left]);
 #endif
 #ifdef DO_SPEC
-               COPY_4V(span->specArray[j], span->specArray[j + left]);
+               COPY_4V(array->spec[j], array->spec[j + left]);
 #endif
 #ifdef DO_INDEX
-               span->color.index[j] = span->color.index[j + left];
+               array->index[j] = array->index[j + left];
 #endif
 #ifdef DO_Z
-               span->zArray[j] = span->zArray[j + left];
+               array->z[j] = array->z[j + left];
 #endif
 #ifdef DO_FOG
-               span->fogArray[j] = span->fogArray[j + left];
+               array->fog[j] = array->fog[j + left];
 #endif
 #ifdef DO_TEX
-               COPY_4V(span->texcoords[0][j], span->texcoords[0][j + left]);
+               COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]);
 #endif
 #if defined(DO_MULTITEX) || defined(DO_TEX)
-               span->lambda[0][j] = span->lambda[0][j + left];
+               array->lambda[0][j] = array->lambda[0][j + left];
 #endif
-               span->coverage[j] = span->coverage[j + left];
+               array->coverage[j] = array->coverage[j + left];
             }
          }
 #ifdef DO_MULTITEX
          /* shift texcoords */
          {
+            struct span_arrays *array = span.array;
             GLuint unit;
             for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
                if (ctx->Texture.Unit[unit]._ReallyEnabled) {
                   GLint j;
                   for (j = 0; j < (GLint) n; j++) {
-                    span->texcoords[unit][j][0] = span->texcoords[unit][j + left][0];
-                     span->texcoords[unit][j][1] = span->texcoords[unit][j + left][1];
-                     span->texcoords[unit][j][2] = span->texcoords[unit][j + left][2];
-                     span->lambda[unit][j] = span->lambda[unit][j + left];
+                    array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0];
+                     array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1];
+                     array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2];
+                     array->lambda[unit][j] = array->lambda[unit][j + left];
                   }
                }
             }
          }
 #endif
 
-         span->x = left;
-         span->y = iy;
-         span->end = n;
-         ASSERT(span->interpMask == 0);
+         span.x = left;
+         span.y = iy;
+         span.end = n;
+         ASSERT(span.interpMask == 0);
 #if defined(DO_MULTITEX) || defined(DO_TEX)
-         _mesa_write_texture_span(ctx, span);
+         _mesa_write_texture_span(ctx, &span);
 #elif defined(DO_RGBA)
-         _mesa_write_rgba_span(ctx, span);
+         _mesa_write_rgba_span(ctx, &span);
 #elif defined(DO_INDEX)
-         _mesa_write_index_span(ctx, span);
+         _mesa_write_index_span(ctx, &span);
 #endif
       }
    }
index de7258fddfb5fc19cea8c5daa1b5004a0a7cf2b6..79e27d5755ebcc328abf64a8409dc6ba723d5c17 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_alpha.c,v 1.10 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_alpha.c,v 1.11 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
 GLint
 _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span )
 {
-   const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->color.rgba;
+   const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->array->rgba;
    const GLchan ref = ctx->Color.AlphaRef;
    const GLuint n = span->end;
-   GLubyte *mask = span->mask;
+   GLubyte *mask = span->array->mask;
    GLuint i;
 
    if (span->arrayMask & SPAN_RGBA) {
index 1525908b2336947d83773e4bc665ada833795352..abe5825d9d24228f50352cb0f8e056bea5f176f0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_bitmap.c,v 1.18 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_bitmap.c,v 1.19 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -53,7 +53,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLint row, col;
    GLuint count = 0;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    ASSERT(ctx->RenderMode == GL_RENDER);
    ASSERT(bitmap);
@@ -66,25 +66,25 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
 
    if (ctx->Visual.rgbMode) {
-      span->interpMask |= SPAN_RGBA;
-      span->red   = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
-      span->green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
-      span->blue  = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
-      span->alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
-      span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+      span.interpMask |= SPAN_RGBA;
+      span.red   = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
+      span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
+      span.blue  = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
+      span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
+      span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
    }
    else {
-      span->interpMask |= SPAN_INDEX;
-      span->index = ChanToFixed(ctx->Current.RasterIndex);
-      span->indexStep = 0;
+      span.interpMask |= SPAN_INDEX;
+      span.index = ChanToFixed(ctx->Current.RasterIndex);
+      span.indexStep = 0;
    }
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
-   for (row = 0; row < height; row++, span->y++) {
+   for (row = 0; row < height; row++, span.y++) {
       const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack,
                  bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
 
@@ -93,8 +93,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
          GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
          for (col = 0; col < width; col++) {
             if (*src & mask) {
-               span->xArray[count] = px + col;
-               span->yArray[count] = py + row;
+               span.array->x[count] = px + col;
+               span.array->y[count] = py + row;
                count++;
             }
             if (mask == 128U) {
@@ -115,8 +115,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
          GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
          for (col = 0; col < width; col++) {
             if (*src & mask) {
-               span->xArray[count] = px + col;
-               span->yArray[count] = py + row;
+               span.array->x[count] = px + col;
+               span.array->y[count] = py + row;
                count++;
             }
             if (mask == 1U) {
@@ -135,12 +135,12 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
 
       if (count + width >= MAX_WIDTH || row + 1 == height) {
          /* flush the span */
-         span->end = count;
+         span.end = count;
          if (ctx->Visual.rgbMode)
-            _mesa_write_rgba_span(ctx, span);
+            _mesa_write_rgba_span(ctx, &span);
          else
-            _mesa_write_index_span(ctx, span);
-         span->end = 0;
+            _mesa_write_index_span(ctx, &span);
+         span.end = 0;
          count = 0;
       }
    }
@@ -155,7 +155,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
  * fragments, initializing the mask array to indicate which fragmens to
  * draw or skip.
  */
-
 void
 _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
                GLsizei width, GLsizei height,
@@ -164,7 +163,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLint row, col;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    ASSERT(ctx->RenderMode == GL_RENDER);
    ASSERT(bitmap);
@@ -175,30 +174,31 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
       _swrast_validate_derived( ctx );
 
    INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK);
-   /*span->arrayMask |= SPAN_MASK;*/  /* we'll init span->mask[] */
-   span->x = px;
-   span->y = py;
-   /*span->end = width;*/
+
+   /*span.arrayMask |= SPAN_MASK;*/  /* we'll init span.mask[] */
+   span.x = px;
+   span.y = py;
+   /*span.end = width;*/
    if (ctx->Visual.rgbMode) {
-      span->interpMask |= SPAN_RGBA;
-      span->red   = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
-      span->green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
-      span->blue  = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
-      span->alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
-      span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+      span.interpMask |= SPAN_RGBA;
+      span.red   = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF);
+      span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF);
+      span.blue  = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF);
+      span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF);
+      span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
    }
    else {
-      span->interpMask |= SPAN_INDEX;
-      span->index = ChanToFixed(ctx->Current.RasterIndex);
-      span->indexStep = 0;
+      span.interpMask |= SPAN_INDEX;
+      span.index = ChanToFixed(ctx->Current.RasterIndex);
+      span.indexStep = 0;
    }
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
-   for (row=0; row<height; row++, span->y++) {
+   for (row=0; row<height; row++, span.y++) {
       const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack,
                  bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
 
@@ -206,7 +206,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
          /* Lsb first */
          GLubyte mask = 1U << (unpack->SkipPixels & 0x7);
          for (col=0; col<width; col++) {
-            span->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
+            span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
             if (mask == 128U) {
                src++;
                mask = 1U;
@@ -217,9 +217,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
          }
 
          if (ctx->Visual.rgbMode)
-            _mesa_write_rgba_span(ctx, span);
+            _mesa_write_rgba_span(ctx, &span);
          else
-           _mesa_write_index_span(ctx, span);
+           _mesa_write_index_span(ctx, &span);
 
          /* get ready for next row */
          if (mask != 1)
@@ -229,7 +229,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
          /* Msb first */
          GLubyte mask = 128U >> (unpack->SkipPixels & 0x7);
          for (col=0; col<width; col++) {
-            span->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
+            span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
             if (mask == 1U) {
                src++;
                mask = 128U;
@@ -240,9 +240,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
          }
 
          if (ctx->Visual.rgbMode)
-            _mesa_write_rgba_span(ctx, span);
+            _mesa_write_rgba_span(ctx, &span);
          else
-            _mesa_write_index_span(ctx, span);
+            _mesa_write_index_span(ctx, &span);
 
          /* get ready for next row */
          if (mask != 128)
index 8397d876a20d89c31c04148fca3ddbd1fa74d25c..eb95bb36d3361370ba4493c2d84983d29d953f9c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_blend.c,v 1.23 2002/06/30 15:57:45 brianp Exp $ */
+/* $Id: s_blend.c,v 1.24 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -765,11 +765,12 @@ _mesa_blend_span( GLcontext *ctx, const struct sw_span *span,
    if (span->arrayMask & SPAN_XY) {
       /* array of x/y pixel coords */
       (*swrast->Driver.ReadRGBAPixels)( ctx, span->end,
-                                        span->xArray, span->yArray,
-                                        framebuffer, span->mask );
+                                        span->array->x, span->array->y,
+                                        framebuffer, span->array->mask );
       if (swrast->_RasterMask & ALPHABUF_BIT) {
-         _mesa_read_alpha_pixels( ctx, span->end, span->xArray, span->yArray,
-                                  framebuffer, span->mask );
+         _mesa_read_alpha_pixels( ctx, span->end,
+                                  span->array->x, span->array->y,
+                                  framebuffer, span->array->mask );
       }
    }
    else {
@@ -778,6 +779,6 @@ _mesa_blend_span( GLcontext *ctx, const struct sw_span *span,
                             span->x, span->y, framebuffer );
    }
 
-   SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->mask, rgba,
+   SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba,
                                   (const GLchan (*)[4]) framebuffer );
 }
index 105b562d90ff9a73d38ee2c83e74f1af9cc073f8..c80c92798b5e8edc11fdda8d385656f40fa4eb20 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_context.c,v 1.36 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_context.c,v 1.37 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -513,10 +513,10 @@ _swrast_CreateContext( GLcontext *ctx )
    for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++)
       swrast->TextureSample[i] = _swrast_validate_texture_sample;
 
-   swrast->span = (struct sw_span *) MALLOC(sizeof(struct sw_span));
-   if (!swrast->span) {
-     FREE(swrast);
-     return GL_FALSE;
+   swrast->span_data = MALLOC_STRUCT(span_arrays);
+   if (!swrast->span_data) {
+      FREE(swrast);
+      return GL_FALSE;
    }
 
    assert(ctx->Const.MaxTextureUnits > 0);
@@ -525,7 +525,7 @@ _swrast_CreateContext( GLcontext *ctx )
    swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits *
                                            MAX_WIDTH * 4 * sizeof(GLchan));
    if (!swrast->TexelBuffer) {
-      FREE(swrast->span);
+      FREE(swrast->span_data);
       FREE(swrast);
       return GL_FALSE;
    }
@@ -544,7 +544,7 @@ _swrast_DestroyContext( GLcontext *ctx )
       _mesa_debug(ctx, "_swrast_DestroyContext\n");
    }
 
-   FREE( swrast->span );
+   FREE( swrast->span_data );
    FREE( swrast->TexelBuffer );
    FREE( swrast );
 
index 900c1907f6044f282be5a503e264410c375122c7..a2c14f07a73747cc8cb3f83064194b1d22a414f8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_context.h,v 1.18 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: s_context.h,v 1.19 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -170,7 +170,13 @@ typedef struct
    swrast_tri_func SpecTriangle;
    /*@}*/
 
-   struct sw_span *span;
+   /**
+    * Typically, we'll allocate a sw_span structure as a local variable
+    * and set its 'array' pointer to point to this object.  The reason is
+    * this object is big and causes problems when allocated on the stack
+    * on some systems.
+    */
+   struct span_arrays *span_data;
 
    /** Internal hooks, kept uptodate by the same mechanism as above.
     */
index 7f5f41b78f6cf9f844b9bfcb944fa2186e2fbf41..58ef3a49cc8b1e4dccc14bad6158401c8022ac49 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_copypix.c,v 1.39 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_copypix.c,v 1.40 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -106,14 +106,14 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
    const GLuint transferOps = ctx->_ImageTransferState;
    GLfloat *dest, *tmpImage, *convImage;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
 
    if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
@@ -239,15 +239,15 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
          GLint g = (GLint) (src[i * 4 + GCOMP] * CHAN_MAXF);
          GLint b = (GLint) (src[i * 4 + BCOMP] * CHAN_MAXF);
          GLint a = (GLint) (src[i * 4 + ACOMP] * CHAN_MAXF);
-         span->color.rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
-         span->color.rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
-         span->color.rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
-         span->color.rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+         span.array->rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
+         span.array->rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
+         span.array->rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+         span.array->rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
       }
 
       if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
-         span->end = width;
-         _swrast_pixel_texture(ctx, span);
+         span.end = width;
+         _swrast_pixel_texture(ctx, &span);
       }
 
       /* write row to framebuffer */
@@ -255,21 +255,21 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       dy = desty + row;
       if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
          (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
-                      (const GLchan (*)[4])span->color.rgba, NULL );
+                      (const GLchan (*)[4])span.array->rgba, NULL );
       }
       else if (zoom) {
-         span->x = destx;
-         span->y = dy;
-         span->end = width;
-         _mesa_write_zoomed_rgba_span(ctx, span, 
-                                     (CONST GLchan (*)[4])span->color.rgba,
+         span.x = destx;
+         span.y = dy;
+         span.end = width;
+         _mesa_write_zoomed_rgba_span(ctx, &span, 
+                                     (CONST GLchan (*)[4])span.array->rgba,
                                      desty);
       }
       else {
-         span->x = destx;
-         span->y = dy;
-         span->end = width;
-         _mesa_write_rgba_span(ctx, span);
+         span.x = destx;
+         span.y = dy;
+         span.end = width;
+         _mesa_write_rgba_span(ctx, &span);
       }
    }
 
@@ -292,7 +292,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
    GLint overlapping;
    const GLuint transferOps = ctx->_ImageTransferState;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
 
@@ -319,9 +319,9 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
                                  ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
    if (SWRAST_CONTEXT(ctx)->_RasterMask == 0
        && !zoom
@@ -370,7 +370,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       /* Get source pixels */
       if (overlapping) {
          /* get from buffered image */
-         MEMCPY(span->color.rgba, p, width * sizeof(GLchan) * 4);
+         MEMCPY(span.array->rgba, p, width * sizeof(GLchan) * 4);
          p += width * 4;
       }
       else {
@@ -378,7 +378,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
          if (changeBuffer)
             _swrast_use_read_buffer(ctx);
          _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy,
-                               span->color.rgba );
+                               span.array->rgba );
          if (changeBuffer)
             _swrast_use_draw_buffer(ctx);
       }
@@ -391,10 +391,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
 
          /* convert chan to float */
          for (k = 0; k < width; k++) {
-            rgbaFloat[k][RCOMP] = (GLfloat) span->color.rgba[k][RCOMP] * scale;
-            rgbaFloat[k][GCOMP] = (GLfloat) span->color.rgba[k][GCOMP] * scale;
-            rgbaFloat[k][BCOMP] = (GLfloat) span->color.rgba[k][BCOMP] * scale;
-            rgbaFloat[k][ACOMP] = (GLfloat) span->color.rgba[k][ACOMP] * scale;
+            rgbaFloat[k][RCOMP] = (GLfloat) span.array->rgba[k][RCOMP] * scale;
+            rgbaFloat[k][GCOMP] = (GLfloat) span.array->rgba[k][GCOMP] * scale;
+            rgbaFloat[k][BCOMP] = (GLfloat) span.array->rgba[k][BCOMP] * scale;
+            rgbaFloat[k][ACOMP] = (GLfloat) span.array->rgba[k][ACOMP] * scale;
          }
          /* scale & bias */
          if (transferOps & IMAGE_SCALE_BIAS_BIT) {
@@ -454,36 +454,36 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
             GLint g = (GLint) (rgbaFloat[k][GCOMP] * CHAN_MAXF);
             GLint b = (GLint) (rgbaFloat[k][BCOMP] * CHAN_MAXF);
             GLint a = (GLint) (rgbaFloat[k][ACOMP] * CHAN_MAXF);
-            span->color.rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
-            span->color.rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
-            span->color.rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
-            span->color.rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
+            span.array->rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
+            span.array->rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
+            span.array->rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
+            span.array->rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
          }
          UNDEFARRAY(rgbaFloat);  /* mac 32k limitation */
       }
 
       if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
-         span->end = width;
-         _swrast_pixel_texture(ctx, span);
+         span.end = width;
+         _swrast_pixel_texture(ctx, &span);
       }
 
       if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
          (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
-                                      (const GLchan (*)[4])span->color.rgba, NULL );
+                                      (const GLchan (*)[4])span.array->rgba, NULL );
       }
       else if (zoom) {
-         span->x = destx;
-         span->y = dy;
-         span->end = width;
-         _mesa_write_zoomed_rgba_span(ctx, span,
-                                     (CONST GLchan (*)[4]) span->color.rgba,
+         span.x = destx;
+         span.y = dy;
+         span.end = width;
+         _mesa_write_zoomed_rgba_span(ctx, &span,
+                                     (CONST GLchan (*)[4]) span.array->rgba,
                                      desty);
       }
       else {
-         span->x = destx;
-         span->y = dy;
-         span->end = width;
-         _mesa_write_rgba_span(ctx, span);
+         span.x = destx;
+         span.y = dy;
+         span.end = width;
+         _mesa_write_rgba_span(ctx, &span);
       }
    }
 
@@ -496,7 +496,6 @@ static void copy_ci_pixels( GLcontext *ctx,
                             GLint srcx, GLint srcy, GLint width, GLint height,
                             GLint destx, GLint desty )
 {
-   SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLuint *tmpImage,*p;
    GLint sy, dy, stepy;
    GLint j;
@@ -504,7 +503,7 @@ static void copy_ci_pixels( GLcontext *ctx,
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
    const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset;
    GLint overlapping;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
 
@@ -526,9 +525,9 @@ static void copy_ci_pixels( GLcontext *ctx,
                                  ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
    /* If read and draw buffer are different we must do buffer switching */
    changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
@@ -564,32 +563,32 @@ static void copy_ci_pixels( GLcontext *ctx,
 
    for (j = 0; j < height; j++, sy += stepy, dy += stepy) {
       if (overlapping) {
-         MEMCPY(span->color.index, p, width * sizeof(GLuint));
+         MEMCPY(span.array->index, p, width * sizeof(GLuint));
          p += width;
       }
       else {
          if (changeBuffer)
             _swrast_use_read_buffer(ctx);
          _mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy,
-                                span->color.index );
+                                span.array->index );
          if (changeBuffer)
             _swrast_use_draw_buffer(ctx);
       }
 
       if (shift_or_offset) {
-         _mesa_shift_and_offset_ci( ctx, width, span->color.index );
+         _mesa_shift_and_offset_ci( ctx, width, span.array->index );
       }
       if (ctx->Pixel.MapColorFlag) {
-         _mesa_map_ci( ctx, width, span->color.index );
+         _mesa_map_ci( ctx, width, span.array->index );
       }
 
-      span->x = destx;
-      span->y = dy;
-      span->end = width;
+      span.x = destx;
+      span.y = dy;
+      span.end = width;
       if (zoom)
-         _mesa_write_zoomed_index_span(ctx, span, desty);
+         _mesa_write_zoomed_index_span(ctx, &span, desty);
       else
-         _mesa_write_index_span(ctx, span);
+         _mesa_write_index_span(ctx, &span);
    }
 
    if (overlapping)
@@ -611,7 +610,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
    GLint i, j;
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
    GLint overlapping;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
 
@@ -637,9 +636,9 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
    overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
                                  ctx->Pixel.ZoomX, ctx->Pixel.ZoomY);
 
-   _mesa_span_default_color(ctx, span);
+   _mesa_span_default_color(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
    if (overlapping) {
       GLint ssy = sy;
@@ -671,25 +670,25 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
 
       for (i = 0; i < width; i++) {
          GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
-         span->zArray[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax);
+         span.array->z[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax);
       }
 
-      span->x = destx;
-      span->y = dy;
-      span->end = width;
+      span.x = destx;
+      span.y = dy;
+      span.end = width;
       if (ctx->Visual.rgbMode) {
          if (zoom)
-            _mesa_write_zoomed_rgba_span( ctx, span, 
-                                          (const GLchan (*)[4])span->color.rgba,
+            _mesa_write_zoomed_rgba_span( ctx, &span, 
+                                          (const GLchan (*)[4])span.array->rgba,
                                           desty );
          else
-            _mesa_write_rgba_span(ctx, span);
+            _mesa_write_rgba_span(ctx, &span);
       }
       else {
          if (zoom)
-            _mesa_write_zoomed_index_span( ctx, span, desty );
+            _mesa_write_zoomed_index_span( ctx, &span, desty );
          else
-            _mesa_write_index_span(ctx, span);
+            _mesa_write_index_span(ctx, &span);
       }
    }
 
index 0c0a5b6fe18a105f4a88e23faec0329710f87eb0..e7517b1e9edf7d3e3ce4588309d312fe0577abd1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_depth.c,v 1.22 2002/04/19 00:38:27 brianp Exp $ */
+/* $Id: s_depth.c,v 1.23 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -549,9 +549,11 @@ depth_test_span( GLcontext *ctx, struct sw_span *span)
       GLdepth zbuffer[MAX_WIDTH];
       GLuint passed;
       (*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
-      passed = depth_test_span32(ctx, n, zbuffer, span->zArray, span->mask);
+      passed = depth_test_span32(ctx, n, zbuffer, span->array->z,
+                                 span->array->mask);
       ASSERT(swrast->Driver.WriteDepthSpan);
-      (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, span->mask);
+      (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer,
+                                       span->array->mask);
       if (passed < n)
          span->writeAll = GL_FALSE;
       return passed;
@@ -561,11 +563,11 @@ depth_test_span( GLcontext *ctx, struct sw_span *span)
       /* software depth buffer */
       if (ctx->Visual.depthBits <= 16) {
          GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y);
-         passed = depth_test_span16(ctx, n, zptr, span->zArray, span->mask);
+         passed = depth_test_span16(ctx, n, zptr, span->array->z, span->array->mask);
       }
       else {
          GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, x, y);
-         passed = depth_test_span32(ctx, n, zptr, span->zArray, span->mask);
+         passed = depth_test_span32(ctx, n, zptr, span->array->z, span->array->mask);
       }
 #if 1
       if (passed < span->end) {
@@ -1321,10 +1323,10 @@ depth_test_pixels( GLcontext *ctx, struct sw_span *span )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const GLuint n = span->end;
-   const GLint *x = span->xArray;
-   const GLint *y = span->yArray;
-   const GLdepth *z = span->zArray;
-   GLubyte *mask = span->mask;
+   const GLint *x = span->array->x;
+   const GLint *y = span->array->y;
+   const GLdepth *z = span->array->z;
+   GLubyte *mask = span->array->mask;
 
    if (swrast->Driver.ReadDepthPixels) {
       /* read depth values from hardware Z buffer */
index 0bee50400f8baa6b9652df4610cebc75e3266583..1f3999f575ecbc05ddecaeedf0a440a6b7b416fc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_drawpix.c,v 1.35 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.36 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -102,7 +102,7 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
 
@@ -111,9 +111,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
    }
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
    if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0
        && ctx->Texture._EnabledUnits == 0
@@ -237,10 +237,10 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                /* with zooming */
                GLint row;
                for (row=0; row<drawHeight; row++) {
-                  span->x = destX;
-                  span->y = destY;
-                  span->end = drawWidth;
-                  _mesa_write_zoomed_rgba_span(ctx, span,
+                  span.x = destX;
+                  span.y = destY;
+                  span.end = drawWidth;
+                  _mesa_write_zoomed_rgba_span(ctx, &span,
                                             (CONST GLchan (*)[4]) src, zoomY0);
                   src += rowLength * 4;
                   destY++;
@@ -277,10 +277,10 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                /* with zooming */
                GLint row;
                for (row=0; row<drawHeight; row++) {
-                  span->x = destX;
-                  span->y = destY;
-                  span->end = drawWidth;
-                  _mesa_write_zoomed_rgb_span(ctx, span, 
+                  span.x = destX;
+                  span.y = destY;
+                  span.end = drawWidth;
+                  _mesa_write_zoomed_rgb_span(ctx, &span, 
                                             (CONST GLchan (*)[3]) src, zoomY0);
                   src += rowLength * 3;
                   destY++;
@@ -301,12 +301,12 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                for (row=0; row<drawHeight; row++) {
                   GLint i;
                  for (i=0;i<drawWidth;i++) {
-                     span->color.rgb[i][0] = src[i];
-                     span->color.rgb[i][1] = src[i];
-                     span->color.rgb[i][2] = src[i];
+                     span.array->rgb[i][0] = src[i];
+                     span.array->rgb[i][1] = src[i];
+                     span.array->rgb[i][2] = src[i];
                  }
                   (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
-                                   (CONST GLchan (*)[3]) span->color.rgb, NULL);
+                                   (CONST GLchan (*)[3]) span.array->rgb, NULL);
                   src += rowLength;
                   destY++;
                }
@@ -318,13 +318,13 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                for (row=0; row<drawHeight; row++) {
                   GLint i;
                   for (i=0;i<drawWidth;i++) {
-                     span->color.rgb[i][0] = src[i];
-                     span->color.rgb[i][1] = src[i];
-                     span->color.rgb[i][2] = src[i];
+                     span.array->rgb[i][0] = src[i];
+                     span.array->rgb[i][1] = src[i];
+                     span.array->rgb[i][2] = src[i];
                   }
                   destY--;
                   (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
-                                              (CONST GLchan (*)[3]) span->color.rgb, NULL);
+                                              (CONST GLchan (*)[3]) span.array->rgb, NULL);
                   src += rowLength;
                }
             }
@@ -335,15 +335,15 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                for (row=0; row<drawHeight; row++) {
                   GLint i;
                  for (i=0;i<drawWidth;i++) {
-                     span->color.rgb[i][0] = src[i];
-                     span->color.rgb[i][1] = src[i];
-                     span->color.rgb[i][2] = src[i];
+                     span.array->rgb[i][0] = src[i];
+                     span.array->rgb[i][1] = src[i];
+                     span.array->rgb[i][2] = src[i];
                  }
-                  span->x = destX;
-                  span->y = destY;
-                  span->end = drawWidth;
-                  _mesa_write_zoomed_rgb_span(ctx, span,
-                                 (CONST GLchan (*)[3]) span->color.rgb, zoomY0);
+                  span.x = destX;
+                  span.y = destY;
+                  span.end = drawWidth;
+                  _mesa_write_zoomed_rgb_span(ctx, &span,
+                                 (CONST GLchan (*)[3]) span.array->rgb, zoomY0);
                   src += rowLength;
                   destY++;
                }
@@ -364,13 +364,13 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                   GLint i;
                   GLchan *ptr = src;
                  for (i=0;i<drawWidth;i++) {
-                     span->color.rgba[i][0] = *ptr;
-                     span->color.rgba[i][1] = *ptr;
-                     span->color.rgba[i][2] = *ptr++;
-                     span->color.rgba[i][3] = *ptr++;
+                     span.array->rgba[i][0] = *ptr;
+                     span.array->rgba[i][1] = *ptr;
+                     span.array->rgba[i][2] = *ptr++;
+                     span.array->rgba[i][3] = *ptr++;
                  }
                   (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
-                                             (CONST GLchan (*)[4]) span->color.rgba, NULL);
+                                             (CONST GLchan (*)[4]) span.array->rgba, NULL);
                   src += rowLength*2;
                   destY++;
                }
@@ -383,14 +383,14 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                   GLint i;
                   GLchan *ptr = src;
                   for (i=0;i<drawWidth;i++) {
-                     span->color.rgba[i][0] = *ptr;
-                     span->color.rgba[i][1] = *ptr;
-                     span->color.rgba[i][2] = *ptr++;
-                     span->color.rgba[i][3] = *ptr++;
+                     span.array->rgba[i][0] = *ptr;
+                     span.array->rgba[i][1] = *ptr;
+                     span.array->rgba[i][2] = *ptr++;
+                     span.array->rgba[i][3] = *ptr++;
                   }
                   destY--;
                   (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
-                                             (CONST GLchan (*)[4]) span->color.rgba, NULL);
+                                             (CONST GLchan (*)[4]) span.array->rgba, NULL);
                   src += rowLength*2;
                }
             }
@@ -402,16 +402,16 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                   GLchan *ptr = src;
                   GLint i;
                  for (i=0;i<drawWidth;i++) {
-                     span->color.rgba[i][0] = *ptr;
-                     span->color.rgba[i][1] = *ptr;
-                     span->color.rgba[i][2] = *ptr++;
-                     span->color.rgba[i][3] = *ptr++;
+                     span.array->rgba[i][0] = *ptr;
+                     span.array->rgba[i][1] = *ptr;
+                     span.array->rgba[i][2] = *ptr++;
+                     span.array->rgba[i][3] = *ptr++;
                  }
-                  span->x = destX;
-                  span->y = destY;
-                  span->end = drawWidth;
-                  _mesa_write_zoomed_rgba_span(ctx, span,
-                               (CONST GLchan (*)[4]) span->color.rgba, zoomY0);
+                  span.x = destX;
+                  span.y = destY;
+                  span.end = drawWidth;
+                  _mesa_write_zoomed_rgba_span(ctx, &span,
+                               (CONST GLchan (*)[4]) span.array->rgba, zoomY0);
                   src += rowLength*2;
                   destY++;
                }
@@ -428,9 +428,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                GLint row;
                for (row=0; row<drawHeight; row++) {
                   ASSERT(drawWidth < MAX_WIDTH);
-                  _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span->color.rgba);
+                  _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba);
                   (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
-                                  (const GLchan (*)[4]) span->color.rgba, NULL);
+                                  (const GLchan (*)[4]) span.array->rgba, NULL);
                   src += rowLength;
                   destY++;
                }
@@ -441,10 +441,10 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                GLint row;
                for (row=0; row<drawHeight; row++) {
                   ASSERT(drawWidth < MAX_WIDTH);
-                  _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span->color.rgba);
+                  _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba);
                   destY--;
                   (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
-                                 (CONST GLchan (*)[4]) span->color.rgba, NULL);
+                                 (CONST GLchan (*)[4]) span.array->rgba, NULL);
                   src += rowLength;
                }
                return GL_TRUE;
@@ -454,12 +454,12 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
                GLint row;
                for (row=0; row<drawHeight; row++) {
                   ASSERT(drawWidth < MAX_WIDTH);
-                  _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span->color.rgba);
-                  span->x = destX;
-                  span->y = destY;
-                  span->end = drawWidth;
-                  _mesa_write_zoomed_rgba_span(ctx, span,
-                               (CONST GLchan (*)[4]) span->color.rgba, zoomY0);
+                  _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba);
+                  span.x = destX;
+                  span.y = destY;
+                  span.end = drawWidth;
+                  _mesa_write_zoomed_rgba_span(ctx, &span,
+                               (CONST GLchan (*)[4]) span.array->rgba, zoomY0);
                   src += rowLength;
                   destY++;
                }
@@ -508,14 +508,14 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
    const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
    const GLint desty = y;
    GLint row, drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_INDEX);
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
 
    /*
     * General solution
@@ -524,16 +524,16 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
       const GLvoid *source = _mesa_image_address(&ctx->Unpack,
                     pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0);
       _mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT,
-                              span->color.index,
+                              span.array->index,
                               type, source, &ctx->Unpack,
                               ctx->_ImageTransferState);
-      span->x = x;
-      span->y = y;
-      span->end = drawWidth;
+      span.x = x;
+      span.y = y;
+      span.end = drawWidth;
       if (zoom)
-         _mesa_write_zoomed_index_span(ctx, span, desty);
+         _mesa_write_zoomed_index_span(ctx, &span, desty);
       else
-         _mesa_write_index_span(ctx, span);
+         _mesa_write_index_span(ctx, &span);
    }
 }
 
@@ -610,7 +610,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
    const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
    const GLint desty = y;
    GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_Z);
 
@@ -625,52 +625,52 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
       return;
    }
 
-   _mesa_span_default_color(ctx, span);
+   _mesa_span_default_color(ctx, &span);
 
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
    if (ctx->Texture._ReallyEnabled)
-      _mesa_span_default_texcoords(ctx, span);
+      _mesa_span_default_texcoords(ctx, &span);
 
    if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
        && !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
       /* Special case: directly write 16-bit depth values */
       GLint row;
-      span->x = x;
-      span->y = y;
-      span->end = drawWidth;
-      for (row = 0; row < height; row++, span->y++) {
+      span.x = x;
+      span.y = y;
+      span.end = drawWidth;
+      for (row = 0; row < height; row++, span.y++) {
          const GLushort *zptr = (const GLushort *)
             _mesa_image_address(&ctx->Unpack, pixels, width, height,
                                 GL_DEPTH_COMPONENT, type, 0, row, 0);
          GLint i;
          for (i = 0; i < drawWidth; i++)
-            span->zArray[i] = zptr[i];
-         _mesa_write_rgba_span(ctx, span);
+            span.array->z[i] = zptr[i];
+         _mesa_write_rgba_span(ctx, &span);
       }
    }
    else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32
        && !bias_or_scale && !zoom && ctx->Visual.rgbMode) {
       /* Special case: directly write 32-bit depth values */
       GLint row;
-      span->x = x;
-      span->y = y;
-      span->end = drawWidth;
-      for (row = 0; row < height; row++, span->y++) {
+      span.x = x;
+      span.y = y;
+      span.end = drawWidth;
+      for (row = 0; row < height; row++, span.y++) {
          const GLuint *zptr = (const GLuint *)
             _mesa_image_address(&ctx->Unpack, pixels, width, height,
                                 GL_DEPTH_COMPONENT, type, 0, row, 0);
-         MEMCPY(span->zArray, zptr, drawWidth * sizeof(GLdepth));
-         _mesa_write_rgba_span(ctx, span);
+         MEMCPY(span.array->z, zptr, drawWidth * sizeof(GLdepth));
+         _mesa_write_rgba_span(ctx, &span);
       }
    }
    else {
       /* General case */
       GLint row;
-      span->x = x;
-      span->y = y;
-      span->end = drawWidth;
-      for (row = 0; row < height; row++, span->y++) {
+      span.x = x;
+      span.y = y;
+      span.end = drawWidth;
+      for (row = 0; row < height; row++, span.y++) {
          GLfloat fspan[MAX_WIDTH];
          const GLvoid *src = _mesa_image_address(&ctx->Unpack,
                 pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
@@ -681,21 +681,24 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
             const GLfloat zs = ctx->DepthMaxF;
             GLint i;
             for (i = 0; i < drawWidth; i++) {
-               span->zArray[i] = (GLdepth) (fspan[i] * zs + 0.5F);
+               span.array->z[i] = (GLdepth) (fspan[i] * zs + 0.5F);
             }
          }
          if (ctx->Visual.rgbMode) {
-            if (zoom)
-               _mesa_write_zoomed_rgba_span(ctx, span,
-                                 (const GLchan (*)[4]) span->color.rgba, desty);
+            if (zoom) {
+               abort();
+               _mesa_write_zoomed_rgba_span(ctx, &span,
+                                 (const GLchan (*)[4]) span.array->rgba, desty);
+            }
             else
-               _mesa_write_rgba_span(ctx, span);
+               _mesa_write_rgba_span(ctx, &span);
          }
          else {
+               abort();
             if (zoom)
-               _mesa_write_zoomed_index_span(ctx, span, desty);
+               _mesa_write_zoomed_index_span(ctx, &span, desty);
             else
-               _mesa_write_index_span(ctx, span);
+               _mesa_write_index_span(ctx, &span);
          }
       }
    }
@@ -717,7 +720,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
    GLboolean quickDraw;
    GLfloat *convImage = NULL;
    GLuint transferOps = ctx->_ImageTransferState;
-   struct sw_span *span = swrast->span;
+   struct sw_span span;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
 
@@ -731,11 +734,11 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
       return;
 
    if (ctx->Depth.Test)
-      _mesa_span_default_z(ctx, span);
+      _mesa_span_default_z(ctx, &span);
    if (ctx->Fog.Enabled)
-      _mesa_span_default_fog(ctx, span);
+      _mesa_span_default_fog(ctx, &span);
    if (ctx->Texture._ReallyEnabled)
-      _mesa_span_default_texcoords(ctx, span);
+      _mesa_span_default_texcoords(ctx, &span);
 
    if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
        && x + width <= (GLint) ctx->DrawBuffer->Width
@@ -805,11 +808,13 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
       GLint row;
       if (width > MAX_WIDTH)
          width = MAX_WIDTH;
+
       for (row = 0; row < height; row++, y++) {
          const GLvoid *source = _mesa_image_address(unpack,
                   pixels, width, height, format, type, 0, row, 0);
+
          _mesa_unpack_chan_color_span(ctx, width, GL_RGBA,
-                                      (GLchan *) span->color.rgba,
+                                      (GLchan *) span.array->rgba,
                                       format, type, source, unpack,
                                       transferOps);
 
@@ -818,26 +823,26 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
             continue;
 
          if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) {
-            span->end = width;
-            _swrast_pixel_texture(ctx, span);
+            span.end = width;
+            _swrast_pixel_texture(ctx, &span);
          }
 
          if (quickDraw) {
             (*swrast->Driver.WriteRGBASpan)(ctx, width, x, y,
-                                 (CONST GLchan (*)[4]) span->color.rgba, NULL);
+                                 (CONST GLchan (*)[4]) span.array->rgba, NULL);
          }
          else if (zoom) {
-            span->x = x;
-            span->y = y;
-            span->end = width;
-            _mesa_write_zoomed_rgba_span(ctx, span,
-                                (CONST GLchan (*)[4]) span->color.rgba, desty);
+            span.x = x;
+            span.y = y;
+            span.end = width;
+            _mesa_write_zoomed_rgba_span(ctx, &span,
+                                (CONST GLchan (*)[4]) span.array->rgba, desty);
          }
          else {
-            span->x = x;
-            span->y = y;
-            span->end = width;
-            _mesa_write_rgba_span(ctx, span);
+            span.x = x;
+            span.y = y;
+            span.end = width;
+            _mesa_write_rgba_span(ctx, &span);
          }
       }
    }
index 0988ebb1a7d2e96af773d366b2d2495111824cac..c43ef60a30b01f41592bc6edbab5170fa53b8587 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_fog.c,v 1.22 2002/02/17 17:30:58 brianp Exp $ */
+/* $Id: s_fog.c,v 1.23 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -134,9 +134,11 @@ compute_fog_factors_from_z( const GLcontext *ctx,
                for (i=0;i<n;i++) {
                   GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
                   GLfloat eyez = (ndcz - p14) / p10;
+                  GLfloat f;
                   if (eyez < 0.0)
                      eyez = -eyez;
-                  fogFact[i] = (fogEnd - eyez) * fogScale;
+                  f = (fogEnd - eyez) * fogScale;
+                  fogFact[i] = CLAMP(f, 0.0F, 1.0F);
                }
             }
             else {
@@ -144,9 +146,11 @@ compute_fog_factors_from_z( const GLcontext *ctx,
                for (i=0;i<n;i++) {
                   GLfloat ndcz = ((GLfloat) z[i] - tz) * szInv;
                   GLfloat eyez = p14 / (ndcz + p10);
+                  GLfloat f;
                   if (eyez < 0.0)
                      eyez = -eyez;
-                  fogFact[i] = (fogEnd - eyez) * fogScale;
+                  f = (fogEnd - eyez) * fogScale;
+                  fogFact[i] = CLAMP(f, 0.0F, 1.0F);
                }
             }
          }
@@ -214,7 +218,7 @@ compute_fog_factors_from_z( const GLcontext *ctx,
 
 /**
  * Apply fog to a span of RGBA pixels.
- * The fog factors are either in the span->fogArray or stored as base/step.
+ * The fog factors are either in the span->array->fog or stored as base/step.
  * These are fog _factors_, not fog coords.  Fog coords were converted to
  * fog factors per vertex.
  */
@@ -223,7 +227,7 @@ _mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span )
 {
    const SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const GLuint n = span->end;
-   GLchan (*rgba)[4] = (GLchan (*)[4]) span->color.rgba;
+   GLchan (*rgba)[4] = (GLchan (*)[4]) span->array->rgba;
    GLchan rFog, gFog, bFog;
 
    ASSERT(ctx->Fog.Enabled);
@@ -238,14 +242,15 @@ _mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span )
       /* compute fog factor from each fragment's Z value */
       if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0)
          _mesa_span_interpolate_z(ctx, span);
-      compute_fog_factors_from_z(ctx, n, span->zArray, span->fogArray);
+      compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog);
       span->arrayMask |= SPAN_FOG;
    }
 
    if (span->arrayMask & SPAN_FOG) {
+      /* use fog array in span */
       GLuint i;
       for (i = 0; i < n; i++) {
-         const GLfloat fog = span->fogArray[i];
+         const GLfloat fog = span->array->fog[i];
          const GLfloat oneMinusFog = 1.0F - fog;
          rgba[i][RCOMP] = (GLchan) (fog * rgba[i][RCOMP] + oneMinusFog * rFog);
          rgba[i][GCOMP] = (GLchan) (fog * rgba[i][GCOMP] + oneMinusFog * gFog);
@@ -253,6 +258,7 @@ _mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span )
       }
    }
    else {
+      /* interpolate fog factors */
       GLfloat fog = span->fog, dFog = span->fogStep;
       GLuint i;
       for (i = 0; i < n; i++) {
@@ -274,7 +280,7 @@ _mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span )
 {
    const SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const GLuint n = span->end;
-   GLuint *index = span->color.index;
+   GLuint *index = span->array->index;
 
    ASSERT(ctx->Fog.Enabled);
    ASSERT(span->arrayMask & SPAN_INDEX);
@@ -284,7 +290,7 @@ _mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span )
       /* compute fog factor from each fragment's Z value */
       if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0)
          _mesa_span_interpolate_z(ctx, span);
-      compute_fog_factors_from_z(ctx, n, span->zArray, span->fogArray);
+      compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog);
       span->arrayMask |= SPAN_FOG;
    }
 
@@ -292,7 +298,7 @@ _mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span )
       const GLuint idx = (GLuint) ctx->Fog.Index;
       GLuint i;
       for (i = 0; i < n; i++) {
-         const GLfloat f = CLAMP(span->fogArray[i], 0.0F, 1.0F);
+         const GLfloat f = CLAMP(span->array->fog[i], 0.0F, 1.0F);
          index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx);
       }
    }
index e9e9c670d74766f3b0e6c6eceaa7c7f07d5cec9a..55b545b0b1bdaa55dfbfec43c74bcfce6c1b0f9c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_lines.c,v 1.30 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_lines.c,v 1.31 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -77,16 +77,17 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
       start = width / 2 - 1;
 
    if (xMajor) {
+      GLint *y = span->array->y;
       GLuint i;
       GLint w;
       for (w = 0; w < width; w++) {
          if (w == 0) {
             for (i = 0; i < span->end; i++)
-               span->yArray[i] -= start;
+               y[i] -= start;
          }
          else {
             for (i = 0; i < span->end; i++)
-               span->yArray[i]++;
+               y[i]++;
          }
          if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
             _mesa_write_texture_span(ctx, span);
@@ -97,16 +98,17 @@ draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor )
       }
    }
    else {
+      GLint *x = span->array->x;
       GLuint i;
       GLint w;
       for (w = 0; w < width; w++) {
          if (w == 0) {
             for (i = 0; i < span->end; i++)
-               span->xArray[i] -= start;
+               x[i] -= start;
          }
          else {
             for (i = 0; i < span->end; i++)
-               span->xArray[i]++;
+               x[i]++;
          }
          if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE)
             _mesa_write_texture_span(ctx, span);
@@ -130,27 +132,30 @@ static void flat_ci_line( GLcontext *ctx,
                           const SWvertex *vert0,
                          const SWvertex *vert1 )
 {
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   GLint *x, *y;
+   struct sw_span span;
 
    ASSERT(ctx->Light.ShadeModel == GL_FLAT);
    ASSERT(!ctx->Line.StippleFlag);
    ASSERT(ctx->Line.Width == 1.0F);
 
    INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, SPAN_XY);
-   span->index = IntToFixed(vert1->index);
-   span->indexStep = 0;
+   span.index = IntToFixed(vert1->index);
+   span.indexStep = 0;
+   x = span.array->x;
+   y = span.array->y;
 
 #define INTERP_XY 1
-#define PLOT(X,Y)                      \
-   {                                   \
-      span->xArray[span->end] = X;     \
-      span->yArray[span->end] = Y;     \
-      span->end++;                     \
+#define PLOT(X,Y)              \
+   {                           \
+      x[span.end] = X;         \
+      y[span.end] = Y;         \
+      span.end++;              \
    }
 
 #include "s_linetemp.h"
 
-   _mesa_write_index_span(ctx, span);
+   _mesa_write_index_span(ctx, &span);
 }
 
 
@@ -159,33 +164,36 @@ static void flat_rgba_line( GLcontext *ctx,
                             const SWvertex *vert0,
                            const SWvertex *vert1 )
 {
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
 
    ASSERT(ctx->Light.ShadeModel == GL_FLAT);
    ASSERT(!ctx->Line.StippleFlag);
    ASSERT(ctx->Line.Width == 1.0F);
 
    INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, SPAN_XY);
-   span->red = ChanToFixed(vert1->color[0]);
-   span->green = ChanToFixed(vert1->color[1]);
-   span->blue = ChanToFixed(vert1->color[2]);
-   span->alpha = ChanToFixed(vert1->color[3]);
-   span->redStep = 0;
-   span->greenStep = 0;
-   span->blueStep = 0;
-   span->alphaStep = 0;
+   span.red = ChanToFixed(vert1->color[0]);
+   span.green = ChanToFixed(vert1->color[1]);
+   span.blue = ChanToFixed(vert1->color[2]);
+   span.alpha = ChanToFixed(vert1->color[3]);
+   span.redStep = 0;
+   span.greenStep = 0;
+   span.blueStep = 0;
+   span.alphaStep = 0;
+   x = span.array->x;
+   y = span.array->y;
 
 #define INTERP_XY 1
-#define PLOT(X,Y)                      \
-   {                                   \
-      span->xArray[span->end] = X;     \
-      span->yArray[span->end] = Y;     \
-      span->end++;                     \
+#define PLOT(X,Y)              \
+   {                           \
+      x[span.end] = X;         \
+      y[span.end] = Y;         \
+      span.end++;              \
    }
 
 #include "s_linetemp.h"
 
-   _mesa_write_rgba_span(ctx, span);
+   _mesa_write_rgba_span(ctx, &span);
 }
 
 
@@ -194,27 +202,32 @@ static void smooth_ci_line( GLcontext *ctx,
                             const SWvertex *vert0,
                            const SWvertex *vert1 )
 {
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
+   GLuint *index;
 
    ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
    ASSERT(!ctx->Line.StippleFlag);
    ASSERT(ctx->Line.Width == 1.0F);
 
    INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_INDEX);
+   x = span.array->x;
+   y = span.array->y;
+   index = span.array->index;
 
 #define INTERP_XY 1
 #define INTERP_INDEX 1
-#define PLOT(X,Y)                      \
-   {                                   \
-      span->xArray[span->end] = X;     \
-      span->yArray[span->end] = Y;     \
-      span->color.index[span->end] = I;        \
-      span->end++;                     \
+#define PLOT(X,Y)              \
+   {                           \
+      x[span.end] = X;         \
+      y[span.end] = Y;         \
+      index[span.end] = I;     \
+      span.end++;              \
    }
 
 #include "s_linetemp.h"
 
-   _mesa_write_index_span(ctx, span);
+   _mesa_write_index_span(ctx, &span);
 }
 
 
@@ -223,31 +236,36 @@ static void smooth_rgba_line( GLcontext *ctx,
                                      const SWvertex *vert0,
                              const SWvertex *vert1 )
 {
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
+   GLchan (*rgba)[4];
 
    ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
    ASSERT(!ctx->Line.StippleFlag);
    ASSERT(ctx->Line.Width == 1.0F);
 
    INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_RGBA);
+   x = span.array->x;
+   y = span.array->y;
+   rgba = span.array->rgba;
 
 #define INTERP_XY 1
 #define INTERP_RGB 1
 #define INTERP_ALPHA 1
-#define PLOT(X,Y)                                              \
-   {                                                           \
-      span->xArray[span->end] = X;                             \
-      span->yArray[span->end] = Y;                             \
-      span->color.rgba[span->end][RCOMP] = FixedToInt(r0);     \
-      span->color.rgba[span->end][GCOMP] = FixedToInt(g0);     \
-      span->color.rgba[span->end][BCOMP] = FixedToInt(b0);     \
-      span->color.rgba[span->end][ACOMP] = FixedToInt(a0);     \
-      span->end++;                                             \
+#define PLOT(X,Y)                              \
+   {                                           \
+      x[span.end] = X;                         \
+      y[span.end] = Y;                         \
+      rgba[span.end][RCOMP] = FixedToInt(r0);  \
+      rgba[span.end][GCOMP] = FixedToInt(g0);  \
+      rgba[span.end][BCOMP] = FixedToInt(b0);  \
+      rgba[span.end][ACOMP] = FixedToInt(a0);  \
+      span.end++;                              \
    }
 
 #include "s_linetemp.h"
 
-   _mesa_write_rgba_span(ctx, span);
+   _mesa_write_rgba_span(ctx, &span);
 }
 
 
@@ -257,39 +275,48 @@ static void general_smooth_ci_line( GLcontext *ctx,
                                    const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
+   GLdepth *z;
+   GLfloat *fog;
+   GLuint *index;
 
    ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
 
    INIT_SPAN(span, GL_LINE, 0, 0,
             SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX);
+   x = span.array->x;
+   y = span.array->y;
+   z = span.array->z;
+   fog = span.array->fog;
+   index = span.array->index;
 
 #define SET_XMAJOR 1
 #define INTERP_XY 1
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define INTERP_INDEX 1
-#define PLOT(X,Y)                      \
-   {                                   \
-      span->xArray[span->end] = X;     \
-      span->yArray[span->end] = Y;     \
-      span->zArray[span->end] = Z;     \
-      span->fogArray[span->end] = fog0;        \
-      span->color.index[span->end] = I;        \
-      span->end++;                     \
+#define PLOT(X,Y)              \
+   {                           \
+      x[span.end] = X;         \
+      y[span.end] = Y;         \
+      z[span.end] = Z;         \
+      fog[span.end] = fog0;    \
+      index[span.end] = I;     \
+      span.end++;              \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_index_span(ctx, span);
+      _mesa_write_index_span(ctx, &span);
    }
 }
 
@@ -300,39 +327,46 @@ static void general_flat_ci_line( GLcontext *ctx,
                                  const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
+   GLdepth *z;
+   GLfloat *fog;
 
    ASSERT(ctx->Light.ShadeModel == GL_FLAT);
 
    INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX,
             SPAN_XY | SPAN_Z | SPAN_FOG);
-   span->index = IntToFixed(vert1->index);
-   span->indexStep = 0;
+   span.index = IntToFixed(vert1->index);
+   span.indexStep = 0;
+   x = span.array->x;
+   y = span.array->y;
+   z = span.array->z;
+   fog = span.array->fog;
 
 #define SET_XMAJOR 1
 #define INTERP_XY 1
 #define INTERP_Z 1
 #define INTERP_FOG 1
-#define PLOT(X,Y)                      \
-   {                                   \
-      span->xArray[span->end] = X;     \
-      span->yArray[span->end] = Y;     \
-      span->zArray[span->end] = Z;     \
-      span->fogArray[span->end] = fog0;        \
-      span->end++;                     \
+#define PLOT(X,Y)              \
+   {                           \
+      x[span.end] = X;         \
+      y[span.end] = Y;         \
+      z[span.end] = Z;         \
+      fog[span.end] = fog0;    \
+      span.end++;              \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_index_span(ctx, span);
+      _mesa_write_index_span(ctx, &span);
    }
 }
 
@@ -343,12 +377,21 @@ static void general_smooth_rgba_line( GLcontext *ctx,
                                      const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
+   GLdepth *z;
+   GLchan (*rgba)[4];
+   GLfloat *fog;
 
    ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
 
    INIT_SPAN(span, GL_LINE, 0, 0,
             SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA);
+   x = span.array->x;
+   y = span.array->y;
+   z = span.array->z;
+   rgba = span.array->rgba;
+   fog = span.array->fog;
 
 #define SET_XMAJOR 1
 #define INTERP_XY 1
@@ -356,30 +399,30 @@ static void general_smooth_rgba_line( GLcontext *ctx,
 #define INTERP_FOG 1
 #define INTERP_RGB 1
 #define INTERP_ALPHA 1
-#define PLOT(X,Y)                                              \
-   {                                                           \
-      span->xArray[span->end] = X;                             \
-      span->yArray[span->end] = Y;                             \
-      span->zArray[span->end] = Z;                             \
-      span->color.rgba[span->end][RCOMP] = FixedToInt(r0);     \
-      span->color.rgba[span->end][GCOMP] = FixedToInt(g0);     \
-      span->color.rgba[span->end][BCOMP] = FixedToInt(b0);     \
-      span->color.rgba[span->end][ACOMP] = FixedToInt(a0);     \
-      span->fogArray[span->end] = fog0;                                \
-      span->end++;                                             \
+#define PLOT(X,Y)                              \
+   {                                           \
+      x[span.end] = X;                         \
+      y[span.end] = Y;                         \
+      z[span.end] = Z;                         \
+      rgba[span.end][RCOMP] = FixedToInt(r0);  \
+      rgba[span.end][GCOMP] = FixedToInt(g0);  \
+      rgba[span.end][BCOMP] = FixedToInt(b0);  \
+      rgba[span.end][ACOMP] = FixedToInt(a0);  \
+      fog[span.end] = fog0;                    \
+      span.end++;                              \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_rgba_span(ctx, span);
+      _mesa_write_rgba_span(ctx, &span);
    }
 }
 
@@ -389,45 +432,52 @@ static void general_flat_rgba_line( GLcontext *ctx,
                                    const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
+   GLint *x, *y;
+   GLdepth *z;
+   GLfloat *fog;
 
    ASSERT(ctx->Light.ShadeModel == GL_FLAT);
 
    INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA,
             SPAN_XY | SPAN_Z | SPAN_FOG);
-   span->red = ChanToFixed(vert1->color[0]);
-   span->green = ChanToFixed(vert1->color[1]);
-   span->blue = ChanToFixed(vert1->color[2]);
-   span->alpha = ChanToFixed(vert1->color[3]);
-   span->redStep = 0;
-   span->greenStep = 0;
-   span->blueStep = 0;
-   span->alphaStep = 0;
+   span.red = ChanToFixed(vert1->color[0]);
+   span.green = ChanToFixed(vert1->color[1]);
+   span.blue = ChanToFixed(vert1->color[2]);
+   span.alpha = ChanToFixed(vert1->color[3]);
+   span.redStep = 0;
+   span.greenStep = 0;
+   span.blueStep = 0;
+   span.alphaStep = 0;
+   x = span.array->x;
+   y = span.array->y;
+   z = span.array->z;
+   fog = span.array->fog;
 
 #define SET_XMAJOR 1
 #define INTERP_XY 1
 #define INTERP_Z 1
 #define INTERP_FOG 1
-#define PLOT(X,Y)                                              \
-   {                                                           \
-      span->xArray[span->end] = X;                             \
-      span->yArray[span->end] = Y;                             \
-      span->zArray[span->end] = Z;                             \
-      span->fogArray[span->end] = fog0;                                \
-      span->end++;                                             \
+#define PLOT(X,Y)              \
+   {                           \
+      x[span.end] = X;         \
+      y[span.end] = Y;         \
+      z[span.end] = Z;         \
+      fog[span.end] = fog0;    \
+      span.end++;              \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_rgba_span(ctx, span);
+      _mesa_write_rgba_span(ctx, &span);
    }
 }
 
@@ -438,26 +488,26 @@ static void flat_textured_line( GLcontext *ctx,
                                const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
 
    ASSERT(ctx->Light.ShadeModel == GL_FLAT);
 
    INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC,
             SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
-   span->red = ChanToFixed(vert1->color[0]);
-   span->green = ChanToFixed(vert1->color[1]);
-   span->blue = ChanToFixed(vert1->color[2]);
-   span->alpha = ChanToFixed(vert1->color[3]);
-   span->redStep = 0;
-   span->greenStep = 0;
-   span->blueStep = 0;
-   span->alphaStep = 0;
-   span->specRed = ChanToFixed(vert1->specular[0]);
-   span->specGreen = ChanToFixed(vert1->specular[1]);
-   span->specBlue = ChanToFixed(vert1->specular[2]);
-   span->specRedStep = 0;
-   span->specGreenStep = 0;
-   span->specBlueStep = 0;
+   span.red = ChanToFixed(vert1->color[0]);
+   span.green = ChanToFixed(vert1->color[1]);
+   span.blue = ChanToFixed(vert1->color[2]);
+   span.alpha = ChanToFixed(vert1->color[3]);
+   span.redStep = 0;
+   span.greenStep = 0;
+   span.blueStep = 0;
+   span.alphaStep = 0;
+   span.specRed = ChanToFixed(vert1->specular[0]);
+   span.specGreen = ChanToFixed(vert1->specular[1]);
+   span.specBlue = ChanToFixed(vert1->specular[2]);
+   span.specRedStep = 0;
+   span.specGreenStep = 0;
+   span.specBlueStep = 0;
 
 #define SET_XMAJOR 1
 #define INTERP_XY 1
@@ -466,28 +516,28 @@ static void flat_textured_line( GLcontext *ctx,
 #define INTERP_TEX 1
 #define PLOT(X,Y)                                              \
    {                                                           \
-      span->xArray[span->end] = X;                             \
-      span->yArray[span->end] = Y;                             \
-      span->zArray[span->end] = Z;                             \
-      span->fogArray[span->end] = fog0;                                \
-      span->texcoords[0][span->end][0] = fragTexcoord[0];              \
-      span->texcoords[0][span->end][1] = fragTexcoord[1];              \
-      span->texcoords[0][span->end][2] = fragTexcoord[2];              \
-      span->lambda[0][span->end] = 0.0;                                \
-      span->end++;                                             \
+      span.array->x[span.end] = X;                             \
+      span.array->y[span.end] = Y;                             \
+      span.array->z[span.end] = Z;                             \
+      span.array->fog[span.end] = fog0;                                \
+      span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \
+      span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \
+      span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \
+      span.array->lambda[0][span.end] = 0.0;                   \
+      span.end++;                                              \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_texture_span(ctx, span);
+      _mesa_write_texture_span(ctx, &span);
    }
 }
 
@@ -499,7 +549,7 @@ static void smooth_textured_line( GLcontext *ctx,
                                  const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
 
    ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
 
@@ -515,32 +565,32 @@ static void smooth_textured_line( GLcontext *ctx,
 #define INTERP_TEX 1
 #define PLOT(X,Y)                                              \
    {                                                           \
-      span->xArray[span->end] = X;                             \
-      span->yArray[span->end] = Y;                             \
-      span->zArray[span->end] = Z;                             \
-      span->fogArray[span->end] = fog0;                                \
-      span->color.rgba[span->end][RCOMP] = FixedToInt(r0);     \
-      span->color.rgba[span->end][GCOMP] = FixedToInt(g0);     \
-      span->color.rgba[span->end][BCOMP] = FixedToInt(b0);     \
-      span->color.rgba[span->end][ACOMP] = FixedToInt(a0);     \
-      span->texcoords[0][span->end][0] = fragTexcoord[0];              \
-      span->texcoords[0][span->end][1] = fragTexcoord[1];              \
-      span->texcoords[0][span->end][2] = fragTexcoord[2];              \
-      span->lambda[0][span->end] = 0.0;                                \
-      span->end++;                                             \
+      span.array->x[span.end] = X;                             \
+      span.array->y[span.end] = Y;                             \
+      span.array->z[span.end] = Z;                             \
+      span.array->fog[span.end] = fog0;                                \
+      span.array->rgba[span.end][RCOMP] = FixedToInt(r0);      \
+      span.array->rgba[span.end][GCOMP] = FixedToInt(g0);      \
+      span.array->rgba[span.end][BCOMP] = FixedToInt(b0);      \
+      span.array->rgba[span.end][ACOMP] = FixedToInt(a0);      \
+      span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \
+      span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \
+      span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \
+      span.array->lambda[0][span.end] = 0.0;                   \
+      span.end++;                                              \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_texture_span(ctx, span);
+      _mesa_write_texture_span(ctx, &span);
    }
 }
 
@@ -553,7 +603,7 @@ static void smooth_multitextured_line( GLcontext *ctx,
                                       const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
    GLuint u;
 
    ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
@@ -571,39 +621,39 @@ static void smooth_multitextured_line( GLcontext *ctx,
 #define INTERP_MULTITEX 1
 #define PLOT(X,Y)                                                      \
    {                                                                   \
-      span->xArray[span->end] = X;                                     \
-      span->yArray[span->end] = Y;                                     \
-      span->zArray[span->end] = Z;                                     \
-      span->fogArray[span->end] = fog0;                                        \
-      span->color.rgba[span->end][RCOMP] = FixedToInt(r0);             \
-      span->color.rgba[span->end][GCOMP] = FixedToInt(g0);             \
-      span->color.rgba[span->end][BCOMP] = FixedToInt(b0);             \
-      span->color.rgba[span->end][ACOMP] = FixedToInt(a0);             \
-      span->specArray[span->end][RCOMP] = FixedToInt(sr0);             \
-      span->specArray[span->end][GCOMP] = FixedToInt(sb0);             \
-      span->specArray[span->end][BCOMP] = FixedToInt(sb0);             \
+      span.array->x[span.end] = X;                                     \
+      span.array->y[span.end] = Y;                                     \
+      span.array->z[span.end] = Z;                                     \
+      span.array->fog[span.end] = fog0;                                        \
+      span.array->rgba[span.end][RCOMP] = FixedToInt(r0);              \
+      span.array->rgba[span.end][GCOMP] = FixedToInt(g0);              \
+      span.array->rgba[span.end][BCOMP] = FixedToInt(b0);              \
+      span.array->rgba[span.end][ACOMP] = FixedToInt(a0);              \
+      span.array->spec[span.end][RCOMP] = FixedToInt(sr0);             \
+      span.array->spec[span.end][GCOMP] = FixedToInt(sg0);             \
+      span.array->spec[span.end][BCOMP] = FixedToInt(sb0);             \
       for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {               \
          if (ctx->Texture.Unit[u]._ReallyEnabled) {                    \
-            span->texcoords[u][span->end][0] = fragTexcoord[u][0];     \
-            span->texcoords[u][span->end][1] = fragTexcoord[u][1];     \
-            span->texcoords[u][span->end][2] = fragTexcoord[u][2];     \
-            span->lambda[u][span->end] = 0.0;                          \
+            span.array->texcoords[u][span.end][0] = fragTexcoord[u][0];        \
+            span.array->texcoords[u][span.end][1] = fragTexcoord[u][1];        \
+            span.array->texcoords[u][span.end][2] = fragTexcoord[u][2];        \
+            span.array->lambda[u][span.end] = 0.0;                     \
          }                                                             \
       }                                                                        \
-      span->end++;                                                     \
+      span.end++;                                                      \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_texture_span(ctx, span);
+      _mesa_write_texture_span(ctx, &span);
    }
 }
 
@@ -616,27 +666,27 @@ static void flat_multitextured_line( GLcontext *ctx,
                                     const SWvertex *vert1 )
 {
    GLboolean xMajor = GL_FALSE;
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
    GLuint u;
 
    ASSERT(ctx->Light.ShadeModel == GL_FLAT);
 
    INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC,
             SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
-   span->red = ChanToFixed(vert1->color[0]);
-   span->green = ChanToFixed(vert1->color[1]);
-   span->blue = ChanToFixed(vert1->color[2]);
-   span->alpha = ChanToFixed(vert1->color[3]);
-   span->redStep = 0;
-   span->greenStep = 0;
-   span->blueStep = 0;
-   span->alphaStep = 0;
-   span->specRed = ChanToFixed(vert1->specular[0]);
-   span->specGreen = ChanToFixed(vert1->specular[1]);
-   span->specBlue = ChanToFixed(vert1->specular[2]);
-   span->specRedStep = 0;
-   span->specGreenStep = 0;
-   span->specBlueStep = 0;
+   span.red = ChanToFixed(vert1->color[0]);
+   span.green = ChanToFixed(vert1->color[1]);
+   span.blue = ChanToFixed(vert1->color[2]);
+   span.alpha = ChanToFixed(vert1->color[3]);
+   span.redStep = 0;
+   span.greenStep = 0;
+   span.blueStep = 0;
+   span.alphaStep = 0;
+   span.specRed = ChanToFixed(vert1->specular[0]);
+   span.specGreen = ChanToFixed(vert1->specular[1]);
+   span.specBlue = ChanToFixed(vert1->specular[2]);
+   span.specRedStep = 0;
+   span.specGreenStep = 0;
+   span.specBlueStep = 0;
 
 #define SET_XMAJOR 1
 #define INTERP_XY 1
@@ -645,32 +695,32 @@ static void flat_multitextured_line( GLcontext *ctx,
 #define INTERP_MULTITEX 1
 #define PLOT(X,Y)                                                      \
    {                                                                   \
-      span->xArray[span->end] = X;                                     \
-      span->yArray[span->end] = Y;                                     \
-      span->zArray[span->end] = Z;                                     \
-      span->fogArray[span->end] = fog0;                                        \
+      span.array->x[span.end] = X;                                     \
+      span.array->y[span.end] = Y;                                     \
+      span.array->z[span.end] = Z;                                     \
+      span.array->fog[span.end] = fog0;                                        \
       for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {               \
          if (ctx->Texture.Unit[u]._ReallyEnabled) {                    \
-            span->texcoords[u][span->end][0] = fragTexcoord[u][0];     \
-            span->texcoords[u][span->end][1] = fragTexcoord[u][1];     \
-            span->texcoords[u][span->end][2] = fragTexcoord[u][2];     \
-            span->lambda[u][span->end] = 0.0;                          \
+            span.array->texcoords[u][span.end][0] = fragTexcoord[u][0];        \
+            span.array->texcoords[u][span.end][1] = fragTexcoord[u][1];        \
+            span.array->texcoords[u][span.end][2] = fragTexcoord[u][2];        \
+            span.array->lambda[u][span.end] = 0.0;                     \
          }                                                             \
       }                                                                        \
-      span->end++;                                                     \
+      span.end++;                                                      \
    }
 #include "s_linetemp.h"
 
    if (ctx->Line.StippleFlag) {
-      span->arrayMask |= SPAN_MASK;
-      compute_stipple_mask(ctx, span->end, span->mask);
+      span.arrayMask |= SPAN_MASK;
+      compute_stipple_mask(ctx, span.end, span.array->mask);
    }
 
    if (ctx->Line.Width > 1.0) {
-      draw_wide_line(ctx, span, xMajor);
+      draw_wide_line(ctx, &span, xMajor);
    }
    else {
-      _mesa_write_texture_span(ctx, span);
+      _mesa_write_texture_span(ctx, &span);
    }
 }
 
index 99633ae436677c70c5f8eed97a3e9004f76ca1ac..083c3c4402e947e031f6e31947e9c7a5485f1a12 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_logic.c,v 1.10 2002/02/02 21:40:33 brianp Exp $ */
+/* $Id: s_logic.c,v 1.11 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -175,14 +175,15 @@ _mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span,
 
    /* Read dest values from frame buffer */
    if (span->arrayMask & SPAN_XY) {
-      (*swrast->Driver.ReadCI32Pixels)( ctx, span->end, span->xArray,
-                                        span->yArray, dest, span->mask );
+      (*swrast->Driver.ReadCI32Pixels)( ctx, span->end,
+                                        span->array->x, span->array->y,
+                                        dest, span->array->mask );
    }
    else {
       (*swrast->Driver.ReadCI32Span)( ctx, span->end, span->x, span->y, dest );
    }
 
-   index_logicop( ctx, span->end, index, dest, span->mask );
+   index_logicop( ctx, span->end, index, dest, span->array->mask );
 }
 
 
@@ -472,11 +473,12 @@ _mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span,
 
    if (span->arrayMask & SPAN_XY) {
       (*swrast->Driver.ReadRGBAPixels)(ctx, span->end,
-                                       span->xArray, span->yArray,
-                                       dest, span->mask);
+                                       span->array->x, span->array->y,
+                                       dest, span->array->mask);
       if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
-         _mesa_read_alpha_pixels(ctx, span->end, span->xArray, span->yArray,
-                                 dest, span->mask);
+         _mesa_read_alpha_pixels(ctx, span->end,
+                                 span->array->x, span->array->y,
+                                 dest, span->array->mask);
       }
    }
    else {
@@ -485,11 +487,11 @@ _mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span,
    }
 
    if (sizeof(GLchan) * 4 == sizeof(GLuint)) {
-      rgba_logicop_ui(ctx, span->end, span->mask,
+      rgba_logicop_ui(ctx, span->end, span->array->mask,
                       (GLuint *) rgba, (const GLuint *) dest);
    }
    else {
-      rgba_logicop_chan(ctx, 4 * span->end, span->mask,
+      rgba_logicop_chan(ctx, 4 * span->end, span->array->mask,
                         (GLchan *) rgba, (const GLchan *) dest);
    }
 }
index 00995cf997af5d940056504cf239a1eb061f6961..7e0adc42d3521813d0e40e50513a7f4fa805a235 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_masking.c,v 1.7 2002/02/02 21:40:33 brianp Exp $ */
+/* $Id: s_masking.c,v 1.8 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -65,11 +65,11 @@ _mesa_mask_rgba_span( GLcontext *ctx, const struct sw_span *span,
    ASSERT(span->arrayMask & SPAN_RGBA);
 
    if (span->arrayMask & SPAN_XY) {
-      (*swrast->Driver.ReadRGBAPixels)(ctx, n, span->xArray, span->yArray,
-                                       dest, span->mask);
+      (*swrast->Driver.ReadRGBAPixels)(ctx, n, span->array->x, span->array->y,
+                                       dest, span->array->mask);
       if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
-         _mesa_read_alpha_pixels(ctx, n, span->xArray, span->yArray,
-                                 dest, span->mask );
+         _mesa_read_alpha_pixels(ctx, n, span->array->x, span->array->y,
+                                 dest, span->array->mask);
       }
    }
    else {
@@ -150,8 +150,9 @@ _mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span,
 
    if (span->arrayMask & SPAN_XY) {
 
-      (*swrast->Driver.ReadCI32Pixels)(ctx, span->end, span->xArray,
-                                       span->yArray, fbindexes, span->mask);
+      (*swrast->Driver.ReadCI32Pixels)(ctx, span->end, span->array->x,
+                                       span->array->y, fbindexes,
+                                       span->array->mask);
 
       for (i = 0; i < span->end; i++) {
          index[i] = (index[i] & msrc) | (fbindexes[i] & mdest);
index 3afda84fa0efd4fc74e8af5c4707e9ea5fe7f223..687dfe307ac3a79243bc4b5cb3f749ac0f53c35b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_pixeltex.c,v 1.9 2002/05/02 00:59:20 brianp Exp $ */
+/* $Id: s_pixeltex.c,v 1.10 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -99,13 +99,13 @@ _swrast_pixel_texture(GLcontext *ctx, struct sw_span *span)
 
    /* convert colors into texture coordinates */
    pixeltexgen( ctx, span->end,
-                (const GLchan (*)[4]) span->color.rgba,
-                span->texcoords[0] );
+                (const GLchan (*)[4]) span->array->rgba,
+                span->array->texcoords[0] );
 
    /* copy the new texture units for all enabled units */
    for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) {
       if (ctx->Texture.Unit[unit]._ReallyEnabled) {
-         MEMCPY( span->texcoords[unit], span->texcoords[0],
+         MEMCPY( span->array->texcoords[unit], span->array->texcoords[0],
                  span->end * 4 * sizeof(GLfloat) );
       }
    }
index 1fc8ba39f4c90371f99f33c12d0a040ea1df50bd..be8783b69491b83fcae4cbb895a95eaf5a5ee049 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_pointtemp.h,v 1.17 2002/06/15 03:03:11 brianp Exp $ */
+/* $Id: s_pointtemp.h,v 1.18 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -77,7 +77,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
    const GLchan alpha = vert->color[3];
 #endif
 
-   struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
+   struct sw_span span;
 
    /* Cull primitives with malformed coordinates.
     */
@@ -88,58 +88,58 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
    }
 
    INIT_SPAN(span, GL_POINT, 0, SPAN_FOG, SPAN_XY | SPAN_Z);
-   span->fog = vert->fog;
-   span->fogStep = 0.0;
+   span.fog = vert->fog;
+   span.fogStep = 0.0;
 
 #if (FLAGS & RGBA)
 #if (FLAGS & SMOOTH)
    /* because we need per-fragment alpha values */
-   span->arrayMask |= SPAN_RGBA;
+   span.arrayMask |= SPAN_RGBA;
 #else
    /* same RGBA for all fragments */
-   span->interpMask |= SPAN_RGBA;
-   span->red = ChanToFixed(vert->color[0]);
-   span->green = ChanToFixed(vert->color[1]);
-   span->blue = ChanToFixed(vert->color[2]);
-   span->alpha = ChanToFixed(vert->color[3]);
-   span->redStep = span->greenStep = span->blueStep = span->alphaStep = 0;
+   span.interpMask |= SPAN_RGBA;
+   span.red = ChanToFixed(vert->color[0]);
+   span.green = ChanToFixed(vert->color[1]);
+   span.blue = ChanToFixed(vert->color[2]);
+   span.alpha = ChanToFixed(vert->color[3]);
+   span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0;
 #endif /*SMOOTH*/
 #endif /*RGBA*/
 #if FLAGS & SPECULAR
-   span->interpMask |= SPAN_SPEC;
-   span->specRed = ChanToFixed(vert->specular[0]);
-   span->specGreen = ChanToFixed(vert->specular[1]);
-   span->specBlue = ChanToFixed(vert->specular[2]);
-   span->specRedStep = span->specGreenStep = span->specBlueStep = 0;
+   span.interpMask |= SPAN_SPEC;
+   span.specRed = ChanToFixed(vert->specular[0]);
+   span.specGreen = ChanToFixed(vert->specular[1]);
+   span.specBlue = ChanToFixed(vert->specular[2]);
+   span.specRedStep = span.specGreenStep = span.specBlueStep = 0;
 #endif
 #if FLAGS & INDEX
-   span->interpMask |= SPAN_INDEX;
-   span->index = IntToFixed(vert->index);
-   span->indexStep = 0;
+   span.interpMask |= SPAN_INDEX;
+   span.index = IntToFixed(vert->index);
+   span.indexStep = 0;
 #endif
 #if FLAGS & TEXTURE
    /* but not used for sprite mode */
-   span->interpMask |= SPAN_TEXTURE;
+   span.interpMask |= SPAN_TEXTURE;
    for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
       if (ctx->Texture.Unit[u]._ReallyEnabled) {
          const GLfloat q = vert->texcoord[u][3];
          const GLfloat invQ = (q == 0.0 || q == 1.0) ? 1.0 : (1.0 / q);
-         span->tex[u][0] = vert->texcoord[u][0] * invQ;
-         span->tex[u][1] = vert->texcoord[u][1] * invQ;
-         span->tex[u][2] = vert->texcoord[u][2] * invQ;
-         span->tex[u][3] = q;
-         span->texStepX[u][0] = span->texStepY[u][0] = 0.0;
-         span->texStepX[u][1] = span->texStepY[u][1] = 0.0;
-         span->texStepX[u][2] = span->texStepY[u][2] = 0.0;
-         span->texStepX[u][3] = span->texStepY[u][3] = 0.0;
+         span.tex[u][0] = vert->texcoord[u][0] * invQ;
+         span.tex[u][1] = vert->texcoord[u][1] * invQ;
+         span.tex[u][2] = vert->texcoord[u][2] * invQ;
+         span.tex[u][3] = q;
+         span.texStepX[u][0] = span.texStepY[u][0] = 0.0;
+         span.texStepX[u][1] = span.texStepY[u][1] = 0.0;
+         span.texStepX[u][2] = span.texStepY[u][2] = 0.0;
+         span.texStepX[u][3] = span.texStepY[u][3] = 0.0;
       }
    }
 #endif
 #if FLAGS & SMOOTH
-   span->arrayMask |= SPAN_COVERAGE;
+   span.arrayMask |= SPAN_COVERAGE;
 #endif
 #if FLAGS & SPRITE
-   span->arrayMask |= SPAN_TEXTURE;
+   span.arrayMask |= SPAN_TEXTURE;
 #endif
 
 #if FLAGS & ATTENUATE
@@ -209,55 +209,55 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
             if (dist2 < rmax2) {
                if (dist2 >= rmin2) {
                   /* compute partial coverage */
-                  span->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
+                  span.array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
 #if FLAGS & INDEX
-                  span->coverage[count] *= 15.0; /* coverage in [0,15] */
+                  span.array->coverage[count] *= 15.0; /* coverage in [0,15] */
 #endif
                }
                else {
                   /* full coverage */
-                  span->coverage[count] = 1.0F;
+                  span.array->coverage[count] = 1.0F;
                }
 
-               span->xArray[count] = x;
-               span->yArray[count] = y;
-               span->zArray[count] = z;
+               span.array->x[count] = x;
+               span.array->y[count] = y;
+               span.array->z[count] = z;
 
 #if FLAGS & RGBA
-               span->color.rgba[count][RCOMP] = red;
-               span->color.rgba[count][GCOMP] = green;
-               span->color.rgba[count][BCOMP] = blue;
+               span.array->rgba[count][RCOMP] = red;
+               span.array->rgba[count][GCOMP] = green;
+               span.array->rgba[count][BCOMP] = blue;
 #if FLAGS & ATTENUATE
-               span->color.rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
+               span.array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
 #else
-               span->color.rgba[count][ACOMP] = alpha;
+               span.array->rgba[count][ACOMP] = alpha;
 #endif /*ATTENUATE*/
 #endif /*RGBA*/
                count++;
             } /*if*/
 #else /*SMOOTH*/
             /* not smooth (square points) */
-            span->xArray[count] = x;
-            span->yArray[count] = y;
-            span->zArray[count] = z;
+            span.array->x[count] = x;
+            span.array->y[count] = y;
+            span.array->z[count] = z;
 #if FLAGS & SPRITE
             for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
                if (ctx->Texture.Unit[u]._ReallyEnabled) {
                   if (ctx->Point.CoordReplace[u]) {
                      GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size;
                      GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size;
-                     span->texcoords[u][count][0] = s;
-                     span->texcoords[u][count][1] = t;
-                     span->texcoords[u][count][3] = 1.0F;
+                     span.array->texcoords[u][count][0] = s;
+                     span.array->texcoords[u][count][1] = t;
+                     span.array->texcoords[u][count][3] = 1.0F;
                      if (ctx->Point.SpriteRMode == GL_ZERO)
-                        span->texcoords[u][count][2] = 0.0F;
+                        span.array->texcoords[u][count][2] = 0.0F;
                      else if (ctx->Point.SpriteRMode == GL_S)
-                        span->texcoords[u][count][2] = vert->texcoord[u][0];
+                        span.array->texcoords[u][count][2] = vert->texcoord[u][0];
                      else /* GL_R */
-                        span->texcoords[u][count][2] = vert->texcoord[u][2];
+                        span.array->texcoords[u][count][2] = vert->texcoord[u][2];
                   }
                   else {
-                     COPY_4V(span->texcoords[u][count], vert->texcoord[u]);
+                     COPY_4V(span.array->texcoords[u][count], vert->texcoord[u]);
                   }
                }
             }
@@ -266,32 +266,32 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
 #endif /*SMOOTH*/
         } /*for x*/
       } /*for y*/
-      span->end = count;
+      span.end = count;
    }
 
 #else /* LARGE | ATTENUATE | SMOOTH | SPRITE */
 
    {
       /* size == 1 */
-      span->xArray[0] = (GLint) vert->win[0];
-      span->yArray[0] = (GLint) vert->win[1];
-      span->zArray[0] = (GLint) vert->win[2];
-      span->end = 1;
+      span.array->x[0] = (GLint) vert->win[0];
+      span.array->y[0] = (GLint) vert->win[1];
+      span.array->z[0] = (GLint) vert->win[2];
+      span.end = 1;
    }
 
 #endif /* LARGE || ATTENUATE || SMOOTH */
 
-   ASSERT(span->end > 0);
+   ASSERT(span.end > 0);
 
 #if FLAGS & (TEXTURE | SPRITE)
    if (ctx->Texture._EnabledUnits)
-      _mesa_write_texture_span(ctx, span);
+      _mesa_write_texture_span(ctx, &span);
    else
-      _mesa_write_rgba_span(ctx, span);
+      _mesa_write_rgba_span(ctx, &span);
 #elif FLAGS & RGBA
-   _mesa_write_rgba_span(ctx, span);
+   _mesa_write_rgba_span(ctx, &span);
 #else
-   _mesa_write_index_span(ctx, span);
+   _mesa_write_index_span(ctx, &span);
 #endif
 }
 
index 94cd4a9ce83e68c4cbe89ae26a91f098b7e104d9..67636569afc35b09765e50b3401fe6433a22df6c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_span.c,v 1.45 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_span.c,v 1.46 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -154,7 +154,7 @@ interpolate_colors(GLcontext *ctx, struct sw_span *span)
    const GLint db = span->blueStep;
    const GLint da = span->alphaStep;
    const GLuint n = span->end;
-   GLchan (*rgba)[4] = span->color.rgba;
+   GLchan (*rgba)[4] = span->array->rgba;
    GLuint i;
 
    ASSERT((span->interpMask & SPAN_RGBA)  &&
@@ -168,7 +168,7 @@ interpolate_colors(GLcontext *ctx, struct sw_span *span)
       color[BCOMP] = FixedToChan(b);
       color[ACOMP] = FixedToChan(a);
       for (i = 0; i < n; i++) {
-         COPY_CHAN4(span->color.rgba[i], color);
+         COPY_CHAN4(span->array->rgba[i], color);
       }
    }
    else {
@@ -195,7 +195,7 @@ interpolate_indexes(GLcontext *ctx, struct sw_span *span)
    GLfixed index = span->index;
    const GLint indexStep = span->indexStep;
    const GLuint n = span->end;
-   GLuint *indexes = span->color.index;
+   GLuint *indexes = span->array->index;
    GLuint i;
    ASSERT((span->interpMask & SPAN_INDEX)  &&
          !(span->arrayMask & SPAN_INDEX));
@@ -218,7 +218,7 @@ interpolate_indexes(GLcontext *ctx, struct sw_span *span)
 }
 
 
-/* Fill in the span.specArray array from the interpolation values */
+/* Fill in the span.->array->spec array from the interpolation values */
 static void
 interpolate_specular(GLcontext *ctx, struct sw_span *span)
 {
@@ -229,9 +229,9 @@ interpolate_specular(GLcontext *ctx, struct sw_span *span)
       const GLchan b = FixedToChan(span->specBlue);
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         span->specArray[i][RCOMP] = r;
-         span->specArray[i][GCOMP] = g;
-         span->specArray[i][BCOMP] = b;
+         span->array->spec[i][RCOMP] = r;
+         span->array->spec[i][GCOMP] = g;
+         span->array->spec[i][BCOMP] = b;
       }
    }
    else {
@@ -247,9 +247,9 @@ interpolate_specular(GLcontext *ctx, struct sw_span *span)
 #endif
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         span->specArray[i][RCOMP] = FixedToChan(r);
-         span->specArray[i][GCOMP] = FixedToChan(g);
-         span->specArray[i][BCOMP] = FixedToChan(b);
+         span->array->spec[i][RCOMP] = FixedToChan(r);
+         span->array->spec[i][GCOMP] = FixedToChan(g);
+         span->array->spec[i][BCOMP] = FixedToChan(b);
          r += span->specRedStep;
          g += span->specGreenStep;
          b += span->specBlueStep;
@@ -271,16 +271,18 @@ _mesa_span_interpolate_z( const GLcontext *ctx, struct sw_span *span )
 
    if (ctx->Visual.depthBits <= 16) {
       GLfixed zval = span->z;
-      for (i = 0; i < n; i++) {
-         span->zArray[i] = FixedToInt(zval);
+      GLdepth *z = span->array->z; 
+     for (i = 0; i < n; i++) {
+         z[i] = FixedToInt(zval);
          zval += span->zStep;
       }
    }
    else {
       /* Deep Z buffer, no fixed->int shift */
       GLfixed zval = span->z;
+      GLdepth *z = span->array->z;
       for (i = 0; i < n; i++) {
-         span->zArray[i] = zval;
+         z[i] = zval;
          zval += span->zStep;
       }
    }
@@ -355,6 +357,8 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
             const struct gl_texture_image *img = obj->Image[obj->BaseLevel];
             GLboolean needLambda = (obj->MinFilter != obj->MagFilter);
             if (needLambda) {
+               GLfloat (*texcoord)[4] = span->array->texcoords[u];
+               GLfloat *lambda = span->array->lambda[u];
                const GLfloat texW = (GLfloat) img->WidthScale;
                const GLfloat texH = (GLfloat) img->HeightScale;
                const GLfloat dsdx = span->texStepX[u][0];
@@ -371,12 +375,12 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
                GLuint i;
                for (i = 0; i < span->end; i++) {
                   const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
-                  span->texcoords[u][i][0] = s * invQ;
-                  span->texcoords[u][i][1] = t * invQ;
-                  span->texcoords[u][i][2] = r * invQ;
-                  span->lambda[u][i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
-                                                      dqdx, dqdy, texW, texH,
-                                                      s, t, q, invQ);
+                  texcoord[i][0] = s * invQ;
+                  texcoord[i][1] = t * invQ;
+                  texcoord[i][2] = r * invQ;
+                  lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
+                                             dqdx, dqdy, texW, texH,
+                                             s, t, q, invQ);
                   s += dsdx;
                   t += dtdx;
                   r += drdx;
@@ -385,6 +389,8 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
                span->arrayMask |= SPAN_LAMBDA;
             }
             else {
+               GLfloat (*texcoord)[4] = span->array->texcoords[u];
+               GLfloat *lambda = span->array->lambda[u];
                const GLfloat dsdx = span->texStepX[u][0];
                const GLfloat dtdx = span->texStepX[u][1];
                const GLfloat drdx = span->texStepX[u][2];
@@ -398,10 +404,10 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
                   /* Ortho projection or polygon's parallel to window X axis */
                   const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
                   for (i = 0; i < span->end; i++) {
-                     span->texcoords[u][i][0] = s * invQ;
-                     span->texcoords[u][i][1] = t * invQ;
-                     span->texcoords[u][i][2] = r * invQ;
-                     span->lambda[u][i] = 0.0;
+                     texcoord[i][0] = s * invQ;
+                     texcoord[i][1] = t * invQ;
+                     texcoord[i][2] = r * invQ;
+                     lambda[i] = 0.0;
                      s += dsdx;
                      t += dtdx;
                      r += drdx;
@@ -410,10 +416,10 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
                else {
                   for (i = 0; i < span->end; i++) {
                      const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
-                     span->texcoords[u][i][0] = s * invQ;
-                     span->texcoords[u][i][1] = t * invQ;
-                     span->texcoords[u][i][2] = r * invQ;
-                     span->lambda[u][i] = 0.0;
+                     texcoord[i][0] = s * invQ;
+                     texcoord[i][1] = t * invQ;
+                     texcoord[i][2] = r * invQ;
+                     lambda[i] = 0.0;
                      s += dsdx;
                      t += dtdx;
                      r += drdx;
@@ -432,6 +438,8 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
       span->arrayMask |= SPAN_TEXTURE;
       if (needLambda) {
          /* just texture unit 0, with lambda */
+         GLfloat (*texcoord)[4] = span->array->texcoords[0];
+         GLfloat *lambda = span->array->lambda[0];
          const GLfloat texW = (GLfloat) img->WidthScale;
          const GLfloat texH = (GLfloat) img->HeightScale;
          const GLfloat dsdx = span->texStepX[0][0];
@@ -448,12 +456,12 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
          GLuint i;
          for (i = 0; i < span->end; i++) {
             const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
-            span->lambda[0][i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
-                                                dqdx, dqdy, texW, texH,
-                                                s, t, q, invQ);
-            span->texcoords[0][i][0] = s * invQ;
-            span->texcoords[0][i][1] = t * invQ;
-            span->texcoords[0][i][2] = r * invQ;
+            lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy,
+                                       dqdx, dqdy, texW, texH,
+                                       s, t, q, invQ);
+            texcoord[i][0] = s * invQ;
+            texcoord[i][1] = t * invQ;
+            texcoord[i][2] = r * invQ;
             s += dsdx;
             t += dtdx;
             r += drdx;
@@ -463,6 +471,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
       }
       else {
          /* just texture 0, without lambda */
+         GLfloat (*texcoord)[4] = span->array->texcoords[0];
          const GLfloat dsdx = span->texStepX[0][0];
          const GLfloat dtdx = span->texStepX[0][1];
          const GLfloat drdx = span->texStepX[0][2];
@@ -476,9 +485,9 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
             /* Ortho projection or polygon's parallel to window X axis */
             const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
             for (i = 0; i < span->end; i++) {
-               span->texcoords[0][i][0] = s * invQ;
-               span->texcoords[0][i][1] = t * invQ;
-               span->texcoords[0][i][2] = r * invQ;
+               texcoord[i][0] = s * invQ;
+               texcoord[i][1] = t * invQ;
+               texcoord[i][2] = r * invQ;
                s += dsdx;
                t += dtdx;
                r += drdx;
@@ -487,9 +496,9 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
          else {
             for (i = 0; i < span->end; i++) {
                const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q);
-               span->texcoords[0][i][0] = s * invQ;
-               span->texcoords[0][i][1] = t * invQ;
-               span->texcoords[0][i][2] = r * invQ;
+               texcoord[i][0] = s * invQ;
+               texcoord[i][1] = t * invQ;
+               texcoord[i][2] = r * invQ;
                s += dsdx;
                t += dtdx;
                r += drdx;
@@ -509,6 +518,7 @@ stipple_polygon_span( GLcontext *ctx, struct sw_span *span )
 {
    const GLuint highbit = 0x80000000;
    const GLuint stipple = ctx->PolygonStipple[span->y % 32];
+   GLubyte *mask = span->array->mask;
    GLuint i, m;
 
    ASSERT(ctx->Polygon.StippleFlag);
@@ -518,7 +528,7 @@ stipple_polygon_span( GLcontext *ctx, struct sw_span *span )
 
    for (i = 0; i < span->end; i++) {
       if ((m & stipple) == 0) {
-        span->mask[i] = 0;
+        mask[i] = 0;
       }
       m = m >> 1;
       if (m == 0) {
@@ -546,10 +556,10 @@ clip_span( GLcontext *ctx, struct sw_span *span )
 
    if (span->arrayMask & SPAN_XY) {
       /* arrays of x/y pixel coords */
-      const GLint *x = span->xArray;
-      const GLint *y = span->yArray;
+      const GLint *x = span->array->x;
+      const GLint *y = span->array->y;
       const GLint n = span->end;
-      GLubyte *mask = span->mask;
+      GLubyte *mask = span->array->mask;
       GLint i;
       if (span->arrayMask & SPAN_MASK) {
          /* note: using & intead of && to reduce branches */
@@ -583,7 +593,7 @@ clip_span( GLcontext *ctx, struct sw_span *span )
       if (x < xmin) {
          ASSERT(x + n > xmin);
          span->writeAll = GL_FALSE;
-         BZERO(span->mask, (xmin - x) * sizeof(GLubyte));
+         BZERO(span->array->mask, (xmin - x) * sizeof(GLubyte));
       }
 
       /* Clip to right */
@@ -623,7 +633,7 @@ multi_write_index_span( GLcontext *ctx, struct sw_span *span )
             (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
 
          /* make copy of incoming indexes */
-         MEMCPY( indexTmp, span->color.index, span->end * sizeof(GLuint) );
+         MEMCPY( indexTmp, span->array->index, span->end * sizeof(GLuint) );
 
          if (ctx->Color.IndexLogicOpEnabled) {
             _mesa_logicop_ci_span(ctx, span, indexTmp);
@@ -636,13 +646,13 @@ multi_write_index_span( GLcontext *ctx, struct sw_span *span )
          if (span->arrayMask & SPAN_XY) {
             /* array of pixel coords */
             (*swrast->Driver.WriteCI32Pixels)(ctx, span->end,
-                                              span->xArray, span->yArray,
-                                              indexTmp, span->mask);
+                                              span->array->x, span->array->y,
+                                              indexTmp, span->array->mask);
          }
          else {
             /* horizontal run of pixels */
             (*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y,
-                                            indexTmp, span->mask);
+                                            indexTmp, span->array->mask);
          }
       }
    }
@@ -693,7 +703,7 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
          }
 
          /* make copy of incoming colors */
-         MEMCPY( rgbaTmp, span->color.rgba, 4 * span->end * sizeof(GLchan) );
+         MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) );
 
          if (ctx->Color.ColorLogicOpEnabled) {
             _mesa_logicop_rgba_span(ctx, span, rgbaTmp);
@@ -709,25 +719,25 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
          if (span->arrayMask & SPAN_XY) {
             /* array of pixel coords */
             (*swrast->Driver.WriteRGBAPixels)(ctx, span->end,
-                                              span->xArray, span->yArray,
+                                              span->array->x, span->array->y,
                                               (const GLchan (*)[4]) rgbaTmp,
-                                              span->mask);
+                                              span->array->mask);
             if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
                _mesa_write_alpha_pixels(ctx, span->end,
-                                        span->xArray, span->yArray,
+                                        span->array->x, span->array->y,
                                         (const GLchan (*)[4]) rgbaTmp,
-                                        span->mask);
+                                        span->array->mask);
             }
          }
          else {
             /* horizontal run of pixels */
             (*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y,
                                             (const GLchan (*)[4]) rgbaTmp,
-                                            span->mask);
+                                            span->array->mask);
             if (swrast->_RasterMask & ALPHABUF_BIT) {
                _mesa_write_alpha_span(ctx, span->end, span->x, span->y,
                                       (const GLchan (*)[4]) rgbaTmp,
-                                      span->mask);
+                                      span->array->mask);
             }
          }
       }
@@ -762,7 +772,7 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span)
       span->writeAll = GL_FALSE;
    }
    else {
-      MEMSET(span->mask, 1, span->end);
+      MEMSET(span->array->mask, 1, span->end);
       span->writeAll = GL_TRUE;
    }
 
@@ -777,11 +787,11 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span)
    if (span->arrayMask & SPAN_XY) {
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         if (span->mask[i]) {
-            assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
-            assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
-            assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
-            assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+         if (span->array->mask[i]) {
+            assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin);
+            assert(span->array->x[i] < ctx->DrawBuffer->_Xmax);
+            assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin);
+            assert(span->array->y[i] < ctx->DrawBuffer->_Ymax);
          }
       }
    }
@@ -837,10 +847,11 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span)
    /* Antialias coverage application */
    if (span->arrayMask & SPAN_COVERAGE) {
       GLuint i;
-      GLuint *index = span->color.index;
+      GLuint *index = span->array->index;
+      GLfloat *coverage = span->array->coverage;
       for (i = 0; i < span->end; i++) {
-         ASSERT(span->coverage[i] < 16);
-         index[i] = (index[i] & ~0xf) | ((GLuint) (span->coverage[i]));
+         ASSERT(coverage[i] < 16);
+         index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]);
       }
    }
 
@@ -851,11 +862,11 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span)
    else {
       /* normal situation: draw to exactly one buffer */
       if (ctx->Color.IndexLogicOpEnabled) {
-         _mesa_logicop_ci_span(ctx, span, span->color.index);
+         _mesa_logicop_ci_span(ctx, span, span->array->index);
       }
 
       if (ctx->Color.IndexMask != 0xffffffff) {
-         _mesa_mask_index_span(ctx, span, span->color.index);
+         _mesa_mask_index_span(ctx, span, span->array->index);
       }
 
       /* write pixels */
@@ -864,14 +875,14 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span)
          if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) {
             /* all pixels have same color index */
             (*swrast->Driver.WriteMonoCIPixels)(ctx, span->end,
-                                                span->xArray, span->yArray,
+                                                span->array->x, span->array->y,
                                                 FixedToInt(span->index),
-                                                span->mask);
+                                                span->array->mask);
          }
          else {
-            (*swrast->Driver.WriteCI32Pixels)(ctx, span->end, span->xArray,
-                                              span->yArray, span->color.index,
-                                              span->mask );
+            (*swrast->Driver.WriteCI32Pixels)(ctx, span->end, span->array->x,
+                                              span->array->y, span->array->index,
+                                              span->array->mask );
          }
       }
       else {
@@ -880,11 +891,12 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span)
             /* all pixels have same color index */
             (*swrast->Driver.WriteMonoCISpan)(ctx, span->end, span->x, span->y,
                                               FixedToInt(span->index),
-                                              span->mask);
+                                              span->array->mask);
          }
          else {
             (*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y,
-                                            span->color.index, span->mask);
+                                            span->array->index,
+                                            span->array->mask);
          }
       }
    }
@@ -920,16 +932,12 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span)
       ASSERT((span->interpMask | span->arrayMask) & SPAN_Z);
 #endif
 
-   /*
-   printf("%s()  interp 0x%x  array 0x%x  p=0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask, span->primitive);
-   */
-
    if (span->arrayMask & SPAN_MASK) {
       /* mask was initialized by caller, probably glBitmap */
       span->writeAll = GL_FALSE;
    }
    else {
-      MEMSET(span->mask, 1, span->end);
+      MEMSET(span->array->mask, 1, span->end);
       span->writeAll = GL_TRUE;
    }
 
@@ -949,11 +957,11 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span)
    if (span->arrayMask & SPAN_XY) {
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         if (span->mask[i]) {
-            assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
-            assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
-            assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
-            assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+         if (span->array->mask[i]) {
+            assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin);
+            assert(span->array->x[i] < ctx->DrawBuffer->_Xmax);
+            assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin);
+            assert(span->array->y[i] < ctx->DrawBuffer->_Ymax);
          }
       }
    }
@@ -1022,10 +1030,11 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span)
 
    /* Antialias coverage application */
    if (span->arrayMask & SPAN_COVERAGE) {
-      GLchan (*rgba)[4] = span->color.rgba;
+      GLchan (*rgba)[4] = span->array->rgba;
+      GLfloat *coverage = span->array->coverage;
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * span->coverage[i]);
+         rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
       }
       monoColor = GL_FALSE;
    }
@@ -1036,17 +1045,17 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span)
    else {
       /* normal: write to exactly one buffer */
       if (ctx->Color.ColorLogicOpEnabled) {
-         _mesa_logicop_rgba_span(ctx, span, span->color.rgba);
+         _mesa_logicop_rgba_span(ctx, span, span->array->rgba);
          monoColor = GL_FALSE;
       }
       else if (ctx->Color.BlendEnabled) {
-         _mesa_blend_span(ctx, span, span->color.rgba);
+         _mesa_blend_span(ctx, span, span->array->rgba);
          monoColor = GL_FALSE;
       }
 
       /* Color component masking */
       if (colorMask != 0xffffffff) {
-         _mesa_mask_rgba_span(ctx, span, span->color.rgba);
+         _mesa_mask_rgba_span(ctx, span, span->array->rgba);
          monoColor = GL_FALSE;
       }
 
@@ -1054,13 +1063,13 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span)
       if (span->arrayMask & SPAN_XY) {
          /* array of pixel coords */
          /* XXX test for mono color */
-         (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->xArray,
-             span->yArray, (const GLchan (*)[4]) span->color.rgba, span->mask);
+         (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x,
+             span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask);
          if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
             _mesa_write_alpha_pixels(ctx, span->end,
-                                     span->xArray, span->yArray,
-                                     (const GLchan (*)[4]) span->color.rgba,
-                                     span->mask);
+                                     span->array->x, span->array->y,
+                                     (const GLchan (*)[4]) span->array->rgba,
+                                     span->array->mask);
          }
       }
       else {
@@ -1073,18 +1082,18 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span)
             color[BCOMP] = FixedToChan(span->blue);
             color[ACOMP] = FixedToChan(span->alpha);
             (*swrast->Driver.WriteMonoRGBASpan)(ctx, span->end, span->x,
-                                                span->y, color, span->mask);
+                                                span->y, color, span->array->mask);
             /* XXX software alpha buffer writes! */
          }
          else {
             /* each pixel is a different color */
             (*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y,
-                      (const GLchan (*)[4]) span->color.rgba,
-                      span->writeAll ? ((const GLubyte *) NULL) : span->mask);
+                      (const GLchan (*)[4]) span->array->rgba,
+                      span->writeAll ? ((const GLubyte *) NULL) : span->array->mask);
             if (swrast->_RasterMask & ALPHABUF_BIT) {
                _mesa_write_alpha_span(ctx, span->end, span->x, span->y,
-                      (const GLchan (*)[4]) span->color.rgba,
-                      span->writeAll ? ((const GLubyte *) NULL) : span->mask);
+                      (const GLchan (*)[4]) span->array->rgba,
+                      span->writeAll ? ((const GLubyte *) NULL) : span->array->mask);
             }
          }
       }
@@ -1148,7 +1157,7 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span)
       span->writeAll = GL_FALSE;
    }
    else {
-      MEMSET(span->mask, 1, span->end);
+      MEMSET(span->array->mask, 1, span->end);
       span->writeAll = GL_TRUE;
    }
 
@@ -1163,11 +1172,11 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span)
    if (span->arrayMask & SPAN_XY) {
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         if (span->mask[i]) {
-            assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin);
-            assert(span->xArray[i] < ctx->DrawBuffer->_Xmax);
-            assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin);
-            assert(span->yArray[i] < ctx->DrawBuffer->_Ymax);
+         if (span->array->mask[i]) {
+            assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin);
+            assert(span->array->x[i] < ctx->DrawBuffer->_Xmax);
+            assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin);
+            assert(span->array->y[i] < ctx->DrawBuffer->_Ymax);
          }
       }
    }
@@ -1255,7 +1264,7 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span)
          interpolate_specular(ctx, span);
       }
       ASSERT(span->arrayMask & SPAN_SPEC);
-      add_colors( span->end, span->color.rgba, span->specArray );
+      add_colors( span->end, span->array->rgba, span->array->spec );
    }
 
    /* Fog */
@@ -1265,10 +1274,11 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span)
 
    /* Antialias coverage application */
    if (span->arrayMask & SPAN_COVERAGE) {
-      GLchan (*rgba)[4] = span->color.rgba;
+      GLchan (*rgba)[4] = span->array->rgba;
+      GLfloat *coverage = span->array->coverage;
       GLuint i;
       for (i = 0; i < span->end; i++) {
-         rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * span->coverage[i]);
+         rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]);
       }
    }
 
@@ -1278,37 +1288,37 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span)
    else {
       /* normal: write to exactly one buffer */
       if (ctx->Color.ColorLogicOpEnabled) {
-         _mesa_logicop_rgba_span(ctx, span, span->color.rgba);
+         _mesa_logicop_rgba_span(ctx, span, span->array->rgba);
       }
       else if (ctx->Color.BlendEnabled) {
-         _mesa_blend_span(ctx, span, span->color.rgba);
+         _mesa_blend_span(ctx, span, span->array->rgba);
       }
 
       if (colorMask != 0xffffffff) {
-         _mesa_mask_rgba_span(ctx, span, span->color.rgba);
+         _mesa_mask_rgba_span(ctx, span, span->array->rgba);
       }
 
  
       if (span->arrayMask & SPAN_XY) {
          /* array of pixel coords */
-         (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->xArray,
-             span->yArray, (const GLchan (*)[4]) span->color.rgba, span->mask);
+         (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x,
+             span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask);
          if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
             _mesa_write_alpha_pixels(ctx, span->end,
-                                     span->xArray, span->yArray,
-                                     (const GLchan (*)[4]) span->color.rgba,
-                                     span->mask);
+                                     span->array->x, span->array->y,
+                                     (const GLchan (*)[4]) span->array->rgba,
+                                     span->array->mask);
          }
       }
       else {
          /* horizontal run of pixels */
          (*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y,
-                                       (const GLchan (*)[4]) span->color.rgba,
-                                       span->writeAll ? NULL : span->mask);
+                                       (const GLchan (*)[4]) span->array->rgba,
+                                       span->writeAll ? NULL : span->array->mask);
          if (swrast->_RasterMask & ALPHABUF_BIT) {
             _mesa_write_alpha_span(ctx, span->end, span->x, span->y,
-                                   (const GLchan (*)[4]) span->color.rgba,
-                                   span->writeAll ? NULL : span->mask);
+                                   (const GLchan (*)[4]) span->array->rgba,
+                                   span->writeAll ? NULL : span->array->mask);
          }
       }
    }
index fd0b2973bc03d788e196d68fbb523a7272be2214..775868cb677696475072e2b04ffa63dbc900ad1a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_stencil.c,v 1.24 2002/04/20 17:54:55 brianp Exp $ */
+/* $Id: s_stencil.c,v 1.25 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -420,7 +420,7 @@ stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span)
    const GLuint n = span->end;
    const GLint x = span->x;
    const GLint y = span->y;
-   GLubyte *mask = span->mask;
+   GLubyte *mask = span->array->mask;
 
    ASSERT((span->arrayMask & SPAN_XY) == 0);
    ASSERT(ctx->Stencil.Enabled);
@@ -893,9 +893,9 @@ static GLboolean
 stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span )
 {
    const GLuint n = span->end;
-   const GLint *x = span->xArray;
-   const GLint *y = span->yArray;
-   GLubyte *mask = span->mask;
+   const GLint *x = span->array->x;
+   const GLint *y = span->array->y;
+   GLubyte *mask = span->array->mask;
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
 
    ASSERT(span->arrayMask & SPAN_XY);
index 405eae95f04909fa2a13a1e2658e5ac3447bae2b..f769e1e0f934b21e91d780d672a13c81ac2ab355 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.64 2002/06/26 14:56:20 brianp Exp $ */
+/* $Id: s_texture.c,v 1.65 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -3604,7 +3604,7 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
     * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
     */
    if (swrast->_AnyTextureCombine)
-      MEMCPY(primary_rgba, span->color.rgba, 4 * span->end * sizeof(GLchan));
+      MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan));
 
    /*
     * Must do all texture sampling before combining in order to
@@ -3614,7 +3614,7 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
       if (ctx->Texture.Unit[unit]._ReallyEnabled) {
          const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
          const struct gl_texture_object *curObj = texUnit->_Current;
-         GLfloat *lambda = span->lambda[unit];
+         GLfloat *lambda = span->array->lambda[unit];
          GLchan (*texels)[4] = (GLchan (*)[4])
             (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan)));
 
@@ -3642,7 +3642,7 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
 
          /* Sample the texture (span->end fragments) */
          swrast->TextureSample[unit]( ctx, unit, texUnit->_Current,
-                                      span->end, span->texcoords[unit],
+                                      span->end, span->array->texcoords[unit],
                                       lambda, texels );
       }
    }
@@ -3659,14 +3659,14 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
             texture_combine( ctx, unit, span->end,
                              (CONST GLchan (*)[4]) primary_rgba,
                              swrast->TexelBuffer,
-                             span->color.rgba );
+                             span->array->rgba );
          }
          else if (texUnit->EnvMode == GL_COMBINE4_NV) {
             /* GL_NV_texture_env_combine4 */
             texture_combine4( ctx, unit, span->end,
                               (CONST GLchan (*)[4]) primary_rgba,
                               swrast->TexelBuffer,
-                              span->color.rgba );
+                              span->array->rgba );
          }
          else {
             /* conventional texture blend */
@@ -3675,7 +3675,7 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
                 (span->end * 4 * sizeof(GLchan)));
             texture_apply( ctx, texUnit, span->end,
                            (CONST GLchan (*)[4]) primary_rgba, texels,
-                           span->color.rgba );
+                           span->array->rgba );
          }
       }
    }
index 634664371bd788dbb3c243e8dcffd52138d31c88..4e2c40625b43bfcf5fc1858f0eb24da885fe345d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_triangle.c,v 1.60 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.61 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -49,7 +49,9 @@
 #include "s_triangle.h"
 
 
-
+/*
+ * Just used for feedback mode.
+ */
 GLboolean _mesa_cull_triangle( GLcontext *ctx,
                            const SWvertex *v0,
                            const SWvertex *v1,
@@ -81,11 +83,11 @@ static void flat_ci_triangle( GLcontext *ctx,
 #define INTERP_FOG 1
 
 #define SETUP_CODE                                     \
-   span->interpMask |= SPAN_INDEX;                     \
-   span->index = IntToFixed(v2->index);                        \
-   span->indexStep = 0;
+   span.interpMask |= SPAN_INDEX;                      \
+   span.index = IntToFixed(v2->index);                 \
+   span.indexStep = 0;
 
-#define RENDER_SPAN( span )  _mesa_write_index_span(ctx, span);
+#define RENDER_SPAN( span )  _mesa_write_index_span(ctx, &span);
 
 #include "s_tritemp.h"
 }
@@ -104,7 +106,7 @@ static void smooth_ci_triangle( GLcontext *ctx,
 #define INTERP_FOG 1
 #define INTERP_INDEX 1
 
-#define RENDER_SPAN( span )  _mesa_write_index_span(ctx, span);
+#define RENDER_SPAN( span )  _mesa_write_index_span(ctx, &span);
 
 #include "s_tritemp.h"
 }
@@ -126,17 +128,17 @@ static void flat_rgba_triangle( GLcontext *ctx,
 #define SETUP_CODE                             \
    ASSERT(ctx->Texture._EnabledUnits == 0);    \
    ASSERT(ctx->Light.ShadeModel==GL_FLAT);     \
-   span->interpMask |= SPAN_RGBA;              \
-   span->red = ChanToFixed(v2->color[0]);      \
-   span->green = ChanToFixed(v2->color[1]);    \
-   span->blue = ChanToFixed(v2->color[2]);     \
-   span->alpha = ChanToFixed(v2->color[3]);    \
-   span->redStep = 0;                          \
-   span->greenStep = 0;                                \
-   span->blueStep = 0;                         \
-   span->alphaStep = 0;
-
-#define RENDER_SPAN( span )  _mesa_write_rgba_span(ctx, span);
+   span.interpMask |= SPAN_RGBA;               \
+   span.red = ChanToFixed(v2->color[0]);       \
+   span.green = ChanToFixed(v2->color[1]);     \
+   span.blue = ChanToFixed(v2->color[2]);      \
+   span.alpha = ChanToFixed(v2->color[3]);     \
+   span.redStep = 0;                           \
+   span.greenStep = 0;                         \
+   span.blueStep = 0;                          \
+   span.alphaStep = 0;
+
+#define RENDER_SPAN( span )  _mesa_write_rgba_span(ctx, &span);
 
 #include "s_tritemp.h"
 }
@@ -165,7 +167,7 @@ static void smooth_rgba_triangle( GLcontext *ctx,
       ASSERT(ctx->Light.ShadeModel==GL_SMOOTH);        \
    }
 
-#define RENDER_SPAN( span )  _mesa_write_rgba_span(ctx, span);
+#define RENDER_SPAN( span )  _mesa_write_rgba_span(ctx, &span);
 
 #include "s_tritemp.h"
 
@@ -204,21 +206,21 @@ static void simple_textured_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span  )                                           \
    GLuint i;                                                           \
-   span->intTex[0] -= FIXED_HALF; /* off-by-one error? */              \
-   span->intTex[1] -= FIXED_HALF;                                      \
-   for (i = 0; i < span->end; i++) {                                   \
-      GLint s = FixedToInt(span->intTex[0]) & smask;                   \
-      GLint t = FixedToInt(span->intTex[1]) & tmask;                   \
+   span.intTex[0] -= FIXED_HALF; /* off-by-one error? */               \
+   span.intTex[1] -= FIXED_HALF;                                       \
+   for (i = 0; i < span.end; i++) {                                    \
+      GLint s = FixedToInt(span.intTex[0]) & smask;                    \
+      GLint t = FixedToInt(span.intTex[1]) & tmask;                    \
       GLint pos = (t << twidth_log2) + s;                              \
       pos = pos + pos + pos;  /* multiply by 3 */                      \
-      span->color.rgb[i][RCOMP] = texture[pos];                                \
-      span->color.rgb[i][GCOMP] = texture[pos+1];                      \
-      span->color.rgb[i][BCOMP] = texture[pos+2];                      \
-      span->intTex[0] += span->intTexStep[0];                          \
-      span->intTex[1] += span->intTexStep[1];                          \
+      span.array->rgb[i][RCOMP] = texture[pos];                                \
+      span.array->rgb[i][GCOMP] = texture[pos+1];                      \
+      span.array->rgb[i][BCOMP] = texture[pos+2];                      \
+      span.intTex[0] += span.intTexStep[0];                            \
+      span.intTex[1] += span.intTexStep[1];                            \
    }                                                                   \
-   (*swrast->Driver.WriteRGBSpan)(ctx, span->end, span->x, span->y,    \
-                                  (CONST GLchan (*)[3]) span->color.rgb,\
+   (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y,       \
+                                  (CONST GLchan (*)[3]) span.array->rgb,\
                                   NULL );
 
 #include "s_tritemp.h"
@@ -260,31 +262,31 @@ static void simple_z_textured_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                                            \
    GLuint i;                                                           \
-   span->intTex[0] -= FIXED_HALF; /* off-by-one error? */              \
-   span->intTex[1] -= FIXED_HALF;                                      \
-   for (i = 0; i < span->end; i++) {                                   \
-      const GLdepth z = FixedToDepth(span->z);                         \
+   span.intTex[0] -= FIXED_HALF; /* off-by-one error? */               \
+   span.intTex[1] -= FIXED_HALF;                                       \
+   for (i = 0; i < span.end; i++) {                                    \
+      const GLdepth z = FixedToDepth(span.z);                          \
       if (z < zRow[i]) {                                               \
-         GLint s = FixedToInt(span->intTex[0]) & smask;                        \
-         GLint t = FixedToInt(span->intTex[1]) & tmask;                        \
+         GLint s = FixedToInt(span.intTex[0]) & smask;                 \
+         GLint t = FixedToInt(span.intTex[1]) & tmask;                 \
          GLint pos = (t << twidth_log2) + s;                           \
          pos = pos + pos + pos;  /* multiply by 3 */                   \
-         span->color.rgb[i][RCOMP] = texture[pos];                     \
-         span->color.rgb[i][GCOMP] = texture[pos+1];                   \
-         span->color.rgb[i][BCOMP] = texture[pos+2];                   \
+         span.array->rgb[i][RCOMP] = texture[pos];                     \
+         span.array->rgb[i][GCOMP] = texture[pos+1];                   \
+         span.array->rgb[i][BCOMP] = texture[pos+2];                   \
          zRow[i] = z;                                                  \
-         span->mask[i] = 1;                                            \
+         span.array->mask[i] = 1;                                      \
       }                                                                        \
       else {                                                           \
-         span->mask[i] = 0;                                            \
+         span.array->mask[i] = 0;                                      \
       }                                                                        \
-      span->intTex[0] += span->intTexStep[0];                          \
-      span->intTex[1] += span->intTexStep[1];                          \
-      span->z += span->zStep;                                          \
+      span.intTex[0] += span.intTexStep[0];                            \
+      span.intTex[1] += span.intTexStep[1];                            \
+      span.z += span.zStep;                                            \
    }                                                                   \
-   (*swrast->Driver.WriteRGBSpan)(ctx, span->end, span->x, span->y,    \
-                                  (CONST GLchan (*)[3]) span->color.rgb,\
-                                  span->mask );
+   (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y,       \
+                                  (CONST GLchan (*)[3]) span.array->rgb,\
+                                  span.array->mask );
 
 #include "s_tritemp.h"
 }
@@ -452,7 +454,7 @@ affine_span(GLcontext *ctx, struct sw_span *span,
 
 
    GLuint i;
-   GLchan *dest = span->color.rgba[0];
+   GLchan *dest = span->array->rgba[0];
 
    span->intTex[0] -= FIXED_HALF;
    span->intTex[1] -= FIXED_HALF;
@@ -589,7 +591,7 @@ static void affine_textured_triangle( GLcontext *ctx,
    info.format = obj->Image[b]->Format;                                        \
    info.filter = obj->MinFilter;                                       \
    info.envmode = unit->EnvMode;                                       \
-   span->arrayMask |= SPAN_RGBA;                                       \
+   span.arrayMask |= SPAN_RGBA;                                                \
                                                                        \
    if (info.envmode == GL_BLEND) {                                     \
       /* potential off-by-one error here? (1.0f -> 2048 -> 0) */       \
@@ -624,7 +626,7 @@ static void affine_textured_triangle( GLcontext *ctx,
    }                                                                   \
    info.tsize = obj->Image[b]->Height * info.tbytesline;
 
-#define RENDER_SPAN( span )   affine_span(ctx, span, &info);
+#define RENDER_SPAN( span )   affine_span(ctx, &span, &info);
 
 #include "s_tritemp.h"
 
@@ -719,7 +721,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
 
    GLuint i;
    GLfloat tex_coord[3], tex_step[3];
-   GLchan *dest = span->color.rgba[0];
+   GLchan *dest = span->array->rgba[0];
 
    tex_coord[0] = span->tex[0][0]  * (info->smask + 1);
    tex_step[0] = span->texStepX[0][0] * (info->smask + 1);
@@ -824,7 +826,6 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
    ASSERT(span->arrayMask & SPAN_RGBA);
    _mesa_write_rgba_span(ctx, span);
 
-
 #undef SPAN_NEAREST
 #undef SPAN_LINEAR
 }
@@ -895,9 +896,9 @@ static void persp_textured_triangle( GLcontext *ctx,
    info.tsize = obj->Image[b]->Height * info.tbytesline;
 
 #define RENDER_SPAN( span )                    \
-   span->interpMask &= ~SPAN_RGBA;             \
-   span->arrayMask |= SPAN_RGBA;               \
-   fast_persp_span(ctx, span, &info);
+   span.interpMask &= ~SPAN_RGBA;              \
+   span.arrayMask |= SPAN_RGBA;                        \
+   fast_persp_span(ctx, &span, &info);
 
 #include "s_tritemp.h"
 
@@ -926,7 +927,7 @@ static void general_textured_triangle( GLcontext *ctx,
 #define INTERP_ALPHA 1
 #define INTERP_TEX 1
 
-#define RENDER_SPAN( span )   _mesa_write_texture_span(ctx, span);
+#define RENDER_SPAN( span )   _mesa_write_texture_span(ctx, &span);
 
 #include "s_tritemp.h"
 }
@@ -953,7 +954,7 @@ multitextured_triangle( GLcontext *ctx,
 #define INTERP_SPEC 1
 #define INTERP_MULTITEX 1
 
-#define RENDER_SPAN( span )   _mesa_write_texture_span(ctx, span);
+#define RENDER_SPAN( span )   _mesa_write_texture_span(ctx, &span);
 
 #include "s_tritemp.h"
 
@@ -975,13 +976,13 @@ static void occlusion_zless_triangle( GLcontext *ctx,
 
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
-   for (i = 0; i < span->end; i++) {                   \
-      GLdepth z = FixedToDepth(span->z);               \
+   for (i = 0; i < span.end; i++) {                    \
+      GLdepth z = FixedToDepth(span.z);                        \
       if (z < zRow[i]) {                               \
          ctx->OcclusionResult = GL_TRUE;               \
          return;                                       \
       }                                                        \
-      span->z += span->zStep;                          \
+      span.z += span.zStep;                            \
    }
 
 #include "s_tritemp.h"
index 960fdf2d5ed037c2c8129b4e81de92d673844c39..f96a3f5c2978a6a0d6fad82149ee093cb8d42742 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_zoom.c,v 1.16 2002/04/19 14:05:50 brianp Exp $ */
+/* $Id: s_zoom.c,v 1.17 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -48,16 +48,19 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
    const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH );
    GLchan rgbaSave[MAX_WIDTH][4];
    GLuint indexSave[MAX_WIDTH];
-   struct sw_span zoomed;
    const GLchan (*rgba)[4] = (const GLchan (*)[4]) src;
    const GLchan (*rgb)[3] = (const GLchan (*)[3]) src;
    const GLuint *indexes = (const GLuint *) src;
+   struct sw_span zoomed;
+   struct span_arrays zoomed_arrays;  /* this is big! */
 
    /* no pixel arrays! */
    ASSERT((span->arrayMask & SPAN_XY) == 0);
    ASSERT(span->primitive == GL_BITMAP);
 
-   INIT_SPAN((&zoomed), GL_BITMAP, 0, 0, 0);
+   INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0);
+   zoomed.array = &zoomed_arrays;
+
    if (format == GL_RGBA || format == GL_RGB) {
       zoomed.z = span->z;
       zoomed.zStep = span->z;
@@ -141,7 +144,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
          /* common case */
          for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) {
             i = span->end - (j + skipCol) - 1;
-            COPY_CHAN4(zoomed.color.rgba[j], rgba[i]);
+            COPY_CHAN4(zoomed.array->rgba[j], rgba[i]);
          }
       }
       else {
@@ -151,7 +154,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
             i = (GLint) ((j + skipCol) * xscale);
             if (i < 0)
                i = span->end + i - 1;
-            COPY_CHAN4(zoomed.color.rgba[j], rgba[i]);
+            COPY_CHAN4(zoomed.array->rgba[j], rgba[i]);
          }
       }
    }
@@ -160,10 +163,10 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
          /* common case */
          for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) {
             i = span->end - (j + skipCol) - 1;
-            zoomed.color.rgba[j][0] = rgb[i][0];
-            zoomed.color.rgba[j][1] = rgb[i][1];
-            zoomed.color.rgba[j][2] = rgb[i][2];
-            zoomed.color.rgba[j][3] = CHAN_MAX;
+            zoomed.array->rgba[j][0] = rgb[i][0];
+            zoomed.array->rgba[j][1] = rgb[i][1];
+            zoomed.array->rgba[j][2] = rgb[i][2];
+            zoomed.array->rgba[j][3] = CHAN_MAX;
          }
       }
       else {
@@ -173,10 +176,10 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
             i = (GLint) ((j + skipCol) * xscale);
             if (i < 0)
                i = span->end + i - 1;
-            zoomed.color.rgba[j][0] = rgb[i][0];
-            zoomed.color.rgba[j][1] = rgb[i][1];
-            zoomed.color.rgba[j][2] = rgb[i][2];
-            zoomed.color.rgba[j][3] = CHAN_MAX;
+            zoomed.array->rgba[j][0] = rgb[i][0];
+            zoomed.array->rgba[j][1] = rgb[i][1];
+            zoomed.array->rgba[j][2] = rgb[i][2];
+            zoomed.array->rgba[j][3] = CHAN_MAX;
          }
       }
    }
@@ -185,7 +188,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
          /* common case */
          for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) {
             i = span->end - (j + skipCol) - 1;
-            zoomed.color.index[j] = indexes[i];
+            zoomed.array->index[j] = indexes[i];
          }
       }
       else {
@@ -195,7 +198,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
             i = (GLint) ((j + skipCol) * xscale);
             if (i < 0)
                i = span->end + i - 1;
-            zoomed.color.index[j] = indexes[i];
+            zoomed.array->index[j] = indexes[i];
          }
       }
    }
@@ -206,25 +209,25 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
        * going to call _mesa_write_zoomed_span() more than once.
        */
       if (r1 - r0 > 1) {
-         MEMCPY(rgbaSave, zoomed.color.rgba, zoomed.end * 4 * sizeof(GLchan));
+         MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan));
       }
       for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) {
          _mesa_write_rgba_span(ctx, &zoomed);
          if (r1 - r0 > 1) {
             /* restore the colors */
-            MEMCPY(zoomed.color.rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan));
+            MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan));
          }
       }
    }
    else if (format == GL_COLOR_INDEX) {
       if (r1 - r0 > 1) {
-         MEMCPY(indexSave, zoomed.color.index, zoomed.end * sizeof(GLuint));
+         MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint));
       }
       for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) {
          _mesa_write_index_span(ctx, &zoomed);
          if (r1 - r0 > 1) {
             /* restore the colors */
-            MEMCPY(zoomed.color.index, indexSave, zoomed.end * sizeof(GLuint));
+            MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint));
          }
       }
    }
@@ -251,7 +254,7 @@ void
 _mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span,
                                GLint y0 )
 {
-  zoom_span(ctx, span, (const GLvoid *) span->color.index, y0, GL_COLOR_INDEX);
+  zoom_span(ctx, span, (const GLvoid *) span->array->index, y0, GL_COLOR_INDEX);
 }
 
 
index a33e97ec0172b30a41731ec463d846091deb880f..493534c4babd9f7f8afe5d31dbd9436110ef0e98 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: swrast.h,v 1.25 2002/07/09 01:22:52 brianp Exp $ */
+/* $Id: swrast.h,v 1.26 2002/08/07 00:45:07 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -112,6 +112,28 @@ typedef struct {
 #define SPAN_MASK         0x800  /* arrayMask only */
 
 
+struct span_arrays {
+   /**
+    * Arrays of fragment values.  These will either be computed from the
+    * x/xStep values above or filled in by glDraw/CopyPixels, etc.
+    */
+   GLchan  rgb[MAX_WIDTH][3];
+   GLchan  rgba[MAX_WIDTH][4];
+   GLuint  index[MAX_WIDTH];
+   GLchan  spec[MAX_WIDTH][4]; /* specular color */
+   GLint   x[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
+   GLint   y[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
+   GLdepth z[MAX_WIDTH];
+   GLfloat fog[MAX_WIDTH];
+   GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4];
+   GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];
+   GLfloat coverage[MAX_WIDTH];
+
+   /** This mask indicates if fragment is alive or culled */
+   GLubyte mask[MAX_WIDTH];
+};
+
+
 struct sw_span {
    GLint x, y;
 
@@ -158,40 +180,28 @@ struct sw_span {
 
    /**
     * This bitmask (of SPAN_* flags) indicates which of the fragment arrays
-    * are relevant.
+    * in the span_arrays struct are relevant.
     */
    GLuint arrayMask;
 
    /**
-    * Arrays of fragment values.  These will either be computed from the
-    * x/xStep values above or filled in by glDraw/CopyPixels, etc.
+    * We store the arrays of fragment values in a separate struct so
+    * that we can allocate sw_span structs on the stack without using
+    * a lot of memory.  The span_arrays struct is about 400KB while the
+    * sw_span struct is only about 512 bytes.
     */
-   union {
-      GLchan rgb[MAX_WIDTH][3];
-      GLchan rgba[MAX_WIDTH][4];
-      GLuint index[MAX_WIDTH];
-   } color;
-   GLchan  specArray[MAX_WIDTH][4];
-   GLint   xArray[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
-   GLint   yArray[MAX_WIDTH];  /**< X/Y used for point/line rendering only */
-   GLdepth zArray[MAX_WIDTH];
-   GLfloat fogArray[MAX_WIDTH];
-   GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4];
-   GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH];
-   GLfloat coverage[MAX_WIDTH];
-
-  /** This mask indicates if fragment is alive or culled */
-   GLubyte mask[MAX_WIDTH];
+   struct span_arrays *array;
 };
 
 
-#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK)  \
-do {                              \
-   S->primitive = (PRIMITIVE);     \
-   S->interpMask = (INTERP_MASK);  \
-   S->arrayMask = (ARRAY_MASK);    \
-   S->start = 0;                   \
-   S->end = (END);                 \
+#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK)  \
+do {                                                           \
+   (S).primitive = (PRIMITIVE);                                        \
+   (S).interpMask = (INTERP_MASK);                             \
+   (S).arrayMask = (ARRAY_MASK);                               \
+   (S).start = 0;                                              \
+   (S).end = (END);                                            \
+   (S).array = SWRAST_CONTEXT(ctx)->span_data;                 \
 } while (0)