summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c32
-rw-r--r--src/mesa/drivers/x11/xm_tri.c450
-rw-r--r--src/mesa/swrast/s_aaline.c4
-rw-r--r--src/mesa/swrast/s_aalinetemp.h80
-rw-r--r--src/mesa/swrast/s_aatritemp.h151
-rw-r--r--src/mesa/swrast/s_alpha.c18
-rw-r--r--src/mesa/swrast/s_bitmap.c93
-rw-r--r--src/mesa/swrast/s_context.c11
-rw-r--r--src/mesa/swrast/s_context.h79
-rw-r--r--src/mesa/swrast/s_copypix.c142
-rw-r--r--src/mesa/swrast/s_drawpix.c223
-rw-r--r--src/mesa/swrast/s_lines.c392
-rw-r--r--src/mesa/swrast/s_pointtemp.h109
-rw-r--r--src/mesa/swrast/s_triangle.c114
-rw-r--r--src/mesa/swrast/s_tritemp.h328
-rw-r--r--src/mesa/swrast/s_zoom.c4
-rw-r--r--src/mesa/swrast/swrast.h55
17 files changed, 1147 insertions, 1138 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 4fdf290383f..9dc08b58206 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.78 2002/04/04 16:58:04 brianp Exp $ */
+/* $Id: osmesa.c,v 1.79 2002/04/19 14:05:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1882,20 +1882,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
@@ -1926,14 +1926,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
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 43c923e02e9..6a8b678d7b5 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -1,4 +1,4 @@
-/* $Id: xm_tri.c,v 1.21 2001/12/17 04:56:29 brianp Exp $ */
+/* $Id: xm_tri.c,v 1.22 2002/04/19 14:05:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -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"
@@ -1048,15 +1048,15 @@ static void smooth_DITHER_triangle( GLcontext *ctx,
#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"
@@ -1080,12 +1080,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"
@@ -1109,13 +1109,13 @@ static void smooth_HPCR_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++) { \
- 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 +1138,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 +1164,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 +1189,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 +1213,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]; \
@@ -1235,8 +1235,8 @@ static void flat_TRUEDITHER_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++) { \
unsigned long p; \
PACK_TRUEDITHER(p, x, y, v2->color[0], \
v2->color[1], v2->color[2] ); \
@@ -1265,7 +1265,7 @@ static void flat_5R6G5B_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; \
}
@@ -1288,8 +1288,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 +1315,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 +1340,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 ); \
}
@@ -1369,8 +1369,8 @@ static void flat_HPCR_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++) { \
+ 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 +1398,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; \
}
diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c
index 92103cb296d..a3a041d0e42 100644
--- a/src/mesa/swrast/s_aaline.c
+++ b/src/mesa/swrast/s_aaline.c
@@ -1,4 +1,4 @@
-/* $Id: s_aaline.c,v 1.13 2002/02/02 17:24:11 brianp Exp $ */
+/* $Id: s_aaline.c,v 1.14 2002/04/19 14:05:50 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;
};
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index e1e12569155..3bd516ba874 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aalinetemp.h,v 1.19 2002/04/12 15:39:58 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.20 2002/04/19 14:05:50 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->coverage[i] = coverage;
+ line->span->xArray[i] = ix;
+ line->span->yArray[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->zArray[i] = (GLdepth) solve_plane(fx, fy, line->zPlane);
#endif
#ifdef DO_FOG
- line->span.fogArray[i] = solve_plane(fx, fy, line->fPlane);
+ line->span->fogArray[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->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);
#endif
#ifdef DO_INDEX
- line->span.color.index[i] = (GLint) solve_plane(fx, fy, line->iPlane);
+ line->span->color.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->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);
#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->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->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->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->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,24 @@ 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.span.arrayMask |= (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 +174,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 +190,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 +213,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 +224,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 +295,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
}
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index cdef16c2e25..18c611e0176 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aatritemp.h,v 1.28 2002/04/12 15:39:58 brianp Exp $ */
+/* $Id: s_aatritemp.h,v 1.29 2002/04/19 14:05:50 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;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
#ifdef DO_Z
GLfloat zPlane[4];
@@ -86,7 +86,6 @@
INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE);
- /*span.arrayMask |= SPAN_COVERAGE;*/
/* determine bottom to top order of vertices */
{
@@ -141,11 +140,11 @@
*/
#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) {
@@ -160,7 +159,7 @@
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) {
@@ -170,7 +169,7 @@
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) {
@@ -183,7 +182,7 @@
constant_plane(v2->specular[GCOMP], sgPlane);
constant_plane(v2->specular[BCOMP], sbPlane);
}
- span.arrayMask |= SPAN_SPEC;
+ span->arrayMask |= SPAN_SPEC;
#endif
#ifdef DO_TEX
{
@@ -211,7 +210,7 @@
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;
@@ -243,7 +242,7 @@
}
}
}
- span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#endif
/* Begin bottom-to-top scan over the triangle.
@@ -286,37 +285,37 @@
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
#ifdef DO_INDEX
- span.coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
+ span->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy);
#else
- span.coverage[count] = coverage;
+ span->coverage[count] = coverage;
#endif
#ifdef DO_Z
- span.zArray[count] = (GLdepth) solve_plane(cx, cy, zPlane);
+ span->zArray[count] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- span.fogArray[count] = solve_plane(cx, cy, fogPlane);
+ span->fogArray[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);
+ 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);
#endif
#ifdef DO_INDEX
- span.color.index[count] = (GLint) solve_plane(cx, cy, iPlane);
+ span->color.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);
+ 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);
#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,
+ 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,
cx, cy, invQ,
texWidth, texHeight);
}
@@ -326,10 +325,10 @@
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],
+ 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],
tPlane[unit], vPlane[unit], cx, cy, invQ,
texWidth[unit], texHeight[unit]);
}
@@ -344,16 +343,16 @@
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
}
}
@@ -391,37 +390,37 @@
/* (cx,cy) = center of fragment */
const GLfloat cx = ix + 0.5F, cy = iy + 0.5F;
#ifdef DO_INDEX
- span.coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
+ span->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy);
#else
- span.coverage[ix] = coverage;
+ span->coverage[ix] = coverage;
#endif
#ifdef DO_Z
- span.zArray[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
+ span->zArray[ix] = (GLdepth) solve_plane(cx, cy, zPlane);
#endif
#ifdef DO_FOG
- span.fogArray[ix] = solve_plane(cx, cy, fogPlane);
+ span->fogArray[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);
+ 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);
#endif
#ifdef DO_INDEX
- span.color.index[ix] = (GLint) solve_plane(cx, cy, iPlane);
+ span->color.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);
+ 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);
#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,
+ 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,
cx, cy, invQ, texWidth, texHeight);
}
#elif defined(DO_MULTITEX)
@@ -430,10 +429,10 @@
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],
+ 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],
tPlane[unit],
vPlane[unit],
cx, cy, invQ,
@@ -461,27 +460,27 @@
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(span->color.rgba[j], span->color.rgba[j + left]);
#endif
#ifdef DO_SPEC
- COPY_4V(span.specArray[j], span.specArray[j + left]);
+ COPY_4V(span->specArray[j], span->specArray[j + left]);
#endif
#ifdef DO_INDEX
- span.color.index[j] = span.color.index[j + left];
+ span->color.index[j] = span->color.index[j + left];
#endif
#ifdef DO_Z
- span.zArray[j] = span.zArray[j + left];
+ span->zArray[j] = span->zArray[j + left];
#endif
#ifdef DO_FOG
- span.fogArray[j] = span.fogArray[j + left];
+ span->fogArray[j] = span->fogArray[j + left];
#endif
#ifdef DO_TEX
- COPY_4V(span.texcoords[0][j], span.texcoords[0][j + left]);
+ COPY_4V(span->texcoords[0][j], span->texcoords[0][j + left]);
#endif
#if defined(DO_MULTITEX) || defined(DO_TEX)
- span.lambda[0][j] = span.lambda[0][j + left];
+ span->lambda[0][j] = span->lambda[0][j + left];
#endif
- span.coverage[j] = span.coverage[j + left];
+ span->coverage[j] = span->coverage[j + left];
}
}
#ifdef DO_MULTITEX
@@ -492,26 +491,26 @@
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];
+ 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];
}
}
}
}
#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
}
}
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index 914b699cead..de7258fddfb 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -1,4 +1,4 @@
-/* $Id: s_alpha.c,v 1.9 2002/02/02 21:40:33 brianp Exp $ */
+/* $Id: s_alpha.c,v 1.10 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -24,6 +24,10 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/**
+ * \file swrast/s_alpha.c
+ * \brief Functions to apply alpha test.
+ */
#include "glheader.h"
#include "context.h"
@@ -35,12 +39,12 @@
#include "s_context.h"
-/*
- * Apply the alpha test to a span of pixels.
- * In: rgba - array of pixels
- * In/Out: span -
- * Return: 0 = all pixels in the span failed the alpha test.
- * 1 = one or more pixels passed the alpha test.
+/**
+ * \fn GLint _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span )
+ * \brief Apply the alpha test to a span of pixels.
+ * \return
+ * - "0" = all pixels in the span failed the alpha test.
+ * - "1" = one or more pixels passed the alpha test.
*/
GLint
_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span )
diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c
index 518e0587df0..1525908b233 100644
--- a/src/mesa/swrast/s_bitmap.c
+++ b/src/mesa/swrast/s_bitmap.c
@@ -1,4 +1,4 @@
-/* $Id: s_bitmap.c,v 1.17 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_bitmap.c,v 1.18 2002/04/19 14:05:50 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;
+ struct sw_span *span = swrast->span;
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
@@ -64,28 +64,27 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
_swrast_validate_derived( ctx );
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
- /*span.arrayMask |= SPAN_XY;
- 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 );
@@ -94,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->xArray[count] = px + col;
+ span->yArray[count] = py + row;
count++;
}
if (mask == 128U) {
@@ -116,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->xArray[count] = px + col;
+ span->yArray[count] = py + row;
count++;
}
if (mask == 1U) {
@@ -136,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;
}
}
@@ -165,7 +164,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint row, col;
- struct sw_span span;
+ struct sw_span *span = swrast->span;
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
@@ -176,30 +175,30 @@ _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 );
@@ -207,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->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
if (mask == 128U) {
src++;
mask = 1U;
@@ -218,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)
@@ -230,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->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE;
if (mask == 1U) {
src++;
mask = 128U;
@@ -241,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)
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index fa91f15a8ff..96572aa0634 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -1,4 +1,4 @@
-/* $Id: s_context.c,v 1.30 2002/04/19 00:38:27 brianp Exp $ */
+/* $Id: s_context.c,v 1.31 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -494,7 +494,14 @@ _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;
+ }
+
ctx->swrast_context = swrast;
+
return GL_TRUE;
}
@@ -507,6 +514,8 @@ _swrast_DestroyContext( GLcontext *ctx )
fprintf(stderr, "_swrast_DestroyContext\n");
}
+ FREE( swrast->span );
+
FREE( swrast );
ctx->swrast_context = 0;
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index cacbc32052f..b0ca5bf1b57 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -1,4 +1,4 @@
-/* $Id: s_context.h,v 1.16 2002/02/02 21:40:33 brianp Exp $ */
+/* $Id: s_context.h,v 1.17 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,6 +27,12 @@
* Keith Whitwell <[email protected]>
*/
+/**
+ * \file swrast/s_context.h
+ * \brief fill in description
+ * \author Keith Whitwell <[email protected]>
+ */
+
#ifndef S_CONTEXT_H
#define S_CONTEXT_H
@@ -64,24 +70,25 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
const SWvertex *, const SWvertex *);
-
-/*
- * Bitmasks to indicate which rasterization options are enabled (RasterMask)
+/** \defgroup Bitmasks
+ * Bitmasks to indicate which rasterization options are enabled
+ * (RasterMask)
*/
-#define ALPHATEST_BIT 0x001 /* Alpha-test pixels */
-#define BLEND_BIT 0x002 /* Blend pixels */
-#define DEPTH_BIT 0x004 /* Depth-test pixels */
-#define FOG_BIT 0x008 /* Fog pixels */
-#define LOGIC_OP_BIT 0x010 /* Apply logic op in software */
-#define CLIP_BIT 0x020 /* Scissor or window clip pixels */
-#define STENCIL_BIT 0x040 /* Stencil pixels */
-#define MASKING_BIT 0x080 /* Do glColorMask or glIndexMask */
-#define ALPHABUF_BIT 0x100 /* Using software alpha buffer */
-#define MULTI_DRAW_BIT 0x400 /* Write to more than one color- */
- /* buffer or no buffers. */
-#define OCCLUSION_BIT 0x800 /* GL_HP_occlusion_test enabled */
-#define TEXTURE_BIT 0x1000 /* Texturing really enabled */
-
+/*@{*/
+#define ALPHATEST_BIT 0x001 /**< Alpha-test pixels */
+#define BLEND_BIT 0x002 /**< Blend pixels */
+#define DEPTH_BIT 0x004 /**< Depth-test pixels */
+#define FOG_BIT 0x008 /**< Fog pixels */
+#define LOGIC_OP_BIT 0x010 /**< Apply logic op in software */
+#define CLIP_BIT 0x020 /**< Scissor or window clip pixels */
+#define STENCIL_BIT 0x040 /**< Stencil pixels */
+#define MASKING_BIT 0x080 /**< Do glColorMask or glIndexMask */
+#define ALPHABUF_BIT 0x100 /**< Using software alpha buffer */
+#define MULTI_DRAW_BIT 0x400 /**< Write to more than one color- */
+ /**< buffer or no buffers. */
+#define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */
+#define TEXTURE_BIT 0x1000 /**< Texturing really enabled */
+/*@}*/
#define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \
_NEW_SCISSOR| \
@@ -94,20 +101,23 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
_NEW_DEPTH)
-
+/**
+ * \struct SWcontext
+ * \brief SWContext?
+ */
typedef struct
{
- /* Driver interface:
+ /** Driver interface:
*/
struct swrast_device_driver Driver;
- /* Configuration mechanisms to make software rasterizer match
+ /** Configuration mechanisms to make software rasterizer match
* characteristics of the hardware rasterizer (if present):
*/
GLboolean AllowVertexFog;
GLboolean AllowPixelFog;
- /* Derived values, invalidated on statechanges, updated from
+ /** Derived values, invalidated on statechanges, updated from
* _swrast_validate_derived():
*/
GLuint _RasterMask;
@@ -117,20 +127,20 @@ typedef struct
/* Accum buffer temporaries.
*/
- GLboolean _IntegerAccumMode; /* Storing unscaled integers? */
- GLfloat _IntegerAccumScaler; /* Implicit scale factor */
+ GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */
+ GLfloat _IntegerAccumScaler; /**< Implicit scale factor */
/* Working values:
*/
- GLuint StippleCounter; /* Line stipple counter */
+ GLuint StippleCounter; /**< Line stipple counter */
GLuint NewState;
GLuint StateChanges;
-
- /* Mechanism to allow driver (like X11) to register further
+ /** Mechanism to allow driver (like X11) to register further
* software rasterization routines.
*/
+ /*@{*/
void (*choose_point)( GLcontext * );
void (*choose_line)( GLcontext * );
void (*choose_triangle)( GLcontext * );
@@ -138,25 +148,30 @@ typedef struct
GLuint invalidate_point;
GLuint invalidate_line;
GLuint invalidate_triangle;
+ /*@}*/
-
- /* Function pointers for dispatch behind public entrypoints.
- */
+ /** Function pointers for dispatch behind public entrypoints. */
+ /*@{*/
void (*InvalidateState)( GLcontext *ctx, GLuint new_state );
swrast_point_func Point;
swrast_line_func Line;
swrast_tri_func Triangle;
+ /*@}*/
- /* Placeholders for when separate specular (or secondary color) is
+ /**
+ * Placeholders for when separate specular (or secondary color) is
* enabled but texturing is not.
*/
+ /*@{*/
swrast_point_func SpecPoint;
swrast_line_func SpecLine;
swrast_tri_func SpecTriangle;
+ /*@}*/
+ struct sw_span *span;
- /* Internal hooks, kept uptodate by the same mechanism as above.
+ /** Internal hooks, kept uptodate by the same mechanism as above.
*/
blend_func BlendFunc;
TextureSampleFunc TextureSample[MAX_TEXTURE_UNITS];
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index d7844718278..bea0af48833 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -1,4 +1,4 @@
-/* $Id: s_copypix.c,v 1.36 2002/04/19 00:38:27 brianp Exp $ */
+/* $Id: s_copypix.c,v 1.37 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -107,15 +107,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;
+ struct sw_span *span = swrast->span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
- /*span.arrayMask |= 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
@@ -252,15 +251,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->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);
}
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._ReallyEnabled) {
- span.end = width;
- _swrast_pixel_texture(ctx, &span);
+ span->end = width;
+ _swrast_pixel_texture(ctx, span);
}
/* write row to framebuffer */
@@ -268,21 +267,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->color.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->color.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);
}
}
@@ -306,10 +305,9 @@ 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;
+ struct sw_span *span = swrast->span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
- /*span.arrayMask |= SPAN_RGBA;*/
if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty);
@@ -334,9 +332,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
@@ -392,7 +390,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->color.rgba, p, width * sizeof(GLchan) * 4);
p += width * 4;
}
else {
@@ -413,7 +411,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackRightAlpha;
}
}
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, span.color.rgba );
+ _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, span->color.rgba );
}
if (changeBuffer) {
@@ -431,10 +429,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->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;
}
/* scale & bias */
if (transferOps & IMAGE_SCALE_BIAS_BIT) {
@@ -494,36 +492,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->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);
}
UNDEFARRAY(rgbaFloat); /* mac 32k limitation */
}
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._ReallyEnabled) {
- 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->color.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->color.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);
}
}
@@ -548,10 +546,9 @@ 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;
+ struct sw_span *span = swrast->span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
- /*span.arrayMask |= SPAN_INDEX;*/
/* Determine if copy should be bottom-to-top or top-to-bottom */
if (srcy<desty) {
@@ -571,9 +568,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
@@ -607,7 +604,7 @@ 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->color.index, p, width * sizeof(GLuint));
p += width;
}
else {
@@ -616,7 +613,7 @@ static void copy_ci_pixels( GLcontext *ctx,
ctx->Pixel.DriverReadBuffer );
}
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy,
- span.color.index );
+ span->color.index );
}
if (changeBuffer) {
@@ -626,19 +623,19 @@ static void copy_ci_pixels( GLcontext *ctx,
}
if (shift_or_offset) {
- _mesa_shift_and_offset_ci( ctx, width, span.color.index );
+ _mesa_shift_and_offset_ci( ctx, width, span->color.index );
}
if (ctx->Pixel.MapColorFlag) {
- _mesa_map_ci( ctx, width, span.color.index );
+ _mesa_map_ci( ctx, width, span->color.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);
}
/* Restore pixel source to be the draw buffer (for blending, etc) */
@@ -664,10 +661,9 @@ 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;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
- /*span.arrayMask |= SPAN_Z;*/
if (!ctx->Visual.depthBits) {
_mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
@@ -691,9 +687,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;
@@ -725,25 +721,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->zArray[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->color.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);
}
}
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 82998ba57ce..e0e6e7868d3 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -1,4 +1,4 @@
-/* $Id: s_drawpix.c,v 1.32 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_drawpix.c,v 1.33 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -102,19 +102,18 @@ 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;
+ struct sw_span *span = swrast->span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
- /*span.arrayMask |= SPAN_RGBA;*/
if (!ctx->Current.RasterPosValid) {
return GL_TRUE; /* no-op */
}
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._ReallyEnabled == 0
@@ -238,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++;
@@ -278,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++;
@@ -302,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->color.rgb[i][0] = src[i];
+ span->color.rgb[i][1] = src[i];
+ span->color.rgb[i][2] = src[i];
}
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[3]) span.color.rgb, NULL);
+ (CONST GLchan (*)[3]) span->color.rgb, NULL);
src += rowLength;
destY++;
}
@@ -319,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->color.rgb[i][0] = src[i];
+ span->color.rgb[i][1] = src[i];
+ span->color.rgb[i][2] = src[i];
}
destY--;
(*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[3]) span.color.rgb, NULL);
+ (CONST GLchan (*)[3]) span->color.rgb, NULL);
src += rowLength;
}
}
@@ -336,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->color.rgb[i][0] = src[i];
+ span->color.rgb[i][1] = src[i];
+ span->color.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->color.rgb, zoomY0);
src += rowLength;
destY++;
}
@@ -365,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->color.rgba[i][0] = *ptr;
+ span->color.rgba[i][1] = *ptr;
+ span->color.rgba[i][2] = *ptr++;
+ span->color.rgba[i][3] = *ptr++;
}
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[4]) span.color.rgba, NULL);
+ (CONST GLchan (*)[4]) span->color.rgba, NULL);
src += rowLength*2;
destY++;
}
@@ -384,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->color.rgba[i][0] = *ptr;
+ span->color.rgba[i][1] = *ptr;
+ span->color.rgba[i][2] = *ptr++;
+ span->color.rgba[i][3] = *ptr++;
}
destY--;
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[4]) span.color.rgba, NULL);
+ (CONST GLchan (*)[4]) span->color.rgba, NULL);
src += rowLength*2;
}
}
@@ -403,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->color.rgba[i][0] = *ptr;
+ span->color.rgba[i][1] = *ptr;
+ span->color.rgba[i][2] = *ptr++;
+ span->color.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->color.rgba, zoomY0);
src += rowLength*2;
destY++;
}
@@ -429,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->color.rgba);
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (const GLchan (*)[4]) span.color.rgba, NULL);
+ (const GLchan (*)[4]) span->color.rgba, NULL);
src += rowLength;
destY++;
}
@@ -442,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->color.rgba);
destY--;
(*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
- (CONST GLchan (*)[4]) span.color.rgba, NULL);
+ (CONST GLchan (*)[4]) span->color.rgba, NULL);
src += rowLength;
}
return GL_TRUE;
@@ -455,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->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);
src += rowLength;
destY++;
}
@@ -509,15 +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;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_INDEX);
- /*span.arrayMask |= 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
@@ -526,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->color.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);
}
}
@@ -612,11 +610,9 @@ 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;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_Z);
- /*span.arrayMask |= SPAN_Z;
- span.end = drawWidth;*/
if (type != GL_BYTE
&& type != GL_UNSIGNED_BYTE
@@ -629,50 +625,50 @@ 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 (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->zArray[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->zArray, 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);
@@ -683,21 +679,21 @@ 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->zArray[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);
+ _mesa_write_zoomed_rgba_span(ctx, span,
+ (const GLchan (*)[4]) span->color.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);
}
}
}
@@ -719,10 +715,9 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
GLboolean quickDraw;
GLfloat *convImage = NULL;
GLuint transferOps = ctx->_ImageTransferState;
- struct sw_span span;
+ struct sw_span *span = swrast->span;
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
- /*span.arrayMask |= SPAN_RGBA;*/
if (!_mesa_is_legal_format_and_type(format, type)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)");
@@ -734,13 +729,13 @@ 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 (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
- && x + width <= ctx->DrawBuffer->Width
- && y + height <= ctx->DrawBuffer->Height) {
+ && x + width <= (GLint) ctx->DrawBuffer->Width
+ && y + height <= (GLint) ctx->DrawBuffer->Height) {
quickDraw = GL_TRUE;
}
else {
@@ -810,7 +805,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint 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->color.rgba,
format, type, source, unpack,
transferOps);
@@ -819,26 +814,26 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
continue;
if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._ReallyEnabled) {
- 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->color.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->color.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);
}
}
}
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index 5c6743f92f8..19cc6f0cc3c 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -1,4 +1,4 @@
-/* $Id: s_lines.c,v 1.28 2002/04/19 00:38:27 brianp Exp $ */
+/* $Id: s_lines.c,v 1.29 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -130,29 +130,27 @@ static void flat_ci_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->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.arrayMask |= SPAN_XY;
- span.interpMask |= SPAN_INDEX;*/
- span.index = IntToFixed(vert1->index);
- span.indexStep = 0;
+ span->index = IntToFixed(vert1->index);
+ span->indexStep = 0;
#define INTERP_XY 1
#define PLOT(X,Y) \
{ \
- span.xArray[span.end] = X; \
- span.yArray[span.end] = Y; \
- span.end++; \
+ span->xArray[span->end] = X; \
+ span->yArray[span->end] = Y; \
+ span->end++; \
}
#include "s_linetemp.h"
- _mesa_write_index_span(ctx, &span);
+ _mesa_write_index_span(ctx, span);
}
@@ -161,35 +159,33 @@ static void flat_rgba_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
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.arrayMask |= SPAN_XY;
- span.interpMask |= SPAN_RGBA;*/
- 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;
#define INTERP_XY 1
#define PLOT(X,Y) \
{ \
- span.xArray[span.end] = X; \
- span.yArray[span.end] = Y; \
- span.end++; \
+ span->xArray[span->end] = X; \
+ span->yArray[span->end] = Y; \
+ span->end++; \
}
#include "s_linetemp.h"
- _mesa_write_rgba_span(ctx, &span);
+ _mesa_write_rgba_span(ctx, span);
}
@@ -198,28 +194,27 @@ static void smooth_ci_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
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);
- /*span.arrayMask |= (SPAN_XY | SPAN_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++; \
+ span->xArray[span->end] = X; \
+ span->yArray[span->end] = Y; \
+ span->color.index[span->end] = I; \
+ span->end++; \
}
#include "s_linetemp.h"
- _mesa_write_index_span(ctx, &span);
+ _mesa_write_index_span(ctx, span);
}
@@ -228,32 +223,31 @@ static void smooth_rgba_line( GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1 )
{
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
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);
- /*span.arrayMask |= (SPAN_XY | SPAN_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++; \
+ 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++; \
}
#include "s_linetemp.h"
- _mesa_write_rgba_span(ctx, &span);
+ _mesa_write_rgba_span(ctx, span);
}
@@ -263,13 +257,12 @@ static void general_smooth_ci_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
INIT_SPAN(span, GL_LINE, 0, 0,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX);*/
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -278,25 +271,25 @@ static void general_smooth_ci_line( GLcontext *ctx,
#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++; \
+ 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++; \
}
#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->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);
}
}
@@ -307,16 +300,14 @@ static void general_flat_ci_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX,
SPAN_XY | SPAN_Z | SPAN_FOG);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG);
- span.interpMask |= SPAN_INDEX;*/
- span.index = IntToFixed(vert1->index);
- span.indexStep = 0;
+ span->index = IntToFixed(vert1->index);
+ span->indexStep = 0;
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -324,24 +315,24 @@ static void general_flat_ci_line( GLcontext *ctx,
#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++; \
+ span->xArray[span->end] = X; \
+ span->yArray[span->end] = Y; \
+ span->zArray[span->end] = Z; \
+ span->fogArray[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->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);
}
}
@@ -352,13 +343,12 @@ static void general_smooth_rgba_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
INIT_SPAN(span, GL_LINE, 0, 0,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA);*/
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -368,28 +358,28 @@ static void general_smooth_rgba_line( GLcontext *ctx,
#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++; \
+ 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++; \
}
#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->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);
}
}
@@ -399,22 +389,20 @@ static void general_flat_rgba_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA,
SPAN_XY | SPAN_Z | SPAN_FOG);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG);
- span.interpMask |= SPAN_RGBA;*/
- 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;
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -422,24 +410,24 @@ static void general_flat_rgba_line( GLcontext *ctx,
#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++; \
+ span->xArray[span->end] = X; \
+ span->yArray[span->end] = Y; \
+ span->zArray[span->end] = Z; \
+ span->fogArray[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->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);
}
}
@@ -450,28 +438,26 @@ static void flat_textured_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->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_RGBA);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
- span.interpMask |= (SPAN_RGBA | SPAN_SPEC);*/
- 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_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;
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -480,28 +466,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->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++; \
}
#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->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);
}
}
@@ -513,13 +499,12 @@ static void smooth_textured_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
INIT_SPAN(span, GL_LINE, 0, 0,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA);*/
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -530,32 +515,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->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++; \
}
#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->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);
}
}
@@ -568,14 +553,13 @@ static void smooth_multitextured_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
GLuint u;
ASSERT(ctx->Light.ShadeModel == GL_SMOOTH);
INIT_SPAN(span, GL_LINE, 0, 0,
SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA);
- /*span.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA);*/
#define SET_XMAJOR 1
#define INTERP_XY 1
@@ -587,39 +571,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->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); \
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->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.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->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);
}
}
@@ -632,29 +616,27 @@ static void flat_multitextured_line( GLcontext *ctx,
const SWvertex *vert1 )
{
GLboolean xMajor = GL_FALSE;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->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.arrayMask |= (SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA);
- span.interpMask |= (SPAN_RGBA | SPAN_SPEC);*/
- 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
@@ -663,32 +645,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->xArray[span->end] = X; \
+ span->yArray[span->end] = Y; \
+ span->zArray[span->end] = Z; \
+ span->fogArray[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->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.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->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);
}
}
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 29bf3e3baff..2e0618587e4 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_pointtemp.h,v 1.14 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_pointtemp.h,v 1.15 2002/04/19 14:05:50 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;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
/* Cull primitives with malformed coordinates.
*/
@@ -88,55 +88,52 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
}
INIT_SPAN(span, GL_POINT, 0, SPAN_FOG, SPAN_XY | SPAN_Z);
-
- /*span.arrayMask |= (SPAN_XY | SPAN_Z);
- span.interpMask |= SPAN_FOG;*/
- span.fog = vert->fog;
- span.fogStep = 0.0;
+ span->fog = vert->fog;
+ span->fogStep = 0.0;
#if (FLAGS & RGBA)
#if (FLAGS & SMOOTH)
- span.arrayMask |= SPAN_RGBA;
+ span->arrayMask |= SPAN_RGBA;
#else
- 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
- 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 & ATTENUATE
@@ -260,67 +257,67 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
if (dist2 < rmax2) {
if (dist2 >= rmin2) {
/* compute partial coverage */
- span.coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
+ span->coverage[count] = 1.0F - (dist2 - rmin2) * cscale;
#if FLAGS & INDEX
- span.coverage[count] *= 15.0; /* coverage in [0,15] */
+ span->coverage[count] *= 15.0; /* coverage in [0,15] */
#endif
}
else {
/* full coverage */
- span.coverage[count] = 1.0F;
+ span->coverage[count] = 1.0F;
}
- span.xArray[count] = x;
- span.yArray[count] = y;
- span.zArray[count] = z;
+ span->xArray[count] = x;
+ span->yArray[count] = y;
+ span->zArray[count] = z;
#if FLAGS & RGBA
- span.color.rgba[count][RCOMP] = red;
- span.color.rgba[count][GCOMP] = green;
- span.color.rgba[count][BCOMP] = blue;
+ span->color.rgba[count][RCOMP] = red;
+ span->color.rgba[count][GCOMP] = green;
+ span->color.rgba[count][BCOMP] = blue;
#if FLAGS & ATTENUATE
- span.color.rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
+ span->color.rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten);
#else
- span.color.rgba[count][ACOMP] = alpha;
+ span->color.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->xArray[count] = x;
+ span->yArray[count] = y;
+ span->zArray[count] = z;
count++;
#endif /*SMOOTH*/
} /*for x*/
} /*for y*/
- span.end = count;
+ span->end = count;
}
#else /* LARGE || ATTENUATE || SMOOTH*/
{
/* 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->xArray[0] = (GLint) vert->win[0];
+ span->yArray[0] = (GLint) vert->win[1];
+ span->zArray[0] = (GLint) vert->win[2];
+ span->end = 1;
}
#endif /* LARGE || ATTENUATE || SMOOTH */
- ASSERT(span.end > 0);
+ ASSERT(span->end > 0);
#if FLAGS & TEXTURE
if (ctx->Texture._ReallyEnabled)
- _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
}
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index b5d439609d6..1816624d67a 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1,4 +1,4 @@
-/* $Id: s_triangle.c,v 1.57 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.58 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -81,11 +81,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 +104,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 +126,17 @@ static void flat_rgba_triangle( GLcontext *ctx,
#define SETUP_CODE \
ASSERT(!ctx->Texture._ReallyEnabled); \
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 +165,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 +204,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->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]; \
} \
- (*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->color.rgb, \
NULL );
#include "s_tritemp.h"
@@ -260,31 +260,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->color.rgb[i][RCOMP] = texture[pos]; \
+ span->color.rgb[i][GCOMP] = texture[pos+1]; \
+ span->color.rgb[i][BCOMP] = texture[pos+2]; \
zRow[i] = z; \
- span.mask[i] = 1; \
+ span->mask[i] = 1; \
} \
else { \
- span.mask[i] = 0; \
+ span->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->color.rgb, \
+ span->mask );
#include "s_tritemp.h"
}
@@ -589,7 +589,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 +624,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"
@@ -895,9 +895,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 +926,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 +953,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 +975,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"
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index 35ad92f2f8b..ce7bdd09bdb 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_tritemp.h,v 1.36 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_tritemp.h,v 1.37 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -118,7 +118,7 @@
const GLint snapMask = ~((FIXED_ONE / 16) - 1); /* for x/y coord snapping */
GLfixed vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy;
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
INIT_SPAN(span, GL_POLYGON, 0, 0, 0);
@@ -339,7 +339,7 @@
/* compute d?/dx and d?/dy derivatives */
#ifdef INTERP_Z
- span.interpMask |= SPAN_Z;
+ span->interpMask |= SPAN_Z;
{
GLfloat eMaj_dz, eBot_dz;
eMaj_dz = vMax->win[2] - vMin->win[2];
@@ -354,22 +354,22 @@
dzdy = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx);
}
if (depthBits <= 16)
- span.zStep = SignedFloatToFixed(dzdx);
+ span->zStep = SignedFloatToFixed(dzdx);
else
- span.zStep = (GLint) dzdx;
+ span->zStep = (GLint) dzdx;
}
#endif
#ifdef INTERP_FOG
- span.interpMask |= SPAN_FOG;
+ span->interpMask |= SPAN_FOG;
{
const GLfloat eMaj_dfog = vMax->fog - vMin->fog;
const GLfloat eBot_dfog = vMid->fog - vMin->fog;
- span.fogStep = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
+ span->fogStep = oneOverArea * (eMaj_dfog * eBot.dy - eMaj.dy * eBot_dfog);
dfogdy = oneOverArea * (eMaj.dx * eBot_dfog - eMaj_dfog * eBot.dx);
}
#endif
#ifdef INTERP_RGB
- span.interpMask |= SPAN_RGBA;
+ span->interpMask |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
GLfloat eMaj_dr, eBot_dr;
GLfloat eMaj_dg, eBot_dg;
@@ -382,21 +382,21 @@
eBot_dr = (GLfloat) ((GLint) vMid->color[RCOMP] -
(GLint) vMin->color[RCOMP]);
drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
- span.redStep = SignedFloatToFixed(drdx);
+ span->redStep = SignedFloatToFixed(drdx);
drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
eMaj_dg = (GLfloat) ((GLint) vMax->color[GCOMP] -
(GLint) vMin->color[GCOMP]);
eBot_dg = (GLfloat) ((GLint) vMid->color[GCOMP] -
(GLint) vMin->color[GCOMP]);
dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
- span.greenStep = SignedFloatToFixed(dgdx);
+ span->greenStep = SignedFloatToFixed(dgdx);
dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
eMaj_db = (GLfloat) ((GLint) vMax->color[BCOMP] -
(GLint) vMin->color[BCOMP]);
eBot_db = (GLfloat) ((GLint) vMid->color[BCOMP] -
(GLint) vMin->color[BCOMP]);
dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
- span.blueStep = SignedFloatToFixed(dbdx);
+ span->blueStep = SignedFloatToFixed(dbdx);
dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
# ifdef INTERP_ALPHA
eMaj_da = (GLfloat) ((GLint) vMax->color[ACOMP] -
@@ -404,27 +404,27 @@
eBot_da = (GLfloat) ((GLint) vMid->color[ACOMP] -
(GLint) vMin->color[ACOMP]);
dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
- span.alphaStep = SignedFloatToFixed(dadx);
+ span->alphaStep = SignedFloatToFixed(dadx);
dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
# endif
}
else {
ASSERT (ctx->Light.ShadeModel == GL_FLAT);
- span.interpMask |= SPAN_FLAT;
+ span->interpMask |= SPAN_FLAT;
drdx = drdy = 0.0F;
dgdx = dgdy = 0.0F;
dbdx = dbdy = 0.0F;
- span.redStep = 0;
- span.greenStep = 0;
- span.blueStep = 0;
+ span->redStep = 0;
+ span->greenStep = 0;
+ span->blueStep = 0;
# ifdef INTERP_ALPHA
dadx = dady = 0.0F;
- span.alphaStep = 0;
+ span->alphaStep = 0;
# endif
}
#endif
#ifdef INTERP_FLOAT_RGBA
- span.interpMask |= SPAN_RGBA;
+ span->interpMask |= SPAN_RGBA;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
GLfloat eMaj_dr, eBot_dr;
GLfloat eMaj_dg, eBot_dg;
@@ -433,33 +433,33 @@
eMaj_dr = vMax->color[RCOMP] - vMin->color[RCOMP];
eBot_dr = vMid->color[RCOMP] - vMin->color[RCOMP];
drdx = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
- span.redStep = drdx;
+ span->redStep = drdx;
drdy = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
eMaj_dg = vMax->color[GCOMP] - vMin->color[GCOMP];
eBot_dg = vMid->color[GCOMP] - vMin->color[GCOMP];
dgdx = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
- span.greenStep = dgdx;
+ span->greenStep = dgdx;
dgdy = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
eMaj_db = vMax->color[BCOMP] - vMin->color[BCOMP];
eBot_db = vMid->color[BCOMP] - vMin->color[BCOMP];
dbdx = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
- span.blueStep = dbdx;
+ span->blueStep = dbdx;
dbdy = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
eMaj_da = vMax->color[ACOMP] - vMin->color[ACOMP];
eBot_da = vMid->color[ACOMP] - vMin->color[ACOMP];
dadx = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
- span.alphaStep = dadx;
+ span->alphaStep = dadx;
dady = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
}
else {
- drdx = drdy = span.redStep = 0.0F;
- dgdx = dgdy = span.greenStep = 0.0F;
- dbdx = dbdy = span.blueStep = 0.0F;
- dadx = dady = span.alphaStep = 0.0F;
+ drdx = drdy = span->redStep = 0.0F;
+ dgdx = dgdy = span->greenStep = 0.0F;
+ dbdx = dbdy = span->blueStep = 0.0F;
+ dadx = dady = span->alphaStep = 0.0F;
}
#endif
#ifdef INTERP_SPEC
- span.interpMask |= SPAN_SPEC;
+ span->interpMask |= SPAN_SPEC;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
GLfloat eMaj_dsr, eBot_dsr;
GLfloat eMaj_dsg, eBot_dsg;
@@ -469,34 +469,34 @@
eBot_dsr = (GLfloat) ((GLint) vMid->specular[RCOMP] -
(GLint) vMin->specular[RCOMP]);
dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr);
- span.specRedStep = SignedFloatToFixed(dsrdx);
+ span->specRedStep = SignedFloatToFixed(dsrdx);
dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx);
eMaj_dsg = (GLfloat) ((GLint) vMax->specular[GCOMP] -
(GLint) vMin->specular[GCOMP]);
eBot_dsg = (GLfloat) ((GLint) vMid->specular[GCOMP] -
(GLint) vMin->specular[GCOMP]);
dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg);
- span.specGreenStep = SignedFloatToFixed(dsgdx);
+ span->specGreenStep = SignedFloatToFixed(dsgdx);
dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx);
eMaj_dsb = (GLfloat) ((GLint) vMax->specular[BCOMP] -
(GLint) vMin->specular[BCOMP]);
eBot_dsb = (GLfloat) ((GLint) vMid->specular[BCOMP] -
(GLint) vMin->specular[BCOMP]);
dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb);
- span.specBlueStep = SignedFloatToFixed(dsbdx);
+ span->specBlueStep = SignedFloatToFixed(dsbdx);
dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
}
else {
dsrdx = dsrdy = 0.0F;
dsgdx = dsgdy = 0.0F;
dsbdx = dsbdy = 0.0F;
- span.specRedStep = 0;
- span.specGreenStep = 0;
- span.specBlueStep = 0;
+ span->specRedStep = 0;
+ span->specGreenStep = 0;
+ span->specBlueStep = 0;
}
#endif
#ifdef INTERP_FLOAT_SPEC
- span.interpMask |= SPAN_SPEC;
+ span->interpMask |= SPAN_SPEC;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
GLfloat eMaj_dsr, eBot_dsr;
GLfloat eMaj_dsg, eBot_dsg;
@@ -504,49 +504,49 @@
eMaj_dsr = vMax->specular[RCOMP] - vMin->specular[RCOMP];
eBot_dsr = vMid->specular[RCOMP] - vMin->specular[RCOMP];
dsrdx = oneOverArea * (eMaj_dsr * eBot.dy - eMaj.dy * eBot_dsr);
- span.specRedStep = dsrdx;
+ span->specRedStep = dsrdx;
dsrdy = oneOverArea * (eMaj.dx * eBot_dsr - eMaj_dsr * eBot.dx);
eMaj_dsg = vMax->specular[GCOMP] - vMin->specular[GCOMP];
eBot_dsg = vMid->specular[GCOMP] - vMin->specular[GCOMP];
dsgdx = oneOverArea * (eMaj_dsg * eBot.dy - eMaj.dy * eBot_dsg);
- span.specGreenStep = dsgdx;
+ span->specGreenStep = dsgdx;
dsgdy = oneOverArea * (eMaj.dx * eBot_dsg - eMaj_dsg * eBot.dx);
eMaj_dsb = vMax->specular[BCOMP] - vMin->specular[BCOMP];
eBot_dsb = vMid->specular[BCOMP] - vMin->specular[BCOMP];
dsbdx = oneOverArea * (eMaj_dsb * eBot.dy - eMaj.dy * eBot_dsb);
- span.specBlueStep = dsbdx;
+ span->specBlueStep = dsbdx;
dsbdy = oneOverArea * (eMaj.dx * eBot_dsb - eMaj_dsb * eBot.dx);
}
else {
- dsrdx = dsrdy = span.specRedStep = 0;
- dsgdx = dsgdy = span.specGreenStep = 0;
- dsbdx = dsbdy = span.specBlueStep = 0;
+ dsrdx = dsrdy = span->specRedStep = 0;
+ dsgdx = dsgdy = span->specGreenStep = 0;
+ dsbdx = dsbdy = span->specBlueStep = 0;
}
#endif
#ifdef INTERP_INDEX
- span.interpMask |= SPAN_INDEX;
+ span->interpMask |= SPAN_INDEX;
if (ctx->Light.ShadeModel == GL_SMOOTH) {
GLfloat eMaj_di, eBot_di;
eMaj_di = (GLfloat) ((GLint) vMax->index - (GLint) vMin->index);
eBot_di = (GLfloat) ((GLint) vMid->index - (GLint) vMin->index);
didx = oneOverArea * (eMaj_di * eBot.dy - eMaj.dy * eBot_di);
- span.indexStep = SignedFloatToFixed(didx);
+ span->indexStep = SignedFloatToFixed(didx);
didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx);
}
else {
- span.interpMask |= SPAN_FLAT;
+ span->interpMask |= SPAN_FLAT;
didx = didy = 0.0F;
- span.indexStep = 0;
+ span->indexStep = 0;
}
#endif
#ifdef INTERP_INT_TEX
- span.interpMask |= SPAN_INT_TEXTURE;
+ span->interpMask |= SPAN_INT_TEXTURE;
{
GLfloat eMaj_ds, eBot_ds;
eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE;
eBot_ds = (vMid->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE;
dsdx = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds);
- span.intTexStep[0] = SignedFloatToFixed(dsdx);
+ span->intTexStep[0] = SignedFloatToFixed(dsdx);
dsdy = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx);
}
{
@@ -554,13 +554,13 @@
eMaj_dt = (vMax->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE;
eBot_dt = (vMid->texcoord[0][1] - vMin->texcoord[0][1]) * T_SCALE;
dtdx = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt);
- span.intTexStep[1] = SignedFloatToFixed(dtdx);
+ span->intTexStep[1] = SignedFloatToFixed(dtdx);
dtdy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
}
#endif
#ifdef INTERP_TEX
- span.interpMask |= SPAN_TEXTURE;
+ span->interpMask |= SPAN_TEXTURE;
{
GLfloat wMax = vMax->win[3];
GLfloat wMin = vMin->win[3];
@@ -574,33 +574,33 @@
eBot_ds = vMid->texcoord[0][0] * wMid - vMin->texcoord[0][0] * wMin;
dsdx = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds);
dsdy = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx);
- span.texStepX[0][0] = dsdx;
- span.texStepY[0][0] = dsdy;
+ span->texStepX[0][0] = dsdx;
+ span->texStepY[0][0] = dsdy;
eMaj_dt = vMax->texcoord[0][1] * wMax - vMin->texcoord[0][1] * wMin;
eBot_dt = vMid->texcoord[0][1] * wMid - vMin->texcoord[0][1] * wMin;
dtdx = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt);
dtdy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
- span.texStepX[0][1] = dtdx;
- span.texStepY[0][1] = dtdy;
+ span->texStepX[0][1] = dtdx;
+ span->texStepY[0][1] = dtdy;
eMaj_du = vMax->texcoord[0][2] * wMax - vMin->texcoord[0][2] * wMin;
eBot_du = vMid->texcoord[0][2] * wMid - vMin->texcoord[0][2] * wMin;
dudx = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du);
dudy = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx);
- span.texStepX[0][2] = dudx;
- span.texStepY[0][2] = dudy;
+ span->texStepX[0][2] = dudx;
+ span->texStepY[0][2] = dudy;
eMaj_dv = vMax->texcoord[0][3] * wMax - vMin->texcoord[0][3] * wMin;
eBot_dv = vMid->texcoord[0][3] * wMid - vMin->texcoord[0][3] * wMin;
dvdx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
dvdy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
- span.texStepX[0][3] = dvdx;
- span.texStepY[0][3] = dvdy;
+ span->texStepX[0][3] = dvdx;
+ span->texStepY[0][3] = dvdy;
}
#endif
#ifdef INTERP_MULTITEX
- span.interpMask |= SPAN_TEXTURE;
+ span->interpMask |= SPAN_TEXTURE;
{
GLfloat wMax = vMax->win[3];
GLfloat wMin = vMin->win[3];
@@ -618,8 +618,8 @@
- vMin->texcoord[u][0] * wMin;
dsdx[u] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds);
dsdy[u] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx);
- span.texStepX[u][0] = dsdx[u];
- span.texStepY[u][0] = dsdy[u];
+ span->texStepX[u][0] = dsdx[u];
+ span->texStepY[u][0] = dsdy[u];
eMaj_dt = vMax->texcoord[u][1] * wMax
- vMin->texcoord[u][1] * wMin;
@@ -627,8 +627,8 @@
- vMin->texcoord[u][1] * wMin;
dtdx[u] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt);
dtdy[u] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx);
- span.texStepX[u][1] = dtdx[u];
- span.texStepY[u][1] = dtdy[u];
+ span->texStepX[u][1] = dtdx[u];
+ span->texStepY[u][1] = dtdy[u];
eMaj_du = vMax->texcoord[u][2] * wMax
- vMin->texcoord[u][2] * wMin;
@@ -636,8 +636,8 @@
- vMin->texcoord[u][2] * wMin;
dudx[u] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du);
dudy[u] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx);
- span.texStepX[u][2] = dudx[u];
- span.texStepY[u][2] = dudy[u];
+ span->texStepX[u][2] = dudx[u];
+ span->texStepY[u][2] = dudy[u];
eMaj_dv = vMax->texcoord[u][3] * wMax
- vMin->texcoord[u][3] * wMin;
@@ -645,8 +645,8 @@
- vMin->texcoord[u][3] * wMin;
dvdx[u] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv);
dvdy[u] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx);
- span.texStepX[u][3] = dvdx[u];
- span.texStepY[u][3] = dvdy[u];
+ span->texStepX[u][3] = dvdx[u];
+ span->texStepY[u][3] = dvdy[u];
}
}
}
@@ -828,7 +828,7 @@
(void) dxOuter;
fy = eLeft->fsy;
- span.y = FixedToInt(fy);
+ span->y = FixedToInt(fy);
adjx = (float)(fx - eLeft->fx0); /* SCALED! */
adjy = eLeft->adjy; /* SCALED! */
@@ -840,7 +840,7 @@
#ifdef PIXEL_ADDRESS
{
- pRow = (PIXEL_TYPE *) PIXEL_ADDRESS(FixedToInt(fxLeftEdge), span.y);
+ pRow = (PIXEL_TYPE *) PIXEL_ADDRESS(FixedToInt(fxLeftEdge), span->y);
dPRowOuter = -((int)BYTES_PER_ROW) + idxOuter * sizeof(PIXEL_TYPE);
/* negative because Y=0 at bottom and increases upward */
}
@@ -876,15 +876,15 @@
}
# ifdef DEPTH_TYPE
zRow = (DEPTH_TYPE *)
- _mesa_zbuffer_address(ctx, FixedToInt(fxLeftEdge), span.y);
+ _mesa_zbuffer_address(ctx, FixedToInt(fxLeftEdge), span->y);
dZRowOuter = (ctx->DrawBuffer->Width + idxOuter) * sizeof(DEPTH_TYPE);
# endif
}
#endif
#ifdef INTERP_FOG
- fogLeft = vLower->fog + (span.fogStep * adjx + dfogdy * adjy)
+ fogLeft = vLower->fog + (span->fogStep * adjx + dfogdy * adjy)
* (1.0F/FIXED_SCALE);
- dfogOuter = dfogdy + dxOuter * span.fogStep;
+ dfogOuter = dfogdy + dxOuter * span->fogStep;
#endif
#ifdef INTERP_RGB
if (ctx->Light.ShadeModel == GL_SMOOTH) {
@@ -1006,21 +1006,21 @@
GLfloat invW = vLower->win[3];
GLfloat s0, t0, u0, v0;
s0 = vLower->texcoord[0][0] * invW;
- sLeft = s0 + (span.texStepX[0][0] * adjx + dsdy * adjy)
+ sLeft = s0 + (span->texStepX[0][0] * adjx + dsdy * adjy)
* (1.0F/FIXED_SCALE);
- dsOuter = dsdy + dxOuter * span.texStepX[0][0];
+ dsOuter = dsdy + dxOuter * span->texStepX[0][0];
t0 = vLower->texcoord[0][1] * invW;
- tLeft = t0 + (span.texStepX[0][1] * adjx + dtdy * adjy)
+ tLeft = t0 + (span->texStepX[0][1] * adjx + dtdy * adjy)
* (1.0F/FIXED_SCALE);
- dtOuter = dtdy + dxOuter * span.texStepX[0][1];
+ dtOuter = dtdy + dxOuter * span->texStepX[0][1];
u0 = vLower->texcoord[0][2] * invW;
- uLeft = u0 + (span.texStepX[0][2] * adjx + dudy * adjy)
+ uLeft = u0 + (span->texStepX[0][2] * adjx + dudy * adjy)
* (1.0F/FIXED_SCALE);
- duOuter = dudy + dxOuter * span.texStepX[0][2];
+ duOuter = dudy + dxOuter * span->texStepX[0][2];
v0 = vLower->texcoord[0][3] * invW;
- vLeft = v0 + (span.texStepX[0][3] * adjx + dvdy * adjy)
+ vLeft = v0 + (span->texStepX[0][3] * adjx + dvdy * adjy)
* (1.0F/FIXED_SCALE);
- dvOuter = dvdy + dxOuter * span.texStepX[0][3];
+ dvOuter = dvdy + dxOuter * span->texStepX[0][3];
}
#endif
#ifdef INTERP_MULTITEX
@@ -1031,21 +1031,21 @@
GLfloat invW = vLower->win[3];
GLfloat s0, t0, u0, v0;
s0 = vLower->texcoord[u][0] * invW;
- sLeft[u] = s0 + (span.texStepX[u][0] * adjx + dsdy[u]
+ sLeft[u] = s0 + (span->texStepX[u][0] * adjx + dsdy[u]
* adjy) * (1.0F/FIXED_SCALE);
- dsOuter[u] = dsdy[u] + dxOuter * span.texStepX[u][0];
+ dsOuter[u] = dsdy[u] + dxOuter * span->texStepX[u][0];
t0 = vLower->texcoord[u][1] * invW;
- tLeft[u] = t0 + (span.texStepX[u][1] * adjx + dtdy[u]
+ tLeft[u] = t0 + (span->texStepX[u][1] * adjx + dtdy[u]
* adjy) * (1.0F/FIXED_SCALE);
- dtOuter[u] = dtdy[u] + dxOuter * span.texStepX[u][1];
+ dtOuter[u] = dtdy[u] + dxOuter * span->texStepX[u][1];
u0 = vLower->texcoord[u][2] * invW;
- uLeft[u] = u0 + (span.texStepX[u][2] * adjx + dudy[u]
+ uLeft[u] = u0 + (span->texStepX[u][2] * adjx + dudy[u]
* adjy) * (1.0F/FIXED_SCALE);
- duOuter[u] = dudy[u] + dxOuter * span.texStepX[u][2];
+ duOuter[u] = dudy[u] + dxOuter * span->texStepX[u][2];
v0 = vLower->texcoord[u][3] * invW;
- vLeft[u] = v0 + (span.texStepX[u][3] * adjx + dvdy[u]
+ vLeft[u] = v0 + (span->texStepX[u][3] * adjx + dvdy[u]
* adjy) * (1.0F/FIXED_SCALE);
- dvOuter[u] = dvdy[u] + dxOuter * span.texStepX[u][3];
+ dvOuter[u] = dvdy[u] + dxOuter * span->texStepX[u][3];
}
}
}
@@ -1072,46 +1072,46 @@
# ifdef DEPTH_TYPE
dZRowInner = dZRowOuter + sizeof(DEPTH_TYPE);
# endif
- fdzInner = fdzOuter + span.zStep;
+ fdzInner = fdzOuter + span->zStep;
#endif
#ifdef INTERP_FOG
- dfogInner = dfogOuter + span.fogStep;
+ dfogInner = dfogOuter + span->fogStep;
#endif
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
- fdrInner = fdrOuter + span.redStep;
- fdgInner = fdgOuter + span.greenStep;
- fdbInner = fdbOuter + span.blueStep;
+ fdrInner = fdrOuter + span->redStep;
+ fdgInner = fdgOuter + span->greenStep;
+ fdbInner = fdbOuter + span->blueStep;
#endif
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
- fdaInner = fdaOuter + span.alphaStep;
+ fdaInner = fdaOuter + span->alphaStep;
#endif
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
- fdsrInner = fdsrOuter + span.specRedStep;
- fdsgInner = fdsgOuter + span.specGreenStep;
- fdsbInner = fdsbOuter + span.specBlueStep;
+ fdsrInner = fdsrOuter + span->specRedStep;
+ fdsgInner = fdsgOuter + span->specGreenStep;
+ fdsbInner = fdsbOuter + span->specBlueStep;
#endif
#ifdef INTERP_INDEX
- fdiInner = fdiOuter + span.indexStep;
+ fdiInner = fdiOuter + span->indexStep;
#endif
#ifdef INTERP_INT_TEX
- fdsInner = fdsOuter + span.intTexStep[0];
- fdtInner = fdtOuter + span.intTexStep[1];
+ fdsInner = fdsOuter + span->intTexStep[0];
+ fdtInner = fdtOuter + span->intTexStep[1];
#endif
#ifdef INTERP_TEX
- dsInner = dsOuter + span.texStepX[0][0];
- dtInner = dtOuter + span.texStepX[0][1];
- duInner = duOuter + span.texStepX[0][2];
- dvInner = dvOuter + span.texStepX[0][3];
+ dsInner = dsOuter + span->texStepX[0][0];
+ dtInner = dtOuter + span->texStepX[0][1];
+ duInner = duOuter + span->texStepX[0][2];
+ dvInner = dvOuter + span->texStepX[0][3];
#endif
#ifdef INTERP_MULTITEX
{
GLuint u;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
- dsInner[u] = dsOuter[u] + span.texStepX[u][0];
- dtInner[u] = dtOuter[u] + span.texStepX[u][1];
- duInner[u] = duOuter[u] + span.texStepX[u][2];
- dvInner[u] = dvOuter[u] + span.texStepX[u][3];
+ dsInner[u] = dsOuter[u] + span->texStepX[u][0];
+ dtInner[u] = dtOuter[u] + span->texStepX[u][1];
+ duInner[u] = duOuter[u] + span->texStepX[u][2];
+ dvInner[u] = dvOuter[u] + span->texStepX[u][3];
}
}
}
@@ -1122,45 +1122,45 @@
/* ff = fixed-pt fragment */
const GLint right = FixedToInt(fxRightEdge);
- span.x = FixedToInt(fxLeftEdge);
+ span->x = FixedToInt(fxLeftEdge);
- if (right <= span.x)
- span.end = 0;
+ if (right <= span->x)
+ span->end = 0;
else
- span.end = right - span.x;
+ span->end = right - span->x;
#ifdef INTERP_Z
- span.z = fz;
+ span->z = fz;
#endif
#ifdef INTERP_FOG
- span.fog = fogLeft;
+ span->fog = fogLeft;
#endif
#if defined(INTERP_RGB) || defined(INTERP_FLOAT_RGBA)
- span.red = fr;
- span.green = fg;
- span.blue = fb;
+ span->red = fr;
+ span->green = fg;
+ span->blue = fb;
#endif
#if defined(INTERP_ALPHA) || defined(INTERP_FLOAT_RGBA)
- span.alpha = fa;
+ span->alpha = fa;
#endif
#if defined(INTERP_SPEC) || defined(INTERP_FLOAT_SPEC)
- span.specRed = fsr;
- span.specGreen = fsg;
- span.specBlue = fsb;
+ span->specRed = fsr;
+ span->specGreen = fsg;
+ span->specBlue = fsb;
#endif
#ifdef INTERP_INDEX
- span.index = fi;
+ span->index = fi;
#endif
#ifdef INTERP_INT_TEX
- span.intTex[0] = fs;
- span.intTex[1] = ft;
+ span->intTex[0] = fs;
+ span->intTex[1] = ft;
#endif
#ifdef INTERP_TEX
- span.tex[0][0] = sLeft;
- span.tex[0][1] = tLeft;
- span.tex[0][2] = uLeft;
- span.tex[0][3] = vLeft;
+ span->tex[0][0] = sLeft;
+ span->tex[0][1] = tLeft;
+ span->tex[0][2] = uLeft;
+ span->tex[0][3] = vLeft;
#endif
#ifdef INTERP_MULTITEX
@@ -1168,10 +1168,10 @@
GLuint u;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
if (ctx->Texture.Unit[u]._ReallyEnabled) {
- span.tex[u][0] = sLeft[u];
- span.tex[u][1] = tLeft[u];
- span.tex[u][2] = uLeft[u];
- span.tex[u][3] = vLeft[u];
+ span->tex[u][0] = sLeft[u];
+ span->tex[u][1] = tLeft[u];
+ span->tex[u][2] = uLeft[u];
+ span->tex[u][3] = vLeft[u];
}
}
}
@@ -1180,68 +1180,68 @@
#ifdef INTERP_RGB
{
/* need this to accomodate round-off errors */
- const GLint len = right - span.x - 1;
- GLfixed ffrend = span.red + len * span.redStep;
- GLfixed ffgend = span.green + len * span.greenStep;
- GLfixed ffbend = span.blue + len * span.blueStep;
+ const GLint len = right - span->x - 1;
+ GLfixed ffrend = span->red + len * span->redStep;
+ GLfixed ffgend = span->green + len * span->greenStep;
+ GLfixed ffbend = span->blue + len * span->blueStep;
if (ffrend < 0) {
- span.red -= ffrend;
- if (span.red < 0)
- span.red = 0;
+ span->red -= ffrend;
+ if (span->red < 0)
+ span->red = 0;
}
if (ffgend < 0) {
- span.green -= ffgend;
- if (span.green < 0)
- span.green = 0;
+ span->green -= ffgend;
+ if (span->green < 0)
+ span->green = 0;
}
if (ffbend < 0) {
- span.blue -= ffbend;
- if (span.blue < 0)
- span.blue = 0;
+ span->blue -= ffbend;
+ if (span->blue < 0)
+ span->blue = 0;
}
}
#endif
#ifdef INTERP_ALPHA
{
- const GLint len = right - span.x - 1;
- GLfixed ffaend = span.alpha + len * span.alphaStep;
+ const GLint len = right - span->x - 1;
+ GLfixed ffaend = span->alpha + len * span->alphaStep;
if (ffaend < 0) {
- span.alpha -= ffaend;
- if (span.alpha < 0)
- span.alpha = 0;
+ span->alpha -= ffaend;
+ if (span->alpha < 0)
+ span->alpha = 0;
}
}
#endif
#ifdef INTERP_SPEC
{
/* need this to accomodate round-off errors */
- const GLint len = right - span.x - 1;
- GLfixed ffsrend = span.specRed + len * span.specRedStep;
- GLfixed ffsgend = span.specGreen + len * span.specGreenStep;
- GLfixed ffsbend = span.specBlue + len * span.specBlueStep;
+ const GLint len = right - span->x - 1;
+ GLfixed ffsrend = span->specRed + len * span->specRedStep;
+ GLfixed ffsgend = span->specGreen + len * span->specGreenStep;
+ GLfixed ffsbend = span->specBlue + len * span->specBlueStep;
if (ffsrend < 0) {
- span.specRed -= ffsrend;
- if (span.specRed < 0)
- span.specRed = 0;
+ span->specRed -= ffsrend;
+ if (span->specRed < 0)
+ span->specRed = 0;
}
if (ffsgend < 0) {
- span.specGreen -= ffsgend;
- if (span.specGreen < 0)
- span.specGreen = 0;
+ span->specGreen -= ffsgend;
+ if (span->specGreen < 0)
+ span->specGreen = 0;
}
if (ffsbend < 0) {
- span.specBlue -= ffsbend;
- if (span.specBlue < 0)
- span.specBlue = 0;
+ span->specBlue -= ffsbend;
+ if (span->specBlue < 0)
+ span->specBlue = 0;
}
}
#endif
#ifdef INTERP_INDEX
- if (span.index < 0) span.index = 0;
+ if (span->index < 0) span->index = 0;
#endif
/* This is where we actually generate fragments */
- if (span.end > 0) {
+ if (span->end > 0) {
RENDER_SPAN( span );
}
@@ -1251,7 +1251,7 @@
* pixel-center x coordinate so that it stays
* on or inside the major edge.
*/
- span.y++;
+ (span->y)++;
lines--;
fxLeftEdge += fdxLeftEdge;
diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c
index f56fa5a6a4b..960fdf2d5ed 100644
--- a/src/mesa/swrast/s_zoom.c
+++ b/src/mesa/swrast/s_zoom.c
@@ -1,4 +1,4 @@
-/* $Id: s_zoom.c,v 1.15 2002/04/19 00:38:27 brianp Exp $ */
+/* $Id: s_zoom.c,v 1.16 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -57,7 +57,7 @@ zoom_span( GLcontext *ctx, const struct sw_span *span,
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);
if (format == GL_RGBA || format == GL_RGB) {
zoomed.z = span->z;
zoomed.zStep = span->z;
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index a90d498eb59..f36031cfb4a 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -1,4 +1,4 @@
-/* $Id: swrast.h,v 1.23 2002/04/12 15:47:21 brianp Exp $ */
+/* $Id: swrast.h,v 1.24 2002/04/19 14:05:50 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,12 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- * Authors:
- * Keith Whitwell <[email protected]>
+ */
+
+/**
+ * \file swrast/swrast.h
+ * \brief Defines basic structures for sw_rasterizer.
+ * \author Keith Whitwell <[email protected]>
*/
#ifndef SWRAST_H
@@ -32,8 +36,11 @@
#include "mtypes.h"
-
-/* The software rasterizer now uses this format for vertices. Thus a
+/**
+ * \struct SWvertex
+ * \brief Data-structure to handle vertices in the software rasterizer.
+ *
+ * The software rasterizer now uses this format for vertices. Thus a
* 'RasterSetup' stage or other translation is required between the
* tnl module and the swrast rasterization functions. This serves to
* isolate the swrast module from the internals of the tnl module, and
@@ -66,11 +73,17 @@ typedef struct {
} SWvertex;
-/*
+/**
+ * \struct sw_span
+ * \brief Contains data for either a horizontal line or a set of
+ * pixels that are passed through a pipeline of functions before being
+ * drawn.
+ *
* The sw_span structure describes the colors, Z, fogcoord, texcoords,
- * etc for a horizontal run of pixels. We can either specify a base/step
- * to indicate interpolated values, or fill in arrays of values.
- * The interpMask and arrayMask bitfields indicate which are active.
+ * etc for either a horizontal run or a set of independent pixels. We
+ * can either specify a base/step to indicate interpolated values, or
+ * fill in arrays of values. The interpMask and arrayMask bitfields
+ * indicate which are active.
*
* With this structure it's easy to hand-off span rasterization to
* subroutines instead of doing it all inline in the triangle functions
@@ -102,14 +115,14 @@ typedef struct {
struct sw_span {
GLint x, y;
- /* Only need to process pixels between start <= i < end */
- /* At this time, start is always zero. */
+ /** Only need to process pixels between start <= i < end */
+ /** At this time, start is always zero. */
GLuint start, end;
- /* This flag indicates that mask[] array is effectively filled with ones */
+ /** This flag indicates that mask[] array is effectively filled with ones */
GLboolean writeAll;
- /* either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */
+ /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */
GLenum primitive;
/**
@@ -159,26 +172,26 @@ struct sw_span {
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];
+ 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 */
+ /** This mask indicates if fragment is alive or culled */
GLubyte mask[MAX_WIDTH];
};
#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->primitive = (PRIMITIVE); \
+ S->interpMask = (INTERP_MASK); \
+ S->arrayMask = (ARRAY_MASK); \
+ S->start = 0; \
+ S->end = (END); \
} while (0)