diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2000-11-19 23:10:25 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2000-11-19 23:10:25 +0000 |
commit | a852378a6289d154364dde440f89a39bbfc33e2d (patch) | |
tree | dbaf6946d80e517a2f0b349a11d1736cde1b83e1 /src/mesa | |
parent | b12d8e3b0ddf6dc56dc866530b66230bdc5d73db (diff) |
Replaced Texture.CurrentD[] with separate Texture.Current1/2/3D vars.
Completely removed the dirty texture object list. Set texObj->Complete
to GL_FALSE to indicate dirty.
Made point/line/triangle/quad SWvertex parameters const.
Minor code clean-ups.
Diffstat (limited to 'src/mesa')
32 files changed, 751 insertions, 701 deletions
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 9f978b3f46..85d2271b72 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -462,7 +462,7 @@ void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state) 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; diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 2cc6add1d2..a5af36ca41 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -456,7 +456,7 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) 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) { @@ -747,8 +747,8 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx) 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; diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 9f7280564c..3f9a3626b1 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $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 @@ -1239,7 +1239,7 @@ static void read_index_pixels( const GLcontext *ctx, * 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; @@ -1261,7 +1261,7 @@ static void flat_rgba_line( GLcontext *ctx, * 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; @@ -1290,7 +1290,7 @@ static void flat_rgba_z_line( GLcontext *ctx, * 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; @@ -1325,7 +1325,7 @@ static void flat_blend_rgba_line( GLcontext *ctx, * 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; @@ -1363,7 +1363,7 @@ static void flat_blend_rgba_z_line( GLcontext *ctx, * 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; @@ -1509,7 +1509,9 @@ osmesa_choose_line_function( GLcontext *ctx ) * 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; @@ -1551,7 +1553,9 @@ static void smooth_rgba_z_triangle( GLcontext *ctx, * 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 diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 0513d045ab..328ba65cee 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -1,4 +1,4 @@ -/* $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 @@ -54,7 +54,7 @@ /* * 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; @@ -117,7 +117,7 @@ void xmesa_choose_point( GLcontext *ctx ) * 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; @@ -138,7 +138,7 @@ static void flat_TRUECOLOR_line( GLcontext *ctx, * 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; @@ -158,7 +158,7 @@ static void flat_8A8B8G8R_line( GLcontext *ctx, * 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; @@ -178,7 +178,7 @@ static void flat_8R8G8B_line( GLcontext *ctx, * 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; @@ -201,7 +201,7 @@ static void flat_8R8G8B24_line( GLcontext *ctx, * 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; @@ -221,7 +221,7 @@ static void flat_5R6G5B_line( GLcontext *ctx, * 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; @@ -241,7 +241,7 @@ static void flat_DITHER_5R6G5B_line( GLcontext *ctx, * 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; @@ -263,7 +263,7 @@ static void flat_DITHER8_line( GLcontext *ctx, * 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; @@ -285,7 +285,7 @@ static void flat_LOOKUP8_line( GLcontext *ctx, * 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; @@ -307,7 +307,7 @@ static void flat_HPCR_line( GLcontext *ctx, * 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; @@ -333,7 +333,7 @@ static void flat_TRUECOLOR_z_line( GLcontext *ctx, * 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; @@ -359,7 +359,7 @@ static void flat_8A8B8G8R_z_line( GLcontext *ctx, * 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; @@ -385,7 +385,7 @@ static void flat_8R8G8B_z_line( GLcontext *ctx, * 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; @@ -412,7 +412,7 @@ static void flat_8R8G8B24_z_line( GLcontext *ctx, * 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; @@ -437,7 +437,7 @@ static void flat_5R6G5B_z_line( GLcontext *ctx, * 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; @@ -461,7 +461,7 @@ static void flat_DITHER_5R6G5B_z_line( GLcontext *ctx, * 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; @@ -488,7 +488,7 @@ static void flat_DITHER8_z_line( GLcontext *ctx, * 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; @@ -516,7 +516,7 @@ static void flat_LOOKUP8_z_line( GLcontext *ctx, * 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; diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 0badaede8c..c2b15034ad 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1,4 +1,4 @@ -/* $Id: xm_tri.c,v 1.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 @@ -56,9 +56,9 @@ * 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; @@ -91,9 +91,9 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx, * 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 @@ -125,9 +125,9 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx, * 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 @@ -159,9 +159,9 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx, * 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 @@ -195,9 +195,9 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx, * 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; @@ -229,9 +229,9 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx, * 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 @@ -263,9 +263,9 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, * 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 @@ -297,9 +297,9 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx, * 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 @@ -332,9 +332,9 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx, * 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; @@ -369,9 +369,9 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx, * 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 @@ -405,9 +405,9 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, * 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 @@ -439,9 +439,9 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx, * 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; @@ -472,9 +472,9 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, * 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 @@ -506,9 +506,9 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, * 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 @@ -540,9 +540,9 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, * 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; @@ -575,9 +575,9 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, * 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; @@ -607,9 +607,9 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, * 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 @@ -641,9 +641,9 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, * 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; @@ -674,9 +674,9 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, * 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 @@ -709,9 +709,9 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, * 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; @@ -743,9 +743,9 @@ static void flat_DITHER_z_triangle( GLcontext *ctx, * 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 @@ -778,9 +778,9 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, * 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 @@ -816,9 +816,9 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, * 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; @@ -841,9 +841,9 @@ static void smooth_TRUECOLOR_triangle( GLcontext *ctx, * 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 @@ -868,9 +868,9 @@ static void smooth_8A8B8G8R_triangle( GLcontext *ctx, * 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 @@ -895,9 +895,9 @@ static void smooth_8R8G8B_triangle( GLcontext *ctx, * 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 @@ -924,9 +924,9 @@ static void smooth_8R8G8B24_triangle( GLcontext *ctx, * 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; @@ -950,9 +950,9 @@ static void smooth_TRUEDITHER_triangle( GLcontext *ctx, * 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 @@ -977,9 +977,9 @@ static void smooth_5R6G5B_triangle( GLcontext *ctx, * 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 @@ -1004,9 +1004,9 @@ static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx, * 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 @@ -1032,9 +1032,9 @@ static void smooth_DITHER8_triangle( GLcontext *ctx, * 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; @@ -1059,9 +1059,9 @@ static void smooth_DITHER_triangle( GLcontext *ctx, * 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; @@ -1089,9 +1089,9 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx, * 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; @@ -1117,9 +1117,9 @@ static void smooth_HPCR_triangle( GLcontext *ctx, * 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; @@ -1142,9 +1142,9 @@ static void flat_TRUECOLOR_triangle( GLcontext *ctx, * 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) @@ -1169,9 +1169,9 @@ static void flat_8A8B8G8R_triangle( GLcontext *ctx, * 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) @@ -1196,9 +1196,9 @@ static void flat_8R8G8B_triangle( GLcontext *ctx, * 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; @@ -1223,9 +1223,9 @@ static void flat_8R8G8B24_triangle( GLcontext *ctx, * 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; @@ -1248,9 +1248,9 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx, * 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) @@ -1275,9 +1275,9 @@ static void flat_5R6G5B_triangle( GLcontext *ctx, * 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; @@ -1301,9 +1301,9 @@ static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx, * 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) @@ -1329,9 +1329,9 @@ static void flat_DITHER8_triangle( GLcontext *ctx, * 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; @@ -1355,9 +1355,9 @@ static void flat_DITHER_triangle( GLcontext *ctx, * 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) @@ -1383,9 +1383,9 @@ static void flat_HPCR_triangle( GLcontext *ctx, * 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) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index b6c5174def..155af4cbbc 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $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 @@ -350,17 +350,18 @@ _mesa_PushAttrib(GLbitfield mask) 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 ); @@ -811,29 +812,29 @@ _mesa_PopAttrib(void) { 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; diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 64ba6670d7..12c8dbbde7 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $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 @@ -217,15 +217,15 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, 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: @@ -458,15 +458,15 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, 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: @@ -687,13 +687,13 @@ _mesa_GetColorTable( GLenum target, GLenum format, 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; @@ -950,13 +950,13 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) 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; @@ -1081,13 +1081,13 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) 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; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c0e75e9298..83c64cc321 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $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 @@ -479,7 +479,6 @@ one_time_init( void ) static struct gl_shared_state * alloc_shared_state( void ) { - GLuint d; struct gl_shared_state *ss; GLboolean outOfMemory; @@ -494,16 +493,32 @@ alloc_shared_state( void ) /* 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; } @@ -517,14 +532,14 @@ alloc_shared_state( void ) _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; } @@ -558,7 +573,7 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) 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); @@ -668,9 +683,9 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) 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; } @@ -1352,21 +1367,29 @@ alloc_proxy_textures( GLcontext *ctx ) 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; } @@ -1393,9 +1416,9 @@ alloc_proxy_textures( GLcontext *ctx ) _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 { @@ -1609,9 +1632,9 @@ _mesa_free_context_data( GLcontext *ctx ) 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) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 980269d854..b373f70107 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $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 @@ -811,13 +811,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *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: { @@ -2009,13 +2009,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *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]; @@ -3210,13 +3210,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *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]; @@ -4383,13 +4383,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *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] ); diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index d1dde8c88e..2439655143 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $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 @@ -692,7 +692,7 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) static void -_mesa_update_polygon( GLcontext *ctx ) +update_polygon( GLcontext *ctx ) { ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK; @@ -726,7 +726,7 @@ _mesa_update_polygon( GLcontext *ctx ) } static void -_mesa_calculate_model_project_matrix( GLcontext *ctx ) +calculate_model_project_matrix( GLcontext *ctx ) { if (!ctx->_NeedEyeCoords) { _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, @@ -738,7 +738,7 @@ _mesa_calculate_model_project_matrix( GLcontext *ctx ) } 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 | @@ -759,34 +759,32 @@ _mesa_update_modelview_scale( GLcontext *ctx ) /* 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 ); @@ -795,7 +793,7 @@ _mesa_update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords ) static void -_mesa_update_drawbuffer( GLcontext *ctx ) +update_drawbuffer( GLcontext *ctx ) { ctx->DrawBuffer->_Xmin = 0; ctx->DrawBuffer->_Ymin = 0; @@ -824,7 +822,7 @@ _mesa_update_drawbuffer( GLcontext *ctx ) * uptodate across changes to the Transform attributes. */ static void -_mesa_update_projection( GLcontext *ctx ) +update_projection( GLcontext *ctx ) { _math_matrix_analyze( &ctx->ProjectionMatrix ); @@ -845,6 +843,61 @@ _mesa_update_projection( GLcontext *ctx ) +/* + * 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 @@ -871,7 +924,7 @@ void gl_update_state( GLcontext *ctx ) _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 ); @@ -882,18 +935,18 @@ void gl_update_state( GLcontext *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. */ @@ -924,7 +977,7 @@ void gl_update_state( GLcontext *ctx ) _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 @@ -935,61 +988,3 @@ void gl_update_state( GLcontext *ctx ) 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; -} diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 640c21dc7c..cd1a78f226 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -1,4 +1,4 @@ -/* $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 @@ -46,8 +46,5 @@ gl_print_state( const char *msg, GLuint state ); extern void gl_print_enable_flags( const char *msg, GLuint flags ); -extern void -_mesa_update_image_transfer_state(GLcontext *ctx); - #endif diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 0eab5dfa50..6ef5554b6f 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $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 @@ -544,15 +544,15 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, { 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: @@ -584,15 +584,15 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, 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: @@ -1247,7 +1247,7 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, 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; @@ -1442,7 +1442,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, 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); @@ -1639,7 +1639,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[1]; + texObj = texUnit->Current1D; texImage = texObj->Image[level]; if (!texImage) { @@ -1700,7 +1700,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, } /* 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) { @@ -1839,7 +1839,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } /* 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) { @@ -1911,7 +1911,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[3]; + texObj = texUnit->Current3D; texImage = texObj->Image[level]; if (!texImage) { @@ -1973,7 +1973,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, } /* 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) { @@ -2403,7 +2403,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[1]; + texObj = texUnit->Current1D; texImage = texObj->Image[level]; assert(texImage); @@ -2544,7 +2544,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[3]; + texObj = texUnit->Current3D; texImage = texObj->Image[level]; assert(texImage); @@ -2741,7 +2741,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, 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 */ @@ -2788,7 +2788,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, 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 */ @@ -2835,7 +2835,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, 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 */ @@ -2893,7 +2893,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[1]; + texObj = texUnit->Current1D; texImage = texObj->Image[level]; if (!texImage) { @@ -2954,7 +2954,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } /* 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) { @@ -3023,7 +3023,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[2]; + texObj = texUnit->Current2D; texImage = texObj->Image[level]; if (!texImage) { @@ -3089,7 +3089,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, } /* 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) { @@ -3155,7 +3155,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = texUnit->CurrentD[3]; + texObj = texUnit->Current3D; texImage = texObj->Image[level]; if (!texImage) { @@ -3218,7 +3218,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } /* 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) { @@ -3377,11 +3377,11 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) 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: @@ -3409,7 +3409,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) 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: diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 18f942fa8e..f0372237ca 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $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 @@ -50,11 +50,12 @@ * 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; @@ -103,19 +104,13 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, * 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); @@ -144,7 +139,7 @@ void gl_free_texture_object( struct gl_shared_state *shared, _mesa_free_colortable_data(&t->Palette); - /* free texture images */ + /* free the texture images */ { GLuint i; for (i=0;i<MAX_TEXTURE_LEVELS;i++) { @@ -153,10 +148,15 @@ void gl_free_texture_object( struct gl_shared_state *shared, } } } + /* 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) @@ -169,7 +169,7 @@ 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 @@ -180,7 +180,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, 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; @@ -207,7 +207,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, 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] || @@ -444,7 +444,7 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) 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); @@ -467,36 +467,42 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) 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); } } } @@ -516,7 +522,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) 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", @@ -526,20 +532,20 @@ _mesa_BindTexture( GLenum target, GLuint texName ) 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; } @@ -550,42 +556,65 @@ _mesa_BindTexture( GLenum target, GLuint texName ) } 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; @@ -594,11 +623,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) 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 */ @@ -612,7 +636,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) if (ctx->Driver.DeleteTexture) { (*ctx->Driver.DeleteTexture)( ctx, oldTexObj ); } - gl_free_texture_object(ctx->Shared, oldTexObj); + _mesa_free_texture_object(ctx->Shared, oldTexObj); } } } diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 52bf621be8..c6948398b1 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -1,10 +1,10 @@ -/* $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"), @@ -38,12 +38,13 @@ */ 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 diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 0e33e683de..a99325672c 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $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 @@ -616,13 +616,13 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) 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) { @@ -737,7 +737,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } 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 ); @@ -1613,64 +1613,3 @@ _mesa_ClientActiveTextureARB( GLenum target ) 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; - } -} - - diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 9954a0a126..d9dd060abd 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -1,4 +1,4 @@ -/* $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 @@ -127,20 +127,5 @@ extern void _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 diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index ee414aae59..71da5f0c5c 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aalinetemp.h,v 1.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 @@ -148,7 +148,7 @@ NAME(plot)(GLcontext *ctx, const struct LineInfo *line, * 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; diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index a261f5dc82..43cf9013d3 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -1,4 +1,4 @@ -/* $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 @@ -299,9 +299,9 @@ compute_coveragei(const GLfloat v0[3], const GLfloat v1[3], 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 @@ -311,9 +311,9 @@ rgba_aa_tri(GLcontext *ctx, 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 @@ -342,9 +342,9 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], 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 @@ -355,9 +355,9 @@ tex_aa_tri(GLcontext *ctx, 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 @@ -369,9 +369,9 @@ spec_tex_aa_tri(GLcontext *ctx, 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 @@ -381,9 +381,9 @@ multitex_aa_tri(GLcontext *ctx, 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 diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index ccece6cab8..247c7ac85a 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aatritemp.h,v 1.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 @@ -47,7 +47,7 @@ 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; diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index f1dfef3cc4..85f9ef0891 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -1,4 +1,4 @@ -/* $Id: s_context.c,v 1.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 @@ -190,7 +190,8 @@ _swrast_update_hint( GLcontext *ctx ) */ 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); @@ -202,7 +203,9 @@ _swrast_validate_quad( GLcontext *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); @@ -213,7 +216,7 @@ _swrast_validate_triangle( GLcontext *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); @@ -224,7 +227,7 @@ _swrast_validate_line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 ) } static void -_swrast_validate_point( GLcontext *ctx, SWvertex *v0 ) +_swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); @@ -344,25 +347,27 @@ _swrast_validate_derived( GLcontext *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 ); } diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index 10e162b705..7def2e9c5c 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -55,10 +55,19 @@ typedef void (*blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[], 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) @@ -138,11 +147,11 @@ typedef struct /* 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. */ diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index e14c6a8e21..a635569153 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -1,4 +1,4 @@ -/* $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 @@ -46,7 +46,8 @@ -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]; @@ -85,8 +86,10 @@ static void feedback_vertex( GLcontext *ctx, SWvertex *v, SWvertex *pv ) /* * 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 ); @@ -105,7 +108,7 @@ void gl_feedback_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, } -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); @@ -127,15 +130,17 @@ void gl_feedback_line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 ) } -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; @@ -147,7 +152,7 @@ void gl_select_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, } -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 ); @@ -155,7 +160,7 @@ void gl_select_line( GLcontext *ctx, SWvertex *v0, SWvertex *v1 ) } -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 ); diff --git a/src/mesa/swrast/s_feedback.h b/src/mesa/swrast/s_feedback.h index f32dcc86f9..4cd700b908 100644 --- a/src/mesa/swrast/s_feedback.h +++ b/src/mesa/swrast/s_feedback.h @@ -1,4 +1,4 @@ -/* $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 @@ -33,15 +33,21 @@ #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 diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index a16fe9ecf8..e4cc074b6d 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -1,4 +1,4 @@ -/* $Id: s_lines.c,v 1.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 @@ -54,8 +54,8 @@ /* 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; @@ -73,8 +73,8 @@ static void flat_ci_line( GLcontext *ctx, /* 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 ); @@ -92,8 +92,8 @@ static void flat_ci_z_line( GLcontext *ctx, /* 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; @@ -111,8 +111,8 @@ static void flat_rgba_line( GLcontext *ctx, /* 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; @@ -131,8 +131,8 @@ static void flat_rgba_z_line( GLcontext *ctx, /* 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; @@ -161,8 +161,8 @@ static void smooth_ci_line( GLcontext *ctx, /* 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; @@ -194,8 +194,8 @@ static void smooth_ci_z_line( GLcontext *ctx, /* 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; @@ -228,8 +228,8 @@ static void smooth_rgba_line( GLcontext *ctx, /* 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; @@ -276,8 +276,8 @@ static void smooth_rgba_z_line( GLcontext *ctx, /* 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; @@ -356,8 +356,8 @@ static void general_smooth_ci_line( GLcontext *ctx, /* 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; @@ -428,8 +428,8 @@ static void general_flat_ci_line( GLcontext *ctx, 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; @@ -530,8 +530,8 @@ static void general_smooth_rgba_line( GLcontext *ctx, 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; @@ -574,8 +574,8 @@ static void general_flat_rgba_line( GLcontext *ctx, /* 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; @@ -640,8 +640,8 @@ static void flat_textured_line( GLcontext *ctx, /* 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; @@ -719,8 +719,8 @@ static void smooth_textured_line( GLcontext *ctx, * 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; @@ -816,8 +816,8 @@ static void smooth_multitextured_line( GLcontext *ctx, * 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; diff --git a/src/mesa/swrast/s_lines.h b/src/mesa/swrast/s_lines.h index efbb59d2d6..63edb3452a 100644 --- a/src/mesa/swrast/s_lines.h +++ b/src/mesa/swrast/s_lines.h @@ -1,3 +1,30 @@ +/* $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 diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index 1605f880a1..2035c96dda 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -1,4 +1,4 @@ -/* $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 @@ -73,7 +73,7 @@ */ -/*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]; diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index e6f193f555..7a7d66daca 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -1,8 +1,8 @@ -/* $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. * @@ -59,7 +59,7 @@ * 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; @@ -84,7 +84,7 @@ size1_ci_point( GLcontext *ctx, SWvertex *vert ) * 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; @@ -107,7 +107,7 @@ size1_rgba_point( GLcontext *ctx, SWvertex *vert ) * 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); @@ -152,7 +152,7 @@ general_ci_point( GLcontext *ctx, SWvertex *vert ) * 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); @@ -203,7 +203,7 @@ general_rgba_point( GLcontext *ctx, SWvertex *vert ) * 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; @@ -270,7 +270,7 @@ textured_rgba_point( GLcontext *ctx, SWvertex *vert ) * 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; @@ -359,7 +359,7 @@ multitextured_rgba_point( GLcontext *ctx, SWvertex *vert ) * 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; @@ -501,7 +501,7 @@ static GLfloat attenuation_distance(const GLcontext *ctx, const GLfloat *pos) * 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; @@ -553,7 +553,7 @@ dist_atten_general_ci_point( GLcontext *ctx, SWvertex *vert ) * 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; @@ -612,7 +612,7 @@ dist_atten_general_rgba_point( GLcontext *ctx, SWvertex *vert ) * 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; @@ -705,7 +705,7 @@ dist_atten_textured_rgba_point( GLcontext *ctx, SWvertex *vert ) * 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; diff --git a/src/mesa/swrast/s_points.h b/src/mesa/swrast/s_points.h index 1c1af1a89f..9c24b1a3b9 100644 --- a/src/mesa/swrast/s_points.h +++ b/src/mesa/swrast/s_points.h @@ -1,3 +1,30 @@ +/* $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 diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index b71da4f648..167a7baf40 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.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 @@ -48,9 +48,9 @@ #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]; @@ -69,9 +69,9 @@ GLboolean gl_cull_triangle( GLcontext *ctx, * 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 @@ -103,9 +103,9 @@ static void flat_ci_triangle( GLcontext *ctx, * 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 @@ -140,9 +140,9 @@ static void smooth_ci_triangle( GLcontext *ctx, * 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 @@ -180,9 +180,9 @@ static void flat_rgba_triangle( GLcontext *ctx, * 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 @@ -233,15 +233,15 @@ static void smooth_rgba_triangle( GLcontext *ctx, * 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; \ @@ -292,9 +292,9 @@ static void simple_textured_triangle( GLcontext *ctx, * 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 @@ -302,7 +302,7 @@ static void simple_z_textured_triangle( GLcontext *ctx, #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; \ @@ -361,9 +361,9 @@ static void simple_z_textured_triangle( GLcontext *ctx, * 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 @@ -374,7 +374,7 @@ static void affine_textured_triangle( GLcontext *ctx, #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; \ @@ -683,9 +683,9 @@ static void affine_textured_triangle( GLcontext *ctx, * 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 @@ -702,7 +702,7 @@ static void near_persp_textured_triangle(GLcontext *ctx, #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; \ @@ -1423,9 +1423,9 @@ static void near_persp_textured_triangle(GLcontext *ctx, * 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 @@ -1434,7 +1434,7 @@ static void lin_persp_textured_triangle( GLcontext *ctx, #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; \ @@ -1602,9 +1602,9 @@ static void lin_persp_textured_triangle( GLcontext *ctx, * 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 @@ -1692,9 +1692,9 @@ static void general_textured_triangle( GLcontext *ctx, * 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], @@ -1817,9 +1817,9 @@ compute_lambda( GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, * 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] ) @@ -1921,9 +1921,9 @@ static void lambda_textured_triangle1( GLcontext *ctx, * 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] ) @@ -2038,9 +2038,9 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx, */ 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]) @@ -2167,9 +2167,9 @@ lambda_multitextured_triangle1( GLcontext *ctx, */ 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]; @@ -2178,18 +2178,18 @@ static void general_textured_spec_triangle(GLcontext *ctx, } 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]; @@ -2199,9 +2199,9 @@ static void lambda_textured_spec_triangle( GLcontext *ctx, 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]; @@ -2217,9 +2217,9 @@ static void lambda_multitextured_triangle( GLcontext *ctx, 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; @@ -2299,7 +2299,7 @@ _swrast_choose_triangle( GLcontext *ctx ) 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 diff --git a/src/mesa/swrast/s_triangle.h b/src/mesa/swrast/s_triangle.h index eaff79532c..d08fc9177f 100644 --- a/src/mesa/swrast/s_triangle.h +++ b/src/mesa/swrast/s_triangle.h @@ -1,4 +1,4 @@ -/* $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 @@ -37,9 +37,9 @@ GLboolean gl_cull_triangle( GLcontext *ctx, - SWvertex *v0, - SWvertex *v1, - SWvertex *v2); + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2); void diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 8fdbec9d18..be1fab9b49 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -1,4 +1,4 @@ -/* $Id: s_tritemp.h,v 1.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 @@ -76,7 +76,7 @@ /*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 */ @@ -95,7 +95,7 @@ #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 */ @@ -650,7 +650,7 @@ } if (setupLeft && eLeft->lines > 0) { - SWvertex *vLower; + const SWvertex *vLower; GLfixed fsx = eLeft->fsx; fx = FixedCeil(fsx); fError = fx - fsx - FIXED_ONE; diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 82a0add00e..654199ef24 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -129,17 +129,19 @@ _swrast_get_stipple_counter_ref( GLcontext *ctx ); * 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 ); |