else {
fxMesa->haveGlobalPaletteTexture = 0;
- if ((ctx->Texture.Unit[0]._Current == ctx->Texture.Unit[0].CurrentD[2]) &&
+ if ((ctx->Texture.Unit[0]._Current == ctx->Texture.Unit[0].Current2D) &&
(ctx->Texture.Unit[0]._Current != NULL)) {
struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current;
GLuint unitsmode;
GLint ifmt;
tfxTexInfo *ti;
- struct gl_texture_object *tObj=ctx->Texture.Unit[textureset].CurrentD[2];
+ struct gl_texture_object *tObj=ctx->Texture.Unit[textureset].Current2D;
int tmu;
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GrCombineLocal_t localc,locala;
tfxTexInfo *ti0,*ti1;
- struct gl_texture_object *tObj0=ctx->Texture.Unit[0].CurrentD[2];
- struct gl_texture_object *tObj1=ctx->Texture.Unit[1].CurrentD[2];
+ struct gl_texture_object *tObj0=ctx->Texture.Unit[0].Current2D;
+ struct gl_texture_object *tObj1=ctx->Texture.Unit[1].Current2D;
GLuint envmode,ifmt,unitsmode;
int tmu0=0, tmu1=1;
-/* $Id: osmesa.c,v 1.32 2000/11/17 21:01:40 brianp Exp $ */
+/* $Id: osmesa.c,v 1.33 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Draw a flat-shaded, RGB line into an osmesa buffer.
*/
static void flat_rgba_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, RGB line into an osmesa buffer.
*/
static void flat_rgba_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *color = vert0->color;
* Draw a flat-shaded, alpha-blended, RGB line into an osmesa buffer.
*/
static void flat_blend_rgba_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift;
* Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer.
*/
static void flat_blend_rgba_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift;
* Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer.
*/
static void flat_blend_rgba_z_line_write( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift;
* Smooth-shaded, z-less triangle, RGBA color.
*/
static void smooth_rgba_z_triangle( GLcontext *ctx,
- SWvertex *v0, SWvertex *v1, SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift;
* Flat-shaded, z-less triangle, RGBA color.
*/
static void flat_rgba_z_triangle( GLcontext *ctx,
- SWvertex *v0, SWvertex *v1, SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
#define INTERP_Z 1
-/* $Id: xm_line.c,v 1.10 2000/11/16 21:05:40 keithw Exp $ */
+/* $Id: xm_line.c,v 1.11 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
* Render an array of points into a pixmap, any pixel format.
*/
-static void draw_points_ANY_pixmap( GLcontext *ctx, SWvertex *vert )
+static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaDisplay *dpy = xmesa->xm_visual->display;
* Draw a flat-shaded, PF_TRUECOLOR line into an XImage.
*/
static void flat_TRUECOLOR_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_8A8B8G8R line into an XImage.
*/
static void flat_8A8B8G8R_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_8R8G8B line into an XImage.
*/
static void flat_8R8G8B_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_8R8G8B24 line into an XImage.
*/
static void flat_8R8G8B24_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_5R6G5B line into an XImage.
*/
static void flat_5R6G5B_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_DITHER_5R6G5B line into an XImage.
*/
static void flat_DITHER_5R6G5B_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_DITHER 8-bit line into an XImage.
*/
static void flat_DITHER8_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage.
*/
static void flat_LOOKUP8_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, PF_HPCR line into an XImage.
*/
static void flat_HPCR_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage.
*/
static void flat_TRUECOLOR_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_8A8B8G8R line into an XImage.
*/
static void flat_8A8B8G8R_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage.
*/
static void flat_8R8G8B_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_8R8G8B24 line into an XImage.
*/
static void flat_8R8G8B24_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_5R6G5B line into an XImage.
*/
static void flat_5R6G5B_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_DITHER_5R6G5B line into an XImage.
*/
static void flat_DITHER_5R6G5B_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage.
*/
static void flat_DITHER8_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage.
*/
static void flat_LOOKUP8_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
* Draw a flat-shaded, Z-less, PF_HPCR line into an XImage.
*/
static void flat_HPCR_z_line( GLcontext *ctx,
- SWvertex *vert0, SWvertex *vert1 )
+ const SWvertex *vert0, const SWvertex *vert1 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = vert0->color;
-/* $Id: xm_tri.c,v 1.10 2000/11/16 21:05:40 keithw Exp $ */
+/* $Id: xm_tri.c,v 1.11 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* XImage, smooth, depth-buffered, PF_TRUECOLOR triangle.
*/
static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, smooth, depth-buffered, PF_8A8B8G8R triangle.
*/
static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, PF_8R8G8B triangle.
*/
static void smooth_8R8G8B_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, PF_8R8G8B24 triangle.
*/
static void smooth_8R8G8B24_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, PF_TRUEDITHER triangle.
*/
static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, smooth, depth-buffered, PF_5R6G5B triangle.
*/
static void smooth_5R6G5B_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, PF_DITHER_5R6G5B triangle.
*/
static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, 8-bit, PF_DITHER8 triangle.
*/
static void smooth_DITHER8_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, PF_DITHER triangle.
*/
static void smooth_DITHER_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, smooth, depth-buffered, 8-bit PF_LOOKUP triangle.
*/
static void smooth_LOOKUP8_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, depth-buffered, 8-bit PF_HPCR triangle.
*/
static void smooth_HPCR_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, flat, depth-buffered, PF_TRUECOLOR triangle.
*/
static void flat_TRUECOLOR_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, flat, depth-buffered, PF_8A8B8G8R triangle.
*/
static void flat_8A8B8G8R_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, flat, depth-buffered, PF_8R8G8B triangle.
*/
static void flat_8R8G8B_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, flat, depth-buffered, PF_8R8G8B24 triangle.
*/
static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = v0->color;
* XImage, flat, depth-buffered, PF_TRUEDITHER triangle.
*/
static void flat_TRUEDITHER_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, flat, depth-buffered, PF_5R6G5B triangle.
*/
static void flat_5R6G5B_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, flat, depth-buffered, PF_DITHER_5R6G5B triangle.
*/
static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = v0->color;
* XImage, flat, depth-buffered, 8-bit PF_DITHER triangle.
*/
static void flat_DITHER8_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, flat, depth-buffered, PF_DITHER triangle.
*/
static void flat_DITHER_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, flat, depth-buffered, 8-bit PF_HPCR triangle.
*/
static void flat_HPCR_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, flat, depth-buffered, 8-bit PF_LOOKUP triangle.
*/
static void flat_LOOKUP8_z_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_Z 1
* XImage, smooth, NON-depth-buffered, PF_TRUECOLOR triangle.
*/
static void smooth_TRUECOLOR_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, smooth, NON-depth-buffered, PF_8A8B8G8R triangle.
*/
static void smooth_8A8B8G8R_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_RGB 1
* XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle.
*/
static void smooth_8R8G8B_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_RGB 1
* XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle.
*/
static void smooth_8R8G8B24_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_RGB 1
* XImage, smooth, NON-depth-buffered, PF_TRUEDITHER triangle.
*/
static void smooth_TRUEDITHER_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, smooth, NON-depth-buffered, PF_5R6G5B triangle.
*/
static void smooth_5R6G5B_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_RGB 1
* XImage, smooth, NON-depth-buffered, PF_DITHER_5R6G5B triangle.
*/
static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_RGB 1
* XImage, smooth, NON-depth-buffered, 8-bit PF_DITHER triangle.
*/
static void smooth_DITHER8_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define INTERP_RGB 1
* XImage, smooth, NON-depth-buffered, PF_DITHER triangle.
*/
static void smooth_DITHER_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, smooth, NON-depth-buffered, 8-bit PF_LOOKUP triangle.
*/
static void smooth_LOOKUP8_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
* XImage, smooth, NON-depth-buffered, 8-bit PF_HPCR triangle.
*/
static void smooth_HPCR_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
* XImage, flat, NON-depth-buffered, PF_TRUECOLOR triangle.
*/
static void flat_TRUECOLOR_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, flat, NON-depth-buffered, PF_8A8B8G8R triangle.
*/
static void flat_8A8B8G8R_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
* XImage, flat, NON-depth-buffered, PF_8R8G8B triangle.
*/
static void flat_8R8G8B_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
* XImage, flat, NON-depth-buffered, PF_8R8G8B24 triangle.
*/
static void flat_8R8G8B24_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = v0->color;
* XImage, flat, NON-depth-buffered, PF_TRUEDITHER triangle.
*/
static void flat_TRUEDITHER_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, flat, NON-depth-buffered, PF_5R6G5B triangle.
*/
static void flat_5R6G5B_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
* XImage, flat, NON-depth-buffered, PF_DITHER_5R6G5B triangle.
*/
static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
const GLubyte *color = v0->color;
* XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle.
*/
static void flat_DITHER8_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
* XImage, flat, NON-depth-buffered, PF_DITHER triangle.
*/
static void flat_DITHER_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaImage *img = xmesa->xm_buffer->backimage;
* XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle.
*/
static void flat_HPCR_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
* XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle.
*/
static void flat_LOOKUP8_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
-/* $Id: attrib.c,v 1.34 2000/11/16 21:05:34 keithw Exp $ */
+/* $Id: attrib.c,v 1.35 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLuint u;
/* Take care of texture object reference counters */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- ctx->Texture.Unit[u].CurrentD[1]->RefCount++;
- ctx->Texture.Unit[u].CurrentD[2]->RefCount++;
- ctx->Texture.Unit[u].CurrentD[3]->RefCount++;
+ ctx->Texture.Unit[u].Current1D->RefCount++;
+ ctx->Texture.Unit[u].Current2D->RefCount++;
+ ctx->Texture.Unit[u].Current3D->RefCount++;
+ ctx->Texture.Unit[u].CurrentCubeMap->RefCount++;
}
attr = MALLOC_STRUCT( gl_texture_attrib );
MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) );
/* copy state of the currently bound texture objects */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- copy_texobj_state(&attr->Unit[u].Saved1D, attr->Unit[u].CurrentD[1]);
- copy_texobj_state(&attr->Unit[u].Saved2D, attr->Unit[u].CurrentD[2]);
- copy_texobj_state(&attr->Unit[u].Saved3D, attr->Unit[u].CurrentD[3]);
+ copy_texobj_state(&attr->Unit[u].Saved1D, attr->Unit[u].Current1D);
+ copy_texobj_state(&attr->Unit[u].Saved2D, attr->Unit[u].Current2D);
+ copy_texobj_state(&attr->Unit[u].Saved3D, attr->Unit[u].Current3D);
copy_texobj_state(&attr->Unit[u].SavedCubeMap, attr->Unit[u].CurrentCubeMap);
}
newnode = new_attrib_node( GL_TEXTURE_BIT );
{
GLuint u;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- ctx->Texture.Unit[u].CurrentD[1]->RefCount--;
- ctx->Texture.Unit[u].CurrentD[2]->RefCount--;
- ctx->Texture.Unit[u].CurrentD[3]->RefCount--;
+ ctx->Texture.Unit[u].Current1D->RefCount--;
+ ctx->Texture.Unit[u].Current2D->RefCount--;
+ ctx->Texture.Unit[u].Current3D->RefCount--;
+ ctx->Texture.Unit[u].CurrentCubeMap->RefCount--;
}
MEMCPY( &ctx->Texture, attr->data,
sizeof(struct gl_texture_attrib) );
ctx->NewState |= _NEW_TEXTURE;
/* restore state of the currently bound texture objects */
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
- copy_texobj_state( ctx->Texture.Unit[u].CurrentD[1],
+ copy_texobj_state( ctx->Texture.Unit[u].Current1D,
&(ctx->Texture.Unit[u].Saved1D) );
- copy_texobj_state( ctx->Texture.Unit[u].CurrentD[2],
+ copy_texobj_state( ctx->Texture.Unit[u].Current2D,
&(ctx->Texture.Unit[u].Saved2D) );
- copy_texobj_state( ctx->Texture.Unit[u].CurrentD[3],
+ copy_texobj_state( ctx->Texture.Unit[u].Current3D,
&(ctx->Texture.Unit[u].Saved3D) );
copy_texobj_state( ctx->Texture.Unit[u].CurrentCubeMap,
&(ctx->Texture.Unit[u].SavedCubeMap) );
- gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentD[1] );
- gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentD[2] );
- gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentD[3] );
- gl_put_texobj_on_dirty_list( ctx, ctx->Texture.Unit[u].CurrentCubeMap );
-
+ ctx->Texture.Unit[u].Current1D->Complete = GL_FALSE;
+ ctx->Texture.Unit[u].Current2D->Complete = GL_FALSE;
+ ctx->Texture.Unit[u].Current3D->Complete = GL_FALSE;
+ ctx->Texture.Unit[u].CurrentCubeMap->Complete = GL_FALSE;
}
}
break;
-/* $Id: colortab.c,v 1.26 2000/11/10 17:45:15 brianp Exp $ */
+/* $Id: colortab.c,v 1.27 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
switch (target) {
case GL_TEXTURE_1D:
- texObj = texUnit->CurrentD[1];
+ texObj = texUnit->Current1D;
table = &texObj->Palette;
break;
case GL_TEXTURE_2D:
- texObj = texUnit->CurrentD[2];
+ texObj = texUnit->Current2D;
table = &texObj->Palette;
break;
case GL_TEXTURE_3D:
- texObj = texUnit->CurrentD[3];
+ texObj = texUnit->Current3D;
table = &texObj->Palette;
break;
case GL_PROXY_TEXTURE_1D:
switch (target) {
case GL_TEXTURE_1D:
- texObj = texUnit->CurrentD[1];
+ texObj = texUnit->Current1D;
table = &texObj->Palette;
break;
case GL_TEXTURE_2D:
- texObj = texUnit->CurrentD[2];
+ texObj = texUnit->Current2D;
table = &texObj->Palette;
break;
case GL_TEXTURE_3D:
- texObj = texUnit->CurrentD[3];
+ texObj = texUnit->Current3D;
table = &texObj->Palette;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
switch (target) {
case GL_TEXTURE_1D:
- table = &texUnit->CurrentD[1]->Palette;
+ table = &texUnit->Current1D->Palette;
break;
case GL_TEXTURE_2D:
- table = &texUnit->CurrentD[2]->Palette;
+ table = &texUnit->Current2D->Palette;
break;
case GL_TEXTURE_3D:
- table = &texUnit->CurrentD[3]->Palette;
+ table = &texUnit->Current3D->Palette;
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
table = &ctx->Texture.Palette;
switch (target) {
case GL_TEXTURE_1D:
- table = &texUnit->CurrentD[1]->Palette;
+ table = &texUnit->Current1D->Palette;
break;
case GL_TEXTURE_2D:
- table = &texUnit->CurrentD[2]->Palette;
+ table = &texUnit->Current2D->Palette;
break;
case GL_TEXTURE_3D:
- table = &texUnit->CurrentD[3]->Palette;
+ table = &texUnit->Current3D->Palette;
break;
case GL_PROXY_TEXTURE_1D:
table = &ctx->Texture.Proxy1D->Palette;
switch (target) {
case GL_TEXTURE_1D:
- table = &texUnit->CurrentD[1]->Palette;
+ table = &texUnit->Current1D->Palette;
break;
case GL_TEXTURE_2D:
- table = &texUnit->CurrentD[2]->Palette;
+ table = &texUnit->Current2D->Palette;
break;
case GL_TEXTURE_3D:
- table = &texUnit->CurrentD[3]->Palette;
+ table = &texUnit->Current3D->Palette;
break;
case GL_PROXY_TEXTURE_1D:
table = &ctx->Texture.Proxy1D->Palette;
-/* $Id: context.c,v 1.106 2000/11/16 21:05:34 keithw Exp $ */
+/* $Id: context.c,v 1.107 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
static struct gl_shared_state *
alloc_shared_state( void )
{
- GLuint d;
struct gl_shared_state *ss;
GLboolean outOfMemory;
/* Default Texture objects */
outOfMemory = GL_FALSE;
- for (d = 1 ; d <= 3 ; d++) {
- ss->DefaultD[d] = gl_alloc_texture_object(ss, 0, d);
- if (!ss->DefaultD[d]) {
- outOfMemory = GL_TRUE;
- break;
- }
- ss->DefaultD[d]->RefCount++; /* don't free if not in use */
+
+ ss->Default1D = _mesa_alloc_texture_object(ss, 0, 1);
+ if (!ss->Default1D) {
+ outOfMemory = GL_TRUE;
+ }
+ else {
+ ss->Default1D->RefCount++;
}
- ss->DefaultCubeMap = gl_alloc_texture_object(ss, 0, 6);
+ ss->Default2D = _mesa_alloc_texture_object(ss, 0, 2);
+ if (!ss->Default2D) {
+ outOfMemory = GL_TRUE;
+ }
+ else {
+ ss->Default2D->RefCount++;
+ }
+
+ ss->Default3D = _mesa_alloc_texture_object(ss, 0, 3);
+ if (!ss->Default3D) {
+ outOfMemory = GL_TRUE;
+ }
+ else {
+ ss->Default1D->RefCount++;
+ }
+
+ ss->DefaultCubeMap = _mesa_alloc_texture_object(ss, 0, 6);
if (!ss->DefaultCubeMap) {
outOfMemory = GL_TRUE;
}
_mesa_DeleteHashTable(ss->DisplayList);
if (ss->TexObjects)
_mesa_DeleteHashTable(ss->TexObjects);
- if (ss->DefaultD[1])
- gl_free_texture_object(ss, ss->DefaultD[1]);
- if (ss->DefaultD[2])
- gl_free_texture_object(ss, ss->DefaultD[2]);
- if (ss->DefaultD[3])
- gl_free_texture_object(ss, ss->DefaultD[3]);
+ if (ss->Default1D)
+ _mesa_free_texture_object(ss, ss->Default1D);
+ if (ss->Default2D)
+ _mesa_free_texture_object(ss, ss->Default2D);
+ if (ss->Default3D)
+ _mesa_free_texture_object(ss, ss->Default3D);
if (ss->DefaultCubeMap)
- gl_free_texture_object(ss, ss->DefaultCubeMap);
+ _mesa_free_texture_object(ss, ss->DefaultCubeMap);
FREE(ss);
return NULL;
}
if (ctx->Driver.DeleteTexture)
(*ctx->Driver.DeleteTexture)( ctx, ss->TexObjectList );
/* this function removes from linked list too! */
- gl_free_texture_object(ss, ss->TexObjectList);
+ _mesa_free_texture_object(ss, ss->TexObjectList);
}
_mesa_DeleteHashTable(ss->TexObjects);
ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 );
- texUnit->CurrentD[1] = ctx->Shared->DefaultD[1];
- texUnit->CurrentD[2] = ctx->Shared->DefaultD[2];
- texUnit->CurrentD[3] = ctx->Shared->DefaultD[3];
+ texUnit->Current1D = ctx->Shared->Default1D;
+ texUnit->Current2D = ctx->Shared->Default2D;
+ texUnit->Current3D = ctx->Shared->Default3D;
texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
}
GLboolean out_of_memory;
GLint i;
- ctx->Texture.Proxy1D = gl_alloc_texture_object(NULL, 0, 1);
+ ctx->Texture.Proxy1D = _mesa_alloc_texture_object(NULL, 0, 1);
if (!ctx->Texture.Proxy1D) {
return GL_FALSE;
}
- ctx->Texture.Proxy2D = gl_alloc_texture_object(NULL, 0, 2);
+ ctx->Texture.Proxy2D = _mesa_alloc_texture_object(NULL, 0, 2);
if (!ctx->Texture.Proxy2D) {
- gl_free_texture_object(NULL, ctx->Texture.Proxy1D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
return GL_FALSE;
}
- ctx->Texture.Proxy3D = gl_alloc_texture_object(NULL, 0, 3);
+ ctx->Texture.Proxy3D = _mesa_alloc_texture_object(NULL, 0, 3);
if (!ctx->Texture.Proxy3D) {
- gl_free_texture_object(NULL, ctx->Texture.Proxy1D);
- gl_free_texture_object(NULL, ctx->Texture.Proxy2D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
+ return GL_FALSE;
+ }
+
+ ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, 6);
+ if (!ctx->Texture.ProxyCubeMap) {
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy3D);
return GL_FALSE;
}
_mesa_free_texture_image(ctx->Texture.Proxy3D->Image[i]);
}
}
- gl_free_texture_object(NULL, ctx->Texture.Proxy1D);
- gl_free_texture_object(NULL, ctx->Texture.Proxy2D);
- gl_free_texture_object(NULL, ctx->Texture.Proxy3D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D);
+ _mesa_free_texture_object(NULL, ctx->Texture.Proxy3D);
return GL_FALSE;
}
else {
FREE( ctx->_ShineTabList );
/* Free proxy texture objects */
- gl_free_texture_object( NULL, ctx->Texture.Proxy1D );
- gl_free_texture_object( NULL, ctx->Texture.Proxy2D );
- gl_free_texture_object( NULL, ctx->Texture.Proxy3D );
+ _mesa_free_texture_object( NULL, ctx->Texture.Proxy1D );
+ _mesa_free_texture_object( NULL, ctx->Texture.Proxy2D );
+ _mesa_free_texture_object( NULL, ctx->Texture.Proxy3D );
/* Free evaluator data */
if (ctx->EvalMap.Map1Vertex3.Points)
-/* $Id: get.c,v 1.41 2000/11/16 21:05:35 keithw Exp $ */
+/* $Id: get.c,v 1.42 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
*params = _mesa_IsEnabled(GL_TEXTURE_3D);
break;
case GL_TEXTURE_BINDING_1D:
- *params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name);
+ *params = INT_TO_BOOL(textureUnit->Current1D->Name);
break;
case GL_TEXTURE_BINDING_2D:
- *params = INT_TO_BOOL(textureUnit->CurrentD[2]->Name);
+ *params = INT_TO_BOOL(textureUnit->Current2D->Name);
break;
case GL_TEXTURE_BINDING_3D:
- *params = INT_TO_BOOL(textureUnit->CurrentD[3]->Name);
+ *params = INT_TO_BOOL(textureUnit->Current3D->Name);
break;
case GL_TEXTURE_ENV_COLOR:
{
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
break;
case GL_TEXTURE_BINDING_1D:
- *params = (GLdouble) textureUnit->CurrentD[1]->Name;
+ *params = (GLdouble) textureUnit->Current1D->Name;
break;
case GL_TEXTURE_BINDING_2D:
- *params = (GLdouble) textureUnit->CurrentD[2]->Name;
+ *params = (GLdouble) textureUnit->Current2D->Name;
break;
case GL_TEXTURE_BINDING_3D:
- *params = (GLdouble) textureUnit->CurrentD[3]->Name;
+ *params = (GLdouble) textureUnit->Current3D->Name;
break;
case GL_TEXTURE_ENV_COLOR:
params[0] = (GLdouble) textureUnit->EnvColor[0];
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1.0 : 0.0;
break;
case GL_TEXTURE_BINDING_1D:
- *params = (GLfloat) textureUnit->CurrentD[1]->Name;
+ *params = (GLfloat) textureUnit->Current1D->Name;
break;
case GL_TEXTURE_BINDING_2D:
- *params = (GLfloat) textureUnit->CurrentD[2]->Name;
+ *params = (GLfloat) textureUnit->Current2D->Name;
break;
case GL_TEXTURE_BINDING_3D:
- *params = (GLfloat) textureUnit->CurrentD[2]->Name;
+ *params = (GLfloat) textureUnit->Current2D->Name;
break;
case GL_TEXTURE_ENV_COLOR:
params[0] = textureUnit->EnvColor[0];
*params = _mesa_IsEnabled(GL_TEXTURE_3D) ? 1 : 0;
break;
case GL_TEXTURE_BINDING_1D:
- *params = textureUnit->CurrentD[1]->Name;
+ *params = textureUnit->Current1D->Name;
break;
case GL_TEXTURE_BINDING_2D:
- *params = textureUnit->CurrentD[2]->Name;
+ *params = textureUnit->Current2D->Name;
break;
case GL_TEXTURE_BINDING_3D:
- *params = textureUnit->CurrentD[3]->Name;
+ *params = textureUnit->Current3D->Name;
break;
case GL_TEXTURE_ENV_COLOR:
params[0] = FLOAT_TO_INT( textureUnit->EnvColor[0] );
-/* $Id: state.c,v 1.45 2000/11/16 21:05:35 keithw Exp $ */
+/* $Id: state.c,v 1.46 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void
-_mesa_update_polygon( GLcontext *ctx )
+update_polygon( GLcontext *ctx )
{
ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK;
}
static void
-_mesa_calculate_model_project_matrix( GLcontext *ctx )
+calculate_model_project_matrix( GLcontext *ctx )
{
if (!ctx->_NeedEyeCoords) {
_math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
}
static void
-_mesa_update_modelview_scale( GLcontext *ctx )
+update_modelview_scale( GLcontext *ctx )
{
ctx->_ModelViewInvScale = 1.0F;
if (ctx->ModelView.flags & (MAT_FLAG_UNIFORM_SCALE |
/* Bring uptodate any state that relies on _NeedEyeCoords.
*/
static void
-_mesa_update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
+update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
{
/* Check if the truth-value interpretations of the bitfields have
* changed:
*/
- if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0))
- {
+ if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) {
/* Recalculate all state that depends on _NeedEyeCoords.
*/
- _mesa_update_modelview_scale(ctx);
- _mesa_calculate_model_project_matrix(ctx);
+ update_modelview_scale(ctx);
+ calculate_model_project_matrix(ctx);
gl_compute_light_positions( ctx );
if (ctx->Driver.LightingSpaceChange)
ctx->Driver.LightingSpaceChange( ctx );
}
- else
- {
+ else {
GLuint new_state = ctx->NewState;
/* Recalculate that same state if and only if it has been
* invalidated by other statechanges.
*/
if (new_state & _NEW_MODELVIEW)
- _mesa_update_modelview_scale(ctx);
+ update_modelview_scale(ctx);
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
- _mesa_calculate_model_project_matrix(ctx);
+ calculate_model_project_matrix(ctx);
if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
gl_compute_light_positions( ctx );
static void
-_mesa_update_drawbuffer( GLcontext *ctx )
+update_drawbuffer( GLcontext *ctx )
{
ctx->DrawBuffer->_Xmin = 0;
ctx->DrawBuffer->_Ymin = 0;
* uptodate across changes to the Transform attributes.
*/
static void
-_mesa_update_projection( GLcontext *ctx )
+update_projection( GLcontext *ctx )
{
_math_matrix_analyze( &ctx->ProjectionMatrix );
+/*
+ * Return a bitmask of IMAGE_*_BIT flags which to indicate which
+ * pixel transfer operations are enabled.
+ */
+static void
+update_image_transfer_state(GLcontext *ctx)
+{
+ GLuint mask = 0;
+
+ if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F ||
+ ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
+ ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F ||
+ ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
+ mask |= IMAGE_SCALE_BIAS_BIT;
+
+ if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
+ mask |= IMAGE_SHIFT_OFFSET_BIT;
+
+ if (ctx->Pixel.MapColorFlag)
+ mask |= IMAGE_MAP_COLOR_BIT;
+
+ if (ctx->Pixel.ColorTableEnabled)
+ mask |= IMAGE_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.Convolution1DEnabled ||
+ ctx->Pixel.Convolution2DEnabled ||
+ ctx->Pixel.Separable2DEnabled)
+ mask |= IMAGE_CONVOLUTION_BIT;
+
+ if (ctx->Pixel.PostConvolutionColorTableEnabled)
+ mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
+
+ if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
+ ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
+ ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
+ ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
+ mask |= IMAGE_COLOR_MATRIX_BIT;
+
+ if (ctx->Pixel.PostColorMatrixColorTableEnabled)
+ mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
+
+ if (ctx->Pixel.HistogramEnabled)
+ mask |= IMAGE_HISTOGRAM_BIT;
+
+ if (ctx->Pixel.MinMaxEnabled)
+ mask |= IMAGE_MIN_MAX_BIT;
+
+ ctx->_ImageTransferState = mask;
+}
+
/*
* If ctx->NewState is non-zero then this function MUST be called before
_math_matrix_analyze( &ctx->ModelView );
if (new_state & _NEW_PROJECTION)
- _mesa_update_projection( ctx );
+ update_projection( ctx );
if (new_state & _NEW_TEXTURE_MATRIX)
_mesa_update_texture_matrices( ctx );
/* References ColorMatrix.type (derived above).
*/
if (new_state & (_NEW_PIXEL|_NEW_COLOR_MATRIX))
- _mesa_update_image_transfer_state(ctx);
+ update_image_transfer_state(ctx);
/* Contributes to NeedEyeCoords, NeedNormals.
*/
if (new_state & _NEW_TEXTURE)
- _mesa_update_textures( ctx );
+ _mesa_update_texture_state( ctx );
if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR))
- _mesa_update_drawbuffer( ctx );
+ update_drawbuffer( ctx );
if (new_state & _NEW_POLYGON)
- _mesa_update_polygon( ctx );
+ update_polygon( ctx );
/* Contributes to NeedEyeCoords, NeedNormals.
*/
_TNL_NEW_NORMAL_TRANSFORM |
_NEW_LIGHT |
_TNL_NEW_NEED_EYE_COORDS))
- _mesa_update_tnl_spaces( ctx, oldneedeyecoords );
+ update_tnl_spaces( ctx, oldneedeyecoords );
/*
* Here the driver sets up all the ctx->Driver function pointers
ctx->Driver.UpdateState(ctx);
ctx->NewState = 0;
}
-
-
-
-
-/*
- * Return a bitmask of IMAGE_*_BIT flags which to indicate which
- * pixel transfer operations are enabled.
- */
-void
-_mesa_update_image_transfer_state(GLcontext *ctx)
-{
- GLuint mask = 0;
-
- if (ctx->Pixel.RedScale != 1.0F || ctx->Pixel.RedBias != 0.0F ||
- ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
- ctx->Pixel.BlueScale != 1.0F || ctx->Pixel.BlueBias != 0.0F ||
- ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
- mask |= IMAGE_SCALE_BIAS_BIT;
-
- if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
- mask |= IMAGE_SHIFT_OFFSET_BIT;
-
- if (ctx->Pixel.MapColorFlag)
- mask |= IMAGE_MAP_COLOR_BIT;
-
- if (ctx->Pixel.ColorTableEnabled)
- mask |= IMAGE_COLOR_TABLE_BIT;
-
- if (ctx->Pixel.Convolution1DEnabled ||
- ctx->Pixel.Convolution2DEnabled ||
- ctx->Pixel.Separable2DEnabled)
- mask |= IMAGE_CONVOLUTION_BIT;
-
- if (ctx->Pixel.PostConvolutionColorTableEnabled)
- mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
-
- if (ctx->ColorMatrix.type != MATRIX_IDENTITY ||
- ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[0] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[1] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[2] != 0.0F ||
- ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
- ctx->Pixel.PostColorMatrixBias[3] != 0.0F)
- mask |= IMAGE_COLOR_MATRIX_BIT;
-
- if (ctx->Pixel.PostColorMatrixColorTableEnabled)
- mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
-
- if (ctx->Pixel.HistogramEnabled)
- mask |= IMAGE_HISTOGRAM_BIT;
-
- if (ctx->Pixel.MinMaxEnabled)
- mask |= IMAGE_MIN_MAX_BIT;
-
- ctx->_ImageTransferState = mask;
-}
-/* $Id: state.h,v 1.3 2000/08/21 14:22:24 brianp Exp $ */
+/* $Id: state.h,v 1.4 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
extern void
gl_print_enable_flags( const char *msg, GLuint flags );
-extern void
-_mesa_update_image_transfer_state(GLcontext *ctx);
-
#endif
-/* $Id: teximage.c,v 1.62 2000/11/13 15:25:26 brianp Exp $ */
+/* $Id: teximage.c,v 1.63 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
switch (target) {
case GL_TEXTURE_1D:
- return texUnit->CurrentD[1];
+ return texUnit->Current1D;
case GL_PROXY_TEXTURE_1D:
return ctx->Texture.Proxy1D;
case GL_TEXTURE_2D:
- return texUnit->CurrentD[2];
+ return texUnit->Current2D;
case GL_PROXY_TEXTURE_2D:
return ctx->Texture.Proxy2D;
case GL_TEXTURE_3D:
- return texUnit->CurrentD[3];
+ return texUnit->Current3D;
case GL_PROXY_TEXTURE_3D:
return ctx->Texture.Proxy3D;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
ASSERT(texUnit);
switch (target) {
case GL_TEXTURE_1D:
- return texUnit->CurrentD[1]->Image[level];
+ return texUnit->Current1D->Image[level];
case GL_PROXY_TEXTURE_1D:
return ctx->Texture.Proxy1D->Image[level];
case GL_TEXTURE_2D:
- return texUnit->CurrentD[2]->Image[level];
+ return texUnit->Current2D->Image[level];
case GL_PROXY_TEXTURE_2D:
return ctx->Texture.Proxy2D->Image[level];
case GL_TEXTURE_3D:
- return texUnit->CurrentD[3]->Image[level];
+ return texUnit->Current3D->Image[level];
case GL_PROXY_TEXTURE_3D:
return ctx->Texture.Proxy3D->Image[level];
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
return GL_TRUE;
}
- destTex = texUnit->CurrentD[2]->Image[level];
+ destTex = texUnit->Current2D->Image[level];
if (!destTex) {
gl_error(ctx, GL_INVALID_OPERATION, "glTexSubImage2D");
return GL_TRUE;
return GL_TRUE;
}
- teximage = texUnit->CurrentD[dimensions]->Image[level];
+ teximage = _mesa_select_tex_image(ctx, texUnit, target, level);
if (!teximage) {
char message[100];
sprintf(message, "glCopyTexSubImage%dD(undefined texture)", dimensions);
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[1];
+ texObj = texUnit->Current1D;
texImage = texObj->Image[level];
if (!texImage) {
}
/* state update */
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
else if (target == GL_PROXY_TEXTURE_1D) {
}
/* state update */
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
else if (target == GL_PROXY_TEXTURE_2D) {
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[3];
+ texObj = texUnit->Current3D;
texImage = texObj->Image[level];
if (!texImage) {
}
/* state update */
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
else if (target == GL_PROXY_TEXTURE_3D) {
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[1];
+ texObj = texUnit->Current1D;
texImage = texObj->Image[level];
assert(texImage);
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[3];
+ texObj = texUnit->Current3D;
texImage = texObj->Image[level];
assert(texImage);
GLchan *image;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- teximage = texUnit->CurrentD[1]->Image[level];
+ teximage = texUnit->Current1D->Image[level];
assert(teximage);
/* get image from frame buffer */
GLchan *image;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- teximage = texUnit->CurrentD[2]->Image[level];
+ teximage = texUnit->Current2D->Image[level];
assert(teximage);
/* get image from frame buffer */
GLchan *image;
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- teximage = texUnit->CurrentD[3]->Image[level];
+ teximage = texUnit->Current3D->Image[level];
assert(teximage);
/* get image from frame buffer */
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[1];
+ texObj = texUnit->Current1D;
texImage = texObj->Image[level];
if (!texImage) {
}
/* state update */
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
else if (target == GL_PROXY_TEXTURE_1D) {
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[2];
+ texObj = texUnit->Current2D;
texImage = texObj->Image[level];
if (!texImage) {
}
/* state update */
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
else if (target == GL_PROXY_TEXTURE_2D) {
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[3];
+ texObj = texUnit->Current3D;
texImage = texObj->Image[level];
if (!texImage) {
}
/* state update */
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
}
else if (target == GL_PROXY_TEXTURE_3D) {
switch (target) {
case GL_TEXTURE_1D:
- texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[1];
+ texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D;
texImage = texObj->Image[level];
break;
case GL_TEXTURE_2D:
- texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[2];
+ texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D;
texImage = texObj->Image[level];
break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
texImage = texObj->NegZ[level];
break;
case GL_TEXTURE_3D:
- texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[3];
+ texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D;
texImage = texObj->Image[level];
break;
default:
-/* $Id: texobj.c,v 1.33 2000/11/11 20:23:47 brianp Exp $ */
+/* $Id: texobj.c,v 1.34 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Input: shared - the shared GL state structure to contain the texture object
* name - integer name for the texture object
* dimensions - either 1, 2, 3 or 6 (cube map)
+ * zero is ok for the sake of GenTextures()
* Return: pointer to new texture object
*/
struct gl_texture_object *
-gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
- GLuint dimensions)
+_mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
+ GLuint dimensions)
{
struct gl_texture_object *obj;
* Input: shared - the shared GL state to which the object belongs
* t - the texture object to delete
*/
-void gl_free_texture_object( struct gl_shared_state *shared,
- struct gl_texture_object *t )
+void _mesa_free_texture_object( struct gl_shared_state *shared,
+ struct gl_texture_object *t )
{
struct gl_texture_object *tprev, *tcurr;
assert(t);
- /* Remove t from dirty list so we don't touch free'd memory later.
- * Test for shared since Proxy texture aren't in global linked list.
- */
- if (shared)
- gl_remove_texobj_from_dirty_list( shared, t );
-
/* unlink t from the linked list */
if (shared) {
_glthread_LOCK_MUTEX(shared->Mutex);
_mesa_free_colortable_data(&t->Palette);
- /* free texture images */
+ /* free the texture images */
{
GLuint i;
for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
}
}
}
+
/* free this object */
FREE( t );
}
+
+/*
+ * Report why a texture object is incomplete. (for debug only)
+ */
#if 0
static void
incomplete(const struct gl_texture_object *t, const char *why)
/*
- * Examine a texture object to determine if it is complete or not.
+ * Examine a texture object to determine if it is complete.
* The t->Complete flag will be set to GL_TRUE or GL_FALSE accordingly.
*/
void
t->Complete = GL_TRUE; /* be optimistic */
- /* Always need level zero image */
+ /* Always need the base level image */
if (!t->Image[baseLevel]) {
incomplete(t, "Image[baseLevel] == NULL");
t->Complete = GL_FALSE;
if (t->Dimensions == 6) {
- /* make sure all six level 0 images are same size */
+ /* make sure that all six cube map level 0 images are the same size */
const GLint w = t->Image[baseLevel]->Width2;
const GLint h = t->Image[baseLevel]->Height2;
if (!t->NegX[baseLevel] ||
for (i=0;i<n;i++) {
GLuint name = first + i;
GLuint dims = 0;
- (void) gl_alloc_texture_object(ctx->Shared, name, dims);
+ (void) _mesa_alloc_texture_object(ctx->Shared, name, dims);
}
_glthread_UNLOCK_MUTEX(GenTexturesLock);
return;
for (i=0;i<n;i++) {
- struct gl_texture_object *t;
- if (texName[i]>0) {
- t = (struct gl_texture_object *)
+ if (texName[i] > 0) {
+ struct gl_texture_object *delObj = (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, texName[i]);
- if (t) {
+ if (delObj) {
/* First check if this texture is currently bound.
* If so, unbind it and decrement the reference count.
*/
GLuint u;
for (u = 0; u < MAX_TEXTURE_UNITS; u++) {
struct gl_texture_unit *unit = &ctx->Texture.Unit[u];
- GLuint d;
- for (d = 1 ; d <= 3 ; d++) {
- if (unit->CurrentD[d] == t) {
- unit->CurrentD[d] = ctx->Shared->DefaultD[d];
- ctx->Shared->DefaultD[d]->RefCount++;
- t->RefCount--;
- ASSERT( t->RefCount >= 0 );
- ctx->NewState |= _NEW_TEXTURE;
- }
- }
+ if (delObj == unit->Current1D) {
+ unit->Current1D = ctx->Shared->Default1D;
+ ctx->Shared->Default1D->RefCount++;
+ }
+ else if (delObj == unit->Current2D) {
+ unit->Current2D = ctx->Shared->Default2D;
+ ctx->Shared->Default2D->RefCount++;
+ }
+ else if (delObj == unit->Current3D) {
+ unit->Current3D = ctx->Shared->Default3D;
+ ctx->Shared->Default3D->RefCount++;
+ }
+ else if (delObj == unit->CurrentCubeMap) {
+ unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap;
+ ctx->Shared->DefaultCubeMap->RefCount++;
+ }
}
+ ctx->NewState |= _NEW_TEXTURE;
/* Decrement reference count and delete if zero */
- t->RefCount--;
- ASSERT( t->RefCount >= 0 );
- if (t->RefCount == 0) {
+ delObj->RefCount--;
+ ASSERT( delObj->RefCount >= 0 );
+ if (delObj->RefCount == 0) {
if (ctx->Driver.DeleteTexture)
- (*ctx->Driver.DeleteTexture)( ctx, t );
- gl_free_texture_object(ctx->Shared, t);
+ (*ctx->Driver.DeleteTexture)( ctx, delObj );
+ _mesa_free_texture_object(ctx->Shared, delObj);
}
}
}
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *oldTexObj;
struct gl_texture_object *newTexObj;
- GLuint dim;
+ GLuint targetDim;
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glBindTexture %s %d\n",
switch (target) {
case GL_TEXTURE_1D:
- dim = 1;
- oldTexObj = texUnit->CurrentD[1];
+ targetDim = 1;
+ oldTexObj = texUnit->Current1D;
break;
case GL_TEXTURE_2D:
- dim = 2;
- oldTexObj = texUnit->CurrentD[2];
+ targetDim = 2;
+ oldTexObj = texUnit->Current2D;
break;
case GL_TEXTURE_3D:
- dim = 3;
- oldTexObj = texUnit->CurrentD[3];
+ targetDim = 3;
+ oldTexObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
if (ctx->Extensions.ARB_texture_cube_map) {
- dim = 6;
+ targetDim = 6;
oldTexObj = texUnit->CurrentCubeMap;
break;
}
}
if (oldTexObj->Name == texName)
- return;
+ return; /* rebinding the same texture- no change */
+ /*
+ * Get pointer to new texture object (newTexObj)
+ */
if (texName == 0) {
- if (target == GL_TEXTURE_CUBE_MAP_ARB)
- newTexObj = ctx->Shared->DefaultCubeMap;
- else
- newTexObj = ctx->Shared->DefaultD[dim];
+ /* newTexObj = a default texture object */
+ switch (target) {
+ case GL_TEXTURE_1D:
+ newTexObj = ctx->Shared->Default1D;
+ break;
+ case GL_TEXTURE_2D:
+ newTexObj = ctx->Shared->Default2D;
+ break;
+ case GL_TEXTURE_3D:
+ newTexObj = ctx->Shared->Default3D;
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ newTexObj = ctx->Shared->DefaultCubeMap;
+ break;
+ default:
+ ; /* Bad targets are caught above */
+ }
}
else {
- struct _mesa_HashTable *hash = ctx->Shared->TexObjects;
+ /* non-default texture object */
+ const struct _mesa_HashTable *hash = ctx->Shared->TexObjects;
newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName);
-
- if (!newTexObj)
- newTexObj = gl_alloc_texture_object(ctx->Shared, texName, dim);
-
- if (newTexObj->Dimensions != dim) {
- if (newTexObj->Dimensions) {
+ if (newTexObj) {
+ /* error checking */
+ if (newTexObj->Dimensions > 0 && newTexObj->Dimensions != targetDim) {
/* the named texture object's dimensions don't match the target */
- gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
- return;
- }
- newTexObj->Dimensions = dim;
+ gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
+ return;
+ }
}
+ else {
+ /* if this is a new texture id, allocate a texture object now */
+ newTexObj = _mesa_alloc_texture_object(ctx->Shared, texName, targetDim);
+ if (!newTexObj) {
+ gl_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
+ return;
+ }
+ }
+ newTexObj->Dimensions = targetDim;
}
newTexObj->RefCount++;
+ /* do the actual binding */
switch (target) {
case GL_TEXTURE_1D:
- texUnit->CurrentD[1] = newTexObj;
+ texUnit->Current1D = newTexObj;
break;
case GL_TEXTURE_2D:
- texUnit->CurrentD[2] = newTexObj;
+ texUnit->Current2D = newTexObj;
break;
case GL_TEXTURE_3D:
- texUnit->CurrentD[3] = newTexObj;
+ texUnit->Current3D = newTexObj;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
texUnit->CurrentCubeMap = newTexObj;
gl_problem(ctx, "bad target in BindTexture");
}
- /* If we've changed the CurrentD[123] texture object then update the
- * ctx->Texture.Current pointer to point to the new texture object.
- */
- texUnit->_Current = texUnit->CurrentD[texUnit->_CurrentDimension];
-
ctx->NewState |= _NEW_TEXTURE;
/* Pass BindTexture call to device driver */
if (ctx->Driver.DeleteTexture) {
(*ctx->Driver.DeleteTexture)( ctx, oldTexObj );
}
- gl_free_texture_object(ctx->Shared, oldTexObj);
+ _mesa_free_texture_object(ctx->Shared, oldTexObj);
}
}
}
-/* $Id: texobj.h,v 1.3 2000/05/23 17:14:49 brianp Exp $ */
+/* $Id: texobj.h,v 1.4 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.5
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*/
extern struct gl_texture_object *
-gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
- GLuint dimensions );
+_mesa_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
+ GLuint dimensions );
-extern void gl_free_texture_object( struct gl_shared_state *shared,
- struct gl_texture_object *t );
+extern void
+_mesa_free_texture_object( struct gl_shared_state *shared,
+ struct gl_texture_object *t );
extern void
-/* $Id: texstate.c,v 1.22 2000/11/16 21:05:35 keithw Exp $ */
+/* $Id: texstate.c,v 1.23 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
switch (target) {
case GL_TEXTURE_1D:
- texObj = texUnit->CurrentD[1];
+ texObj = texUnit->Current1D;
break;
case GL_TEXTURE_2D:
- texObj = texUnit->CurrentD[2];
+ texObj = texUnit->Current2D;
break;
case GL_TEXTURE_3D_EXT:
- texObj = texUnit->CurrentD[3];
+ texObj = texUnit->Current3D;
break;
case GL_TEXTURE_CUBE_MAP_ARB:
if (ctx->Extensions.ARB_texture_cube_map) {
}
ctx->NewState |= _NEW_TEXTURE;
- gl_put_texobj_on_dirty_list( ctx, texObj );
+ texObj->Complete = GL_FALSE;
if (ctx->Driver.TexParameter) {
(*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params );
gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)");
}
}
-
-
-
-/*
- * Put the given texture object into the list of dirty texture objects.
- * When a texture object is dirty we have to reexamine it for completeness
- * and perhaps choose a different texture sampling function.
- */
-void gl_put_texobj_on_dirty_list( GLcontext *ctx, struct gl_texture_object *t )
-{
- ASSERT(ctx);
- ASSERT(t);
- /* Only insert if not already in the dirty list.
- * The Dirty flag is only set iff the texture object is in the dirty list.
- */
- if (!t->Dirty) {
- ASSERT(t->NextDirty == NULL);
- t->Dirty = GL_TRUE;
- t->NextDirty = ctx->Shared->DirtyTexObjList;
- ctx->Shared->DirtyTexObjList = t;
- }
-#ifdef DEBUG
- else {
- /* make sure t is in the list */
- struct gl_texture_object *obj = ctx->Shared->DirtyTexObjList;
- while (obj) {
- if (obj == t) {
- return;
- }
- obj = obj->NextDirty;
- }
- gl_problem(ctx, "Error in gl_put_texobj_on_dirty_list");
- }
-#endif
-}
-
-
-/*
- * Remove a texture object from the dirty texture list.
- */
-void gl_remove_texobj_from_dirty_list( struct gl_shared_state *shared,
- struct gl_texture_object *tObj )
-{
- struct gl_texture_object *t, *prev = NULL;
- ASSERT(shared);
- ASSERT(tObj);
- for (t = shared->DirtyTexObjList; t; t = t->NextDirty) {
- if (t == tObj) {
- if (prev) {
- prev->NextDirty = t->NextDirty;
- }
- else {
- shared->DirtyTexObjList = t->NextDirty;
- }
- return;
- }
- prev = t;
- }
-}
-
-
-/* $Id: texstate.h,v 1.3 2000/11/16 21:05:35 keithw Exp $ */
+/* $Id: texstate.h,v 1.4 2000/11/19 23:10:25 brianp Exp $ */
/*
* Mesa 3-D graphics library
_mesa_ClientActiveTextureARB( GLenum target );
-
-/*** Internal functions ***/
-
-extern void
-gl_put_texobj_on_dirty_list( GLcontext *ctx, struct gl_texture_object *t );
-
-#ifdef VMS
-#define gl_remove_texobj_from_dirty_list gl_remove_texobj_from_dirty_lis
-#endif
-extern void
-gl_remove_texobj_from_dirty_list( struct gl_shared_state *shared,
- struct gl_texture_object *tObj );
-
-
-
#endif
-/* $Id: s_aalinetemp.h,v 1.1 2000/11/05 23:15:16 brianp Exp $ */
+/* $Id: s_aalinetemp.h,v 1.2 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Line setup
*/
static void
-NAME(line)(GLcontext *ctx, SWvertex *v0, SWvertex *v1)
+NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct pixel_buffer *pb = SWRAST_CONTEXT(ctx)->PB;
-/* $Id: s_aatriangle.c,v 1.3 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_aatriangle.c,v 1.4 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
static void
rgba_aa_tri(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2)
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
#define DO_Z
#define DO_RGBA
static void
index_aa_tri(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2)
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
#define DO_Z
#define DO_INDEX
static void
tex_aa_tri(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2)
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
#define DO_Z
#define DO_RGBA
static void
spec_tex_aa_tri(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2)
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
#define DO_Z
#define DO_RGBA
static void
multitex_aa_tri(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2)
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
#define DO_Z
#define DO_RGBA
static void
spec_multitex_aa_tri(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2)
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
#define DO_Z
#define DO_RGBA
-/* $Id: s_aatritemp.h,v 1.3 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_aatritemp.h,v 1.4 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
const GLfloat *p0 = v0->win;
const GLfloat *p1 = v1->win;
const GLfloat *p2 = v2->win;
- SWvertex *vMin, *vMid, *vMax;
+ const SWvertex *vMin, *vMid, *vMax;
GLint iyMin, iyMax;
GLfloat yMin, yMax;
GLboolean ltor;
-/* $Id: s_context.c,v 1.4 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_context.c,v 1.5 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
static void
_swrast_validate_quad( GLcontext *ctx,
- SWvertex *v0, SWvertex *v1, SWvertex *v2, SWvertex *v3 )
+ const SWvertex *v0, const SWvertex *v1,
+ const SWvertex *v2, const SWvertex *v3 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
static void
_swrast_validate_triangle( GLcontext *ctx,
- SWvertex *v0, SWvertex *v1, SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
}
static void
-_swrast_validate_line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 )
+_swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
}
static void
-_swrast_validate_point( GLcontext *ctx, SWvertex *v0 )
+_swrast_validate_point( GLcontext *ctx, const SWvertex *v0 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
*/
void
_swrast_Quad( GLcontext *ctx,
- SWvertex *v0, SWvertex *v1, SWvertex *v2, SWvertex *v3 )
+ const SWvertex *v0, const SWvertex *v1,
+ const SWvertex *v2, const SWvertex *v3 )
{
SWRAST_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3 );
}
void
-_swrast_Triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 )
+_swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2 )
{
SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
}
void
-_swrast_Line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 )
+_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{
SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 );
}
void
-_swrast_Point( GLcontext *ctx, SWvertex *v0 )
+_swrast_Point( GLcontext *ctx, const SWvertex *v0 )
{
SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
}
GLchan src[][4], CONST GLchan dst[][4] );
#endif
-typedef void (*swrast_tri_func)( GLcontext *ctx,
- SWvertex *, SWvertex *, SWvertex *);
-typedef void (*swrast_line_func)( GLcontext *ctx, SWvertex *, SWvertex *);
-typedef void (*swrast_point_func)( GLcontext *ctx, SWvertex *);
+typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *);
+
+typedef void (*swrast_line_func)( GLcontext *ctx,
+ const SWvertex *, const SWvertex *);
+
+typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
+ const SWvertex *, const SWvertex *);
+
+typedef void (*swrast_quad_func)( GLcontext *ctx,
+ const SWvertex *, const SWvertex *,
+ const SWvertex *, const SWvertex *);
+
+
/*
* Bitmasks to indicate which rasterization options are enabled (RasterMask)
/* Function pointers for dispatch behind public entrypoints.
*/
void (*InvalidateState)( GLcontext *ctx, GLuint new_state );
- void (*Point)( GLcontext *ctx, SWvertex *v );
- void (*Line)( GLcontext *ctx, SWvertex *v0, SWvertex *v1 );
- void (*Triangle)( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 );
- void (*Quad)( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2,
- SWvertex *v3);
+
+ swrast_point_func Point;
+ swrast_line_func Line;
+ swrast_tri_func Triangle;
+ swrast_quad_func Quad;
/* Internal hooks, kept uptodate by the same mechanism as above.
*/
-/* $Id: s_feedback.c,v 1.2 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_feedback.c,v 1.3 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
-static void feedback_vertex( GLcontext *ctx, SWvertex *v, SWvertex *pv )
+static void feedback_vertex( GLcontext *ctx,
+ const SWvertex *v, const SWvertex *pv )
{
GLfloat win[4];
GLfloat color[4];
/*
* Put triangle in feedback buffer.
*/
-void gl_feedback_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1,
- SWvertex *v2)
+void gl_feedback_triangle( GLcontext *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
if (gl_cull_triangle( ctx, v0, v1, v2 )) {
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN );
}
-void gl_feedback_line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 )
+void gl_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{
GLenum token = GL_LINE_TOKEN;
SWcontext *swrast = SWRAST_CONTEXT(ctx);
}
-void gl_feedback_point( GLcontext *ctx, SWvertex *v )
+void gl_feedback_point( GLcontext *ctx, const SWvertex *v )
{
FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN );
feedback_vertex( ctx, v, v );
}
-void gl_select_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1,
- SWvertex *v2)
+void gl_select_triangle( GLcontext *ctx,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2)
{
if (gl_cull_triangle( ctx, v0, v1, v2 )) {
const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF;
}
-void gl_select_line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 )
+void gl_select_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
{
const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF;
gl_update_hitflag( ctx, v0->win[2] * zs );
}
-void gl_select_point( GLcontext *ctx, SWvertex *v )
+void gl_select_point( GLcontext *ctx, const SWvertex *v )
{
const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF;
gl_update_hitflag( ctx, v->win[2] * zs );
-/* $Id: s_feedback.h,v 1.1 2000/11/05 18:24:40 keithw Exp $ */
+/* $Id: s_feedback.h,v 1.2 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "swrast.h"
-extern void gl_feedback_point( GLcontext *ctx, SWvertex *v );
-extern void gl_feedback_line( GLcontext *ctx, SWvertex *v1, SWvertex *v2 );
-extern void gl_feedback_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1,
- SWvertex *v2 );
+extern void gl_feedback_point( GLcontext *ctx, const SWvertex *v );
-extern void gl_select_point( GLcontext *ctx, SWvertex *v );
-extern void gl_select_line( GLcontext *ctx, SWvertex *v1, SWvertex *v2 );
-extern void gl_select_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1,
- SWvertex *v2 );
+extern void gl_feedback_line( GLcontext *ctx,
+ const SWvertex *v1, const SWvertex *v2 );
+
+extern void gl_feedback_triangle( GLcontext *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2 );
+
+extern void gl_select_point( GLcontext *ctx, const SWvertex *v );
+
+extern void gl_select_line( GLcontext *ctx,
+ const SWvertex *v1, const SWvertex *v2 );
+
+extern void gl_select_triangle( GLcontext *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2 );
#endif
-/* $Id: s_lines.c,v 1.6 2000/11/16 21:05:41 keithw Exp $ */
+/* $Id: s_lines.c,v 1.7 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* Flat, color index line */
static void flat_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
/* Flat, color index line with Z interpolation/testing */
static void flat_ci_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
PB_SET_INDEX( PB, vert0->index );
/* Flat-shaded, RGBA line */
static void flat_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
const GLchan *color = vert0->color;
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
/* Flat-shaded, RGBA line with Z interpolation/testing */
static void flat_rgba_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
const GLchan *color = vert0->color;
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
/* Smooth shaded, color index line */
static void smooth_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
/* Smooth shaded, color index line with Z interpolation/testing */
static void smooth_ci_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
/* Smooth-shaded, RGBA line */
static void smooth_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
/* Smooth-shaded, RGBA line with Z interpolation/testing */
static void smooth_rgba_z_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
/* Smooth shaded, color index, any width, maybe stippled */
static void general_smooth_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
/* Flat shaded, color index, any width, maybe stippled */
static void general_flat_ci_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count;
static void general_smooth_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
static void general_flat_rgba_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
const GLchan *color = vert0->color;
/* Flat-shaded, textured, any width, maybe stippled */
static void flat_textured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count;
/* Smooth-shaded, textured, any width, maybe stippled */
static void smooth_textured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
* color interpolation.
*/
static void smooth_multitextured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
* color interpolation.
*/
static void flat_multitextured_line( GLcontext *ctx,
- SWvertex *vert0,
- SWvertex *vert1 )
+ const SWvertex *vert0,
+ const SWvertex *vert1 )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint count = PB->count;
+/* $Id: s_lines.h,v 1.2 2000/11/19 23:10:26 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * 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.
+ */
+
+
#ifndef S_LINES_H
#define S_LINES_H
-/* $Id: s_linetemp.h,v 1.2 2000/11/05 18:24:40 keithw Exp $ */
+/* $Id: s_linetemp.h,v 1.3 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
*/
-/*void line( GLcontext *ctx, SWvertex *vert0, SWvertex *vert1 )*/
+/*void line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )*/
{
GLint x0 = (GLint) vert0->win[0];
GLint x1 = (GLint) vert1->win[0];
-/* $Id: s_points.c,v 1.6 2000/11/16 21:05:41 keithw Exp $ */
+/* $Id: s_points.c,v 1.7 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.4
+ * Version: 3.5
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* CI points with size == 1.0
*/
static void
-size1_ci_point( GLcontext *ctx, SWvertex *vert )
+size1_ci_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint *pbx = PB->x, *pby = PB->y;
* RGBA points with size == 1.0
*/
static void
-size1_rgba_point( GLcontext *ctx, SWvertex *vert )
+size1_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
* General CI points.
*/
static void
-general_ci_point( GLcontext *ctx, SWvertex *vert )
+general_ci_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
const GLint isize = (GLint) (ctx->Point._Size + 0.5F);
* General RGBA points.
*/
static void
-general_rgba_point( GLcontext *ctx, SWvertex *vert )
+general_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
GLint isize = (GLint) (ctx->Point._Size + 0.5F);
* Textured RGBA points.
*/
static void
-textured_rgba_point( GLcontext *ctx, SWvertex *vert )
+textured_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
* Multitextured RGBA points.
*/
static void
-multitextured_rgba_point( GLcontext *ctx, SWvertex *vert )
+multitextured_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
* Antialiased points with or without texture mapping.
*/
static void
-antialiased_rgba_point( GLcontext *ctx, SWvertex *vert )
+antialiased_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct pixel_buffer *PB = swrast->PB;
* Distance Attenuated General CI points.
*/
static void
-dist_atten_general_ci_point( GLcontext *ctx, SWvertex *vert )
+dist_atten_general_ci_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
const GLfloat psize = ctx->Point._Size;
* Distance Attenuated General RGBA points.
*/
static void
-dist_atten_general_rgba_point( GLcontext *ctx, SWvertex *vert )
+dist_atten_general_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
const GLfloat psize = ctx->Point._Size;
* Distance Attenuated Textured RGBA points.
*/
static void
-dist_atten_textured_rgba_point( GLcontext *ctx, SWvertex *vert )
+dist_atten_textured_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct pixel_buffer *PB = swrast->PB;
* Distance Attenuated Antialiased points with or without texture mapping.
*/
static void
-dist_atten_antialiased_rgba_point( GLcontext *ctx, SWvertex *vert )
+dist_atten_antialiased_rgba_point( GLcontext *ctx, const SWvertex *vert )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct pixel_buffer *PB = swrast->PB;
+/* $Id: s_points.h,v 1.2 2000/11/19 23:10:26 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.5
+ *
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * 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.
+ */
+
+
#ifndef S_POINTS_H
#define S_POINTS_H
-/* $Id: s_triangle.c,v 1.4 2000/11/14 17:40:16 brianp Exp $ */
+/* $Id: s_triangle.c,v 1.5 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "s_triangle.h"
GLboolean gl_cull_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
GLfloat ex = v1->win[0] - v0->win[0];
GLfloat ey = v1->win[1] - v0->win[1];
* Render a flat-shaded color index triangle.
*/
static void flat_ci_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define SETUP_CODE
* Render a smooth-shaded color index triangle.
*/
static void smooth_ci_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define INTERP_INDEX 1
* Render a flat-shaded RGBA triangle.
*/
static void flat_rgba_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
* Render a smooth-shaded RGBA triangle.
*/
static void smooth_rgba_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
* No fog.
*/
static void simple_textured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_INT_TEX 1
#define S_SCALE twidth
#define T_SCALE theight
#define SETUP_CODE \
- struct gl_texture_object *obj = ctx->Texture.Unit[0].CurrentD[2]; \
+ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
GLfloat theight = (GLfloat) obj->Image[b]->Height; \
* No fog.
*/
static void simple_z_textured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define S_SCALE twidth
#define T_SCALE theight
#define SETUP_CODE \
- struct gl_texture_object *obj = ctx->Texture.Unit[0].CurrentD[2]; \
+ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
GLfloat theight = (GLfloat) obj->Image[b]->Height; \
* Render an RGB/RGBA textured triangle without perspective correction.
*/
static void affine_textured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define T_SCALE theight
#define SETUP_CODE \
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- struct gl_texture_object *obj = unit->CurrentD[2]; \
+ struct gl_texture_object *obj = unit->Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
GLfloat theight = (GLfloat) obj->Image[b]->Height; \
* Send all questions and bug reports to him.
*/
static void near_persp_textured_triangle(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
/* The BIAS value is used to shift negative values into positive values.
* Without this, negative texture values don't GL_REPEAT correctly at just
#define INTERP_TEX 1
#define SETUP_CODE \
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- struct gl_texture_object *obj = unit->CurrentD[2]; \
+ struct gl_texture_object *obj = unit->Current2D; \
const GLint b = obj->BaseLevel; \
const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[b]->Height; \
* Send all questions and bug reports to him.
*/
static void lin_persp_textured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_TEX 1
#define SETUP_CODE \
struct gl_texture_unit *unit = ctx->Texture.Unit+0; \
- struct gl_texture_object *obj = unit->CurrentD[2]; \
+ struct gl_texture_object *obj = unit->Current2D; \
const GLint b = obj->BaseLevel; \
const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
const GLfloat theight = (GLfloat) obj->Image[b]->Height; \
* R is already used for red.
*/
static void general_textured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
* R is already used for red.
*/
static void general_textured_spec_triangle1( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2,
GLdepth zspan[MAX_WIDTH],
GLfixed fogspan[MAX_WIDTH],
GLchan rgba[MAX_WIDTH][4],
* mipmaps, lambda is also used to select the texture level of detail.
*/
static void lambda_textured_triangle1( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2,
GLfloat s[MAX_WIDTH],
GLfloat t[MAX_WIDTH],
GLfloat u[MAX_WIDTH] )
* mipmaps, lambda is also used to select the texture level of detail.
*/
static void lambda_textured_spec_triangle1( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2,
GLfloat s[MAX_WIDTH],
GLfloat t[MAX_WIDTH],
GLfloat u[MAX_WIDTH] )
*/
static void
lambda_multitextured_triangle1( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2,
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2,
GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH],
GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH],
GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH])
*/
static void general_textured_spec_triangle(GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
GLdepth zspan[MAX_WIDTH];
GLfixed fogspan[MAX_WIDTH];
}
static void lambda_textured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
GLfloat s[MAX_WIDTH], t[MAX_WIDTH], u[MAX_WIDTH];
lambda_textured_triangle1(ctx,v0,v1,v2,s,t,u);
}
static void lambda_textured_spec_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
GLfloat s[MAX_WIDTH];
GLfloat t[MAX_WIDTH];
static void lambda_multitextured_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH];
static void occlusion_zless_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2 )
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2 )
{
if (ctx->OcclusionResult) {
return;
if (ctx->Texture._ReallyEnabled) {
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
GLint format, filter;
- const struct gl_texture_object *current2Dtex = ctx->Texture.Unit[0].CurrentD[2];
+ const struct gl_texture_object *current2Dtex = ctx->Texture.Unit[0].Current2D;
const struct gl_texture_image *image;
/* First see if we can used an optimized 2-D texture function */
if (ctx->Texture._ReallyEnabled==TEXTURE0_2D
-/* $Id: s_triangle.h,v 1.2 2000/11/05 18:24:41 keithw Exp $ */
+/* $Id: s_triangle.h,v 1.3 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLboolean gl_cull_triangle( GLcontext *ctx,
- SWvertex *v0,
- SWvertex *v1,
- SWvertex *v2);
+ const SWvertex *v0,
+ const SWvertex *v1,
+ const SWvertex *v2);
void
-/* $Id: s_tritemp.h,v 1.3 2000/11/13 20:02:57 keithw Exp $ */
+/* $Id: s_tritemp.h,v 1.4 2000/11/19 23:10:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*void triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 )*/
{
typedef struct {
- SWvertex *v0, *v1; /* Y(v0) < Y(v1) */
+ const SWvertex *v0, *v1; /* Y(v0) < Y(v1) */
GLfloat dx; /* X(v1) - X(v0) */
GLfloat dy; /* Y(v1) - Y(v0) */
GLfixed fdxdy; /* dx/dy in fixed-point */
#endif
EdgeT eMaj, eTop, eBot;
GLfloat oneOverArea;
- SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
+ const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
float bf = SWRAST_CONTEXT(ctx)->_backface_sign;
/* find the order of the 3 vertices along the Y axis */
}
if (setupLeft && eLeft->lines > 0) {
- SWvertex *vLower;
+ const SWvertex *vLower;
GLfixed fsx = eLeft->fsx;
fx = FixedCeil(fsx);
fError = fx - fsx - FIXED_ONE;
* current state.
*/
extern void
-_swrast_Point( GLcontext *ctx, SWvertex *v );
+_swrast_Point( GLcontext *ctx, const SWvertex *v );
extern void
-_swrast_Line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 );
+_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 );
extern void
-_swrast_Triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 );
+_swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
+ const SWvertex *v1, const SWvertex *v2 );
extern void
-_swrast_Quad( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2,
- SWvertex *v3);
+_swrast_Quad( GLcontext *ctx,
+ const SWvertex *v0, const SWvertex *v1,
+ const SWvertex *v2, const SWvertex *v3);
extern void
_swrast_flush( GLcontext *ctx );