-/* $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
#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
#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
-/* $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
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
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"
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"
#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]; \
ptr->b = color[BCOMP]; \
zRow[i] = z; \
} \
- span.z += span.zStep; \
+ span->z += span->zStep; \
}
#include "swrast/s_tritemp.h"
#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], \
XMesaPutPixel(img, x, y, p); \
zRow[i] = z; \
} \
- span.z += span.zStep; \
+ span->z += span->zStep; \
}
#include "swrast/s_tritemp.h"
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"
#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"
#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"
#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"
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"
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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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); \
}
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; \
}
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; \
}
#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]; \
#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] ); \
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; \
}
#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]); \
}
#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); \
}
#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 ); \
}
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); \
}
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; \
}
-/* $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
GLfloat lambda[MAX_TEXTURE_UNITS];
GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS];
- struct sw_span span;
+ struct sw_span *span;
};
-/* $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
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)
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]);
}
}
#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 */
}
}
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);
}
#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);
}
#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);
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]);
#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;
}
#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
}
-/* $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
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];
INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE);
- /*span.arrayMask |= SPAN_COVERAGE;*/
/* determine bottom to top order of vertices */
{
*/
#ifdef DO_Z
compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane);
- span.arrayMask |= SPAN_Z;
+ span->arrayMask |= SPAN_Z;
#endif
#ifdef DO_FOG
compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane);
- span.arrayMask |= SPAN_FOG;
+ span->arrayMask |= SPAN_FOG;
#endif
#ifdef DO_RGBA
if (ctx->Light.ShadeModel == GL_SMOOTH) {
constant_plane(v2->color[BCOMP], bPlane);
constant_plane(v2->color[ACOMP], aPlane);
}
- span.arrayMask |= SPAN_RGBA;
+ span->arrayMask |= SPAN_RGBA;
#endif
#ifdef DO_INDEX
if (ctx->Light.ShadeModel == GL_SMOOTH) {
else {
constant_plane((GLfloat) v2->index, iPlane);
}
- span.arrayMask |= SPAN_INDEX;
+ span->arrayMask |= SPAN_INDEX;
#endif
#ifdef DO_SPEC
if (ctx->Light.ShadeModel == GL_SMOOTH) {
constant_plane(v2->specular[GCOMP], sgPlane);
constant_plane(v2->specular[BCOMP], sbPlane);
}
- span.arrayMask |= SPAN_SPEC;
+ span->arrayMask |= SPAN_SPEC;
#endif
#ifdef DO_TEX
{
texWidth = (GLfloat) texImage->Width;
texHeight = (GLfloat) texImage->Height;
}
- span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#elif defined(DO_MULTITEX)
{
GLuint u;
}
}
}
- span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
+ span->arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA);
#endif
/* Begin bottom-to-top scan over the triangle.
/* (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);
}
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]);
}
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
}
}
/* (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)
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,
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
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
}
}
-/* $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
* 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"
#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 )
-/* $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
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);
_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 );
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) {
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) {
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;
}
}
{
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);
_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 );
/* 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;
}
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)
/* 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;
}
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)
-/* $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
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;
}
fprintf(stderr, "_swrast_DestroyContext\n");
}
+ FREE( swrast->span );
+
FREE( swrast );
ctx->swrast_context = 0;
-/* $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
* Keith Whitwell <keithw@valinux.com>
*/
+/**
+ * \file swrast/s_context.h
+ * \brief fill in description
+ * \author Keith Whitwell <keithw@valinux.com>
+ */
+
#ifndef S_CONTEXT_H
#define S_CONTEXT_H
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| \
_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;
/* 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 * );
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];
-/* $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
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
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 */
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);
}
}
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);
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
/* 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 {
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) {
/* 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) {
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);
}
}
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) {
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
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 {
ctx->Pixel.DriverReadBuffer );
}
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy,
- span.color.index );
+ span->color.index );
}
if (changeBuffer) {
}
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) */
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" );
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;
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);
}
}
-/* $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
{
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
/* 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++;
/* 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++;
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++;
}
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;
}
}
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++;
}
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++;
}
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;
}
}
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++;
}
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++;
}
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;
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++;
}
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
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);
}
}
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
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);
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);
}
}
}
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)");
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 {
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);
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);
}
}
}
-/* $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
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);
}
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);
}
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);
}
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);
}
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
#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);
}
}
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
#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);
}
}
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
#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);
}
}
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
#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);
}
}
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
#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);
}
}
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
#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);
}
}
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
#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);
}
}
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
#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);
}
}
-/* $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
const GLchan alpha = vert->color[3];
#endif
- struct sw_span span;
+ struct sw_span *span = SWRAST_CONTEXT(ctx)->span;
/* Cull primitives with malformed coordinates.
*/
}
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
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
}
-/* $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
#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"
}
#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"
}
#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"
}
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"
#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"
#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"
}
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) */ \
} \
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"
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"
#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"
}
#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"
#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"
-/* $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
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);
/* 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];
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;
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] -
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;
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;
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;
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);
}
{
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];
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];
- 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;
- 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;
- 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;
- 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];
}
}
}
(void) dxOuter;
fy = eLeft->fsy;
- span.y = FixedToInt(fy);
+ span->y = FixedToInt(fy);
adjx = (float)(fx - eLeft->fx0); /* SCALED! */
adjy = eLeft->adjy; /* SCALED! */
#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 */
}
}
# 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) {
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
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];
}
}
}
# 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];
}
}
}
/* 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
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];
}
}
}
#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 );
}
* pixel-center x coordinate so that it stays
* on or inside the major edge.
*/
- span.y++;
+ (span->y)++;
lines--;
fxLeftEdge += fdxLeftEdge;
-/* $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
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;
-/* $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
* 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 <keithw@valinux.com>
+ */
+
+/**
+ * \file swrast/swrast.h
+ * \brief Defines basic structures for sw_rasterizer.
+ * \author Keith Whitwell <keithw@valinux.com>
*/
#ifndef SWRAST_H
#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
} 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
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;
/**
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)