moved function declaration into the template, define the NAME to specify the function...
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 13 Nov 2002 16:51:01 +0000 (16:51 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 13 Nov 2002 16:51:01 +0000 (16:51 +0000)
src/mesa/drivers/dos/dmesa.c
src/mesa/drivers/x11/xm_tri.c
src/mesa/swrast/s_triangle.c
src/mesa/swrast/s_tritemp.h

index 77c9a3a1b8584e950eb94a29a707eeb66e83b45d..2034fb1cff3c40e89da5e1f095ab5d084966a812 100644 (file)
@@ -274,43 +274,34 @@ static void read_rgba_pixels (const GLcontext *ctx,
 /*\r
  * flat, NON-depth-buffered, triangle.\r
  */\r
-static void tri_rgb_flat (GLcontext *ctx,\r
-                          const SWvertex *v0,\r
-                          const SWvertex *v1,\r
-                          const SWvertex *v2)\r
-{\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
+#define NAME tri_rgb_flat\r
+#define SETUP_CODE                                             \\r
+ GLuint rgb = vl_mixrgb(v2->color);                            \\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;          \\r
+ void *b = c->Buffer->the_window;                              \\r
  GLuint w = c->Buffer->width, h = c->Buffer->height;\r
 \r
-#define SETUP_CODE GLuint rgb = vl_mixrgb(v2->color);\r
-\r
 #define RENDER_SPAN(span)                                      \\r
  GLuint i, offset = FLIP2(span.y)*w + span.x;                  \\r
  for (i = 0; i < span.end; i++, offset++) {                    \\r
      vl_putpixel(b, offset, rgb);                              \\r
  }\r
-\r
 #include "swrast/s_tritemp.h"\r
-}\r
+\r
 \r
 \r
 \r
 /*\r
  * flat, depth-buffered, triangle.\r
  */\r
-static void tri_rgb_flat_z (GLcontext *ctx,\r
-                            const SWvertex *v0,\r
-                            const SWvertex *v1,\r
-                            const SWvertex *v2)\r
-{\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
- GLuint w = c->Buffer->width, h = c->Buffer->height;\r
-\r
+#define NAME tri_rgb_flat_z\r
 #define INTERP_Z 1\r
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE\r
-#define SETUP_CODE GLuint rgb = vl_mixrgb(v2->color);\r
+#define SETUP_CODE                                             \\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;          \\r
+ void *b = c->Buffer->the_window;                              \\r
+ GLuint w = c->Buffer->width, h = c->Buffer->height;           \\r
+ GLuint rgb = vl_mixrgb(v2->color);\r
 \r
 #define RENDER_SPAN(span)                                      \\r
  GLuint i, offset = FLIP2(span.y)*w + span.x;                  \\r
@@ -322,25 +313,20 @@ static void tri_rgb_flat_z (GLcontext *ctx,
      }                                                         \\r
      span.z += span.zStep;                                     \\r
  }\r
-\r
 #include "swrast/s_tritemp.h"\r
-}\r
+\r
 \r
 \r
 \r
 /*\r
  * smooth, NON-depth-buffered, triangle.\r
  */\r
-static void tri_rgb_smooth (GLcontext *ctx,\r
-                            const SWvertex *v0,\r
-                            const SWvertex *v1,\r
-                            const SWvertex *v2)\r
-{\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
- GLuint w = c->Buffer->width, h = c->Buffer->height;\r
-\r
+#define NAME tri_rgb_smooth\r
 #define INTERP_RGB 1\r
+#define SETUP_CODE                                             \\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;          \\r
+ void *b = c->Buffer->the_window;                              \\r
+ GLuint w = c->Buffer->width, h = c->Buffer->height;\r
 #define RENDER_SPAN(span)                                      \\r
  GLuint i, offset = FLIP2(span.y)*w + span.x;                  \\r
  for (i = 0; i < span.end; i++, offset++) {                    \\r
@@ -353,28 +339,21 @@ static void tri_rgb_smooth (GLcontext *ctx,
      span.green += span.greenStep;                             \\r
      span.blue += span.blueStep;                               \\r
  }\r
-\r
 #include "swrast/s_tritemp.h"\r
-}\r
 \r
 \r
 \r
 /*\r
  * smooth, depth-buffered, triangle.\r
  */\r
-static void tri_rgb_smooth_z (GLcontext *ctx,\r
-                              const SWvertex *v0,\r
-                              const SWvertex *v1,\r
-                              const SWvertex *v2)\r
-{\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
- GLuint w = c->Buffer->width, h = c->Buffer->height;\r
-\r
+#define NAME tri_rgb_smooth_z\r
 #define INTERP_Z 1\r
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE\r
 #define INTERP_RGB 1\r
-\r
+#define SETUP_CODE                                             \\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;          \\r
+ void *b = c->Buffer->the_window;                              \\r
+ GLuint w = c->Buffer->width, h = c->Buffer->height;\r
 #define RENDER_SPAN(span)                                      \\r
  GLuint i, offset = FLIP2(span.y)*w + span.x;                  \\r
  for (i = 0; i < span.end; i++, offset++) {                    \\r
@@ -392,9 +371,8 @@ static void tri_rgb_smooth_z (GLcontext *ctx,
      span.blue += span.blueStep;                               \\r
      span.z += span.zStep;                                     \\r
  }\r
-\r
 #include "swrast/s_tritemp.h"\r
-}\r
+\r
 \r
 \r
 \r
index 17bbc27a5c53d09c31713d42774247209b30c9ed..68f457c409d25964dee898f684fc2947aa4be4c5 100644 (file)
@@ -1,8 +1,8 @@
-/* $Id: xm_tri.c,v 1.29 2002/10/30 20:24:47 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.30 2002/11/13 16:51:02 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
+ * Version:  5.1
  *
  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
  *
 /*
  * XImage, smooth, depth-buffered, PF_TRUECOLOR triangle.
  */
-static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx,
-                                         const SWvertex *v0,
-                                        const SWvertex *v1,
-                                        const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME smooth_TRUECOLOR_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaImage *img = xmesa->xm_buffer->backimage;
 
 #define RENDER_SPAN( span )                                    \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -86,25 +83,22 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx,
    }
 
 #include "swrast/s_tritemp.h"
-}
+
 
 
 
 /*
  * XImage, smooth, depth-buffered, PF_8A8B8G8R triangle.
  */
-static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx,
-                                       const SWvertex *v0,
-                                       const SWvertex *v1,
-                                       const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_8A8B8G8R_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
@@ -122,24 +116,21 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx,
    }
 
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, PF_8R8G8B triangle.
  */
-static void smooth_8R8G8B_z_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_8R8G8B_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
@@ -157,25 +148,21 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx,
    }
 
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, PF_8R8G8B24 triangle.
  */
-static void smooth_8R8G8B24_z_triangle( GLcontext *ctx,
-                                        const SWvertex *v0,
-                                       const SWvertex *v1,
-                                       const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_8R8G8B24_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE bgr_t
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    for (i = 0; i < span.end; i++) {                            \
@@ -192,25 +179,20 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, PF_TRUEDITHER triangle.
  */
-static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx,
-                                         const SWvertex *v0,
-                                         const SWvertex *v1,
-                                         const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME smooth_TRUEDITHER_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
-
+#define SETUP_CODE                                             \
+   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);       \
@@ -228,27 +210,22 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, PF_5R6G5B triangle.
  */
-static void smooth_5R6G5B_z_triangle( GLcontext *ctx,
-                                      const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_5R6G5B_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    for (i = 0; i < span.end; i++) {                            \
@@ -263,27 +240,22 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, PF_DITHER_5R6G5B triangle.
  */
-static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
-                                             const SWvertex *v0,
-                                            const SWvertex *v1,
-                                            const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_DITHER_5R6G5B_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -299,27 +271,22 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, 8-bit, PF_DITHER8 triangle.
  */
-static void smooth_DITHER8_z_triangle( GLcontext *ctx,
-                                       const SWvertex *v0,
-                                      const SWvertex *v1,
-                                      const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_DITHER8_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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 SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -336,25 +303,20 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, PF_DITHER triangle.
  */
-static void smooth_DITHER_z_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME smooth_DITHER_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
-
+#define SETUP_CODE                                             \
+   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);       \
@@ -372,27 +334,22 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, depth-buffered, 8-bit PF_LOOKUP triangle.
  */
-static void smooth_LOOKUP8_z_triangle( GLcontext *ctx,
-                                      const SWvertex *v0,
-                                      const SWvertex *v1,
-                                      const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_LOOKUP8_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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 SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    LOOKUP_SETUP;                                               \
@@ -408,28 +365,22 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
 
 
 
 /*
  * XImage, smooth, depth-buffered, 8-bit PF_HPCR triangle.
  */
-static void smooth_HPCR_z_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_HPCR_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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 SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -445,27 +396,21 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx,
       span.blue += span.blueStep;                              \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_TRUECOLOR triangle.
  */
-static void flat_TRUECOLOR_z_triangle( GLcontext *ctx,
-                                      const SWvertex *v0,
-                                      const SWvertex *v1,
-                                      const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME flat_TRUECOLOR_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaImage *img = xmesa->xm_buffer->backimage;              \
    unsigned long pixel;                                                \
    PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]);
-
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -477,27 +422,22 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx,
       }                                                                \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_8A8B8G8R triangle.
  */
-static void flat_8A8B8G8R_z_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_8A8B8G8R_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define SETUP_CODE                                     \
-   unsigned long p = PACK_8B8G8R( v2->color[0],        \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   unsigned long p = PACK_8B8G8R( v2->color[0],                \
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
@@ -509,27 +449,22 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx,
       }                                                        \
       span.z += span.zStep;                            \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_8R8G8B triangle.
  */
-static void flat_8R8G8B_z_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_8R8G8B_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-#define SETUP_CODE                             \
-   unsigned long p = PACK_8R8G8B( v2->color[0],        \
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   unsigned long p = PACK_8R8G8B( v2->color[0],                \
                 v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                    \
    GLuint i;                                   \
@@ -541,26 +476,22 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx,
       }                                                \
       span.z += span.zStep;                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_8R8G8B24 triangle.
  */
-static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   const GLubyte *color = v2->color;
+#define NAME flat_8R8G8B24_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE bgr_t
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   const GLubyte *color = v2->color;
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
    for (i = 0; i < span.end; i++) {                    \
@@ -574,23 +505,19 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
       }                                                        \
       span.z += span.zStep;                            \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_TRUEDITHER triangle.
  */
-static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
-                                       const SWvertex *v0,
-                                       const SWvertex *v1,
-                                       const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME flat_TRUEDITHER_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
+#define SETUP_CODE                                             \
+   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);       \
@@ -605,26 +532,21 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
       }                                                                \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_5R6G5B triangle.
  */
-static void flat_5R6G5B_z_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_5R6G5B_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
    unsigned long p = PACK_5R6G5B( v2->color[0],                \
             v2->color[1], v2->color[2] );
 #define RENDER_SPAN( span )                            \
@@ -637,26 +559,22 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx,
       }                                                        \
       span.z += span.zStep;                            \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_DITHER_5R6G5B triangle.
  */
-static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
-                                          const SWvertex *v0,
-                                          const SWvertex *v1,
-                                          const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   const GLubyte *color = v2->color;
+#define NAME flat_DITHER_5R6G5B_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   const GLubyte *color = v2->color;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -669,28 +587,22 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
       }                                                                \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, 8-bit PF_DITHER triangle.
  */
-static void flat_DITHER8_z_triangle( GLcontext *ctx,
-                                    const SWvertex *v0,
-                                    const SWvertex *v1,
-                                    const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_DITHER8_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
    FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
-
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -703,26 +615,20 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx,
       }                                                                \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, PF_DITHER triangle.
  */
-static void flat_DITHER_z_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME flat_DITHER_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define SETUP_CODE     \
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaImage *img = xmesa->xm_buffer->backimage;              \
    FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
-
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -736,28 +642,23 @@ static void flat_DITHER_z_triangle( GLcontext *ctx,
       }                                                                \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, 8-bit PF_HPCR triangle.
  */
-static void flat_HPCR_z_triangle( GLcontext *ctx,
-                                 const SWvertex *v0,
-                                 const SWvertex *v1,
-                                 const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_HPCR_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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             \
-   GLubyte r = v2->color[0];   \
-   GLubyte g = v2->color[1];   \
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   GLubyte r = v2->color[0];                                   \
+   GLubyte g = v2->color[1];                                   \
    GLubyte b = v2->color[2];
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
@@ -770,30 +671,25 @@ static void flat_HPCR_z_triangle( GLcontext *ctx,
       }                                                                \
       span.z += span.zStep;                                    \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, depth-buffered, 8-bit PF_LOOKUP triangle.
  */
-static void flat_LOOKUP8_z_triangle( GLcontext *ctx,
-                                    const SWvertex *v0,
-                                    const SWvertex *v1,
-                                    const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_LOOKUP8_z_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #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                             \
-   LOOKUP_SETUP;                               \
-   GLubyte r = v2->color[0];   \
-   GLubyte g = v2->color[1];   \
-   GLubyte b = v2->color[2];   \
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   LOOKUP_SETUP;                                       \
+   GLubyte r = v2->color[0];                           \
+   GLubyte g = v2->color[1];                           \
+   GLubyte b = v2->color[2];                           \
    GLubyte p = LOOKUP(r,g,b);
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
@@ -805,23 +701,18 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx,
       }                                                        \
       span.z += span.zStep;                            \
    }
-
 #include "swrast/s_tritemp.h"
-}
 
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_TRUECOLOR triangle.
  */
-static void smooth_TRUECOLOR_triangle( GLcontext *ctx,
-                                      const SWvertex *v0,
-                                      const SWvertex *v1,
-                                      const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME smooth_TRUECOLOR_triangle
 #define INTERP_RGB 1
+#define SETUP_CODE                                             \
+   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);       \
@@ -830,109 +721,93 @@ static void smooth_TRUECOLOR_triangle( GLcontext *ctx,
       PACK_TRUECOLOR(p, FixedToInt(span.red),                  \
          FixedToInt(span.green), FixedToInt(span.blue));       \
       XMesaPutPixel(img, x, y, p);                             \
-      span.red += span.redStep;                                \
+      span.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_8A8B8G8R triangle.
  */
-static void smooth_8A8B8G8R_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_8A8B8G8R_triangle
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #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.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
-   }                                                           \
-
+   }
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle.
  */
-static void smooth_8R8G8B_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_8R8G8B_triangle
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #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.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle.
  */
-static void smooth_8R8G8B24_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_8R8G8B24_triangle
 #define INTERP_RGB 1
 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE bgr_t
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #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;                        \
+      pixel->b = FixedToInt(span.blue);                        \
+      span.red += span.redStep;                                \
       span.green += span.greenStep;                    \
       span.blue += span.blueStep;                      \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_TRUEDITHER triangle.
  */
-static void smooth_TRUEDITHER_triangle( GLcontext *ctx,
-                                       const SWvertex *v0,
-                                       const SWvertex *v1,
-                                       const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME smooth_TRUEDITHER_triangle
 #define INTERP_RGB 1
+#define SETUP_CODE                                             \
+   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);       \
@@ -941,83 +816,71 @@ static void smooth_TRUEDITHER_triangle( GLcontext *ctx,
       PACK_TRUEDITHER(p, x, y, FixedToInt(span.red),           \
          FixedToInt(span.green), FixedToInt(span.blue));       \
       XMesaPutPixel(img, x, y, p );                            \
-      span.red += span.redStep;                                \
+      span.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_5R6G5B triangle.
  */
-static void smooth_5R6G5B_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_5R6G5B_triangle
 #define INTERP_RGB 1
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #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.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_DITHER_5R6G5B triangle.
  */
-static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx,
-                                          const SWvertex *v0,
-                                          const SWvertex *v1,
-                                          const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_DITHER_5R6G5B_triangle
 #define INTERP_RGB 1
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #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.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, 8-bit PF_DITHER triangle.
  */
-static void smooth_DITHER8_triangle( GLcontext *ctx,
-                                    const SWvertex *v0,
-                                    const SWvertex *v1,
-                                    const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_DITHER8_triangle
 #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 SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -1025,26 +888,22 @@ static void smooth_DITHER8_triangle( GLcontext *ctx,
    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.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, PF_DITHER triangle.
  */
-static void smooth_DITHER_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME smooth_DITHER_triangle
 #define INTERP_RGB 1
+#define SETUP_CODE                                             \
+   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);       \
@@ -1053,160 +912,131 @@ static void smooth_DITHER_triangle( GLcontext *ctx,
       unsigned long p = XDITHER(x, FixedToInt(span.red),       \
          FixedToInt(span.green), FixedToInt(span.blue) );      \
       XMesaPutPixel(img, x, y, p);                             \
-      span.red += span.redStep;                                \
+      span.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, smooth, NON-depth-buffered, 8-bit PF_LOOKUP triangle.
  */
-static void smooth_LOOKUP8_triangle( GLcontext *ctx,
-                                    const SWvertex *v0,
-                                    const SWvertex *v1,
-                                    const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_LOOKUP8_triangle
 #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;                                           \
-   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;                      \
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#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;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
 
 
 
 /*
  * XImage, smooth, NON-depth-buffered, 8-bit PF_HPCR triangle.
  */
-static void smooth_HPCR_triangle( GLcontext *ctx,
-                                 const SWvertex *v0,
-                                 const SWvertex *v1,
-                                 const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME smooth_HPCR_triangle
 #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 SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
 #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),        \
+      pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red),                \
          FixedToInt(span.green), FixedToInt(span.blue));       \
-      span.red += span.redStep;                                \
+      span.red += span.redStep;                                        \
       span.green += span.greenStep;                            \
       span.blue += span.blueStep;                              \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_TRUECOLOR triangle.
  */
-static void flat_TRUECOLOR_triangle( GLcontext *ctx,
-                                    const SWvertex *v0,
-                                    const SWvertex *v1,
-                                    const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
+#define NAME flat_TRUECOLOR_triangle
 #define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaImage *img = xmesa->xm_buffer->backimage;              \
    unsigned long pixel;                                                \
    PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], 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++) {                       \
       XMesaPutPixel(img, x, y, pixel);                         \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_8A8B8G8R triangle.
  */
-static void flat_8A8B8G8R_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_8A8B8G8R_triangle
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
 #define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
    unsigned long p = PACK_8B8G8R( v2->color[0],                \
                 v2->color[1], v2->color[2] );
-#define RENDER_SPAN( span )                    \
-   GLuint i;                                   \
-   for (i = 0; i < span.end; i++) {            \
-      pRow[i] = (PIXEL_TYPE) p;                        \
+#define RENDER_SPAN( span )                            \
+   GLuint i;                                           \
+   for (i = 0; i < span.end; i++) {                    \
+      pRow[i] = (PIXEL_TYPE) p;                                \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_8R8G8B triangle.
  */
-static void flat_8R8G8B_triangle( GLcontext *ctx,
-                                 const SWvertex *v0,
-                                 const SWvertex *v1,
-                                 const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_8R8G8B_triangle
 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE GLuint
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
-#define SETUP_CODE                             \
-   unsigned long p = PACK_8R8G8B( v2->color[0],        \
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   unsigned long p = PACK_8R8G8B( v2->color[0],                \
                 v2->color[1], v2->color[2] );
-#define RENDER_SPAN( span )                    \
-   GLuint i;                                   \
-   for (i = 0; i < span.end; i++) {            \
-      pRow[i] = (PIXEL_TYPE) p;                        \
+#define RENDER_SPAN( span )                            \
+   GLuint i;                                           \
+   for (i = 0; i < span.end; i++) {                    \
+      pRow[i] = (PIXEL_TYPE) p;                                \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_8R8G8B24 triangle.
  */
-static void flat_8R8G8B24_triangle( GLcontext *ctx,
-                                   const SWvertex *v0,
-                                   const SWvertex *v1,
-                                   const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   const GLubyte *color = v2->color;
+#define NAME flat_8R8G8B24_triangle
 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
 #define PIXEL_TYPE bgr_t
 #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   const GLubyte *color = v2->color;
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
    PIXEL_TYPE *pixel = pRow;                           \
@@ -1215,19 +1045,16 @@ static void flat_8R8G8B24_triangle( GLcontext *ctx,
       pixel->g = color[GCOMP];                         \
       pixel->b = color[BCOMP];                         \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
+
 
 /*
  * XImage, flat, NON-depth-buffered, PF_TRUEDITHER triangle.
  */
-static void flat_TRUEDITHER_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_TRUEDITHER_triangle
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
    XMesaImage *img = xmesa->xm_buffer->backimage;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
@@ -1238,50 +1065,40 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx,
                v2->color[1], v2->color[2] );                   \
       XMesaPutPixel(img, x, y, p);                             \
    }
-
 #include "swrast/s_tritemp.h"
-}
 
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_5R6G5B triangle.
  */
-static void flat_5R6G5B_triangle( GLcontext *ctx,
-                                 const SWvertex *v0,
-                                 const SWvertex *v1,
-                                 const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_5R6G5B_triangle
 #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                             \
-   unsigned long p = PACK_5R6G5B( v2->color[0],        \
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   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++) {            \
-      pRow[i] = (PIXEL_TYPE) p;                        \
+#define RENDER_SPAN( span )                            \
+   GLuint i;                                           \
+   for (i = 0; i < span.end; i++) {                    \
+      pRow[i] = (PIXEL_TYPE) p;                                \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_DITHER_5R6G5B triangle.
  */
-static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx,
-                                        const SWvertex *v0,
-                                        const SWvertex *v1,
-                                        const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   const GLubyte *color = v2->color;
+#define NAME flat_DITHER_5R6G5B_triangle
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   const GLubyte *color = v2->color;
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -1289,26 +1106,20 @@ static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx,
       PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP],             \
          color[GCOMP], color[BCOMP]);                          \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle.
  */
-static void flat_DITHER8_triangle( GLcontext *ctx,
-                                  const SWvertex *v0,
-                                  const SWvertex *v1,
-                                  const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_DITHER8_triangle
 #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                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
    FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
-
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -1316,24 +1127,18 @@ static void flat_DITHER8_triangle( GLcontext *ctx,
    for (i = 0; i < span.end; i++, x++) {                       \
       pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x);                   \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, PF_DITHER triangle.
  */
-static void flat_DITHER_triangle( GLcontext *ctx,
-                                 const SWvertex *v0,
-                                 const SWvertex *v1,
-                                 const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
-   XMesaImage *img = xmesa->xm_buffer->backimage;
-#define SETUP_CODE     \
+#define NAME flat_DITHER_triangle
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   XMesaImage *img = xmesa->xm_buffer->backimage;              \
    FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
-
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
    GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y);       \
@@ -1342,26 +1147,21 @@ static void flat_DITHER_triangle( GLcontext *ctx,
       unsigned long p = FLAT_DITHER(x);                                \
       XMesaPutPixel(img, x, y, p );                            \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle.
  */
-static void flat_HPCR_triangle( GLcontext *ctx,
-                               const SWvertex *v0,
-                               const SWvertex *v1,
-                               const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_HPCR_triangle
 #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             \
-   GLubyte r = v2->color[0];   \
-   GLubyte g = v2->color[1];   \
+#define SETUP_CODE                                             \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;         \
+   GLubyte r = v2->color[0];                                   \
+   GLubyte g = v2->color[1];                                   \
    GLubyte b = v2->color[2];
 #define RENDER_SPAN( span )                                    \
    GLuint i;                                                   \
@@ -1369,37 +1169,31 @@ static void flat_HPCR_triangle( GLcontext *ctx,
    for (i = 0; i < span.end; i++, x++) {                       \
       pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b);       \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 /*
  * XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle.
  */
-static void flat_LOOKUP8_triangle( GLcontext *ctx,
-                                  const SWvertex *v0,
-                                  const SWvertex *v1,
-                                  const SWvertex *v2 )
-{
-   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
+#define NAME flat_LOOKUP8_triangle
 #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                             \
-   LOOKUP_SETUP;                               \
-   GLubyte r = v2->color[0];                   \
-   GLubyte g = v2->color[1];                   \
-   GLubyte b = v2->color[2];                   \
+#define SETUP_CODE                                     \
+   XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; \
+   LOOKUP_SETUP;                                       \
+   GLubyte r = v2->color[0];                           \
+   GLubyte g = v2->color[1];                           \
+   GLubyte b = v2->color[2];                           \
    GLubyte p = LOOKUP(r,g,b);
-#define RENDER_SPAN( span )                    \
-   GLuint i;                                   \
-   for (i = 0; i < span.end; i++) {            \
-      pRow[i] = (PIXEL_TYPE) p;                        \
+#define RENDER_SPAN( span )                            \
+   GLuint i;                                           \
+   for (i = 0; i < span.end; i++) {                    \
+      pRow[i] = (PIXEL_TYPE) p;                                \
    }
-
 #include "swrast/s_tritemp.h"
-}
+
 
 
 #ifdef DEBUG
index f96fbe1f2ca4e18a899b03c3a0b475f0608c8b54..d1575cb691d985e93a602834905e68613708bffa 100644 (file)
@@ -1,8 +1,8 @@
-/* $Id: s_triangle.c,v 1.64 2002/10/30 20:16:44 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.65 2002/11/13 16:51:01 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  5.0
+ * Version:  5.1
  *
  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
  *
@@ -74,57 +74,37 @@ GLboolean _mesa_cull_triangle( GLcontext *ctx,
 /*
  * Render a flat-shaded color index triangle.
  */
-static void flat_ci_triangle( GLcontext *ctx,
-                             const SWvertex *v0,
-                             const SWvertex *v1,
-                             const SWvertex *v2 )
-{
+#define NAME flat_ci_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
-
-#define SETUP_CODE                                     \
-   span.interpMask |= SPAN_INDEX;                      \
-   span.index = IntToFixed(v2->index);                 \
+#define SETUP_CODE                     \
+   span.interpMask |= SPAN_INDEX;      \
+   span.index = IntToFixed(v2->index); \
    span.indexStep = 0;
-
 #define RENDER_SPAN( span )  _mesa_write_index_span(ctx, &span);
-
 #include "s_tritemp.h"
-}
 
 
 
 /*
  * Render a smooth-shaded color index triangle.
  */
-static void smooth_ci_triangle( GLcontext *ctx,
-                               const SWvertex *v0,
-                               const SWvertex *v1,
-                               const SWvertex *v2 )
-{
+#define NAME smooth_ci_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define INTERP_INDEX 1
-
 #define RENDER_SPAN( span )  _mesa_write_index_span(ctx, &span);
-
 #include "s_tritemp.h"
-}
 
 
 
 /*
  * Render a flat-shaded RGBA triangle.
  */
-static void flat_rgba_triangle( GLcontext *ctx,
-                               const SWvertex *v0,
-                               const SWvertex *v1,
-                               const SWvertex *v2 )
-{
+#define NAME flat_rgba_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
 #define SETUP_CODE                             \
    ASSERT(ctx->Texture._EnabledUnits == 0);    \
    ASSERT(ctx->Light.ShadeModel==GL_FLAT);     \
@@ -137,41 +117,29 @@ static void flat_rgba_triangle( GLcontext *ctx,
    span.greenStep = 0;                         \
    span.blueStep = 0;                          \
    span.alphaStep = 0;
-
 #define RENDER_SPAN( span )  _mesa_write_rgba_span(ctx, &span);
-
 #include "s_tritemp.h"
-}
 
 
 
 /*
  * Render a smooth-shaded RGBA triangle.
  */
-static void smooth_rgba_triangle( GLcontext *ctx,
-                                 const SWvertex *v0,
-                                 const SWvertex *v1,
-                                 const SWvertex *v2 )
-{
-
+#define NAME smooth_rgba_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_RGB 1
 #define INTERP_ALPHA 1
-
 #define SETUP_CODE                             \
    {                                           \
       /* texturing must be off */              \
       ASSERT(ctx->Texture._EnabledUnits == 0); \
       ASSERT(ctx->Light.ShadeModel==GL_SMOOTH);        \
    }
-
 #define RENDER_SPAN( span )  _mesa_write_rgba_span(ctx, &span);
-
 #include "s_tritemp.h"
 
-}
 
 
 /*
@@ -180,11 +148,7 @@ static void smooth_rgba_triangle( GLcontext *ctx,
  *
  * No fog.
  */
-static void simple_textured_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
+#define NAME simple_textured_triangle
 #define INTERP_INT_TEX 1
 #define S_SCALE twidth
 #define T_SCALE theight
@@ -222,9 +186,8 @@ static void simple_textured_triangle( GLcontext *ctx,
    (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y,       \
                                   (CONST GLchan (*)[3]) span.array->rgb,\
                                   NULL );
-
 #include "s_tritemp.h"
-}
+
 
 
 /*
@@ -234,11 +197,7 @@ static void simple_textured_triangle( GLcontext *ctx,
  *
  * No fog.
  */
-static void simple_z_textured_triangle( GLcontext *ctx,
-                                       const SWvertex *v0,
-                                       const SWvertex *v1,
-                                       const SWvertex *v2 )
-{
+#define NAME simple_z_textured_triangle
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
 #define INTERP_INT_TEX 1
@@ -287,9 +246,8 @@ static void simple_z_textured_triangle( GLcontext *ctx,
    (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y,       \
                                   (CONST GLchan (*)[3]) span.array->rgb,\
                                   span.array->mask );
-
 #include "s_tritemp.h"
-}
+
 
 
 #if CHAN_TYPE != GL_FLOAT
@@ -568,11 +526,7 @@ affine_span(GLcontext *ctx, struct sw_span *span,
 /*
  * Render an RGB/RGBA textured triangle without perspective correction.
  */
-static void affine_textured_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
+#define NAME affine_textured_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -635,8 +589,6 @@ static void affine_textured_triangle( GLcontext *ctx,
 
 #include "s_tritemp.h"
 
-}
-
 
 
 struct persp_info
@@ -846,11 +798,7 @@ fast_persp_span(GLcontext *ctx, struct sw_span *span,
  * by interpolated Q/W comes out right.
  *
  */
-static void persp_textured_triangle( GLcontext *ctx,
-                                    const SWvertex *v0,
-                                    const SWvertex *v1,
-                                    const SWvertex *v2 )
-{
+#define NAME persp_textured_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -911,8 +859,6 @@ static void persp_textured_triangle( GLcontext *ctx,
 
 #include "s_tritemp.h"
 
-}
-
 
 #endif /* CHAN_BITS != GL_FLOAT */
 
@@ -923,11 +869,7 @@ static void persp_textured_triangle( GLcontext *ctx,
  * Render a smooth-shaded, textured, RGBA triangle.
  * Interpolate S,T,R with perspective correction, w/out mipmapping.
  */
-static void general_textured_triangle( GLcontext *ctx,
-                                      const SWvertex *v0,
-                                      const SWvertex *v1,
-                                      const SWvertex *v2 )
-{
+#define NAME general_textured_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -935,11 +877,8 @@ static void general_textured_triangle( GLcontext *ctx,
 #define INTERP_SPEC 1
 #define INTERP_ALPHA 1
 #define INTERP_TEX 1
-
 #define RENDER_SPAN( span )   _mesa_write_texture_span(ctx, &span);
-
 #include "s_tritemp.h"
-}
 
 
 
@@ -948,13 +887,7 @@ static void general_textured_triangle( GLcontext *ctx,
  * Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates.
  * Yup, it's slow.
  */
-static void
-multitextured_triangle( GLcontext *ctx,
-                        const SWvertex *v0,
-                        const SWvertex *v1,
-                        const SWvertex *v2 )
-{
-
+#define NAME multitextured_triangle
 #define INTERP_Z 1
 #define INTERP_FOG 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
@@ -962,27 +895,19 @@ multitextured_triangle( GLcontext *ctx,
 #define INTERP_ALPHA 1
 #define INTERP_SPEC 1
 #define INTERP_MULTITEX 1
-
 #define RENDER_SPAN( span )   _mesa_write_texture_span(ctx, &span);
-
 #include "s_tritemp.h"
 
-}
-
 
-static void occlusion_zless_triangle( GLcontext *ctx,
-                                     const SWvertex *v0,
-                                     const SWvertex *v1,
-                                     const SWvertex *v2 )
-{
-   if (ctx->OcclusionResult) {
-      return;
-   }
 
+#define NAME occlusion_zless_triangle
 #define DO_OCCLUSION_TEST
 #define INTERP_Z 1
 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
+#define SETUP_CODE                     \
+   if (ctx->OcclusionResult) {         \
+      return;                          \
+   }
 #define RENDER_SPAN( span )                            \
    GLuint i;                                           \
    for (i = 0; i < span.end; i++) {                    \
@@ -993,14 +918,15 @@ static void occlusion_zless_triangle( GLcontext *ctx,
       }                                                        \
       span.z += span.zStep;                            \
    }
-
 #include "s_tritemp.h"
-}
 
-static void nodraw_triangle( GLcontext *ctx,
-                            const SWvertex *v0,
-                            const SWvertex *v1,
-                            const SWvertex *v2 )
+
+
+static void
+nodraw_triangle( GLcontext *ctx,
+                 const SWvertex *v0,
+                 const SWvertex *v1,
+                 const SWvertex *v2 )
 {
    (void) (ctx && v0 && v1 && v2);
 }
index dcd1f4a8d88913044bd0487cc9cc9839e1a87cc4..38762112f0d6ca6035d541670a3f6768a7ffadf2 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: s_tritemp.h,v 1.40 2002/10/17 15:26:39 brianp Exp $ */
+/* $Id: s_tritemp.h,v 1.41 2002/11/13 16:51:02 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  5.1
  *
- * Copyright (C) 1999-2001  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"),
 #define INTERP_FLOAT_SPEC
 #endif
 
-#endif
+#endif /* CHAN_TYPE == GL_FLOAT */
+
 
 
-/*void triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 )*/
+static void NAME(GLcontext *ctx, const SWvertex *v0,
+                                 const SWvertex *v1,
+                                 const SWvertex *v2 )
 {
    typedef struct {
         const SWvertex *v0, *v1;   /* Y(v0) < Y(v1) */
 #undef FixedToDepth
 
 #undef DO_OCCLUSION_TEST
+#undef NAME