diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 6 | ||||
-rw-r--r-- | src/mesa/main/convolve.c | 19 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 2 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 13 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 3 | ||||
-rw-r--r-- | src/mesa/main/texutil_tmp.h | 22 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 6 | ||||
-rw-r--r-- | src/mesa/swrast/s_pointtemp.h | 10 | ||||
-rw-r--r-- | src/mesa/tnl/t_pipeline.c | 6 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_lighttmp.h | 195 | ||||
-rw-r--r-- | src/mesa/x86/assyntax.h | 11 | ||||
-rw-r--r-- | src/mesa/x86/mmx_blend.S | 15 | ||||
-rw-r--r-- | src/mesa/x86/mmx_blendtmp.h | 31 |
15 files changed, 191 insertions, 160 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 84a5f5c84cb..1bab6d91a41 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1100,6 +1100,8 @@ static XMesaVisual choose_visual( Display *dpy, int screen, const int *list ) } } + (void) caveat; + /* * Since we're only simulating the GLX extension this function will never * find any real GL visuals. Instead, all we can do is try to find an RGB @@ -2019,6 +2021,10 @@ Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config, } } + /* not used at this time */ + (void) useLargest; + (void) preserveContents; + if (width == 0 || height == 0) return 0; @@ -2373,6 +2379,10 @@ Fake_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, } } + /* not used at this time */ + (void) useLargest; + (void) preserveContents; + xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height); /* A GLXPbuffer handle must be an X Drawable because that's what * glXMakeCurrent takes. diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index d800de97d5b..02c67c25cf3 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -881,6 +881,8 @@ static GLboolean setup_grayscale( int client, XMesaVisual v, static GLboolean setup_dithered_color( int client, XMesaVisual v, XMesaBuffer buffer, XMesaColormap cmap ) { + (void) DitherValues; /* silence warning */ + if (GET_VISUAL_DEPTH(v)<4 || GET_VISUAL_DEPTH(v)>16) { return GL_FALSE; } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index d82edda7743..7d896c5d586 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -137,8 +137,8 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) else if (bufferBit == BACK_LEFT_BIT) { ASSERT(target->db_state); if (target->backpixmap) { - /* back buffer is a pixmape */ - target->buffer = target->backpixmap; /* incompatible types? */ + /* back buffer is a pixmap */ + target->buffer = (XMesaDrawable) target->backpixmap; } else if (target->backimage) { /* back buffer is an XImage */ @@ -413,6 +413,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, const GLubyte r = xmesa->clearcolor[0]; const GLubyte g = xmesa->clearcolor[1]; const GLubyte b = xmesa->clearcolor[2]; +#if 0 /* See below */ register GLuint clearPixel; if (xmesa->swapbytes) { clearPixel = (b << 16) | (g << 8) | r; @@ -420,6 +421,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, else { clearPixel = (r << 16) | (g << 8) | b; } +#endif if (all) { if (r==g && g==b) { diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index b7d2eeb20f9..e6b19fabd42 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 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"), @@ -178,7 +177,7 @@ void GLAPIENTRY _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { GLint baseFormat; - GLint i, components; + GLint i; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -215,8 +214,8 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G return; } - components = _mesa_components_in_format(format); - assert(components > 0); /* this should have been caught earlier */ + /* this should have been caught earlier */ + assert(_mesa_components_in_format(format)); ctx->Convolution2D.Format = format; ctx->Convolution2D.InternalFormat = internalFormat; @@ -304,22 +303,18 @@ void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - struct gl_convolution_attrib *conv; GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; - conv = &ctx->Convolution1D; break; case GL_CONVOLUTION_2D: c = 1; - conv = &ctx->Convolution2D; break; case GL_SEPARABLE_2D: c = 2; - conv = &ctx->Separable2D; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); @@ -403,22 +398,18 @@ void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); - struct gl_convolution_attrib *conv; GLuint c; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: c = 0; - conv = &ctx->Convolution1D; break; case GL_CONVOLUTION_2D: c = 1; - conv = &ctx->Convolution2D; break; case GL_SEPARABLE_2D: c = 2; - conv = &ctx->Separable2D; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index fa7a33e0c0d..0b512c57939 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -31,7 +31,7 @@ #include "mtypes.h" -#define F(x) (int)&(((struct gl_extensions *)0)->x) +#define F(x) (int)(unsigned long)&(((struct gl_extensions *)0)->x) #define ON GL_TRUE #define OFF GL_FALSE diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index ec08168fc02..e4579bdb6f8 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2481,7 +2481,6 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); @@ -2498,7 +2497,6 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); @@ -2518,7 +2516,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); @@ -2535,7 +2532,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); @@ -2557,7 +2553,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); @@ -2574,7 +2569,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, return; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(texImage); @@ -2609,7 +2603,6 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize) { - GLboolean isProxy = GL_FALSE; GLint expectedSize, maxLevels = 0, maxTextureSize; if (dimensions == 1) { @@ -2619,7 +2612,6 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, else if (dimensions == 2) { if (target == GL_PROXY_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; - isProxy = GL_TRUE; } else if (target == GL_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; @@ -2628,7 +2620,6 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, if (!ctx->Extensions.ARB_texture_cube_map) return GL_INVALID_ENUM; /*target*/ maxLevels = ctx->Const.MaxCubeTextureLevels; - isProxy = GL_TRUE; } else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { @@ -2698,7 +2689,6 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize) { - GLboolean isProxy = GL_FALSE; GLint expectedSize, maxLevels = 0, maxTextureSize; if (dimensions == 1) { @@ -2708,7 +2698,6 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, else if (dimensions == 2) { if (target == GL_PROXY_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; - isProxy = GL_TRUE; } else if (target == GL_TEXTURE_2D) { maxLevels = ctx->Const.MaxTextureLevels; @@ -2717,7 +2706,6 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, if (!ctx->Extensions.ARB_texture_cube_map) return GL_INVALID_ENUM; /*target*/ maxLevels = ctx->Const.MaxCubeTextureLevels; - isProxy = GL_TRUE; } else if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { @@ -3075,6 +3063,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, error = compressed_subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, imageSize); if (error) { + /* XXX proxy target? */ _mesa_error(ctx, error, "glCompressedTexSubImage2D"); return; } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 36d5c25ce4b..899201e6c4a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -627,6 +627,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, srcPacking, srcAddr, dstAddr); assert(b); + (void) b; } else if (dimensions == 2) { GLboolean b; @@ -638,6 +639,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, srcPacking, srcAddr, dstAddr); assert(b); + (void) b; } else { GLboolean b; @@ -648,6 +650,7 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, srcFormat, srcType, srcPacking, srcAddr, dstAddr); assert(b); + (void) b; } } else { diff --git a/src/mesa/main/texutil_tmp.h b/src/mesa/main/texutil_tmp.h index 7b2ccaa1c90..0be341c87c3 100644 --- a/src/mesa/main/texutil_tmp.h +++ b/src/mesa/main/texutil_tmp.h @@ -385,18 +385,16 @@ TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert ) DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + (convert->yoffset * convert->dstImageWidth + convert->xoffset) * DST_TEXEL_BYTES); - GLint adjust; - GLint row, col = 0; - (void) col; - - adjust = convert->dstImageWidth - convert->width; + GLint row; +#ifndef CONVERT_DIRECT + GLint adjust = convert->dstImageWidth - convert->width; +#endif #if DEBUG_TEXUTIL _mesa_debug( NULL, __FUNCTION__ ":\n" ); _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -406,6 +404,7 @@ TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert ) dst += convert->dstImageWidth; #else const GLubyte *srcRow = src; + GLint col; for ( col = 0 ; col < convert->width ; col++ ) { CONVERT_TEXEL( *dst++, src ); src += SRC_TEXEL_BYTES; @@ -437,18 +436,16 @@ TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert ) ((convert->zoffset * convert->dstImageHeight + convert->yoffset) * convert->dstImageWidth + convert->xoffset) * DST_TEXEL_BYTES); - GLint adjust; - GLint row, col = 0, img; - (void) col; - - adjust = convert->dstImageWidth - convert->width; + GLint row, img; +#ifndef CONVERT_DIRECT + GLint adjust = convert->dstImageWidth - convert->width; +#endif #if DEBUG_TEXUTIL _mesa_debug( NULL, __FUNCTION__ ":\n" ); _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { @@ -460,6 +457,7 @@ TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert ) dst += convert->dstImageWidth; #else const GLubyte *srcRow = src; + GLint col; for ( col = 0 ; col < convert->width ; col++ ) { CONVERT_TEXEL( *dst++, src ); src += SRC_TEXEL_BYTES; diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 8e97b619bf2..5d4093f32c0 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -125,7 +125,6 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint skipPixels = unpack->SkipPixels; GLint skipRows = unpack->SkipRows; GLint rowLength; - GLdepth zSpan[MAX_WIDTH]; /* only used when zooming */ GLint zoomY0 = 0; if (unpack->RowLength > 0) @@ -185,13 +184,8 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } else { - /* setup array of fragment Z value to pass to zoom function */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF); - GLint i; if (drawWidth > MAX_WIDTH) return GL_FALSE; /* fall back to general case path */ - for (i=0; i<drawWidth; i++) - zSpan[i] = z; /* save Y value of first row */ zoomY0 = IROUND(ctx->Current.RasterPos[1]); diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h index f21f4f634dc..1ae1c946ff1 100644 --- a/src/mesa/swrast/s_pointtemp.h +++ b/src/mesa/swrast/s_pointtemp.h @@ -63,10 +63,10 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) #if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) GLfloat size; #endif -#if FLAGS & ATTENUATE +#if FLAGS & RGBA +#if (FLAGS & ATTENUATE) && (FLAGS & SMOOTH) GLfloat alphaAtten; #endif -#if FLAGS & RGBA const GLchan red = vert->color[0]; const GLchan green = vert->color[1]; const GLchan blue = vert->color[2]; @@ -134,12 +134,16 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) #if FLAGS & ATTENUATE if (vert->pointSize >= ctx->Point.Threshold) { size = MIN2(vert->pointSize, ctx->Point.MaxSize); +#if (FLAGS & RGBA) && (FLAGS & SMOOTH) alphaAtten = 1.0F; +#endif } else { +#if (FLAGS & RGBA) && (FLAGS & SMOOTH) GLfloat dsize = vert->pointSize / ctx->Point.Threshold; - size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize); alphaAtten = dsize * dsize; +#endif + size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize); } #elif FLAGS & (LARGE | SMOOTH | SPRITE) size = ctx->Point._Size; diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 5e40309cd0d..bfb8996c8db 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -123,7 +123,9 @@ void _tnl_run_pipeline( GLcontext *ctx ) GLuint changed_state = pipe->run_state_changes; GLuint changed_inputs = pipe->run_input_changes; GLboolean running = GL_TRUE; +#ifdef HAVE_FAST_MATH unsigned short __tmp; +#endif pipe->run_state_changes = 0; pipe->run_input_changes = 0; @@ -132,7 +134,9 @@ void _tnl_run_pipeline( GLcontext *ctx ) */ ASSERT(pipe->build_state_changes == 0); +#ifdef HAVE_FAST_MATH START_FAST_MATH(__tmp); +#endif /* If something changes in the pipeline, tag all subsequent stages * using this value for recalculation. Inactive stages have their @@ -155,7 +159,9 @@ void _tnl_run_pipeline( GLcontext *ctx ) } } +#ifdef HAVE_FAST_MATH END_FAST_MATH(__tmp); +#endif } diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index 167325eae83..7af1a4bfabf 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 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"), @@ -61,9 +60,11 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; - GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data; +#if IDX & LIGHT_TWOSIDE + GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data; +#endif const GLuint nr = VB->Count; @@ -78,11 +79,11 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, VB->SecondaryColorPtr[0] = &store->LitSecondary[0]; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - if (IDX & LIGHT_TWOSIDE) { - VB->ColorPtr[1] = &store->LitColor[1]; - VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; - sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; - } +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; + VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif /* Side-effects done, can we finish now? */ @@ -93,20 +94,21 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, GLfloat sum[2][3], spec[2][3]; struct gl_light *light; - if ( IDX & LIGHT_MATERIAL ) { - update_materials( ctx, store ); - sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - if (IDX & LIGHT_TWOSIDE) - sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; - } +#if IDX & LIGHT_MATERIAL + update_materials( ctx, store ); + sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; +#if IDX & LIGHT_TWOSIDE + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif +#endif COPY_3V(sum[0], base[0]); ZERO_3V(spec[0]); - if (IDX & LIGHT_TWOSIDE) { - COPY_3V(sum[1], base[1]); - ZERO_3V(spec[1]); - } +#if IDX & LIGHT_TWOSIDE + COPY_3V(sum[1], base[1]); + ZERO_3V(spec[1]); +#endif /* Add contribution from each enabled light source */ foreach (light, &ctx->Light.EnabledList) { @@ -167,17 +169,18 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, /* Which side gets the diffuse & specular terms? */ if (n_dot_VP < 0.0F) { ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); - if (!(IDX & LIGHT_TWOSIDE)) { - continue; - } +#if IDX & LIGHT_TWOSIDE side = 1; correction = -1; n_dot_VP = -n_dot_VP; +#else + continue; +#endif } else { - if (IDX & LIGHT_TWOSIDE) { - ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); - } +#if IDX & LIGHT_TWOSIDE + ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); +#endif side = 0; correction = 1; } @@ -224,11 +227,11 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, COPY_3V( Fspec[j], spec[0] ); Fcolor[j][3] = sumA[0]; - if (IDX & LIGHT_TWOSIDE) { - COPY_3V( Bcolor[j], sum[1] ); - COPY_3V( Bspec[j], spec[1] ); - Bcolor[j][3] = sumA[1]; - } +#if IDX & LIGHT_TWOSIDE + COPY_3V( Bcolor[j], sum[1] ); + COPY_3V( Bspec[j], spec[1] ); + Bcolor[j][3] = sumA[1]; +#endif } } @@ -268,10 +271,10 @@ static void TAG(light_rgba)( GLcontext *ctx, VB->ColorPtr[0] = &store->LitColor[0]; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - if (IDX & LIGHT_TWOSIDE) { - VB->ColorPtr[1] = &store->LitColor[1]; - sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; - } +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif if (stage->changed_inputs == 0) return; @@ -283,8 +286,9 @@ static void TAG(light_rgba)( GLcontext *ctx, if ( IDX & LIGHT_MATERIAL ) { update_materials( ctx, store ); sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - if (IDX & LIGHT_TWOSIDE) - sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#if IDX & LIGHT_TWOSIDE + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif } COPY_3V(sum[0], base[0]); @@ -353,18 +357,18 @@ static void TAG(light_rgba)( GLcontext *ctx, /* which side are we lighting? */ if (n_dot_VP < 0.0F) { ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); - - if (!(IDX & LIGHT_TWOSIDE)) - continue; - +#if IDX & LIGHT_TWOSIDE side = 1; correction = -1; n_dot_VP = -n_dot_VP; +#else + continue; +#endif } else { - if (IDX & LIGHT_TWOSIDE) { - ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); - } +#if IDX & LIGHT_TWOSIDE + ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); +#endif side = 0; correction = 1; } @@ -413,10 +417,10 @@ static void TAG(light_rgba)( GLcontext *ctx, COPY_3V( Fcolor[j], sum[0] ); Fcolor[j][3] = sumA[0]; - if (IDX & LIGHT_TWOSIDE) { - COPY_3V( Bcolor[j], sum[1] ); - Bcolor[j][3] = sumA[1]; - } +#if IDX & LIGHT_TWOSIDE + COPY_3V( Bcolor[j], sum[1] ); + Bcolor[j][3] = sumA[1]; +#endif } } @@ -435,7 +439,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; +#if IDX & LIGHT_TWOSIDE GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; +#endif const struct gl_light *light = ctx->Light.EnabledList.next; GLuint j = 0; GLfloat base[2][3]; @@ -450,8 +456,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, (void) nstride; VB->ColorPtr[0] = &store->LitColor[0]; - if (IDX & LIGHT_TWOSIDE) - VB->ColorPtr[1] = &store->LitColor[1]; +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; +#endif if (stage->changed_inputs == 0) return; @@ -470,29 +477,29 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, ACC_3V(base[0], ctx->Light._BaseColor[0] ); base[0][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - if (IDX & LIGHT_TWOSIDE) { - COPY_3V(base[1], light->_MatAmbient[1]); - ACC_3V(base[1], ctx->Light._BaseColor[1]); - base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; - } +#if IDX & LIGHT_TWOSIDE + COPY_3V(base[1], light->_MatAmbient[1]); + ACC_3V(base[1], ctx->Light._BaseColor[1]); + base[1][3] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif } n_dot_VP = DOT3(normal, light->_VP_inf_norm); if (n_dot_VP < 0.0F) { - if (IDX & LIGHT_TWOSIDE) { - GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm); - GLfloat sum[3]; - COPY_3V(sum, base[1]); - ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]); - if (n_dot_h > 0.0F) { - GLfloat spec; - GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec ); - ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]); - } - COPY_3V(Bcolor[j], sum ); - Bcolor[j][3] = base[1][3]; - } +#if IDX & LIGHT_TWOSIDE + GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm); + GLfloat sum[3]; + COPY_3V(sum, base[1]); + ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]); + if (n_dot_h > 0.0F) { + GLfloat spec; + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]); + } + COPY_3V(Bcolor[j], sum ); + Bcolor[j][3] = base[1][3]; +#endif COPY_4FV(Fcolor[j], base[0]); } else { @@ -508,7 +515,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, } COPY_3V(Fcolor[j], sum ); Fcolor[j][3] = base[0][3]; - if (IDX & LIGHT_TWOSIDE) COPY_4FV(Bcolor[j], base[1]); +#if IDX & LIGHT_TWOSIDE + COPY_4FV(Bcolor[j], base[1]); +#endif } } } @@ -526,7 +535,9 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data; +#if IDX & LIGHT_TWOSIDE GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data; +#endif GLuint j = 0; const GLuint nr = VB->Count; const struct gl_light *light; @@ -543,8 +554,9 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; VB->ColorPtr[0] = &store->LitColor[0]; - if (IDX & LIGHT_TWOSIDE) - VB->ColorPtr[1] = &store->LitColor[1]; +#if IDX & LIGHT_TWOSIDE + VB->ColorPtr[1] = &store->LitColor[1]; +#endif if (stage->changed_inputs == 0) return; @@ -557,21 +569,24 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, update_materials( ctx, store ); sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; - if (IDX & LIGHT_TWOSIDE) - sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#if IDX & LIGHT_TWOSIDE + sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; +#endif } COPY_3V(sum[0], ctx->Light._BaseColor[0]); - if (IDX & LIGHT_TWOSIDE) - COPY_3V(sum[1], ctx->Light._BaseColor[1]); +#if IDX & LIGHT_TWOSIDE + COPY_3V(sum[1], ctx->Light._BaseColor[1]); +#endif foreach (light, &ctx->Light.EnabledList) { GLfloat n_dot_h, n_dot_VP, spec; ACC_3V(sum[0], light->_MatAmbient[0]); - if (IDX & LIGHT_TWOSIDE) - ACC_3V(sum[1], light->_MatAmbient[1]); +#if IDX & LIGHT_TWOSIDE + ACC_3V(sum[1], light->_MatAmbient[1]); +#endif n_dot_VP = DOT3(normal, light->_VP_inf_norm); @@ -584,7 +599,8 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, ACC_SCALE_SCALAR_3V( sum[0], spec, light->_MatSpecular[0]); } } - else if (IDX & LIGHT_TWOSIDE) { +#if IDX & LIGHT_TWOSIDE + else { ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]); n_dot_h = -DOT3(normal, light->_h_inf_norm); if (n_dot_h > 0.0F) { @@ -593,15 +609,16 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, ACC_SCALE_SCALAR_3V( sum[1], spec, light->_MatSpecular[1]); } } +#endif } COPY_3V( Fcolor[j], sum[0] ); Fcolor[j][3] = sumA[0]; - if (IDX & LIGHT_TWOSIDE) { - COPY_3V( Bcolor[j], sum[1] ); - Bcolor[j][3] = sumA[1]; - } +#if IDX & LIGHT_TWOSIDE + COPY_3V( Bcolor[j], sum[1] ); + Bcolor[j][3] = sumA[1]; +#endif } } @@ -640,15 +657,17 @@ static void TAG(light_ci)( GLcontext *ctx, (void) vstride; VB->IndexPtr[0] = &store->LitIndex[0]; - if (IDX & LIGHT_TWOSIDE) - VB->IndexPtr[1] = &store->LitIndex[1]; +#if IDX & LIGHT_TWOSIDE + VB->IndexPtr[1] = &store->LitIndex[1]; +#endif if (stage->changed_inputs == 0) return; indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data; - if (IDX & LIGHT_TWOSIDE) - indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data; +#if IDX & LIGHT_TWOSIDE + indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data; +#endif /* loop over vertices */ for (j=0; j<nr; j++,STRIDE_F(vertex,vstride),STRIDE_F(normal, nstride)) { @@ -716,11 +735,13 @@ static void TAG(light_ci)( GLcontext *ctx, /* which side are we lighting? */ if (n_dot_VP < 0.0F) { - if (!(IDX & LIGHT_TWOSIDE)) - continue; +#if IDX & LIGHT_TWOSIDE side = 1; correction = -1; n_dot_VP = -n_dot_VP; +#else + continue; +#endif } /* accumulate diffuse term */ diff --git a/src/mesa/x86/assyntax.h b/src/mesa/x86/assyntax.h index ebe9c57460d..13f980d57da 100644 --- a/src/mesa/x86/assyntax.h +++ b/src/mesa/x86/assyntax.h @@ -78,9 +78,11 @@ #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (i386) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) -#define CONCAT(x, y) x ## y +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z #else -#define CONCAT(x, y) x/**/y +#define CONCAT(x, y) x/**/y +#define CONCAT3(x, y, z) x/**/y/**/z #endif #ifdef ACK_ASSEMBLER @@ -862,7 +864,8 @@ #define P_XMM6 xmm6 #define P_XMM7 xmm7 -#define CONCAT(x, y) x ## y +#define CONCAT(x, y) x ## y +#define CONCAT3(x, y, z) x ## y ## z #if defined(NASM_ASSEMBLER) @@ -1689,8 +1692,10 @@ SECTION _DATA public align=16 class=DATA use32 flat /* Added by BrianP for FreeBSD (per David Dawes) */ #if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) && !defined(__bsdi__) #define LLBL(a) CONCAT(.L,a) +#define LLBL2(a,b) CONCAT3(.L,a,b) #else #define LLBL(a) a +#define LLBL2(a,b) CONCAT(a,b) #endif /* Segment overrides */ diff --git a/src/mesa/x86/mmx_blend.S b/src/mesa/x86/mmx_blend.S index 9fe3e717961..d049aa12bee 100644 --- a/src/mesa/x86/mmx_blend.S +++ b/src/mesa/x86/mmx_blend.S @@ -254,7 +254,8 @@ const_80: /* Blend transparency function */ -#define TAG(x) x##_transparency +#define TAG(x) CONCAT(x,_transparency) +#define LLTAG(x) LLBL2(x,_transparency) #define INIT \ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ @@ -275,7 +276,8 @@ const_80: * FIXME: Add some loop unrolling here... */ -#define TAG(x) x##_add +#define TAG(x) CONCAT(x,_add) +#define LLTAG(x) LLBL2(x,_add) #define INIT @@ -295,7 +297,8 @@ TWO(MOVQ ( MM1, REGIND(rgba) )) /* Blend min function */ -#define TAG(x) x##_min +#define TAG(x) CONCAT(x,_min) +#define LLTAG(x) LLBL2(x,_min) #define INIT \ MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ @@ -318,7 +321,8 @@ TWO(MOVQ ( MM1, REGIND(rgba) )) /* Blend max function */ -#define TAG(x) x##_max +#define TAG(x) CONCAT(x,_max) +#define LLTAG(x) LLBL2(x,_max) #define INIT \ MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ @@ -341,7 +345,8 @@ TWO(MOVQ ( MM1, REGIND(rgba) )) /* Blend modulate function */ -#define TAG(x) x##_modulate +#define TAG(x) CONCAT(x,_modulate) +#define LLTAG(x) LLBL2(x,_modulate) #define INIT \ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\ diff --git a/src/mesa/x86/mmx_blendtmp.h b/src/mesa/x86/mmx_blendtmp.h index 1a8190355e4..5d22f288a03 100644 --- a/src/mesa/x86/mmx_blendtmp.h +++ b/src/mesa/x86/mmx_blendtmp.h @@ -24,7 +24,7 @@ GLNAME( TAG(_mesa_mmx_blend) ): MOV_L ( REGOFF(12, EBP), ECX ) /* n */ CMP_L ( CONST(0), ECX) - JE ( LLBL ( TAG(GMB_return) ) ) + JE ( LLTAG(GMB_return) ) MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ @@ -33,10 +33,10 @@ GLNAME( TAG(_mesa_mmx_blend) ): INIT TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ - JZ ( LLBL ( TAG(GMB_align_end) ) ) + JZ ( LLTAG(GMB_align_end) ) CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ - JE ( LLBL ( TAG(GMB_align_continue) ) ) + JE ( LLTAG(GMB_align_continue) ) /* runin */ #define ONE(x) x @@ -45,23 +45,23 @@ GLNAME( TAG(_mesa_mmx_blend) ): #undef ONE #undef TWO -LLBL ( TAG(GMB_align_continue) ): +LLTAG(GMB_align_continue): DEC_L ( ECX ) /* n -= 1 */ INC_L ( EBX ) /* mask += 1 */ ADD_L ( CONST(4), EDI ) /* rgba += 1 */ ADD_L ( CONST(4), ESI ) /* dest += 1 */ -LLBL ( TAG(GMB_align_end) ): +LLTAG(GMB_align_end): CMP_L ( CONST(2), ECX) - JB ( LLBL ( TAG(GMB_loop_end) ) ) + JB ( LLTAG(GMB_loop_end) ) ALIGNTEXT16 -LLBL ( TAG(GMB_loop_begin) ): +LLTAG(GMB_loop_begin): CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ - JE ( LLBL ( TAG(GMB_loop_continue) ) ) + JE ( LLTAG(GMB_loop_continue) ) /* main loop */ #define ONE(x) @@ -70,7 +70,7 @@ LLBL ( TAG(GMB_loop_begin) ): #undef ONE #undef TWO -LLBL ( TAG(GMB_loop_continue) ): +LLTAG(GMB_loop_continue): DEC_L ( ECX ) DEC_L ( ECX ) /* n -= 2 */ @@ -78,15 +78,15 @@ LLBL ( TAG(GMB_loop_continue) ): ADD_L ( CONST(8), EDI ) /* rgba += 2 */ ADD_L ( CONST(8), ESI ) /* dest += 2 */ CMP_L ( CONST(2), ECX ) - JAE ( LLBL ( TAG(GMB_loop_begin) ) ) + JAE ( LLTAG(GMB_loop_begin) ) -LLBL ( TAG(GMB_loop_end) ): +LLTAG(GMB_loop_end): CMP_L ( CONST(1), ECX ) - JB ( LLBL ( TAG(GMB_done) ) ) + JB ( LLTAG(GMB_done) ) CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ - JE ( LLBL ( TAG(GMB_done) ) ) + JE ( LLTAG(GMB_done) ) /* runout */ #define ONE(x) x @@ -95,11 +95,11 @@ LLBL ( TAG(GMB_loop_end) ): #undef ONE #undef TWO -LLBL ( TAG(GMB_done) ): +LLTAG(GMB_done): EMMS -LLBL ( TAG(GMB_return) ): +LLTAG(GMB_return): POP_L ( EBX ) POP_L ( EDI ) @@ -109,5 +109,6 @@ LLBL ( TAG(GMB_return) ): RET #undef TAG +#undef LLTAG #undef INIT #undef MAIN |