diff options
Diffstat (limited to 'xc/extras/Mesa/src')
254 files changed, 30738 insertions, 21267 deletions
diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c index 0735e2d64..e5a79e1c3 100644 --- a/xc/extras/Mesa/src/OSmesa/osmesa.c +++ b/xc/extras/Mesa/src/OSmesa/osmesa.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -40,9 +40,9 @@ #include "colormac.h" #include "depth.h" #include "extensions.h" +#include "imports.h" #include "macros.h" #include "matrix.h" -#include "mem.h" #include "mmath.h" #include "mtypes.h" #include "texformat.h" @@ -54,7 +54,6 @@ #include "swrast/s_depth.h" #include "swrast/s_lines.h" #include "swrast/s_triangle.h" -#include "swrast/s_trispan.h" #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" @@ -293,7 +292,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, osmesa->gl_visual, sharelist ? &sharelist->gl_ctx : (GLcontext *) NULL, - (void *) osmesa, GL_TRUE )) { + (void *) osmesa, + GL_FALSE)) { _mesa_destroy_visual( osmesa->gl_visual ); FREE(osmesa); return NULL; @@ -301,6 +301,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, _mesa_enable_sw_extensions(&(osmesa->gl_ctx)); _mesa_enable_1_3_extensions(&(osmesa->gl_ctx)); + _mesa_enable_1_4_extensions(&(osmesa->gl_ctx)); osmesa->gl_buffer = _mesa_create_framebuffer( osmesa->gl_visual, (GLboolean) ( osmesa->gl_visual->depthBits > 0 ), @@ -473,7 +474,7 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, compute_row_addresses( ctx ); /* init viewport */ - if (ctx->gl_ctx.Viewport.Width==0) { + if (ctx->gl_ctx.Viewport.Width == 0) { /* initialize viewport and scissor box to buffer size */ _mesa_Viewport( 0, 0, width, height ); ctx->gl_ctx.Scissor.Width = width; @@ -624,6 +625,39 @@ OSMesaGetColorBuffer( OSMesaContext c, GLint *width, } } + + +struct name_address { + const char *Name; + GLvoid *Address; +}; + +static struct name_address functions[] = { + { "OSMesaCreateContext", (void *) OSMesaCreateContext }, + { "OSMesaCreateContextExt", (void *) OSMesaCreateContextExt }, + { "OSMesaDestroyContext", (void *) OSMesaDestroyContext }, + { "OSMesaMakeCurrent", (void *) OSMesaMakeCurrent }, + { "OSMesaGetCurrentContext", (void *) OSMesaGetCurrentContext }, + { "OSMesaPixelsStore", (void *) OSMesaPixelStore }, + { "OSMesaGetIntegerv", (void *) OSMesaGetIntegerv }, + { "OSMesaGetDepthBuffer", (void *) OSMesaGetDepthBuffer }, + { "OSMesaGetColorBuffer", (void *) OSMesaGetColorBuffer }, + { "OSMesaGetProcAddress", (void *) OSMesaGetProcAddress }, + { NULL, NULL } +}; + +GLAPI void * GLAPIENTRY +OSMesaGetProcAddress( const char *funcName ) +{ + int i; + for (i = 0; functions[i].Name; i++) { + if (_mesa_strcmp(functions[i].Name, funcName) == 0) + return (void *) functions[i].Address; + } + return (void *) _glapi_get_proc_address(funcName); +} + + /**********************************************************************/ /*** Device Driver Functions ***/ /**********************************************************************/ @@ -634,12 +668,12 @@ OSMesaGetColorBuffer( OSMesaContext c, GLint *width, */ #if CHAN_TYPE == GL_FLOAT -#define PACK_RGBA(DST, R, G, B, A) \ -do { \ - (DST)[0] = (R < 0.0f) ? 0.0f : ((R > 1.0f) ? 1.0f : R); \ - (DST)[1] = (G < 0.0f) ? 0.0f : ((G > 1.0f) ? 1.0f : G); \ - (DST)[2] = (B < 0.0f) ? 0.0f : ((B > 1.0f) ? 1.0f : B); \ - (DST)[3] = (A < 0.0f) ? 0.0f : ((A > 1.0f) ? 1.0f : A); \ +#define PACK_RGBA(DST, R, G, B, A) \ +do { \ + (DST)[0] = MAX2( R, 0.0F ); \ + (DST)[1] = MAX2( G, 0.0F ); \ + (DST)[2] = MAX2( B, 0.0F ); \ + (DST)[3] = CLAMP(A, 0.0F, CHAN_MAXF);\ } while (0) #else #define PACK_RGBA(DST, R, G, B, A) \ @@ -684,19 +718,11 @@ do { \ -static void set_draw_buffer( GLcontext *ctx, GLenum mode ) -{ - /* A no-op since there's only one color buffer! */ - (void) ctx; - (void) mode; -} - - -static void set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +static void set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) { /* separate read buffer not supported */ ASSERT(buffer == ctx->DrawBuffer); - ASSERT(mode == GL_FRONT_LEFT); + ASSERT(bufferBit == FRONT_LEFT_BIT); } @@ -738,9 +764,10 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, } } else if (osmesa->format == OSMESA_RGB) { - const GLchan r = ctx->Color.ClearColor[0]; - const GLchan g = ctx->Color.ClearColor[1]; - const GLchan b = ctx->Color.ClearColor[2]; + GLchan r, g, b; + CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); if (all) { /* Clear whole RGB buffer */ GLuint n = osmesa->rowlength * osmesa->height; @@ -764,9 +791,10 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, } } else if (osmesa->format == OSMESA_BGR) { - const GLchan r = ctx->Color.ClearColor[0]; - const GLchan g = ctx->Color.ClearColor[1]; - const GLchan b = ctx->Color.ClearColor[2]; + GLchan r, g, b; + CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); if (all) { /* Clear whole RGB buffer */ const GLint n = osmesa->rowlength * osmesa->height; @@ -790,10 +818,11 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, } } else if (osmesa->format == OSMESA_RGB_565) { - const GLchan r = ctx->Color.ClearColor[0]; - const GLchan g = ctx->Color.ClearColor[1]; - const GLchan b = ctx->Color.ClearColor[2]; GLushort clearPixel; + GLchan r, g, b; + CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); PACK_RGB_565(clearPixel, r, g, b); if (all) { /* Clear whole RGB buffer */ @@ -822,10 +851,10 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, /* 4-byte pixel value */ GLuint clearPixel; GLchan *clr = (GLchan *) &clearPixel; - clr[osmesa->rInd] = ctx->Color.ClearColor[0]; - clr[osmesa->gInd] = ctx->Color.ClearColor[1]; - clr[osmesa->bInd] = ctx->Color.ClearColor[2]; - clr[osmesa->aInd] = ctx->Color.ClearColor[3]; + CLAMPED_FLOAT_TO_CHAN(clr[osmesa->rInd], ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(clr[osmesa->gInd], ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(clr[osmesa->bInd], ctx->Color.ClearColor[2]); + CLAMPED_FLOAT_TO_CHAN(clr[osmesa->aInd], ctx->Color.ClearColor[3]); if (all) { /* Clear whole RGBA buffer */ const GLuint n = osmesa->rowlength * osmesa->height; @@ -837,7 +866,7 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, } } else { - BZERO(ptr4, n * sizeof(GLuint)); + _mesa_bzero(ptr4, n * sizeof(GLuint)); } } else { @@ -851,10 +880,11 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, } } #else - const GLchan r = ctx->Color.ClearColor[0]; - const GLchan g = ctx->Color.ClearColor[1]; - const GLchan b = ctx->Color.ClearColor[2]; - const GLchan a = ctx->Color.ClearColor[3]; + GLchan r, g, b, a; + CLAMPED_FLOAT_TO_CHAN(r, ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(g, ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(b, ctx->Color.ClearColor[2]); + CLAMPED_FLOAT_TO_CHAN(a, ctx->Color.ClearColor[3]); if (all) { /* Clear whole RGBA buffer */ const GLuint n = osmesa->rowlength * osmesa->height; @@ -891,13 +921,8 @@ static void clear( GLcontext *ctx, GLbitfield mask, GLboolean all, static void buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) { -#ifdef WIN32 - /* Hack to get around problems with exporting glapi_Context from Mesa - and importing into OSMesa. */ + /* don't use GET_CURRENT_CONTEXT(ctx) here - it's a problem on Windows */ GLcontext *ctx = (GLcontext *) _glapi_get_context(); -#else - GET_CURRENT_CONTEXT(ctx); -#endif (void) buffer; if (ctx) { OSMesaContext osmesa = OSMESA_CONTEXT(ctx); @@ -1785,7 +1810,7 @@ osmesa_choose_line_function( GLcontext *ctx ) if (CHAN_BITS != 8) return NULL; if (ctx->RenderMode != GL_RENDER) return NULL; if (ctx->Line.SmoothFlag) return NULL; - if (ctx->Texture._ReallyEnabled) return NULL; + if (ctx->Texture._EnabledUnits) return NULL; if (ctx->Light.ShadeModel != GL_FLAT) return NULL; if (ctx->Line.Width != 1.0F) return NULL; if (ctx->Line.StippleFlag) return NULL; @@ -1794,7 +1819,6 @@ osmesa_choose_line_function( GLcontext *ctx ) osmesa->format != OSMESA_BGRA && osmesa->format != OSMESA_ARGB) return NULL; - if (swrast->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE @@ -1857,7 +1881,6 @@ static void smooth_rgba_z_triangle( GLcontext *ctx, const SWvertex *v2 ) { const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); - #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 @@ -1865,7 +1888,7 @@ static void smooth_rgba_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLchan *img = PIXELADDR4(span.x, span.y); \ - for (i = 0; i < span.count; i++, img += 4) { \ + for (i = 0; i < span.end; i++, img += 4) { \ const GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PACK_RGBA(img, FixedToChan(span.red), \ @@ -1909,7 +1932,7 @@ static void flat_rgba_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLuint *img = (GLuint *) PIXELADDR4(span.x, span.y); \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ img[i] = pixel; \ @@ -1940,7 +1963,7 @@ osmesa_choose_triangle_function( GLcontext *ctx ) if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL; if (ctx->Polygon.StippleFlag) return (swrast_tri_func) NULL; - if (ctx->Texture._ReallyEnabled) return (swrast_tri_func) NULL; + if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL; if (osmesa->format != OSMESA_RGBA && osmesa->format != OSMESA_BGRA && osmesa->format != OSMESA_ARGB) return (swrast_tri_func) NULL; @@ -2050,9 +2073,8 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.GetString = get_string; ctx->Driver.UpdateState = osmesa_update_state; - ctx->Driver.SetDrawBuffer = set_draw_buffer; - ctx->Driver.GetBufferSize = buffer_size; ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; + ctx->Driver.GetBufferSize = buffer_size; ctx->Driver.Accum = _swrast_Accum; ctx->Driver.Bitmap = _swrast_Bitmap; @@ -2060,6 +2082,7 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.CopyPixels = _swrast_CopyPixels; ctx->Driver.DrawPixels = _swrast_DrawPixels; ctx->Driver.ReadPixels = _swrast_ReadPixels; + ctx->Driver.DrawBuffer = _swrast_DrawBuffer; ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format; ctx->Driver.TexImage1D = _mesa_store_teximage1d; @@ -2070,6 +2093,13 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; + ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d; + ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d; + ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d; + ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; + ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; + ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; @@ -2080,9 +2110,7 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; - ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat; - ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size; - ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage; + swdd->SetBuffer = set_buffer; /* RGB(A) span/pixel functions */ if (osmesa->format == OSMESA_RGB) { @@ -2141,8 +2169,6 @@ static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) swdd->ReadCI32Span = read_index_span; swdd->ReadCI32Pixels = read_index_pixels; - swdd->SetReadBuffer = set_read_buffer; - tnl->Driver.RunPipeline = _tnl_run_pipeline; _swrast_InvalidateState( ctx, new_state ); diff --git a/xc/extras/Mesa/src/SPARC/glapi_sparc.S b/xc/extras/Mesa/src/SPARC/glapi_sparc.S index 9d3eb8e20..738170087 100644 --- a/xc/extras/Mesa/src/SPARC/glapi_sparc.S +++ b/xc/extras/Mesa/src/SPARC/glapi_sparc.S @@ -1,9 +1,6 @@ /* DO NOT EDIT - This file generated automatically with glsparcasm.py script */ #include "glapioffsets.h" - - - /* The _glapi_Dispatch symbol addresses get relocated into the * sethi/or instruction sequences below at library init time. */ @@ -8697,6 +8694,27 @@ glSampleCoverageARB: jmpl %g3, %g0 nop +.globl gl__unused413 +.type gl__unused413,#function +gl__unused413: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset___unused413), %g2 + or %g2, %lo(8 * _gloffset___unused413), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset___unused413)], %g3 +#endif + jmpl %g3, %g0 + nop + .globl glCompressedTexImage3DARB .type glCompressedTexImage3DARB,#function glCompressedTexImage3DARB: @@ -8844,6 +8862,972 @@ glGetCompressedTexImageARB: jmpl %g3, %g0 nop +.globl glActiveTexture +.type glActiveTexture,#function +glActiveTexture: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_ActiveTextureARB), %g2 + or %g2, %lo(8 * _gloffset_ActiveTextureARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_ActiveTextureARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glClientActiveTexture +.type glClientActiveTexture,#function +glClientActiveTexture: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_ClientActiveTextureARB), %g2 + or %g2, %lo(8 * _gloffset_ClientActiveTextureARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_ClientActiveTextureARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1d +.type glMultiTexCoord1d,#function +glMultiTexCoord1d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1dARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1dARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1dARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1dv +.type glMultiTexCoord1dv,#function +glMultiTexCoord1dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1dvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1dvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1dvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1f +.type glMultiTexCoord1f,#function +glMultiTexCoord1f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1fARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1fARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1fARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1fv +.type glMultiTexCoord1fv,#function +glMultiTexCoord1fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1fvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1fvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1fvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1i +.type glMultiTexCoord1i,#function +glMultiTexCoord1i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1iARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1iARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1iARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1iv +.type glMultiTexCoord1iv,#function +glMultiTexCoord1iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1ivARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1ivARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1ivARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1s +.type glMultiTexCoord1s,#function +glMultiTexCoord1s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1sARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1sARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1sARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord1sv +.type glMultiTexCoord1sv,#function +glMultiTexCoord1sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord1svARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord1svARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord1svARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2d +.type glMultiTexCoord2d,#function +glMultiTexCoord2d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2dARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2dARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2dARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2dv +.type glMultiTexCoord2dv,#function +glMultiTexCoord2dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2dvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2dvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2dvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2f +.type glMultiTexCoord2f,#function +glMultiTexCoord2f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2fARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2fARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2fARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2fv +.type glMultiTexCoord2fv,#function +glMultiTexCoord2fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2fvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2fvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2fvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2i +.type glMultiTexCoord2i,#function +glMultiTexCoord2i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2iARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2iARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2iARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2iv +.type glMultiTexCoord2iv,#function +glMultiTexCoord2iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2ivARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2ivARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2ivARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2s +.type glMultiTexCoord2s,#function +glMultiTexCoord2s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2sARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2sARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2sARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord2sv +.type glMultiTexCoord2sv,#function +glMultiTexCoord2sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord2svARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord2svARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord2svARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3d +.type glMultiTexCoord3d,#function +glMultiTexCoord3d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3dARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3dARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3dARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3dv +.type glMultiTexCoord3dv,#function +glMultiTexCoord3dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3dvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3dvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3dvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3f +.type glMultiTexCoord3f,#function +glMultiTexCoord3f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3fARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3fARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3fARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3fv +.type glMultiTexCoord3fv,#function +glMultiTexCoord3fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3fvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3fvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3fvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3i +.type glMultiTexCoord3i,#function +glMultiTexCoord3i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3iARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3iARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3iARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3iv +.type glMultiTexCoord3iv,#function +glMultiTexCoord3iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3ivARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3ivARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3ivARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3s +.type glMultiTexCoord3s,#function +glMultiTexCoord3s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3sARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3sARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3sARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord3sv +.type glMultiTexCoord3sv,#function +glMultiTexCoord3sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord3svARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord3svARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord3svARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4d +.type glMultiTexCoord4d,#function +glMultiTexCoord4d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4dARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4dARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4dARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4dv +.type glMultiTexCoord4dv,#function +glMultiTexCoord4dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4dvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4dvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4dvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4f +.type glMultiTexCoord4f,#function +glMultiTexCoord4f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4fARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4fARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4fARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4fv +.type glMultiTexCoord4fv,#function +glMultiTexCoord4fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4fvARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4fvARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4fvARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4i +.type glMultiTexCoord4i,#function +glMultiTexCoord4i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4iARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4iARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4iARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4iv +.type glMultiTexCoord4iv,#function +glMultiTexCoord4iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4ivARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4ivARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4ivARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4s +.type glMultiTexCoord4s,#function +glMultiTexCoord4s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4sARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4sARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4sARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiTexCoord4sv +.type glMultiTexCoord4sv,#function +glMultiTexCoord4sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiTexCoord4svARB), %g2 + or %g2, %lo(8 * _gloffset_MultiTexCoord4svARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiTexCoord4svARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glLoadTransposeMatrixf +.type glLoadTransposeMatrixf,#function +glLoadTransposeMatrixf: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_LoadTransposeMatrixfARB), %g2 + or %g2, %lo(8 * _gloffset_LoadTransposeMatrixfARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_LoadTransposeMatrixfARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glLoadTransposeMatrixd +.type glLoadTransposeMatrixd,#function +glLoadTransposeMatrixd: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_LoadTransposeMatrixdARB), %g2 + or %g2, %lo(8 * _gloffset_LoadTransposeMatrixdARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_LoadTransposeMatrixdARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultTransposeMatrixf +.type glMultTransposeMatrixf,#function +glMultTransposeMatrixf: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultTransposeMatrixfARB), %g2 + or %g2, %lo(8 * _gloffset_MultTransposeMatrixfARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultTransposeMatrixfARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultTransposeMatrixd +.type glMultTransposeMatrixd,#function +glMultTransposeMatrixd: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultTransposeMatrixdARB), %g2 + or %g2, %lo(8 * _gloffset_MultTransposeMatrixdARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultTransposeMatrixdARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSampleCoverage +.type glSampleCoverage,#function +glSampleCoverage: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SampleCoverageARB), %g2 + or %g2, %lo(8 * _gloffset_SampleCoverageARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SampleCoverageARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glCompressedTexImage3D +.type glCompressedTexImage3D,#function +glCompressedTexImage3D: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_CompressedTexImage3DARB), %g2 + or %g2, %lo(8 * _gloffset_CompressedTexImage3DARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_CompressedTexImage3DARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glCompressedTexImage2D +.type glCompressedTexImage2D,#function +glCompressedTexImage2D: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_CompressedTexImage2DARB), %g2 + or %g2, %lo(8 * _gloffset_CompressedTexImage2DARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_CompressedTexImage2DARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glCompressedTexImage1D +.type glCompressedTexImage1D,#function +glCompressedTexImage1D: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_CompressedTexImage1DARB), %g2 + or %g2, %lo(8 * _gloffset_CompressedTexImage1DARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_CompressedTexImage1DARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glCompressedTexSubImage3D +.type glCompressedTexSubImage3D,#function +glCompressedTexSubImage3D: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_CompressedTexSubImage3DARB), %g2 + or %g2, %lo(8 * _gloffset_CompressedTexSubImage3DARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_CompressedTexSubImage3DARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glCompressedTexSubImage2D +.type glCompressedTexSubImage2D,#function +glCompressedTexSubImage2D: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_CompressedTexSubImage2DARB), %g2 + or %g2, %lo(8 * _gloffset_CompressedTexSubImage2DARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_CompressedTexSubImage2DARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glCompressedTexSubImage1D +.type glCompressedTexSubImage1D,#function +glCompressedTexSubImage1D: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_CompressedTexSubImage1DARB), %g2 + or %g2, %lo(8 * _gloffset_CompressedTexSubImage1DARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_CompressedTexSubImage1DARB)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glGetCompressedTexImage +.type glGetCompressedTexImage,#function +glGetCompressedTexImage: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_GetCompressedTexImageARB), %g2 + or %g2, %lo(8 * _gloffset_GetCompressedTexImageARB), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_GetCompressedTexImageARB)], %g3 +#endif + jmpl %g3, %g0 + nop + .globl glBlendColorEXT .type glBlendColorEXT,#function glBlendColorEXT: @@ -10146,6 +11130,48 @@ glGetSharpenTexFuncSGIS: jmpl %g3, %g0 nop +.globl glSampleMaskSGIS +.type glSampleMaskSGIS,#function +glSampleMaskSGIS: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SampleMaskSGIS), %g2 + or %g2, %lo(8 * _gloffset_SampleMaskSGIS), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SampleMaskSGIS)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSamplePatternSGIS +.type glSamplePatternSGIS,#function +glSamplePatternSGIS: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SamplePatternSGIS), %g2 + or %g2, %lo(8 * _gloffset_SamplePatternSGIS), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SamplePatternSGIS)], %g3 +#endif + jmpl %g3, %g0 + nop + .globl glArrayElementEXT .type glArrayElementEXT,#function glArrayElementEXT: @@ -10482,6 +11508,48 @@ glPointParameterfvEXT: jmpl %g3, %g0 nop +.globl glPointParameterfARB +.type glPointParameterfARB,#function +glPointParameterfARB: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameterfEXT), %g2 + or %g2, %lo(8 * _gloffset_PointParameterfEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameterfEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameterfvARB +.type glPointParameterfvARB,#function +glPointParameterfvARB: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameterfvEXT), %g2 + or %g2, %lo(8 * _gloffset_PointParameterfvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameterfvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + .globl glPointParameterfSGIS .type glPointParameterfSGIS,#function glPointParameterfSGIS: @@ -11889,6 +12957,48 @@ glSecondaryColorPointerEXT: jmpl %g3, %g0 nop +.globl glMultiDrawArraysEXT +.type glMultiDrawArraysEXT,#function +glMultiDrawArraysEXT: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiDrawArraysEXT), %g2 + or %g2, %lo(8 * _gloffset_MultiDrawArraysEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiDrawArraysEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiDrawElementsEXT +.type glMultiDrawElementsEXT,#function +glMultiDrawElementsEXT: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiDrawElementsEXT), %g2 + or %g2, %lo(8 * _gloffset_MultiDrawElementsEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiDrawElementsEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + .globl glFogCoordfEXT .type glFogCoordfEXT,#function glFogCoordfEXT: @@ -12960,9 +14070,9 @@ glTbufferMask3DFX: jmpl %g3, %g0 nop -.globl glSampleMaskSGIS -.type glSampleMaskSGIS,#function -glSampleMaskSGIS: +.globl glSampleMaskEXT +.type glSampleMaskEXT,#function +glSampleMaskEXT: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -12981,9 +14091,9 @@ glSampleMaskSGIS: jmpl %g3, %g0 nop -.globl glSamplePatternSGIS -.type glSamplePatternSGIS,#function -glSamplePatternSGIS: +.globl glSamplePatternEXT +.type glSamplePatternEXT,#function +glSamplePatternEXT: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13002,9 +14112,9 @@ glSamplePatternSGIS: jmpl %g3, %g0 nop -.globl glActiveTexture -.type glActiveTexture,#function -glActiveTexture: +.globl glDeleteFencesNV +.type glDeleteFencesNV,#function +glDeleteFencesNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13012,20 +14122,20 @@ glActiveTexture: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_ActiveTextureARB), %g2 - or %g2, %lo(8 * _gloffset_ActiveTextureARB), %g2 + sethi %hi(8 * _gloffset_DeleteFencesNV), %g2 + or %g2, %lo(8 * _gloffset_DeleteFencesNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_ActiveTextureARB)], %g3 + ld [%g1 + (4 * _gloffset_DeleteFencesNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glClientActiveTexture -.type glClientActiveTexture,#function -glClientActiveTexture: +.globl glGenFencesNV +.type glGenFencesNV,#function +glGenFencesNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13033,20 +14143,20 @@ glClientActiveTexture: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_ClientActiveTextureARB), %g2 - or %g2, %lo(8 * _gloffset_ClientActiveTextureARB), %g2 + sethi %hi(8 * _gloffset_GenFencesNV), %g2 + or %g2, %lo(8 * _gloffset_GenFencesNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_ClientActiveTextureARB)], %g3 + ld [%g1 + (4 * _gloffset_GenFencesNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glCompressedTexImage1D -.type glCompressedTexImage1D,#function -glCompressedTexImage1D: +.globl glIsFenceNV +.type glIsFenceNV,#function +glIsFenceNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13054,20 +14164,20 @@ glCompressedTexImage1D: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_CompressedTexImage1DARB), %g2 - or %g2, %lo(8 * _gloffset_CompressedTexImage1DARB), %g2 + sethi %hi(8 * _gloffset_IsFenceNV), %g2 + or %g2, %lo(8 * _gloffset_IsFenceNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_CompressedTexImage1DARB)], %g3 + ld [%g1 + (4 * _gloffset_IsFenceNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glCompressedTexImage2D -.type glCompressedTexImage2D,#function -glCompressedTexImage2D: +.globl glTestFenceNV +.type glTestFenceNV,#function +glTestFenceNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13075,20 +14185,20 @@ glCompressedTexImage2D: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_CompressedTexImage2DARB), %g2 - or %g2, %lo(8 * _gloffset_CompressedTexImage2DARB), %g2 + sethi %hi(8 * _gloffset_TestFenceNV), %g2 + or %g2, %lo(8 * _gloffset_TestFenceNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_CompressedTexImage2DARB)], %g3 + ld [%g1 + (4 * _gloffset_TestFenceNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glCompressedTexImage3D -.type glCompressedTexImage3D,#function -glCompressedTexImage3D: +.globl glGetFenceivNV +.type glGetFenceivNV,#function +glGetFenceivNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13096,20 +14206,20 @@ glCompressedTexImage3D: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_CompressedTexImage3DARB), %g2 - or %g2, %lo(8 * _gloffset_CompressedTexImage3DARB), %g2 + sethi %hi(8 * _gloffset_GetFenceivNV), %g2 + or %g2, %lo(8 * _gloffset_GetFenceivNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_CompressedTexImage3DARB)], %g3 + ld [%g1 + (4 * _gloffset_GetFenceivNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glCompressedTexSubImage1D -.type glCompressedTexSubImage1D,#function -glCompressedTexSubImage1D: +.globl glFinishFenceNV +.type glFinishFenceNV,#function +glFinishFenceNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13117,20 +14227,20 @@ glCompressedTexSubImage1D: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_CompressedTexSubImage1DARB), %g2 - or %g2, %lo(8 * _gloffset_CompressedTexSubImage1DARB), %g2 + sethi %hi(8 * _gloffset_FinishFenceNV), %g2 + or %g2, %lo(8 * _gloffset_FinishFenceNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_CompressedTexSubImage1DARB)], %g3 + ld [%g1 + (4 * _gloffset_FinishFenceNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glCompressedTexSubImage2D -.type glCompressedTexSubImage2D,#function -glCompressedTexSubImage2D: +.globl glSetFenceNV +.type glSetFenceNV,#function +glSetFenceNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13138,20 +14248,20 @@ glCompressedTexSubImage2D: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_CompressedTexSubImage2DARB), %g2 - or %g2, %lo(8 * _gloffset_CompressedTexSubImage2DARB), %g2 + sethi %hi(8 * _gloffset_SetFenceNV), %g2 + or %g2, %lo(8 * _gloffset_SetFenceNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_CompressedTexSubImage2DARB)], %g3 + ld [%g1 + (4 * _gloffset_SetFenceNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glCompressedTexSubImage3D -.type glCompressedTexSubImage3D,#function -glCompressedTexSubImage3D: +.globl glWindowPos2dARB +.type glWindowPos2dARB,#function +glWindowPos2dARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13159,20 +14269,20 @@ glCompressedTexSubImage3D: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_CompressedTexSubImage3DARB), %g2 - or %g2, %lo(8 * _gloffset_CompressedTexSubImage3DARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2dMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2dMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_CompressedTexSubImage3DARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2dMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glGetCompressedTexImage -.type glGetCompressedTexImage,#function -glGetCompressedTexImage: +.globl glWindowPos2fARB +.type glWindowPos2fARB,#function +glWindowPos2fARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13180,20 +14290,20 @@ glGetCompressedTexImage: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_GetCompressedTexImageARB), %g2 - or %g2, %lo(8 * _gloffset_GetCompressedTexImageARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2fMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2fMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_GetCompressedTexImageARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2fMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1d -.type glMultiTexCoord1d,#function -glMultiTexCoord1d: +.globl glWindowPos2iARB +.type glWindowPos2iARB,#function +glWindowPos2iARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13201,20 +14311,20 @@ glMultiTexCoord1d: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1dARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1dARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2iMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2iMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1dARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2iMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1dv -.type glMultiTexCoord1dv,#function -glMultiTexCoord1dv: +.globl glWindowPos2sARB +.type glWindowPos2sARB,#function +glWindowPos2sARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13222,20 +14332,20 @@ glMultiTexCoord1dv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1dvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1dvARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2sMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2sMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1dvARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2sMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1f -.type glMultiTexCoord1f,#function -glMultiTexCoord1f: +.globl glWindowPos2dvARB +.type glWindowPos2dvARB,#function +glWindowPos2dvARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13243,20 +14353,20 @@ glMultiTexCoord1f: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1fARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1fARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2dvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2dvMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1fARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2dvMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1fv -.type glMultiTexCoord1fv,#function -glMultiTexCoord1fv: +.globl glWindowPos2fvARB +.type glWindowPos2fvARB,#function +glWindowPos2fvARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13264,20 +14374,20 @@ glMultiTexCoord1fv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1fvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1fvARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2fvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2fvMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1fvARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2fvMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1i -.type glMultiTexCoord1i,#function -glMultiTexCoord1i: +.globl glWindowPos2ivARB +.type glWindowPos2ivARB,#function +glWindowPos2ivARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13285,20 +14395,20 @@ glMultiTexCoord1i: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1iARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1iARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2ivMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2ivMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1iARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2ivMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1iv -.type glMultiTexCoord1iv,#function -glMultiTexCoord1iv: +.globl glWindowPos2svARB +.type glWindowPos2svARB,#function +glWindowPos2svARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13306,20 +14416,20 @@ glMultiTexCoord1iv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1ivARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1ivARB), %g2 + sethi %hi(8 * _gloffset_WindowPos2svMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2svMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1ivARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos2svMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1s -.type glMultiTexCoord1s,#function -glMultiTexCoord1s: +.globl glWindowPos3dARB +.type glWindowPos3dARB,#function +glWindowPos3dARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13327,20 +14437,20 @@ glMultiTexCoord1s: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1sARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1sARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3dMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3dMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1sARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3dMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord1sv -.type glMultiTexCoord1sv,#function -glMultiTexCoord1sv: +.globl glWindowPos3fARB +.type glWindowPos3fARB,#function +glWindowPos3fARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13348,20 +14458,20 @@ glMultiTexCoord1sv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord1svARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord1svARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3fMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3fMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord1svARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3fMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2d -.type glMultiTexCoord2d,#function -glMultiTexCoord2d: +.globl glWindowPos3iARB +.type glWindowPos3iARB,#function +glWindowPos3iARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13369,20 +14479,20 @@ glMultiTexCoord2d: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2dARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2dARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3iMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3iMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2dARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3iMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2dv -.type glMultiTexCoord2dv,#function -glMultiTexCoord2dv: +.globl glWindowPos3sARB +.type glWindowPos3sARB,#function +glWindowPos3sARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13390,20 +14500,20 @@ glMultiTexCoord2dv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2dvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2dvARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3sMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3sMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2dvARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3sMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2f -.type glMultiTexCoord2f,#function -glMultiTexCoord2f: +.globl glWindowPos3dvARB +.type glWindowPos3dvARB,#function +glWindowPos3dvARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13411,20 +14521,20 @@ glMultiTexCoord2f: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2fARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2fARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3dvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3dvMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2fARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3dvMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2fv -.type glMultiTexCoord2fv,#function -glMultiTexCoord2fv: +.globl glWindowPos3fvARB +.type glWindowPos3fvARB,#function +glWindowPos3fvARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13432,20 +14542,20 @@ glMultiTexCoord2fv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2fvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2fvARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3fvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3fvMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2fvARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3fvMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2i -.type glMultiTexCoord2i,#function -glMultiTexCoord2i: +.globl glWindowPos3ivARB +.type glWindowPos3ivARB,#function +glWindowPos3ivARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13453,20 +14563,20 @@ glMultiTexCoord2i: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2iARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2iARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3ivMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3ivMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2iARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3ivMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2iv -.type glMultiTexCoord2iv,#function -glMultiTexCoord2iv: +.globl glWindowPos3svARB +.type glWindowPos3svARB,#function +glWindowPos3svARB: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13474,20 +14584,20 @@ glMultiTexCoord2iv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2ivARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2ivARB), %g2 + sethi %hi(8 * _gloffset_WindowPos3svMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3svMESA), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2ivARB)], %g3 + ld [%g1 + (4 * _gloffset_WindowPos3svMESA)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2s -.type glMultiTexCoord2s,#function -glMultiTexCoord2s: +.globl glAreProgramsResidentNV +.type glAreProgramsResidentNV,#function +glAreProgramsResidentNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13495,20 +14605,20 @@ glMultiTexCoord2s: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2sARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2sARB), %g2 + sethi %hi(8 * _gloffset_AreProgramsResidentNV), %g2 + or %g2, %lo(8 * _gloffset_AreProgramsResidentNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2sARB)], %g3 + ld [%g1 + (4 * _gloffset_AreProgramsResidentNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord2sv -.type glMultiTexCoord2sv,#function -glMultiTexCoord2sv: +.globl glBindProgramNV +.type glBindProgramNV,#function +glBindProgramNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13516,20 +14626,20 @@ glMultiTexCoord2sv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord2svARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord2svARB), %g2 + sethi %hi(8 * _gloffset_BindProgramNV), %g2 + or %g2, %lo(8 * _gloffset_BindProgramNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord2svARB)], %g3 + ld [%g1 + (4 * _gloffset_BindProgramNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3d -.type glMultiTexCoord3d,#function -glMultiTexCoord3d: +.globl glDeleteProgramsNV +.type glDeleteProgramsNV,#function +glDeleteProgramsNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13537,20 +14647,20 @@ glMultiTexCoord3d: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3dARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3dARB), %g2 + sethi %hi(8 * _gloffset_DeleteProgramsNV), %g2 + or %g2, %lo(8 * _gloffset_DeleteProgramsNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3dARB)], %g3 + ld [%g1 + (4 * _gloffset_DeleteProgramsNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3dv -.type glMultiTexCoord3dv,#function -glMultiTexCoord3dv: +.globl glExecuteProgramNV +.type glExecuteProgramNV,#function +glExecuteProgramNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13558,20 +14668,20 @@ glMultiTexCoord3dv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3dvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3dvARB), %g2 + sethi %hi(8 * _gloffset_ExecuteProgramNV), %g2 + or %g2, %lo(8 * _gloffset_ExecuteProgramNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3dvARB)], %g3 + ld [%g1 + (4 * _gloffset_ExecuteProgramNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3f -.type glMultiTexCoord3f,#function -glMultiTexCoord3f: +.globl glGenProgramsNV +.type glGenProgramsNV,#function +glGenProgramsNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13579,20 +14689,20 @@ glMultiTexCoord3f: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3fARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3fARB), %g2 + sethi %hi(8 * _gloffset_GenProgramsNV), %g2 + or %g2, %lo(8 * _gloffset_GenProgramsNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3fARB)], %g3 + ld [%g1 + (4 * _gloffset_GenProgramsNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3fv -.type glMultiTexCoord3fv,#function -glMultiTexCoord3fv: +.globl glGetProgramParameterdvNV +.type glGetProgramParameterdvNV,#function +glGetProgramParameterdvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13600,20 +14710,20 @@ glMultiTexCoord3fv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3fvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3fvARB), %g2 + sethi %hi(8 * _gloffset_GetProgramParameterdvNV), %g2 + or %g2, %lo(8 * _gloffset_GetProgramParameterdvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3fvARB)], %g3 + ld [%g1 + (4 * _gloffset_GetProgramParameterdvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3i -.type glMultiTexCoord3i,#function -glMultiTexCoord3i: +.globl glGetProgramParameterfvNV +.type glGetProgramParameterfvNV,#function +glGetProgramParameterfvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13621,20 +14731,20 @@ glMultiTexCoord3i: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3iARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3iARB), %g2 + sethi %hi(8 * _gloffset_GetProgramParameterfvNV), %g2 + or %g2, %lo(8 * _gloffset_GetProgramParameterfvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3iARB)], %g3 + ld [%g1 + (4 * _gloffset_GetProgramParameterfvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3iv -.type glMultiTexCoord3iv,#function -glMultiTexCoord3iv: +.globl glGetProgramivNV +.type glGetProgramivNV,#function +glGetProgramivNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13642,20 +14752,20 @@ glMultiTexCoord3iv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3ivARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3ivARB), %g2 + sethi %hi(8 * _gloffset_GetProgramivNV), %g2 + or %g2, %lo(8 * _gloffset_GetProgramivNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3ivARB)], %g3 + ld [%g1 + (4 * _gloffset_GetProgramivNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3s -.type glMultiTexCoord3s,#function -glMultiTexCoord3s: +.globl glGetProgramStringNV +.type glGetProgramStringNV,#function +glGetProgramStringNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13663,20 +14773,20 @@ glMultiTexCoord3s: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3sARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3sARB), %g2 + sethi %hi(8 * _gloffset_GetProgramStringNV), %g2 + or %g2, %lo(8 * _gloffset_GetProgramStringNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3sARB)], %g3 + ld [%g1 + (4 * _gloffset_GetProgramStringNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord3sv -.type glMultiTexCoord3sv,#function -glMultiTexCoord3sv: +.globl glGetTrackMatrixivNV +.type glGetTrackMatrixivNV,#function +glGetTrackMatrixivNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13684,20 +14794,20 @@ glMultiTexCoord3sv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord3svARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord3svARB), %g2 + sethi %hi(8 * _gloffset_GetTrackMatrixivNV), %g2 + or %g2, %lo(8 * _gloffset_GetTrackMatrixivNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord3svARB)], %g3 + ld [%g1 + (4 * _gloffset_GetTrackMatrixivNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4d -.type glMultiTexCoord4d,#function -glMultiTexCoord4d: +.globl glGetVertexAttribdvNV +.type glGetVertexAttribdvNV,#function +glGetVertexAttribdvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13705,20 +14815,20 @@ glMultiTexCoord4d: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4dARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4dARB), %g2 + sethi %hi(8 * _gloffset_GetVertexAttribdvNV), %g2 + or %g2, %lo(8 * _gloffset_GetVertexAttribdvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4dARB)], %g3 + ld [%g1 + (4 * _gloffset_GetVertexAttribdvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4dv -.type glMultiTexCoord4dv,#function -glMultiTexCoord4dv: +.globl glGetVertexAttribfvNV +.type glGetVertexAttribfvNV,#function +glGetVertexAttribfvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13726,20 +14836,20 @@ glMultiTexCoord4dv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4dvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4dvARB), %g2 + sethi %hi(8 * _gloffset_GetVertexAttribfvNV), %g2 + or %g2, %lo(8 * _gloffset_GetVertexAttribfvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4dvARB)], %g3 + ld [%g1 + (4 * _gloffset_GetVertexAttribfvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4f -.type glMultiTexCoord4f,#function -glMultiTexCoord4f: +.globl glGetVertexAttribivNV +.type glGetVertexAttribivNV,#function +glGetVertexAttribivNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13747,20 +14857,20 @@ glMultiTexCoord4f: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4fARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4fARB), %g2 + sethi %hi(8 * _gloffset_GetVertexAttribivNV), %g2 + or %g2, %lo(8 * _gloffset_GetVertexAttribivNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4fARB)], %g3 + ld [%g1 + (4 * _gloffset_GetVertexAttribivNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4fv -.type glMultiTexCoord4fv,#function -glMultiTexCoord4fv: +.globl glGetVertexAttribPointervNV +.type glGetVertexAttribPointervNV,#function +glGetVertexAttribPointervNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13768,20 +14878,20 @@ glMultiTexCoord4fv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4fvARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4fvARB), %g2 + sethi %hi(8 * _gloffset_GetVertexAttribPointervNV), %g2 + or %g2, %lo(8 * _gloffset_GetVertexAttribPointervNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4fvARB)], %g3 + ld [%g1 + (4 * _gloffset_GetVertexAttribPointervNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4i -.type glMultiTexCoord4i,#function -glMultiTexCoord4i: +.globl glIsProgramNV +.type glIsProgramNV,#function +glIsProgramNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13789,20 +14899,20 @@ glMultiTexCoord4i: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4iARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4iARB), %g2 + sethi %hi(8 * _gloffset_IsProgramNV), %g2 + or %g2, %lo(8 * _gloffset_IsProgramNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4iARB)], %g3 + ld [%g1 + (4 * _gloffset_IsProgramNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4iv -.type glMultiTexCoord4iv,#function -glMultiTexCoord4iv: +.globl glLoadProgramNV +.type glLoadProgramNV,#function +glLoadProgramNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13810,20 +14920,20 @@ glMultiTexCoord4iv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4ivARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4ivARB), %g2 + sethi %hi(8 * _gloffset_LoadProgramNV), %g2 + or %g2, %lo(8 * _gloffset_LoadProgramNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4ivARB)], %g3 + ld [%g1 + (4 * _gloffset_LoadProgramNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4s -.type glMultiTexCoord4s,#function -glMultiTexCoord4s: +.globl glProgramParameter4dNV +.type glProgramParameter4dNV,#function +glProgramParameter4dNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13831,20 +14941,20 @@ glMultiTexCoord4s: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4sARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4sARB), %g2 + sethi %hi(8 * _gloffset_ProgramParameter4dNV), %g2 + or %g2, %lo(8 * _gloffset_ProgramParameter4dNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4sARB)], %g3 + ld [%g1 + (4 * _gloffset_ProgramParameter4dNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultiTexCoord4sv -.type glMultiTexCoord4sv,#function -glMultiTexCoord4sv: +.globl glProgramParameter4dvNV +.type glProgramParameter4dvNV,#function +glProgramParameter4dvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13852,20 +14962,20 @@ glMultiTexCoord4sv: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultiTexCoord4svARB), %g2 - or %g2, %lo(8 * _gloffset_MultiTexCoord4svARB), %g2 + sethi %hi(8 * _gloffset_ProgramParameter4dvNV), %g2 + or %g2, %lo(8 * _gloffset_ProgramParameter4dvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultiTexCoord4svARB)], %g3 + ld [%g1 + (4 * _gloffset_ProgramParameter4dvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glLoadTransposeMatrixd -.type glLoadTransposeMatrixd,#function -glLoadTransposeMatrixd: +.globl glProgramParameter4fNV +.type glProgramParameter4fNV,#function +glProgramParameter4fNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13873,20 +14983,20 @@ glLoadTransposeMatrixd: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_LoadTransposeMatrixdARB), %g2 - or %g2, %lo(8 * _gloffset_LoadTransposeMatrixdARB), %g2 + sethi %hi(8 * _gloffset_ProgramParameter4fNV), %g2 + or %g2, %lo(8 * _gloffset_ProgramParameter4fNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_LoadTransposeMatrixdARB)], %g3 + ld [%g1 + (4 * _gloffset_ProgramParameter4fNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glLoadTransposeMatrixf -.type glLoadTransposeMatrixf,#function -glLoadTransposeMatrixf: +.globl glProgramParameter4fvNV +.type glProgramParameter4fvNV,#function +glProgramParameter4fvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13894,20 +15004,20 @@ glLoadTransposeMatrixf: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_LoadTransposeMatrixfARB), %g2 - or %g2, %lo(8 * _gloffset_LoadTransposeMatrixfARB), %g2 + sethi %hi(8 * _gloffset_ProgramParameter4fvNV), %g2 + or %g2, %lo(8 * _gloffset_ProgramParameter4fvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_LoadTransposeMatrixfARB)], %g3 + ld [%g1 + (4 * _gloffset_ProgramParameter4fvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultTransposeMatrixd -.type glMultTransposeMatrixd,#function -glMultTransposeMatrixd: +.globl glProgramParameters4dvNV +.type glProgramParameters4dvNV,#function +glProgramParameters4dvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13915,20 +15025,20 @@ glMultTransposeMatrixd: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultTransposeMatrixdARB), %g2 - or %g2, %lo(8 * _gloffset_MultTransposeMatrixdARB), %g2 + sethi %hi(8 * _gloffset_ProgramParameters4dvNV), %g2 + or %g2, %lo(8 * _gloffset_ProgramParameters4dvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultTransposeMatrixdARB)], %g3 + ld [%g1 + (4 * _gloffset_ProgramParameters4dvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glMultTransposeMatrixf -.type glMultTransposeMatrixf,#function -glMultTransposeMatrixf: +.globl glProgramParameters4fvNV +.type glProgramParameters4fvNV,#function +glProgramParameters4fvNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13936,20 +15046,20 @@ glMultTransposeMatrixf: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_MultTransposeMatrixfARB), %g2 - or %g2, %lo(8 * _gloffset_MultTransposeMatrixfARB), %g2 + sethi %hi(8 * _gloffset_ProgramParameters4fvNV), %g2 + or %g2, %lo(8 * _gloffset_ProgramParameters4fvNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_MultTransposeMatrixfARB)], %g3 + ld [%g1 + (4 * _gloffset_ProgramParameters4fvNV)], %g3 #endif jmpl %g3, %g0 nop -.globl glSampleCoverage -.type glSampleCoverage,#function -glSampleCoverage: +.globl glRequestResidentProgramsNV +.type glRequestResidentProgramsNV,#function +glRequestResidentProgramsNV: #ifdef __sparc_v9__ sethi %hi(0x00000000), %g2 sethi %hi(0x00000000), %g1 @@ -13957,17 +15067,1886 @@ glSampleCoverage: or %g1, %lo(0x00000000), %g1 sllx %g2, 32, %g2 ldx [%g1 + %g2], %g1 - sethi %hi(8 * _gloffset_SampleCoverageARB), %g2 - or %g2, %lo(8 * _gloffset_SampleCoverageARB), %g2 + sethi %hi(8 * _gloffset_RequestResidentProgramsNV), %g2 + or %g2, %lo(8 * _gloffset_RequestResidentProgramsNV), %g2 ldx [%g1 + %g2], %g3 #else sethi %hi(0x00000000), %g1 ld [%g1 + %lo(0x00000000)], %g1 - ld [%g1 + (4 * _gloffset_SampleCoverageARB)], %g3 + ld [%g1 + (4 * _gloffset_RequestResidentProgramsNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glTrackMatrixNV +.type glTrackMatrixNV,#function +glTrackMatrixNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_TrackMatrixNV), %g2 + or %g2, %lo(8 * _gloffset_TrackMatrixNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_TrackMatrixNV)], %g3 #endif jmpl %g3, %g0 nop +.globl glVertexAttribPointerNV +.type glVertexAttribPointerNV,#function +glVertexAttribPointerNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribPointerNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribPointerNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribPointerNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib1dNV +.type glVertexAttrib1dNV,#function +glVertexAttrib1dNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib1dNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib1dNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib1dNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib1dvNV +.type glVertexAttrib1dvNV,#function +glVertexAttrib1dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib1dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib1dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib1dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib1fNV +.type glVertexAttrib1fNV,#function +glVertexAttrib1fNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib1fNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib1fNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib1fNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib1fvNV +.type glVertexAttrib1fvNV,#function +glVertexAttrib1fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib1fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib1fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib1fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib1sNV +.type glVertexAttrib1sNV,#function +glVertexAttrib1sNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib1sNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib1sNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib1sNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib1svNV +.type glVertexAttrib1svNV,#function +glVertexAttrib1svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib1svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib1svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib1svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib2dNV +.type glVertexAttrib2dNV,#function +glVertexAttrib2dNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib2dNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib2dNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib2dNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib2dvNV +.type glVertexAttrib2dvNV,#function +glVertexAttrib2dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib2dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib2dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib2dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib2fNV +.type glVertexAttrib2fNV,#function +glVertexAttrib2fNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib2fNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib2fNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib2fNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib2fvNV +.type glVertexAttrib2fvNV,#function +glVertexAttrib2fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib2fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib2fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib2fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib2sNV +.type glVertexAttrib2sNV,#function +glVertexAttrib2sNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib2sNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib2sNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib2sNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib2svNV +.type glVertexAttrib2svNV,#function +glVertexAttrib2svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib2svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib2svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib2svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib3dNV +.type glVertexAttrib3dNV,#function +glVertexAttrib3dNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib3dNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib3dNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib3dNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib3dvNV +.type glVertexAttrib3dvNV,#function +glVertexAttrib3dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib3dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib3dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib3dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib3fNV +.type glVertexAttrib3fNV,#function +glVertexAttrib3fNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib3fNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib3fNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib3fNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib3fvNV +.type glVertexAttrib3fvNV,#function +glVertexAttrib3fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib3fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib3fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib3fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib3sNV +.type glVertexAttrib3sNV,#function +glVertexAttrib3sNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib3sNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib3sNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib3sNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib3svNV +.type glVertexAttrib3svNV,#function +glVertexAttrib3svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib3svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib3svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib3svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4dNV +.type glVertexAttrib4dNV,#function +glVertexAttrib4dNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4dNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4dNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4dNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4dvNV +.type glVertexAttrib4dvNV,#function +glVertexAttrib4dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4fNV +.type glVertexAttrib4fNV,#function +glVertexAttrib4fNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4fNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4fNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4fNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4fvNV +.type glVertexAttrib4fvNV,#function +glVertexAttrib4fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4sNV +.type glVertexAttrib4sNV,#function +glVertexAttrib4sNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4sNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4sNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4sNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4svNV +.type glVertexAttrib4svNV,#function +glVertexAttrib4svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4ubNV +.type glVertexAttrib4ubNV,#function +glVertexAttrib4ubNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4ubNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4ubNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4ubNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttrib4ubvNV +.type glVertexAttrib4ubvNV,#function +glVertexAttrib4ubvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttrib4ubvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttrib4ubvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttrib4ubvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs1dvNV +.type glVertexAttribs1dvNV,#function +glVertexAttribs1dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs1dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs1dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs1dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs1fvNV +.type glVertexAttribs1fvNV,#function +glVertexAttribs1fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs1fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs1fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs1fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs1svNV +.type glVertexAttribs1svNV,#function +glVertexAttribs1svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs1svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs1svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs1svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs2dvNV +.type glVertexAttribs2dvNV,#function +glVertexAttribs2dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs2dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs2dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs2dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs2fvNV +.type glVertexAttribs2fvNV,#function +glVertexAttribs2fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs2fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs2fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs2fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs2svNV +.type glVertexAttribs2svNV,#function +glVertexAttribs2svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs2svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs2svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs2svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs3dvNV +.type glVertexAttribs3dvNV,#function +glVertexAttribs3dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs3dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs3dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs3dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs3fvNV +.type glVertexAttribs3fvNV,#function +glVertexAttribs3fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs3fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs3fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs3fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs3svNV +.type glVertexAttribs3svNV,#function +glVertexAttribs3svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs3svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs3svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs3svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs4dvNV +.type glVertexAttribs4dvNV,#function +glVertexAttribs4dvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs4dvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs4dvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs4dvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs4fvNV +.type glVertexAttribs4fvNV,#function +glVertexAttribs4fvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs4fvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs4fvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs4fvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs4svNV +.type glVertexAttribs4svNV,#function +glVertexAttribs4svNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs4svNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs4svNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs4svNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glVertexAttribs4ubvNV +.type glVertexAttribs4ubvNV,#function +glVertexAttribs4ubvNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_VertexAttribs4ubvNV), %g2 + or %g2, %lo(8 * _gloffset_VertexAttribs4ubvNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_VertexAttribs4ubvNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameteriNV +.type glPointParameteriNV,#function +glPointParameteriNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameteriNV), %g2 + or %g2, %lo(8 * _gloffset_PointParameteriNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameteriNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameterivNV +.type glPointParameterivNV,#function +glPointParameterivNV: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameterivNV), %g2 + or %g2, %lo(8 * _gloffset_PointParameterivNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameterivNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glBlendFuncSeparate +.type glBlendFuncSeparate,#function +glBlendFuncSeparate: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_BlendFuncSeparateEXT), %g2 + or %g2, %lo(8 * _gloffset_BlendFuncSeparateEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_BlendFuncSeparateEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glFogCoordf +.type glFogCoordf,#function +glFogCoordf: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_FogCoordfEXT), %g2 + or %g2, %lo(8 * _gloffset_FogCoordfEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_FogCoordfEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glFogCoordfv +.type glFogCoordfv,#function +glFogCoordfv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_FogCoordfvEXT), %g2 + or %g2, %lo(8 * _gloffset_FogCoordfvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_FogCoordfvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glFogCoordd +.type glFogCoordd,#function +glFogCoordd: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_FogCoorddEXT), %g2 + or %g2, %lo(8 * _gloffset_FogCoorddEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_FogCoorddEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glFogCoorddv +.type glFogCoorddv,#function +glFogCoorddv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_FogCoorddvEXT), %g2 + or %g2, %lo(8 * _gloffset_FogCoorddvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_FogCoorddvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glFogCoordPointer +.type glFogCoordPointer,#function +glFogCoordPointer: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_FogCoordPointerEXT), %g2 + or %g2, %lo(8 * _gloffset_FogCoordPointerEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_FogCoordPointerEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiDrawArrays +.type glMultiDrawArrays,#function +glMultiDrawArrays: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiDrawArraysEXT), %g2 + or %g2, %lo(8 * _gloffset_MultiDrawArraysEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiDrawArraysEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glMultiDrawElements +.type glMultiDrawElements,#function +glMultiDrawElements: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_MultiDrawElementsEXT), %g2 + or %g2, %lo(8 * _gloffset_MultiDrawElementsEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_MultiDrawElementsEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameterf +.type glPointParameterf,#function +glPointParameterf: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameterfEXT), %g2 + or %g2, %lo(8 * _gloffset_PointParameterfEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameterfEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameterfv +.type glPointParameterfv,#function +glPointParameterfv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameterfvEXT), %g2 + or %g2, %lo(8 * _gloffset_PointParameterfvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameterfvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameteri +.type glPointParameteri,#function +glPointParameteri: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameteriNV), %g2 + or %g2, %lo(8 * _gloffset_PointParameteriNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameteriNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glPointParameteriv +.type glPointParameteriv,#function +glPointParameteriv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_PointParameterivNV), %g2 + or %g2, %lo(8 * _gloffset_PointParameterivNV), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_PointParameterivNV)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3b +.type glSecondaryColor3b,#function +glSecondaryColor3b: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3bEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3bEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3bEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3bv +.type glSecondaryColor3bv,#function +glSecondaryColor3bv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3bvEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3bvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3bvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3d +.type glSecondaryColor3d,#function +glSecondaryColor3d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3dEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3dEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3dEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3dv +.type glSecondaryColor3dv,#function +glSecondaryColor3dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3dvEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3dvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3dvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3f +.type glSecondaryColor3f,#function +glSecondaryColor3f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3fEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3fEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3fEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3fv +.type glSecondaryColor3fv,#function +glSecondaryColor3fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3fvEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3fvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3fvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3i +.type glSecondaryColor3i,#function +glSecondaryColor3i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3iEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3iEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3iEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3iv +.type glSecondaryColor3iv,#function +glSecondaryColor3iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3ivEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3ivEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3ivEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3s +.type glSecondaryColor3s,#function +glSecondaryColor3s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3sEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3sEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3sEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3sv +.type glSecondaryColor3sv,#function +glSecondaryColor3sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3svEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3svEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3svEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3ub +.type glSecondaryColor3ub,#function +glSecondaryColor3ub: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3ubEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3ubEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3ubEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3ubv +.type glSecondaryColor3ubv,#function +glSecondaryColor3ubv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3ubvEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3ubvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3ubvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3ui +.type glSecondaryColor3ui,#function +glSecondaryColor3ui: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3uiEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3uiEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3uiEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3uiv +.type glSecondaryColor3uiv,#function +glSecondaryColor3uiv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3uivEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3uivEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3uivEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3us +.type glSecondaryColor3us,#function +glSecondaryColor3us: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3usEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3usEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3usEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColor3usv +.type glSecondaryColor3usv,#function +glSecondaryColor3usv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColor3usvEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColor3usvEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColor3usvEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glSecondaryColorPointer +.type glSecondaryColorPointer,#function +glSecondaryColorPointer: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_SecondaryColorPointerEXT), %g2 + or %g2, %lo(8 * _gloffset_SecondaryColorPointerEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_SecondaryColorPointerEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2d +.type glWindowPos2d,#function +glWindowPos2d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2dMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2dMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2dMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2dv +.type glWindowPos2dv,#function +glWindowPos2dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2dvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2dvMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2dvMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2f +.type glWindowPos2f,#function +glWindowPos2f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2fMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2fMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2fMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2fv +.type glWindowPos2fv,#function +glWindowPos2fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2fvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2fvMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2fvMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2i +.type glWindowPos2i,#function +glWindowPos2i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2iMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2iMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2iMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2iv +.type glWindowPos2iv,#function +glWindowPos2iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2ivMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2ivMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2ivMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2s +.type glWindowPos2s,#function +glWindowPos2s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2sMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2sMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2sMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos2sv +.type glWindowPos2sv,#function +glWindowPos2sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos2svMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos2svMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos2svMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3d +.type glWindowPos3d,#function +glWindowPos3d: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3dMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3dMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3dMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3dv +.type glWindowPos3dv,#function +glWindowPos3dv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3dvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3dvMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3dvMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3f +.type glWindowPos3f,#function +glWindowPos3f: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3fMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3fMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3fMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3fv +.type glWindowPos3fv,#function +glWindowPos3fv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3fvMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3fvMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3fvMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3i +.type glWindowPos3i,#function +glWindowPos3i: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3iMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3iMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3iMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3iv +.type glWindowPos3iv,#function +glWindowPos3iv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3ivMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3ivMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3ivMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3s +.type glWindowPos3s,#function +glWindowPos3s: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3sMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3sMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3sMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glWindowPos3sv +.type glWindowPos3sv,#function +glWindowPos3sv: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_WindowPos3svMESA), %g2 + or %g2, %lo(8 * _gloffset_WindowPos3svMESA), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_WindowPos3svMESA)], %g3 +#endif + jmpl %g3, %g0 + nop + +.globl glActiveStencilFaceEXT +.type glActiveStencilFaceEXT,#function +glActiveStencilFaceEXT: +#ifdef __sparc_v9__ + sethi %hi(0x00000000), %g2 + sethi %hi(0x00000000), %g1 + or %g2, %lo(0x00000000), %g2 + or %g1, %lo(0x00000000), %g1 + sllx %g2, 32, %g2 + ldx [%g1 + %g2], %g1 + sethi %hi(8 * _gloffset_ActiveStencilFaceEXT), %g2 + or %g2, %lo(8 * _gloffset_ActiveStencilFaceEXT), %g2 + ldx [%g1 + %g2], %g3 +#else + sethi %hi(0x00000000), %g1 + ld [%g1 + %lo(0x00000000)], %g1 + ld [%g1 + (4 * _gloffset_ActiveStencilFaceEXT)], %g3 +#endif + jmpl %g3, %g0 + nop + nop .globl _mesa_sparc_glapi_end .type _mesa_sparc_glapi_end,#function diff --git a/xc/extras/Mesa/src/SPARC/sparc.c b/xc/extras/Mesa/src/SPARC/sparc.c index 666f6e918..7fe7c3fe5 100644 --- a/xc/extras/Mesa/src/SPARC/sparc.c +++ b/xc/extras/Mesa/src/SPARC/sparc.c @@ -1,4 +1,3 @@ -/* $Id: sparc.c,v 1.1.1.1 2002/10/22 13:06:32 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -30,7 +29,6 @@ #include "context.h" -#include "math/m_vertices.h" #include "math/m_xform.h" #include "tnl/t_context.h" #include "sparc.h" diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index e1e713795..279425ac1 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -47,7 +47,7 @@ #include "context.h" #include "config.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "xfonts.h" @@ -65,11 +65,22 @@ #define SERVER_MINOR_VERSION 4 /* This is appended onto the glXGetClient/ServerString version strings. */ -#define MESA_GLX_VERSION "Mesa 4.0.4" +#define MESA_GLX_VERSION "Mesa 5.0" /* Who implemented this GLX? */ #define VENDOR "Brian Paul" +#define EXTENSIONS \ + "GLX_MESA_set_3dfx_mode " \ + "GLX_MESA_copy_sub_buffer " \ + "GLX_MESA_pixmap_colormap " \ + "GLX_MESA_release_buffers " \ + "GLX_ARB_get_proc_address " \ + "GLX_EXT_visual_info " \ + "GLX_EXT_visual_rating " \ + "GLX_SGI_video_sync " \ + "GLX_SGIX_fbconfig " \ + "GLX_SGIX_pbuffer" /* Silence compiler warnings */ @@ -259,7 +270,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, if (dbFlag) { /* Check if the MESA_BACK_BUFFER env var is set */ - char *backbuffer = getenv("MESA_BACK_BUFFER"); + char *backbuffer = _mesa_getenv("MESA_BACK_BUFFER"); if (backbuffer) { if (backbuffer[0]=='p' || backbuffer[0]=='P') { ximageFlag = GL_FALSE; @@ -268,15 +279,14 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, ximageFlag = GL_TRUE; } else { - fprintf(stderr, "Mesa: invalid value for MESA_BACK_BUFFER "); - fprintf(stderr, "environment variable, using an XImage.\n"); + _mesa_warning(NULL, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage."); } } } /* Comparing IDs uses less memory but sometimes fails. */ /* XXX revisit this after 3.0 is finished. */ - if (getenv("MESA_GLX_VISUAL_HACK")) + if (_mesa_getenv("MESA_GLX_VISUAL_HACK")) comparePointers = GL_TRUE; else comparePointers = GL_FALSE; @@ -307,8 +317,8 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* Create a new visual and add it to the list. */ - if (NumVisuals>=MAX_VISUALS) { - fprintf( stderr, "GLX Error: maximum number of visuals exceeded\n"); + if (NumVisuals >= MAX_VISUALS) { + _mesa_problem(NULL, "GLX Error: maximum number of visuals exceeded"); return NULL; } @@ -319,6 +329,11 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, accumBlueSize, accumAlphaSize, 0, level, GLX_NONE_EXT ); if (xmvis) { + /* Save a copy of the pointer now so we can find this visual again + * if we need to search for it in find_glx_visual(). + */ + xmvis->vishandle = vinfo; + /* add xmvis to the list */ VisualTable[NumVisuals] = xmvis; NumVisuals++; } @@ -355,7 +370,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) ); } else if (is_usable_visual( visinfo )) { - if (getenv("MESA_GLX_FORCE_CI")) { + if (_mesa_getenv("MESA_GLX_FORCE_CI")) { /* Configure this visual as a COLOR INDEX visual. */ return save_glx_visual( dpy, visinfo, GL_FALSE, /* rgb */ @@ -391,7 +406,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) } } else { - fprintf(stderr,"Mesa: error in glXCreateContext: bad visual\n"); + _mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n"); return NULL; } } @@ -406,19 +421,21 @@ find_glx_visual( Display *dpy, XVisualInfo *vinfo ) { int i; - /* First try to match pointers */ + /* try to match visual id */ for (i=0;i<NumVisuals;i++) { - if (VisualTable[i]->display==dpy && VisualTable[i]->vishandle==vinfo) { + if (VisualTable[i]->display==dpy + && VisualTable[i]->visinfo->visualid == vinfo->visualid) { return VisualTable[i]; } } - /* try to match visual id */ + + /* if that fails, try to match pointers */ for (i=0;i<NumVisuals;i++) { - if (VisualTable[i]->display==dpy - && VisualTable[i]->visinfo->visualid == vinfo->visualid) { + if (VisualTable[i]->display==dpy && VisualTable[i]->vishandle==vinfo) { return VisualTable[i]; } } + return NULL; } @@ -554,21 +571,21 @@ static XVisualInfo *get_env_visual(Display *dpy, int scr, const char *varname) int depth, xclass = -1; XVisualInfo *vis; - if (!getenv( varname )) { + if (!_mesa_getenv( varname )) { return NULL; } - strncpy( value, getenv(varname), 100 ); + _mesa_strncpy( value, _mesa_getenv(varname), 100 ); value[99] = 0; sscanf( value, "%s %d", type, &depth ); - if (strcmp(type,"TrueColor")==0) xclass = TrueColor; - else if (strcmp(type,"DirectColor")==0) xclass = DirectColor; - else if (strcmp(type,"PseudoColor")==0) xclass = PseudoColor; - else if (strcmp(type,"StaticColor")==0) xclass = StaticColor; - else if (strcmp(type,"GrayScale")==0) xclass = GrayScale; - else if (strcmp(type,"StaticGray")==0) xclass = StaticGray; + if (_mesa_strcmp(type,"TrueColor")==0) xclass = TrueColor; + else if (_mesa_strcmp(type,"DirectColor")==0) xclass = DirectColor; + else if (_mesa_strcmp(type,"PseudoColor")==0) xclass = PseudoColor; + else if (_mesa_strcmp(type,"StaticColor")==0) xclass = StaticColor; + else if (_mesa_strcmp(type,"GrayScale")==0) xclass = GrayScale; + else if (_mesa_strcmp(type,"StaticGray")==0) xclass = StaticGray; if (xclass>-1 && depth>0) { vis = get_visual( dpy, scr, depth, xclass ); @@ -577,8 +594,9 @@ static XVisualInfo *get_env_visual(Display *dpy, int scr, const char *varname) } } - fprintf( stderr, "Mesa: GLX unable to find visual class=%s, depth=%d.\n", - type, depth ); + _mesa_warning(NULL, "GLX unable to find visual class=%s, depth=%d.", + type, depth); + return NULL; } @@ -892,10 +910,9 @@ static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr, /**********************************************************************/ -static XVisualInfo * -Fake_glXChooseVisual( Display *dpy, int screen, int *list ) +static XMesaVisual choose_visual( Display *dpy, int screen, const int *list ) { - int *parselist; + const int *parselist; XVisualInfo *vis; int min_ci = 0; int min_red=0, min_green=0, min_blue=0; @@ -914,6 +931,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) int trans_type = DONT_CARE; int trans_value = DONT_CARE; GLint caveat = DONT_CARE; + XMesaVisual xmvis = NULL; parselist = list; @@ -1036,10 +1054,47 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) caveat = *parselist++; /* ignored for now */ break; + /* + * GLX_ARB_multisample + */ + case GLX_SAMPLE_BUFFERS_ARB: + /* ms not supported */ + return NULL; + case GLX_SAMPLES_ARB: + /* ms not supported */ + return NULL; + + /* + * FBConfig attribs. + */ + case GLX_RENDER_TYPE: + parselist++; + if (*parselist == GLX_RGBA_BIT) { + rgb_flag = GL_TRUE; + } + else if (*parselist == GLX_COLOR_INDEX_BIT) { + rgb_flag = GL_FALSE; + } + else if (*parselist == 0) { + rgb_flag = GL_TRUE; + } + parselist++; + break; + case GLX_DRAWABLE_TYPE: + parselist++; + if (*parselist & ~(GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT)) { + return NULL; /* bad bit */ + } + parselist++; + break; + case None: break; + default: /* undefined attribute */ + _mesa_warning(NULL, "unexpected attrib 0x%x in choose_visual()", + *parselist); return NULL; } } @@ -1111,27 +1166,48 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) accumAlphaSize = alpha_flag ? ACCUM_BITS : 0; } - if (!save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag, - stereo_flag, depth_size, stencil_size, - accumRedSize, accumGreenSize, - accumBlueSize, accumAlphaSize, - level )) - return NULL; + xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag, + stereo_flag, depth_size, stencil_size, + accumRedSize, accumGreenSize, + accumBlueSize, accumAlphaSize, level ); } - return vis; + return xmvis; } +static XVisualInfo * +Fake_glXChooseVisual( Display *dpy, int screen, int *list ) +{ + XMesaVisual xmvis = choose_visual(dpy, screen, list); + if (xmvis) { +#if 0 + return xmvis->vishandle; +#else + /* create a new vishandle - the cached one may be stale */ + xmvis->vishandle = _mesa_malloc(sizeof(XVisualInfo)); + if (xmvis->vishandle) { + _mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); + } + return xmvis->vishandle; +#endif + } + else + return NULL; +} static GLXContext Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo, GLXContext share_list, Bool direct ) { - XMesaVisual glxvis; + XMesaVisual xmvis; struct fake_glx_context *glxCtx; struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list; + + if (!dpy || !visinfo) + return 0; + glxCtx = CALLOC_STRUCT(fake_glx_context); if (!glxCtx) return 0; @@ -1139,18 +1215,18 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo, /* deallocate unused windows/buffers */ XMesaGarbageCollect(); - glxvis = find_glx_visual( dpy, visinfo ); - if (!glxvis) { + xmvis = find_glx_visual( dpy, visinfo ); + if (!xmvis) { /* This visual wasn't found with glXChooseVisual() */ - glxvis = create_glx_visual( dpy, visinfo ); - if (!glxvis) { + xmvis = create_glx_visual( dpy, visinfo ); + if (!xmvis) { /* unusable visual */ FREE(glxCtx); return NULL; } } - glxCtx->xmesaContext = XMesaCreateContext(glxvis, + glxCtx->xmesaContext = XMesaCreateContext(xmvis, shareCtx ? shareCtx->xmesaContext : NULL); if (!glxCtx->xmesaContext) { FREE(glxCtx); @@ -1330,8 +1406,8 @@ Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ) if (b) { XMesaDestroyBuffer(b); } - else if (getenv("MESA_DEBUG")) { - fprintf( stderr, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n"); + else if (_mesa_getenv("MESA_DEBUG")) { + _mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n"); } } @@ -1404,8 +1480,8 @@ Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable ) if (buffer) { XMesaSwapBuffers(buffer); } - else if (getenv("MESA_DEBUG")) { - fprintf(stderr, "Mesa Warning: glXSwapBuffers: invalid drawable\n"); + else if (_mesa_getenv("MESA_DEBUG")) { + _mesa_warning(NULL, "Mesa: glXSwapBuffers: invalid drawable\n"); } } @@ -1421,8 +1497,8 @@ Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, if (buffer) { XMesaCopySubBuffer(buffer, x, y, width, height); } - else if (getenv("MESA_DEBUG")) { - fprintf(stderr, "Mesa Warning: glXCopySubBufferMESA: invalid drawable\n"); + else if (_mesa_getenv("MESA_DEBUG")) { + _mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n"); } } @@ -1445,40 +1521,21 @@ Fake_glXQueryVersion( Display *dpy, int *maj, int *min ) * Query the GLX attributes of the given XVisualInfo. */ static int -Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, - int attrib, int *value ) +get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig ) { - XMesaVisual glxvis; - - glxvis = find_glx_visual( dpy, visinfo ); - if (!glxvis) { - /* this visual wasn't obtained with glXChooseVisual */ - glxvis = create_glx_visual( dpy, visinfo ); - if (!glxvis) { - /* this visual can't be used for GL rendering */ - if (attrib==GLX_USE_GL) { - *value = (int) False; - return 0; - } - else { - /*fprintf( stderr, "Mesa: Error in glXGetConfig: bad visual\n");*/ - return GLX_BAD_VISUAL; - } - } - } - + ASSERT(xmvis); switch(attrib) { case GLX_USE_GL: *value = (int) True; return 0; case GLX_BUFFER_SIZE: - *value = visinfo->depth; + *value = xmvis->visinfo->depth; return 0; case GLX_LEVEL: - *value = glxvis->level; + *value = xmvis->level; return 0; case GLX_RGBA: - if (glxvis->mesa_visual.rgbMode) { + if (xmvis->mesa_visual.rgbMode) { *value = True; } else { @@ -1486,50 +1543,50 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, } return 0; case GLX_DOUBLEBUFFER: - *value = (int) glxvis->mesa_visual.doubleBufferMode; + *value = (int) xmvis->mesa_visual.doubleBufferMode; return 0; case GLX_STEREO: - *value = (int) glxvis->mesa_visual.stereoMode; + *value = (int) xmvis->mesa_visual.stereoMode; return 0; case GLX_AUX_BUFFERS: *value = (int) False; return 0; case GLX_RED_SIZE: - *value = glxvis->mesa_visual.redBits; + *value = xmvis->mesa_visual.redBits; return 0; case GLX_GREEN_SIZE: - *value = glxvis->mesa_visual.greenBits; + *value = xmvis->mesa_visual.greenBits; return 0; case GLX_BLUE_SIZE: - *value = glxvis->mesa_visual.blueBits; + *value = xmvis->mesa_visual.blueBits; return 0; case GLX_ALPHA_SIZE: - *value = glxvis->mesa_visual.alphaBits; + *value = xmvis->mesa_visual.alphaBits; return 0; case GLX_DEPTH_SIZE: - *value = glxvis->mesa_visual.depthBits; + *value = xmvis->mesa_visual.depthBits; return 0; case GLX_STENCIL_SIZE: - *value = glxvis->mesa_visual.stencilBits; + *value = xmvis->mesa_visual.stencilBits; return 0; case GLX_ACCUM_RED_SIZE: - *value = glxvis->mesa_visual.accumRedBits; + *value = xmvis->mesa_visual.accumRedBits; return 0; case GLX_ACCUM_GREEN_SIZE: - *value = glxvis->mesa_visual.accumGreenBits; + *value = xmvis->mesa_visual.accumGreenBits; return 0; case GLX_ACCUM_BLUE_SIZE: - *value = glxvis->mesa_visual.accumBlueBits; + *value = xmvis->mesa_visual.accumBlueBits; return 0; case GLX_ACCUM_ALPHA_SIZE: - *value = glxvis->mesa_visual.accumAlphaBits; + *value = xmvis->mesa_visual.accumAlphaBits; return 0; /* * GLX_EXT_visual_info extension */ case GLX_X_VISUAL_TYPE_EXT: - switch (glxvis->visinfo->CLASS) { + switch (xmvis->visinfo->CLASS) { case StaticGray: *value = GLX_STATIC_GRAY_EXT; return 0; case GrayScale: *value = GLX_GRAY_SCALE_EXT; return 0; case StaticColor: *value = GLX_STATIC_GRAY_EXT; return 0; @@ -1539,27 +1596,27 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, } return 0; case GLX_TRANSPARENT_TYPE_EXT: - if (glxvis->level==0) { + if (xmvis->level==0) { /* normal planes */ *value = GLX_NONE_EXT; } - else if (glxvis->level>0) { + else if (xmvis->level>0) { /* overlay */ - if (glxvis->mesa_visual.rgbMode) { + if (xmvis->mesa_visual.rgbMode) { *value = GLX_TRANSPARENT_RGB_EXT; } else { *value = GLX_TRANSPARENT_INDEX_EXT; } } - else if (glxvis->level<0) { + else if (xmvis->level<0) { /* underlay */ *value = GLX_NONE_EXT; } return 0; case GLX_TRANSPARENT_INDEX_VALUE_EXT: { - int pixel = transparent_pixel( glxvis ); + int pixel = transparent_pixel( xmvis ); if (pixel>=0) { *value = pixel; } @@ -1584,21 +1641,108 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, */ case GLX_VISUAL_CAVEAT_EXT: /* test for zero, just in case */ - if (glxvis->VisualCaveat > 0) - *value = glxvis->VisualCaveat; + if (xmvis->VisualCaveat > 0) + *value = xmvis->VisualCaveat; else *value = GLX_NONE_EXT; return 0; /* - * Extensions + * GLX_ARB_multisample + */ + case GLX_SAMPLE_BUFFERS_ARB: + *value = 0; + return 0; + case GLX_SAMPLES_ARB: + *value = 0; + return 0; + + /* + * For FBConfigs: */ + case GLX_SCREEN_EXT: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = xmvis->visinfo->screen; + break; + case GLX_DRAWABLE_TYPE: /*SGIX too */ + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT; + break; + case GLX_RENDER_TYPE_SGIX: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + if (xmvis->mesa_visual.rgbMode) + *value = GLX_RGBA_BIT; + else + *value = GLX_COLOR_INDEX_BIT; + break; + case GLX_X_RENDERABLE_SGIX: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = True; /* XXX really? */ + break; + case GLX_FBCONFIG_ID_SGIX: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = xmvis->visinfo->visualid; + break; + case GLX_MAX_PBUFFER_WIDTH: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + /* XXX or MAX_WIDTH? */ + *value = DisplayWidth(xmvis->display, xmvis->visinfo->screen); + break; + case GLX_MAX_PBUFFER_HEIGHT: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = DisplayHeight(xmvis->display, xmvis->visinfo->screen); + break; + case GLX_MAX_PBUFFER_PIXELS: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = DisplayWidth(xmvis->display, xmvis->visinfo->screen) * + DisplayHeight(xmvis->display, xmvis->visinfo->screen); + break; + case GLX_VISUAL_ID: + if (!fbconfig) + return GLX_BAD_ATTRIBUTE; + *value = xmvis->visinfo->visualid; + break; + default: return GLX_BAD_ATTRIBUTE; } + return Success; } +static int +Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, + int attrib, int *value ) +{ + XMesaVisual xmvis; + + xmvis = find_glx_visual( dpy, visinfo ); + if (!xmvis) { + /* this visual wasn't obtained with glXChooseVisual */ + xmvis = create_glx_visual( dpy, visinfo ); + if (!xmvis) { + /* this visual can't be used for GL rendering */ + if (attrib==GLX_USE_GL) { + *value = (int) False; + return 0; + } + else { + return GLX_BAD_VISUAL; + } + } + } + + return get_config(xmvis, attrib, value, GL_FALSE); +} + static void Fake_glXWaitGL( void ) @@ -1617,18 +1761,16 @@ Fake_glXWaitX( void ) } -/* - * Return the extensions string, which is 3Dfx-dependant. - */ -static const char *get_extensions( void ) +static const char * +get_extensions( void ) { #ifdef FX - const char *fx = getenv("MESA_GLX_FX"); + const char *fx = _mesa_getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address"; + return EXTENSIONS; } #endif - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address"; + return EXTENSIONS + 23; /* skip "GLX_MESA_set_3dfx_mode" */ } @@ -1649,8 +1791,8 @@ static const char * Fake_glXQueryServerString( Display *dpy, int screen, int name ) { static char version[1000]; - sprintf(version, "%d.%d %s", SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION, - MESA_GLX_VERSION); + _mesa_sprintf(version, "%d.%d %s", + SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION, MESA_GLX_VERSION); (void) dpy; (void) screen; @@ -1674,8 +1816,8 @@ static const char * Fake_glXGetClientString( Display *dpy, int name ) { static char version[1000]; - sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION, CLIENT_MINOR_VERSION, - MESA_GLX_VERSION); + _mesa_sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION, + CLIENT_MINOR_VERSION, MESA_GLX_VERSION); (void) dpy; @@ -1697,24 +1839,26 @@ Fake_glXGetClientString( Display *dpy, int name ) * GLX 1.3 and later */ -/* XXX Move this when done. - * Create an XMesaBuffer as a Pbuffer. - * New in Mesa 4.0 but untested. - */ -extern XMesaBuffer XMesaCreatePBuffer( XMesaVisual v, XMesaColormap cmap, - unsigned int width, unsigned int height ); - - static GLXFBConfig * Fake_glXChooseFBConfig( Display *dpy, int screen, const int *attribList, int *nitems ) { - (void) dpy; - (void) screen; - (void) attribList; - (void) nitems; - return 0; + XMesaVisual xmvis = choose_visual(dpy, screen, attribList); + if (xmvis) { + GLXFBConfig *config = _mesa_malloc(sizeof(XMesaVisual)); + if (!config) { + *nitems = 0; + return NULL; + } + *nitems = 1; + config[0] = (GLXFBConfig) xmvis; + return (GLXFBConfig *) config; + } + else { + *nitems = 0; + return NULL; + } } @@ -1722,168 +1866,40 @@ static int Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, int attribute, int *value ) { - XMesaVisual v = NULL; /* XXX Fix this */ + XMesaVisual v = (XMesaVisual) config; (void) dpy; (void) config; - (void) attribute; - (void) value; if (!dpy || !config || !value) return -1; - switch (attribute) { - case GLX_FBCONFIG_ID: - case GLX_BUFFER_SIZE: - if (v->mesa_visual.rgbMode) - *value = v->mesa_visual.redBits + v->mesa_visual.greenBits + - v->mesa_visual.blueBits + v->mesa_visual.alphaBits; - else - *value = v->mesa_visual.indexBits; - break; - case GLX_LEVEL: - *value = v->level; - break; - case GLX_DOUBLEBUFFER: - *value = v->mesa_visual.doubleBufferMode; - break; - case GLX_STEREO: - *value = v->mesa_visual.stereoMode; - break; - case GLX_AUX_BUFFERS: - *value = v->mesa_visual.numAuxBuffers; - break; - case GLX_RED_SIZE: - *value = v->mesa_visual.redBits; - break; - case GLX_GREEN_SIZE: - *value = v->mesa_visual.greenBits; - break; - case GLX_BLUE_SIZE: - *value = v->mesa_visual.blueBits; - break; - case GLX_ALPHA_SIZE: - *value = v->mesa_visual.alphaBits; - break; - case GLX_DEPTH_SIZE: - *value = v->mesa_visual.depthBits; - break; - case GLX_STENCIL_SIZE: - *value = v->mesa_visual.stencilBits; - break; - case GLX_ACCUM_RED_SIZE: - *value = v->mesa_visual.accumRedBits; - break; - case GLX_ACCUM_GREEN_SIZE: - *value = v->mesa_visual.accumGreenBits; - break; - case GLX_ACCUM_BLUE_SIZE: - *value = v->mesa_visual.accumBlueBits; - break; - case GLX_ACCUM_ALPHA_SIZE: - *value = v->mesa_visual.accumAlphaBits; - break; - case GLX_RENDER_TYPE: - *value = 0; /* XXX ??? */ - break; - case GLX_DRAWABLE_TYPE: - *value = GLX_PBUFFER_BIT; /* XXX fix? */ - break; - case GLX_X_RENDERABLE: - *value = False; /* XXX ??? */ - break; - case GLX_X_VISUAL_TYPE: -#if defined(__cplusplus) || defined(c_plusplus) - switch (v->vishandle->c_class) { -#else - switch (v->vishandle->class) { -#endif - case GrayScale: - *value = GLX_GRAY_SCALE; - break; - case StaticGray: - *value = GLX_STATIC_GRAY; - break; - case StaticColor: - *value = GLX_STATIC_COLOR; - break; - case PseudoColor: - *value = GLX_PSEUDO_COLOR; - break; - case TrueColor: - *value = GLX_TRUE_COLOR; - break; - case DirectColor: - *value = GLX_DIRECT_COLOR; - break; - default: - *value = 0; - } - break; - case GLX_CONFIG_CAVEAT: - *value = 0; /* XXX ??? */ - break; - case GLX_TRANSPARENT_TYPE: - if (v->level == 0) { - /* normal planes */ - *value = GLX_NONE_EXT; - } - else if (v->level > 0) { - /* overlay */ - if (v->mesa_visual.rgbMode) { - *value = GLX_TRANSPARENT_RGB_EXT; - } - else { - *value = GLX_TRANSPARENT_INDEX_EXT; - } - } - else if (v->level < 0) { - /* underlay */ - *value = GLX_NONE_EXT; - } - break; - case GLX_TRANSPARENT_INDEX_VALUE: - *value = transparent_pixel( v ); - break; - case GLX_TRANSPARENT_RED_VALUE: - *value = 0; /* not implemented */ - break; - case GLX_TRANSPARENT_GREEN_VALUE: - *value = 0; /* not implemented */ - break; - case GLX_TRANSPARENT_BLUE_VALUE: - *value = 0; /* not implemented */ - break; - case GLX_TRANSPARENT_ALPHA_VALUE: - *value = 0; /* not implemented */ - break; - case GLX_MAX_PBUFFER_WIDTH: - *value = DisplayWidth(dpy, v->vishandle->screen); - break; - case GLX_MAX_PBUFFER_HEIGHT: - *value = DisplayHeight(dpy, v->vishandle->screen); - break; - case GLX_MAX_PBUFFER_PIXELS: - *value = DisplayWidth(dpy, v->vishandle->screen) * - DisplayHeight(dpy, v->vishandle->screen); - break; - case GLX_VISUAL_ID: - *value = v->vishandle->visualid; - break; - default: - return GLX_BAD_ATTRIBUTE; - } - - return Success; + return get_config(v, attribute, value, GL_TRUE); } static GLXFBConfig * Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements ) { - (void) dpy; - (void) screen; - (void) nelements; - return 0; + XVisualInfo *visuals, visTemplate; + const long visMask = VisualScreenMask; + int i; + + /* Get list of all X visuals */ + visTemplate.screen = screen; + visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements); + if (*nelements > 0) { + XMesaVisual *results; + results = _mesa_malloc(*nelements * sizeof(XMesaVisual)); + if (!results) { + *nelements = 0; + return NULL; + } + for (i = 0; i < *nelements; i++) { + results[i] = create_glx_visual(dpy, visuals + i); + } + return (GLXFBConfig *) results; + } + return NULL; } @@ -1891,8 +1907,17 @@ static XVisualInfo * Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { if (dpy && config) { - XMesaVisual v = (XMesaVisual) config; - return v->vishandle; + XMesaVisual xmvis = (XMesaVisual) config; +#if 0 + return xmvis->vishandle; +#else + /* create a new vishandle - the cached one may be stale */ + xmvis->vishandle = _mesa_malloc(sizeof(XVisualInfo)); + if (xmvis->vishandle) { + _mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo)); + } + return xmvis->vishandle; +#endif } else { return NULL; @@ -1929,7 +1954,6 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList ) { XMesaVisual v = (XMesaVisual) config; - XVisualInfo *visinfo; XMesaBuffer b; (void) dpy; @@ -1940,17 +1964,6 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap, if (!dpy || !config || !pixmap) return 0; - visinfo = v->vishandle; - - v = find_glx_visual( dpy, visinfo ); - if (!v) { - v = create_glx_visual( dpy, visinfo ); - if (!v) { - /* unusable visual */ - return 0; - } - } - b = XMesaCreatePixmapBuffer( v, pixmap, 0 ); if (!b) { return 0; @@ -1974,26 +1987,31 @@ static GLXPbuffer Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList ) { + XMesaVisual xmvis = (XMesaVisual) config; + XMesaBuffer xmbuf; const int *attrib; int width = 0, height = 0; GLboolean useLargest = GL_FALSE, preserveContents = GL_FALSE; (void) dpy; - (void) config; - for (attrib = attribList; attrib; attrib++) { + for (attrib = attribList; *attrib; attrib++) { switch (*attrib) { case GLX_PBUFFER_WIDTH: - width = *(++attrib); + attrib++; + width = *attrib; break; case GLX_PBUFFER_HEIGHT: - height = *(++attrib); + attrib++; + height = *attrib; break; case GLX_PRESERVED_CONTENTS: - preserveContents = GL_TRUE; /* ignored */ + attrib++; + preserveContents = *attrib; /* ignored */ break; case GLX_LARGEST_PBUFFER: - useLargest = GL_TRUE; /* ignored */ + attrib++; + useLargest = *attrib; /* ignored */ break; default: return 0; @@ -2003,16 +2021,21 @@ Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config, if (width == 0 || height == 0) return 0; - - return 0; + xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height); + /* A GLXPbuffer handle must be an X Drawable because that's what + * glXMakeCurrent takes. + */ + return (GLXPbuffer) xmbuf->frontbuffer; } static void Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ) { - (void) dpy; - (void) pbuf; + XMesaBuffer b = XMesaFindBuffer(dpy, pbuf); + if (b) { + XMesaDestroyBuffer(b); + } } @@ -2020,16 +2043,25 @@ static void Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, unsigned int *value ) { - (void) dpy; - (void) draw; + XMesaBuffer xmbuf = XMesaFindBuffer(dpy, draw); + if (!xmbuf) + return; switch (attribute) { case GLX_WIDTH: + *value = xmbuf->width; + break; case GLX_HEIGHT: + *value = xmbuf->height; + break; case GLX_PRESERVED_CONTENTS: + *value = True; + break; case GLX_LARGEST_PBUFFER: + *value = xmbuf->width * xmbuf->height; + break; case GLX_FBCONFIG_ID: - *value = 0; + *value = xmbuf->xm_visual->visinfo->visualid; return; default: return; /* GLX_BAD_ATTRIBUTE? */ @@ -2041,40 +2073,74 @@ static GLXContext Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct ) { - XMesaVisual v = (XMesaVisual) config; + struct fake_glx_context *glxCtx; + struct fake_glx_context *shareCtx = (struct fake_glx_context *) shareList; + XMesaVisual xmvis = (XMesaVisual) config; if (!dpy || !config || (renderType != GLX_RGBA_TYPE && renderType != GLX_COLOR_INDEX_TYPE)) return 0; - return Fake_glXCreateContext(dpy, v->vishandle, shareList, direct); + glxCtx = CALLOC_STRUCT(fake_glx_context); + if (!glxCtx) + return 0; + + /* deallocate unused windows/buffers */ + XMesaGarbageCollect(); + + glxCtx->xmesaContext = XMesaCreateContext(xmvis, + shareCtx ? shareCtx->xmesaContext : NULL); + if (!glxCtx->xmesaContext) { + FREE(glxCtx); + return NULL; + } + + glxCtx->xmesaContext->direct = GL_FALSE; + glxCtx->glxContext.isDirect = GL_FALSE; + glxCtx->glxContext.currentDpy = dpy; + glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */ + + assert((void *) glxCtx == (void *) &(glxCtx->glxContext)); + + return (GLXContext) glxCtx; } static int Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value ) { + struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx; + XMesaContext xmctx = glxCtx->xmesaContext; + (void) dpy; (void) ctx; switch (attribute) { case GLX_FBCONFIG_ID: + *value = xmctx->xm_visual->visinfo->visualid; + break; case GLX_RENDER_TYPE: + if (xmctx->xm_visual->mesa_visual.rgbMode) + *value = GLX_RGBA_BIT; + else + *value = GLX_COLOR_INDEX_BIT; + break; case GLX_SCREEN: *value = 0; return Success; default: return GLX_BAD_ATTRIBUTE; } + return 0; } static void Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask ) { - (void) dpy; - (void) drawable; - (void) mask; + XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable); + if (xmbuf) + xmbuf->selectedEvents = mask; } @@ -2082,9 +2148,11 @@ static void Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, unsigned long *mask ) { - (void) dpy; - (void) drawable; - (void) mask; + XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable); + if (xmbuf) + *mask = xmbuf->selectedEvents; + else + *mask = 0; } @@ -2125,11 +2193,7 @@ Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) static Bool Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) { - (void) dpy; - (void) draw; - (void) read; - (void) ctx; - return False; + return Fake_glXMakeContextCurrent( dpy, draw, read, ctx ); } /* not used @@ -2207,57 +2271,74 @@ Fake_glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute, int static int Fake_glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value) { - (void) dpy; - (void) config; - (void) attribute; - (void) value; - return 0; + return Fake_glXGetFBConfigAttrib(dpy, config, attribute, value); } static GLXFBConfigSGIX * Fake_glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements) { - (void) dpy; - (void) screen; - (void) attrib_list; - (void) nelements; - return 0; + return (GLXFBConfig *) Fake_glXChooseFBConfig(dpy, screen, attrib_list, nelements); } + static GLXPixmap Fake_glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap) { - (void) dpy; - (void) config; - (void) pixmap; - return 0; + XMesaVisual xmvis = (XMesaVisual) config; + XMesaBuffer xmbuf = XMesaCreatePixmapBuffer(xmvis, pixmap, 0); + return xmbuf->frontbuffer; /* need to return an X ID */ } + static GLXContext Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct) { - (void) dpy; - (void) config; - (void) render_type; - (void) share_list; - (void) direct; - return 0; + XMesaVisual xmvis = (XMesaVisual) config; + struct fake_glx_context *glxCtx; + struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list; + + glxCtx = CALLOC_STRUCT(fake_glx_context); + if (!glxCtx) + return 0; + + /* deallocate unused windows/buffers */ + XMesaGarbageCollect(); + + glxCtx->xmesaContext = XMesaCreateContext(xmvis, + shareCtx ? shareCtx->xmesaContext : NULL); + if (!glxCtx->xmesaContext) { + FREE(glxCtx); + return NULL; + } + + glxCtx->xmesaContext->direct = GL_FALSE; + glxCtx->glxContext.isDirect = GL_FALSE; + glxCtx->glxContext.currentDpy = dpy; + glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */ + + assert((void *) glxCtx == (void *) &(glxCtx->glxContext)); + + return (GLXContext) glxCtx; } + static XVisualInfo * Fake_glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config) { - (void) dpy; - (void) config; - return NULL; + return Fake_glXGetVisualFromFBConfig(dpy, config); } + static GLXFBConfigSGIX Fake_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis) { - (void) dpy; - (void) vis; - return 0; + XMesaVisual xmvis = find_glx_visual(dpy, vis); + if (!xmvis) { + /* This visual wasn't found with glXChooseVisual() */ + xmvis = create_glx_visual(dpy, vis); + } + + return (GLXFBConfigSGIX) xmvis; } @@ -2265,47 +2346,104 @@ Fake_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis) /*** GLX_SGIX_pbuffer ***/ static GLXPbufferSGIX -Fake_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) +Fake_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, + unsigned int width, unsigned int height, + int *attribList) { + XMesaVisual xmvis = (XMesaVisual) config; + XMesaBuffer xmbuf; + const int *attrib; + GLboolean useLargest = GL_FALSE, preserveContents = GL_FALSE; + (void) dpy; - (void) config; - (void) width; - (void) height; - (void) attrib_list; - return 0; + + for (attrib = attribList; *attrib; attrib++) { + switch (*attrib) { + case GLX_PRESERVED_CONTENTS_SGIX: + attrib++; + preserveContents = *attrib; /* ignored */ + break; + case GLX_LARGEST_PBUFFER_SGIX: + attrib++; + useLargest = *attrib; /* ignored */ + break; + default: + return 0; + } + } + + xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height); + /* A GLXPbuffer handle must be an X Drawable because that's what + * glXMakeCurrent takes. + */ + return (GLXPbuffer) xmbuf->frontbuffer; } + static void Fake_glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf) { - (void) dpy; - (void) pbuf; + XMesaBuffer xmbuf = XMesaFindBuffer(dpy, pbuf); + if (xmbuf) { + XMesaDestroyBuffer(xmbuf); + } } + static int Fake_glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value) { - (void) dpy; - (void) pbuf; - (void) attribute; - (void) value; + const XMesaBuffer xmbuf = XMesaFindBuffer(dpy, pbuf); + + if (!xmbuf) { + /* Generate GLXBadPbufferSGIX for bad pbuffer */ + return 0; + } + + switch (attribute) { + case GLX_PRESERVED_CONTENTS_SGIX: + *value = True; + break; + case GLX_LARGEST_PBUFFER_SGIX: + *value = xmbuf->width * xmbuf->height; + break; + case GLX_WIDTH_SGIX: + *value = xmbuf->width; + break; + case GLX_HEIGHT_SGIX: + *value = xmbuf->height; + break; + case GLX_EVENT_MASK_SGIX: + *value = 0; /* XXX might be wrong */ + break; + default: + *value = 0; + } return 0; } + static void Fake_glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask) { - (void) dpy; - (void) drawable; - (void) mask; + XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable); + if (xmbuf) { + /* Note: we'll never generate clobber events */ + xmbuf->selectedEvents = mask; + } } + static void Fake_glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask) { - (void) dpy; - (void) drawable; - (void) mask; + XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable); + if (xmbuf) { + *mask = xmbuf->selectedEvents; + } + else { + *mask = 0; + } } @@ -2476,6 +2614,38 @@ Fake_glXSet3DfxModeMESA( int mode ) +/*** AGP memory allocation ***/ +static void * +Fake_glXAllocateMemoryNV( GLsizei size, + GLfloat readFrequency, + GLfloat writeFrequency, + GLfloat priority ) +{ + (void) size; + (void) readFrequency; + (void) writeFrequency; + (void) priority; + return NULL; +} + + +static void +Fake_glXFreeMemoryNV( GLvoid *pointer ) +{ + (void) pointer; +} + + +/*** GLX_MESA_agp_offset */ + +static GLuint +Fake_glXGetAGPOffsetMESA( const GLvoid *pointer ) +{ + (void) pointer; + return ~0; +} + + extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); struct _glxapi_table *_mesa_GetGLXDispatchTable(void) @@ -2614,5 +2784,12 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) /*** GLX_MESA_set_3dfx_mode ***/ glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA; + /*** GLX_NV_vertex_array_range ***/ + glx.AllocateMemoryNV = Fake_glXAllocateMemoryNV; + glx.FreeMemoryNV = Fake_glXFreeMemoryNV; + + /*** GLX_MESA_agp_offset ***/ + glx.GetAGPOffsetMESA = Fake_glXGetAGPOffsetMESA; + return &glx; } diff --git a/xc/extras/Mesa/src/X/glxapi.c b/xc/extras/Mesa/src/X/glxapi.c index 4ddd7a92e..0ef19ff06 100644 --- a/xc/extras/Mesa/src/X/glxapi.c +++ b/xc/extras/Mesa/src/X/glxapi.c @@ -987,6 +987,35 @@ Bool glXSet3DfxModeMESA(int mode) +/*** AGP memory allocation ***/ + +void * +glXAllocateMemoryNV( GLsizei size, + GLfloat readFrequency, + GLfloat writeFrequency, + GLfloat priority ) +{ + struct _glxapi_table *t; + Display *dpy = glXGetCurrentDisplay(); + GET_DISPATCH(dpy, t); + if (!t) + return NULL; + return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority); +} + + +void +glXFreeMemoryNV( GLvoid *pointer ) +{ + struct _glxapi_table *t; + Display *dpy = glXGetCurrentDisplay(); + GET_DISPATCH(dpy, t); + if (!t) + return; + (t->FreeMemoryNV)(pointer); +} + + /**********************************************************************/ /* GLX API management functions */ @@ -1197,6 +1226,10 @@ static struct name_address_pair GLX_functions[] = { /*** GLX_ARB_get_proc_address ***/ { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, + /*** GLX AGP memory allocation ***/ + { "glXAllocateMemoryNV", (GLvoid *) glXAllocateMemoryNV }, + { "glXFreeMemoryNV", (GLvoid *) glXFreeMemoryNV }, + { NULL, NULL } /* end of list */ }; diff --git a/xc/extras/Mesa/src/X/glxapi.h b/xc/extras/Mesa/src/X/glxapi.h index 31e257e6f..5c61334d1 100644 --- a/xc/extras/Mesa/src/X/glxapi.h +++ b/xc/extras/Mesa/src/X/glxapi.h @@ -195,6 +195,15 @@ struct _glxapi_table { /*** GLX_MESA_set_3dfx_mode ***/ Bool (*Set3DfxModeMESA)(int mode); + /*** GLX_NV_vertex_array_range ***/ + void * (*AllocateMemoryNV)( GLsizei size, + GLfloat readFrequency, + GLfloat writeFrequency, + GLfloat priority ); + void (*FreeMemoryNV)( GLvoid *pointer ); + + /*** GLX_MESA_agp_offset ***/ + GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer ); }; diff --git a/xc/extras/Mesa/src/X/glxheader.h b/xc/extras/Mesa/src/X/glxheader.h index 39b9a0211..b58340038 100644 --- a/xc/extras/Mesa/src/X/glxheader.h +++ b/xc/extras/Mesa/src/X/glxheader.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -56,6 +56,7 @@ # include <sys/shm.h> # include <X11/extensions/XShm.h> # endif +# include <GL/glx.h> #endif diff --git a/xc/extras/Mesa/src/X/realglx.c b/xc/extras/Mesa/src/X/realglx.c index bd9800532..a7783f508 100644 --- a/xc/extras/Mesa/src/X/realglx.c +++ b/xc/extras/Mesa/src/X/realglx.c @@ -1,4 +1,3 @@ -/* $Id: realglx.c,v 1.1.1.3 2002/10/22 13:05:58 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -170,5 +169,12 @@ _real_GetGLXDispatchTable(void) /*** GLX_MESA_set_3dfx_mode ***/ glx.Set3DfxModeMESA = _real_glXSet3DfxModeMESA; + /*** GLX_NV_vertex_array_range ***/ + glx.AllocateMemoryNV = _real_glXAllocateMemoryNV; + glx.FreeMemoryNV = _real_glXFreeMemoryNV; + + /*** GLX_MESA_agp_offset ***/ + glx.GetAGPOffsetMESA = _real_glXGetAGPOffsetMESA; + return &glx; } diff --git a/xc/extras/Mesa/src/X/realglx.h b/xc/extras/Mesa/src/X/realglx.h index da5924987..150129db6 100644 --- a/xc/extras/Mesa/src/X/realglx.h +++ b/xc/extras/Mesa/src/X/realglx.h @@ -1,4 +1,3 @@ -/* $Id: realglx.h,v 1.1.1.3 2002/10/22 13:05:58 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -306,6 +305,18 @@ extern Bool _real_glXSet3DfxModeMESA( int mode ); #endif +#ifdef GLX_NV_vertex_array_range +extern void * +_real_glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +extern void +_real_glXFreeMemoryNV(GLvoid *pointer); +#endif + +#ifdef GLX_MESA_agp_offset +extern GLuint +_real_glXGetAGPOffsetMESA(const GLvoid *pointer); +#endif + #ifdef GLX_MESA_copy_sub_buffer extern void _real_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, diff --git a/xc/extras/Mesa/src/X/xfonts.c b/xc/extras/Mesa/src/X/xfonts.c index d2a1a7a40..8e256e097 100644 --- a/xc/extras/Mesa/src/X/xfonts.c +++ b/xc/extras/Mesa/src/X/xfonts.c @@ -32,19 +32,9 @@ #include <GL/vms_x_fix.h> #endif -#ifdef HAVE_CONFIG_H -#include "conf.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include "GL/gl.h" -#include "GL/glx.h" +#include "glxheader.h" #include "context.h" -#include "mem.h" +#include "imports.h" #include "xfonts.h" diff --git a/xc/extras/Mesa/src/X/xm_api.c b/xc/extras/Mesa/src/X/xm_api.c index d1d4682aa..3555af027 100644 --- a/xc/extras/Mesa/src/X/xm_api.c +++ b/xc/extras/Mesa/src/X/xm_api.c @@ -1,6 +1,7 @@ + /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -21,7 +22,7 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/X/xm_api.c,v 1.5 2002/09/09 21:52:12 dawes Exp $ */ +/* $XFree86: xc/extras/Mesa/src/X/xm_api.c,v 1.2 2002/02/26 23:37:31 tsi Exp $ */ /* * This file contains the implementations of all the XMesa* functions. @@ -67,13 +68,10 @@ #include "context.h" #include "extensions.h" #include "glthread.h" +#include "imports.h" #include "matrix.h" -#include "mem.h" #include "mmath.h" #include "mtypes.h" -#ifdef HAVE_CONFIG_H -#include "conf.h" -#endif #include "macros.h" #include "texformat.h" #include "texstore.h" @@ -162,18 +160,6 @@ static short hpcr_rgbTbl[3][256] = { /* - * X/Mesa error reporting function: - */ -static void error( const char *msg ) -{ - (void)DitherValues; /* Muffle compiler */ - - if (getenv("MESA_DEBUG")) - fprintf( stderr, "X/Mesa error: %s\n", msg ); -} - - -/* * Return the host's byte order as LSBFirst or MSBFirst ala X. */ #ifndef XFree86Server @@ -267,7 +253,7 @@ static GLint gamma_adjust( GLfloat gamma, GLint value, GLint max ) } else { double x = (double) value / (double) max; - return IROUND_POS((GLfloat) max * pow(x, 1.0F/gamma)); + return IROUND_POS((GLfloat) max * _mesa_pow(x, 1.0F/gamma)); } } @@ -281,8 +267,6 @@ static GLint gamma_adjust( GLfloat gamma, GLint value, GLint max ) * visinfo - desribes the visual to be used for XImages * Return: true number of bits per pixel for XImages */ -#define GET_BITS_PER_PIXEL(xmv) bits_per_pixel(xmv) - #ifdef XFree86Server static int bits_per_pixel( XMesaVisual xmv ) @@ -499,7 +483,7 @@ static GLboolean alloc_shm_back_buffer( XMesaBuffer b ) ZPixmap, NULL, &b->shminfo, b->width, b->height ); if (b->backimage == NULL) { - error("alloc_back_buffer: Shared memory error (XShmCreateImage), disabling."); + _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (XShmCreateImage), disabling."); b->shm = 0; return GL_FALSE; } @@ -507,11 +491,10 @@ static GLboolean alloc_shm_back_buffer( XMesaBuffer b ) b->shminfo.shmid = shmget( IPC_PRIVATE, b->backimage->bytes_per_line * b->backimage->height, IPC_CREAT|0777 ); if (b->shminfo.shmid < 0) { - if (getenv("MESA_DEBUG")) - perror("alloc_back_buffer"); + _mesa_warning(NULL, "shmget failed while allocating back buffer"); XDestroyImage( b->backimage ); b->backimage = NULL; - error("alloc_back_buffer: Shared memory error (shmget), disabling."); + _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmget), disabling."); b->shm = 0; return GL_FALSE; } @@ -519,12 +502,11 @@ static GLboolean alloc_shm_back_buffer( XMesaBuffer b ) b->shminfo.shmaddr = b->backimage->data = (char*)shmat( b->shminfo.shmid, 0, 0 ); if (b->shminfo.shmaddr == (char *) -1) { - if (getenv("MESA_DEBUG")) - perror("alloc_back_buffer"); + _mesa_warning(NULL, "shmat() failed while allocating back buffer"); XDestroyImage( b->backimage ); shmctl( b->shminfo.shmid, IPC_RMID, 0 ); b->backimage = NULL; - error("alloc_back_buffer: Shared memory error (shmat), disabling."); + _mesa_warning(NULL, "alloc_back_buffer: Shared memory error (shmat), disabling."); b->shm = 0; return GL_FALSE; } @@ -627,9 +609,7 @@ void xmesa_alloc_back_buffer( XMesaBuffer b ) b->backimage = XMesaCreateImage(b->xm_visual->BitsPerPixel, b->width, b->height, NULL); #else - if (b->shm==0 - || alloc_shm_back_buffer(b)==GL_FALSE - ) { + if (b->shm==0 || alloc_shm_back_buffer(b)==GL_FALSE) { /* Allocate a regular XImage for the back buffer. */ b->backimage = XCreateImage( b->xm_visual->display, b->xm_visual->visinfo->visual, @@ -639,12 +619,12 @@ void xmesa_alloc_back_buffer( XMesaBuffer b ) 8, 0 ); /* pad, bytes_per_line */ #endif if (!b->backimage) { - error("alloc_back_buffer: XCreateImage failed."); + _mesa_warning(NULL, "alloc_back_buffer: XCreateImage failed."); } b->backimage->data = (char *) MALLOC( b->backimage->height * b->backimage->bytes_per_line ); if (!b->backimage->data) { - error("alloc_back_buffer: MALLOC failed."); + _mesa_warning(NULL, "alloc_back_buffer: MALLOC failed."); XMesaDestroyImage( b->backimage ); b->backimage = NULL; } @@ -877,8 +857,8 @@ static GLboolean setup_grayscale( int client, XMesaVisual v, buffer->pixel_to_b[xcol.pixel] = gray; } - if (colorsfailed && getenv("MESA_DEBUG")) { - fprintf( stderr, + if (colorsfailed && _mesa_getenv("MESA_DEBUG")) { + _mesa_warning(NULL, "Note: %d out of 256 needed colors do not match exactly.\n", colorsfailed ); } @@ -957,8 +937,8 @@ static GLboolean setup_dithered_color( int client, XMesaVisual v, } } - if (colorsfailed && getenv("MESA_DEBUG")) { - fprintf( stderr, + if (colorsfailed && _mesa_getenv("MESA_DEBUG")) { + _mesa_warning(NULL, "Note: %d out of %d needed colors do not match exactly.\n", colorsfailed, _R*_G*_B ); } @@ -991,19 +971,19 @@ static void setup_8bit_hpcr( XMesaVisual v ) g = 1.0 / v->RedGamma; for (i=0; i<256; i++) { - GLint red = IROUND_POS(255.0 * pow( hpcr_rgbTbl[0][i]/255.0, g )); + GLint red = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[0][i]/255.0, g )); v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 ); } g = 1.0 / v->GreenGamma; for (i=0; i<256; i++) { - GLint green = IROUND_POS(255.0 * pow( hpcr_rgbTbl[1][i]/255.0, g )); + GLint green = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[1][i]/255.0, g )); v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 ); } g = 1.0 / v->BlueGamma; for (i=0; i<256; i++) { - GLint blue = IROUND_POS(255.0 * pow( hpcr_rgbTbl[2][i]/255.0, g )); + GLint blue = IROUND_POS(255.0 * _mesa_pow( hpcr_rgbTbl[2][i]/255.0, g )); v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 ); } v->undithered_pf = PF_HPCR; /* can't really disable dithering for now */ @@ -1012,7 +992,7 @@ static void setup_8bit_hpcr( XMesaVisual v ) /* which method should I use to clear */ /* GL_FALSE: keep the ordinary method */ /* GL_TRUE : clear with dither pattern */ - v->hpcr_clear_flag = getenv("MESA_HPCR_CLEAR") ? GL_TRUE : GL_FALSE; + v->hpcr_clear_flag = _mesa_getenv("MESA_HPCR_CLEAR") ? GL_TRUE : GL_FALSE; if (v->hpcr_clear_flag) { v->hpcr_clear_pixmap = XMesaCreatePixmap(v->display, @@ -1195,8 +1175,7 @@ static GLboolean initialize_visual_and_buffer( int client, XMesaBuffer b, GLboolean rgb_flag, XMesaDrawable window, - XMesaColormap cmap - ) + XMesaColormap cmap ) { #ifndef XFree86Server XGCValues gcvalues; @@ -1207,7 +1186,7 @@ static GLboolean initialize_visual_and_buffer( int client, } /* Save true bits/pixel */ - v->BitsPerPixel = GET_BITS_PER_PIXEL(v); + v->BitsPerPixel = bits_per_pixel(v); assert(v->BitsPerPixel > 0); @@ -1243,12 +1222,12 @@ static GLboolean initialize_visual_and_buffer( int client, } } else { - error("XMesa: RGB mode rendering not supported in given visual."); + _mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual."); return GL_FALSE; } v->index_bits = 0; - if (getenv("MESA_NO_DITHER")) { + if (_mesa_getenv("MESA_NO_DITHER")) { v->dithered_pf = v->undithered_pf; } } @@ -1259,13 +1238,13 @@ static GLboolean initialize_visual_and_buffer( int client, * which can help Brian figure out what's going on when a user * reports bugs. */ - if (getenv("MESA_INFO")) { - fprintf(stderr, "X/Mesa visual = %p\n", (void *) v); - fprintf(stderr, "X/Mesa dithered pf = %u\n", v->dithered_pf); - fprintf(stderr, "X/Mesa undithered pf = %u\n", v->undithered_pf); - fprintf(stderr, "X/Mesa level = %d\n", v->level); - fprintf(stderr, "X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v)); - fprintf(stderr, "X/Mesa bits per pixel = %d\n", v->BitsPerPixel); + if (_mesa_getenv("MESA_INFO")) { + _mesa_printf("X/Mesa visual = %p\n", (void *) v); + _mesa_printf("X/Mesa dithered pf = %u\n", v->dithered_pf); + _mesa_printf("X/Mesa undithered pf = %u\n", v->undithered_pf); + _mesa_printf("X/Mesa level = %d\n", v->level); + _mesa_printf("X/Mesa depth = %d\n", GET_VISUAL_DEPTH(v)); + _mesa_printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel); } if (b && window) { @@ -1477,7 +1456,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, GLint red_bits, green_bits, blue_bits, alpha_bits; /* For debugging only */ - if (getenv("MESA_XSYNC")) { + if (_mesa_getenv("MESA_XSYNC")) { /* This makes debugging X easier. * In your debugger, set a breakpoint on _XError to stop when an * X protocol error is generated. @@ -1514,11 +1493,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, return NULL; } MEMCPY(v->visinfo, visinfo, sizeof(*visinfo)); - - /* Save a copy of the pointer now so we can find this visual again - * if we need to search for it in find_glx_visual(). - */ - v->vishandle = visinfo; #endif #ifdef XFree86Server @@ -1535,7 +1509,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, #endif /* check for MESA_GAMMA environment variable */ - gamma = getenv("MESA_GAMMA"); + gamma = _mesa_getenv("MESA_GAMMA"); if (gamma) { v->RedGamma = v->GreenGamma = v->BlueGamma = 0.0; sscanf( gamma, "%f %f %f", &v->RedGamma, &v->GreenGamma, &v->BlueGamma ); @@ -1618,11 +1592,10 @@ void XMesaDestroyVisual( XMesaVisual v ) */ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) { + static GLboolean firstTime = GL_TRUE; XMesaContext c; GLcontext *ctx; - GLboolean direct = GL_TRUE; /* XXXX */ - /* NOT_DONE: should this be GL_FALSE??? */ - static GLboolean firstTime = GL_TRUE; + GLboolean direct = GL_TRUE; /* not really */ if (firstTime) { _glthread_INIT_MUTEX(_xmesa_lock); @@ -1636,7 +1609,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) ctx = c->gl_ctx = _mesa_create_context( &v->mesa_visual, share_list ? share_list->gl_ctx : (GLcontext *) NULL, - (void *) c, direct ); + (void *) c, direct); if (!c->gl_ctx) { FREE(c); return NULL; @@ -1644,6 +1617,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_enable_sw_extensions(ctx); _mesa_enable_1_3_extensions(ctx); + _mesa_enable_1_4_extensions(ctx); if (CHECK_BYTE_ORDER(v)) { c->swapbytes = GL_FALSE; @@ -1653,6 +1627,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) } c->xm_visual = v; + c->xm_draw_buffer = NULL; /* set later by XMesaMakeCurrent */ + c->xm_read_buffer = NULL; /* set later by XMesaMakeCurrent */ c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */ c->display = v->display; c->pixelformat = v->dithered_pf; /* Dithering is enabled by default */ @@ -1672,12 +1648,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) */ xmesa_init_pointers( ctx ); - - /* Run the config file - */ - _mesa_read_config_file( ctx ); - - return c; } @@ -1687,8 +1657,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) void XMesaDestroyContext( XMesaContext c ) { #ifdef FX - if (c->xm_buffer && c->xm_buffer->FXctx) - fxMesaDestroyContext(c->xm_buffer->FXctx); + if (c->xm_draw_buffer && c->xm_buffer->FXctx) + fxMesaDestroyContext(c->xm_draw_buffer->FXctx); #endif if (c->gl_ctx) { _swsetup_DestroyContext( c->gl_ctx ); @@ -1742,14 +1712,12 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, if (GET_VISUAL_DEPTH(v) != attr.depth) { #endif - if (getenv("MESA_DEBUG")) { - fprintf(stderr, "XMesaCreateWindowBuffer: depth mismatch between visual and window!\n"); - } + _mesa_warning(NULL, "XMesaCreateWindowBuffer: depth mismatch between visual and window!\n"); return NULL; } b->xm_visual = v; - b->pixmap_flag = GL_FALSE; + b->type = WINDOW; b->display = v->display; #ifdef XFree86Server b->cmap = (ColormapPtr)LookupIDByType(wColormap(w), RT_COLORMAP); @@ -1758,9 +1726,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, b->cmap = attr.colormap; } else { - if (getenv("MESA_DEBUG")) { - fprintf(stderr, "Window %u has no colormap!\n", (unsigned int) w); - } + _mesa_warning(NULL, "Window %u has no colormap!\n", (unsigned int) w); /* this is weird, a window w/out a colormap!? */ /* OK, let's just allocate a new one and hope for the best */ b->cmap = XCreateColormap(v->display, w, attr.visual, AllocNone); @@ -1794,7 +1760,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, } #ifdef FX - fxEnvVar = getenv("MESA_GLX_FX"); + fxEnvVar = _mesa_getenv("MESA_GLX_FX"); if (fxEnvVar) { if (fxEnvVar[0]!='d') { int attribs[100]; @@ -1853,10 +1819,10 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w, } } else { - fprintf(stderr,"WARNING: This Mesa Library includes the Glide driver but\n"); - fprintf(stderr," you have not defined the MESA_GLX_FX env. var.\n"); - fprintf(stderr," (check the README.3DFX file for more information).\n\n"); - fprintf(stderr," you can disable this message with a 'export MESA_GLX_FX=disable'.\n"); + _mesa_warning(NULL, "WARNING: This Mesa Library includes the Glide driver but\n"); + _mesa_warning(NULL, " you have not defined the MESA_GLX_FX env. var.\n"); + _mesa_warning(NULL, " (check the README.3DFX file for more information).\n\n"); + _mesa_warning(NULL, " you can disable this message with a 'export MESA_GLX_FX=disable'.\n"); } #endif @@ -1895,7 +1861,7 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, assert(v); b->xm_visual = v; - b->pixmap_flag = GL_TRUE; + b->type = PIXMAP; b->display = v->display; b->cmap = cmap; @@ -1932,21 +1898,29 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, -#if 0 /* not done */ XMesaBuffer XMesaCreatePBuffer( XMesaVisual v, XMesaColormap cmap, unsigned int width, unsigned int height ) { +#ifdef XFree86Server + return 0; +#else int client = 0; + XMesaWindow root; + XMesaDrawable drawable; /* X Pixmap Drawable */ XMesaBuffer b = alloc_xmesa_buffer(); if (!b) { return NULL; } b->xm_visual = v; - b->pbuffer_flag = GL_TRUE; + b->type = PBUFFER; b->display = v->display; b->cmap = cmap; + /* allocate pixmap for front buffer */ + root = RootWindow( v->display, v->visinfo->screen ); + drawable = XCreatePixmap( v->display, root, width, height, v->visinfo->depth ); + /* determine back buffer implementation */ if (v->mesa_visual.doubleBufferMode) { if (v->ximage_flag) { @@ -1970,14 +1944,14 @@ XMesaBuffer XMesaCreatePBuffer( XMesaVisual v, XMesaColormap cmap, v->mesa_visual.alphaBits > 0 ); if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, - 0, cmap)) { + drawable, cmap)) { free_xmesa_buffer(client, b); return NULL; } return b; -} #endif +} @@ -2050,24 +2024,24 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, if (drawBuffer->FXctx) { fxMesaMakeCurrent(drawBuffer->FXctx); - c->xm_buffer = drawBuffer; + c->xm_draw_buffer = drawBuffer; c->xm_read_buffer = readBuffer; - c->use_read_buffer = (drawBuffer != readBuffer); + c->xm_buffer = drawBuffer; return GL_TRUE; } #endif if (c->gl_ctx == _mesa_get_current_context() - && c->xm_buffer == drawBuffer + && c->xm_draw_buffer == drawBuffer && c->xm_read_buffer == readBuffer - && c->xm_buffer->wasCurrent) { + && c->xm_draw_buffer->wasCurrent) { /* same context and buffer, do nothing */ return GL_TRUE; } - c->xm_buffer = drawBuffer; + c->xm_draw_buffer = drawBuffer; c->xm_read_buffer = readBuffer; - c->use_read_buffer = (drawBuffer != readBuffer); + c->xm_buffer = drawBuffer; _mesa_make_current2(c->gl_ctx, &drawBuffer->mesa_buffer, @@ -2091,11 +2065,11 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, c->clearcolor[2], c->clearcolor[3], c->xm_visual->undithered_pf); - XMesaSetForeground(c->display, c->xm_buffer->cleargc, c->clearpixel); + XMesaSetForeground(c->display, c->xm_draw_buffer->cleargc, c->clearpixel); } /* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */ - c->xm_buffer->wasCurrent = GL_TRUE; + c->xm_draw_buffer->wasCurrent = GL_TRUE; } else { /* Detach */ @@ -2133,7 +2107,7 @@ XMesaBuffer XMesaGetCurrentBuffer( void ) GET_CURRENT_CONTEXT(ctx); if (ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - return xmesa->xm_buffer; + return xmesa->xm_draw_buffer; } else { return 0; @@ -2147,7 +2121,7 @@ XMesaBuffer XMesaGetCurrentReadBuffer( void ) GET_CURRENT_CONTEXT(ctx); if (ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - return xmesa->xm_buffer; + return xmesa->xm_read_buffer; } else { return 0; @@ -2159,7 +2133,7 @@ GLboolean XMesaForceCurrent(XMesaContext c) { if (c) { if (c->gl_ctx != _mesa_get_current_context()) { - _mesa_make_current(c->gl_ctx, &c->xm_buffer->mesa_buffer); + _mesa_make_current(c->gl_ctx, &c->xm_draw_buffer->mesa_buffer); } } else { @@ -2183,7 +2157,7 @@ GLboolean XMesaLoseCurrent(XMesaContext c) GLboolean XMesaSetFXmode( GLint mode ) { #ifdef FX - const char *fx = getenv("MESA_GLX_FX"); + const char *fx = _mesa_getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { GET_CURRENT_CONTEXT(ctx); GrHwConfiguration hw; @@ -2198,15 +2172,15 @@ GLboolean XMesaSetFXmode( GLint mode ) if (ctx) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; if (mode == XMESA_FX_WINDOW) { - if (xmesa->xm_buffer->FXisHackUsable) { + if (xmesa->xm_draw_buffer->FXisHackUsable) { FX_grSstControl(GR_CONTROL_DEACTIVATE); - xmesa->xm_buffer->FXwindowHack = GL_TRUE; + xmesa->xm_draw_buffer->FXwindowHack = GL_TRUE; return GL_TRUE; } } else if (mode == XMESA_FX_FULLSCREEN) { FX_grSstControl(GR_CONTROL_ACTIVATE); - xmesa->xm_buffer->FXwindowHack = GL_FALSE; + xmesa->xm_draw_buffer->FXwindowHack = GL_FALSE; return GL_TRUE; } else { @@ -2327,7 +2301,7 @@ void XMesaSwapBuffers( XMesaBuffer b ) * we have to flush any pending rendering commands first. */ if (ctx && ctx->DrawBuffer == &(b->mesa_buffer)) - _mesa_swapbuffers(ctx); + _mesa_notifySwapBuffers(ctx); if (b->db_state) { #ifdef FX @@ -2393,7 +2367,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) * we have to flush any pending rendering commands first. */ if (ctx && ctx->DrawBuffer == &(b->mesa_buffer)) - _mesa_swapbuffers(ctx); + _mesa_notifySwapBuffers(ctx); if (b->db_state) { int yTop = b->height - y - height; @@ -2512,7 +2486,7 @@ const char *XMesaGetString( XMesaContext c, int name ) { (void) c; if (name==XMESA_VERSION) { - return "4.0.3"; + return "5.0"; } else if (name==XMESA_EXTENSIONS) { return ""; @@ -2546,7 +2520,7 @@ void XMesaGarbageCollect( void ) XMesaBuffer b, next; for (b=XMesaBufferList; b; b=next) { next = b->Next; - if (b->display && b->frontbuffer && !b->pixmap_flag) { + if (b->display && b->frontbuffer && b->type == WINDOW) { #ifdef XFree86Server /* NOT_NEEDED */ #else diff --git a/xc/extras/Mesa/src/X/xm_dd.c b/xc/extras/Mesa/src/X/xm_dd.c index f7a1e7107..dcdd482f5 100644 --- a/xc/extras/Mesa/src/X/xm_dd.c +++ b/xc/extras/Mesa/src/X/xm_dd.c @@ -1,3 +1,4 @@ + /* * Mesa 3-D graphics library * Version: 4.0.3 @@ -21,15 +22,16 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/X/xm_dd.c,v 1.4 2002/09/09 21:29:58 dawes Exp $ */ +/* $XFree86: xc/extras/Mesa/src/X/xm_dd.c,v 1.2 2002/02/26 23:37:31 tsi Exp $ */ #include "glxheader.h" #include "context.h" +#include "colormac.h" #include "depth.h" #include "drawpix.h" #include "extensions.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mtypes.h" #include "state.h" #include "texstore.h" @@ -114,74 +116,51 @@ flush( GLcontext *ctx ) } -static void -set_draw_buffer( GLcontext *ctx, GLenum mode ) -{ - const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - if (mode == GL_FRONT_LEFT) { - /* write to front buffer */ - xmesa->xm_buffer->buffer = xmesa->xm_buffer->frontbuffer; - xmesa_update_span_funcs(ctx); - } - else if (mode==GL_BACK_LEFT && xmesa->xm_buffer->db_state) { - /* write to back buffer */ - if (xmesa->xm_buffer->backpixmap) { - xmesa->xm_buffer->buffer = - (XMesaDrawable)xmesa->xm_buffer->backpixmap; - } - else if (xmesa->xm_buffer->backimage) { - xmesa->xm_buffer->buffer = None; - } - else { - /* just in case there wasn't enough memory for back buffer */ - xmesa->xm_buffer->buffer = xmesa->xm_buffer->frontbuffer; - } - xmesa_update_span_funcs(ctx); - } - else { - /* the swrast->_RasterMask MULTI_DRAW_BIT will be set and - * we'll fall back to swrast to draw points/lines/triangles. - */ - } -} - -void -xmesa_set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +/* + * This chooses the color buffer for reading and writing spans, points, + * lines, and triangles. + */ +static void +set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit ) { - XMesaBuffer target; + /* We can make this cast since the XMesaBuffer wraps GLframebuffer. + * GLframebuffer is the first member in a XMesaBuffer struct. + */ + XMesaBuffer target = (XMesaBuffer) buffer; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - if (buffer == ctx->DrawBuffer) { - target = xmesa->xm_buffer; - xmesa->use_read_buffer = GL_FALSE; - } - else { - ASSERT(buffer == ctx->ReadBuffer); - target = xmesa->xm_read_buffer; - xmesa->use_read_buffer = GL_TRUE; - } + /* This assignment tells the span/point/line/triangle functions + * which XMesaBuffer to use. + */ + xmesa->xm_buffer = target; - if (mode == GL_FRONT_LEFT) { + /* + * Now determine front vs back color buffer. + */ + if (bufferBit == FRONT_LEFT_BIT) { target->buffer = target->frontbuffer; - xmesa_update_span_funcs(ctx); } - else if (mode==GL_BACK_LEFT && xmesa->xm_read_buffer->db_state) { + else if (bufferBit == BACK_LEFT_BIT) { + ASSERT(target->db_state); if (target->backpixmap) { - target->buffer = (XMesaDrawable)xmesa->xm_buffer->backpixmap; + /* back buffer is a pixmape */ + target->buffer = target->backpixmap; /* incompatible types? */ } else if (target->backimage) { + /* back buffer is an XImage */ target->buffer = None; } else { - /* just in case there wasn't enough memory for back buffer */ + /* No back buffer!!!! Must be out of memory, use front buffer */ target->buffer = target->frontbuffer; } - xmesa_update_span_funcs(ctx); } else { - _mesa_problem(ctx, "invalid buffer in set_read_buffer() in xmesa2.c"); + _mesa_problem(ctx, "invalid buffer 0x%x in set_buffer() in xm_dd.c"); + return; } + xmesa_update_span_funcs(ctx); } @@ -191,24 +170,27 @@ clear_index( GLcontext *ctx, GLuint index ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; xmesa->clearpixel = (unsigned long) index; - XMesaSetForeground( xmesa->display, xmesa->xm_buffer->cleargc, + XMesaSetForeground( xmesa->display, xmesa->xm_draw_buffer->cleargc, (unsigned long) index ); } static void -clear_color( GLcontext *ctx, const GLchan color[4] ) +clear_color( GLcontext *ctx, const GLfloat color[4] ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - xmesa->clearcolor[0] = color[0]; - xmesa->clearcolor[1] = color[1]; - xmesa->clearcolor[2] = color[2]; - xmesa->clearcolor[3] = color[3]; - xmesa->clearpixel = xmesa_color_to_pixel( xmesa, color[0], color[1], - color[2], color[3], + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); + xmesa->clearpixel = xmesa_color_to_pixel( xmesa, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2], + xmesa->clearcolor[3], xmesa->xm_visual->undithered_pf ); _glthread_LOCK_MUTEX(_xmesa_lock); - XMesaSetForeground( xmesa->display, xmesa->xm_buffer->cleargc, + XMesaSetForeground( xmesa->display, xmesa->xm_draw_buffer->cleargc, xmesa->clearpixel ); _glthread_UNLOCK_MUTEX(_xmesa_lock); } @@ -220,7 +202,7 @@ static void index_mask( GLcontext *ctx, GLuint mask ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - if (xmesa->xm_buffer->buffer != XIMAGE) { + if (xmesa->xm_draw_buffer->buffer != XIMAGE) { unsigned long m; if (mask==0xffffffff) { m = ((unsigned long)~0L); @@ -228,7 +210,8 @@ index_mask( GLcontext *ctx, GLuint mask ) else { m = (unsigned long) mask; } - XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->cleargc, m ); + XMesaSetPlaneMask( xmesa->display, xmesa->xm_draw_buffer->cleargc, m ); + XMesaSetPlaneMask( xmesa->display, xmesa->xm_draw_buffer->gc, m ); } } @@ -253,7 +236,7 @@ color_mask(GLcontext *ctx, if (gmask) m |= GET_GREENMASK(xmesa->xm_visual); if (bmask) m |= GET_BLUEMASK(xmesa->xm_visual); } - XMesaSetPlaneMask( xmesa->display, xmesa->xm_buffer->cleargc, m ); + XMesaSetPlaneMask( xmesa->display, xmesa->xm_draw_buffer->cleargc, m ); } } @@ -270,16 +253,16 @@ clear_front_pixmap( GLcontext *ctx, GLboolean all, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; if (all) { - XMesaFillRectangle( xmesa->display, xmesa->xm_buffer->frontbuffer, - xmesa->xm_buffer->cleargc, + XMesaFillRectangle( xmesa->display, xmesa->xm_draw_buffer->frontbuffer, + xmesa->xm_draw_buffer->cleargc, 0, 0, - xmesa->xm_buffer->width+1, - xmesa->xm_buffer->height+1 ); + xmesa->xm_draw_buffer->width+1, + xmesa->xm_draw_buffer->height+1 ); } else { - XMesaFillRectangle( xmesa->display, xmesa->xm_buffer->frontbuffer, - xmesa->xm_buffer->cleargc, - x, xmesa->xm_buffer->height - y - height, + XMesaFillRectangle( xmesa->display, xmesa->xm_draw_buffer->frontbuffer, + xmesa->xm_draw_buffer->cleargc, + x, xmesa->xm_draw_buffer->height - y - height, width, height ); } } @@ -291,16 +274,16 @@ clear_back_pixmap( GLcontext *ctx, GLboolean all, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; if (all) { - XMesaFillRectangle( xmesa->display, xmesa->xm_buffer->backpixmap, - xmesa->xm_buffer->cleargc, + XMesaFillRectangle( xmesa->display, xmesa->xm_draw_buffer->backpixmap, + xmesa->xm_draw_buffer->cleargc, 0, 0, - xmesa->xm_buffer->width+1, - xmesa->xm_buffer->height+1 ); + xmesa->xm_draw_buffer->width+1, + xmesa->xm_draw_buffer->height+1 ); } else { - XMesaFillRectangle( xmesa->display, xmesa->xm_buffer->backpixmap, - xmesa->xm_buffer->cleargc, - x, xmesa->xm_buffer->height - y - height, + XMesaFillRectangle( xmesa->display, xmesa->xm_draw_buffer->backpixmap, + xmesa->xm_draw_buffer->cleargc, + x, xmesa->xm_draw_buffer->height - y - height, width, height ); } } @@ -312,14 +295,14 @@ clear_8bit_ximage( GLcontext *ctx, GLboolean all, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; if (all) { - size_t n = xmesa->xm_buffer->backimage->bytes_per_line - * xmesa->xm_buffer->backimage->height; - MEMSET( xmesa->xm_buffer->backimage->data, xmesa->clearpixel, n ); + size_t n = xmesa->xm_draw_buffer->backimage->bytes_per_line + * xmesa->xm_draw_buffer->backimage->height; + MEMSET( xmesa->xm_draw_buffer->backimage->data, xmesa->clearpixel, n ); } else { GLint i; for (i=0;i<height;i++) { - GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer, x, y+i ); + GLubyte *ptr = PIXELADDR1( xmesa->xm_draw_buffer, x, y+i ); MEMSET( ptr, xmesa->clearpixel, width ); } } @@ -332,9 +315,9 @@ clear_HPCR_ximage( GLcontext *ctx, GLboolean all, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; if (all) { - GLint i, c16 = (xmesa->xm_buffer->backimage->bytes_per_line>>4)<<4; - GLubyte *ptr = (GLubyte *)xmesa->xm_buffer->backimage->data; - for (i=0; i<xmesa->xm_buffer->backimage->height; i++) { + GLint i, c16 = (xmesa->xm_draw_buffer->backimage->bytes_per_line>>4)<<4; + GLubyte *ptr = (GLubyte *)xmesa->xm_draw_buffer->backimage->data; + for (i=0; i<xmesa->xm_draw_buffer->backimage->height; i++) { GLint j; GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0]; if (i&1) { @@ -359,7 +342,7 @@ clear_HPCR_ximage( GLcontext *ctx, GLboolean all, ptr[15] = sptr[15]; ptr += 16; } - for (; j<xmesa->xm_buffer->backimage->bytes_per_line; j++) { + for (; j<xmesa->xm_draw_buffer->backimage->bytes_per_line; j++) { *ptr = sptr[j&15]; ptr++; } @@ -368,7 +351,7 @@ clear_HPCR_ximage( GLcontext *ctx, GLboolean all, else { GLint i; for (i=y; i<y+height; i++) { - GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer, x, i ); + GLubyte *ptr = PIXELADDR1( xmesa->xm_draw_buffer, x, i ); int j; GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0]; if (i&1) { @@ -394,31 +377,31 @@ clear_16bit_ximage( GLcontext *ctx, GLboolean all, } if (all) { register GLuint n; - register GLuint *ptr4 = (GLuint *) xmesa->xm_buffer->backimage->data; + register GLuint *ptr4 = (GLuint *) xmesa->xm_draw_buffer->backimage->data; if ((pixel & 0xff) == ((pixel >> 8) & 0xff)) { /* low and high bytes are equal so use memset() */ - n = xmesa->xm_buffer->backimage->bytes_per_line - * xmesa->xm_buffer->height; + n = xmesa->xm_draw_buffer->backimage->bytes_per_line + * xmesa->xm_draw_buffer->height; MEMSET( ptr4, pixel & 0xff, n ); } else { pixel = pixel | (pixel<<16); - n = xmesa->xm_buffer->backimage->bytes_per_line - * xmesa->xm_buffer->height / 4; + n = xmesa->xm_draw_buffer->backimage->bytes_per_line + * xmesa->xm_draw_buffer->height / 4; do { *ptr4++ = pixel; n--; } while (n!=0); - if ((xmesa->xm_buffer->backimage->bytes_per_line * - xmesa->xm_buffer->height) & 0x2) + if ((xmesa->xm_draw_buffer->backimage->bytes_per_line * + xmesa->xm_draw_buffer->height) & 0x2) *(GLushort *)ptr4 = pixel & 0xffff; } } else { register int i, j; for (j=0;j<height;j++) { - register GLushort *ptr2 = PIXELADDR2( xmesa->xm_buffer, x, y+j ); + register GLushort *ptr2 = PIXELADDR2( xmesa->xm_draw_buffer, x, y+j ); for (i=0;i<width;i++) { *ptr2++ = pixel; } @@ -447,21 +430,21 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, if (all) { if (r==g && g==b) { /* same value for all three components (gray) */ - const GLint w3 = xmesa->xm_buffer->width * 3; - const GLint h = xmesa->xm_buffer->height; + const GLint w3 = xmesa->xm_draw_buffer->width * 3; + const GLint h = xmesa->xm_draw_buffer->height; GLint i; for (i = 0; i < h; i++) { - bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_draw_buffer, 0, i); MEMSET(ptr3, r, w3); } } else { /* the usual case */ - const GLint w = xmesa->xm_buffer->width; - const GLint h = xmesa->xm_buffer->height; + const GLint w = xmesa->xm_draw_buffer->width; + const GLint h = xmesa->xm_draw_buffer->height; GLint i, j; for (i = 0; i < h; i++) { - bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_draw_buffer, 0, i); for (j = 0; j < w; j++) { ptr3->r = r; ptr3->g = g; @@ -545,7 +528,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, /* same value for all three components (gray) */ GLint j; for (j=0;j<height;j++) { - bgr_t *ptr3 = PIXELADDR3( xmesa->xm_buffer, x, y+j ); + bgr_t *ptr3 = PIXELADDR3( xmesa->xm_draw_buffer, x, y+j ); MEMSET(ptr3, r, 3 * width); } } @@ -553,7 +536,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, /* non-gray clear color */ GLint i, j; for (j = 0; j < height; j++) { - bgr_t *ptr3 = PIXELADDR3( xmesa->xm_buffer, x, y+j ); + bgr_t *ptr3 = PIXELADDR3( xmesa->xm_draw_buffer, x, y+j ); for (i = 0; i < width; i++) { ptr3->r = r; ptr3->g = g; @@ -568,7 +551,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, pixel4[1] = (clearPixel << 16) | (clearPixel >> 8); pixel4[2] = (clearPixel << 8) | (clearPixel >> 16); for (j=0;j<height;j++) { - bgr_t *ptr3 = PIXELADDR3( xmesa->xm_buffer, x, y+j ); + bgr_t *ptr3 = PIXELADDR3( xmesa->xm_draw_buffer, x, y+j ); register GLuint *ptr4 = (GLuint *)ptr3; register GLuint *p, px; GLuint w = width; @@ -651,8 +634,8 @@ clear_32bit_ximage( GLcontext *ctx, GLboolean all, | ((pixel << 24) & 0xff000000); } if (all) { - register GLint n = xmesa->xm_buffer->width * xmesa->xm_buffer->height; - register GLuint *ptr4 = (GLuint *) xmesa->xm_buffer->backimage->data; + register GLint n = xmesa->xm_draw_buffer->width * xmesa->xm_draw_buffer->height; + register GLuint *ptr4 = (GLuint *) xmesa->xm_draw_buffer->backimage->data; if (pixel==0) { MEMSET( ptr4, pixel, 4*n ); } @@ -666,7 +649,7 @@ clear_32bit_ximage( GLcontext *ctx, GLboolean all, else { register int i, j; for (j=0;j<height;j++) { - register GLuint *ptr4 = PIXELADDR4( xmesa->xm_buffer, x, y+j ); + register GLuint *ptr4 = PIXELADDR4( xmesa->xm_draw_buffer, x, y+j ); for (i=0;i<width;i++) { *ptr4++ = pixel; } @@ -680,11 +663,11 @@ clear_nbit_ximage( GLcontext *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xmesa->xm_draw_buffer->backimage; if (all) { register int i, j; - width = xmesa->xm_buffer->width; - height = xmesa->xm_buffer->height; + width = xmesa->xm_draw_buffer->width; + height = xmesa->xm_draw_buffer->height; for (j=0;j<height;j++) { for (i=0;i<width;i++) { XMesaPutPixel( img, i, j, xmesa->clearpixel ); @@ -694,7 +677,7 @@ clear_nbit_ximage( GLcontext *ctx, GLboolean all, else { /* TODO: optimize this */ register int i, j; - y = FLIP(xmesa->xm_buffer, y); + y = FLIP(xmesa->xm_draw_buffer, y); for (j=0;j<height;j++) { for (i=0;i<width;i++) { XMesaPutPixel( img, x+i, y-j, xmesa->clearpixel ); @@ -713,7 +696,7 @@ clear_buffers( GLcontext *ctx, GLbitfield mask, const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) && - xmesa->xm_buffer->mesa_buffer.UseSoftwareAlphaBuffers && + xmesa->xm_draw_buffer->mesa_buffer.UseSoftwareAlphaBuffers && ctx->Color.ColorMask[ACOMP]) { _mesa_clear_alpha_buffers(ctx); } @@ -721,13 +704,13 @@ clear_buffers( GLcontext *ctx, GLbitfield mask, /* we can't handle color or index masking */ if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) { if (mask & DD_FRONT_LEFT_BIT) { - ASSERT(xmesa->xm_buffer->front_clear_func); - (*xmesa->xm_buffer->front_clear_func)( ctx, all, x, y, width, height ); + ASSERT(xmesa->xm_draw_buffer->front_clear_func); + (*xmesa->xm_draw_buffer->front_clear_func)( ctx, all, x, y, width, height ); mask &= ~DD_FRONT_LEFT_BIT; } if (mask & DD_BACK_LEFT_BIT) { - ASSERT(xmesa->xm_buffer->back_clear_func); - (*xmesa->xm_buffer->back_clear_func)( ctx, all, x, y, width, height ); + ASSERT(xmesa->xm_draw_buffer->back_clear_func); + (*xmesa->xm_draw_buffer->back_clear_func)( ctx, all, x, y, width, height ); mask &= ~DD_BACK_LEFT_BIT; } } @@ -800,8 +783,8 @@ drawpixels_8R8G8B( GLcontext *ctx, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xmesa->xm_draw_buffer->buffer; + XMesaGC gc = xmesa->xm_draw_buffer->gc; assert(dpy); assert(buffer); assert(gc); @@ -831,7 +814,7 @@ drawpixels_8R8G8B( GLcontext *ctx, ximage.red_mask = 0xff0000; ximage.green_mask = 0x00ff00; ximage.blue_mask = 0x0000ff; - dstY = FLIP(xmesa->xm_buffer,dstY) - height + 1; + dstY = FLIP(xmesa->xm_draw_buffer,dstY) - height + 1; XPutImage(dpy, buffer, gc, &ximage, srcX, srcY, dstX, dstY, w, h); return GL_TRUE; } @@ -897,33 +880,33 @@ void xmesa_update_state( GLcontext *ctx, GLuint new_state ) /* setup pointers to front and back buffer clear functions */ - xmesa->xm_buffer->front_clear_func = clear_front_pixmap; - if (xmesa->xm_buffer->backpixmap != XIMAGE) { - xmesa->xm_buffer->back_clear_func = clear_back_pixmap; + xmesa->xm_draw_buffer->front_clear_func = clear_front_pixmap; + if (xmesa->xm_draw_buffer->backpixmap != XIMAGE) { + xmesa->xm_draw_buffer->back_clear_func = clear_back_pixmap; } else if (sizeof(GLushort)!=2 || sizeof(GLuint)!=4) { - xmesa->xm_buffer->back_clear_func = clear_nbit_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_nbit_ximage; } else switch (xmesa->xm_visual->BitsPerPixel) { case 8: if (xmesa->xm_visual->hpcr_clear_flag) { - xmesa->xm_buffer->back_clear_func = clear_HPCR_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_HPCR_ximage; } else { - xmesa->xm_buffer->back_clear_func = clear_8bit_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_8bit_ximage; } break; case 16: - xmesa->xm_buffer->back_clear_func = clear_16bit_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_16bit_ximage; break; case 24: - xmesa->xm_buffer->back_clear_func = clear_24bit_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_24bit_ximage; break; case 32: - xmesa->xm_buffer->back_clear_func = clear_32bit_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_32bit_ximage; break; default: - xmesa->xm_buffer->back_clear_func = clear_nbit_ximage; + xmesa->xm_draw_buffer->back_clear_func = clear_nbit_ximage; break; } @@ -938,6 +921,7 @@ void xmesa_update_state( GLcontext *ctx, GLuint new_state ) void xmesa_init_pointers( GLcontext *ctx ) { TNLcontext *tnl; + struct swrast_device_driver *dd = _swrast_GetDeviceDriverReference( ctx ); ctx->Driver.GetString = get_string; ctx->Driver.GetBufferSize = get_buffer_size; @@ -953,6 +937,7 @@ void xmesa_init_pointers( GLcontext *ctx ) ctx->Driver.CopyPixels = _swrast_CopyPixels; ctx->Driver.DrawPixels = _swrast_DrawPixels; ctx->Driver.ReadPixels = _swrast_ReadPixels; + ctx->Driver.DrawBuffer = _swrast_DrawBuffer; /* Software texture functions: */ @@ -971,9 +956,12 @@ void xmesa_init_pointers( GLcontext *ctx ) ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; - ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat; - ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size; - ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage; + ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d; + ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d; + ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d; + ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; + ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; + ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; /* Swrast hooks for imaging extensions: */ @@ -985,7 +973,6 @@ void xmesa_init_pointers( GLcontext *ctx ) /* Statechange callbacks: */ - ctx->Driver.SetDrawBuffer = set_draw_buffer; ctx->Driver.ClearIndex = clear_index; ctx->Driver.ClearColor = clear_color; ctx->Driver.IndexMask = index_mask; @@ -998,6 +985,8 @@ void xmesa_init_pointers( GLcontext *ctx ) tnl = TNL_CONTEXT(ctx); tnl->Driver.RunPipeline = _tnl_run_pipeline; + dd->SetBuffer = set_buffer; + /* Install swsetup for tnl->Driver.Render.*: */ _swsetup_Wakeup(ctx); diff --git a/xc/extras/Mesa/src/X/xm_line.c b/xc/extras/Mesa/src/X/xm_line.c index 007c3ffa1..1c330c82e 100644 --- a/xc/extras/Mesa/src/X/xm_line.c +++ b/xc/extras/Mesa/src/X/xm_line.c @@ -1,10 +1,9 @@ -/* $Id: xm_line.c,v 1.1.1.1 2002/10/22 13:06:06 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 3.5 * - * Copyright (C) 1999-2002 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"), @@ -101,7 +100,7 @@ void xmesa_choose_point( GLcontext *ctx ) if (ctx->RenderMode == GL_RENDER && ctx->Point.Size == 1.0F && !ctx->Point.SmoothFlag && swrast->_RasterMask == 0 - && !ctx->Texture._ReallyEnabled + && !ctx->Texture._EnabledUnits && xmesa->xm_buffer->buffer != XIMAGE) { swrast->Point = draw_points_ANY_pixmap; } @@ -557,7 +556,7 @@ static swrast_line_func get_line_func( GLcontext *ctx ) if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL; if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL; - if (ctx->Texture._ReallyEnabled) return (swrast_line_func) NULL; + if (ctx->Texture._EnabledUnits) return (swrast_line_func) NULL; if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL; if (ctx->Line.StippleFlag) return (swrast_line_func) NULL; if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; diff --git a/xc/extras/Mesa/src/X/xm_span.c b/xc/extras/Mesa/src/X/xm_span.c index 2fe2af697..eda81ee0e 100644 --- a/xc/extras/Mesa/src/X/xm_span.c +++ b/xc/extras/Mesa/src/X/xm_span.c @@ -1,3 +1,4 @@ + /* * Mesa 3-D graphics library * Version: 3.5 @@ -21,18 +22,19 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/X/xm_span.c,v 1.4 2002/09/09 21:07:28 dawes Exp $ */ +/* $XFree86: xc/extras/Mesa/src/X/xm_span.c,v 1.3 2002/02/27 21:07:54 tsi Exp $ */ #include "glxheader.h" +#include "colormac.h" #include "context.h" -#include "drawpix.h" -#include "mem.h" -#include "state.h" #include "depth.h" +#include "drawpix.h" +#include "extensions.h" #include "macros.h" +#include "imports.h" #include "mtypes.h" +#include "state.h" #include "xmesaP.h" -#include "extensions.h" #include "swrast/swrast.h" @@ -3470,14 +3472,9 @@ static void read_index_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[] ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - XMesaBuffer source; + XMesaBuffer source = xmesa->xm_buffer; GLuint i; - if (xmesa->use_read_buffer) - source = xmesa->xm_read_buffer; - else - source = xmesa->xm_buffer; - y = FLIP(source, y); if (source->buffer) { @@ -3526,12 +3523,7 @@ static void read_color_span( const GLcontext *ctx, GLubyte rgba[][4] ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - XMesaBuffer source; - - if (xmesa->use_read_buffer) - source = xmesa->xm_read_buffer; - else - source = xmesa->xm_buffer; + XMesaBuffer source = xmesa->xm_buffer; if (source->buffer) { /* Read from Pixmap or Window */ @@ -3900,12 +3892,7 @@ static void read_index_pixels( const GLcontext *ctx, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; register GLuint i; - XMesaBuffer source; - - if (xmesa->use_read_buffer) - source = xmesa->xm_read_buffer; - else - source = xmesa->xm_buffer; + XMesaBuffer source = xmesa->xm_buffer; if (source->buffer) { for (i=0;i<n;i++) { @@ -3935,15 +3922,8 @@ static void read_color_pixels( const GLcontext *ctx, const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; register GLuint i; - XMesaBuffer source; - XMesaDrawable buffer; - - if (xmesa->use_read_buffer) - source = xmesa->xm_read_buffer; - else - source = xmesa->xm_buffer; - - buffer = source->buffer; /* the X drawable */ + XMesaBuffer source = xmesa->xm_buffer; + XMesaDrawable buffer = source->buffer; /* the X drawable */ if (source->buffer) { switch (xmesa->pixelformat) { @@ -4183,14 +4163,17 @@ static void read_color_pixels( const GLcontext *ctx, static void -clear_color_HPCR_ximage( GLcontext *ctx, const GLchan color[4] ) +clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - COPY_4V(xmesa->clearcolor, color); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); - if (color[0] == 0 && color[1] == 0 && color[2] == 0) { + if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { /* black is black */ MEMSET( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 , sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern)); @@ -4198,24 +4181,33 @@ clear_color_HPCR_ximage( GLcontext *ctx, const GLchan color[4] ) else { /* build clear pattern */ for (i=0; i<16; i++) { - xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = - DITHER_HPCR(i, 0, color[0], color[1], color[2]); + xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = + DITHER_HPCR(i, 0, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2]); xmesa->xm_visual->hpcr_clear_ximage_pattern[1][i] = - DITHER_HPCR(i, 1, color[0], color[1], color[2]); + DITHER_HPCR(i, 1, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2]); } } } static void -clear_color_HPCR_pixmap( GLcontext *ctx, const GLchan color[4] ) +clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - COPY_4V(xmesa->clearcolor, color); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); - if (color[0] == 0 && color[1] == 0 && color[2] == 0) { + if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { /* black is black */ for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0); @@ -4225,9 +4217,15 @@ clear_color_HPCR_pixmap( GLcontext *ctx, const GLchan color[4] ) else { for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, - DITHER_HPCR(i, 0, color[0], color[1], color[2])); + DITHER_HPCR(i, 0, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2])); XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, - DITHER_HPCR(i, 1, color[0], color[1], color[2])); + DITHER_HPCR(i, 1, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2])); } } /* change tile pixmap content */ @@ -4489,6 +4487,4 @@ void xmesa_update_span_funcs( GLcontext *ctx ) dd->ReadRGBASpan = read_color_span; dd->ReadCI32Pixels = read_index_pixels; dd->ReadRGBAPixels = read_color_pixels; - - dd->SetReadBuffer = xmesa_set_read_buffer; } diff --git a/xc/extras/Mesa/src/X/xm_tri.c b/xc/extras/Mesa/src/X/xm_tri.c index 3026b77e2..5e138f03d 100644 --- a/xc/extras/Mesa/src/X/xm_tri.c +++ b/xc/extras/Mesa/src/X/xm_tri.c @@ -1,8 +1,7 @@ -/* $Id: xm_tri.c,v 1.1.1.1 2002/10/22 13:06:05 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -35,6 +34,7 @@ #include "glxheader.h" #include "depth.h" #include "macros.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "xmesaP.h" @@ -44,7 +44,6 @@ #include "swrast/s_context.h" #include "swrast/s_depth.h" #include "swrast/s_triangle.h" -#include "swrast/s_trispan.h" @@ -70,7 +69,7 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ GLuint i; \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p; \ @@ -108,7 +107,7 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_8B8G8R(FixedToInt(span.red), \ @@ -143,7 +142,7 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ @@ -178,7 +177,7 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PIXEL_TYPE *ptr = pRow + i; \ @@ -214,7 +213,7 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p; \ @@ -251,7 +250,7 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = PACK_5R6G5B(FixedToInt(span.red), \ @@ -287,7 +286,7 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \ @@ -324,7 +323,7 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ XDITHER_SETUP(y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),\ @@ -359,7 +358,7 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ XDITHER_SETUP(y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p = XDITHER(x, FixedToInt(span.red), \ @@ -396,7 +395,7 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ LOOKUP_SETUP; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = LOOKUP(FixedToInt(span.red), \ @@ -433,7 +432,7 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ @@ -469,7 +468,7 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ XMesaPutPixel(img, x, y, pixel); \ @@ -501,7 +500,7 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ @@ -533,7 +532,7 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ @@ -563,7 +562,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PIXEL_TYPE *ptr = pRow + i; \ @@ -594,7 +593,7 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p; \ @@ -629,7 +628,7 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ @@ -660,7 +659,7 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ @@ -695,7 +694,7 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y)); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ @@ -727,7 +726,7 @@ static void flat_DITHER_z_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ unsigned long p = FLAT_DITHER(x); \ @@ -762,7 +761,7 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ @@ -797,7 +796,7 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLubyte p = LOOKUP(r,g,b); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ pRow[i] = p; \ @@ -825,12 +824,12 @@ static void smooth_TRUECOLOR_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ unsigned long p; \ PACK_TRUECOLOR(p, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(img, x, y, p); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -854,10 +853,10 @@ static void smooth_8A8B8G8R_triangle( GLcontext *ctx, #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8B8G8R(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } \ @@ -881,10 +880,10 @@ static void smooth_8R8G8B_triangle( GLcontext *ctx, #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -909,11 +908,11 @@ static void smooth_8R8G8B24_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ - for (i = 0; i < span.count; i++, pixel++) { \ + for (i = 0; i < span.end; i++, pixel++) { \ pixel->r = FixedToInt(span.red); \ pixel->g = FixedToInt(span.green); \ - pixel->b = FixedToInt(span.blue); \ - span.red += span.redStep; \ + pixel->b = FixedToInt(span.blue); \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -936,12 +935,12 @@ static void smooth_TRUEDITHER_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ unsigned long p; \ PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ XMesaPutPixel(img, x, y, p ); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -965,10 +964,10 @@ static void smooth_5R6G5B_triangle( GLcontext *ctx, #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -993,10 +992,10 @@ static void smooth_DITHER_5R6G5B_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -1022,10 +1021,10 @@ static void smooth_DITHER8_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ XDITHER_SETUP(y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -1044,17 +1043,16 @@ static void smooth_DITHER_triangle( GLcontext *ctx, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - #define INTERP_RGB 1 #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ XDITHER_SETUP(y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ unsigned long p = XDITHER(x, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue) ); \ XMesaPutPixel(img, x, y, p); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -1072,7 +1070,6 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx, const SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -1080,10 +1077,10 @@ static void smooth_LOOKUP8_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ LOOKUP_SETUP; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = LOOKUP(FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue));\ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -1102,7 +1099,6 @@ static void smooth_HPCR_triangle( GLcontext *ctx, const SWvertex *v2 ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -1110,10 +1106,10 @@ static void smooth_HPCR_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ - pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ + for (i = 0; i < span.end; i++, x++) { \ + pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ + span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ } @@ -1139,7 +1135,7 @@ static void flat_TRUECOLOR_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ XMesaPutPixel(img, x, y, pixel); \ } @@ -1164,7 +1160,7 @@ static void flat_8A8B8G8R_triangle( GLcontext *ctx, v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } @@ -1189,7 +1185,7 @@ static void flat_8R8G8B_triangle( GLcontext *ctx, v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } @@ -1213,7 +1209,7 @@ static void flat_8R8G8B24_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ - for (i = 0; i < span.count; i++, pixel++) { \ + for (i = 0; i < span.end; i++, pixel++) { \ pixel->r = color[RCOMP]; \ pixel->g = color[GCOMP]; \ pixel->b = color[BCOMP]; \ @@ -1232,11 +1228,10 @@ static void flat_TRUEDITHER_triangle( GLcontext *ctx, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; - #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ unsigned long p; \ PACK_TRUEDITHER(p, x, y, v2->color[0], \ v2->color[1], v2->color[2] ); \ @@ -1260,12 +1255,12 @@ static void flat_5R6G5B_triangle( GLcontext *ctx, #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) -#define SETUP_CODE \ +#define SETUP_CODE \ unsigned long p = PACK_5R6G5B( v2->color[0], \ v2->color[1], v2->color[2] ); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } @@ -1289,7 +1284,7 @@ static void flat_DITHER_5R6G5B_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ } @@ -1317,7 +1312,7 @@ static void flat_DITHER8_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y)); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ } @@ -1342,7 +1337,7 @@ static void flat_DITHER_triangle( GLcontext *ctx, GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ unsigned long p = FLAT_DITHER(x); \ XMesaPutPixel(img, x, y, p ); \ } @@ -1363,14 +1358,14 @@ static void flat_HPCR_triangle( GLcontext *ctx, #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) -#define SETUP_CODE \ +#define SETUP_CODE \ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) \ GLuint i; \ GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \ - for (i = 0; i < span.count; i++, x++) { \ + for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ } @@ -1398,7 +1393,7 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx, GLubyte p = LOOKUP(r,g,b); #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ } @@ -1410,89 +1405,89 @@ static void flat_LOOKUP8_triangle( GLcontext *ctx, extern void _xmesa_print_triangle_func( swrast_tri_func triFunc ); void _xmesa_print_triangle_func( swrast_tri_func triFunc ) { - printf("XMesa tri func = "); + _mesa_printf("XMesa tri func = "); if (triFunc ==smooth_TRUECOLOR_z_triangle) - printf("smooth_TRUECOLOR_z_triangle\n"); + _mesa_printf("smooth_TRUECOLOR_z_triangle\n"); else if (triFunc ==smooth_8A8B8G8R_z_triangle) - printf("smooth_8A8B8G8R_z_triangle\n"); + _mesa_printf("smooth_8A8B8G8R_z_triangle\n"); else if (triFunc ==smooth_8R8G8B_z_triangle) - printf("smooth_8R8G8B_z_triangle\n"); + _mesa_printf("smooth_8R8G8B_z_triangle\n"); else if (triFunc ==smooth_8R8G8B24_z_triangle) - printf("smooth_8R8G8B24_z_triangle\n"); + _mesa_printf("smooth_8R8G8B24_z_triangle\n"); else if (triFunc ==smooth_TRUEDITHER_z_triangle) - printf("smooth_TRUEDITHER_z_triangle\n"); + _mesa_printf("smooth_TRUEDITHER_z_triangle\n"); else if (triFunc ==smooth_5R6G5B_z_triangle) - printf("smooth_5R6G5B_z_triangle\n"); + _mesa_printf("smooth_5R6G5B_z_triangle\n"); else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle) - printf("smooth_DITHER_5R6G5B_z_triangle\n"); + _mesa_printf("smooth_DITHER_5R6G5B_z_triangle\n"); else if (triFunc ==smooth_HPCR_z_triangle) - printf("smooth_HPCR_z_triangle\n"); + _mesa_printf("smooth_HPCR_z_triangle\n"); else if (triFunc ==smooth_DITHER8_z_triangle) - printf("smooth_DITHER8_z_triangle\n"); + _mesa_printf("smooth_DITHER8_z_triangle\n"); else if (triFunc ==smooth_LOOKUP8_z_triangle) - printf("smooth_LOOKUP8_z_triangle\n"); + _mesa_printf("smooth_LOOKUP8_z_triangle\n"); else if (triFunc ==flat_TRUECOLOR_z_triangle) - printf("flat_TRUECOLOR_z_triangle\n"); + _mesa_printf("flat_TRUECOLOR_z_triangle\n"); else if (triFunc ==flat_8A8B8G8R_z_triangle) - printf("flat_8A8B8G8R_z_triangle\n"); + _mesa_printf("flat_8A8B8G8R_z_triangle\n"); else if (triFunc ==flat_8R8G8B_z_triangle) - printf("flat_8R8G8B_z_triangle\n"); + _mesa_printf("flat_8R8G8B_z_triangle\n"); else if (triFunc ==flat_8R8G8B24_z_triangle) - printf("flat_8R8G8B24_z_triangle\n"); + _mesa_printf("flat_8R8G8B24_z_triangle\n"); else if (triFunc ==flat_TRUEDITHER_z_triangle) - printf("flat_TRUEDITHER_z_triangle\n"); + _mesa_printf("flat_TRUEDITHER_z_triangle\n"); else if (triFunc ==flat_5R6G5B_z_triangle) - printf("flat_5R6G5B_z_triangle\n"); + _mesa_printf("flat_5R6G5B_z_triangle\n"); else if (triFunc ==flat_DITHER_5R6G5B_z_triangle) - printf("flat_DITHER_5R6G5B_z_triangle\n"); + _mesa_printf("flat_DITHER_5R6G5B_z_triangle\n"); else if (triFunc ==flat_HPCR_z_triangle) - printf("flat_HPCR_z_triangle\n"); + _mesa_printf("flat_HPCR_z_triangle\n"); else if (triFunc ==flat_DITHER8_z_triangle) - printf("flat_DITHER8_z_triangle\n"); + _mesa_printf("flat_DITHER8_z_triangle\n"); else if (triFunc ==flat_LOOKUP8_z_triangle) - printf("flat_LOOKUP8_z_triangle\n"); + _mesa_printf("flat_LOOKUP8_z_triangle\n"); else if (triFunc ==smooth_TRUECOLOR_triangle) - printf("smooth_TRUECOLOR_triangle\n"); + _mesa_printf("smooth_TRUECOLOR_triangle\n"); else if (triFunc ==smooth_8A8B8G8R_triangle) - printf("smooth_8A8B8G8R_triangle\n"); + _mesa_printf("smooth_8A8B8G8R_triangle\n"); else if (triFunc ==smooth_8R8G8B_triangle) - printf("smooth_8R8G8B_triangle\n"); + _mesa_printf("smooth_8R8G8B_triangle\n"); else if (triFunc ==smooth_8R8G8B24_triangle) - printf("smooth_8R8G8B24_triangle\n"); + _mesa_printf("smooth_8R8G8B24_triangle\n"); else if (triFunc ==smooth_TRUEDITHER_triangle) - printf("smooth_TRUEDITHER_triangle\n"); + _mesa_printf("smooth_TRUEDITHER_triangle\n"); else if (triFunc ==smooth_5R6G5B_triangle) - printf("smooth_5R6G5B_triangle\n"); + _mesa_printf("smooth_5R6G5B_triangle\n"); else if (triFunc ==smooth_DITHER_5R6G5B_triangle) - printf("smooth_DITHER_5R6G5B_triangle\n"); + _mesa_printf("smooth_DITHER_5R6G5B_triangle\n"); else if (triFunc ==smooth_HPCR_triangle) - printf("smooth_HPCR_triangle\n"); + _mesa_printf("smooth_HPCR_triangle\n"); else if (triFunc ==smooth_DITHER8_triangle) - printf("smooth_DITHER8_triangle\n"); + _mesa_printf("smooth_DITHER8_triangle\n"); else if (triFunc ==smooth_LOOKUP8_triangle) - printf("smooth_LOOKUP8_triangle\n"); + _mesa_printf("smooth_LOOKUP8_triangle\n"); else if (triFunc ==flat_TRUECOLOR_triangle) - printf("flat_TRUECOLOR_triangle\n"); + _mesa_printf("flat_TRUECOLOR_triangle\n"); else if (triFunc ==flat_TRUEDITHER_triangle) - printf("flat_TRUEDITHER_triangle\n"); + _mesa_printf("flat_TRUEDITHER_triangle\n"); else if (triFunc ==flat_8A8B8G8R_triangle) - printf("flat_8A8B8G8R_triangle\n"); + _mesa_printf("flat_8A8B8G8R_triangle\n"); else if (triFunc ==flat_8R8G8B_triangle) - printf("flat_8R8G8B_triangle\n"); + _mesa_printf("flat_8R8G8B_triangle\n"); else if (triFunc ==flat_8R8G8B24_triangle) - printf("flat_8R8G8B24_triangle\n"); + _mesa_printf("flat_8R8G8B24_triangle\n"); else if (triFunc ==flat_5R6G5B_triangle) - printf("flat_5R6G5B_triangle\n"); + _mesa_printf("flat_5R6G5B_triangle\n"); else if (triFunc ==flat_DITHER_5R6G5B_triangle) - printf("flat_DITHER_5R6G5B_triangle\n"); + _mesa_printf("flat_DITHER_5R6G5B_triangle\n"); else if (triFunc ==flat_HPCR_triangle) - printf("flat_HPCR_triangle\n"); + _mesa_printf("flat_HPCR_triangle\n"); else if (triFunc ==flat_DITHER8_triangle) - printf("flat_DITHER8_triangle\n"); + _mesa_printf("flat_DITHER8_triangle\n"); else if (triFunc ==flat_LOOKUP8_triangle) - printf("flat_LOOKUP8_triangle\n"); + _mesa_printf("flat_LOOKUP8_triangle\n"); else - printf("???\n"); + _mesa_printf("???\n"); } #endif @@ -1527,12 +1522,13 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx ) triFuncName = NULL; #endif - if (ctx->RenderMode != GL_RENDER || - ctx->Polygon.SmoothFlag || - ctx->Texture._ReallyEnabled || - (swrast->_RasterMask & MULTI_DRAW_BIT) || - (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)) - return (swrast_tri_func) NULL; + if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; + if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL; + if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL; + if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_tri_func) NULL; + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) + return (swrast_tri_func) NULL; if (xmesa->xm_buffer->buffer==XIMAGE) { if ( ctx->Light.ShadeModel==GL_SMOOTH diff --git a/xc/extras/Mesa/src/X/xmesaP.h b/xc/extras/Mesa/src/X/xmesaP.h index 06d1453c7..df3b2865f 100644 --- a/xc/extras/Mesa/src/X/xmesaP.h +++ b/xc/extras/Mesa/src/X/xmesaP.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -70,9 +70,9 @@ struct xmesa_visual { #ifdef XFree86Server GLint screen_depth; /* The depth of the screen */ #else - XVisualInfo *vishandle; /* The pointer returned by glXChooseVisual */ + XVisualInfo *vishandle; /* Only used in fakeglx.c */ #endif - XMesaVisualInfo visinfo; /* X's visual info */ + XMesaVisualInfo visinfo; /* X's visual info (pointer to private copy) */ GLint BitsPerPixel; /* True bits per pixel for XImages */ GLint level; /* 0=normal, 1=overlay, etc */ @@ -119,9 +119,9 @@ struct xmesa_visual { struct xmesa_context { GLcontext *gl_ctx; /* the core library context */ XMesaVisual xm_visual; /* Describes the buffers */ - XMesaBuffer xm_buffer; /* current draw framebuffer */ + XMesaBuffer xm_draw_buffer; /* current draw framebuffer */ XMesaBuffer xm_read_buffer; /* current read framebuffer */ - GLboolean use_read_buffer; /* read from the xm_read_buffer/ */ + XMesaBuffer xm_buffer; /* current span/point/line/triangle buffer */ XMesaDisplay *display; /* == xm_visual->display */ GLboolean swapbytes; /* Host byte order != display byte order? */ @@ -135,17 +135,25 @@ struct xmesa_context { +typedef enum { + WINDOW, /* An X window */ + GLXWINDOW, /* GLX window */ + PIXMAP, /* GLX pixmap */ + PBUFFER /* GLX Pbuffer */ +} BufferType; + + /* * "Derived" from GLframebuffer. Basically corresponds to a GLXDrawable. */ struct xmesa_buffer { GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */ + /* This MUST BE FIRST! */ GLboolean wasCurrent; /* was ever the current buffer? */ XMesaVisual xm_visual; /* the X/Mesa visual */ XMesaDisplay *display; - GLboolean pixmap_flag; /* is the buffer a Pixmap? */ - GLboolean pbuffer_flag; /* is the buffer a Pbuffer? */ + BufferType type; /* window, pixmap, pbuffer or glxwindow */ XMesaDrawable frontbuffer; /* either a window or pixmap */ XMesaPixmap backpixmap; /* back buffer Pixmap */ XMesaImage *backimage; /* back buffer simulated XImage */ @@ -155,6 +163,8 @@ struct xmesa_buffer { XMesaColormap cmap; /* the X colormap */ + unsigned long selectedEvents;/* for pbuffers only */ + GLint db_state; /* 0 = single buffered */ /* BACK_PIXMAP = use Pixmap for back buffer */ /* BACK_XIMAGE = use XImage for back buffer */ @@ -528,9 +538,7 @@ extern GLboolean XMesaForceCurrent(XMesaContext c); extern GLboolean XMesaLoseCurrent(XMesaContext c); extern void XMesaReset( void ); -extern void xmesa_set_read_buffer( GLcontext *ctx, - GLframebuffer *buffer, GLenum mode ); - extern void xmesa_resize_buffers( GLframebuffer *buffer ); + #endif diff --git a/xc/extras/Mesa/src/X86/3dnow.c b/xc/extras/Mesa/src/X86/3dnow.c index 00054e91d..01cd056b5 100644 --- a/xc/extras/Mesa/src/X86/3dnow.c +++ b/xc/extras/Mesa/src/X86/3dnow.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -30,7 +30,6 @@ #include "glheader.h" #include "context.h" -#include "math/m_vertices.h" #include "math/m_xform.h" #include "tnl/t_context.h" @@ -79,9 +78,7 @@ void _mesa_init_3dnow_transform_asm( void ) ASSIGN_XFORM_GROUP( 3dnow, 3 ); ASSIGN_XFORM_GROUP( 3dnow, 4 ); -/* Normalize function is broken - see demos/morph3d for example. - */ -/* ASSIGN_NORM_GROUP( 3dnow ); */ + ASSIGN_NORM_GROUP( 3dnow ); #ifdef DEBUG _math_test_all_transform_functions( "3DNow!" ); @@ -89,17 +86,3 @@ void _mesa_init_3dnow_transform_asm( void ) #endif #endif } - -void _mesa_init_3dnow_vertex_asm( void ) -{ -#ifdef USE_3DNOW_ASM - _mesa_xform_points3_v16_general = _mesa_v16_3dnow_general_xform; - - _mesa_project_v16 = _mesa_3dnow_project_vertices; - _mesa_project_clipped_v16 = _mesa_3dnow_project_clipped_vertices; - -#ifdef DEBUG_NOT - _math_test_all_vertex_functions( "3DNow!" ); -#endif -#endif -} diff --git a/xc/extras/Mesa/src/X86/3dnow.h b/xc/extras/Mesa/src/X86/3dnow.h index d9ea5154c..df9f2638d 100644 --- a/xc/extras/Mesa/src/X86/3dnow.h +++ b/xc/extras/Mesa/src/X86/3dnow.h @@ -34,6 +34,5 @@ #include "math/m_xform.h" void _mesa_init_3dnow_transform_asm( void ); -void _mesa_init_3dnow_vertex_asm( void ); #endif diff --git a/xc/extras/Mesa/src/X86/3dnow_normal.S b/xc/extras/Mesa/src/X86/3dnow_normal.S index 920788fc6..eec9be3ee 100644 --- a/xc/extras/Mesa/src/X86/3dnow_normal.S +++ b/xc/extras/Mesa/src/X86/3dnow_normal.S @@ -1,10 +1,9 @@ -/* $Id: 3dnow_normal.S,v 1.1.1.1 2002/10/22 13:06:12 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0.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"), @@ -101,7 +100,7 @@ LLBL (G3TN_transform): PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PREFETCHW ( REGIND(EAX) ) @@ -112,7 +111,7 @@ LLBL (G3TN_transform): PFADD ( MM2, MM0 ) /* x0*m4+x1*m5+x2*m6| x0*m0+...+x2**/ MOVQ ( REGIND (EDX), MM1 ) /* x1 | x0 */ - MOVQ ( MM0, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ MOVD ( REGOFF (8, EDX), MM2 ) /* | x2 */ @@ -125,7 +124,7 @@ LLBL (G3TN_transform): PREFETCH ( REGIND(EDX) ) - MOVD ( MM1, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ DEC_L ( EBP ) /* decrement normal counter */ JA ( LLBL (G3TN_transform) ) @@ -160,7 +159,7 @@ LLBL (G3TN_norm_w_lengths): MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ DEC_L ( EBP ) /* decrement normal counter */ JA ( LLBL (G3TN_norm_w_lengths) ) @@ -171,11 +170,14 @@ LLBL (G3TN_norm): PREFETCHW ( REGIND(EAX) ) + MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ + MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + MOVQ ( MM0, MM3 ) /* x1 | x0 */ MOVQ ( MM1, MM4 ) /* | x2 */ PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PFMUL ( MM1, MM4 ) /* | x2*x2 */ PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ @@ -194,13 +196,10 @@ LLBL (G3TN_norm): PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalize*/ - MOVQ ( MM0, REGOFF(-12, EAX) ) /* write new x0, x1 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ PFMUL ( MM5, MM1 ) /* | x2 (normalize*/ - MOVD ( MM1, REGOFF(-4, EAX) ) /* write new x2 */ - MOVQ ( REGIND (EAX), MM0 ) /* x1 | x0 */ - - MOVD ( REGOFF(8, EAX), MM1 ) /* | x2 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ JA ( LLBL (G3TN_norm) ) LLBL (G3TN_exit_3dnow): @@ -277,7 +276,7 @@ LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ PREFETCH ( REGIND(EDX) ) PFMUL ( MM2, MM7 ) /* | x2*m10 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PFMUL ( MM3, MM7 ) /* | x2 (normalized) */ PUNPCKLDQ ( MM3, MM3 ) /* length (x) | length (x) */ @@ -286,9 +285,9 @@ LLBL (G3TNNR_norm_w_lengths): /* use precalculated lengths */ PFMUL ( MM3, MM6 ) /* x1 (normalized) | x0 (normalized) */ DEC_L ( EBP ) /* decrement normal counter */ - MOVQ ( MM6, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ - MOVD ( MM7, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ MOVD ( REGIND(EDI), MM3 ) /* | length (x) */ JA ( LLBL (G3TNNR_norm_w_lengths) ) @@ -303,7 +302,7 @@ LLBL (G3TNNR_norm): /* need to calculate lengths */ MOVD ( REGOFF(8, EDX), MM7 ) /* | x2 */ PFMUL ( MM0, MM6 ) /* x1*m5 | x0*m0 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PFMUL ( MM2, MM7 ) /* | x2*m10 */ MOVQ ( MM6, MM3 ) /* x1 (transformed)| x0 (transformed) */ @@ -332,10 +331,10 @@ LLBL (G3TNNR_norm): /* need to calculate lengths */ PFRCPIT2 ( MM4, MM5 ) PFMUL ( MM5, MM6 ) /* x1 (normalized) | x0 (normalized) */ - MOVQ ( MM6, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM6, REGOFF(-16, EAX) ) /* write r0, r1 */ PFMUL ( MM5, MM7 ) /* | x2 (normalized) */ - MOVD ( MM7, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM7, REGOFF(-8, EAX) ) /* write r2 */ JA ( LLBL (G3TNNR_norm) ) @@ -404,12 +403,12 @@ LLBL (G3TRNR_rescale): PREFETCH ( REGIND(EDX) ) PFMUL ( MM2, MM5 ) /* | x2*m10 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ DEC_L ( EBP ) /* decrement normal counter */ - MOVQ ( MM4, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ - MOVD ( MM5, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ JA ( LLBL (G3TRNR_rescale) ) /* cnt > 0 ? -> process next normal */ FEMMS @@ -481,7 +480,7 @@ LLBL (G3TR_rescale): PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ @@ -496,14 +495,14 @@ LLBL (G3TR_rescale): PREFETCH ( REGIND(EDX) ) - MOVQ ( MM0, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ PFMUL ( MM7, MM2 ) /* | x2*m10 */ PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ - MOVD ( MM1, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ DEC_L ( EDI ) /* decrement normal counter */ JA ( LLBL (G3TR_rescale) ) @@ -565,12 +564,12 @@ LLBL (G3TNR_transform): PREFETCH ( REGIND(EDX) ) PFMUL ( MM2, MM5 ) /* | x2*m10 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ DEC_L ( EDI ) /* decrement normal counter */ - MOVQ ( MM4, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM4, REGOFF(-16, EAX) ) /* write r0, r1 */ - MOVD ( MM5, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM5, REGOFF(-8, EAX) ) /* write r2 */ JA ( LLBL (G3TNR_transform) ) FEMMS @@ -632,7 +631,7 @@ LLBL (G3T_transform): PUNPCKLDQ ( MM2, MM2 ) /* x2 | x2 */ PFMUL ( MM3, MM0 ) /* x1*m1 | x0*m0 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PFMUL ( MM4, MM1 ) /* x1*m5 | x0*m4 */ PFACC ( MM1, MM0 ) /* x0*m4+x1*m5 | x0*m0+x1*m1 */ @@ -641,7 +640,7 @@ LLBL (G3T_transform): PFADD ( MM2, MM0 ) /* x0*m4...+x2*m6| x0*m0+x1*m1+x2*m2 */ MOVQ ( REGIND(EDX), MM1 ) /* x1 | x0 */ - MOVQ ( MM0, REGOFF(-12, EAX) ) /* write r0, r1 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write r0, r1 */ PFMUL ( MM6, MM1 ) /* x1*m9 | x0*m8 */ MOVD ( REGOFF(8, EDX), MM2 ) /* | x2 */ @@ -654,7 +653,7 @@ LLBL (G3T_transform): PFACC ( MM1, MM1 ) /* *not used* | x0*m8+x1*m9 */ PFADD ( MM2, MM1 ) /* *not used* | x0*m8+x1*m9+x2*m10 */ - MOVD ( MM1, REGOFF(-4, EAX) ) /* write r2 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write r2 */ DEC_L ( EDI ) /* decrement normal counter */ JA ( LLBL (G3T_transform) ) @@ -718,7 +717,7 @@ LLBL (G3N_norm1): /* use precalculated lengths */ MOVQ ( MM0, REGIND(EAX) ) /* write new x0, x1 */ MOVD ( MM1, REGOFF(8, EAX) ) /* write new x2 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ ADD_L ( CONST(4), EDX ) /* next length */ DEC_L ( EBP ) /* decrement normal counter */ @@ -732,18 +731,18 @@ LLBL (G3N_norm2): /* need to calculate lengths */ PREFETCHW ( REGIND(EAX) ) - MOVQ ( MM0, MM3 ) /* x1 | x0 */ - ADD_L ( STRIDE, ECX ) /* next normal */ - PREFETCH ( REGIND(ECX) ) MOVQ ( REGIND(ECX), MM0 ) /* x1 | x0 */ MOVD ( REGOFF(8, ECX), MM1 ) /* | x2 */ + MOVQ ( MM0, MM3 ) /* x1 | x0 */ + ADD_L ( STRIDE, ECX ) /* next normal */ + PFMUL ( MM0, MM3 ) /* x1*x1 | x0*x0 */ MOVQ ( MM1, MM4 ) /* | x2 */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ PFMUL ( MM1, MM4 ) /* | x2*x2 */ PFADD ( MM4, MM3 ) /* | x0*x0+x2*x2 */ @@ -761,10 +760,10 @@ LLBL (G3N_norm2): /* need to calculate lengths */ PFRCPIT2 ( MM4, MM5 ) PFMUL ( MM5, MM0 ) /* x1 (normalized) | x0 (normalized) */ - MOVQ ( MM0, REGOFF(-12, EAX) ) /* write new x0, x1 */ + MOVQ ( MM0, REGOFF(-16, EAX) ) /* write new x0, x1 */ PFMUL ( MM5, MM1 ) /* | x2 (normalized) */ - MOVD ( MM1, REGOFF(-4, EAX) ) /* write new x2 */ + MOVD ( MM1, REGOFF(-8, EAX) ) /* write new x2 */ JA ( LLBL (G3N_norm2) ) @@ -820,10 +819,10 @@ LLBL (G3R_rescale): PREFETCH ( REGIND(ECX) ) PFMUL ( MM0, MM2 ) /* | x2*scale */ - ADD_L ( CONST(12), EAX ) /* next r */ + ADD_L ( CONST(16), EAX ) /* next r */ - MOVQ ( MM1, REGOFF(-12, EAX) ) /* write r0, r1 */ - MOVD ( MM2, REGOFF(-4, EAX) ) /* write r2 */ + MOVQ ( MM1, REGOFF(-16, EAX) ) /* write r0, r1 */ + MOVD ( MM2, REGOFF(-8, EAX) ) /* write r2 */ DEC_L ( EDX ) /* decrement normal counter */ JA ( LLBL (G3R_rescale) ) diff --git a/xc/extras/Mesa/src/X86/3dnow_vertex.S b/xc/extras/Mesa/src/X86/3dnow_vertex.S deleted file mode 100644 index 78d89ecb5..000000000 --- a/xc/extras/Mesa/src/X86/3dnow_vertex.S +++ /dev/null @@ -1,220 +0,0 @@ -#include "matypes.h" - - SEG_TEXT - -#define MAT_SY 20 -#define MAT_SZ 40 -#define MAT_TX 48 -#define MAT_TY 52 -#define MAT_TZ 56 - - -/* - * void _mesa_v16_3dnow_general_xform( GLfloat *dest, - * const GLfloat *m, - * const GLfloat *src, - * GLuint src_stride, - * GLuint count ) - * - * These tranformation functions could disappear if the standard ones - * took an output stride. - */ -GLOBL GLNAME( _mesa_v16_3dnow_general_xform ) -GLNAME( _mesa_v16_3dnow_general_xform ): - - PUSH_L ( EDI ) - PUSH_L ( ESI ) - - MOV_L ( REGOFF(12, ESP), EAX ) /* dest */ - MOV_L ( REGOFF(16, ESP), ESI ) /* mat */ - MOV_L ( REGOFF(20, ESP), EDX ) /* src */ - MOV_L ( REGOFF(24, ESP), EDI ) /* src_stride */ - MOV_L ( REGOFF(28, ESP), ECX ) /* count */ - - FEMMS - - MOVQ ( REGOFF(MAT_TX, ESI), MM7 ) /* ty | tx */ - MOVQ ( REGOFF(MAT_TZ, ESI), MM3 ) /* tw | tz */ - -ALIGNTEXT32 -LLBL( v16_3dnow_general_loop ): - - PREFETCHW ( REGOFF(128, EAX) ) /* write alloc 2 verts ahead */ - PREFETCH ( REGOFF(32, EDX) ) /* prefetch next cache line */ - - MOVQ ( REGIND(EDX), MM0 ) /* x1 | x0 */ - MOVD ( REGOFF(8, EDX), MM1 ) /* | x2 */ - MOVQ ( REGIND(ESI), MM4 ) /* m1 | m0 */ - PUNPCKHDQ ( MM0, MM2 ) /* x1 | */ - MOVQ ( REGOFF(16, ESI), MM5 ) /* m5 | m4 */ - PUNPCKLDQ ( MM0, MM0 ) /* x0 | x0 */ - MOVQ ( REGOFF(32, ESI), MM6 ) /* m9 | m8 */ - PFMUL ( MM0, MM4 ) /* x0*m1 | x0*m0 */ - PUNPCKHDQ ( MM2, MM2 ) /* x1 | x1 */ - PFMUL ( MM2, MM5 ) /* x1*m5 | x1*m4 */ - PUNPCKLDQ ( MM1, MM1 ) /* x2 | x2 */ - PFMUL ( REGOFF(8, ESI), MM0 ) /* x0*m3 | x0*m2 */ - PFMUL ( REGOFF(24, ESI), MM2 ) /* x1*m7 | x1*m6 */ - PFMUL ( MM1, MM6 ) /* x2*m9 | x2*m8 */ - PFADD ( MM4, MM5 ) /* x0*m1+x1*m5 | x0*m0+x1*m4 */ - PFMUL ( REGOFF(40, ESI), MM1 ) /* x2*m11 | x2*m10 */ - PFADD ( MM0, MM2 ) /* x0*m3+x1*m7 | x0*m2+x1*m6 */ - PFADD ( MM5, MM6 ) - PFADD ( MM1, MM2 ) - PFADD ( MM7, MM6 ) /* r1 | r0 */ - PFADD ( MM3, MM2 ) /* r3 | r2 */ - ADD_L ( EDI, EDX ) /* next input vertex */ - MOVQ ( MM6, REGIND(EAX) ) - MOVQ ( MM2, REGOFF(8, EAX) ) - ADD_L ( CONST(64), EAX ) /* next output vertex */ - DEC_L ( ECX ) - JNE ( LLBL(v16_3dnow_general_loop) ) - - FEMMS - - POP_L ( ESI ) - POP_L ( EDI ) - RET - - - -/* Do viewport map and perspective projection. Args should look like: - * - * _mesa_3dnow_project_vertices( float *first_vertex, - * const float *last_vertex, - * float *matrix, - * GLuint stride ) - * - * This routine assumes a sane vertex layout with x,y,z,w as - * the first four elements, to be projected in clip-space, to - * x/w,y/w,z/w,1/w, and then transformed according to the matrix to - * device space. The device coordinates will overwrite the clip - * coordinates as the first four elements of the vertex. - * - * If projection is required for other elements, such as texcoords, - * you will have to code a specialized version of this routine. See - * FX/X86 for examples. - * - * These routines are simplified versions of the FX code written by - * Holger. - */ - -GLOBL GLNAME( _mesa_3dnow_project_vertices ) -GLNAME( _mesa_3dnow_project_vertices ): - - PUSH_L ( EBP ) - FEMMS - PREFETCH ( REGOFF(8, ESP) ) /* fetch the first vertex */ - - MOV_L ( REGOFF(8, ESP), ECX ) /* first_vert */ - MOV_L ( REGOFF(12, ESP), EDX ) /* last_vert */ - MOV_L ( REGOFF(16, ESP), EBP ) /* matrix */ - MOV_L ( REGOFF(20, ESP), EAX ) /* stride */ - - MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */ - PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */ - MOVD ( REGIND(EBP), MM5 ) - PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */ - MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */ - SUB_L ( ECX, EDX ) /* last -= first */ - -ALIGNTEXT32 -LLBL( v16_3dnow_pv_loop_start ): - - PREFETCH ( REGOFF(64, ECX) ) /* fetch one/two verts ahead */ - MOVD ( REGOFF(12, ECX), MM0 ) /* | f[3] */ - PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */ - MOVD ( REGOFF(12, ECX), MM7 ) /* | f[3] */ - PFRCPIT1 ( MM0, MM7 ) - PFRCPIT2 ( MM0, MM7 ) /* oow | oow */ - PUNPCKLDQ ( MM7, MM7 ) - MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */ - PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */ - MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */ - PFMUL ( MM7, MM3 ) /* | f[2] * oow */ - MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */ - PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */ - PFADD ( MM0, MM3 ) /* | f[2] += vtz */ - PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */ - PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */ - PUNPCKLDQ ( MM7, MM3 ) /* f[3] = oow | f[2] */ - MOVQ ( MM2, REGOFF(0, ECX) ) - MOVQ ( MM3, REGOFF(8, ECX) ) - ADD_L ( EAX, ECX ) /* f += stride */ - SUB_L ( EAX, EDX ) - JA ( LLBL(v16_3dnow_pv_loop_start) ) - - FEMMS - POP_L ( EBP ) - RET - - - -/* - * _mesa_3dnow_project_clipped_vertices( float *first_vertex, - * const float *last_vertex, - * float *matrix, - * GLuint stride, - * const GLubyte *clip_mask ) - */ -GLOBL GLNAME( _mesa_3dnow_project_clipped_vertices ) -GLNAME( _mesa_3dnow_project_clipped_vertices ): - - PUSH_L ( EBP ) - PUSH_L ( ESI ) - - FEMMS - - PREFETCH ( REGOFF(12, ESP) ) /* fetch the first vertex */ - - MOV_L ( REGOFF(12, ESP), ECX ) /* first_vert */ - MOV_L ( REGOFF(16, ESP), EDX ) /* last_vert */ - MOV_L ( REGOFF(20, ESP), EBP ) /* matrix */ - MOV_L ( REGOFF(24, ESP), EAX ) /* stride */ - MOV_L ( REGOFF(28, ESP), ESI ) /* clip_mask */ - - - MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */ - PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */ - MOVD ( REGIND(EBP), MM5 ) - PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */ - MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */ - -ALIGNTEXT32 -LLBL( v16_3dnow_pcv_loop_start ): - - CMP_B ( CONST(0), REGIND(ESI) ) - JNE ( LLBL(v16_3dnow_pcv_skip) ) - - MOVD ( REGOFF(12, ECX), MM0) /* | f[3] */ - PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */ - MOVD ( REGOFF(12, ECX), MM7) /* | f[3] */ - PFRCPIT1 ( MM0, MM7 ) - PFRCPIT2 ( MM0, MM7 ) /* oow | oow */ - PUNPCKLDQ ( MM7, MM7 ) - MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */ - PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */ - MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */ - PFMUL ( MM7, MM3 ) /* | f[2] * oow */ - MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */ - PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */ - PFADD ( MM0, MM3 ) /* | f[2] += vtz */ - PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */ - PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */ - PUNPCKLDQ ( MM7, MM3 ) /* f[3] = oow | f[2] */ - MOVQ ( MM2, REGOFF(0, ECX) ) - MOVQ ( MM3, REGOFF(8, ECX) ) - -LLBL( v16_3dnow_pcv_skip ): - - ADD_L ( EAX, ECX ) /* f += stride */ - INC_L ( ESI ) /* next clip_mask */ - - CMP_L ( ECX, EDX ) - JNE ( LLBL(v16_3dnow_pcv_loop_start) ) - - FEMMS - - POP_L ( ESI ) - POP_L ( EBP ) - RET diff --git a/xc/extras/Mesa/src/X86/assyntax.h b/xc/extras/Mesa/src/X86/assyntax.h index 2aabbe4f8..25da11604 100644 --- a/xc/extras/Mesa/src/X86/assyntax.h +++ b/xc/extras/Mesa/src/X86/assyntax.h @@ -964,11 +964,11 @@ SECTION _DATA public align=16 class=DATA use32 flat #endif #if defined(Lynx) || (defined(SYSV) || defined(SVR4)) \ - || (defined(linux) || defined(__OS2ELF__)) && defined(__ELF__) \ + || (defined(__linux__) || defined(__OS2ELF__)) && defined(__ELF__) \ || defined(__FreeBSD__) && __FreeBSD__ >= 3 #define GLNAME(a) a #else -#define GLNAME(a) _ ## a +#define GLNAME(a) CONCAT(_, a) #endif /* @@ -1077,7 +1077,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define VARINDIRECT(var) var /* Use register contents as jump/call target: */ -#define CODEPTR(reg) reg +#define CODEPTR(reg) P_(reg) /* * Redefine assembler commands @@ -1201,7 +1201,7 @@ SECTION _DATA public align=16 class=DATA use32 flat #define JS(a) js NEAR a #define JZ(a) jz NEAR a #define JMP(a) jmp a -#define JMPF(s,a) jmpf +#define JMPF(s,a) jmp far s:a #define LAHF lahf #define LAR(a, b) lar b, a #define LEA_L(a, b) lea P_(b), P_(a) diff --git a/xc/extras/Mesa/src/X86/clip_args.h b/xc/extras/Mesa/src/X86/clip_args.h index 25eceed65..796611fbf 100644 --- a/xc/extras/Mesa/src/X86/clip_args.h +++ b/xc/extras/Mesa/src/X86/clip_args.h @@ -28,7 +28,7 @@ * FRAME_OFFSET to the number of bytes pushed onto the stack before * using the ARG_* argument macros. * - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __CLIP_ARGS_H__ diff --git a/xc/extras/Mesa/src/X86/common_x86.c b/xc/extras/Mesa/src/X86/common_x86.c index fc0fbb8c5..3d449b142 100644 --- a/xc/extras/Mesa/src/X86/common_x86.c +++ b/xc/extras/Mesa/src/X86/common_x86.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -44,14 +43,21 @@ #include "context.h" #include "common_x86_asm.h" +#include "imports.h" int _mesa_x86_cpu_features = 0; /* No reason for this to be public. */ -extern int _mesa_identify_x86_cpu_features( void ); +extern int _mesa_identify_x86_cpu_features(void); +extern GLuint _mesa_x86_has_cpuid(void); +extern void _mesa_x86_cpuid(GLuint op, GLuint *reg_eax, GLuint *reg_ebx, GLuint *reg_ecx, GLuint *reg_edx); +extern GLuint _mesa_x86_cpuid_eax(GLuint op); +extern GLuint _mesa_x86_cpuid_ebx(GLuint op); +extern GLuint _mesa_x86_cpuid_ecx(GLuint op); +extern GLuint _mesa_x86_cpuid_edx(GLuint op); static void message( const char *msg ) { @@ -236,9 +242,86 @@ static void check_os_sse_support( void ) void _mesa_init_all_x86_transform_asm( void ) { + (void) message; /* silence warning */ #ifdef USE_X86_ASM - _mesa_x86_cpu_features = _mesa_identify_x86_cpu_features(); + _mesa_x86_cpu_features = 0; + + if (!_mesa_x86_has_cpuid()) { + message("CPUID not detected"); + } + else { + GLuint cpu_features; + GLuint cpu_ext_features; + GLuint cpu_ext_info; + char cpu_vendor[13]; + GLuint result; + + /* get vendor name */ + _mesa_x86_cpuid(0, &result, (GLuint *)(cpu_vendor + 0), (GLuint *)(cpu_vendor + 8), (GLuint *)(cpu_vendor + 4)); + cpu_vendor[12] = '\0'; + + message("cpu vendor: "); + message(cpu_vendor); + message("\n"); + + /* get cpu features */ + cpu_features = _mesa_x86_cpuid_edx(1); + + if (cpu_features & X86_CPU_FPU) + _mesa_x86_cpu_features |= X86_FEATURE_FPU; + if (cpu_features & X86_CPU_CMOV) + _mesa_x86_cpu_features |= X86_FEATURE_CMOV; + +#ifdef USE_MMX_ASM + if (cpu_features & X86_CPU_MMX) + _mesa_x86_cpu_features |= X86_FEATURE_MMX; +#endif + +#ifdef USE_SSE_ASM + if (cpu_features & X86_CPU_XMM) + _mesa_x86_cpu_features |= X86_FEATURE_XMM; + if (cpu_features & X86_CPU_XMM2) + _mesa_x86_cpu_features |= X86_FEATURE_XMM2; +#endif + + /* query extended cpu features */ + if ((cpu_ext_info = _mesa_x86_cpuid_eax(0x80000000)) > 0x80000000) { + if (cpu_ext_info >= 0x80000001) { + + cpu_ext_features = _mesa_x86_cpuid_edx(0x80000001); + + if (cpu_features & X86_CPU_MMX) { + +#ifdef USE_3DNOW_ASM + if (cpu_ext_features & X86_CPUEXT_3DNOW) + _mesa_x86_cpu_features |= X86_FEATURE_3DNOW; + if (cpu_ext_features & X86_CPUEXT_3DNOW_EXT) + _mesa_x86_cpu_features |= X86_FEATURE_3DNOWEXT; +#endif +#ifdef USE_MMX_ASM + if (cpu_ext_features & X86_CPUEXT_MMX_EXT) + _mesa_x86_cpu_features |= X86_FEATURE_MMXEXT; +#endif + } + } + + /* query cpu name */ + if (cpu_ext_info >= 0x80000002) { + GLuint ofs; + char cpu_name[49]; + for (ofs = 0; ofs < 3; ofs++) + _mesa_x86_cpuid(0x80000002+ofs, (GLuint *)(cpu_name + (16*ofs)+0), (GLuint *)(cpu_name + (16*ofs)+4), (GLuint *)(cpu_name + (16*ofs)+8), (GLuint *)(cpu_name + (16*ofs)+12)); + cpu_name[48] = '\0'; /* the name should be NULL terminated, but just to be sure */ + + message("cpu name: "); + message(cpu_name); + message("\n"); + } + } + + } + if ( getenv( "MESA_NO_ASM" ) ) { _mesa_x86_cpu_features = 0; } @@ -277,6 +360,7 @@ void _mesa_init_all_x86_transform_asm( void ) message( "SSE cpu detected.\n" ); _mesa_init_sse_transform_asm(); } else { + message( "SSE cpu detected, but switched off by user.\n" ); _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); } } @@ -284,26 +368,3 @@ void _mesa_init_all_x86_transform_asm( void ) #endif } -/* Note: the above function must be called before this one, so that - * _mesa_x86_cpu_features gets correctly initialized. - */ -void _mesa_init_all_x86_vertex_asm( void ) -{ -#ifdef USE_X86_ASM - if ( _mesa_x86_cpu_features ) { - _mesa_init_x86_vertex_asm(); - } - -#ifdef USE_3DNOW_ASM - if ( cpu_has_3dnow && getenv( "MESA_NO_3DNOW" ) == 0 ) { - _mesa_init_3dnow_vertex_asm(); - } -#endif - -#ifdef USE_SSE_ASM - if ( cpu_has_xmm && getenv( "MESA_NO_SSE" ) == 0 ) { - _mesa_init_sse_vertex_asm(); - } -#endif -#endif -} diff --git a/xc/extras/Mesa/src/X86/common_x86_asm.S b/xc/extras/Mesa/src/X86/common_x86_asm.S index 9241843ff..019e16732 100644 --- a/xc/extras/Mesa/src/X86/common_x86_asm.S +++ b/xc/extras/Mesa/src/X86/common_x86_asm.S @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.0.3 + * 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"), @@ -22,7 +21,6 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/X86/common_x86_asm.S,v 1.13 2002/09/09 21:52:14 dawes Exp $ */ /* * Check extended CPU capabilities. Now justs returns the raw CPUID @@ -32,6 +30,7 @@ * Written by Holger Waechtler <holger@akaflieg.extern.tu-berlin.de> * * Cleaned up and simplified by Gareth Hughes <gareth@valinux.com> + * */ /* @@ -43,139 +42,105 @@ #include "matypes.h" #include "common_x86_features.h" + SEG_TEXT -/* Intel vendor string - */ -#define GENU 0x756e6547 /* "Genu" */ -#define INEI 0x49656e69 /* "ineI" */ -#define NTEL 0x6c65746e /* "ntel" */ +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_has_cpuid) +GLNAME(_mesa_x86_has_cpuid): -/* AMD vendor string - */ -#define AUTH 0x68747541 /* "Auth" */ -#define ENTI 0x69746e65 /* "enti" */ -#define CAMD 0x444d4163 /* "cAMD" */ + /* Test for the CPUID command. If the ID Flag bit in EFLAGS + * (bit 21) is writable, the CPUID command is present */ + PUSHF_L + POP_L (EAX) + MOV_L (EAX, ECX) + XOR_L (CONST(0x00200000), EAX) + PUSH_L (EAX) + POPF_L + PUSHF_L + POP_L (EAX) + /* Verify the ID Flag bit has been written. */ + CMP_L (ECX, EAX) + SETNE (AL) + XOR_L (CONST(0xff), EAX) - SEG_DATA + RET -/* We might want to print out some useful messages. - */ -GLNAME( found_intel ): STRING( "Genuine Intel processor found\n\0" ) -GLNAME( found_amd ): STRING( "Authentic AMD processor found\n\0" ) -#ifdef USE_SSE_ASM -GLNAME( sse_test_dummy ): - D_LONG 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000 -#endif +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid) +GLNAME(_mesa_x86_cpuid): + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EDI) + PUSH_L (EBX) - SEG_TEXT + CPUID + + MOV_L (REGOFF(16, ESP), EDI) /* *eax */ + MOV_L (EAX, REGIND(EDI)) + MOV_L (REGOFF(20, ESP), EDI) /* *ebx */ + MOV_L (EBX, REGIND(EDI)) + MOV_L (REGOFF(24, ESP), EDI) /* *ecx */ + MOV_L (ECX, REGIND(EDI)) + MOV_L (REGOFF(28, ESP), EDI) /* *edx */ + MOV_L (EDX, REGIND(EDI)) + + POP_L (EBX) + POP_L (EDI) + RET ALIGNTEXT4 -GLOBL GLNAME( _mesa_identify_x86_cpu_features ) -GLNAME( _mesa_identify_x86_cpu_features ): +GLOBL GLNAME(_mesa_x86_cpuid_eax) +GLNAME(_mesa_x86_cpuid_eax): - PUSH_L ( EBX ) + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) - /* Test for the CPUID command. If the ID Flag bit in EFLAGS - * (bit 21) is writable, the CPUID command is present. - */ - PUSHF_L - POP_L ( EAX ) - MOV_L ( EAX, ECX ) - XOR_L ( CONST(0x00200000), EAX ) - PUSH_L ( EAX ) - POPF_L - PUSHF_L - POP_L ( EAX ) + CPUID - /* Verify the ID Flag bit has been written. - */ - CMP_L ( ECX, EAX ) - JZ ( LLBL (cpuid_done) ) + POP_L (EBX) + RET - /* Get the CPU vendor info. - */ - XOR_L ( EAX, EAX ) - CPUID +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_ebx) +GLNAME(_mesa_x86_cpuid_ebx): + + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) - /* Test for Intel processors. We must look for the - * "GenuineIntel" string in EBX, ECX and EDX. - */ - CMP_L ( CONST(GENU), EBX ) - JNE ( LLBL(cpuid_amd) ) - CMP_L ( CONST(INEI), EDX ) - JNE ( LLBL(cpuid_amd) ) - CMP_L ( CONST(NTEL), ECX ) - JNE ( LLBL(cpuid_amd) ) - - /* We have an Intel processor, so we can get the feature - * information with an CPUID input value of 1. - */ - MOV_L ( CONST(0x1), EAX ) CPUID - MOV_L ( EDX, EAX ) - JMP ( LLBL(cpuid_done) ) + MOV_L (EBX, EAX) /* return EBX */ -LLBL(cpuid_amd): + POP_L (EBX) + RET - /* Test for AMD processors. We must look for the - * "AuthenticAMD" string in EBX, ECX and EDX. - */ - CMP_L ( CONST(AUTH), EBX ) - JNE ( LLBL(cpuid_other) ) - CMP_L ( CONST(ENTI), EDX ) - JNE ( LLBL(cpuid_other) ) - CMP_L ( CONST(CAMD), ECX ) - JNE ( LLBL(cpuid_other) ) - - /* We have an AMD processor, so we can get the feature - * information after we verify that the extended functions are - * supported. - */ - /* The features we need are almost all in the extended set. The - * exception is SSE enable, which is in the standard set (0x1). - */ - MOV_L ( CONST(0x1), EAX ) - CPUID - TEST_L ( EAX, EAX ) - JZ ( LLBL (cpuid_failed) ) - MOV_L ( EDX, ESI ) +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_ecx) +GLNAME(_mesa_x86_cpuid_ecx): - MOV_L ( CONST(0x80000000), EAX ) - CPUID - TEST_L ( EAX, EAX ) - JZ ( LLBL (cpuid_failed) ) + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) - MOV_L ( CONST(0x80000001), EAX ) CPUID - MOV_L ( EDX, EAX ) - - AND_L ( CONST(0x02000000), ESI ) /* OR in the SSE bit */ - OR_L ( ESI, EAX ) - - JMP ( LLBL (cpuid_done) ) - -LLBL(cpuid_other): + MOV_L (ECX, EAX) /* return ECX */ - /* Test for other processors here when required. - */ + POP_L (EBX) + RET -LLBL(cpuid_failed): +ALIGNTEXT4 +GLOBL GLNAME(_mesa_x86_cpuid_edx) +GLNAME(_mesa_x86_cpuid_edx): - /* If we can't determine the feature information, we must - * return zero to indicate that no platform-specific - * optimizations can be used. - */ - MOV_L ( CONST(0), EAX ) + MOV_L (REGOFF(4, ESP), EAX) /* cpuid op */ + PUSH_L (EBX) -LLBL (cpuid_done): + CPUID + MOV_L (EDX, EAX) /* return EDX */ - POP_L ( EBX ) + POP_L (EBX) RET - #ifdef USE_SSE_ASM /* Execute an SSE instruction to see if the operating system correctly * supports SSE. A signal handler for SIGILL should have been set @@ -215,7 +180,13 @@ GLNAME( _mesa_test_os_sse_exception_support ): LDMXCSR ( REGOFF( -8, EBP ) ) XORPS ( XMM0, XMM0 ) - MOVUPS ( CONTENT( GLNAME( sse_test_dummy ) ), XMM1 ) + + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + PUSH_L ( CONST( 0x3f800000 ) ) + + MOVUPS ( REGIND( ESP ), XMM1 ) DIVPS ( XMM0, XMM1 ) @@ -227,3 +198,4 @@ GLNAME( _mesa_test_os_sse_exception_support ): RET #endif + diff --git a/xc/extras/Mesa/src/X86/common_x86_asm.h b/xc/extras/Mesa/src/X86/common_x86_asm.h index 38096eced..46d1a4b07 100644 --- a/xc/extras/Mesa/src/X86/common_x86_asm.h +++ b/xc/extras/Mesa/src/X86/common_x86_asm.h @@ -31,7 +31,7 @@ * Changed by Andre Werthmann <wertmann@cs.uni-potsdam.de> for using the * new Katmai functions * - * Reimplemented by Gareth Hughes <gareth@valinux.com> in a more + * Reimplemented by Gareth Hughes in a more * future-proof manner, based on code in the Linux kernel. */ @@ -59,6 +59,5 @@ extern int _mesa_x86_cpu_features; extern void _mesa_init_all_x86_transform_asm( void ); -extern void _mesa_init_all_x86_vertex_asm( void ); #endif diff --git a/xc/extras/Mesa/src/X86/common_x86_features.h b/xc/extras/Mesa/src/X86/common_x86_features.h index f82c92674..1820e67c3 100644 --- a/xc/extras/Mesa/src/X86/common_x86_features.h +++ b/xc/extras/Mesa/src/X86/common_x86_features.h @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -28,46 +27,33 @@ * _mesa_identify_x86_cpu_features() and interpreted with the cpu_has_* * helper macros. * - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __COMMON_X86_FEATURES_H__ #define __COMMON_X86_FEATURES_H__ -/* Capabilities of CPUs - */ -#define X86_FEATURE_FPU 0x00000001 -#define X86_FEATURE_VME 0x00000002 -#define X86_FEATURE_DE 0x00000004 -#define X86_FEATURE_PSE 0x00000008 -#define X86_FEATURE_TSC 0x00000010 -#define X86_FEATURE_MSR 0x00000020 -#define X86_FEATURE_PAE 0x00000040 -#define X86_FEATURE_MCE 0x00000080 -#define X86_FEATURE_CX8 0x00000100 -#define X86_FEATURE_APIC 0x00000200 -#define X86_FEATURE_10 0x00000400 -#define X86_FEATURE_SEP 0x00000800 -#define X86_FEATURE_MTRR 0x00001000 -#define X86_FEATURE_PGE 0x00002000 -#define X86_FEATURE_MCA 0x00004000 -#define X86_FEATURE_CMOV 0x00008000 -#define X86_FEATURE_PAT 0x00010000 -#define X86_FEATURE_PSE36 0x00020000 -#define X86_FEATURE_18 0x00040000 -#define X86_FEATURE_19 0x00080000 -#define X86_FEATURE_20 0x00100000 -#define X86_FEATURE_21 0x00200000 -#define X86_FEATURE_MMXEXT 0x00400000 -#define X86_FEATURE_MMX 0x00800000 -#define X86_FEATURE_FXSR 0x01000000 -#define X86_FEATURE_XMM 0x02000000 -#define X86_FEATURE_XMM2 0x04000000 -#define X86_FEATURE_27 0x08000000 -#define X86_FEATURE_28 0x10000000 -#define X86_FEATURE_29 0x20000000 -#define X86_FEATURE_3DNOWEXT 0x40000000 -#define X86_FEATURE_3DNOW 0x80000000 +#define X86_FEATURE_FPU (1<<0) +#define X86_FEATURE_CMOV (1<<1) +#define X86_FEATURE_MMXEXT (1<<2) +#define X86_FEATURE_MMX (1<<3) +#define X86_FEATURE_FXSR (1<<4) +#define X86_FEATURE_XMM (1<<5) +#define X86_FEATURE_XMM2 (1<<6) +#define X86_FEATURE_3DNOWEXT (1<<7) +#define X86_FEATURE_3DNOW (1<<8) + +/* standard X86 CPU features */ +#define X86_CPU_FPU (1<<0) +#define X86_CPU_CMOV (1<<15) +#define X86_CPU_MMX (1<<23) +#define X86_CPU_XMM (1<<25) +#define X86_CPU_XMM2 (1<<26) + +/* extended X86 CPU features */ +#define X86_CPUEXT_MMX_EXT (1<<22) +#define X86_CPUEXT_3DNOW_EXT (1<<30) +#define X86_CPUEXT_3DNOW (1<<31) #define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) #define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) @@ -77,3 +63,4 @@ #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) #endif + diff --git a/xc/extras/Mesa/src/X86/common_x86_macros.h b/xc/extras/Mesa/src/X86/common_x86_macros.h index 05574e539..462f32b3f 100644 --- a/xc/extras/Mesa/src/X86/common_x86_macros.h +++ b/xc/extras/Mesa/src/X86/common_x86_macros.h @@ -1,4 +1,3 @@ -/* $Id: common_x86_macros.h,v 1.1.1.1 2002/10/22 13:06:16 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __COMMON_X86_MACROS_H__ @@ -71,9 +70,9 @@ extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS ); #define NORM_ARGS const GLmatrix *mat, \ GLfloat scale, \ - const GLvector3f *in, \ + const GLvector4f *in, \ const GLfloat *lengths, \ - GLvector3f *dest + GLvector4f *dest #define DECLARE_NORM_GROUP( pfx ) \ extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \ diff --git a/xc/extras/Mesa/src/X86/gen_matypes.c b/xc/extras/Mesa/src/X86/gen_matypes.c index c983fdd5f..8682f33c8 100644 --- a/xc/extras/Mesa/src/X86/gen_matypes.c +++ b/xc/extras/Mesa/src/X86/gen_matypes.c @@ -1,10 +1,9 @@ -/* $Id: gen_matypes.c,v 1.1.1.1 2002/10/22 13:06:08 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ /* @@ -34,13 +33,10 @@ * Mesa, including lighting, clipping, texture image conversion etc. */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "mtypes.h" #include "tnl/t_context.h" -#endif + #undef offsetof #define offsetof( type, member ) ((size_t) &((type *)0)->member) @@ -66,11 +62,21 @@ do { \ printf( "\n" ); \ } while (0) +#if defined(__BEOS__) +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%ld\n", s, offsetof( t, m ) ); +#else #define OFFSET( s, t, m ) \ printf( "#define %s\t%d\n", s, offsetof( t, m ) ); +#endif +#if defined(__BEOS__) +#define SIZEOF( s, t ) \ + printf( "#define %s\t%ld\n", s, sizeof(t) ); +#else #define SIZEOF( s, t ) \ printf( "#define %s\t%d\n", s, sizeof(t) ); +#endif #define DEFINE( s, d ) \ printf( "#define %s\t0x%x\n", s, d ); @@ -122,7 +128,7 @@ int main( int argc, char **argv ) OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, ObjPtr ); OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr ); OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr ); - OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, ProjectedClipPtr ); + OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr ); OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask ); OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, NormalPtr ); @@ -148,34 +154,35 @@ int main( int argc, char **argv ) DEFINE_HEADER( "struct vertex_buffer" ); - DEFINE( "VERT_OBJ ", VERT_OBJ ); - DEFINE( "VERT_RGBA ", VERT_RGBA ); - DEFINE( "VERT_NORM ", VERT_NORM ); - DEFINE( "VERT_INDEX ", VERT_INDEX ); - DEFINE( "VERT_EDGE ", VERT_EDGE ); - DEFINE( "VERT_SPEC_RGB ", VERT_SPEC_RGB ); - DEFINE( "VERT_FOG_COORD ", VERT_FOG_COORD ); - DEFINE( "VERT_TEX0 ", VERT_TEX0 ); - DEFINE( "VERT_TEX1 ", VERT_TEX1 ); - DEFINE( "VERT_TEX2 ", VERT_TEX2 ); - DEFINE( "VERT_TEX3 ", VERT_TEX3 ); - DEFINE( "VERT_EVAL_C1 ", VERT_EVAL_C1 ); - DEFINE( "VERT_EVAL_C2 ", VERT_EVAL_C2 ); - DEFINE( "VERT_EVAL_P1 ", VERT_EVAL_P1 ); - DEFINE( "VERT_EVAL_P2 ", VERT_EVAL_P2 ); - DEFINE( "VERT_OBJ_3 ", VERT_OBJ_3 ); - DEFINE( "VERT_OBJ_4 ", VERT_OBJ_4 ); - DEFINE( "VERT_MATERIAL ", VERT_MATERIAL ); - DEFINE( "VERT_ELT ", VERT_ELT ); - DEFINE( "VERT_BEGIN ", VERT_BEGIN ); - DEFINE( "VERT_END ", VERT_END ); - DEFINE( "VERT_END_VB ", VERT_END_VB ); - DEFINE( "VERT_POINT_SIZE ", VERT_POINT_SIZE ); - DEFINE( "VERT_EYE ", VERT_EYE ); - DEFINE( "VERT_CLIP ", VERT_CLIP ); + /* XXX use new labels here someday after vertex proram is done */ + DEFINE( "VERT_BIT_OBJ ", VERT_BIT_POS ); + DEFINE( "VERT_BIT_NORM ", VERT_BIT_NORMAL ); + DEFINE( "VERT_BIT_RGBA ", VERT_BIT_COLOR0 ); + DEFINE( "VERT_BIT_SPEC_RGB ", VERT_BIT_COLOR1 ); + DEFINE( "VERT_BIT_FOG_COORD ", VERT_BIT_FOG ); + DEFINE( "VERT_BIT_INDEX ", VERT_BIT_INDEX ); + DEFINE( "VERT_BIT_EDGE ", VERT_BIT_EDGEFLAG ); + DEFINE( "VERT_BIT_TEX0 ", VERT_BIT_TEX0 ); + DEFINE( "VERT_BIT_TEX1 ", VERT_BIT_TEX1 ); + DEFINE( "VERT_BIT_TEX2 ", VERT_BIT_TEX2 ); + DEFINE( "VERT_BIT_TEX3 ", VERT_BIT_TEX3 ); + DEFINE( "VERT_BIT_EVAL_C1 ", VERT_BIT_EVAL_C1 ); + DEFINE( "VERT_BIT_EVAL_C2 ", VERT_BIT_EVAL_C2 ); + DEFINE( "VERT_BIT_EVAL_P1 ", VERT_BIT_EVAL_P1 ); + DEFINE( "VERT_BIT_EVAL_P2 ", VERT_BIT_EVAL_P2 ); + DEFINE( "VERT_BIT_OBJ_3 ", VERT_BIT_OBJ_3 ); + DEFINE( "VERT_BIT_OBJ_4 ", VERT_BIT_OBJ_4 ); + DEFINE( "VERT_BIT_MATERIAL ", VERT_BIT_MATERIAL ); + DEFINE( "VERT_BIT_ELT ", VERT_BIT_ELT ); + DEFINE( "VERT_BIT_BEGIN ", VERT_BIT_BEGIN ); + DEFINE( "VERT_BIT_END ", VERT_BIT_END ); + DEFINE( "VERT_BIT_END_VB ", VERT_BIT_END_VB ); + DEFINE( "VERT_BIT_POINT_SIZE ", VERT_BIT_POINT_SIZE ); + DEFINE( "VERT_BIT_EYE ", VERT_BIT_EYE ); + DEFINE( "VERT_BIT_CLIP ", VERT_BIT_CLIP ); printf( "\n" ); - DEFINE( "VERT_OBJ_23 ", VERT_OBJ_3 ); - DEFINE( "VERT_OBJ_234 ", VERT_OBJ_4 ); + DEFINE( "VERT_BIT_OBJ_23 ", VERT_BIT_OBJ_3 ); + DEFINE( "VERT_BIT_OBJ_234 ", VERT_BIT_OBJ_4 ); /* GLvector3f offsets: diff --git a/xc/extras/Mesa/src/X86/glapi_x86.S b/xc/extras/Mesa/src/X86/glapi_x86.S index 5d1fbc168..57dd296c7 100644 --- a/xc/extras/Mesa/src/X86/glapi_x86.S +++ b/xc/extras/Mesa/src/X86/glapi_x86.S @@ -19,4003 +19,4843 @@ #endif +EXTERN GLNAME(_glapi_Dispatch) + ALIGNTEXT16 GLOBL_FN(GL_PREFIX(NewList)) GL_PREFIX(NewList): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_NewList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EndList)) GL_PREFIX(EndList): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EndList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CallList)) GL_PREFIX(CallList): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CallList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CallLists)) GL_PREFIX(CallLists): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CallLists)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DeleteLists)) GL_PREFIX(DeleteLists): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteLists)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenLists)) GL_PREFIX(GenLists): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenLists)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListBase)) GL_PREFIX(ListBase): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListBase)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Begin)) GL_PREFIX(Begin): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Begin)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Bitmap)) GL_PREFIX(Bitmap): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Bitmap)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3b)) GL_PREFIX(Color3b): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3b)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3bv)) GL_PREFIX(Color3bv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3bv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3d)) GL_PREFIX(Color3d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3dv)) GL_PREFIX(Color3dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3f)) GL_PREFIX(Color3f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3fv)) GL_PREFIX(Color3fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3i)) GL_PREFIX(Color3i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3iv)) GL_PREFIX(Color3iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3s)) GL_PREFIX(Color3s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3sv)) GL_PREFIX(Color3sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ub)) GL_PREFIX(Color3ub): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3ub)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ubv)) GL_PREFIX(Color3ubv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3ubv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ui)) GL_PREFIX(Color3ui): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3ui)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3uiv)) GL_PREFIX(Color3uiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3uiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3us)) GL_PREFIX(Color3us): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3us)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3usv)) GL_PREFIX(Color3usv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color3usv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4b)) GL_PREFIX(Color4b): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4b)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4bv)) GL_PREFIX(Color4bv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4bv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4d)) GL_PREFIX(Color4d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4dv)) GL_PREFIX(Color4dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4f)) GL_PREFIX(Color4f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4fv)) GL_PREFIX(Color4fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4i)) GL_PREFIX(Color4i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4iv)) GL_PREFIX(Color4iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4s)) GL_PREFIX(Color4s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4sv)) GL_PREFIX(Color4sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ub)) GL_PREFIX(Color4ub): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4ub)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ubv)) GL_PREFIX(Color4ubv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4ubv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ui)) GL_PREFIX(Color4ui): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4ui)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4uiv)) GL_PREFIX(Color4uiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4uiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4us)) GL_PREFIX(Color4us): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4us)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4usv)) GL_PREFIX(Color4usv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Color4usv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlag)) GL_PREFIX(EdgeFlag): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlag)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlagv)) GL_PREFIX(EdgeFlagv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlagv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(End)) GL_PREFIX(End): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_End)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexd)) GL_PREFIX(Indexd): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexdv)) GL_PREFIX(Indexdv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexdv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexf)) GL_PREFIX(Indexf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexfv)) GL_PREFIX(Indexfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexi)) GL_PREFIX(Indexi): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexiv)) GL_PREFIX(Indexiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexs)) GL_PREFIX(Indexs): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexs)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexsv)) GL_PREFIX(Indexsv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexsv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3b)) GL_PREFIX(Normal3b): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3b)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3bv)) GL_PREFIX(Normal3bv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3bv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3d)) GL_PREFIX(Normal3d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3dv)) GL_PREFIX(Normal3dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3f)) GL_PREFIX(Normal3f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3fv)) GL_PREFIX(Normal3fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3i)) GL_PREFIX(Normal3i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3iv)) GL_PREFIX(Normal3iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3s)) GL_PREFIX(Normal3s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3sv)) GL_PREFIX(Normal3sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Normal3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2d)) GL_PREFIX(RasterPos2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2dv)) GL_PREFIX(RasterPos2dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2f)) GL_PREFIX(RasterPos2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2fv)) GL_PREFIX(RasterPos2fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2i)) GL_PREFIX(RasterPos2i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2iv)) GL_PREFIX(RasterPos2iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2s)) GL_PREFIX(RasterPos2s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2sv)) GL_PREFIX(RasterPos2sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos2sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3d)) GL_PREFIX(RasterPos3d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3dv)) GL_PREFIX(RasterPos3dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3f)) GL_PREFIX(RasterPos3f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3fv)) GL_PREFIX(RasterPos3fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3i)) GL_PREFIX(RasterPos3i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3iv)) GL_PREFIX(RasterPos3iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3s)) GL_PREFIX(RasterPos3s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3sv)) GL_PREFIX(RasterPos3sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4d)) GL_PREFIX(RasterPos4d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4dv)) GL_PREFIX(RasterPos4dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4f)) GL_PREFIX(RasterPos4f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4fv)) GL_PREFIX(RasterPos4fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4i)) GL_PREFIX(RasterPos4i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4iv)) GL_PREFIX(RasterPos4iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4s)) GL_PREFIX(RasterPos4s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4sv)) GL_PREFIX(RasterPos4sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RasterPos4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectd)) GL_PREFIX(Rectd): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectdv)) GL_PREFIX(Rectdv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectdv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectf)) GL_PREFIX(Rectf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectfv)) GL_PREFIX(Rectfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Recti)) GL_PREFIX(Recti): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Recti)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectiv)) GL_PREFIX(Rectiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rects)) GL_PREFIX(Rects): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rects)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectsv)) GL_PREFIX(Rectsv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rectsv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1d)) GL_PREFIX(TexCoord1d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1dv)) GL_PREFIX(TexCoord1dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1f)) GL_PREFIX(TexCoord1f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1fv)) GL_PREFIX(TexCoord1fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1i)) GL_PREFIX(TexCoord1i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1iv)) GL_PREFIX(TexCoord1iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1s)) GL_PREFIX(TexCoord1s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1sv)) GL_PREFIX(TexCoord1sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord1sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2d)) GL_PREFIX(TexCoord2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2dv)) GL_PREFIX(TexCoord2dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2f)) GL_PREFIX(TexCoord2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2fv)) GL_PREFIX(TexCoord2fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2i)) GL_PREFIX(TexCoord2i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2iv)) GL_PREFIX(TexCoord2iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2s)) GL_PREFIX(TexCoord2s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2sv)) GL_PREFIX(TexCoord2sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord2sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3d)) GL_PREFIX(TexCoord3d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3dv)) GL_PREFIX(TexCoord3dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3f)) GL_PREFIX(TexCoord3f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3fv)) GL_PREFIX(TexCoord3fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3i)) GL_PREFIX(TexCoord3i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3iv)) GL_PREFIX(TexCoord3iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3s)) GL_PREFIX(TexCoord3s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3sv)) GL_PREFIX(TexCoord3sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4d)) GL_PREFIX(TexCoord4d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4dv)) GL_PREFIX(TexCoord4dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4f)) GL_PREFIX(TexCoord4f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4fv)) GL_PREFIX(TexCoord4fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4i)) GL_PREFIX(TexCoord4i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4iv)) GL_PREFIX(TexCoord4iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4s)) GL_PREFIX(TexCoord4s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4sv)) GL_PREFIX(TexCoord4sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoord4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2d)) GL_PREFIX(Vertex2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2dv)) GL_PREFIX(Vertex2dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2f)) GL_PREFIX(Vertex2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2fv)) GL_PREFIX(Vertex2fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2i)) GL_PREFIX(Vertex2i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2iv)) GL_PREFIX(Vertex2iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2s)) GL_PREFIX(Vertex2s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2sv)) GL_PREFIX(Vertex2sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex2sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3d)) GL_PREFIX(Vertex3d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3dv)) GL_PREFIX(Vertex3dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3f)) GL_PREFIX(Vertex3f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3fv)) GL_PREFIX(Vertex3fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3i)) GL_PREFIX(Vertex3i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3iv)) GL_PREFIX(Vertex3iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3s)) GL_PREFIX(Vertex3s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3sv)) GL_PREFIX(Vertex3sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4d)) GL_PREFIX(Vertex4d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4dv)) GL_PREFIX(Vertex4dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4f)) GL_PREFIX(Vertex4f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4fv)) GL_PREFIX(Vertex4fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4i)) GL_PREFIX(Vertex4i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4iv)) GL_PREFIX(Vertex4iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4s)) GL_PREFIX(Vertex4s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4sv)) GL_PREFIX(Vertex4sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Vertex4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClipPlane)) GL_PREFIX(ClipPlane): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClipPlane)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorMaterial)) GL_PREFIX(ColorMaterial): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorMaterial)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CullFace)) GL_PREFIX(CullFace): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CullFace)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogf)) GL_PREFIX(Fogf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogfv)) GL_PREFIX(Fogfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogi)) GL_PREFIX(Fogi): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogiv)) GL_PREFIX(Fogiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Fogiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FrontFace)) GL_PREFIX(FrontFace): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FrontFace)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Hint)) GL_PREFIX(Hint): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Hint)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lightf)) GL_PREFIX(Lightf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lightf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lightfv)) GL_PREFIX(Lightfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lightfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lighti)) GL_PREFIX(Lighti): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lighti)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lightiv)) GL_PREFIX(Lightiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Lightiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModelf)) GL_PREFIX(LightModelf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModelf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModelfv)) GL_PREFIX(LightModelfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModelfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModeli)) GL_PREFIX(LightModeli): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModeli)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModeliv)) GL_PREFIX(LightModeliv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightModeliv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LineStipple)) GL_PREFIX(LineStipple): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LineStipple)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LineWidth)) GL_PREFIX(LineWidth): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LineWidth)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materialf)) GL_PREFIX(Materialf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materialf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materialfv)) GL_PREFIX(Materialfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materialfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materiali)) GL_PREFIX(Materiali): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materiali)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materialiv)) GL_PREFIX(Materialiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Materialiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointSize)) GL_PREFIX(PointSize): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointSize)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonMode)) GL_PREFIX(PolygonMode): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonMode)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonStipple)) GL_PREFIX(PolygonStipple): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonStipple)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Scissor)) GL_PREFIX(Scissor): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Scissor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ShadeModel)) GL_PREFIX(ShadeModel): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ShadeModel)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameterf)) GL_PREFIX(TexParameterf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameterf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameterfv)) GL_PREFIX(TexParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameteri)) GL_PREFIX(TexParameteri): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameteri)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameteriv)) GL_PREFIX(TexParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage1D)) GL_PREFIX(TexImage1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage2D)) GL_PREFIX(TexImage2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnvf)) GL_PREFIX(TexEnvf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnvf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnvfv)) GL_PREFIX(TexEnvfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnvfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnvi)) GL_PREFIX(TexEnvi): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnvi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnviv)) GL_PREFIX(TexEnviv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexEnviv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGend)) GL_PREFIX(TexGend): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGend)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGendv)) GL_PREFIX(TexGendv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGendv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGenf)) GL_PREFIX(TexGenf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGenf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGenfv)) GL_PREFIX(TexGenfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGenfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGeni)) GL_PREFIX(TexGeni): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGeni)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGeniv)) GL_PREFIX(TexGeniv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexGeniv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FeedbackBuffer)) GL_PREFIX(FeedbackBuffer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SelectBuffer)) GL_PREFIX(SelectBuffer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SelectBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RenderMode)) GL_PREFIX(RenderMode): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_RenderMode)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InitNames)) GL_PREFIX(InitNames): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_InitNames)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadName)) GL_PREFIX(LoadName): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadName)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PassThrough)) GL_PREFIX(PassThrough): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PassThrough)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopName)) GL_PREFIX(PopName): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopName)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushName)) GL_PREFIX(PushName): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushName)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawBuffer)) GL_PREFIX(DrawBuffer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Clear)) GL_PREFIX(Clear): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Clear)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearAccum)) GL_PREFIX(ClearAccum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearAccum)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearIndex)) GL_PREFIX(ClearIndex): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearIndex)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearColor)) GL_PREFIX(ClearColor): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearColor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearStencil)) GL_PREFIX(ClearStencil): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearStencil)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearDepth)) GL_PREFIX(ClearDepth): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClearDepth)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StencilMask)) GL_PREFIX(StencilMask): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StencilMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorMask)) GL_PREFIX(ColorMask): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DepthMask)) GL_PREFIX(DepthMask): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexMask)) GL_PREFIX(IndexMask): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Accum)) GL_PREFIX(Accum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Disable)) GL_PREFIX(Disable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Disable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Enable)) GL_PREFIX(Enable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Enable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Finish)) GL_PREFIX(Finish): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Finish)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Flush)) GL_PREFIX(Flush): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Flush)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopAttrib)) GL_PREFIX(PopAttrib): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushAttrib)) GL_PREFIX(PushAttrib): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map1d)) GL_PREFIX(Map1d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map1f)) GL_PREFIX(Map1f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map2d)) GL_PREFIX(Map2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map2f)) GL_PREFIX(Map2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Map2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid1d)) GL_PREFIX(MapGrid1d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid1f)) GL_PREFIX(MapGrid1f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid2d)) GL_PREFIX(MapGrid2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid2f)) GL_PREFIX(MapGrid2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MapGrid2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1d)) GL_PREFIX(EvalCoord1d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1dv)) GL_PREFIX(EvalCoord1dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1f)) GL_PREFIX(EvalCoord1f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1fv)) GL_PREFIX(EvalCoord1fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2d)) GL_PREFIX(EvalCoord2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2dv)) GL_PREFIX(EvalCoord2dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2f)) GL_PREFIX(EvalCoord2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2fv)) GL_PREFIX(EvalCoord2fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalMesh1)) GL_PREFIX(EvalMesh1): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalMesh1)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalPoint1)) GL_PREFIX(EvalPoint1): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalPoint1)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalMesh2)) GL_PREFIX(EvalMesh2): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalMesh2)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalPoint2)) GL_PREFIX(EvalPoint2): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EvalPoint2)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(AlphaFunc)) GL_PREFIX(AlphaFunc): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AlphaFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendFunc)) GL_PREFIX(BlendFunc): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LogicOp)) GL_PREFIX(LogicOp): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LogicOp)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StencilFunc)) GL_PREFIX(StencilFunc): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StencilFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StencilOp)) GL_PREFIX(StencilOp): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StencilOp)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DepthFunc)) GL_PREFIX(DepthFunc): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelZoom)) GL_PREFIX(PixelZoom): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelZoom)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTransferf)) GL_PREFIX(PixelTransferf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTransferf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTransferi)) GL_PREFIX(PixelTransferi): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTransferi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelStoref)) GL_PREFIX(PixelStoref): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelStoref)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelStorei)) GL_PREFIX(PixelStorei): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelStorei)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelMapfv)) GL_PREFIX(PixelMapfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelMapfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelMapuiv)) GL_PREFIX(PixelMapuiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelMapuiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelMapusv)) GL_PREFIX(PixelMapusv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelMapusv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadBuffer)) GL_PREFIX(ReadBuffer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReadBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyPixels)) GL_PREFIX(CopyPixels): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyPixels)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadPixels)) GL_PREFIX(ReadPixels): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReadPixels)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawPixels)) GL_PREFIX(DrawPixels): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawPixels)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetBooleanv)) GL_PREFIX(GetBooleanv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetBooleanv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetClipPlane)) GL_PREFIX(GetClipPlane): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetClipPlane)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetDoublev)) GL_PREFIX(GetDoublev): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetDoublev)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetError)) GL_PREFIX(GetError): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetError)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFloatv)) GL_PREFIX(GetFloatv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFloatv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetIntegerv)) GL_PREFIX(GetIntegerv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetIntegerv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetLightfv)) GL_PREFIX(GetLightfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetLightfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetLightiv)) GL_PREFIX(GetLightiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetLightiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMapdv)) GL_PREFIX(GetMapdv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMapdv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMapfv)) GL_PREFIX(GetMapfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMapfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMapiv)) GL_PREFIX(GetMapiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMapiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMaterialfv)) GL_PREFIX(GetMaterialfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMaterialfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMaterialiv)) GL_PREFIX(GetMaterialiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMaterialiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelMapfv)) GL_PREFIX(GetPixelMapfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) GL_PREFIX(GetPixelMapuiv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelMapusv)) GL_PREFIX(GetPixelMapusv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPolygonStipple)) GL_PREFIX(GetPolygonStipple): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetString)) GL_PREFIX(GetString): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetString)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexEnvfv)) GL_PREFIX(GetTexEnvfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexEnviv)) GL_PREFIX(GetTexEnviv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexEnviv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexGendv)) GL_PREFIX(GetTexGendv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexGendv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexGenfv)) GL_PREFIX(GetTexGenfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexGenfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexGeniv)) GL_PREFIX(GetTexGeniv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexGeniv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexImage)) GL_PREFIX(GetTexImage): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexImage)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexParameterfv)) GL_PREFIX(GetTexParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexParameteriv)) GL_PREFIX(GetTexParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) GL_PREFIX(GetTexLevelParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) GL_PREFIX(GetTexLevelParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsEnabled)) GL_PREFIX(IsEnabled): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsEnabled)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsList)) GL_PREFIX(IsList): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DepthRange)) GL_PREFIX(DepthRange): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DepthRange)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Frustum)) GL_PREFIX(Frustum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Frustum)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadIdentity)) GL_PREFIX(LoadIdentity): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadIdentity)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadMatrixf)) GL_PREFIX(LoadMatrixf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadMatrixf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadMatrixd)) GL_PREFIX(LoadMatrixd): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadMatrixd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MatrixMode)) GL_PREFIX(MatrixMode): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MatrixMode)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultMatrixf)) GL_PREFIX(MultMatrixf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultMatrixf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultMatrixd)) GL_PREFIX(MultMatrixd): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultMatrixd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Ortho)) GL_PREFIX(Ortho): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Ortho)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopMatrix)) GL_PREFIX(PopMatrix): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopMatrix)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushMatrix)) GL_PREFIX(PushMatrix): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushMatrix)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rotated)) GL_PREFIX(Rotated): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rotated)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rotatef)) GL_PREFIX(Rotatef): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Rotatef)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Scaled)) GL_PREFIX(Scaled): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Scaled)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Scalef)) GL_PREFIX(Scalef): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Scalef)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Translated)) GL_PREFIX(Translated): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Translated)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Translatef)) GL_PREFIX(Translatef): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Translatef)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Viewport)) GL_PREFIX(Viewport): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Viewport)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ArrayElement)) GL_PREFIX(ArrayElement): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorPointer)) GL_PREFIX(ColorPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DisableClientState)) GL_PREFIX(DisableClientState): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DisableClientState)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawArrays)) GL_PREFIX(DrawArrays): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawElements)) GL_PREFIX(DrawElements): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawElements)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) GL_PREFIX(EdgeFlagPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EnableClientState)) GL_PREFIX(EnableClientState): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EnableClientState)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPointerv)) GL_PREFIX(GetPointerv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexPointer)) GL_PREFIX(IndexPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InterleavedArrays)) GL_PREFIX(InterleavedArrays): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_InterleavedArrays)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(NormalPointer)) GL_PREFIX(NormalPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_NormalPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoordPointer)) GL_PREFIX(TexCoordPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoordPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexPointer)) GL_PREFIX(VertexPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonOffset)) GL_PREFIX(PolygonOffset): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonOffset)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage1D)) GL_PREFIX(CopyTexImage1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage2D)) GL_PREFIX(CopyTexImage2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage1D)) GL_PREFIX(CopyTexSubImage1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage2D)) GL_PREFIX(CopyTexSubImage2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage1D)) GL_PREFIX(TexSubImage1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage2D)) GL_PREFIX(TexSubImage2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(AreTexturesResident)) GL_PREFIX(AreTexturesResident): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AreTexturesResident)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BindTexture)) GL_PREFIX(BindTexture): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DeleteTextures)) GL_PREFIX(DeleteTextures): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenTextures)) GL_PREFIX(GenTextures): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsTexture)) GL_PREFIX(IsTexture): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsTexture)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PrioritizeTextures)) GL_PREFIX(PrioritizeTextures): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexub)) GL_PREFIX(Indexub): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexub)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexubv)) GL_PREFIX(Indexubv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Indexubv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopClientAttrib)) GL_PREFIX(PopClientAttrib): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PopClientAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushClientAttrib)) GL_PREFIX(PushClientAttrib): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PushClientAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendColor)) GL_PREFIX(BlendColor): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendEquation)) GL_PREFIX(BlendEquation): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawRangeElements)) GL_PREFIX(DrawRangeElements): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTable)) GL_PREFIX(ColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) GL_PREFIX(ColorTableParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) GL_PREFIX(ColorTableParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorTable)) GL_PREFIX(CopyColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTable)) GL_PREFIX(GetColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) GL_PREFIX(GetColorTableParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) GL_PREFIX(GetColorTableParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorSubTable)) GL_PREFIX(ColorSubTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorSubTable)) GL_PREFIX(CopyColorSubTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter1D)) GL_PREFIX(ConvolutionFilter1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter2D)) GL_PREFIX(ConvolutionFilter2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterf)) GL_PREFIX(ConvolutionParameterf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterfv)) GL_PREFIX(ConvolutionParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameteri)) GL_PREFIX(ConvolutionParameteri): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameteriv)) GL_PREFIX(ConvolutionParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D)) GL_PREFIX(CopyConvolutionFilter1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2D)) GL_PREFIX(CopyConvolutionFilter2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionFilter)) GL_PREFIX(GetConvolutionFilter): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionFilter)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameterfv)) GL_PREFIX(GetConvolutionParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameteriv)) GL_PREFIX(GetConvolutionParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetSeparableFilter)) GL_PREFIX(GetSeparableFilter): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SeparableFilter2D)) GL_PREFIX(SeparableFilter2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogram)) GL_PREFIX(GetHistogram): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameterfv)) GL_PREFIX(GetHistogramParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameteriv)) GL_PREFIX(GetHistogramParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmax)) GL_PREFIX(GetMinmax): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameterfv)) GL_PREFIX(GetMinmaxParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameteriv)) GL_PREFIX(GetMinmaxParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Histogram)) GL_PREFIX(Histogram): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Minmax)) GL_PREFIX(Minmax): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetHistogram)) GL_PREFIX(ResetHistogram): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetMinmax)) GL_PREFIX(ResetMinmax): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage3D)) GL_PREFIX(TexImage3D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage3D)) GL_PREFIX(TexSubImage3D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) GL_PREFIX(CopyTexSubImage3D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ActiveTextureARB)) GL_PREFIX(ActiveTextureARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClientActiveTextureARB)) GL_PREFIX(ClientActiveTextureARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1dARB)) GL_PREFIX(MultiTexCoord1dARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1dvARB)) GL_PREFIX(MultiTexCoord1dvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1fARB)) GL_PREFIX(MultiTexCoord1fARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1fvARB)) GL_PREFIX(MultiTexCoord1fvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1iARB)) GL_PREFIX(MultiTexCoord1iARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1ivARB)) GL_PREFIX(MultiTexCoord1ivARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1sARB)) GL_PREFIX(MultiTexCoord1sARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1svARB)) GL_PREFIX(MultiTexCoord1svARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2dARB)) GL_PREFIX(MultiTexCoord2dARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2dvARB)) GL_PREFIX(MultiTexCoord2dvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2fARB)) GL_PREFIX(MultiTexCoord2fARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2fvARB)) GL_PREFIX(MultiTexCoord2fvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2iARB)) GL_PREFIX(MultiTexCoord2iARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2ivARB)) GL_PREFIX(MultiTexCoord2ivARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2sARB)) GL_PREFIX(MultiTexCoord2sARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2svARB)) GL_PREFIX(MultiTexCoord2svARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3dARB)) GL_PREFIX(MultiTexCoord3dARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3dvARB)) GL_PREFIX(MultiTexCoord3dvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3fARB)) GL_PREFIX(MultiTexCoord3fARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3fvARB)) GL_PREFIX(MultiTexCoord3fvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3iARB)) GL_PREFIX(MultiTexCoord3iARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3ivARB)) GL_PREFIX(MultiTexCoord3ivARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3sARB)) GL_PREFIX(MultiTexCoord3sARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3svARB)) GL_PREFIX(MultiTexCoord3svARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4dARB)) GL_PREFIX(MultiTexCoord4dARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4dvARB)) GL_PREFIX(MultiTexCoord4dvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4fARB)) GL_PREFIX(MultiTexCoord4fARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4fvARB)) GL_PREFIX(MultiTexCoord4fvARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4iARB)) GL_PREFIX(MultiTexCoord4iARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4ivARB)) GL_PREFIX(MultiTexCoord4ivARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4sARB)) GL_PREFIX(MultiTexCoord4sARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4svARB)) GL_PREFIX(MultiTexCoord4svARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) GL_PREFIX(LoadTransposeMatrixfARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) GL_PREFIX(LoadTransposeMatrixdARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) GL_PREFIX(MultTransposeMatrixfARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) GL_PREFIX(MultTransposeMatrixdARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SampleCoverageARB)) GL_PREFIX(SampleCoverageARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePassARB)) -GL_PREFIX(SamplePassARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_SamplePassARB)) +GLOBL_FN(GL_PREFIX(__unused413)) +GL_PREFIX(__unused413): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset___unused413)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB)) GL_PREFIX(CompressedTexImage3DARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB)) GL_PREFIX(CompressedTexImage2DARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB)) GL_PREFIX(CompressedTexImage1DARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB)) GL_PREFIX(CompressedTexSubImage3DARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB)) GL_PREFIX(CompressedTexSubImage2DARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB)) GL_PREFIX(CompressedTexSubImage1DARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB)) GL_PREFIX(GetCompressedTexImageARB): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ActiveTexture)) +GL_PREFIX(ActiveTexture): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ClientActiveTexture)) +GL_PREFIX(ClientActiveTexture): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1d)) +GL_PREFIX(MultiTexCoord1d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1dv)) +GL_PREFIX(MultiTexCoord1dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1f)) +GL_PREFIX(MultiTexCoord1f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1fv)) +GL_PREFIX(MultiTexCoord1fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1i)) +GL_PREFIX(MultiTexCoord1i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1iv)) +GL_PREFIX(MultiTexCoord1iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1s)) +GL_PREFIX(MultiTexCoord1s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord1sv)) +GL_PREFIX(MultiTexCoord1sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2d)) +GL_PREFIX(MultiTexCoord2d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2dv)) +GL_PREFIX(MultiTexCoord2dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2f)) +GL_PREFIX(MultiTexCoord2f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2fv)) +GL_PREFIX(MultiTexCoord2fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2i)) +GL_PREFIX(MultiTexCoord2i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2iv)) +GL_PREFIX(MultiTexCoord2iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2s)) +GL_PREFIX(MultiTexCoord2s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord2sv)) +GL_PREFIX(MultiTexCoord2sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3d)) +GL_PREFIX(MultiTexCoord3d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3dv)) +GL_PREFIX(MultiTexCoord3dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3f)) +GL_PREFIX(MultiTexCoord3f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3fv)) +GL_PREFIX(MultiTexCoord3fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3i)) +GL_PREFIX(MultiTexCoord3i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3iv)) +GL_PREFIX(MultiTexCoord3iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3s)) +GL_PREFIX(MultiTexCoord3s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord3sv)) +GL_PREFIX(MultiTexCoord3sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4d)) +GL_PREFIX(MultiTexCoord4d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4dv)) +GL_PREFIX(MultiTexCoord4dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4f)) +GL_PREFIX(MultiTexCoord4f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4fv)) +GL_PREFIX(MultiTexCoord4fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4i)) +GL_PREFIX(MultiTexCoord4i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4iv)) +GL_PREFIX(MultiTexCoord4iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4s)) +GL_PREFIX(MultiTexCoord4s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiTexCoord4sv)) +GL_PREFIX(MultiTexCoord4sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixf)) +GL_PREFIX(LoadTransposeMatrixf): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixd)) +GL_PREFIX(LoadTransposeMatrixd): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultTransposeMatrixf)) +GL_PREFIX(MultTransposeMatrixf): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultTransposeMatrixd)) +GL_PREFIX(MultTransposeMatrixd): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SampleCoverage)) +GL_PREFIX(SampleCoverage): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage3D)) +GL_PREFIX(CompressedTexImage3D): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage2D)) +GL_PREFIX(CompressedTexImage2D): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage1D)) +GL_PREFIX(CompressedTexImage1D): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage3D)) +GL_PREFIX(CompressedTexSubImage3D): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage2D)) +GL_PREFIX(CompressedTexSubImage2D): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage1D)) +GL_PREFIX(CompressedTexSubImage1D): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetCompressedTexImage)) +GL_PREFIX(GetCompressedTexImage): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendColorEXT)) GL_PREFIX(BlendColorEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonOffsetEXT)) GL_PREFIX(PolygonOffsetEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PolygonOffsetEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage3DEXT)) GL_PREFIX(TexImage3DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage3DEXT)) GL_PREFIX(TexSubImage3DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS)) GL_PREFIX(GetTexFilterFuncSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetTexFilterFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexFilterFuncSGIS)) GL_PREFIX(TexFilterFuncSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexFilterFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage1DEXT)) GL_PREFIX(TexSubImage1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage2DEXT)) GL_PREFIX(TexSubImage2DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT)) GL_PREFIX(CopyTexImage1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT)) GL_PREFIX(CopyTexImage2DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) GL_PREFIX(CopyTexSubImage1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT)) GL_PREFIX(CopyTexSubImage2DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) GL_PREFIX(CopyTexSubImage3DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramEXT)) GL_PREFIX(GetHistogramEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameterfvEXT)) GL_PREFIX(GetHistogramParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameterivEXT)) GL_PREFIX(GetHistogramParameterivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetHistogramParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxEXT)) GL_PREFIX(GetMinmaxEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameterfvEXT)) GL_PREFIX(GetMinmaxParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameterivEXT)) GL_PREFIX(GetMinmaxParameterivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(HistogramEXT)) GL_PREFIX(HistogramEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MinmaxEXT)) GL_PREFIX(MinmaxEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetHistogramEXT)) GL_PREFIX(ResetHistogramEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetMinmaxEXT)) GL_PREFIX(ResetMinmaxEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT)) GL_PREFIX(ConvolutionFilter1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT)) GL_PREFIX(ConvolutionFilter2DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT)) GL_PREFIX(ConvolutionParameterfEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT)) GL_PREFIX(ConvolutionParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT)) GL_PREFIX(ConvolutionParameteriEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT)) GL_PREFIX(ConvolutionParameterivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT)) GL_PREFIX(CopyConvolutionFilter1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT)) GL_PREFIX(CopyConvolutionFilter2DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionFilterEXT)) GL_PREFIX(GetConvolutionFilterEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionFilterEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameterfvEXT)) GL_PREFIX(GetConvolutionParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameterivEXT)) GL_PREFIX(GetConvolutionParameterivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetSeparableFilterEXT)) GL_PREFIX(GetSeparableFilterEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetSeparableFilterEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT)) GL_PREFIX(SeparableFilter2DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableSGI)) GL_PREFIX(ColorTableSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI)) GL_PREFIX(ColorTableParameterfvSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI)) GL_PREFIX(ColorTableParameterivSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorTableSGI)) GL_PREFIX(CopyColorTableSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableSGI)) GL_PREFIX(GetColorTableSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableSGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterfvSGI)) GL_PREFIX(GetColorTableParameterfvSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvSGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterivSGI)) GL_PREFIX(GetColorTableParameterivSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterivSGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenSGIX)) GL_PREFIX(PixelTexGenSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) GL_PREFIX(PixelTexGenParameteriSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS)) GL_PREFIX(PixelTexGenParameterivSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterivSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) GL_PREFIX(PixelTexGenParameterfSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS)) GL_PREFIX(PixelTexGenParameterfvSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfvSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) GL_PREFIX(GetPixelTexGenParameterivSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) GL_PREFIX(GetPixelTexGenParameterfvSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) GL_PREFIX(TexImage4DSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) GL_PREFIX(TexSubImage4DSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) GL_PREFIX(AreTexturesResidentEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BindTextureEXT)) GL_PREFIX(BindTextureEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) GL_PREFIX(DeleteTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenTexturesEXT)) GL_PREFIX(GenTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsTextureEXT)) GL_PREFIX(IsTextureEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IsTextureEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) GL_PREFIX(PrioritizeTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) GL_PREFIX(DetailTexFuncSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) GL_PREFIX(GetDetailTexFuncSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) GL_PREFIX(SharpenTexFuncSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) GL_PREFIX(GetSharpenTexFuncSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) GL_PREFIX(SampleMaskSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) GL_PREFIX(SamplePatternSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ArrayElementEXT)) GL_PREFIX(ArrayElementEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorPointerEXT)) GL_PREFIX(ColorPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawArraysEXT)) GL_PREFIX(DrawArraysEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) GL_PREFIX(EdgeFlagPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_EdgeFlagPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPointervEXT)) GL_PREFIX(GetPointervEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexPointerEXT)) GL_PREFIX(IndexPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(NormalPointerEXT)) GL_PREFIX(NormalPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_NormalPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) GL_PREFIX(TexCoordPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TexCoordPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexPointerEXT)) GL_PREFIX(VertexPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendEquationEXT)) GL_PREFIX(BlendEquationEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) GL_PREFIX(SpriteParameterfSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) GL_PREFIX(SpriteParameterfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) GL_PREFIX(SpriteParameteriSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) GL_PREFIX(SpriteParameterivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfEXT)) GL_PREFIX(PointParameterfEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) GL_PREFIX(PointParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameterfARB)) +GL_PREFIX(PointParameterfARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameterfvARB)) +GL_PREFIX(PointParameterfvARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfSGIS)) GL_PREFIX(PointParameterfSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfvSGIS)) GL_PREFIX(PointParameterfvSGIS): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) GL_PREFIX(GetInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX)) GL_PREFIX(InstrumentsBufferSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_InstrumentsBufferSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) GL_PREFIX(PollInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX)) GL_PREFIX(ReadInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReadInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) GL_PREFIX(StartInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) GL_PREFIX(StopInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FrameZoomSGIX)) GL_PREFIX(FrameZoomSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FrameZoomSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) GL_PREFIX(TagSampleBufferSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX)) GL_PREFIX(ReferencePlaneSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ReferencePlaneSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FlushRasterSGIX)) GL_PREFIX(FlushRasterSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FlushRasterSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) GL_PREFIX(ColorSubTableEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT)) GL_PREFIX(CopyColorSubTableEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(HintPGI)) GL_PREFIX(HintPGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_HintPGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableEXT)) GL_PREFIX(ColorTableEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableEXT)) GL_PREFIX(GetColorTableEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) GL_PREFIX(GetColorTableParameterivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) GL_PREFIX(GetColorTableParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX)) GL_PREFIX(GetListParameterfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetListParameterfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetListParameterivSGIX)) GL_PREFIX(GetListParameterivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetListParameterivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameterfSGIX)) GL_PREFIX(ListParameterfSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameterfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameterfvSGIX)) GL_PREFIX(ListParameterfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameterfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameteriSGIX)) GL_PREFIX(ListParameteriSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameteriSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameterivSGIX)) GL_PREFIX(ListParameterivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ListParameterivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexMaterialEXT)) GL_PREFIX(IndexMaterialEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexMaterialEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexFuncEXT)) GL_PREFIX(IndexFuncEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_IndexFuncEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LockArraysEXT)) GL_PREFIX(LockArraysEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LockArraysEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) GL_PREFIX(UnlockArraysEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) GL_PREFIX(CullParameterdvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) GL_PREFIX(CullParameterfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX)) GL_PREFIX(FragmentColorMaterialSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentColorMaterialSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightfSGIX)) GL_PREFIX(FragmentLightfSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightfvSGIX)) GL_PREFIX(FragmentLightfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightiSGIX)) GL_PREFIX(FragmentLightiSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightiSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightivSGIX)) GL_PREFIX(FragmentLightivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModelfSGIX)) GL_PREFIX(FragmentLightModelfSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModelfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModelfvSGIX)) GL_PREFIX(FragmentLightModelfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModelfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModeliSGIX)) GL_PREFIX(FragmentLightModeliSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModeliSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModelivSGIX)) GL_PREFIX(FragmentLightModelivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentLightModelivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialfSGIX)) GL_PREFIX(FragmentMaterialfSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialfvSGIX)) GL_PREFIX(FragmentMaterialfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialiSGIX)) GL_PREFIX(FragmentMaterialiSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialiSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialivSGIX)) GL_PREFIX(FragmentMaterialivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FragmentMaterialivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentLightfvSGIX)) GL_PREFIX(GetFragmentLightfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentLightfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentLightivSGIX)) GL_PREFIX(GetFragmentLightivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentLightivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentMaterialfvSGIX)) GL_PREFIX(GetFragmentMaterialfvSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentMaterialfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentMaterialivSGIX)) GL_PREFIX(GetFragmentMaterialivSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFragmentMaterialivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightEnviSGIX)) GL_PREFIX(LightEnviSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_LightEnviSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT)) GL_PREFIX(DrawRangeElementsEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3bEXT)) GL_PREFIX(SecondaryColor3bEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3bvEXT)) GL_PREFIX(SecondaryColor3bvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3dEXT)) GL_PREFIX(SecondaryColor3dEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3dvEXT)) GL_PREFIX(SecondaryColor3dvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3fEXT)) GL_PREFIX(SecondaryColor3fEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3fvEXT)) GL_PREFIX(SecondaryColor3fvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3iEXT)) GL_PREFIX(SecondaryColor3iEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3ivEXT)) GL_PREFIX(SecondaryColor3ivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3sEXT)) GL_PREFIX(SecondaryColor3sEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3svEXT)) GL_PREFIX(SecondaryColor3svEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3ubEXT)) GL_PREFIX(SecondaryColor3ubEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3ubvEXT)) GL_PREFIX(SecondaryColor3ubvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3uiEXT)) GL_PREFIX(SecondaryColor3uiEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3uivEXT)) GL_PREFIX(SecondaryColor3uivEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3usEXT)) GL_PREFIX(SecondaryColor3usEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3usvEXT)) GL_PREFIX(SecondaryColor3usvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColorPointerEXT)) GL_PREFIX(SecondaryColorPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiDrawArraysEXT)) +GL_PREFIX(MultiDrawArraysEXT): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiDrawElementsEXT)) +GL_PREFIX(MultiDrawElementsEXT): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordfEXT)) GL_PREFIX(FogCoordfEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordfvEXT)) GL_PREFIX(FogCoordfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoorddEXT)) GL_PREFIX(FogCoorddEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoorddvEXT)) GL_PREFIX(FogCoorddvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordPointerEXT)) GL_PREFIX(FogCoordPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendFuncSeparateEXT)) GL_PREFIX(BlendFuncSeparateEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(BlendFuncSeparateINGR)) +GL_PREFIX(BlendFuncSeparateINGR): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexWeightfEXT)) GL_PREFIX(VertexWeightfEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexWeightfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexWeightfvEXT)) GL_PREFIX(VertexWeightfvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexWeightfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexWeightPointerEXT)) GL_PREFIX(VertexWeightPointerEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexWeightPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV)) GL_PREFIX(FlushVertexArrayRangeNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FlushVertexArrayRangeNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) GL_PREFIX(VertexArrayRangeNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterfvNV)) GL_PREFIX(CombinerParameterfvNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterfNV)) GL_PREFIX(CombinerParameterfNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameterfNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterivNV)) GL_PREFIX(CombinerParameterivNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameteriNV)) GL_PREFIX(CombinerParameteriNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerParameteriNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerInputNV)) GL_PREFIX(CombinerInputNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerInputNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerOutputNV)) GL_PREFIX(CombinerOutputNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_CombinerOutputNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FinalCombinerInputNV)) GL_PREFIX(FinalCombinerInputNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_FinalCombinerInputNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerInputParameterfvNV)) GL_PREFIX(GetCombinerInputParameterfvNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerInputParameterivNV)) GL_PREFIX(GetCombinerInputParameterivNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterfvNV)) GL_PREFIX(GetCombinerOutputParameterfvNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterivNV)) GL_PREFIX(GetCombinerOutputParameterivNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterfvNV)) GL_PREFIX(GetFinalCombinerInputParameterfvNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterivNV)) GL_PREFIX(GetFinalCombinerInputParameterivNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) GL_PREFIX(ResizeBuffersMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) GL_PREFIX(WindowPos2dMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) GL_PREFIX(WindowPos2dvMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) GL_PREFIX(WindowPos2fMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) GL_PREFIX(WindowPos2fvMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) GL_PREFIX(WindowPos2iMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) GL_PREFIX(WindowPos2ivMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) GL_PREFIX(WindowPos2sMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) GL_PREFIX(WindowPos2svMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) GL_PREFIX(WindowPos3dMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) GL_PREFIX(WindowPos3dvMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) GL_PREFIX(WindowPos3fMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) GL_PREFIX(WindowPos3fvMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) GL_PREFIX(WindowPos3iMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) GL_PREFIX(WindowPos3ivMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) GL_PREFIX(WindowPos3sMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) GL_PREFIX(WindowPos3svMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) GL_PREFIX(WindowPos4dMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4dMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) GL_PREFIX(WindowPos4dvMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4dvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) GL_PREFIX(WindowPos4fMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) GL_PREFIX(WindowPos4fvMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4fvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) GL_PREFIX(WindowPos4iMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4iMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) GL_PREFIX(WindowPos4ivMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4ivMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) GL_PREFIX(WindowPos4sMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4sMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) GL_PREFIX(WindowPos4svMESA): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_WindowPos4svMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TbufferMask3DFX)) GL_PREFIX(TbufferMask3DFX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_TbufferMask3DFX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SampleMaskEXT)) GL_PREFIX(SampleMaskEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SamplePatternEXT)) GL_PREFIX(SamplePatternEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) -/* XXX these were added by hand because we need a new gl.spec file */ +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(DeleteFencesNV)) +GL_PREFIX(DeleteFencesNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_DeleteFencesNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ActiveTexture)) -GL_PREFIX(ActiveTexture): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) +GLOBL_FN(GL_PREFIX(GenFencesNV)) +GL_PREFIX(GenFencesNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GenFencesNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClientActiveTexture)) -GL_PREFIX(ClientActiveTexture): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) +GLOBL_FN(GL_PREFIX(IsFenceNV)) +GL_PREFIX(IsFenceNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_IsFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage1D)) -GL_PREFIX(CompressedTexImage1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) +GLOBL_FN(GL_PREFIX(TestFenceNV)) +GL_PREFIX(TestFenceNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_TestFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage2D)) -GL_PREFIX(CompressedTexImage2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) +GLOBL_FN(GL_PREFIX(GetFenceivNV)) +GL_PREFIX(GetFenceivNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetFenceivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexImage3D)) -GL_PREFIX(CompressedTexImage3D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) +GLOBL_FN(GL_PREFIX(FinishFenceNV)) +GL_PREFIX(FinishFenceNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_FinishFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage1D)) -GL_PREFIX(CompressedTexSubImage1D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) +GLOBL_FN(GL_PREFIX(SetFenceNV)) +GL_PREFIX(SetFenceNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SetFenceNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage2D)) -GL_PREFIX(CompressedTexSubImage2D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) +GLOBL_FN(GL_PREFIX(WindowPos2dARB)) +GL_PREFIX(WindowPos2dARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CompressedTexSubImage3D)) -GL_PREFIX(CompressedTexSubImage3D): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) +GLOBL_FN(GL_PREFIX(WindowPos2fARB)) +GL_PREFIX(WindowPos2fARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetCompressedTexImage)) -GL_PREFIX(GetCompressedTexImage): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) +GLOBL_FN(GL_PREFIX(WindowPos2iARB)) +GL_PREFIX(WindowPos2iARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1d)) -GL_PREFIX(MultiTexCoord1d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) +GLOBL_FN(GL_PREFIX(WindowPos2sARB)) +GL_PREFIX(WindowPos2sARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1dv)) -GL_PREFIX(MultiTexCoord1dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) +GLOBL_FN(GL_PREFIX(WindowPos2dvARB)) +GL_PREFIX(WindowPos2dvARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1f)) -GL_PREFIX(MultiTexCoord1f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) +GLOBL_FN(GL_PREFIX(WindowPos2fvARB)) +GL_PREFIX(WindowPos2fvARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1fv)) -GL_PREFIX(MultiTexCoord1fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) +GLOBL_FN(GL_PREFIX(WindowPos2ivARB)) +GL_PREFIX(WindowPos2ivARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1i)) -GL_PREFIX(MultiTexCoord1i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) +GLOBL_FN(GL_PREFIX(WindowPos2svARB)) +GL_PREFIX(WindowPos2svARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1iv)) -GL_PREFIX(MultiTexCoord1iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) +GLOBL_FN(GL_PREFIX(WindowPos3dARB)) +GL_PREFIX(WindowPos3dARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1s)) -GL_PREFIX(MultiTexCoord1s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) +GLOBL_FN(GL_PREFIX(WindowPos3fARB)) +GL_PREFIX(WindowPos3fARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord1sv)) -GL_PREFIX(MultiTexCoord1sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) +GLOBL_FN(GL_PREFIX(WindowPos3iARB)) +GL_PREFIX(WindowPos3iARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2d)) -GL_PREFIX(MultiTexCoord2d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) +GLOBL_FN(GL_PREFIX(WindowPos3sARB)) +GL_PREFIX(WindowPos3sARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2dv)) -GL_PREFIX(MultiTexCoord2dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) +GLOBL_FN(GL_PREFIX(WindowPos3dvARB)) +GL_PREFIX(WindowPos3dvARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2f)) -GL_PREFIX(MultiTexCoord2f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) +GLOBL_FN(GL_PREFIX(WindowPos3fvARB)) +GL_PREFIX(WindowPos3fvARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2fv)) -GL_PREFIX(MultiTexCoord2fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) +GLOBL_FN(GL_PREFIX(WindowPos3ivARB)) +GL_PREFIX(WindowPos3ivARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2i)) -GL_PREFIX(MultiTexCoord2i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) +GLOBL_FN(GL_PREFIX(WindowPos3svARB)) +GL_PREFIX(WindowPos3svARB): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2iv)) -GL_PREFIX(MultiTexCoord2iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) +GLOBL_FN(GL_PREFIX(AreProgramsResidentNV)) +GL_PREFIX(AreProgramsResidentNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_AreProgramsResidentNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2s)) -GL_PREFIX(MultiTexCoord2s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) +GLOBL_FN(GL_PREFIX(BindProgramNV)) +GL_PREFIX(BindProgramNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_BindProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord2sv)) -GL_PREFIX(MultiTexCoord2sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) +GLOBL_FN(GL_PREFIX(DeleteProgramsNV)) +GL_PREFIX(DeleteProgramsNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_DeleteProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3d)) -GL_PREFIX(MultiTexCoord3d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) +GLOBL_FN(GL_PREFIX(ExecuteProgramNV)) +GL_PREFIX(ExecuteProgramNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ExecuteProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3dv)) -GL_PREFIX(MultiTexCoord3dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) +GLOBL_FN(GL_PREFIX(GenProgramsNV)) +GL_PREFIX(GenProgramsNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GenProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3f)) -GL_PREFIX(MultiTexCoord3f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) +GLOBL_FN(GL_PREFIX(GetProgramParameterdvNV)) +GL_PREFIX(GetProgramParameterdvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetProgramParameterdvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3fv)) -GL_PREFIX(MultiTexCoord3fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) +GLOBL_FN(GL_PREFIX(GetProgramParameterfvNV)) +GL_PREFIX(GetProgramParameterfvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetProgramParameterfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3i)) -GL_PREFIX(MultiTexCoord3i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) +GLOBL_FN(GL_PREFIX(GetProgramivNV)) +GL_PREFIX(GetProgramivNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetProgramivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3iv)) -GL_PREFIX(MultiTexCoord3iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) +GLOBL_FN(GL_PREFIX(GetProgramStringNV)) +GL_PREFIX(GetProgramStringNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetProgramStringNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3s)) -GL_PREFIX(MultiTexCoord3s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) +GLOBL_FN(GL_PREFIX(GetTrackMatrixivNV)) +GL_PREFIX(GetTrackMatrixivNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetTrackMatrixivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord3sv)) -GL_PREFIX(MultiTexCoord3sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) +GLOBL_FN(GL_PREFIX(GetVertexAttribdvNV)) +GL_PREFIX(GetVertexAttribdvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetVertexAttribdvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4d)) -GL_PREFIX(MultiTexCoord4d): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) +GLOBL_FN(GL_PREFIX(GetVertexAttribfvNV)) +GL_PREFIX(GetVertexAttribfvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetVertexAttribfvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4dv)) -GL_PREFIX(MultiTexCoord4dv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) +GLOBL_FN(GL_PREFIX(GetVertexAttribivNV)) +GL_PREFIX(GetVertexAttribivNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetVertexAttribivNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4f)) -GL_PREFIX(MultiTexCoord4f): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) +GLOBL_FN(GL_PREFIX(GetVertexAttribPointervNV)) +GL_PREFIX(GetVertexAttribPointervNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_GetVertexAttribPointervNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4fv)) -GL_PREFIX(MultiTexCoord4fv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) +GLOBL_FN(GL_PREFIX(IsProgramNV)) +GL_PREFIX(IsProgramNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_IsProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4i)) -GL_PREFIX(MultiTexCoord4i): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) +GLOBL_FN(GL_PREFIX(LoadProgramNV)) +GL_PREFIX(LoadProgramNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_LoadProgramNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4iv)) -GL_PREFIX(MultiTexCoord4iv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) +GLOBL_FN(GL_PREFIX(ProgramParameter4dNV)) +GL_PREFIX(ProgramParameter4dNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ProgramParameter4dNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4s)) -GL_PREFIX(MultiTexCoord4s): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) +GLOBL_FN(GL_PREFIX(ProgramParameter4dvNV)) +GL_PREFIX(ProgramParameter4dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ProgramParameter4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultiTexCoord4sv)) -GL_PREFIX(MultiTexCoord4sv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) +GLOBL_FN(GL_PREFIX(ProgramParameter4fNV)) +GL_PREFIX(ProgramParameter4fNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ProgramParameter4fNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixd)) -GL_PREFIX(LoadTransposeMatrixd): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) +GLOBL_FN(GL_PREFIX(ProgramParameter4fvNV)) +GL_PREFIX(ProgramParameter4fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ProgramParameter4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixf)) -GL_PREFIX(LoadTransposeMatrixf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) +GLOBL_FN(GL_PREFIX(ProgramParameters4dvNV)) +GL_PREFIX(ProgramParameters4dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ProgramParameters4dvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixd)) -GL_PREFIX(MultTransposeMatrixd): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) +GLOBL_FN(GL_PREFIX(ProgramParameters4fvNV)) +GL_PREFIX(ProgramParameters4fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ProgramParameters4fvNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixf)) -GL_PREFIX(MultTransposeMatrixf): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) +GLOBL_FN(GL_PREFIX(RequestResidentProgramsNV)) +GL_PREFIX(RequestResidentProgramsNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_RequestResidentProgramsNV)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleCoverage)) -GL_PREFIX(SampleCoverage): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) +GLOBL_FN(GL_PREFIX(TrackMatrixNV)) +GL_PREFIX(TrackMatrixNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_TrackMatrixNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribPointerNV)) +GL_PREFIX(VertexAttribPointerNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribPointerNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib1dNV)) +GL_PREFIX(VertexAttrib1dNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib1dNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib1dvNV)) +GL_PREFIX(VertexAttrib1dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib1dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib1fNV)) +GL_PREFIX(VertexAttrib1fNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib1fNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib1fvNV)) +GL_PREFIX(VertexAttrib1fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib1fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib1sNV)) +GL_PREFIX(VertexAttrib1sNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib1sNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib1svNV)) +GL_PREFIX(VertexAttrib1svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib1svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib2dNV)) +GL_PREFIX(VertexAttrib2dNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib2dNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib2dvNV)) +GL_PREFIX(VertexAttrib2dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib2dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib2fNV)) +GL_PREFIX(VertexAttrib2fNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib2fNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib2fvNV)) +GL_PREFIX(VertexAttrib2fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib2fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib2sNV)) +GL_PREFIX(VertexAttrib2sNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib2sNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib2svNV)) +GL_PREFIX(VertexAttrib2svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib2svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib3dNV)) +GL_PREFIX(VertexAttrib3dNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib3dNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib3dvNV)) +GL_PREFIX(VertexAttrib3dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib3dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib3fNV)) +GL_PREFIX(VertexAttrib3fNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib3fNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib3fvNV)) +GL_PREFIX(VertexAttrib3fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib3fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib3sNV)) +GL_PREFIX(VertexAttrib3sNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib3sNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib3svNV)) +GL_PREFIX(VertexAttrib3svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib3svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4dNV)) +GL_PREFIX(VertexAttrib4dNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4dNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4dvNV)) +GL_PREFIX(VertexAttrib4dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4fNV)) +GL_PREFIX(VertexAttrib4fNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4fNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4fvNV)) +GL_PREFIX(VertexAttrib4fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4sNV)) +GL_PREFIX(VertexAttrib4sNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4sNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4svNV)) +GL_PREFIX(VertexAttrib4svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4ubNV)) +GL_PREFIX(VertexAttrib4ubNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4ubNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttrib4ubvNV)) +GL_PREFIX(VertexAttrib4ubvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttrib4ubvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs1dvNV)) +GL_PREFIX(VertexAttribs1dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs1dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs1fvNV)) +GL_PREFIX(VertexAttribs1fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs1fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs1svNV)) +GL_PREFIX(VertexAttribs1svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs1svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs2dvNV)) +GL_PREFIX(VertexAttribs2dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs2dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs2fvNV)) +GL_PREFIX(VertexAttribs2fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs2fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs2svNV)) +GL_PREFIX(VertexAttribs2svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs2svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs3dvNV)) +GL_PREFIX(VertexAttribs3dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs3dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs3fvNV)) +GL_PREFIX(VertexAttribs3fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs3fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs3svNV)) +GL_PREFIX(VertexAttribs3svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs3svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs4dvNV)) +GL_PREFIX(VertexAttribs4dvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs4dvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs4fvNV)) +GL_PREFIX(VertexAttribs4fvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs4fvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs4svNV)) +GL_PREFIX(VertexAttribs4svNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs4svNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexAttribs4ubvNV)) +GL_PREFIX(VertexAttribs4ubvNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_VertexAttribs4ubvNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameteriNV)) +GL_PREFIX(PointParameteriNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameteriNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameterivNV)) +GL_PREFIX(PointParameterivNV): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameterivNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(BlendFuncSeparate)) +GL_PREFIX(BlendFuncSeparate): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(FogCoordf)) +GL_PREFIX(FogCoordf): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(FogCoordfv)) +GL_PREFIX(FogCoordfv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(FogCoordd)) +GL_PREFIX(FogCoordd): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(FogCoorddv)) +GL_PREFIX(FogCoorddv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(FogCoordPointer)) +GL_PREFIX(FogCoordPointer): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiDrawArrays)) +GL_PREFIX(MultiDrawArrays): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultiDrawElements)) +GL_PREFIX(MultiDrawElements): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameterf)) +GL_PREFIX(PointParameterf): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameterfv)) +GL_PREFIX(PointParameterfv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameteri)) +GL_PREFIX(PointParameteri): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameteriNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(PointParameteriv)) +GL_PREFIX(PointParameteriv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_PointParameterivNV)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3b)) +GL_PREFIX(SecondaryColor3b): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3bv)) +GL_PREFIX(SecondaryColor3bv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3d)) +GL_PREFIX(SecondaryColor3d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3dv)) +GL_PREFIX(SecondaryColor3dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3f)) +GL_PREFIX(SecondaryColor3f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3fv)) +GL_PREFIX(SecondaryColor3fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3i)) +GL_PREFIX(SecondaryColor3i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3iv)) +GL_PREFIX(SecondaryColor3iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3s)) +GL_PREFIX(SecondaryColor3s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3sv)) +GL_PREFIX(SecondaryColor3sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3ub)) +GL_PREFIX(SecondaryColor3ub): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3ubv)) +GL_PREFIX(SecondaryColor3ubv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3ui)) +GL_PREFIX(SecondaryColor3ui): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3uiv)) +GL_PREFIX(SecondaryColor3uiv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3us)) +GL_PREFIX(SecondaryColor3us): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColor3usv)) +GL_PREFIX(SecondaryColor3usv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SecondaryColorPointer)) +GL_PREFIX(SecondaryColorPointer): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2d)) +GL_PREFIX(WindowPos2d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2dv)) +GL_PREFIX(WindowPos2dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2f)) +GL_PREFIX(WindowPos2f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2fv)) +GL_PREFIX(WindowPos2fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2i)) +GL_PREFIX(WindowPos2i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2iv)) +GL_PREFIX(WindowPos2iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2s)) +GL_PREFIX(WindowPos2s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2sv)) +GL_PREFIX(WindowPos2sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3d)) +GL_PREFIX(WindowPos3d): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3dv)) +GL_PREFIX(WindowPos3dv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3f)) +GL_PREFIX(WindowPos3f): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3fv)) +GL_PREFIX(WindowPos3fv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3i)) +GL_PREFIX(WindowPos3i): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3iv)) +GL_PREFIX(WindowPos3iv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3s)) +GL_PREFIX(WindowPos3s): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3sv)) +GL_PREFIX(WindowPos3sv): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ActiveStencilFaceEXT)) +GL_PREFIX(ActiveStencilFaceEXT): + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) + JMP(GL_OFFSET(_gloffset_ActiveStencilFaceEXT)) #endif /* __WIN32__ */ diff --git a/xc/extras/Mesa/src/X86/mmx.h b/xc/extras/Mesa/src/X86/mmx.h index 9692d3f2a..f6bfcb3b5 100644 --- a/xc/extras/Mesa/src/X86/mmx.h +++ b/xc/extras/Mesa/src/X86/mmx.h @@ -1,5 +1,3 @@ -/* $Id: mmx.h,v 1.1.1.4 2002/10/22 13:06:08 alanh Exp $ */ - /* * Mesa 3-D graphics library * Version: 3.5 @@ -32,4 +30,20 @@ extern void _ASMAPI _mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], GLubyte rgba[][4], const GLubyte dest[][4] ); +extern void _ASMAPI +_mesa_mmx_blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + +extern void _ASMAPI +_mesa_mmx_blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[], + GLubyte rgba[][4], const GLubyte dest[][4] ); + #endif diff --git a/xc/extras/Mesa/src/X86/mmx_blend.S b/xc/extras/Mesa/src/X86/mmx_blend.S index 8efae08f5..9fe3e7179 100644 --- a/xc/extras/Mesa/src/X86/mmx_blend.S +++ b/xc/extras/Mesa/src/X86/mmx_blend.S @@ -4,8 +4,10 @@ #include "matypes.h" -/* - * make the following approximation to the division (Sree) + +/* integer multiplication - alpha plus one + * + * makes the following approximation to the division (Sree) * * rgb*a/255 ~= (rgb*(a+1)) >> 256 * @@ -13,12 +15,24 @@ * * 0*0 = 0 and 255*255 = 255 * - * note this one should be used alone + * note that MX1 is a register with 0xffffffffffffffff constant which can be easily obtained making + * + * PCMPEQW ( MX1, MX1 ) */ -#define GMBT_ALPHA_PLUS_ONE 0 - -/* - * take the geometric series approximation to the division +#define GMB_MULT_AP1( MP1, MA1, MP2, MA2, MX1 ) \ + PSUBW ( MX1, MA1 ) /* a1 + 1 | a1 + 1 | a1 + 1 | a1 + 1 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ + ;\ +TWO(PSUBW ( MX1, MA2 )) /* a2 + 1 | a2 + 1 | a2 + 1 | a2 + 1 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 ~= t1/255 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 ~= t2/255 */ + + +/* integer multiplication - geometric series + * + * takes the geometric series approximation to the division * * t/255 = (t >> 8) + (t >> 16) + (t >> 24) .. * @@ -29,390 +43,316 @@ * note that just by itself it doesn't satisfies the OpenGL criteria, as 255*255 = 254, * so the special case a = 255 must be accounted or roundoff must be used */ -#define GMBT_GEOMETRIC_SERIES 1 - -/* +#define GMB_MULT_GS( MP1, MA1, MP2, MA2 ) \ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* integer multiplication - geometric series plus rounding + * * when using a geometric series division instead of truncating the result * use roundoff in the approximation (Jim Blinn) * * t = rgb*a + 0x80 * * achieving the exact results + * + * note that M80 is register with the 0x0080008000800080 constant */ -#define GMBT_ROUNDOFF 0 - -/* instead of the roundoff this adds a small correction to satisfy the OpenGL criteria +#define GMB_MULT_GSR( MP1, MA1, MP2, MA2, M80 ) \ + PMULLW ( MP1, MA1 ) /* t1 = p1*a1 */ ;\ + PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ + ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = p2*a2 */ ;\ +TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series + */ +#define GMB_LERP_GS( MP1, MQ1, MA1, MP2, MQ2, MA2) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series with roundoff * - * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8 + * this is a generalization of Blinn's formula to signed arithmetic * - * note that although is faster than rounding off it doesn't give always the exact results + * note that M80 is a register with the 0x0080008000800080 constant */ -#define GMBT_GEOMETRIC_CORRECTION 1 - -/* - * do +#define GMB_LERP_GSR( MP1, MQ1, MA1, MP2, MQ2, MA2, M80) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + PSRLW ( CONST(15), MP1 ) /* q1 > p1 ? 1 : 0 */ ;\ +TWO(PSRLW ( CONST(15), MP2 )) /* q2 > q2 ? 1 : 0 */ ;\ + ;\ + PSLLW ( CONST(8), MP1 ) /* q1 > p1 ? 0x100 : 0 */ ;\ +TWO(PSLLW ( CONST(8), MP2 )) /* q2 > q2 ? 0x100 : 0 */ ;\ + ;\ + PSUBW ( MP1, MA1 ) /* t1 -=? 0x100 */ ;\ +TWO(PSUBW ( MP2, MA2 )) /* t2 -=? 0x100 */ ;\ + ;\ + PADDW ( M80, MA1 ) /* t1 += 0x80 */ ;\ +TWO(PADDW ( M80, MA2 )) /* t2 += 0x80 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* linear interpolation - geometric series with correction + * + * instead of the roundoff this adds a small correction to satisfy the OpenGL criteria * - * s = (q - p)*a + q + * t/255 ~= (t + (t >> 8) + (t >> 15)) >> 8 * - * instead of + * note that although is faster than rounding off it doesn't give always the exact results + */ +#define GMB_LERP_GSC( MP1, MQ1, MA1, MP2, MQ2, MA2) \ + PSUBW ( MQ1, MP1 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ ;\ + PSLLW ( CONST(8), MQ1 ) /* q1 << 8 */ ;\ + PMULLW ( MP1, MA1 ) /* t1 = (q1 - p1)*pa1 */ ;\ + ;\ +TWO(PSUBW ( MQ2, MP2 )) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ ;\ +TWO(PSLLW ( CONST(8), MQ2 )) /* q2 << 8 */ ;\ +TWO(PMULLW ( MP2, MA2 )) /* t2 = (q2 - p2)*pa2 */ ;\ + ;\ + MOVQ ( MA1, MP1 ) ;\ + PSRLW ( CONST(8), MA1 ) /* t1 >> 8 */ ;\ + ;\ +TWO(MOVQ ( MA2, MP2 )) ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* t2 >> 8 */ ;\ + ;\ + PADDW ( MA1, MP1 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ ;\ + PSRLW ( CONST(7), MA1 ) /* t1 >> 15 */ ;\ + ;\ +TWO(PADDW ( MA2, MP2 )) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ ;\ +TWO(PSRLW ( CONST(7), MA2 )) /* t2 >> 15 */ ;\ + ;\ + PADDW ( MP1, MA1 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */ ;\ +TWO(PADDW ( MP2, MA2 )) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */ ;\ + ;\ + PADDW ( MQ1, MA1 ) /* (t1/255 + q1) << 8 */ ;\ +TWO(PADDW ( MQ2, MA2 )) /* (t2/255 + q2) << 8 */ ;\ + ;\ + PSRLW ( CONST(8), MA1 ) /* sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(PSRLW ( CONST(8), MA2 )) /* sa2 | sb2 | sg2 | sr2 */ + + +/* common blending setup code * - * s = p*a + q*(1-a) + * note that M00 is a register with 0x0000000000000000 constant which can be easily obtained making * - * this eliminates a multiply at the expense of - * complicating the roundoff but is generally worth it + * PXOR ( M00, M00 ) */ -#define GMBT_SIGNED_ARITHMETIC 1 +#define GMB_LOAD(rgba, dest, MPP, MQQ) \ +ONE(MOVD ( REGIND(rgba), MPP )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ +ONE(MOVD ( REGIND(dest), MQQ )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ + ;\ +TWO(MOVQ ( REGIND(rgba), MPP )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(MOVQ ( REGIND(dest), MQQ )) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */ + +#define GMB_UNPACK(MP1, MQ1, MP2, MQ2, M00) \ +TWO(MOVQ ( MP1, MP2 )) ;\ +TWO(MOVQ ( MQ1, MQ2 )) ;\ + ;\ + PUNPCKLBW ( M00, MQ1 ) /* qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(PUNPCKHBW ( M00, MQ2 )) /* qa2 | qb2 | qg2 | qr2 */ ;\ + PUNPCKLBW ( M00, MP1 ) /* pa1 | pb1 | pg1 | pr1 */ ;\ +TWO(PUNPCKHBW ( M00, MP2 )) /* pa2 | pb2 | pg2 | pr2 */ + +#define GMB_ALPHA(MP1, MA1, MP2, MA2) \ + MOVQ ( MP1, MA1 ) ;\ +TWO(MOVQ ( MP2, MA2 )) ;\ + ;\ + PUNPCKHWD ( MA1, MA1 ) /* pa1 | pa1 | | */ ;\ +TWO(PUNPCKHWD ( MA2, MA2 )) /* pa2 | pa2 | | */ ;\ + PUNPCKHDQ ( MA1, MA1 ) /* pa1 | pa1 | pa1 | pa1 */ ;\ +TWO(PUNPCKHDQ ( MA2, MA2 )) /* pa2 | pa2 | pa2 | pa2 */ + +#define GMB_PACK( MS1, MS2 ) \ + PACKUSWB ( MS2, MS1 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ + +#define GMB_STORE(rgba, MSS ) \ +ONE(MOVD ( MSS, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(MOVQ ( MSS, REGIND(rgba) )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ + -#if GMBT_ROUNDOFF SEG_DATA ALIGNDATA8 +const_0080: + D_LONG 0x00800080, 0x00800080 + const_80: - D_LONG 0x00800080, 0x00800080 -#endif + D_LONG 0x80808080, 0x80808080 - SEG_TEXT + SEG_TEXT -ALIGNTEXT16 -GLOBL GLNAME(_mesa_mmx_blend_transparency) -/* - * void blend_transparency( GLcontext *ctx, - * GLuint n, - * const GLubyte mask[], - * GLchan rgba[][4], - * CONST GLchan dest[][4] ) - * - * Common transparency blending mode. +/* Blend transparency function */ -GLNAME( _mesa_mmx_blend_transparency ): - - PUSH_L ( EBP ) - MOV_L ( ESP, EBP ) - PUSH_L ( ESI ) - PUSH_L ( EDI ) - PUSH_L ( EBX ) - - MOV_L ( REGOFF(12, EBP), ECX ) /* n */ - CMP_L ( CONST(0), ECX) - JE ( LLBL (GMBT_return) ) - - MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ - MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ - MOV_L ( REGOFF(24, EBP), ESI ) /* dest */ - - TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ - JZ ( LLBL (GMBT_align_end) ) - - CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ - JE ( LLBL (GMBT_align_continue) ) - - PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ - - MOVD ( REGIND(ESI), MM1 ) /* | | | | qa1 | qb1 | qg1 | qr1 */ - MOVD ( REGIND(EDI), MM2 ) /* | | | | pa1 | pb1 | pg1 | pr1 */ - - PUNPCKLBW ( MM0, MM1 ) /* qa1 | qb1 | qg1 | qr1 */ - PUNPCKLBW ( MM0, MM2 ) /* pa1 | pb1 | pg1 | pr1 */ - - MOVQ ( MM2, MM3 ) - - PUNPCKHWD ( MM3, MM3 ) /* pa1 | pa1 | | */ - PUNPCKHDQ ( MM3, MM3 ) /* pa1 | pa1 | pa1 | pa1 */ - -#if GMBT_ALPHA_PLUS_ONE - PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */ - - PSUBW ( MM4, MM3 ) /* pa1 + 1 | pa1 + 1 | pa1 + 1 | pa1 + 1 */ -#endif - -#if GMBT_SIGNED_ARITHMETIC - PSUBW ( MM1, MM2 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ - - PSLLW ( CONST(8), MM1 ) /* q1 << 8 */ - -#if GMBT_ROUNDOFF - MOVQ ( MM2, MM4 ) -#endif - - PMULLW ( MM3, MM2 ) /* t1 = (q1 - p1)*pa1 */ - -#if GMBT_ROUNDOFF - PSRLW ( CONST(15), MM4 ) /* q1 > p1 ? 1 : 0 */ - - PSLLW ( CONST(8), MM4 ) /* q1 > p1 ? 0x100 : 0 */ - - PSUBW ( MM4, MM2 ) /* t1 -=? 0x100 */ -#endif - -#else - PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */ - PUNPCKLBW ( MM0, MM4 ) /* 0x00ff | 0x00ff | 0x00ff | 0x00ff */ - MOVQ ( MM4, MM0 ) - - PMULLW ( MM3, MM2 ) /* p1*pa1 */ - - PSUBW ( MM3, MM0 ) /* 255 - pa1 | 255 - pa1 | 255 - pa1 | 255 - pa1 */ - - PMULLW ( MM0, MM1 ) /* q1*(255 - pa1) */ - - PADDW ( MM1, MM2 ) /* t1 = p1*pa1 + q1*(255 - pa1) */ -#endif - -#if GMBT_ROUNDOFF - MOVQ ( CONTENT(const_80), MM4 ) - - PADDW ( MM4, MM2 ) /* t1 += 0x80 */ -#endif - -#if GMBT_GEOMETRIC_SERIES - MOVQ ( MM2, MM3 ) - PSRLW ( CONST(8), MM3 ) /* t1 >> 8 */ - - PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ -#endif - -#if GMBT_SIGNED_ARITHMETIC - PADDW ( MM1, MM2 ) /* (t1/255 + q1) << 8 */ -#endif - - PSRLW ( CONST(8), MM2 ) /* sa1 | sb1 | sg1 | sr1 */ - - PACKUSWB ( MM0, MM2 ) /* | | | | sa1 | sb1 | sg1 | sr1 */ - MOVD ( MM2, REGIND(EDI) ) - -LLBL (GMBT_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 (GMBT_align_end): - - CMP_L ( CONST(2), ECX) - JB ( LLBL (GMBT_loop_end) ) - -ALIGNTEXT16 -LLBL (GMBT_loop_begin): - - CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ - JE ( LLBL (GMBT_loop_continue) ) - - /* NOTE: the instruction pairing when multiple pipelines are available must be checked */ - - PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ - - MOVQ ( REGIND(ESI), MM7 ) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ - MOVQ ( REGIND(EDI), MM6 ) /* pa2 | pb2 | pg2 | pr2 | pa1 | pb1 | pg1 | pr1 */ - - MOVQ ( MM7, MM1 ) - MOVQ ( MM6, MM2 ) - - PUNPCKLBW ( MM0, MM1 ) /* qa1 | qb1 | qg1 | qr1 */ - PUNPCKHBW ( MM0, MM7 ) /* qa2 | qb2 | qg2 | qr2 */ - PUNPCKLBW ( MM0, MM2 ) /* pa1 | pb1 | pg1 | pr1 */ - PUNPCKHBW ( MM0, MM6 ) /* pa2 | pb2 | pg2 | pr2 */ - - MOVQ ( MM2, MM3 ) - MOVQ ( MM6, MM5 ) - - PUNPCKHWD ( MM3, MM3 ) /* pa1 | pa1 | | */ - PUNPCKHWD ( MM5, MM5 ) /* pa2 | pa2 | | */ - PUNPCKHDQ ( MM3, MM3 ) /* pa1 | pa1 | pa1 | pa1 */ - PUNPCKHDQ ( MM5, MM5 ) /* pa2 | pa2 | pa2 | pa2 */ - -#if GMBT_ALPHA_PLUS_ONE - PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */ - - PSUBW ( MM4, MM3 ) /* pa1 + 1 | pa1 + 1 | pa1 + 1 | pa1 + 1 */ - PSUBW ( MM4, MM5 ) /* pa2 + 1 | pa2 + 1 | pa2 + 1 | pa2 + 1 */ -#endif - -#if GMBT_SIGNED_ARITHMETIC - PSUBW ( MM1, MM2 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ - PSUBW ( MM7, MM6 ) /* pa2 - qa2 | pb2 - qb2 | pg2 - qg2 | pr2 - qr2 */ - - PSLLW ( CONST(8), MM1 ) /* q1 << 8 */ - PSLLW ( CONST(8), MM7 ) /* q2 << 8 */ - -#if GMBT_ROUNDOFF - MOVQ ( MM2, MM0 ) - MOVQ ( MM6, MM4 ) -#endif - - PMULLW ( MM3, MM2 ) /* t1 = (q1 - p1)*pa1 */ - PMULLW ( MM5, MM6 ) /* t2 = (q2 - p2)*pa2 */ - -#if GMBT_ROUNDOFF - PSRLW ( CONST(15), MM0 ) /* q1 > p1 ? 1 : 0 */ - PSRLW ( CONST(15), MM4 ) /* q2 > q2 ? 1 : 0 */ - - PSLLW ( CONST(8), MM0 ) /* q1 > p1 ? 0x100 : 0 */ - PSLLW ( CONST(8), MM4 ) /* q2 > q2 ? 0x100 : 0 */ - - PSUBW ( MM0, MM2 ) /* t1 -=? 0x100 */ - PSUBW ( MM4, MM7 ) /* t2 -=? 0x100 */ -#endif - -#else - PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */ - PUNPCKLBW ( MM0, MM4 ) /* 0x00ff | 0x00ff | 0x00ff | 0x00ff */ - MOVQ ( MM4, MM0 ) - - PMULLW ( MM3, MM2 ) /* p1*pa1 */ - PMULLW ( MM5, MM6 ) /* p2*pa2 */ - - PSUBW ( MM3, MM0 ) /* 255 - pa1 | 255 - pa1 | 255 - pa1 | 255 - pa1 */ - PSUBW ( MM5, MM4 ) /* 255 - pa2 | 255 - pa2 | 255 - pa2 | 255 - pa2 */ - - PMULLW ( MM0, MM1 ) /* q1*(255 - pa1) */ - PMULLW ( MM4, MM7 ) /* q2*(255 - pa2) */ - - PADDW ( MM1, MM2 ) /* t1 = p1*pa1 + q1*(255 - pa1) */ - PADDW ( MM7, MM6 ) /* t2 = p2*pa2 + q2*(255 - pa2) */ -#endif - -#if GMBT_ROUNDOFF - MOVQ ( CONTENT(const_80), MM4 ) - - PADDW ( MM4, MM2 ) /* t1 += 0x80 */ - PADDW ( MM4, MM6 ) /* t2 += 0x80 */ -#endif - -#if GMBT_GEOMETRIC_SERIES - MOVQ ( MM2, MM3 ) - MOVQ ( MM6, MM5 ) - - PSRLW ( CONST(8), MM3 ) /* t1 >> 8 */ - PSRLW ( CONST(8), MM5 ) /* t2 >> 8 */ - - PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ - PADDW ( MM5, MM6 ) /* t2 + (t2 >> 8) ~= (t2/255) << 8 */ - -#if GMBT_GEOMETRIC_CORRECTION - PSRLW ( CONST(7), MM3 ) /* t1 >> 15 */ - PSRLW ( CONST(7), MM5 ) /* t2 >> 15 */ - - PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) + (t1 >>15) ~= (t1/255) << 8 */ - PADDW ( MM5, MM6 ) /* t2 + (t2 >> 8) + (t2 >>15) ~= (t2/255) << 8 */ -#endif -#endif - -#if GMBT_SIGNED_ARITHMETIC - PADDW ( MM1, MM2 ) /* (t1/255 + q1) << 8 */ - PADDW ( MM7, MM6 ) /* (t2/255 + q2) << 8 */ -#endif - - PSRLW ( CONST(8), MM2 ) /* sa1 | sb1 | sg1 | sr1 */ - PSRLW ( CONST(8), MM6 ) /* sa2 | sb2 | sg2 | sr2 */ - - PACKUSWB ( MM6, MM2 ) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ - MOVQ ( MM2, REGIND(EDI) ) - -LLBL (GMBT_loop_continue): - - DEC_L ( ECX ) - DEC_L ( ECX ) /* n -= 2 */ - ADD_L ( CONST(2), EBX ) /* mask += 2 */ - ADD_L ( CONST(8), EDI ) /* rgba += 2 */ - ADD_L ( CONST(8), ESI ) /* dest += 2 */ - CMP_L ( CONST(2), ECX ) - JAE ( LLBL (GMBT_loop_begin) ) - -LLBL (GMBT_loop_end): - - CMP_L ( CONST(1), ECX ) - JB ( LLBL (GMBT_done) ) - - CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ - JE ( LLBL (GMBT_done) ) +#define TAG(x) x##_transparency +#define INIT \ PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ - MOVD ( REGIND(ESI), MM1 ) /* | | | | qa1 | qb1 | qg1 | qr1 */ - MOVD ( REGIND(EDI), MM2 ) /* | | | | pa1 | pb1 | pg1 | pr1 */ +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ + GMB_ALPHA( MM1, MM3, MM4, MM6 ) ;\ + GMB_LERP_GSC( MM1, MM2, MM3, MM4, MM5, MM6 ) ;\ + GMB_PACK( MM3, MM6 ) ;\ + GMB_STORE( rgba, MM3 ) - PUNPCKLBW ( MM0, MM1 ) /* qa1 | qb1 | qg1 | qr1 */ - PUNPCKLBW ( MM0, MM2 ) /* pa1 | pb1 | pg1 | pr1 */ +#include "mmx_blendtmp.h" - MOVQ ( MM2, MM3 ) - PUNPCKHWD ( MM3, MM3 ) /* pa1 | pa1 | | */ - PUNPCKHDQ ( MM3, MM3 ) /* pa1 | pa1 | pa1 | pa1 */ - -#if GMBT_ALPHA_PLUS_ONE - PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */ +/* Blend add function + * + * FIXME: Add some loop unrolling here... + */ - PSUBW ( MM4, MM3 ) /* pa1 + 1 | pa1 + 1 | pa1 + 1 | pa1 + 1 */ -#endif +#define TAG(x) x##_add -#if GMBT_SIGNED_ARITHMETIC - PSUBW ( MM1, MM2 ) /* pa1 - qa1 | pb1 - qb1 | pg1 - qg1 | pr1 - qr1 */ +#define INIT - PSLLW ( CONST(8), MM1 ) /* q1 << 8 */ +#define MAIN( rgba, dest ) \ +ONE(MOVD ( REGIND(rgba), MM1 )) /* | | | | qa1 | qb1 | qg1 | qr1 */ ;\ +ONE(MOVD ( REGIND(dest), MM2 )) /* | | | | pa1 | pb1 | pg1 | pr1 */ ;\ +ONE(PADDUSB ( MM2, MM1 )) ;\ +ONE(MOVD ( MM1, REGIND(rgba) )) /* | | | | sa1 | sb1 | sg1 | sr1 */ ;\ + ;\ +TWO(MOVQ ( REGIND(rgba), MM1 )) /* qa2 | qb2 | qg2 | qr2 | qa1 | qb1 | qg1 | qr1 */ ;\ +TWO(PADDUSB ( REGIND(dest), MM1 )) /* sa2 | sb2 | sg2 | sr2 | sa1 | sb1 | sg1 | sr1 */ ;\ +TWO(MOVQ ( MM1, REGIND(rgba) )) -#if GMBT_ROUNDOFF - MOVQ ( MM2, MM4 ) -#endif +#include "mmx_blendtmp.h" - PMULLW ( MM3, MM2 ) /* t1 = (q1 - p1)*pa1 */ -#if GMBT_ROUNDOFF - PSRLW ( CONST(15), MM4 ) /* q1 > p1 ? 1 : 0 */ +/* Blend min function + */ - PSLLW ( CONST(8), MM4 ) /* q1 > p1 ? 0x100 : 0 */ +#define TAG(x) x##_min - PSUBW ( MM4, MM2 ) /* t1 -=? 0x100 */ -#endif +#define INIT \ + MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ -#else - PCMPEQW ( MM4, MM4 ) /* 0xffff | 0xffff | 0xffff | 0xffff */ - PUNPCKLBW ( MM0, MM4 ) /* 0x00ff | 0x00ff | 0x00ff | 0x00ff */ - MOVQ ( MM4, MM0 ) - - PMULLW ( MM3, MM2 ) /* p1*pa1 */ +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + MOVQ ( MM1, MM3 ) ;\ + MOVQ ( MM2, MM4 ) ;\ + PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ + PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ + PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ + PAND ( MM4, MM1 ) /* q > p ? p : 0 */ ;\ + PANDN ( MM2, MM4 ) /* q > p ? 0 : q */ ;\ + POR ( MM1, MM4 ) /* q > p ? p : q */ ;\ + GMB_STORE( rgba, MM4 ) - PSUBW ( MM3, MM0 ) /* 255 - pa1 | 255 - pa1 | 255 - pa1 | 255 - pa1 */ +#include "mmx_blendtmp.h" - PMULLW ( MM0, MM1 ) /* q1*(255 - pa1) */ - PADDW ( MM1, MM2 ) /* t1 = p1*pa1 + q1*(255 - pa1) */ -#endif +/* Blend max function + */ -#if GMBT_ROUNDOFF - MOVQ ( CONTENT(const_80), MM4 ) +#define TAG(x) x##_max - PADDW ( MM4, MM2 ) /* t1 += 0x80 */ -#endif +#define INIT \ + MOVQ ( CONTENT(const_80), MM7 ) /* 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80| 0x80*/ -#if GMBT_GEOMETRIC_SERIES - MOVQ ( MM2, MM3 ) +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + MOVQ ( MM1, MM3 ) ;\ + MOVQ ( MM2, MM4 ) ;\ + PXOR ( MM7, MM3 ) /* unsigned -> signed */ ;\ + PXOR ( MM7, MM4 ) /* unsigned -> signed */ ;\ + PCMPGTB ( MM3, MM4 ) /* q > p ? 0xff : 0x00 */ ;\ + PAND ( MM4, MM2 ) /* q > p ? q : 0 */ ;\ + PANDN ( MM1, MM4 ) /* q > p ? 0 : p */ ;\ + POR ( MM2, MM4 ) /* q > p ? p : q */ ;\ + GMB_STORE( rgba, MM4 ) - PSRLW ( CONST(8), MM3 ) /* t1 >> 8 */ +#include "mmx_blendtmp.h" - PADDW ( MM3, MM2 ) /* t1 + (t1 >> 8) ~= (t1/255) << 8 */ -#endif -#if GMBT_SIGNED_ARITHMETIC - PADDW ( MM1, MM2 ) /* (t1/255 + q1) << 8 */ -#endif +/* Blend modulate function + */ - PSRLW ( CONST(8), MM2 ) /* sa1 | sb1 | sg1 | sr1 */ - - PACKUSWB ( MM0, MM2 ) /* | | | | sa1 | sb1 | sg1 | sr1 */ - MOVD ( MM2, REGIND(EDI) ) +#define TAG(x) x##_modulate -LLBL (GMBT_done): +#define INIT \ + PXOR ( MM0, MM0 ) /* 0x0000 | 0x0000 | 0x0000 | 0x0000 */ ;\ + MOVQ ( CONTENT(const_0080), MM7 ) /* 0x0080 | 0x0080 | 0x0080 | 0x0080 */ - EMMS +#define MAIN( rgba, dest ) \ + GMB_LOAD( rgba, dest, MM1, MM2 ) ;\ + GMB_UNPACK( MM1, MM2, MM4, MM5, MM0 ) ;\ + GMB_MULT_GSR( MM1, MM2, MM4, MM5, MM7 ) ;\ + GMB_PACK( MM2, MM5 ) ;\ + GMB_STORE( rgba, MM2 ) -LLBL (GMBT_return): +#include "mmx_blendtmp.h" - POP_L ( EBX ) - POP_L ( EDI ) - POP_L ( ESI ) - MOV_L ( EBP, ESP ) - POP_L ( EBP ) - RET diff --git a/xc/extras/Mesa/src/X86/mmx_blendtmp.h b/xc/extras/Mesa/src/X86/mmx_blendtmp.h new file mode 100644 index 000000000..1a8190355 --- /dev/null +++ b/xc/extras/Mesa/src/X86/mmx_blendtmp.h @@ -0,0 +1,113 @@ +/* + * Written by Jos� Fonseca <j_r_fonseca@yahoo.co.uk> + */ + + +/* + * void _mesa_mmx_blend( GLcontext *ctx, + * GLuint n, + * const GLubyte mask[], + * GLchan rgba[][4], + * CONST GLchan dest[][4] ) + * + */ +ALIGNTEXT16 +GLOBL GLNAME( TAG(_mesa_mmx_blend) ) + +GLNAME( TAG(_mesa_mmx_blend) ): + + PUSH_L ( EBP ) + MOV_L ( ESP, EBP ) + PUSH_L ( ESI ) + PUSH_L ( EDI ) + PUSH_L ( EBX ) + + MOV_L ( REGOFF(12, EBP), ECX ) /* n */ + CMP_L ( CONST(0), ECX) + JE ( LLBL ( TAG(GMB_return) ) ) + + MOV_L ( REGOFF(16, EBP), EBX ) /* mask */ + MOV_L ( REGOFF(20, EBP), EDI ) /* rgba */ + MOV_L ( REGOFF(24, EBP), ESI ) /* dest */ + + INIT + + TEST_L ( CONST(4), EDI ) /* align rgba on an 8-byte boundary */ + JZ ( LLBL ( TAG(GMB_align_end) ) ) + + CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ + JE ( LLBL ( TAG(GMB_align_continue) ) ) + + /* runin */ +#define ONE(x) x +#define TWO(x) + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLBL ( TAG(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) ): + + CMP_L ( CONST(2), ECX) + JB ( LLBL ( TAG(GMB_loop_end) ) ) + +ALIGNTEXT16 +LLBL ( TAG(GMB_loop_begin) ): + + CMP_W ( CONST(0), REGIND(EBX) ) /* *mask == 0 && *(mask + 1) == 0 */ + JE ( LLBL ( TAG(GMB_loop_continue) ) ) + + /* main loop */ +#define ONE(x) +#define TWO(x) x + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLBL ( TAG(GMB_loop_continue) ): + + DEC_L ( ECX ) + DEC_L ( ECX ) /* n -= 2 */ + ADD_L ( CONST(2), EBX ) /* mask += 2 */ + 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) ) ) + +LLBL ( TAG(GMB_loop_end) ): + + CMP_L ( CONST(1), ECX ) + JB ( LLBL ( TAG(GMB_done) ) ) + + CMP_B ( CONST(0), REGIND(EBX) ) /* *mask == 0 */ + JE ( LLBL ( TAG(GMB_done) ) ) + + /* runout */ +#define ONE(x) x +#define TWO(x) + MAIN ( EDI, ESI ) +#undef ONE +#undef TWO + +LLBL ( TAG(GMB_done) ): + + EMMS + +LLBL ( TAG(GMB_return) ): + + POP_L ( EBX ) + POP_L ( EDI ) + POP_L ( ESI ) + MOV_L ( EBP, ESP ) + POP_L ( EBP ) + RET + +#undef TAG +#undef INIT +#undef MAIN diff --git a/xc/extras/Mesa/src/X86/norm_args.h b/xc/extras/Mesa/src/X86/norm_args.h index 7c44fef83..596061c17 100644 --- a/xc/extras/Mesa/src/X86/norm_args.h +++ b/xc/extras/Mesa/src/X86/norm_args.h @@ -1,4 +1,3 @@ -/* $Id: norm_args.h,v 1.1.1.1 2002/10/22 13:06:14 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -29,7 +28,7 @@ * FRAME_OFFSET to the number of bytes pushed onto the stack before * using the ARG_* argument macros. * - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __NORM_ARGS_H__ diff --git a/xc/extras/Mesa/src/X86/sse.c b/xc/extras/Mesa/src/X86/sse.c index dea52e9e3..ea3496924 100644 --- a/xc/extras/Mesa/src/X86/sse.c +++ b/xc/extras/Mesa/src/X86/sse.c @@ -1,4 +1,3 @@ -/* $Id: sse.c,v 1.1.1.1 2002/10/22 13:06:08 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -31,7 +30,6 @@ #include "glheader.h" #include "context.h" -#include "math/m_vertices.h" #include "math/m_xform.h" #include "tnl/t_context.h" @@ -118,19 +116,3 @@ void _mesa_init_sse_transform_asm( void ) #endif } -void _mesa_init_sse_vertex_asm( void ) -{ -#ifdef USE_SSE_ASM - _mesa_xform_points3_v16_general = _mesa_v16_sse_general_xform; -#if 0 - /* GH: These are broken. I'm fixing them now. - */ - _mesa_project_v16 = _mesa_sse_project_vertices; - _mesa_project_clipped_v16 = _mesa_sse_project_clipped_vertices; -#endif - -#ifdef DEBUG_NOT - _math_test_all_vertex_functions( "SSE" ); -#endif -#endif -} diff --git a/xc/extras/Mesa/src/X86/sse.h b/xc/extras/Mesa/src/X86/sse.h index 0d0ce4c14..521f91e41 100644 --- a/xc/extras/Mesa/src/X86/sse.h +++ b/xc/extras/Mesa/src/X86/sse.h @@ -1,4 +1,3 @@ -/* $Id: sse.h,v 1.1.1.1 2002/10/22 13:06:08 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -35,6 +34,5 @@ #include "math/m_xform.h" void _mesa_init_sse_transform_asm( void ); -void _mesa_init_sse_vertex_asm( void ); #endif diff --git a/xc/extras/Mesa/src/X86/sse_normal.S b/xc/extras/Mesa/src/X86/sse_normal.S index 4b2d6edbe..c9088c4cc 100644 --- a/xc/extras/Mesa/src/X86/sse_normal.S +++ b/xc/extras/Mesa/src/X86/sse_normal.S @@ -1,4 +1,3 @@ -/* $Id: sse_normal.S,v 1.1.1.1 2002/10/22 13:06:09 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -64,7 +63,7 @@ GLNAME(_mesa_sse_transform_rescale_normals_no_rot): MOV_L ( STRIDE, EAX ) /* stride */ MOV_L ( ECX, REGOFF(V3F_COUNT, EDI) ) /* set dest-count */ - IMUL_L( CONST(12), ECX ) /* count *= 12 */ + IMUL_L( CONST(16), ECX ) /* count *= 16 */ MOV_L( REGOFF(V3F_START, ESI), ESI ) /* ptr to first source vertex */ MOV_L( REGOFF(V3F_START, EDI), EDI ) /* ptr to first dest vertex */ @@ -90,7 +89,7 @@ LLBL(K_G3TRNNRR_top): MOVSS ( XMM2, D(2) ) /* ->D(2) */ LLBL(K_G3TRNNRR_skip): - ADD_L ( CONST(12), EDI ) + ADD_L ( CONST(16), EDI ) ADD_L ( EAX, ESI ) CMP_L ( ECX, EDI ) JNE ( LLBL(K_G3TRNNRR_top) ) @@ -125,7 +124,7 @@ GLNAME(_mesa_sse_transform_rescale_normals): MOV_L ( STRIDE, EAX ) /* stride */ MOV_L ( ECX, REGOFF(V3F_COUNT, EDI) ) /* set dest-count */ - IMUL_L( CONST(12), ECX ) /* count *= 12 */ + IMUL_L( CONST(16), ECX ) /* count *= 16 */ MOV_L( REGOFF(V3F_START, ESI), ESI ) /* ptr to first source vertex */ MOV_L( REGOFF(V3F_START, EDI), EDI ) /* ptr to first dest vertex */ @@ -183,7 +182,7 @@ LLBL(K_G3TRNR_top): MOVSS ( XMM3, D(2) ) LLBL(K_G3TRNR_skip): - ADD_L ( CONST(12), EDI ) + ADD_L ( CONST(16), EDI ) ADD_L ( EAX, ESI ) CMP_L ( ECX, EDI ) JNE ( LLBL(K_G3TRNR_top) ) @@ -217,7 +216,7 @@ GLNAME(_mesa_sse_transform_normals_no_rot): MOV_L ( STRIDE, EAX ) /* stride */ MOV_L ( ECX, REGOFF(V3F_COUNT, EDI) ) /* set dest-count */ - IMUL_L( CONST(12), ECX ) /* count *= 12 */ + IMUL_L( CONST(16), ECX ) /* count *= 16 */ MOV_L( REGOFF(V3F_START, ESI), ESI ) /* ptr to first source vertex */ MOV_L( REGOFF(V3F_START, EDI), EDI ) /* ptr to first dest vertex */ @@ -240,7 +239,7 @@ LLBL(K_G3TNNRR_top): MOVSS( XMM2, D(2) ) LLBL(K_G3TNNRR_skip): - ADD_L ( CONST(12), EDI ) + ADD_L ( CONST(16), EDI ) ADD_L ( EAX, ESI ) CMP_L ( ECX, EDI ) JNE ( LLBL(K_G3TNNRR_top) ) diff --git a/xc/extras/Mesa/src/X86/sse_vertex.S b/xc/extras/Mesa/src/X86/sse_vertex.S deleted file mode 100644 index 4b66a3e6c..000000000 --- a/xc/extras/Mesa/src/X86/sse_vertex.S +++ /dev/null @@ -1,182 +0,0 @@ -#include "matypes.h" - - SEG_TEXT - -#define MAT_SY 20 -#define MAT_SZ 40 -#define MAT_TX 48 -#define MAT_TY 52 -#define MAT_TZ 56 - - -/* - * void _mesa_v16_katmai_general_xform( GLfloat *dest, - * const GLfloat *m, - * const GLfloat *src, - * GLuint src_stride, - * GLuint count ) - * - */ - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_v16_sse_general_xform ) -GLNAME( _mesa_v16_sse_general_xform ): - - PUSH_L( EDI ) - PUSH_L( ESI ) - - MOV_L( REGOFF(12, ESP), EAX ) /* destination */ - MOV_L( REGOFF(16, ESP), ESI ) /* matrix */ - MOV_L( REGOFF(20, ESP), EDX ) /* source */ - MOV_L( REGOFF(24, ESP), EDI ) /* src_stride */ - MOV_L( REGOFF(28, ESP), ECX ) /* count */ - - MOVAPS( REGOFF(0, ESI), XMM4 ) /* m3 | m2 | m1 | m0 */ - MOVAPS( REGOFF(16, ESI), XMM5 ) /* m7 | m6 | m5 | m4 */ - MOVAPS( REGOFF(32, ESI), XMM6 ) /* m11 | m10 | m9 | m8 */ - MOVAPS( REGOFF(48, ESI), XMM7 ) /* m15 | m14 | m13 | m12 */ - -ALIGNTEXT32 -LLBL(v16_sse_general_loop): - - MOVSS( REGOFF(0, EDX), XMM0 ) /* | | | x0 */ - SHUFPS( CONST(0x0), XMM0, XMM0 ) /* x0 | x0 | x0 | x0 */ - MULPS( XMM4, XMM0 ) /* x0*m3 | x0*m2 | x0*m1 | x0*m0 */ - - MOVSS( REGOFF(4, EDX), XMM1 ) /* | | | x1 */ - SHUFPS( CONST(0x0), XMM1, XMM1 ) /* x1 | x1 | x1 | x1 */ - MULPS( XMM5, XMM1 ) /* x1*m7 | x1*m6 | x1*m5 | x1*m4 */ - - MOVSS( REGOFF(8, EDX), XMM2 ) /* | | | x2 */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* x2 | x2 | x2 | x2 */ - MULPS( XMM6, XMM2 ) /* x2*m11 | x2*m10 | x2*m9 | x2*m8 */ - - ADDPS( XMM1, XMM0 ) - ADDPS( XMM2, XMM0 ) - ADDPS( XMM7, XMM0 ) /* r3 | r2 | r1 | r1 */ - - MOVAPS( XMM0, REGOFF(0, EAX) ) - - ADD_L( CONST(64), EAX ) /* next output vertex */ - ADD_L( EDI, EDX ) /* next input vertex */ - - DEC_L( ECX ) - JNE( LLBL(v16_sse_general_loop) ) - - POP_L( ESI ) - POP_L( EDI ) - - RET - - -/* void _mesa_sse_project_vertices(GLfloat *first, - * GLfloat *last, - * const GLfloat *m, - * GLuint stride ) - */ - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_sse_project_vertices ) -GLNAME( _mesa_sse_project_vertices ): - - PUSH_L( EBP ) - - MOV_L( REGOFF(8, ESP), ECX ) /* first_vert */ - MOV_L( REGOFF(12, ESP), EDX ) /* last_vert */ - MOV_L( REGOFF(16, ESP), EBP ) /* matrix */ - MOV_L( REGOFF(20, ESP), EAX ) /* stride */ - - -ALIGNTEXT32 - MOVAPS( REGOFF(MAT_TX, EBP), XMM0 ) /* (x44), x43, x42, x41 => xmm0 */ - MOVSS( REGOFF(0, EBP), XMM1 ) /* -, -, -, x11 => xmm1 */ - UNPCKLPS( REGOFF(MAT_SY, EBP), XMM1 ) /* -, -, x22, x11 => xmm1 */ - SHUFPS( CONST(0x44), REGOFF(MAT_SZ, EBP), XMM1 ) - /* -, x33, x22, x11 => xmm1 */ - - SUB_L( ECX, EDX ) /* last -= first */ - -LLBL(v16_sse_pv_loop_start): - MOVAPS( REGOFF(0, ECX), XMM3 ) /* f[3], f[2], f[1], f[0] */ - - MOVSS( REGOFF(12, ECX), XMM2 ) /* -, -, -, f[3] */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* f[3], f[3], f[3], f[3] */ - RCPPS( XMM2, XMM2 ) /* 1/f[3], 1/f[3], 1/f[3], 1/f[3] */ - - MULPS( XMM2, XMM1 ) /* -, x33*1/f[3]... */ - MULPS( XMM3, XMM1 ) /* -, x33*1/f[3]*f[2]... */ - ADDPS( XMM0, XMM1 ) /* -, x33*1/f[3]*f[2]+x43... */ - - MOVAPS( XMM1, REGOFF(0, ECX) ) /* back to f */ - MOVSS( XMM2, REGOFF(12, ECX) ) /* 1/f[3] into f[3] ! */ - - - ADD_L( EAX, ECX ) /* f += stride */ - SUB_L( EAX, EDX ) /* (last-first)-stride */ - JA ( LLBL(v16_sse_pv_loop_start) ) - - POP_L( EBP ) - RET - - - -/* void _mesa_sse_project_clipped_vertices(GLfloat *first, - * GLfloat *last, - * const GLfloat *m, - * GLuint stride, - * const GLubyte *clipmask ); - */ - - -ALIGNTEXT16 -GLOBL GLNAME( _mesa_sse_project_clipped_vertices ) -GLNAME( _mesa_sse_project_clipped_vertices ): - - PUSH_L( EBP ) - PUSH_L( ESI ) - - MOV_L( REGOFF(12, ESP), ECX ) /* first_vert */ - MOV_L( REGOFF(16, ESP), EDX ) /* last_vert */ - MOV_L( REGOFF(20, ESP), EBP ) /* matrix */ - MOV_L( REGOFF(24, ESP), EAX ) /* stride */ - MOV_L( REGOFF(28, ESP), ESI ) /* clip_mask */ - - - -ALIGNTEXT32 - - MOVAPS( REGOFF(MAT_TX, EBP), XMM0 ) /* (x44), x43, x42, x41 => xmm0 */ - MOVSS( REGOFF(0, EBP), XMM1 ) /* -, -, -, x11 => xmm1 */ - UNPCKLPS( REGOFF(MAT_SY, EBP), XMM1 ) /* -, -, x22, x11 => xmm1 */ - SHUFPS( CONST(0x44), REGOFF(MAT_SZ, EBP), XMM1 ) - /* -, x33, x22, x11 => xmm1 */ - -LLBL(v16_sse_pcv_loop_start): - CMP_B ( CONST(0), REGIND(ESI) ) /* clip_mask == 0 ? */ - JNE( LLBL(v16_sse_pcv_skip) ) /* no -> skip ! */ - - MOVAPS( REGOFF(0, ECX), XMM3 ) /* f[3], f[2], f[1], f[0] */ - - MOVSS( REGOFF(12, ECX), XMM2 ) /* -, -, -, f[3] */ - SHUFPS( CONST(0x0), XMM2, XMM2 ) /* f[3], f[3], f[3], f[3] */ - RCPPS( XMM2, XMM2 ) /* 1/f[3], 1/f[3], 1/f[3], 1/f[3] */ - - MULPS( XMM2, XMM1 ) /* -, x33*1/f[3]... */ - MULPS( XMM3, XMM1 ) /* -, x33*1/f[3]*f[2]... */ - ADDPS( XMM0, XMM1 ) /* -, x33*1/f[3]*f[2]+x43... */ - - MOVAPS( XMM1, REGOFF(0, ECX) ) /* back to f */ - MOVSS( XMM2, REGOFF(12, ECX) ) /* 1/f[3] into f[3] ! */ - -LLBL(v16_sse_pcv_skip): - ADD_L( EAX, ECX ) /* f += stride */ - INC_L( ESI ) /* nect ClipMask */ - - CMP_L( ECX, EDX ) /* p_first_vertex == p_last_vertex */ - JNE( LLBL(v16_sse_pcv_loop_start) ) - /* no -> go on with next vertex */ - - POP_L( ESI ) - POP_L( EBP ) - RET diff --git a/xc/extras/Mesa/src/X86/x86.c b/xc/extras/Mesa/src/X86/x86.c index c2b222ea8..3835bbbd7 100644 --- a/xc/extras/Mesa/src/X86/x86.c +++ b/xc/extras/Mesa/src/X86/x86.c @@ -29,7 +29,6 @@ #include "glheader.h" #include "context.h" -#include "math/m_vertices.h" #include "math/m_xform.h" #include "tnl/t_context.h" @@ -94,14 +93,3 @@ void _mesa_init_x86_transform_asm( void ) #endif } -void _mesa_init_x86_vertex_asm( void ) -{ -#ifdef USE_X86_ASM - _mesa_xform_points3_v16_general = _mesa_v16_x86_general_xform; - _mesa_cliptest_points4_v16 = _mesa_v16_x86_cliptest_points4; - -#if 0 /* DEBUG */ - _math_test_all_vertex_functions( "x86" ); -#endif -#endif -} diff --git a/xc/extras/Mesa/src/X86/x86.h b/xc/extras/Mesa/src/X86/x86.h index 75de94e6b..97651ec6e 100644 --- a/xc/extras/Mesa/src/X86/x86.h +++ b/xc/extras/Mesa/src/X86/x86.h @@ -31,6 +31,5 @@ #define __X86_H__ extern void _mesa_init_x86_transform_asm( void ); -extern void _mesa_init_x86_vertex_asm( void ); #endif diff --git a/xc/extras/Mesa/src/X86/x86_cliptest.S b/xc/extras/Mesa/src/X86/x86_cliptest.S index 03bcce679..7c5b892b9 100644 --- a/xc/extras/Mesa/src/X86/x86_cliptest.S +++ b/xc/extras/Mesa/src/X86/x86_cliptest.S @@ -95,7 +95,7 @@ clip_table: * EBP: temp2 */ -#if defined(__ELF__) && defined(__PIC__) && !defined(ELFPIC) +#if defined(__ELF__) && defined(__PIC__) && defined(GNU_ASSEMBLER) && !defined(ELFPIC) #define ELFPIC #endif diff --git a/xc/extras/Mesa/src/X86/xform_args.h b/xc/extras/Mesa/src/X86/xform_args.h index 2713d548d..b773f5198 100644 --- a/xc/extras/Mesa/src/X86/xform_args.h +++ b/xc/extras/Mesa/src/X86/xform_args.h @@ -28,7 +28,7 @@ * FRAME_OFFSET to the number of bytes pushed onto the stack before * using the ARG_* argument macros. * - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __XFORM_ARGS_H__ diff --git a/xc/extras/Mesa/src/accum.c b/xc/extras/Mesa/src/accum.c index ca255892f..1185adbfd 100644 --- a/xc/extras/Mesa/src/accum.c +++ b/xc/extras/Mesa/src/accum.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,20 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "accum.h" #include "context.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "state.h" #include "mtypes.h" -#endif - - void diff --git a/xc/extras/Mesa/src/all.h b/xc/extras/Mesa/src/all.h deleted file mode 100644 index 852aaa630..000000000 --- a/xc/extras/Mesa/src/all.h +++ /dev/null @@ -1,94 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - - -/* - * The purpose of this file is to collect all the header files that Mesa - * uses into a single header so that we can get new compilers that support - * pre-compiled headers to compile much faster. - * All we do is list all the internal headers used by Mesa in this one - * main header file, and most compilers will pre-compile all these headers - * and use them over and over again for each source module. This makes a - * big difference for Win32 support, because the <windows.h> headers take - * a *long* time to compile. - */ - - -#ifndef SRC_ALL_H -#define SRC_ALL_H - - -#ifndef PC_HEADER - This is an error. all.h should be included only if PC_HEADER is defined. -#endif - -#include "glheader.h" -#include "accum.h" -#include "attrib.h" -#include "blend.h" -#include "buffers.h" -#include "clip.h" -#include "colortab.h" -#include "config.h" -#include "context.h" -#include "convolve.h" -#include "dd.h" -#include "depth.h" -#include "dlist.h" -#include "drawpix.h" -#include "enable.h" -#include "enums.h" -#include "eval.h" -#include "extensions.h" -#include "feedback.h" -#include "fog.h" -#include "get.h" -#include "glapi.h" -#include "glthread.h" -#include "hash.h" -#include "hint.h" -#include "histogram.h" -#include "image.h" -#include "light.h" -#include "lines.h" -#include "macros.h" -#include "matrix.h" -#include "mem.h" -#include "mmath.h" -#include "pixel.h" -#include "points.h" -#include "polygon.h" -#include "rastpos.h" -#include "state.h" -#include "stencil.h" -#include "teximage.h" -#include "texobj.h" -#include "texstate.h" -#include "texstore.h" -#include "mtypes.h" -#include "varray.h" - - -#endif /*SRC_ALL_H*/ diff --git a/xc/extras/Mesa/src/api_arrayelt.c b/xc/extras/Mesa/src/api_arrayelt.c index 15ef51377..deaf65a9d 100644 --- a/xc/extras/Mesa/src/api_arrayelt.c +++ b/xc/extras/Mesa/src/api_arrayelt.c @@ -1,8 +1,7 @@ -/* $Id: api_arrayelt.c,v 1.1.1.1 2002/10/22 13:05:38 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -25,14 +24,14 @@ */ /* Author: - * Keith Whitwell <keith_whitwell@yahoo.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "api_arrayelt.h" #include "context.h" #include "glapi.h" -#include "mem.h" +#include "imports.h" #include "macros.h" #include "mtypes.h" @@ -253,7 +252,7 @@ static void (*fogcoordfuncs[8])( const void * ) = { GLboolean _ae_create_context( GLcontext *ctx ) { ctx->aelt_context = MALLOC( sizeof(AEcontext) ); - if (!ctx->aelt_context) + if (!ctx->aelt_context) return GL_FALSE; AE_CONTEXT(ctx)->NewState = ~0; @@ -307,7 +306,7 @@ static void _ae_update_state( GLcontext *ctx ) if (ctx->Array.EdgeFlag.Enabled) { aa->array = &ctx->Array.EdgeFlag; - aa->func = (array_func) glEdgeFlagv; + aa->func = (array_func)glEdgeFlagv; aa++; } diff --git a/xc/extras/Mesa/src/api_eval.c b/xc/extras/Mesa/src/api_eval.c index 9f497ce0c..3887ba808 100644 --- a/xc/extras/Mesa/src/api_eval.c +++ b/xc/extras/Mesa/src/api_eval.c @@ -1,4 +1,3 @@ -/* $Id: api_eval.c,v 1.1.1.1 2002/10/22 13:05:38 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" @@ -281,16 +280,16 @@ void _mesa_EvalCoord1f( GLfloat u ) GLfloat normal[3], texcoord[4], color[4]; GLuint index; - COPY_3FV( normal, ctx->Current.Normal ); - COPY_4FV( texcoord, ctx->Current.Texcoord[0] ); - COPY_4FV( color, ctx->Current.Color ); + COPY_3FV( normal, ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); + COPY_4FV( texcoord, ctx->Current.Attrib[VERT_ATTRIB_TEX0] ); + COPY_4FV( color, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); index = ctx->Current.Index; do_EvalCoord1f( ctx, u ); - COPY_3FV( ctx->Current.Normal, normal ); - COPY_4FV( ctx->Current.Texcoord[0], texcoord ); - COPY_4FV( ctx->Current.Color, color ); + COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], normal ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0], texcoord ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color ); ctx->Current.Index = index; } @@ -300,16 +299,16 @@ void _mesa_EvalCoord2f( GLfloat u, GLfloat v ) GLfloat normal[3], texcoord[4], color[4]; GLuint index; - COPY_3FV( normal, ctx->Current.Normal ); - COPY_4FV( texcoord, ctx->Current.Texcoord[0] ); - COPY_4FV( color, ctx->Current.Color ); + COPY_3FV( normal, ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); + COPY_4FV( texcoord, ctx->Current.Attrib[VERT_ATTRIB_TEX0] ); + COPY_4FV( color, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); index = ctx->Current.Index; do_EvalCoord2f( ctx, u, v ); - COPY_3FV( ctx->Current.Normal, normal ); - COPY_4FV( ctx->Current.Texcoord[0], texcoord ); - COPY_4FV( ctx->Current.Color, color ); + COPY_3FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], normal ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0], texcoord ); + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color ); ctx->Current.Index = index; } diff --git a/xc/extras/Mesa/src/api_loopback.c b/xc/extras/Mesa/src/api_loopback.c index c944e6989..9805c59aa 100644 --- a/xc/extras/Mesa/src/api_loopback.c +++ b/xc/extras/Mesa/src/api_loopback.c @@ -1,8 +1,7 @@ -/* $Id: api_loopback.c,v 1.1.1.1 2002/10/22 13:05:37 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -64,6 +63,7 @@ #define MATERIALFV(a,b,c) glMaterialfv(a,b,c) #define RECTF(a,b,c,d) glRectf(a,b,c,d) +#define ATTRIB(index, x, y, z, w) _glapi_Dispatch->VertexAttrib4fNV(index, x, y, z, w) #define FOGCOORDF(x) _glapi_Dispatch->FogCoordfEXT(x) @@ -1370,6 +1370,268 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v ) } +/* + * GL_NV_vertex_program + */ + +static void +loopback_VertexAttrib1sNV(GLuint index, GLshort x) +{ + ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1fNV(GLuint index, GLfloat x) +{ + ATTRIB(index, x, 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1dNV(GLuint index, GLdouble x) +{ + ATTRIB(index, (GLfloat) x, 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2sNV(GLuint index, GLshort x, GLshort y) +{ + ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) +{ + ATTRIB(index, (GLfloat) x, y, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z) +{ + ATTRIB(index, (GLfloat) x, y, z, 1.0F); +} + +static void +loopback_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + ATTRIB(index, x, y, z, 1.0F); +} + +static void +loopback_VertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); +} + +static void +loopback_VertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void +loopback_VertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + ATTRIB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void +loopback_VertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + ATTRIB(index, UBYTE_TO_FLOAT(x), UBYTE_TO_FLOAT(y), + UBYTE_TO_FLOAT(z), UBYTE_TO_FLOAT(w)); +} + +static void +loopback_VertexAttrib1svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], 0.0F, 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib1dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib2dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); +} + +static void +loopback_VertexAttrib3svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void +loopback_VertexAttrib3fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], v[1], v[2], 1.0F); +} + +static void +loopback_VertexAttrib3dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void +loopback_VertexAttrib4svNV(GLuint index, const GLshort *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); +} + +static void +loopback_VertexAttrib4fvNV(GLuint index, const GLfloat *v) +{ + ATTRIB(index, v[0], v[1], v[2], v[3]); +} + +static void +loopback_VertexAttrib4dvNV(GLuint index, const GLdouble *v) +{ + ATTRIB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); +} + +static void +loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v) +{ + ATTRIB(index, UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), + UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); +} + + +static void +loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1svNV(index + i, v + i); +} + +static void +loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1fvNV(index + i, v + i); +} + +static void +loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib1dvNV(index + i, v + i); +} + +static void +loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2svNV(index + i, v + 2 * i); +} + +static void +loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2fvNV(index + i, v + 2 * i); +} + +static void +loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib2dvNV(index + i, v + 2 * i); +} + +static void +loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3svNV(index + i, v + 3 * i); +} + +static void +loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3fvNV(index + i, v + 3 * i); +} + +static void +loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib3dvNV(index + i, v + 3 * i); +} + +static void +loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4svNV(index + i, v + 4 * i); +} + +static void +loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4fvNV(index + i, v + 4 * i); +} + +static void +loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4dvNV(index + i, v + 4 * i); +} + +static void +loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) +{ + GLint i; + for (i = n - 1; i >= 0; i--) + loopback_VertexAttrib4ubvNV(index + i, v + 4 * i); +} + + void _mesa_loopback_prefer_float( struct _glapi_table *dest, @@ -1567,4 +1829,46 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest, dest->Rectsv = loopback_Rectsv; dest->FogCoorddEXT = loopback_FogCoorddEXT; dest->FogCoorddvEXT = loopback_FogCoorddvEXT; + + dest->VertexAttrib1sNV = loopback_VertexAttrib1sNV; + dest->VertexAttrib1fNV = loopback_VertexAttrib1fNV; + dest->VertexAttrib1dNV = loopback_VertexAttrib1dNV; + dest->VertexAttrib2sNV = loopback_VertexAttrib2sNV; + dest->VertexAttrib2fNV = loopback_VertexAttrib2fNV; + dest->VertexAttrib2dNV = loopback_VertexAttrib2dNV; + dest->VertexAttrib3sNV = loopback_VertexAttrib3sNV; + dest->VertexAttrib3fNV = loopback_VertexAttrib3fNV; + dest->VertexAttrib3dNV = loopback_VertexAttrib3dNV; + dest->VertexAttrib4sNV = loopback_VertexAttrib4sNV; + dest->VertexAttrib4dNV = loopback_VertexAttrib4dNV; + dest->VertexAttrib4ubNV = loopback_VertexAttrib4ubNV; + + dest->VertexAttrib1svNV = loopback_VertexAttrib1svNV; + dest->VertexAttrib1fvNV = loopback_VertexAttrib1fvNV; + dest->VertexAttrib1dvNV = loopback_VertexAttrib1dvNV; + dest->VertexAttrib2svNV = loopback_VertexAttrib2svNV; + dest->VertexAttrib2fvNV = loopback_VertexAttrib2fvNV; + dest->VertexAttrib2dvNV = loopback_VertexAttrib2dvNV; + dest->VertexAttrib3svNV = loopback_VertexAttrib3svNV; + dest->VertexAttrib3fvNV = loopback_VertexAttrib3fvNV; + dest->VertexAttrib3dvNV = loopback_VertexAttrib3dvNV; + dest->VertexAttrib4svNV = loopback_VertexAttrib4svNV; + dest->VertexAttrib4fvNV = loopback_VertexAttrib4fvNV; + dest->VertexAttrib4dvNV = loopback_VertexAttrib4dvNV; + dest->VertexAttrib4ubvNV = loopback_VertexAttrib4ubvNV; + + dest->VertexAttribs1svNV = loopback_VertexAttribs1svNV; + dest->VertexAttribs1fvNV = loopback_VertexAttribs1fvNV; + dest->VertexAttribs1dvNV = loopback_VertexAttribs1dvNV; + dest->VertexAttribs2svNV = loopback_VertexAttribs2svNV; + dest->VertexAttribs2fvNV = loopback_VertexAttribs2fvNV; + dest->VertexAttribs2dvNV = loopback_VertexAttribs2dvNV; + dest->VertexAttribs3svNV = loopback_VertexAttribs3svNV; + dest->VertexAttribs3fvNV = loopback_VertexAttribs3fvNV; + dest->VertexAttribs3dvNV = loopback_VertexAttribs3dvNV; + dest->VertexAttribs4svNV = loopback_VertexAttribs4svNV; + dest->VertexAttribs4fvNV = loopback_VertexAttribs4fvNV; + dest->VertexAttribs4dvNV = loopback_VertexAttribs4dvNV; + dest->VertexAttribs4ubvNV = loopback_VertexAttribs4ubvNV; + } diff --git a/xc/extras/Mesa/src/api_noop.c b/xc/extras/Mesa/src/api_noop.c index 373bff851..e3fdd6141 100644 --- a/xc/extras/Mesa/src/api_noop.c +++ b/xc/extras/Mesa/src/api_noop.c @@ -1,8 +1,7 @@ -/* $Id: api_noop.c,v 1.1.1.1 2002/10/22 13:05:43 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -58,13 +57,13 @@ void _mesa_noop_EdgeFlagv( const GLboolean *b ) void _mesa_noop_FogCoordfEXT( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.FogCoord = a; + ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = a; } void _mesa_noop_FogCoordfvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - ctx->Current.FogCoord = *v; + ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = *v; } void _mesa_noop_Indexi( GLint i ) @@ -82,7 +81,7 @@ void _mesa_noop_Indexiv( const GLint *v ) void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Normal; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -91,7 +90,7 @@ void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_Normal3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Normal; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -155,7 +154,7 @@ void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(a); color[1] = UBYTE_TO_FLOAT(b); color[2] = UBYTE_TO_FLOAT(c); @@ -165,7 +164,7 @@ void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d ) void _mesa_noop_Color4ubv( const GLubyte *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(v[0]); color[1] = UBYTE_TO_FLOAT(v[1]); color[2] = UBYTE_TO_FLOAT(v[2]); @@ -175,7 +174,7 @@ void _mesa_noop_Color4ubv( const GLubyte *v ) void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = a; color[1] = b; color[2] = c; @@ -185,7 +184,7 @@ void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) void _mesa_noop_Color4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; @@ -195,7 +194,7 @@ void _mesa_noop_Color4fv( const GLfloat *v ) void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(a); color[1] = UBYTE_TO_FLOAT(b); color[2] = UBYTE_TO_FLOAT(c); @@ -205,7 +204,7 @@ void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c ) void _mesa_noop_Color3ubv( const GLubyte *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = UBYTE_TO_FLOAT(v[0]); color[1] = UBYTE_TO_FLOAT(v[1]); color[2] = UBYTE_TO_FLOAT(v[2]); @@ -215,7 +214,7 @@ void _mesa_noop_Color3ubv( const GLubyte *v ) void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = a; color[1] = b; color[2] = c; @@ -225,7 +224,7 @@ void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_Color3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.Color; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; @@ -241,7 +240,7 @@ void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); dest[1] = 0; dest[2] = 0; @@ -258,7 +257,7 @@ void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); dest[1] = 0; dest[2] = 0; @@ -275,7 +274,7 @@ void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); dest[2] = 0; @@ -292,7 +291,7 @@ void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); dest[2] = 0; @@ -309,7 +308,7 @@ void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -326,7 +325,7 @@ void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -344,7 +343,7 @@ void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -361,7 +360,7 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) */ if (unit < MAX_TEXTURE_UNITS) { - GLfloat *dest = ctx->Current.Texcoord[unit]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -372,7 +371,7 @@ void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = UBYTE_TO_FLOAT(a); color[1] = UBYTE_TO_FLOAT(b); color[2] = UBYTE_TO_FLOAT(c); @@ -382,7 +381,7 @@ void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ) void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = UBYTE_TO_FLOAT(v[0]); color[1] = UBYTE_TO_FLOAT(v[1]); color[2] = UBYTE_TO_FLOAT(v[2]); @@ -392,7 +391,7 @@ void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v ) void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = a; color[1] = b; color[2] = c; @@ -402,7 +401,7 @@ void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *color = ctx->Current.SecondaryColor; + GLfloat *color = ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; color[0] = v[0]; color[1] = v[1]; color[2] = v[2]; @@ -412,7 +411,7 @@ void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ) void _mesa_noop_TexCoord1f( GLfloat a ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); dest[1] = 0; dest[2] = 0; @@ -422,7 +421,7 @@ void _mesa_noop_TexCoord1f( GLfloat a ) void _mesa_noop_TexCoord1fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); dest[1] = 0; dest[2] = 0; @@ -432,7 +431,7 @@ void _mesa_noop_TexCoord1fv( const GLfloat *v ) void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); dest[2] = 0; @@ -442,7 +441,7 @@ void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) void _mesa_noop_TexCoord2fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); dest[2] = 0; @@ -452,7 +451,7 @@ void _mesa_noop_TexCoord2fv( const GLfloat *v ) void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -462,7 +461,7 @@ void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) void _mesa_noop_TexCoord3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -472,7 +471,7 @@ void _mesa_noop_TexCoord3fv( const GLfloat *v ) void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], a); COPY_FLOAT(dest[1], b); COPY_FLOAT(dest[2], c); @@ -482,7 +481,7 @@ void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) void _mesa_noop_TexCoord4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - GLfloat *dest = ctx->Current.Texcoord[0]; + GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; COPY_FLOAT(dest[0], v[0]); COPY_FLOAT(dest[1], v[1]); COPY_FLOAT(dest[2], v[2]); @@ -523,6 +522,25 @@ void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, GLfloat w ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < 16) { + ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); + } +} + +void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + if (index < 16) { + ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); + } +} + + + /* Execute a glRectf() function. This is not suitable for GL_COMPILE * modes (as the test for outside begin/end is not compiled), * but may be useful for drivers in circumstances which exclude diff --git a/xc/extras/Mesa/src/api_noop.h b/xc/extras/Mesa/src/api_noop.h index 380fe9225..da133ace7 100644 --- a/xc/extras/Mesa/src/api_noop.h +++ b/xc/extras/Mesa/src/api_noop.h @@ -1,8 +1,7 @@ -/* $Id: api_noop.h,v 1.1.1.1 2002/10/22 13:05:43 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -128,6 +127,12 @@ extern void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ); extern void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); +extern void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, + GLfloat y, GLfloat z, GLfloat w ); + +extern void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ); + + /* Not strictly a noop -- translate Rectf down to Begin/End and * vertices. Closer to the loopback operations, but doesn't meet the diff --git a/xc/extras/Mesa/src/api_validate.c b/xc/extras/Mesa/src/api_validate.c index 2f0869952..37ac4a142 100644 --- a/xc/extras/Mesa/src/api_validate.c +++ b/xc/extras/Mesa/src/api_validate.c @@ -1,8 +1,7 @@ -/* $Id: api_validate.c,v 1.1.1.1 2002/10/22 13:05:24 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -27,6 +26,7 @@ #include "glheader.h" #include "api_validate.h" #include "context.h" +#include "imports.h" #include "mtypes.h" #include "state.h" @@ -44,7 +44,8 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode < 0 || + mode > GL_POLYGON) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return GL_FALSE; } @@ -60,7 +61,10 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (ctx->NewState) _mesa_update_state( ctx ); - if (!ctx->Array.Vertex.Enabled) + if (ctx->Array.Vertex.Enabled + || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) + return GL_TRUE; + else return GL_FALSE; return GL_TRUE; @@ -81,7 +85,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode < 0 || mode > GL_POLYGON) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return GL_FALSE; } @@ -93,8 +97,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (type != GL_UNSIGNED_INT && type != GL_UNSIGNED_BYTE && - type != GL_UNSIGNED_SHORT) - { + type != GL_UNSIGNED_SHORT) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); return GL_FALSE; } @@ -102,10 +105,11 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (ctx->NewState) _mesa_update_state( ctx ); - if (!ctx->Array.Vertex.Enabled) + if (ctx->Array.Vertex.Enabled + || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) + return GL_TRUE; + else return GL_FALSE; - - return GL_TRUE; } @@ -121,7 +125,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode < 0 || mode > GL_POLYGON) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return GL_FALSE; } @@ -129,8 +133,9 @@ _mesa_validate_DrawArrays(GLcontext *ctx, if (ctx->NewState) _mesa_update_state( ctx ); - if (!ctx->Array.Vertex.Enabled) + if (ctx->Array.Vertex.Enabled + || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)) + return GL_TRUE; + else return GL_FALSE; - - return GL_TRUE; } diff --git a/xc/extras/Mesa/src/array_cache/ac_context.c b/xc/extras/Mesa/src/array_cache/ac_context.c index d78394e52..6c807158c 100644 --- a/xc/extras/Mesa/src/array_cache/ac_context.c +++ b/xc/extras/Mesa/src/array_cache/ac_context.c @@ -1,10 +1,9 @@ -/* $Id: ac_context.c,v 1.1.1.1 2002/10/22 13:06:39 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,17 +23,22 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "array_cache/ac_context.h" + +/* + * Initialize the array fallbacks. That is, by default the fallback arrays + * point into the current vertex attribute values in ctx->Current.Attrib[] + */ static void _ac_fallbacks_init( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); @@ -46,7 +50,7 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; - cl->Ptr = (void *) ctx->Current.Normal; + cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ @@ -55,7 +59,7 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; - cl->Ptr = (void *) ctx->Current.Color; + cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ @@ -64,7 +68,7 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; - cl->Ptr = (void *) ctx->Current.SecondaryColor; + cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ @@ -73,7 +77,7 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; - cl->Ptr = (void *) &ctx->Current.FogCoord; + cl->Ptr = (void *) &ctx->Current.Attrib[VERT_ATTRIB_FOG]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ @@ -92,7 +96,7 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Type = GL_FLOAT; cl->Stride = 0; cl->StrideB = 0; - cl->Ptr = (void *) ctx->Current.Texcoord[i]; + cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ } @@ -105,9 +109,23 @@ static void _ac_fallbacks_init( GLcontext *ctx ) cl->Ptr = (void *) &ctx->Current.EdgeFlag; cl->Enabled = 1; cl->Flags = CA_CLIENT_DATA; /* hack */ + + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + cl = &ac->Fallback.Attrib[i]; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 0; + cl->Ptr = (void *) ctx->Current.Attrib[i]; + cl->Enabled = 1; + cl->Flags = CA_CLIENT_DATA; /* hack */ + } } +/* + * Initialize the array cache pointers, types, strides, etc. + */ static void _ac_cache_init( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); @@ -169,7 +187,7 @@ static void _ac_cache_init( GLcontext *ctx ) cl->Enabled = 1; cl->Flags = 0; - for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) { + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { cl = &ac->Cache.TexCoord[i]; cl->Size = 4; cl->Type = GL_FLOAT; @@ -188,6 +206,17 @@ static void _ac_cache_init( GLcontext *ctx ) cl->Ptr = MALLOC( cl->StrideB * size ); cl->Enabled = 1; cl->Flags = 0; + + for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { + cl = &ac->Cache.Attrib[i]; + cl->Size = 4; + cl->Type = GL_FLOAT; + cl->Stride = 0; + cl->StrideB = 4 * sizeof(GLfloat); + cl->Ptr = MALLOC( cl->StrideB * size ); + cl->Enabled = 1; + cl->Flags = 0; + } } @@ -229,6 +258,10 @@ static void _ac_raw_init( GLcontext *ctx ) ac->IsCached.TexCoord[i] = GL_FALSE; } + for (i = 0 ; i < VERT_ATTRIB_MAX ; i++) { + ac->Raw.Attrib[i] = ac->Fallback.Attrib[i]; + ac->IsCached.Attrib[i] = GL_FALSE; + } } GLboolean _ac_CreateContext( GLcontext *ctx ) @@ -262,6 +295,11 @@ void _ac_DestroyContext( GLcontext *ctx ) FREE( ac->Cache.TexCoord[i].Ptr ); } + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + if (ac->Cache.Attrib[i].Ptr) + FREE( ac->Cache.Attrib[i].Ptr ); + } + if (ac->Elts) FREE( ac->Elts ); /* Free the context structure itself */ diff --git a/xc/extras/Mesa/src/array_cache/ac_context.h b/xc/extras/Mesa/src/array_cache/ac_context.h index 4916497b7..19a41e093 100644 --- a/xc/extras/Mesa/src/array_cache/ac_context.h +++ b/xc/extras/Mesa/src/array_cache/ac_context.h @@ -1,10 +1,9 @@ -/* $Id: ac_context.h,v 1.1.1.1 2002/10/22 13:06:39 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef _AC_CONTEXT_H @@ -47,6 +46,7 @@ struct ac_arrays { struct gl_client_array Index; struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; struct gl_client_array EdgeFlag; + struct gl_client_array Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; struct ac_array_pointers { @@ -58,6 +58,7 @@ struct ac_array_pointers { struct gl_client_array *Index; struct gl_client_array *TexCoord[MAX_TEXTURE_UNITS]; struct gl_client_array *EdgeFlag; + struct gl_client_array *Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; struct ac_array_flags { @@ -69,6 +70,7 @@ struct ac_array_flags { GLboolean Index; GLboolean TexCoord[MAX_TEXTURE_UNITS]; GLboolean EdgeFlag; + GLboolean Attrib[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ }; diff --git a/xc/extras/Mesa/src/array_cache/ac_import.c b/xc/extras/Mesa/src/array_cache/ac_import.c index 745a7c4f0..d68de5b03 100644 --- a/xc/extras/Mesa/src/array_cache/ac_import.c +++ b/xc/extras/Mesa/src/array_cache/ac_import.c @@ -1,10 +1,9 @@ -/* $Id: ac_import.c,v 1.1.1.1 2002/10/22 13:06:39 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,12 +23,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" @@ -59,9 +58,9 @@ static void reset_texcoord( GLcontext *ctx, GLuint unit ) else { ac->Raw.TexCoord[unit] = ac->Fallback.TexCoord[unit]; - if (ctx->Current.Texcoord[unit][3] != 1.0) + if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3] != 1.0) ac->Raw.TexCoord[unit].Size = 4; - else if (ctx->Current.Texcoord[unit][2] != 0.0) + else if (ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2] != 0.0) ac->Raw.TexCoord[unit].Size = 3; else ac->Raw.TexCoord[unit].Size = 2; @@ -74,7 +73,8 @@ static void reset_texcoord( GLcontext *ctx, GLuint unit ) static void reset_vertex( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); - ASSERT(ctx->Array.Vertex.Enabled); + ASSERT(ctx->Array.Vertex.Enabled + || (ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)); ac->Raw.Vertex = ctx->Array.Vertex; STRIDE_ARRAY(ac->Raw.Vertex, ac->start); ac->IsCached.Vertex = GL_FALSE; @@ -104,7 +104,7 @@ static void reset_color( GLcontext *ctx ) ACcontext *ac = AC_CONTEXT(ctx); - if (ctx->Array._Enabled & _NEW_ARRAY_COLOR) { + if (ctx->Array._Enabled & _NEW_ARRAY_COLOR0) { ac->Raw.Color = ctx->Array.Color; STRIDE_ARRAY(ac->Raw.Color, ac->start); } @@ -112,7 +112,7 @@ static void reset_color( GLcontext *ctx ) ac->Raw.Color = ac->Fallback.Color; ac->IsCached.Color = GL_FALSE; - ac->NewArrayState &= ~_NEW_ARRAY_COLOR; + ac->NewArrayState &= ~_NEW_ARRAY_COLOR0; } @@ -120,7 +120,7 @@ static void reset_secondarycolor( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); - if (ctx->Array._Enabled & _NEW_ARRAY_SECONDARYCOLOR) { + if (ctx->Array._Enabled & _NEW_ARRAY_COLOR1) { ac->Raw.SecondaryColor = ctx->Array.SecondaryColor; STRIDE_ARRAY(ac->Raw.SecondaryColor, ac->start); } @@ -128,7 +128,7 @@ static void reset_secondarycolor( GLcontext *ctx ) ac->Raw.SecondaryColor = ac->Fallback.SecondaryColor; ac->IsCached.SecondaryColor = GL_FALSE; - ac->NewArrayState &= ~_NEW_ARRAY_SECONDARYCOLOR; + ac->NewArrayState &= ~_NEW_ARRAY_COLOR1; } @@ -147,6 +147,7 @@ static void reset_index( GLcontext *ctx ) ac->NewArrayState &= ~_NEW_ARRAY_INDEX; } + static void reset_fogcoord( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); @@ -162,6 +163,7 @@ static void reset_fogcoord( GLcontext *ctx ) ac->NewArrayState &= ~_NEW_ARRAY_FOGCOORD; } + static void reset_edgeflag( GLcontext *ctx ) { ACcontext *ac = AC_CONTEXT(ctx); @@ -178,7 +180,73 @@ static void reset_edgeflag( GLcontext *ctx ) } +static void reset_attrib( GLcontext *ctx, GLuint index ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + GLboolean fallback = GL_FALSE; + + /* + * The 16 NV vertex attribute arrays have top priority. If one of those + * is not enabled, look if a corresponding conventional array is enabled. + * If nothing else, use the fallback (ctx->Current.Attrib) values. + */ + if (ctx->Array._Enabled & _NEW_ARRAY_ATTRIB(index)) { + ac->Raw.Attrib[index] = ctx->Array.VertexAttrib[index]; + STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); + } + else if (ctx->Array._Enabled & (1 << index)) { + /* use conventional vertex array if possible */ + if (index == VERT_ATTRIB_POS) { + ac->Raw.Attrib[index] = ctx->Array.Vertex; + } + else if (index == VERT_ATTRIB_NORMAL) { + ac->Raw.Attrib[index] = ctx->Array.Normal; + } + else if (index == VERT_ATTRIB_COLOR0) { + ac->Raw.Attrib[index] = ctx->Array.Color; + } + else if (index == VERT_ATTRIB_COLOR1) { + ac->Raw.Attrib[index] = ctx->Array.SecondaryColor; + } + else if (index == VERT_ATTRIB_FOG) { + ac->Raw.Attrib[index] = ctx->Array.FogCoord; + } + else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) { + GLuint unit = index - VERT_ATTRIB_TEX0; + ASSERT(unit < MAX_TEXTURE_UNITS); + ac->Raw.Attrib[index] = ctx->Array.TexCoord[unit]; + } + else { + /* missing conventional array (vertex weight, for example) */ + fallback = GL_TRUE; + } + if (!fallback) + STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start); + } + else { + fallback = GL_TRUE; + } + + if (fallback) { + /* fallback to ctx->Current.Attrib values */ + ac->Raw.Attrib[index] = ac->Fallback.Attrib[index]; + + if (ctx->Current.Attrib[index][3] != 1.0) + ac->Raw.Attrib[index].Size = 4; + else if (ctx->Current.Attrib[index][2] != 0.0) + ac->Raw.Attrib[index].Size = 3; + else + ac->Raw.Attrib[index].Size = 2; + } + + ac->IsCached.Attrib[index] = GL_FALSE; + ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index); +} + +/* + * Generic import function for color data + */ static void import( GLcontext *ctx, GLenum type, struct gl_client_array *to, @@ -237,8 +305,12 @@ static void import( GLcontext *ctx, -/* Functions to import array ranges with specified types and strides. +/* + * Functions to import array ranges with specified types and strides. + * For example, if the vertex data is GLshort[2] and we want GLfloat[3] + * we'll use an import function to do the data conversion. */ + static void import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, GLuint stride ) { @@ -246,6 +318,8 @@ static void import_texcoord( GLcontext *ctx, GLuint unit, struct gl_client_array *from = &ac->Raw.TexCoord[unit]; struct gl_client_array *to = &ac->Cache.TexCoord[unit]; + ASSERT(unit < ctx->Const.MaxTextureUnits); + /* Limited choices at this stage: */ ASSERT(type == GL_FLOAT); @@ -316,9 +390,6 @@ static void import_normal( GLcontext *ctx, ac->IsCached.Normal = GL_TRUE; } - - - static void import_color( GLcontext *ctx, GLenum type, GLuint stride ) { @@ -415,10 +486,42 @@ static void import_edgeflag( GLcontext *ctx, ac->IsCached.EdgeFlag = GL_TRUE; } +static void import_attrib( GLcontext *ctx, GLuint index, + GLenum type, GLuint stride ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + struct gl_client_array *from = &ac->Raw.Attrib[index]; + struct gl_client_array *to = &ac->Cache.Attrib[index]; + + ASSERT(index < VERT_ATTRIB_MAX); + + /* Limited choices at this stage: + */ + ASSERT(type == GL_FLOAT); + ASSERT(stride == 4*sizeof(GLfloat) || stride == 0); + ASSERT(ac->count - ac->start < ctx->Const.MaxArrayLockSize); + + _math_trans_4f( (GLfloat (*)[4]) to->Ptr, + from->Ptr, + from->StrideB, + from->Type, + from->Size, + 0, + ac->count - ac->start); + + to->Size = from->Size; + to->StrideB = 4 * sizeof(GLfloat); + to->Type = GL_FLOAT; + ac->IsCached.Attrib[index] = GL_TRUE; +} + -/* Externals to request arrays with specific properties: +/* + * Externals to request arrays with specific properties: */ + + struct gl_client_array *_ac_import_texcoord( GLcontext *ctx, GLuint unit, GLenum type, @@ -429,6 +532,8 @@ struct gl_client_array *_ac_import_texcoord( GLcontext *ctx, { ACcontext *ac = AC_CONTEXT(ctx); + ASSERT(unit < ctx->Const.MaxTextureUnits); + /* Can we keep the existing version? */ if (ac->NewArrayState & _NEW_ARRAY_TEXCOORD(unit)) @@ -533,7 +638,7 @@ struct gl_client_array *_ac_import_color( GLcontext *ctx, /* Can we keep the existing version? */ - if (ac->NewArrayState & _NEW_ARRAY_COLOR) + if (ac->NewArrayState & _NEW_ARRAY_COLOR0) reset_color( ctx ); /* Is the request impossible? @@ -601,7 +706,7 @@ struct gl_client_array *_ac_import_secondarycolor( GLcontext *ctx, /* Can we keep the existing version? */ - if (ac->NewArrayState & _NEW_ARRAY_SECONDARYCOLOR) + if (ac->NewArrayState & _NEW_ARRAY_COLOR1) reset_secondarycolor( ctx ); /* Is the request impossible? @@ -656,9 +761,6 @@ struct gl_client_array *_ac_import_fogcoord( GLcontext *ctx, } } - - - struct gl_client_array *_ac_import_edgeflag( GLcontext *ctx, GLenum type, GLuint reqstride, @@ -689,8 +791,50 @@ struct gl_client_array *_ac_import_edgeflag( GLcontext *ctx, } } +/* GL_NV_vertex_program */ +struct gl_client_array *_ac_import_attrib( GLcontext *ctx, + GLuint index, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwriteable, + GLboolean *writeable ) +{ + ACcontext *ac = AC_CONTEXT(ctx); + + ASSERT(index < VERT_ATTRIB_MAX); + + /* Can we keep the existing version? + */ + if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index)) { + reset_attrib( ctx, index ); + } + else if (ac->NewArrayState & (1 << index)) { + /* Also need to check conventional attributes */ + reset_attrib( ctx, index ); + } + /* Is the request impossible? + */ + if (reqsize != 0 && ac->Raw.Attrib[index].Size > (GLint) reqsize) + return NULL; + /* Do we need to pull in a copy of the client data: + */ + if (ac->Raw.Attrib[index].Type != type || + (reqstride != 0 && ac->Raw.Attrib[index].StrideB != (GLint)reqstride) || + reqwriteable) + { + if (!ac->IsCached.Attrib[index]) + import_attrib(ctx, index, type, reqstride ); + *writeable = GL_TRUE; + return &ac->Cache.Attrib[index]; + } + else { + *writeable = GL_FALSE; + return &ac->Raw.Attrib[index]; + } +} /* Clients must call this function to validate state and set bounds @@ -723,8 +867,8 @@ void _ac_import_range( GLcontext *ctx, GLuint start, GLuint count ) -/* Additional convienence function for importing a the element list - * for drawelements, drawrangeelements: +/* Additional convienence function for importing the element list + * for glDrawElements() and glDrawRangeElements(). */ CONST void * _ac_import_elements( GLcontext *ctx, diff --git a/xc/extras/Mesa/src/array_cache/acache.h b/xc/extras/Mesa/src/array_cache/acache.h index 52e4c1f80..2bb64f365 100644 --- a/xc/extras/Mesa/src/array_cache/acache.h +++ b/xc/extras/Mesa/src/array_cache/acache.h @@ -1,10 +1,9 @@ -/* $Id: acache.h,v 1.1.1.1 2002/10/22 13:06:39 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef _ARRAYCACHE_H @@ -43,15 +42,6 @@ extern void _ac_InvalidateState( GLcontext *ctx, GLuint new_state ); extern struct gl_client_array * -_ac_import_texcoord( GLcontext *ctx, - GLuint unit, - GLenum type, - GLuint reqstride, - GLuint reqsize, - GLboolean reqwritable, - GLboolean *writable ); - -extern struct gl_client_array * _ac_import_vertex( GLcontext *ctx, GLenum type, GLuint reqstride, @@ -103,6 +93,24 @@ _ac_import_edgeflag( GLcontext *ctx, GLboolean reqwritable, GLboolean *writable ); +extern struct gl_client_array * +_ac_import_texcoord( GLcontext *ctx, + GLuint unit, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + +extern struct gl_client_array * +_ac_import_attrib( GLcontext *ctx, + GLuint index, + GLenum type, + GLuint reqstride, + GLuint reqsize, + GLboolean reqwritable, + GLboolean *writable ); + /* Clients must call this function to validate state and set bounds * before importing any data: diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c index 636c33ee5..dec0ca5f5 100644 --- a/xc/extras/Mesa/src/attrib.c +++ b/xc/extras/Mesa/src/attrib.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,11 +23,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "accum.h" #include "attrib.h" #include "blend.h" @@ -42,7 +39,6 @@ #include "light.h" #include "lines.h" #include "matrix.h" -#include "mem.h" #include "points.h" #include "polygon.h" #include "simple_list.h" @@ -51,9 +47,6 @@ #include "texstate.h" #include "mtypes.h" #include "math/m_xform.h" -#endif - - /* @@ -80,8 +73,8 @@ _mesa_PushAttrib(GLbitfield mask) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPushAttrib %x\n", (int)mask); + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glPushAttrib %x\n", (int) mask); if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) { _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" ); @@ -141,9 +134,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->AlphaTest = ctx->Color.AlphaEnabled; attr->AutoNormal = ctx->Eval.AutoNormal; attr->Blend = ctx->Color.BlendEnabled; - for (i=0;i<MAX_CLIP_PLANES;i++) { - attr->ClipPlane[i] = ctx->Transform.ClipEnabled[i]; - } + attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; @@ -171,6 +162,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4; attr->Map1Vertex3 = ctx->Eval.Map1Vertex3; attr->Map1Vertex4 = ctx->Eval.Map1Vertex4; + MEMCPY(attr->Map1Attrib, ctx->Eval.Map1Attrib, sizeof(ctx->Eval.Map1Attrib)); attr->Map2Color4 = ctx->Eval.Map2Color4; attr->Map2Index = ctx->Eval.Map2Index; attr->Map2Normal = ctx->Eval.Map2Normal; @@ -180,10 +172,12 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4; attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; + MEMCPY(attr->Map2Attrib, ctx->Eval.Map2Attrib, sizeof(ctx->Eval.Map2Attrib)); attr->Normalize = ctx->Transform.Normalize; attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped; attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; + attr->PointSprite = ctx->Point.PointSprite; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; attr->PolygonOffsetFill = ctx->Polygon.OffsetFill; @@ -201,6 +195,10 @@ _mesa_PushAttrib(GLbitfield mask) attr->Texture[i] = ctx->Texture.Unit[i].Enabled; attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; } + /* GL_NV_vertex_program */ + attr->VertexProgram = ctx->VertexProgram.Enabled; + attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; + attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled; newnode = new_attrib_node( GL_ENABLE_BIT ); newnode->data = attr; newnode->next = head; @@ -339,21 +337,22 @@ _mesa_PushAttrib(GLbitfield mask) ctx->Texture.Unit[u].Current2D->RefCount++; ctx->Texture.Unit[u].Current3D->RefCount++; ctx->Texture.Unit[u].CurrentCubeMap->RefCount++; + ctx->Texture.Unit[u].CurrentRect->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++) { _mesa_copy_texture_object(&attr->Unit[u].Saved1D, - attr->Unit[u].Current1D); + attr->Unit[u].Current1D); _mesa_copy_texture_object(&attr->Unit[u].Saved2D, - attr->Unit[u].Current2D); + attr->Unit[u].Current2D); _mesa_copy_texture_object(&attr->Unit[u].Saved3D, - attr->Unit[u].Current3D); + attr->Unit[u].Current3D); _mesa_copy_texture_object(&attr->Unit[u].SavedCubeMap, - attr->Unit[u].CurrentCubeMap); + attr->Unit[u].CurrentCubeMap); _mesa_copy_texture_object(&attr->Unit[u].SavedRect, - attr->Unit[u].CurrentRect); + attr->Unit[u].CurrentRect); } newnode = new_attrib_node( GL_TEXTURE_BIT ); newnode->data = attr; @@ -412,9 +411,10 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND); for (i=0;i<MAX_CLIP_PLANES;i++) { - if (ctx->Transform.ClipEnabled[i] != enable->ClipPlane[i]) - _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i), - enable->ClipPlane[i]); + const GLuint mask = 1 << i; + if ((ctx->Transform.ClipPlanesEnabled & mask) != (enable->ClipPlanes & mask)) + _mesa_set_enable(ctx, (GLenum) (GL_CLIP_PLANE0 + i), + (GLboolean) ((enable->ClipPlanes & mask) ? GL_TRUE : GL_FALSE)); } TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, @@ -437,6 +437,7 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_INDEX_LOGIC_OP); TEST_AND_UPDATE(ctx->Color.ColorLogicOpEnabled, enable->ColorLogicOp, GL_COLOR_LOGIC_OP); + TEST_AND_UPDATE(ctx->Eval.Map1Color4, enable->Map1Color4, GL_MAP1_COLOR_4); TEST_AND_UPDATE(ctx->Eval.Map1Index, enable->Map1Index, GL_MAP1_INDEX); TEST_AND_UPDATE(ctx->Eval.Map1Normal, enable->Map1Normal, GL_MAP1_NORMAL); @@ -452,6 +453,11 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_MAP1_VERTEX_3); TEST_AND_UPDATE(ctx->Eval.Map1Vertex4, enable->Map1Vertex4, GL_MAP1_VERTEX_4); + for (i = 0; i < 16; i++) { + TEST_AND_UPDATE(ctx->Eval.Map1Attrib[i], enable->Map1Attrib[i], + GL_MAP1_VERTEX_ATTRIB0_4_NV + i); + } + TEST_AND_UPDATE(ctx->Eval.Map2Color4, enable->Map2Color4, GL_MAP2_COLOR_4); TEST_AND_UPDATE(ctx->Eval.Map2Index, enable->Map2Index, GL_MAP2_INDEX); TEST_AND_UPDATE(ctx->Eval.Map2Normal, enable->Map2Normal, GL_MAP2_NORMAL); @@ -467,6 +473,11 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_MAP2_VERTEX_3); TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); + for (i = 0; i < 16; i++) { + TEST_AND_UPDATE(ctx->Eval.Map2Attrib[i], enable->Map2Attrib[i], + GL_MAP2_VERTEX_ATTRIB0_4_NV + i); + } + TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, @@ -478,6 +489,10 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH); + if (ctx->Extensions.NV_point_sprite) { + TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite, + GL_POINT_SPRITE_NV); + } TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT); TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, @@ -490,6 +505,7 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_POLYGON_STIPPLE); TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST); TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST); + /* XXX two-sided stencil */ TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled, GL_MULTISAMPLE_ARB); TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage, @@ -504,6 +520,17 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, enable->SampleCoverageInvert, GL_SAMPLE_COVERAGE_INVERT_ARB); + /* GL_NV_vertex_program */ + TEST_AND_UPDATE(ctx->VertexProgram.Enabled, + enable->VertexProgram, + GL_VERTEX_PROGRAM_NV); + TEST_AND_UPDATE(ctx->VertexProgram.PointSizeEnabled, + enable->VertexProgramPointSize, + GL_VERTEX_PROGRAM_POINT_SIZE_NV); + TEST_AND_UPDATE(ctx->VertexProgram.TwoSideEnabled, + enable->VertexProgramTwoSide, + GL_VERTEX_PROGRAM_TWO_SIDE_NV); + #undef TEST_AND_UPDATE /* texture unit enables */ @@ -515,17 +542,17 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) (*ctx->Driver.ActiveTexture)(ctx, i); } (*ctx->Driver.Enable)( ctx, GL_TEXTURE_1D, - (GLboolean) (enable->Texture[i] & TEXTURE0_1D) ); + (GLboolean) (enable->Texture[i] & TEXTURE_1D_BIT) ); (*ctx->Driver.Enable)( ctx, GL_TEXTURE_2D, - (GLboolean) (enable->Texture[i] & TEXTURE0_2D) ); + (GLboolean) (enable->Texture[i] & TEXTURE_2D_BIT) ); (*ctx->Driver.Enable)( ctx, GL_TEXTURE_3D, - (GLboolean) (enable->Texture[i] & TEXTURE0_3D) ); + (GLboolean) (enable->Texture[i] & TEXTURE_3D_BIT) ); if (ctx->Extensions.ARB_texture_cube_map) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_CUBE_MAP_ARB, - (GLboolean) (enable->Texture[i] & TEXTURE0_CUBE) ); + (GLboolean) (enable->Texture[i] & TEXTURE_CUBE_BIT) ); if (ctx->Extensions.NV_texture_rectangle) (*ctx->Driver.Enable)( ctx, GL_TEXTURE_RECTANGLE_NV, - (GLboolean) (enable->Texture[i] & TEXTURE0_RECT) ); + (GLboolean) (enable->Texture[i] & TEXTURE_RECT_BIT) ); } } @@ -572,18 +599,18 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + u); _mesa_set_enable(ctx, GL_TEXTURE_1D, - (GLboolean) (unit->Enabled & TEXTURE0_1D ? GL_TRUE : GL_FALSE)); + (GLboolean) (unit->Enabled & TEXTURE_1D_BIT ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_2D, - (GLboolean) (unit->Enabled & TEXTURE0_2D ? GL_TRUE : GL_FALSE)); + (GLboolean) (unit->Enabled & TEXTURE_2D_BIT ? GL_TRUE : GL_FALSE)); _mesa_set_enable(ctx, GL_TEXTURE_3D, - (GLboolean) (unit->Enabled & TEXTURE0_3D ? GL_TRUE : GL_FALSE)); + (GLboolean) (unit->Enabled & TEXTURE_3D_BIT ? GL_TRUE : GL_FALSE)); if (ctx->Extensions.ARB_texture_cube_map) { _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, - (GLboolean) (unit->Enabled & TEXTURE0_CUBE ? GL_TRUE : GL_FALSE)); + (GLboolean) (unit->Enabled & TEXTURE_CUBE_BIT ? GL_TRUE : GL_FALSE)); } if (ctx->Extensions.NV_texture_rectangle) { _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, - (GLboolean) (unit->Enabled & TEXTURE0_RECT ? GL_TRUE : GL_FALSE)); + (GLboolean) (unit->Enabled & TEXTURE_RECT_BIT ? GL_TRUE : GL_FALSE)); } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); @@ -704,7 +731,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) } if (ctx->Extensions.SGIX_shadow_ambient) { _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, - CHAN_TO_FLOAT(obj->ShadowAmbient)); + obj->ShadowAmbient); } } @@ -753,9 +780,9 @@ _mesa_PopAttrib(void) while (attr) { - if (MESA_VERBOSE&VERBOSE_API) { - fprintf(stderr, "glPopAttrib %s\n", - _mesa_lookup_enum_by_nr(attr->kind)); + if (MESA_VERBOSE & VERBOSE_API) { + _mesa_debug(ctx, "glPopAttrib %s\n", + _mesa_lookup_enum_by_nr(attr->kind)); } switch (attr->kind) { @@ -774,10 +801,10 @@ _mesa_PopAttrib(void) const struct gl_colorbuffer_attrib *color; color = (const struct gl_colorbuffer_attrib *) attr->data; _mesa_ClearIndex((GLfloat) color->ClearIndex); - _mesa_ClearColor(CHAN_TO_FLOAT(color->ClearColor[0]), - CHAN_TO_FLOAT(color->ClearColor[1]), - CHAN_TO_FLOAT(color->ClearColor[2]), - CHAN_TO_FLOAT(color->ClearColor[3])); + _mesa_ClearColor(color->ClearColor[0], + color->ClearColor[1], + color->ClearColor[2], + color->ClearColor[3]); _mesa_IndexMask(color->IndexMask); _mesa_ColorMask((GLboolean) (color->ColorMask[0] != 0), (GLboolean) (color->ColorMask[1] != 0), @@ -785,8 +812,7 @@ _mesa_PopAttrib(void) (GLboolean) (color->ColorMask[3] != 0)); _mesa_DrawBuffer(color->DrawBuffer); _mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled); - _mesa_AlphaFunc(color->AlphaFunc, - CHAN_TO_FLOAT(color->AlphaRef)); + _mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef); _mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled); _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB, color->BlendDstRGB, @@ -874,8 +900,8 @@ _mesa_PopAttrib(void) _mesa_set_enable(ctx, GL_LIGHTING, light->Enabled); /* per-light state */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); for (i = 0; i < MAX_LIGHTS; i++) { GLenum lgt = (GLenum) (GL_LIGHT0 + i); @@ -885,9 +911,9 @@ _mesa_PopAttrib(void) _mesa_Lightfv( lgt, GL_AMBIENT, l->Ambient ); _mesa_Lightfv( lgt, GL_DIFFUSE, l->Diffuse ); _mesa_Lightfv( lgt, GL_SPECULAR, l->Specular ); - TRANSFORM_POINT( tmp, ctx->ModelView.inv, l->EyePosition ); + TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->inv, l->EyePosition ); _mesa_Lightfv( lgt, GL_POSITION, tmp ); - TRANSFORM_POINT( tmp, ctx->ModelView.m, l->EyeDirection ); + TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, l->EyeDirection ); _mesa_Lightfv( lgt, GL_SPOT_DIRECTION, tmp ); _mesa_Lightfv( lgt, GL_SPOT_EXPONENT, &l->SpotExponent ); _mesa_Lightfv( lgt, GL_SPOT_CUTOFF, &l->SpotCutoff ); @@ -942,12 +968,26 @@ _mesa_PopAttrib(void) point = (const struct gl_point_attrib *) attr->data; _mesa_PointSize(point->Size); _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag); - _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, - point->Params); - _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, point->MinSize); - _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, point->MaxSize); - _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, - point->Threshold); + if (ctx->Extensions.EXT_point_parameters) { + _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, + point->Params); + _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, + point->MinSize); + _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, + point->MaxSize); + _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, + point->Threshold); + } + if (ctx->Extensions.NV_point_sprite) { + GLuint u; + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + _mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV, + (GLint) point->CoordReplace[u]); + } + _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); + _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, + ctx->Point.SpriteRMode); + } } break; case GL_POLYGON_BIT: @@ -988,15 +1028,17 @@ _mesa_PopAttrib(void) break; case GL_STENCIL_BUFFER_BIT: { + const GLint face = 0; /* XXX stencil two side */ const struct gl_stencil_attrib *stencil; stencil = (const struct gl_stencil_attrib *) attr->data; _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); _mesa_ClearStencil(stencil->Clear); - _mesa_StencilFunc(stencil->Function, stencil->Ref, - stencil->ValueMask); - _mesa_StencilMask(stencil->WriteMask); - _mesa_StencilOp(stencil->FailFunc, stencil->ZFailFunc, - stencil->ZPassFunc); + _mesa_StencilFunc(stencil->Function[face], stencil->Ref[face], + stencil->ValueMask[face]); + _mesa_StencilMask(stencil->WriteMask[face]); + _mesa_StencilOp(stencil->FailFunc[face], + stencil->ZFailFunc[face], + stencil->ZPassFunc[face]); } break; case GL_TRANSFORM_BIT: @@ -1006,30 +1048,30 @@ _mesa_PopAttrib(void) xform = (const struct gl_transform_attrib *) attr->data; _mesa_MatrixMode(xform->MatrixMode); - if (ctx->ProjectionMatrix.flags & MAT_DIRTY) - _math_matrix_analyse( &ctx->ProjectionMatrix ); + if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); /* restore clip planes */ for (i = 0; i < MAX_CLIP_PLANES; i++) { + const GLuint mask = 1 << 1; const GLfloat *eyePlane = xform->EyeUserPlane[i]; COPY_4V(ctx->Transform.EyeUserPlane[i], eyePlane); - if (xform->ClipEnabled[i]) { - _mesa_transform_vector( ctx->Transform._ClipUserPlane[i], - eyePlane, - ctx->ProjectionMatrix.inv ); - _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE ); + if (xform->ClipPlanesEnabled & mask) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE); } else { - _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE ); + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE); } if (ctx->Driver.ClipPlane) ctx->Driver.ClipPlane( ctx, GL_CLIP_PLANE0 + i, eyePlane ); } /* normalize/rescale */ - _mesa_set_enable(ctx, GL_NORMALIZE, ctx->Transform.Normalize); - _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT, - ctx->Transform.RescaleNormals); + if (xform->Normalize != ctx->Transform.Normalize) + _mesa_set_enable(ctx, GL_NORMALIZE,ctx->Transform.Normalize); + if (xform->RescaleNormals != ctx->Transform.RescaleNormals) + _mesa_set_enable(ctx, GL_RESCALE_NORMAL_EXT, + ctx->Transform.RescaleNormals); } break; case GL_TEXTURE_BIT: diff --git a/xc/extras/Mesa/src/blend.c b/xc/extras/Mesa/src/blend.c index d5bb107f6..e031851f9 100644 --- a/xc/extras/Mesa/src/blend.c +++ b/xc/extras/Mesa/src/blend.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "blend.h" #include "colormac.h" @@ -34,7 +31,6 @@ #include "enums.h" #include "macros.h" #include "mtypes.h" -#endif void @@ -45,9 +41,9 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glBlendFunc %s %s\n", - _mesa_lookup_enum_by_nr(sfactor), - _mesa_lookup_enum_by_nr(dfactor)); + _mesa_debug(ctx, "glBlendFunc %s %s\n", + _mesa_lookup_enum_by_nr(sfactor), + _mesa_lookup_enum_by_nr(dfactor)); switch (sfactor) { case GL_SRC_COLOR: @@ -126,11 +122,11 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glBlendFuncSeparate %s %s %s %s\n", - _mesa_lookup_enum_by_nr(sfactorRGB), - _mesa_lookup_enum_by_nr(dfactorRGB), - _mesa_lookup_enum_by_nr(sfactorA), - _mesa_lookup_enum_by_nr(dfactorA)); + _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", + _mesa_lookup_enum_by_nr(sfactorRGB), + _mesa_lookup_enum_by_nr(dfactorRGB), + _mesa_lookup_enum_by_nr(sfactorA), + _mesa_lookup_enum_by_nr(dfactorA)); switch (sfactorRGB) { case GL_SRC_COLOR: @@ -267,8 +263,8 @@ _mesa_BlendEquation( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glBlendEquation %s\n", - _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glBlendEquation %s\n", + _mesa_lookup_enum_by_nr(mode)); switch (mode) { case GL_FUNC_ADD_EXT: @@ -345,7 +341,6 @@ void _mesa_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); - GLchan cref; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (func) { @@ -357,18 +352,17 @@ _mesa_AlphaFunc( GLenum func, GLclampf ref ) case GL_NOTEQUAL: case GL_GEQUAL: case GL_ALWAYS: - /* convert float alpha ref to GLchan type */ - UNCLAMPED_FLOAT_TO_CHAN(cref, ref); + ref = CLAMP(ref, 0.0F, 1.0F); - if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == cref) - return; + if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == ref) + return; /* no change */ FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.AlphaFunc = func; - ctx->Color.AlphaRef = cref; + ctx->Color.AlphaRef = ref; if (ctx->Driver.AlphaFunc) - ctx->Driver.AlphaFunc(ctx, func, cref); + ctx->Driver.AlphaFunc(ctx, func, ref); return; default: @@ -444,7 +438,7 @@ _mesa_ColorMask( GLboolean red, GLboolean green, ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glColorMask %d %d %d %d\n", red, green, blue, alpha); + _mesa_debug(ctx, "glColorMask %d %d %d %d\n", red, green, blue, alpha); /* Shouldn't have any information about channel depth in core mesa * -- should probably store these as the native booleans: diff --git a/xc/extras/Mesa/src/buffers.c b/xc/extras/Mesa/src/buffers.c index c5a459d91..a6713c880 100644 --- a/xc/extras/Mesa/src/buffers.c +++ b/xc/extras/Mesa/src/buffers.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,10 +24,8 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "accum.h" #include "buffers.h" #include "colormac.h" @@ -35,11 +33,9 @@ #include "depth.h" #include "enums.h" #include "macros.h" -#include "mem.h" #include "stencil.h" #include "state.h" #include "mtypes.h" -#endif @@ -66,20 +62,20 @@ _mesa_ClearIndex( GLfloat c ) void _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { - GLchan tmp[4]; + GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - UNCLAMPED_FLOAT_TO_CHAN(tmp[0], red); - UNCLAMPED_FLOAT_TO_CHAN(tmp[1], green); - UNCLAMPED_FLOAT_TO_CHAN(tmp[2], blue); - UNCLAMPED_FLOAT_TO_CHAN(tmp[3], alpha); + tmp[0] = CLAMP(red, 0.0F, 1.0F); + tmp[1] = CLAMP(green, 0.0F, 1.0F); + tmp[2] = CLAMP(blue, 0.0F, 1.0F); + tmp[3] = CLAMP(alpha, 0.0F, 1.0F); if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) - return; + return; /* no change */ FLUSH_VERTICES(ctx, _NEW_COLOR); - COPY_CHAN4(ctx->Color.ClearColor, tmp); + COPY_4V(ctx->Color.ClearColor, tmp); if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { /* it's OK to call glClearColor in CI mode but it should be a NOP */ @@ -96,7 +92,16 @@ _mesa_Clear( GLbitfield mask ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glClear 0x%x\n", mask); + _mesa_debug(ctx, "glClear 0x%x\n", mask); + + if (mask & ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT | + GL_ACCUM_BUFFER_BIT)) { + /* invalid bit set */ + _mesa_error( ctx, GL_INVALID_VALUE, "glClear(mask)"); + return; + } if (ctx->NewState) { _mesa_update_state( ctx ); /* update _Xmin, etc */ @@ -111,14 +116,14 @@ _mesa_Clear( GLbitfield mask ) /* don't clear depth buffer if depth writing disabled */ if (!ctx->Depth.Mask) - CLEAR_BITS(mask, GL_DEPTH_BUFFER_BIT); + mask &= ~GL_DEPTH_BUFFER_BIT; /* Build bitmask to send to driver Clear function */ ddMask = mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_ACCUM_BUFFER_BIT); if (mask & GL_COLOR_BUFFER_BIT) { - ddMask |= ctx->Color.DrawDestMask; + ddMask |= ctx->Color._DrawDestMask; } ASSERT(ctx->Driver.Clear); @@ -134,51 +139,42 @@ _mesa_DrawBuffer( GLenum mode ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */ - if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); + /* + * Do error checking and compute the _DrawDestMask bitfield. + */ switch (mode) { - case GL_AUX0: - case GL_AUX1: - case GL_AUX2: - case GL_AUX3: - /* AUX buffers not implemented in Mesa at this time */ - _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); - return; case GL_RIGHT: if (!ctx->Visual.stereoMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return;} if (ctx->Visual.doubleBufferMode) - ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT; + ctx->Color._DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT; else - ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; + ctx->Color._DrawDestMask = FRONT_RIGHT_BIT; break; case GL_FRONT_RIGHT: if (!ctx->Visual.stereoMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } - ctx->Color.DrawDestMask = FRONT_RIGHT_BIT; + ctx->Color._DrawDestMask = FRONT_RIGHT_BIT; break; case GL_BACK_RIGHT: - if (!ctx->Visual.stereoMode) { - _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); - return; - } - if (!ctx->Visual.doubleBufferMode) { + if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } - ctx->Color.DrawDestMask = BACK_RIGHT_BIT; + ctx->Color._DrawDestMask = BACK_RIGHT_BIT; break; case GL_BACK_LEFT: if (!ctx->Visual.doubleBufferMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" ); return; } - ctx->Color.DrawDestMask = BACK_LEFT_BIT; + ctx->Color._DrawDestMask = BACK_LEFT_BIT; break; case GL_FRONT_AND_BACK: if (!ctx->Visual.doubleBufferMode) { @@ -186,10 +182,10 @@ _mesa_DrawBuffer( GLenum mode ) return; } if (ctx->Visual.stereoMode) - ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT + ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT | FRONT_RIGHT_BIT | BACK_RIGHT_BIT; else - ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; break; case GL_BACK: if (!ctx->Visual.doubleBufferMode) { @@ -197,74 +193,81 @@ _mesa_DrawBuffer( GLenum mode ) return; } if (ctx->Visual.stereoMode) - ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT; + ctx->Color._DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT; else - ctx->Color.DrawDestMask = BACK_LEFT_BIT; + ctx->Color._DrawDestMask = BACK_LEFT_BIT; break; case GL_LEFT: /* never an error */ if (ctx->Visual.doubleBufferMode) - ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT; else - ctx->Color.DrawDestMask = FRONT_LEFT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT; break; case GL_FRONT_LEFT: /* never an error */ - ctx->Color.DrawDestMask = FRONT_LEFT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT; break; case GL_FRONT: /* never an error */ if (ctx->Visual.stereoMode) - ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT; else - ctx->Color.DrawDestMask = FRONT_LEFT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT; break; case GL_NONE: /* never an error */ - ctx->Color.DrawDestMask = 0; + ctx->Color._DrawDestMask = 0; + break; + case GL_AUX0: + if (ctx->Const.NumAuxBuffers >= 1) { + ctx->Color._DrawDestMask = AUX0_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX0)" ); + return; + } + break; + case GL_AUX1: + if (ctx->Const.NumAuxBuffers >= 2) { + ctx->Color._DrawDestMask = AUX1_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX1)" ); + return; + } + break; + case GL_AUX2: + if (ctx->Const.NumAuxBuffers >= 3) { + ctx->Color._DrawDestMask = AUX2_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX2)" ); + return; + } + break; + case GL_AUX3: + if (ctx->Const.NumAuxBuffers >= 4) { + ctx->Color._DrawDestMask = AUX3_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer(GL_AUX3)" ); + return; + } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" ); return; } - /* - * Make the dest buffer mode more precise if possible - */ - if (mode == GL_LEFT && !ctx->Visual.doubleBufferMode) - ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; - else if (mode == GL_RIGHT && !ctx->Visual.doubleBufferMode) - ctx->Color.DriverDrawBuffer = GL_FRONT_RIGHT; - else if (mode == GL_FRONT && !ctx->Visual.stereoMode) - ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; - else if (mode == GL_BACK && !ctx->Visual.stereoMode) - ctx->Color.DriverDrawBuffer = GL_BACK_LEFT; - else - ctx->Color.DriverDrawBuffer = mode; - - /* - * Set current alpha buffer pointer - */ - if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) { - if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT) - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontLeftAlpha; - else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT) - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackLeftAlpha; - else if (ctx->Color.DriverDrawBuffer == GL_FRONT_RIGHT) - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontRightAlpha; - else if (ctx->Color.DriverDrawBuffer == GL_BACK_RIGHT) - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackRightAlpha; - } + ctx->Color.DrawBuffer = mode; + ctx->NewState |= _NEW_COLOR; /* - * If we get here there can't have been an error. Now tell the - * device driver about it. + * Call device driver function. */ - ASSERT(ctx->Driver.SetDrawBuffer); - (*ctx->Driver.SetDrawBuffer)(ctx, ctx->Color.DriverDrawBuffer); - - ctx->Color.DrawBuffer = mode; - ctx->NewState |= _NEW_COLOR; + if (ctx->Driver.DrawBuffer) + (*ctx->Driver.DrawBuffer)(ctx, mode); } @@ -276,21 +279,17 @@ _mesa_ReadBuffer( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); + /* + * Do error checking and compute ctx->Pixel._ReadSrcMask. + */ switch (mode) { - case GL_AUX0: - case GL_AUX1: - case GL_AUX2: - case GL_AUX3: - /* AUX buffers not implemented in Mesa at this time */ - _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); - return; case GL_LEFT: case GL_FRONT: case GL_FRONT_LEFT: /* Front-Left buffer, always exists */ - ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT; + ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT; break; case GL_BACK: case GL_BACK_LEFT: @@ -299,7 +298,7 @@ _mesa_ReadBuffer( GLenum mode ) _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } - ctx->Pixel.DriverReadBuffer = GL_BACK_LEFT; + ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT; break; case GL_FRONT_RIGHT: case GL_RIGHT: @@ -307,14 +306,50 @@ _mesa_ReadBuffer( GLenum mode ) _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } - ctx->Pixel.DriverReadBuffer = GL_FRONT_RIGHT; + ctx->Pixel._ReadSrcMask = FRONT_RIGHT_BIT; break; case GL_BACK_RIGHT: if (!ctx->Visual.stereoMode || !ctx->Visual.doubleBufferMode) { _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" ); return; } - ctx->Pixel.DriverReadBuffer = GL_BACK_RIGHT; + ctx->Pixel._ReadSrcMask = BACK_RIGHT_BIT; + break; + case GL_AUX0: + if (ctx->Const.NumAuxBuffers >= 1) { + ctx->Pixel._ReadSrcMask = AUX0_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX0)" ); + return; + } + break; + case GL_AUX1: + if (ctx->Const.NumAuxBuffers >= 2) { + ctx->Pixel._ReadSrcMask = AUX1_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX1)" ); + return; + } + break; + case GL_AUX2: + if (ctx->Const.NumAuxBuffers >= 3) { + ctx->Pixel._ReadSrcMask = AUX2_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX2)" ); + return; + } + break; + case GL_AUX3: + if (ctx->Const.NumAuxBuffers >= 4) { + ctx->Pixel._ReadSrcMask = AUX3_BIT; + } + else { + _mesa_error( ctx, GL_INVALID_OPERATION, "glReadBuffer(GL_AUX3)" ); + return; + } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glReadBuffer" ); @@ -323,6 +358,12 @@ _mesa_ReadBuffer( GLenum mode ) ctx->Pixel.ReadBuffer = mode; ctx->NewState |= _NEW_PIXEL; + + /* + * Call device driver function. + */ + if (ctx->Driver.ReadBuffer) + (*ctx->Driver.ReadBuffer)(ctx, mode); } @@ -338,7 +379,7 @@ _mesa_ResizeBuffersMESA( void ) GLcontext *ctx = _mesa_get_current_context(); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glResizeBuffersMESA\n"); + _mesa_debug(ctx, "glResizeBuffersMESA\n"); if (ctx) { ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); @@ -394,7 +435,7 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) } if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glScissor %d %d %d %d\n", x, y, width, height); + _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); if (x == ctx->Scissor.X && y == ctx->Scissor.Y && diff --git a/xc/extras/Mesa/src/clip.c b/xc/extras/Mesa/src/clip.c index bde8c2072..07553683d 100644 --- a/xc/extras/Mesa/src/clip.c +++ b/xc/extras/Mesa/src/clip.c @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "clip.h" #include "context.h" @@ -36,7 +33,6 @@ #include "math/m_xform.h" #include "math/m_matrix.h" -#endif @@ -73,10 +69,11 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) * clipping now takes place. The clip-space equations are recalculated * whenever the projection matrix changes. */ - if (ctx->ModelView.flags & MAT_DIRTY) - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY) + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - _mesa_transform_vector( equation, equation, ctx->ModelView.inv ); + _mesa_transform_vector( equation, equation, + ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) return; @@ -88,13 +85,13 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) * matrix, and is recalculated on changes to the projection matrix by * code in _mesa_update_state(). */ - if (ctx->Transform.ClipEnabled[p]) { - if (ctx->ProjectionMatrix.flags & MAT_DIRTY) - _math_matrix_analyse( &ctx->ProjectionMatrix ); + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], - ctx->ProjectionMatrix.inv ); + ctx->ProjectionMatrixStack.Top->inv ); } if (ctx->Driver.ClipPlane) diff --git a/xc/extras/Mesa/src/colormac.h b/xc/extras/Mesa/src/colormac.h index ddfc2d22b..eb2043d3f 100644 --- a/xc/extras/Mesa/src/colormac.h +++ b/xc/extras/Mesa/src/colormac.h @@ -1,10 +1,9 @@ -/* $Id: colormac.h,v 1.1.1.1 2002/10/22 13:05:43 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -74,10 +73,8 @@ #define CHAN_TO_UBYTE(c) ((c) >> 8) #define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF))) -#define CLAMPED_FLOAT_TO_CHAN(c, f) \ - c = ((GLchan) IROUND((f) * CHAN_MAXF)) -#define UNCLAMPED_FLOAT_TO_CHAN(c, f) \ - c = ( (GLchan) IROUND( CLAMP(f, 0.0, 1.0) * CHAN_MAXF) ) +#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f) +#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f) #define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC) diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c index 9ca9576e9..0a0392cef 100644 --- a/xc/extras/Mesa/src/colortab.c +++ b/xc/extras/Mesa/src/colortab.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,20 +24,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colortab.h" #include "context.h" #include "image.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "state.h" -#include "swrast/s_span.h" /* XXX SWRAST hack */ -#endif - /* @@ -321,9 +315,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, table->Format = (GLenum) 0; } else { - char msg[100]; - sprintf(msg, "glColorTable(width=%d)", width); - _mesa_error(ctx, GL_INVALID_VALUE, msg); + _mesa_error(ctx, GL_INVALID_VALUE, "glColorTable(width=%d)", width); } return; } diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h index f65114aca..e1b53e93d 100644 --- a/xc/extras/Mesa/src/config.h +++ b/xc/extras/Mesa/src/config.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -54,6 +54,10 @@ /* Maximum color matrix stack depth: */ #define MAX_COLOR_STACK_DEPTH 4 +/* Vertex program matrix stacks: */ +#define MAX_PROGRAM_MATRICES 8 +#define MAX_PROGRAM_STACK_DEPTH 4 + /* Maximum attribute stack depth: */ #define MAX_ATTRIB_STACK_DEPTH 16 @@ -87,7 +91,7 @@ /* Min and Max point sizes and granularity */ #define MIN_POINT_SIZE 1.0 -#define MAX_POINT_SIZE 10.0 +#define MAX_POINT_SIZE 20.0 #define POINT_SIZE_GRANULARITY 0.1 /* Min and Max line widths and granularity */ @@ -104,14 +108,14 @@ /* Number of 3D texture mipmap levels */ #define MAX_3D_TEXTURE_LEVELS 8 -/* Number of cube texture mipmap levels */ +/* Number of cube texture mipmap levels - GL_ARB_texture_cube_map */ #define MAX_CUBE_TEXTURE_LEVELS 12 /* Maximum rectangular texture size - GL_NV_texture_rectangle */ #define MAX_TEXTURE_RECT_SIZE 2048 /* Number of texture units - GL_ARB_multitexture */ -#define MAX_TEXTURE_UNITS 6 +#define MAX_TEXTURE_UNITS 8 /* Maximum viewport/image size: */ #define MAX_WIDTH 2048 @@ -192,4 +196,11 @@ #define ACOMP 3 + +/* + * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1. + */ +#define FEATURE_NV_vertex_program 0 + + #endif /* CONFIG_H */ diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index 3978fbe63..82037a2f6 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -1,8 +1,7 @@ -/* $Id: context.c,v 1.1.1.8 2002/10/22 13:05:37 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -25,10 +24,8 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "buffers.h" #include "clip.h" #include "colortab.h" @@ -41,10 +38,8 @@ #include "get.h" #include "glthread.h" #include "hash.h" -#include "imports.h" #include "light.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "simple_list.h" #include "state.h" @@ -53,14 +48,15 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#if FEATURE_NV_vertex_program +#include "vpstate.h" +#endif #include "vtxfmt.h" - #include "math/m_translate.h" -#include "math/m_vertices.h" #include "math/m_matrix.h" #include "math/m_xform.h" #include "math/mathmod.h" -#endif + #if defined(MESA_TRACE) #include "Trace/tr_context.h" @@ -79,20 +75,157 @@ int MESA_VERBOSE = 0; int MESA_DEBUG_FLAGS = 0; #endif + +static void +free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); + + /**********************************************************************/ /***** OpenGL SI-style interface (new in Mesa 3.5) *****/ /**********************************************************************/ -static GLboolean -_mesa_DestroyContext(__GLcontext *gc) +/* Called by window system/device driver (via gc->exports.destroyCurrent()) + * when the rendering context is to be destroyed. + */ +GLboolean +_mesa_destroyContext(__GLcontext *gc) { if (gc) { _mesa_free_context_data(gc); - (*gc->imports.free)(gc, gc); + _mesa_free(gc); + } + return GL_TRUE; +} + +/* Called by window system/device driver (via gc->exports.loseCurrent()) + * when the rendering context is made non-current. + */ +GLboolean +_mesa_loseCurrent(__GLcontext *gc) +{ + /* XXX unbind context from thread */ + return GL_TRUE; +} + +/* Called by window system/device driver (via gc->exports.makeCurrent()) + * when the rendering context is made current. + */ +GLboolean +_mesa_makeCurrent(__GLcontext *gc) +{ + /* XXX bind context to thread */ + return GL_TRUE; +} + +/* Called by window system/device driver - yadda, yadda, yadda. + * See above comments. + */ +GLboolean +_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) +{ + if (gc && gcShare && gc->Shared && gcShare->Shared) { + gc->Shared->RefCount--; + if (gc->Shared->RefCount == 0) { + free_shared_state(gc, gc->Shared); + } + gc->Shared = gcShare->Shared; + gc->Shared->RefCount++; + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + +GLboolean +_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) +{ + if (dst && src) { + _mesa_copy_context( src, dst, mask ); + return GL_TRUE; + } + else { + return GL_FALSE; } +} + +GLboolean +_mesa_forceCurrent(__GLcontext *gc) +{ return GL_TRUE; } +GLboolean +_mesa_notifyResize(__GLcontext *gc) +{ + GLint x, y; + GLuint width, height; + __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); + if (!d || !d->getDrawableSize) + return GL_FALSE; + d->getDrawableSize( d, &x, &y, &width, &height ); + /* update viewport, resize software buffers, etc. */ + return GL_TRUE; +} + +void +_mesa_notifyDestroy(__GLcontext *gc) +{ + /* Called when the context's window/buffer is going to be destroyed. */ + /* Unbind from it. */ +} + +/* Called by window system just before swapping buffers. + * We have to finish any pending rendering. + */ +void +_mesa_notifySwapBuffers(__GLcontext *gc) +{ + FLUSH_VERTICES( gc, 0 ); +} + +struct __GLdispatchStateRec * +_mesa_dispatchExec(__GLcontext *gc) +{ + return NULL; +} + +void +_mesa_beginDispatchOverride(__GLcontext *gc) +{ +} + +void +_mesa_endDispatchOverride(__GLcontext *gc) +{ +} + +/* Setup the exports. The window system will call these functions + * when it needs Mesa to do something. + * NOTE: Device drivers should override these functions! For example, + * the Xlib driver should plug in the XMesa*-style functions into this + * structure. The XMesa-style functions should then call the _mesa_* + * version of these functions. This is an approximation to OO design + * (inheritance and virtual functions). + */ +static void +_mesa_init_default_exports(__GLexports *exports) +{ + exports->destroyContext = _mesa_destroyContext; + exports->loseCurrent = _mesa_loseCurrent; + exports->makeCurrent = _mesa_makeCurrent; + exports->shareContext = _mesa_shareContext; + exports->copyContext = _mesa_copyContext; + exports->forceCurrent = _mesa_forceCurrent; + exports->notifyResize = _mesa_notifyResize; + exports->notifyDestroy = _mesa_notifyDestroy; + exports->notifySwapBuffers = _mesa_notifySwapBuffers; + exports->dispatchExec = _mesa_dispatchExec; + exports->beginDispatchOverride = _mesa_beginDispatchOverride; + exports->endDispatchOverride = _mesa_endDispatchOverride; +} + + /* exported OpenGL SI interface */ __GLcontext * @@ -100,34 +233,13 @@ __glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) { GLcontext *ctx; - ctx = (GLcontext *) (*imports->calloc)(0, 1, sizeof(GLcontext)); + ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); if (ctx == NULL) { return NULL; } - ctx->Driver.CurrentExecPrimitive=0; - ctx->imports = *imports; - _mesa_initialize_visual(&ctx->Visual, - modes->rgbMode, - modes->doubleBufferMode, - modes->stereoMode, - modes->redBits, - modes->greenBits, - modes->blueBits, - modes->alphaBits, - modes->indexBits, - modes->depthBits, - modes->stencilBits, - modes->accumRedBits, - modes->accumGreenBits, - modes->accumBlueBits, - modes->accumAlphaBits, - 0); - - /* KW: was imports->wscx */ - _mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->other, GL_FALSE); - - ctx->exports.destroyContext = _mesa_DestroyContext; + _mesa_initialize_context(ctx, modes, NULL, imports, GL_FALSE); + ctx->imports = *imports; return ctx; } @@ -148,12 +260,6 @@ __glCoreNopDispatch(void) /**********************************************************************/ -/***** Context and Thread management *****/ -/**********************************************************************/ - - - -/**********************************************************************/ /***** GL Visual allocation/destruction *****/ /**********************************************************************/ @@ -264,6 +370,7 @@ _mesa_initialize_visual( GLvisual *vis, vis->rgbMode = rgbFlag; vis->doubleBufferMode = dbFlag; vis->stereoMode = stereoFlag; + vis->redBits = redBits; vis->greenBits = greenBits; vis->blueBits = blueBits; @@ -277,6 +384,14 @@ _mesa_initialize_visual( GLvisual *vis, vis->accumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0; vis->stencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0; + vis->haveAccumBuffer = accumRedBits > 0; + vis->haveDepthBuffer = depthBits > 0; + vis->haveStencilBuffer = stencilBits > 0; + + vis->numAuxBuffers = 0; + vis->level = 0; + vis->pixmapMode = 0; + return GL_TRUE; } @@ -337,7 +452,7 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer, assert(buffer); assert(visual); - BZERO(buffer, sizeof(GLframebuffer)); + _mesa_bzero(buffer, sizeof(GLframebuffer)); /* sanity checks */ if (softwareDepth ) { @@ -431,7 +546,7 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock); * This function just calls all the various one-time-init functions in Mesa. */ static void -one_time_init( void ) +one_time_init( GLcontext *ctx ) { static GLboolean alreadyCalled = GL_FALSE; _glthread_LOCK_MUTEX(OneTimeLock); @@ -452,15 +567,22 @@ one_time_init( void ) #ifdef USE_SPARC_ASM _mesa_init_sparc_glapi_relocs(); #endif - if (getenv("MESA_DEBUG")) { + if (_mesa_getenv("MESA_DEBUG")) { _glapi_noop_enable_warnings(GL_TRUE); +#ifndef GLX_DIRECT_RENDERING + /* libGL from before 2002/06/28 don't have this function. Someday, + * when newer libGL libs are common, remove the #ifdef test. This + * only serves to print warnings when calling undefined GL functions. + */ + _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); +#endif } else { _glapi_noop_enable_warnings(GL_FALSE); } #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) - fprintf(stderr, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__); + _mesa_debug(ctx, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__); #endif alreadyCalled = GL_TRUE; @@ -469,6 +591,36 @@ one_time_init( void ) } +static void +init_matrix_stack( struct matrix_stack *stack, + GLuint maxDepth, GLuint dirtyFlag ) +{ + GLuint i; + + stack->Depth = 0; + stack->MaxDepth = maxDepth; + stack->DirtyFlag = dirtyFlag; + /* The stack */ + stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix)); + for (i = 0; i < maxDepth; i++) { + _math_matrix_ctr(&stack->Stack[i]); + _math_matrix_alloc_inv(&stack->Stack[i]); + } + stack->Top = stack->Stack; +} + + +static void +free_matrix_stack( struct matrix_stack *stack ) +{ + GLuint i; + for (i = 0; i < stack->MaxDepth; i++) { + _math_matrix_dtr(&stack->Stack[i]); + } + FREE(stack->Stack); + stack->Stack = stack->Top = NULL; +} + /* * Allocate and initialize a shared context state structure. @@ -487,6 +639,9 @@ alloc_shared_state( void ) ss->DisplayList = _mesa_NewHashTable(); ss->TexObjects = _mesa_NewHashTable(); +#if FEATURE_NV_vertex_program + ss->VertexPrograms = _mesa_NewHashTable(); +#endif /* Default Texture objects */ outOfMemory = GL_FALSE; @@ -518,12 +673,18 @@ alloc_shared_state( void ) outOfMemory = GL_TRUE; } - if (!ss->DisplayList || !ss->TexObjects || outOfMemory) { + if (!ss->DisplayList || !ss->TexObjects +#if FEATURE_NV_vertex_program + || !ss->VertexPrograms +#endif + || outOfMemory) { /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) _mesa_DeleteHashTable(ss->DisplayList); if (ss->TexObjects) _mesa_DeleteHashTable(ss->TexObjects); + if (ss->VertexPrograms) + _mesa_DeleteHashTable(ss->VertexPrograms); if (ss->Default1D) _mesa_free_texture_object(ss, ss->Default1D); if (ss->Default2D) @@ -570,6 +731,22 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) } _mesa_DeleteHashTable(ss->TexObjects); +#if FEATURE_NV_vertex_program + /* Free vertex programs */ + while (1) { + GLuint prog = _mesa_HashFirstEntry(ss->VertexPrograms); + if (prog) { + _mesa_delete_program(ctx, prog); + } + else { + break; + } + } + _mesa_DeleteHashTable(ss->VertexPrograms); +#endif + + _glthread_DESTROY_MUTEX(ss->Mutex); + FREE(ss); } @@ -727,7 +904,7 @@ init_2d_map( struct gl_2d_map *map, int n, const float *initial ) static void init_attrib_groups( GLcontext *ctx ) { - GLuint i, j; + GLuint i; assert(ctx); @@ -758,50 +935,27 @@ init_attrib_groups( GLcontext *ctx ) ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; - ctx->Const.NumCompressedTextureFormats = 0; ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; ctx->Const.MaxLights = MAX_LIGHTS; - /* Modelview matrix */ - _math_matrix_ctr( &ctx->ModelView ); - _math_matrix_alloc_inv( &ctx->ModelView ); - - ctx->ModelViewStackDepth = 0; - for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { - _math_matrix_ctr( &ctx->ModelViewStack[i] ); - _math_matrix_alloc_inv( &ctx->ModelViewStack[i] ); - } - - /* Projection matrix - need inv for user clipping in clip space*/ - _math_matrix_ctr( &ctx->ProjectionMatrix ); - _math_matrix_alloc_inv( &ctx->ProjectionMatrix ); - - ctx->ProjectionStackDepth = 0; - for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) { - _math_matrix_ctr( &ctx->ProjectionStack[i] ); - _math_matrix_alloc_inv( &ctx->ProjectionStack[i] ); - } - - /* Derived ModelProject matrix */ + /* Initialize matrix stacks */ + init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH, + _NEW_MODELVIEW); + init_matrix_stack(&ctx->ProjectionMatrixStack, MAX_PROJECTION_STACK_DEPTH, + _NEW_PROJECTION); + init_matrix_stack(&ctx->ColorMatrixStack, MAX_COLOR_STACK_DEPTH, + _NEW_COLOR_MATRIX); + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH, + _NEW_TEXTURE_MATRIX); + for (i = 0; i < MAX_PROGRAM_MATRICES; i++) + init_matrix_stack(&ctx->ProgramMatrixStack[i], MAX_PROGRAM_STACK_DEPTH, + _NEW_TRACK_MATRIX); + ctx->CurrentStack = &ctx->ModelviewMatrixStack; + + /* Init combined Modelview*Projection matrix */ _math_matrix_ctr( &ctx->_ModelProjectMatrix ); - /* Texture matrix */ - for (i = 0; i < MAX_TEXTURE_UNITS; i++) { - _math_matrix_ctr( &ctx->TextureMatrix[i] ); - ctx->TextureStackDepth[i] = 0; - for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) { - _math_matrix_ctr( &ctx->TextureStack[i][j] ); - ctx->TextureStack[i][j].inv = 0; - } - } - - /* Color matrix */ - _math_matrix_ctr(&ctx->ColorMatrix); - ctx->ColorStackDepth = 0; - for (j = 0; j < MAX_COLOR_STACK_DEPTH - 1; j++) { - _math_matrix_ctr(&ctx->ColorStack[j]); - } - /* Accumulate buffer group */ ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); @@ -830,20 +984,23 @@ init_attrib_groups( GLcontext *ctx ) ctx->Color.DitherFlag = GL_TRUE; /* Current group */ - ASSIGN_4V( ctx->Current.Color, 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 0.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 0.0 ); + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.Index = 1; - for (i=0; i<MAX_TEXTURE_UNITS; i++) - ASSIGN_4V( ctx->Current.Texcoord[i], 0.0, 0.0, 0.0, 1.0 ); + ctx->Current.EdgeFlag = GL_TRUE; + ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterDistance = 0.0; ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 ); ctx->Current.RasterIndex = 1; for (i=0; i<MAX_TEXTURE_UNITS; i++) - ASSIGN_4V( ctx->Current.RasterMultiTexCoord[i], 0.0, 0.0, 0.0, 1.0 ); - ctx->Current.RasterTexCoord = ctx->Current.RasterMultiTexCoord[0]; + ASSIGN_4V( ctx->Current.RasterTexCoords[i], 0.0, 0.0, 0.0, 1.0 ); ctx->Current.RasterPosValid = GL_TRUE; - ctx->Current.EdgeFlag = GL_TRUE; - ASSIGN_3V( ctx->Current.Normal, 0.0, 0.0, 1.0 ); /* Depth buffer group */ @@ -863,6 +1020,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Eval.Map1TextureCoord4 = GL_FALSE; ctx->Eval.Map1Vertex3 = GL_FALSE; ctx->Eval.Map1Vertex4 = GL_FALSE; + MEMSET(ctx->Eval.Map1Attrib, 0, sizeof(ctx->Eval.Map1Attrib)); ctx->Eval.Map2Color4 = GL_FALSE; ctx->Eval.Map2Index = GL_FALSE; ctx->Eval.Map2Normal = GL_FALSE; @@ -872,6 +1030,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Eval.Map2TextureCoord4 = GL_FALSE; ctx->Eval.Map2Vertex3 = GL_FALSE; ctx->Eval.Map2Vertex4 = GL_FALSE; + MEMSET(ctx->Eval.Map2Attrib, 0, sizeof(ctx->Eval.Map2Attrib)); ctx->Eval.AutoNormal = GL_FALSE; ctx->Eval.MapGrid1un = 1; ctx->Eval.MapGrid1u1 = 0.0; @@ -890,6 +1049,7 @@ init_attrib_groups( GLcontext *ctx ) static GLfloat index[1] = { 1.0 }; static GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 }; static GLfloat texcoord[4] = { 0.0, 0.0, 0.0, 1.0 }; + static GLfloat attrib[4] = { 0.0, 0.0, 0.0, 1.0 }; init_1d_map( &ctx->EvalMap.Map1Vertex3, 3, vertex ); init_1d_map( &ctx->EvalMap.Map1Vertex4, 4, vertex ); @@ -900,6 +1060,8 @@ init_attrib_groups( GLcontext *ctx ) init_1d_map( &ctx->EvalMap.Map1Texture2, 2, texcoord ); init_1d_map( &ctx->EvalMap.Map1Texture3, 3, texcoord ); init_1d_map( &ctx->EvalMap.Map1Texture4, 4, texcoord ); + for (i = 0; i < 16; i++) + init_1d_map( ctx->EvalMap.Map1Attrib + i, 4, attrib ); init_2d_map( &ctx->EvalMap.Map2Vertex3, 3, vertex ); init_2d_map( &ctx->EvalMap.Map2Vertex4, 4, vertex ); @@ -910,6 +1072,8 @@ init_attrib_groups( GLcontext *ctx ) init_2d_map( &ctx->EvalMap.Map2Texture2, 2, texcoord ); init_2d_map( &ctx->EvalMap.Map2Texture3, 3, texcoord ); init_2d_map( &ctx->EvalMap.Map2Texture4, 4, texcoord ); + for (i = 0; i < 16; i++) + init_2d_map( ctx->EvalMap.Map2Attrib + i, 4, attrib ); } /* Fog group */ @@ -1094,7 +1258,11 @@ init_attrib_groups( GLcontext *ctx ) ctx->Point.MinSize = 0.0; ctx->Point.MaxSize = ctx->Const.MaxPointSize; ctx->Point.Threshold = 1.0; - ctx->Point.SpriteMode = GL_FALSE; /* GL_MESA_sprite_point */ + ctx->Point.PointSprite = GL_FALSE; /* GL_NV_point_sprite */ + ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite */ + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_NV_point_sprite */ + } /* Polygon group */ ctx->Polygon.CullFlag = GL_FALSE; @@ -1107,7 +1275,6 @@ init_attrib_groups( GLcontext *ctx ) ctx->Polygon.StippleFlag = GL_FALSE; ctx->Polygon.OffsetFactor = 0.0F; ctx->Polygon.OffsetUnits = 0.0F; - ctx->Polygon.OffsetMRD = 0.0F; ctx->Polygon.OffsetPoint = GL_FALSE; ctx->Polygon.OffsetLine = GL_FALSE; ctx->Polygon.OffsetFill = GL_FALSE; @@ -1124,18 +1291,27 @@ init_attrib_groups( GLcontext *ctx ) /* Stencil group */ ctx->Stencil.Enabled = GL_FALSE; - ctx->Stencil.Function = GL_ALWAYS; - ctx->Stencil.FailFunc = GL_KEEP; - ctx->Stencil.ZPassFunc = GL_KEEP; - ctx->Stencil.ZFailFunc = GL_KEEP; - ctx->Stencil.Ref = 0; - ctx->Stencil.ValueMask = STENCIL_MAX; + ctx->Stencil.TestTwoSide = GL_FALSE; + ctx->Stencil.ActiveFace = 0; /* 0 = GL_FRONT, 1 = GL_BACK */ + ctx->Stencil.Function[0] = GL_ALWAYS; + ctx->Stencil.Function[1] = GL_ALWAYS; + ctx->Stencil.FailFunc[0] = GL_KEEP; + ctx->Stencil.FailFunc[1] = GL_KEEP; + ctx->Stencil.ZPassFunc[0] = GL_KEEP; + ctx->Stencil.ZPassFunc[1] = GL_KEEP; + ctx->Stencil.ZFailFunc[0] = GL_KEEP; + ctx->Stencil.ZFailFunc[1] = GL_KEEP; + ctx->Stencil.Ref[0] = 0; + ctx->Stencil.Ref[1] = 0; + ctx->Stencil.ValueMask[0] = STENCIL_MAX; + ctx->Stencil.ValueMask[1] = STENCIL_MAX; + ctx->Stencil.WriteMask[0] = STENCIL_MAX; + ctx->Stencil.WriteMask[1] = STENCIL_MAX; ctx->Stencil.Clear = 0; - ctx->Stencil.WriteMask = STENCIL_MAX; /* Texture group */ ctx->Texture.CurrentUnit = 0; /* multitexture */ - ctx->Texture._ReallyEnabled = 0; + ctx->Texture._EnabledUnits = 0; for (i=0; i<MAX_TEXTURE_UNITS; i++) init_texture_unit( ctx, i ); ctx->Texture.SharedPalette = GL_FALSE; @@ -1147,10 +1323,9 @@ init_attrib_groups( GLcontext *ctx ) ctx->Transform.RescaleNormals = GL_FALSE; ctx->Transform.RasterPositionUnclipped = GL_FALSE; for (i=0;i<MAX_CLIP_PLANES;i++) { - ctx->Transform.ClipEnabled[i] = GL_FALSE; ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 ); } - ctx->Transform._AnyClip = GL_FALSE; + ctx->Transform.ClipPlanesEnabled = 0; /* Viewport group */ ctx->Viewport.X = 0; @@ -1281,6 +1456,18 @@ init_attrib_groups( GLcontext *ctx ) _mesa_init_colortable(&ctx->PostColorMatrixColorTable); _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); + /* GL_NV_vertex_program */ + ctx->VertexProgram.Enabled = GL_FALSE; + ctx->VertexProgram.PointSizeEnabled = GL_FALSE; + ctx->VertexProgram.TwoSideEnabled = GL_FALSE; + ctx->VertexProgram.CurrentID = 0; + ctx->VertexProgram.ErrorPos = -1; + ctx->VertexProgram.Current = NULL; + for (i = 0; i < VP_NUM_PROG_REGS / 4; i++) { + ctx->VertexProgram.TrackMatrix[i] = GL_NONE; + ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; + } + /* Miscellaneous */ ctx->NewState = _NEW_ALL; ctx->RenderMode = GL_RENDER; @@ -1295,19 +1482,17 @@ init_attrib_groups( GLcontext *ctx ) ctx->CatchSignals = GL_TRUE; ctx->OcclusionResult = GL_FALSE; ctx->OcclusionResultSaved = GL_FALSE; + ctx->_Facing = 0; /* For debug/development only */ - ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; + ctx->NoRaster = _mesa_getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; ctx->FirstTimeCurrent = GL_TRUE; /* Dither disable */ - ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; + ctx->NoDither = _mesa_getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; if (ctx->NoDither) { - if (getenv("MESA_DEBUG")) { - /* XXX This causes an OSMesa build problem on Solaris 2.6 */ -#ifndef SVR4 - fprintf(stderr, "MESA_NO_DITHER set - dithering disabled\n"); -#endif + if (_mesa_getenv("MESA_DEBUG")) { + _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); } ctx->Color.DitherFlag = GL_FALSE; } @@ -1345,7 +1530,8 @@ alloc_proxy_textures( GLcontext *ctx ) return GL_FALSE; } - ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_CUBE_MAP_ARB); + ctx->Texture.ProxyCubeMap = _mesa_alloc_texture_object(NULL, 0, + GL_TEXTURE_CUBE_MAP_ARB); if (!ctx->Texture.ProxyCubeMap) { _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); @@ -1353,7 +1539,8 @@ alloc_proxy_textures( GLcontext *ctx ) return GL_FALSE; } - ctx->Texture.ProxyRect = _mesa_alloc_texture_object(NULL, 0, GL_TEXTURE_RECTANGLE_NV); + ctx->Texture.ProxyRect = _mesa_alloc_texture_object(NULL, 0, + GL_TEXTURE_RECTANGLE_NV); if (!ctx->Texture.ProxyRect) { _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); @@ -1368,15 +1555,17 @@ alloc_proxy_textures( GLcontext *ctx ) ctx->Texture.Proxy2D->Image[i] = _mesa_alloc_texture_image(); ctx->Texture.Proxy3D->Image[i] = _mesa_alloc_texture_image(); ctx->Texture.ProxyCubeMap->Image[i] = _mesa_alloc_texture_image(); - ctx->Texture.ProxyRect->Image[i] = _mesa_alloc_texture_image(); if (!ctx->Texture.Proxy1D->Image[i] || !ctx->Texture.Proxy2D->Image[i] || !ctx->Texture.Proxy3D->Image[i] - || !ctx->Texture.ProxyCubeMap->Image[i] - || !ctx->Texture.ProxyRect->Image[i]) { + || !ctx->Texture.ProxyCubeMap->Image[i]) { out_of_memory = GL_TRUE; } } + ctx->Texture.ProxyRect->Image[0] = _mesa_alloc_texture_image(); + if (!ctx->Texture.ProxyRect->Image[0]) + out_of_memory = GL_TRUE; + if (out_of_memory) { for (i=0;i<MAX_TEXTURE_LEVELS;i++) { if (ctx->Texture.Proxy1D->Image[i]) { @@ -1391,9 +1580,9 @@ alloc_proxy_textures( GLcontext *ctx ) if (ctx->Texture.ProxyCubeMap->Image[i]) { _mesa_free_texture_image(ctx->Texture.ProxyCubeMap->Image[i]); } - if (ctx->Texture.ProxyRect->Image[i]) { - _mesa_free_texture_image(ctx->Texture.ProxyRect->Image[i]); - } + } + if (ctx->Texture.ProxyRect->Image[0]) { + _mesa_free_texture_image(ctx->Texture.ProxyRect->Image[0]); } _mesa_free_texture_object(NULL, ctx->Texture.Proxy1D); _mesa_free_texture_object(NULL, ctx->Texture.Proxy2D); @@ -1411,36 +1600,36 @@ alloc_proxy_textures( GLcontext *ctx ) static void add_debug_flags( const char *debug ) { #ifdef MESA_DEBUG - if (strstr(debug, "varray")) + if (_mesa_strstr(debug, "varray")) MESA_VERBOSE |= VERBOSE_VARRAY; - if (strstr(debug, "tex")) + if (_mesa_strstr(debug, "tex")) MESA_VERBOSE |= VERBOSE_TEXTURE; - if (strstr(debug, "imm")) + if (_mesa_strstr(debug, "imm")) MESA_VERBOSE |= VERBOSE_IMMEDIATE; - if (strstr(debug, "pipe")) + if (_mesa_strstr(debug, "pipe")) MESA_VERBOSE |= VERBOSE_PIPELINE; - if (strstr(debug, "driver")) + if (_mesa_strstr(debug, "driver")) MESA_VERBOSE |= VERBOSE_DRIVER; - if (strstr(debug, "state")) + if (_mesa_strstr(debug, "state")) MESA_VERBOSE |= VERBOSE_STATE; - if (strstr(debug, "api")) + if (_mesa_strstr(debug, "api")) MESA_VERBOSE |= VERBOSE_API; - if (strstr(debug, "list")) + if (_mesa_strstr(debug, "list")) MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; - if (strstr(debug, "lighting")) + if (_mesa_strstr(debug, "lighting")) MESA_VERBOSE |= VERBOSE_LIGHTING; /* Debug flag: */ - if (strstr(debug, "flush")) + if (_mesa_strstr(debug, "flush")) MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; #endif } @@ -1458,19 +1647,20 @@ _mesa_initialize_context( GLcontext *ctx, GLboolean direct ) { GLuint dispatchSize; + const char *c; - (void) direct; /* not used */ + ASSERT(driver_ctx); - /* misc one-time initializations */ - one_time_init(); + /* If the driver wants core Mesa to use special imports, it'll have to + * override these defaults. + */ + _mesa_init_default_imports( &(ctx->imports), driver_ctx ); - /** - ** OpenGL SI stuff - **/ - if (!ctx->imports.malloc) { - _mesa_InitDefaultImports(&ctx->imports, driver_ctx, NULL); - } - /* exports are setup by the device driver */ + /* initialize the exports (Mesa functions called by the window system) */ + _mesa_init_default_exports( &(ctx->exports) ); + + /* misc one-time initializations */ + one_time_init(ctx); ctx->DriverCtx = driver_ctx; ctx->Visual = *visual; @@ -1503,17 +1693,15 @@ _mesa_initialize_context( GLcontext *ctx, if (visual->doubleBufferMode) { ctx->Color.DrawBuffer = GL_BACK; - ctx->Color.DriverDrawBuffer = GL_BACK_LEFT; - ctx->Color.DrawDestMask = BACK_LEFT_BIT; + ctx->Color._DrawDestMask = BACK_LEFT_BIT; ctx->Pixel.ReadBuffer = GL_BACK; - ctx->Pixel.DriverReadBuffer = GL_BACK_LEFT; + ctx->Pixel._ReadSrcMask = BACK_LEFT_BIT; } else { ctx->Color.DrawBuffer = GL_FRONT; - ctx->Color.DriverDrawBuffer = GL_FRONT_LEFT; - ctx->Color.DrawDestMask = FRONT_LEFT_BIT; + ctx->Color._DrawDestMask = FRONT_LEFT_BIT; ctx->Pixel.ReadBuffer = GL_FRONT; - ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT; + ctx->Pixel._ReadSrcMask = FRONT_LEFT_BIT; } if (!alloc_proxy_textures(ctx)) { @@ -1521,15 +1709,106 @@ _mesa_initialize_context( GLcontext *ctx, return GL_FALSE; } - /* register the most recent extension functions with libGL */ - _glapi_add_entrypoint("glTbufferMask3DFX", 553); - _glapi_add_entrypoint("glCompressedTexImage3DARB", 554); - _glapi_add_entrypoint("glCompressedTexImage2DARB", 555); - _glapi_add_entrypoint("glCompressedTexImage1DARB", 556); - _glapi_add_entrypoint("glCompressedTexSubImage3DARB", 557); - _glapi_add_entrypoint("glCompressedTexSubImage2DARB", 558); - _glapi_add_entrypoint("glCompressedTexSubImage1DARB", 559); - _glapi_add_entrypoint("glGetCompressedTexImageARB", 560); + /* + * For XFree86/DRI: tell libGL to add these functions to the dispatcher. + * Basically, we should add all extension functions above offset 577. + * This enables older libGL libraries to work with newer drivers that + * have newer extensions. + */ + /* GL_ARB_window_pos aliases with GL_MESA_window_pos */ + _glapi_add_entrypoint("glWindowPos2dARB", 513); + _glapi_add_entrypoint("glWindowPos2dvARB", 514); + _glapi_add_entrypoint("glWindowPos2fARB", 515); + _glapi_add_entrypoint("glWindowPos2fvARB", 516); + _glapi_add_entrypoint("glWindowPos2iARB", 517); + _glapi_add_entrypoint("glWindowPos2ivARB", 518); + _glapi_add_entrypoint("glWindowPos2sARB", 519); + _glapi_add_entrypoint("glWindowPos2svARB", 520); + _glapi_add_entrypoint("glWindowPos3dARB", 521); + _glapi_add_entrypoint("glWindowPos3dvARB", 522); + _glapi_add_entrypoint("glWindowPos3fARB", 523); + _glapi_add_entrypoint("glWindowPos3fvARB", 524); + _glapi_add_entrypoint("glWindowPos3iARB", 525); + _glapi_add_entrypoint("glWindowPos3ivARB", 526); + _glapi_add_entrypoint("glWindowPos3sARB", 527); + _glapi_add_entrypoint("glWindowPos3svARB", 528); + /* new extension functions */ + _glapi_add_entrypoint("glAreProgramsResidentNV", 578); + _glapi_add_entrypoint("glBindProgramNV", 579); + _glapi_add_entrypoint("glDeleteProgramsNV", 580); + _glapi_add_entrypoint("glExecuteProgramNV", 581); + _glapi_add_entrypoint("glGenProgramsNV", 582); + _glapi_add_entrypoint("glGetProgramParameterdvNV", 583); + _glapi_add_entrypoint("glGetProgramParameterfvNV", 584); + _glapi_add_entrypoint("glGetProgramivNV", 585); + _glapi_add_entrypoint("glGetProgramStringNV", 586); + _glapi_add_entrypoint("glGetTrackMatrixivNV", 587); + _glapi_add_entrypoint("glGetVertexAttribdvNV", 588); + _glapi_add_entrypoint("glGetVertexAttribfvNV", 589); + _glapi_add_entrypoint("glGetVertexAttribivNV", 590); + _glapi_add_entrypoint("glGetVertexAttribPointervNV", 591); + _glapi_add_entrypoint("glIsProgramNV", 592); + _glapi_add_entrypoint("glLoadProgramNV", 593); + _glapi_add_entrypoint("glProgramParameter4dNV", 594); + _glapi_add_entrypoint("glProgramParameter4dvNV", 595); + _glapi_add_entrypoint("glProgramParameter4fNV", 596); + _glapi_add_entrypoint("glProgramParameter4fvNV", 597); + _glapi_add_entrypoint("glProgramParameters4dvNV", 598); + _glapi_add_entrypoint("glProgramParameters4fvNV", 599); + _glapi_add_entrypoint("glRequestResidentProgramsNV", 600); + _glapi_add_entrypoint("glTrackMatrixNV", 601); + _glapi_add_entrypoint("glVertexAttribPointerNV", 602); + _glapi_add_entrypoint("glVertexAttrib1dNV", 603); + _glapi_add_entrypoint("glVertexAttrib1dvNV", 604); + _glapi_add_entrypoint("glVertexAttrib1fNV", 605); + _glapi_add_entrypoint("glVertexAttrib1fvNV", 606); + _glapi_add_entrypoint("glVertexAttrib1sNV", 607); + _glapi_add_entrypoint("glVertexAttrib1svNV", 608); + _glapi_add_entrypoint("glVertexAttrib2dNV", 609); + _glapi_add_entrypoint("glVertexAttrib2dvNV", 610); + _glapi_add_entrypoint("glVertexAttrib2fNV", 611); + _glapi_add_entrypoint("glVertexAttrib2fvNV", 612); + _glapi_add_entrypoint("glVertexAttrib2sNV", 613); + _glapi_add_entrypoint("glVertexAttrib2svNV", 614); + _glapi_add_entrypoint("glVertexAttrib3dNV", 615); + _glapi_add_entrypoint("glVertexAttrib3dvNV", 616); + _glapi_add_entrypoint("glVertexAttrib3fNV", 617); + _glapi_add_entrypoint("glVertexAttrib3fvNV", 618); + _glapi_add_entrypoint("glVertexAttrib3sNV", 619); + _glapi_add_entrypoint("glVertexAttrib3svNV", 620); + _glapi_add_entrypoint("glVertexAttrib4dNV", 621); + _glapi_add_entrypoint("glVertexAttrib4dvNV", 622); + _glapi_add_entrypoint("glVertexAttrib4fNV", 623); + _glapi_add_entrypoint("glVertexAttrib4fvNV", 624); + _glapi_add_entrypoint("glVertexAttrib4sNV", 625); + _glapi_add_entrypoint("glVertexAttrib4svNV", 626); + _glapi_add_entrypoint("glVertexAttrib4ubNV", 627); + _glapi_add_entrypoint("glVertexAttrib4ubvNV", 628); + _glapi_add_entrypoint("glVertexAttribs1dvNV", 629); + _glapi_add_entrypoint("glVertexAttribs1fvNV", 630); + _glapi_add_entrypoint("glVertexAttribs1svNV", 631); + _glapi_add_entrypoint("glVertexAttribs2dvNV", 632); + _glapi_add_entrypoint("glVertexAttribs2fvNV", 633); + _glapi_add_entrypoint("glVertexAttribs2svNV", 634); + _glapi_add_entrypoint("glVertexAttribs3dvNV", 635); + _glapi_add_entrypoint("glVertexAttribs3fvNV", 636); + _glapi_add_entrypoint("glVertexAttribs3svNV", 637); + _glapi_add_entrypoint("glVertexAttribs4dvNV", 638); + _glapi_add_entrypoint("glVertexAttribs4fvNV", 639); + _glapi_add_entrypoint("glVertexAttribs4svNV", 640); + _glapi_add_entrypoint("glVertexAttribs4ubvNV", 641); + _glapi_add_entrypoint("glPointParameteriNV", 642); + _glapi_add_entrypoint("glPointParameterivNV", 643); + _glapi_add_entrypoint("glMultiDrawArraysEXT", 644); + _glapi_add_entrypoint("glMultiDrawElementsEXT", 645); + _glapi_add_entrypoint("glActiveStencilFaceEXT", 646); + _glapi_add_entrypoint("glDeleteFencesNV", 647); + _glapi_add_entrypoint("glGenFencesNV", 648); + _glapi_add_entrypoint("glIsFenceNV", 649); + _glapi_add_entrypoint("glTestFenceNV", 650); + _glapi_add_entrypoint("glGetFenceivNV", 651); + _glapi_add_entrypoint("glFinishFenceNV", 652); + _glapi_add_entrypoint("glSetFenceNV", 653); /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI @@ -1581,41 +1860,13 @@ _mesa_initialize_context( GLcontext *ctx, } ctx->MRD = 1.0; /* Minimum resolvable depth value, for polygon offset */ + c = _mesa_getenv("MESA_DEBUG"); + if (c) + add_debug_flags(c); -#if defined(MESA_TRACE) - ctx->TraceCtx = (trace_context_t *) CALLOC( sizeof(trace_context_t) ); -#if 0 - /* Brian: do you want to have CreateContext fail here, - or should we just trap in NewTrace (currently done)? */ - if (!(ctx->TraceCtx)) { - free_shared_state(ctx, ctx->Shared); - FREE( ctx->Exec ); - FREE( ctx->Save ); - return GL_FALSE; - } -#endif - trInitContext(ctx->TraceCtx); - - ctx->TraceDispatch = (struct _glapi_table *) - CALLOC(dispatchSize * sizeof(void*)); -#if 0 - if (!(ctx->TraceCtx)) { - free_shared_state(ctx, ctx->Shared); - FREE( ctx->Exec ); - FREE( ctx->Save ); - FREE( ctx->TraceCtx ); - return GL_FALSE; - } -#endif - trInitDispatch(ctx->TraceDispatch); -#endif - - - if (getenv("MESA_DEBUG")) - add_debug_flags(getenv("MESA_DEBUG")); - - if (getenv("MESA_VERBOSE")) - add_debug_flags(getenv("MESA_VERBOSE")); + c = _mesa_getenv("MESA_VERBOSE"); + if (c) + add_debug_flags(c); return GL_TRUE; } @@ -1627,6 +1878,7 @@ _mesa_initialize_context( GLcontext *ctx, * Input: visual - a GLvisual pointer (we copy the struct contents) * sharelist - another context to share display lists with or NULL * driver_ctx - pointer to device driver's context state struct + * direct - direct rendering? * Return: pointer to a new __GLcontextRec or NULL if error. */ GLcontext * @@ -1634,17 +1886,22 @@ _mesa_create_context( const GLvisual *visual, GLcontext *share_list, void *driver_ctx, GLboolean direct ) + { - GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) ); - if (!ctx) { + GLcontext *ctx; + + ASSERT(visual); + ASSERT(driver_ctx); + + ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); + if (!ctx) return NULL; - } - ctx->Driver.CurrentExecPrimitive = 0; + if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) { return ctx; } else { - FREE(ctx); + _mesa_free(ctx); return NULL; } } @@ -1659,35 +1916,36 @@ void _mesa_free_context_data( GLcontext *ctx ) { struct gl_shine_tab *s, *tmps; - GLuint i, j; + GLuint i; /* if we're destroying the current context, unbind it first */ if (ctx == _mesa_get_current_context()) { _mesa_make_current(NULL, NULL); } - _math_matrix_dtr( &ctx->ModelView ); - for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { - _math_matrix_dtr( &ctx->ModelViewStack[i] ); - } - _math_matrix_dtr( &ctx->ProjectionMatrix ); - for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) { - _math_matrix_dtr( &ctx->ProjectionStack[i] ); - } - for (i = 0; i < MAX_TEXTURE_UNITS; i++) { - _math_matrix_dtr( &ctx->TextureMatrix[i] ); - for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) { - _math_matrix_dtr( &ctx->TextureStack[i][j] ); - } - } - + /* + * Free transformation matrix stacks + */ + free_matrix_stack(&ctx->ModelviewMatrixStack); + free_matrix_stack(&ctx->ProjectionMatrixStack); + free_matrix_stack(&ctx->ColorMatrixStack); + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + free_matrix_stack(&ctx->TextureMatrixStack[i]); + for (i = 0; i < MAX_PROGRAM_MATRICES; i++) + free_matrix_stack(&ctx->ProgramMatrixStack[i]); + /* combined Modelview*Projection matrix */ _math_matrix_dtr( &ctx->_ModelProjectMatrix ); - _math_matrix_dtr(&ctx->ColorMatrix); - for (j = 0; j < MAX_COLOR_STACK_DEPTH - 1; j++) { - _math_matrix_dtr(&ctx->ColorStack[j]); + +#if FEATURE_NV_vertex_program + if (ctx->VertexProgram.Current) { + ctx->VertexProgram.Current->RefCount--; + if (ctx->VertexProgram.Current->RefCount <= 0) + _mesa_delete_program(ctx, ctx->VertexProgram.CurrentID); } +#endif + /* Shared context state (display lists, textures, etc) */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); ctx->Shared->RefCount--; assert(ctx->Shared->RefCount >= 0); @@ -1697,6 +1955,7 @@ _mesa_free_context_data( GLcontext *ctx ) free_shared_state( ctx, ctx->Shared ); } + /* Free lighting shininess exponentiation table */ foreach_s( s, tmps, ctx->_ShineTabList ) { FREE( s ); } @@ -1728,6 +1987,8 @@ _mesa_free_context_data( GLcontext *ctx ) FREE( ctx->EvalMap.Map1Texture3.Points ); if (ctx->EvalMap.Map1Texture4.Points) FREE( ctx->EvalMap.Map1Texture4.Points ); + for (i = 0; i < 16; i++) + FREE((ctx->EvalMap.Map1Attrib[i].Points)); if (ctx->EvalMap.Map2Vertex3.Points) FREE( ctx->EvalMap.Map2Vertex3.Points ); @@ -1747,6 +2008,8 @@ _mesa_free_context_data( GLcontext *ctx ) FREE( ctx->EvalMap.Map2Texture3.Points ); if (ctx->EvalMap.Map2Texture4.Points) FREE( ctx->EvalMap.Map2Texture4.Points ); + for (i = 0; i < 16; i++) + FREE((ctx->EvalMap.Map2Attrib[i].Points)); _mesa_free_colortable_data( &ctx->ColorTable ); _mesa_free_colortable_data( &ctx->PostConvolutionColorTable ); @@ -1891,45 +2154,46 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) } -/* - * Set the current context, binding the given frame buffer to the context. - */ -void -_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer ) -{ - _mesa_make_current2( newCtx, buffer, buffer ); -} - static void print_info( void ) { - fprintf(stderr, "Mesa GL_VERSION = %s\n", + _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", (char *) _mesa_GetString(GL_VERSION)); - fprintf(stderr, "Mesa GL_RENDERER = %s\n", + _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", (char *) _mesa_GetString(GL_RENDERER)); - fprintf(stderr, "Mesa GL_VENDOR = %s\n", + _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", (char *) _mesa_GetString(GL_VENDOR)); - fprintf(stderr, "Mesa GL_EXTENSIONS = %s\n", + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", (char *) _mesa_GetString(GL_EXTENSIONS)); #if defined(THREADS) - fprintf(stderr, "Mesa thread-safe: YES\n"); + _mesa_debug(NULL, "Mesa thread-safe: YES\n"); #else - fprintf(stderr, "Mesa thread-safe: NO\n"); + _mesa_debug(NULL, "Mesa thread-safe: NO\n"); #endif #if defined(USE_X86_ASM) - fprintf(stderr, "Mesa x86-optimized: YES\n"); + _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); #else - fprintf(stderr, "Mesa x86-optimized: NO\n"); + _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); #endif #if defined(USE_SPARC_ASM) - fprintf(stderr, "Mesa sparc-optimized: YES\n"); + _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); #else - fprintf(stderr, "Mesa sparc-optimized: NO\n"); + _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); #endif } /* + * Set the current context, binding the given frame buffer to the context. + */ +void +_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer ) +{ + _mesa_make_current2( newCtx, buffer, buffer ); +} + + +/* * Bind the given context to the given draw-buffer and read-buffer * and make it the current context for this thread. */ @@ -1938,7 +2202,7 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { if (MESA_VERBOSE) - fprintf(stderr, "_mesa_make_current2()\n"); + _mesa_debug(newCtx, "_mesa_make_current2()\n"); /* Check that the context's and framebuffer's visuals are compatible. * We could do a lot more checking here but this'll catch obvious @@ -2009,6 +2273,7 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, } } + /* This is only for T&L - a bit out of place, or misnamed (BP) */ if (newCtx->Driver.MakeCurrent) newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer ); @@ -2018,7 +2283,7 @@ _mesa_make_current2( GLcontext *newCtx, GLframebuffer *drawBuffer, * information. */ if (newCtx->FirstTimeCurrent) { - if (getenv("MESA_INFO")) { + if (_mesa_getenv("MESA_INFO")) { print_info(); } newCtx->FirstTimeCurrent = GL_FALSE; @@ -2040,19 +2305,6 @@ _mesa_get_current_context( void ) } - -/* - * This should be called by device drivers just before they do a - * swapbuffers. Any pending rendering commands will be executed. - */ -void -_mesa_swapbuffers(GLcontext *ctx) -{ - FLUSH_VERTICES( ctx, 0 ); -} - - - /* * Return pointer to this context's current API dispatch table. * It'll either be the immediate-mode execute dispatcher or the @@ -2072,111 +2324,12 @@ _mesa_get_dispatch(GLcontext *ctx) /* - * This function is called when the Mesa user has stumbled into a code - * path which may not be implemented fully or correctly. - */ -void _mesa_problem( const GLcontext *ctx, const char *s ) -{ - fprintf( stderr, "Mesa implementation error: %s\n", s ); -#ifdef XF86DRI - fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); -#else - fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); -#endif - (void) ctx; -} - - - -/* - * This is called to inform the user that he or she has tried to do - * something illogical or if there's likely a bug in their program - * (like enabled depth testing without a depth buffer). + * Record the given error code and call the driver's Error function if defined. + * This is called via _mesa_error(). */ void -_mesa_warning( const GLcontext *ctx, const char *s ) +_mesa_record_error( GLcontext *ctx, GLenum error ) { - (*ctx->imports.warning)((__GLcontext *) ctx, (char *) s); -} - - - -/* - * Compile an error into current display list. - */ -void -_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) -{ - if (ctx->CompileFlag) - _mesa_save_error( ctx, error, s ); - - if (ctx->ExecuteFlag) - _mesa_error( ctx, error, s ); -} - - - -/* - * This is Mesa's error handler. Normally, all that's done is the updating - * of the current error value. If Mesa is compiled with -DDEBUG or if the - * environment variable "MESA_DEBUG" is defined then a real error message - * is printed to stderr. - * Input: ctx - the GL context - * error - the error value - * where - usually the name of function where error was detected - */ -void -_mesa_error( GLcontext *ctx, GLenum error, const char *where ) -{ - const char *debugEnv = getenv("MESA_DEBUG"); - GLboolean debug; - -#ifdef DEBUG - if (debugEnv && strstr(debugEnv, "silent")) - debug = GL_FALSE; - else - debug = GL_TRUE; -#else - if (debugEnv) - debug = GL_TRUE; - else - debug = GL_FALSE; -#endif - - if (debug) { - const char *errstr; - switch (error) { - case GL_NO_ERROR: - errstr = "GL_NO_ERROR"; - break; - case GL_INVALID_VALUE: - errstr = "GL_INVALID_VALUE"; - break; - case GL_INVALID_ENUM: - errstr = "GL_INVALID_ENUM"; - break; - case GL_INVALID_OPERATION: - errstr = "GL_INVALID_OPERATION"; - break; - case GL_STACK_OVERFLOW: - errstr = "GL_STACK_OVERFLOW"; - break; - case GL_STACK_UNDERFLOW: - errstr = "GL_STACK_UNDERFLOW"; - break; - case GL_OUT_OF_MEMORY: - errstr = "GL_OUT_OF_MEMORY"; - break; - case GL_TABLE_TOO_LARGE: - errstr = "GL_TABLE_TOO_LARGE"; - break; - default: - errstr = "unknown"; - break; - } - fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where); - } - if (!ctx) return; @@ -2191,7 +2344,6 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *where ) } - void _mesa_Finish( void ) { diff --git a/xc/extras/Mesa/src/context.h b/xc/extras/Mesa/src/context.h index 36f8e164f..a123b317b 100644 --- a/xc/extras/Mesa/src/context.h +++ b/xc/extras/Mesa/src/context.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -52,9 +52,7 @@ /* - * Create/destroy a GLvisual. A GLvisual is like a GLX visual. It describes - * the colorbuffer, depth buffer, stencil buffer and accum buffer which will - * be used by the GL context and framebuffer. + * Create/destroy a GLvisual. */ extern GLvisual * _mesa_create_visual( GLboolean rgbFlag, @@ -97,9 +95,7 @@ _mesa_destroy_visual( GLvisual *vis ); /* - * Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable. - * It bundles up the depth buffer, stencil buffer and accum buffers into a - * single entity. + * Create/destroy a GLframebuffer. */ extern GLframebuffer * _mesa_create_framebuffer( const GLvisual *visual, @@ -125,14 +121,13 @@ _mesa_destroy_framebuffer( GLframebuffer *buffer ); /* - * Create/destroy a GLcontext. A GLcontext is like a GLX context. It - * contains the rendering state. + * Create/destroy a GLcontext. */ extern GLcontext * _mesa_create_context( const GLvisual *visual, GLcontext *share_list, void *driver_ctx, - GLboolean direct); + GLboolean direct ); extern GLboolean _mesa_initialize_context( GLcontext *ctx, @@ -181,47 +176,64 @@ _mesa_get_current_context(void); -extern void -_mesa_swapbuffers(GLcontext *ctx); +/* OpenGL SI-style export functions. */ +extern GLboolean +_mesa_destroyContext(__GLcontext *gc); -extern struct _glapi_table * -_mesa_get_dispatch(GLcontext *ctx); +extern GLboolean +_mesa_loseCurrent(__GLcontext *gc); +extern GLboolean +_mesa_makeCurrent(__GLcontext *gc); +extern GLboolean +_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare); -/* - * Miscellaneous - */ +extern GLboolean +_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); + +extern GLboolean +_mesa_forceCurrent(__GLcontext *gc); + +extern GLboolean +_mesa_notifyResize(__GLcontext *gc); extern void -_mesa_problem( const GLcontext *ctx, const char *s ); +_mesa_notifyDestroy(__GLcontext *gc); extern void -_mesa_warning( const GLcontext *ctx, const char *s ); +_mesa_notifySwapBuffers(__GLcontext *gc); + +extern struct __GLdispatchStateRec * +_mesa_dispatchExec(__GLcontext *gc); extern void -_mesa_error( GLcontext *ctx, GLenum error, const char *s ); +_mesa_beginDispatchOverride(__GLcontext *gc); extern void -_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); +_mesa_endDispatchOverride(__GLcontext *gc); -extern void -_mesa_Finish( void ); +extern struct _glapi_table * +_mesa_get_dispatch(GLcontext *ctx); -extern void -_mesa_Flush( void ); +/* + * Miscellaneous + */ extern void -_mesa_read_config_file(GLcontext *ctx); +_mesa_record_error( GLcontext *ctx, GLenum error ); + extern void -_mesa_register_config_var(const char *name, - void (*notify)( const char *, int )); +_mesa_Finish( void ); + +extern void +_mesa_Flush( void ); #endif diff --git a/xc/extras/Mesa/src/convolve.c b/xc/extras/Mesa/src/convolve.c index a2622e0f4..341d60eac 100644 --- a/xc/extras/Mesa/src/convolve.c +++ b/xc/extras/Mesa/src/convolve.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -32,9 +32,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "convolve.h" @@ -42,8 +39,6 @@ #include "image.h" #include "mtypes.h" #include "state.h" -#include "swrast/s_span.h" /* XXX SWRAST hack */ -#endif /* diff --git a/xc/extras/Mesa/src/dd.h b/xc/extras/Mesa/src/dd.h index 2bf833730..6e5f759f4 100644 --- a/xc/extras/Mesa/src/dd.h +++ b/xc/extras/Mesa/src/dd.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -29,8 +29,6 @@ /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ -#include "macros.h" - struct gl_pixelstore_attrib; /* Mask bits sent to the driver Clear() function */ @@ -38,9 +36,13 @@ struct gl_pixelstore_attrib; #define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */ #define DD_BACK_LEFT_BIT BACK_LEFT_BIT /* 4 */ #define DD_BACK_RIGHT_BIT BACK_RIGHT_BIT /* 8 */ +#define DD_AUX0 AUX0_BIT /* future use */ +#define DD_AUX1 AUX1_BIT /* future use */ +#define DD_AUX2 AUX2_BIT /* future use */ +#define DD_AUX3 AUX3_BIT /* future use */ #define DD_DEPTH_BIT GL_DEPTH_BUFFER_BIT /* 0x00000100 */ -#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */ #define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */ +#define DD_STENCIL_BIT GL_STENCIL_BUFFER_BIT /* 0x00000400 */ /* @@ -48,11 +50,6 @@ struct gl_pixelstore_attrib; */ struct dd_function_table { - /********************************************************************** - *** Mandatory functions: these functions must be implemented by *** - *** every device driver. *** - **********************************************************************/ - const GLubyte * (*GetString)( GLcontext *ctx, GLenum name ); /* Return a string as needed by glGetString(). * Only the GL_RENDERER token must be implemented. Otherwise, @@ -74,28 +71,23 @@ struct dd_function_table { * If 'all' is true then the clear the whole buffer, else clear only the * region defined by (x,y,width,height). * This function must obey the glColorMask, glIndexMask and glStencilMask - * settings! Software Mesa can do masked clears if the device driver can't. + * settings! + * Software Mesa can do masked clears if the device driver can't. */ - void (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer ); + void (*DrawBuffer)( GLcontext *ctx, GLenum buffer ); /* - * Specifies the current buffer for writing. - * The following values must be accepted when applicable: - * GL_FRONT_LEFT - this buffer always exists - * GL_BACK_LEFT - when double buffering - * GL_FRONT_RIGHT - when using stereo - * GL_BACK_RIGHT - when using stereo and double buffering - * GL_FRONT - write to front left and front right if it exists - * GL_BACK - write to back left and back right if it exists - * GL_LEFT - write to front left and back left if it exists - * GL_RIGHT - write to right left and back right if they exist - * GL_FRONT_AND_BACK - write to all four buffers if they exist - * GL_NONE - disable buffer write in device driver. - * + * Specifies the current buffer for writing. Called via glDrawBuffer(). * Note the driver must organize fallbacks (eg with swrast) if it * cannot implement the requested mode. */ + + void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); + /* + * Specifies the current buffer for reading. Called via glReadBuffer(). + */ + void (*GetBufferSize)( GLframebuffer *buffer, GLuint *width, GLuint *height ); /* @@ -351,55 +343,6 @@ struct dd_function_table { * should do the job. */ - void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target, - GLint level, void *image, - const struct gl_texture_object *texObj, - struct gl_texture_image *texImage ); - /* Called by glGetCompressedTexImageARB. - * <target>, <level>, <image> are specified by user. - * <texObj> is the source texture object. - * <texImage> is the source texture image. - */ - - GLint (*BaseCompressedTexFormat)(GLcontext *ctx, - GLint internalFormat); - /* Called to compute the base format for a specific compressed - * format. Return -1 if the internalFormat is not a specific - * compressed format that the driver recognizes. - * Example: if internalFormat==GL_COMPRESSED_RGB_FXT1_3DFX, return GL_RGB. - */ - - GLint (*CompressedTextureSize)(GLcontext *ctx, - const struct gl_texture_image *texImage); - -#if 000 - /* ... Note the - * return value differences between this function and - * SpecificCompressedTexFormat below. - */ - - GLint (*SpecificCompressedTexFormat)(GLcontext *ctx, - GLint internalFormat, - GLint numDimensions, - GLint *levelp, - GLsizei *widthp, - GLsizei *heightp, - GLsizei *depthp, - GLint *borderp, - GLenum *formatp, - GLenum *typep); - /* Called to turn a generic texture format into a specific - * texture format. For example, if a driver implements - * GL_3DFX_texture_compression_FXT1, this would map - * GL_COMPRESSED_RGBA_ARB to GL_COMPRESSED_RGBA_FXT1_3DFX. - * - * If the driver does not know how to handle the compressed - * format, then just return the generic format, and Mesa will - * do the right thing with it. - */ - -#endif - /*** *** Texture object functions: ***/ @@ -468,16 +411,14 @@ struct dd_function_table { *** They're ALSO called by the gl_PopAttrib() function!!! *** May add more functions like these to the device driver in the future. ***/ - void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLchan ref); + void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref); void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]); void (*BlendEquation)(GLcontext *ctx, GLenum mode); void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor); void (*BlendFuncSeparate)(GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA); - void (*BlendConstColor)(GLcontext *ctx, GLfloat red, GLfloat green, - GLfloat blue, GLfloat alpha); - void (*ClearColor)(GLcontext *ctx, const GLchan color[4]); + void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]); void (*ClearDepth)(GLcontext *ctx, GLclampd d); void (*ClearIndex)(GLcontext *ctx, GLuint index); void (*ClearStencil)(GLcontext *ctx, GLint s); @@ -512,6 +453,7 @@ struct dd_function_table { void (*StencilFunc)(GLcontext *ctx, GLenum func, GLint ref, GLuint mask); void (*StencilMask)(GLcontext *ctx, GLuint mask); void (*StencilOp)(GLcontext *ctx, GLenum fail, GLenum zfail, GLenum zpass); + void (*ActiveStencilFace)(GLcontext *ctx, GLuint face); void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname, const GLfloat *params); void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, @@ -522,7 +464,6 @@ struct dd_function_table { void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat); void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); - /*** *** Vertex array functions *** @@ -543,6 +484,8 @@ struct dd_function_table { void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr); + void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size, + GLenum type, GLsizei stride, const GLvoid *ptr); /*** State-query functions @@ -555,8 +498,6 @@ struct dd_function_table { GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result); GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result); - - /*** *** Support for multiple t&l engines ***/ @@ -703,6 +644,9 @@ typedef struct { void (*CallList)( GLuint ); /* NOTE */ void (*Begin)( GLenum ); void (*End)( void ); + void (*VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); + void (*VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); + /* Drivers present a reduced set of the functions possible in * begin/end objects. Core mesa provides translation stubs for the * remaining functions to map down to these entrypoints. diff --git a/xc/extras/Mesa/src/debug.c b/xc/extras/Mesa/src/debug.c index de309348e..7cd30f30b 100644 --- a/xc/extras/Mesa/src/debug.c +++ b/xc/extras/Mesa/src/debug.c @@ -1,4 +1,3 @@ -/* $Id: debug.c,v 1.1.1.1 2002/10/22 13:05:08 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -25,11 +24,15 @@ */ #include "mtypes.h" +#include "context.h" +#include "imports.h" #include "debug.h" -void _mesa_print_state( const char *msg, GLuint state ) + +void +_mesa_print_state( const char *msg, GLuint state ) { - fprintf(stderr, + _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, @@ -61,9 +64,10 @@ void _mesa_print_state( const char *msg, GLuint state ) -void _mesa_print_tri_caps( const char *name, GLuint flags ) +void +_mesa_print_tri_caps( const char *name, GLuint flags ) { - fprintf(stderr, + _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", name, flags, diff --git a/xc/extras/Mesa/src/depth.c b/xc/extras/Mesa/src/depth.c index cd3b39521..1d8c52910 100644 --- a/xc/extras/Mesa/src/depth.c +++ b/xc/extras/Mesa/src/depth.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,18 +24,13 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "enums.h" #include "depth.h" #include "macros.h" -#include "mem.h" #include "mtypes.h" -#endif - /**********************************************************************/ @@ -69,7 +64,7 @@ _mesa_DepthFunc( GLenum func ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); + _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); switch (func) { case GL_LESS: /* (default) pass if incoming z < stored z */ @@ -105,7 +100,7 @@ _mesa_DepthMask( GLboolean flag ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glDepthMask %d\n", flag); + _mesa_debug(ctx, "glDepthMask %d\n", flag); /* * GL_TRUE indicates depth buffer writing is enabled (default) diff --git a/xc/extras/Mesa/src/dispatch.c b/xc/extras/Mesa/src/dispatch.c index d4eebdb53..87dc64f02 100644 --- a/xc/extras/Mesa/src/dispatch.c +++ b/xc/extras/Mesa/src/dispatch.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -27,10 +27,7 @@ /* * This file generates all the gl* function entyrpoints. * But if we're using X86-optimized dispatch (X86/glapi_x86.S) then - * we don't use this file's code. - * - * Eventually this file may be replaced by automatically generated - * code from an API spec file. + * we don't use this code. * * NOTE: This file should _not_ be used when compiling Mesa for a DRI- * based device driver. @@ -38,14 +35,11 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "glapi.h" #include "glapitable.h" #include "glthread.h" -#endif + #if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM)) @@ -63,12 +57,28 @@ #define NAME(func) gl##func #endif + +#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ + +#define F stdout +#define DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE; \ + (_glapi_Dispatch->FUNC) ARGS; + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + fprintf MESSAGE; \ + return (_glapi_Dispatch->FUNC) ARGS + +#else + #define DISPATCH(FUNC, ARGS, MESSAGE) \ - (_glapi_Dispatch->FUNC) ARGS + (_glapi_Dispatch->FUNC) ARGS; #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ return (_glapi_Dispatch->FUNC) ARGS +#endif /* logging */ + #ifndef GLAPIENTRY #define GLAPIENTRY diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c index 5fe6124ec..bf01ec2bc 100644 --- a/xc/extras/Mesa/src/dlist.c +++ b/xc/extras/Mesa/src/dlist.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,11 +23,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "api_loopback.h" #include "attrib.h" #include "blend.h" @@ -54,7 +51,6 @@ #include "dlist.h" #include "macros.h" #include "matrix.h" -#include "mem.h" #include "pixel.h" #include "points.h" #include "polygon.h" @@ -64,12 +60,13 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#if FEATURE_NV_vertex_program +#include "vpstate.h" +#endif #include "math/m_matrix.h" #include "math/m_xform.h" -#endif - /* @@ -241,6 +238,17 @@ typedef enum { OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, /* GL_ARB_multisample */ OPCODE_SAMPLE_COVERAGE, + /* GL_ARB_window_pos */ + OPCODE_WINDOW_POS_ARB, + /* GL_NV_vertex_program */ + OPCODE_BIND_PROGRAM_NV, + OPCODE_EXECUTE_PROGRAM_NV, + OPCODE_REQUEST_PROGRAMS_RESIDENT_NV, + OPCODE_LOAD_PROGRAM_NV, + OPCODE_PROGRAM_PARAMETER4F_NV, + OPCODE_TRACK_MATRIX_NV, + /* GL_EXT_stencil_two_side */ + OPCODE_ACTIVE_STENCIL_FACE_EXT, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -508,7 +516,7 @@ void _mesa_init_lists( void ) InstSize[OPCODE_BLEND_FUNC] = 3; InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5; InstSize[OPCODE_CALL_LIST] = 2; - InstSize[OPCODE_CALL_LIST_OFFSET] = 2; + InstSize[OPCODE_CALL_LIST_OFFSET] = 3; InstSize[OPCODE_CLEAR] = 2; InstSize[OPCODE_CLEAR_ACCUM] = 5; InstSize[OPCODE_CLEAR_COLOR] = 5; @@ -626,6 +634,17 @@ void _mesa_init_lists( void ) InstSize[OPCODE_SAMPLE_COVERAGE] = 3; /* GL_ARB_multitexture */ InstSize[OPCODE_ACTIVE_TEXTURE] = 2; + /* GL_ARB_window_pos */ + InstSize[OPCODE_WINDOW_POS_ARB] = 4; + /* GL_NV_vertex_program */ + InstSize[OPCODE_BIND_PROGRAM_NV] = 3; + InstSize[OPCODE_EXECUTE_PROGRAM_NV] = 7; + InstSize[OPCODE_REQUEST_PROGRAMS_RESIDENT_NV] = 2; + InstSize[OPCODE_LOAD_PROGRAM_NV] = 4; + InstSize[OPCODE_PROGRAM_PARAMETER4F_NV] = 7; + InstSize[OPCODE_TRACK_MATRIX_NV] = 5; + /* GL_EXT_stencil_two_side */ + InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2; } init_flag = 1; } @@ -876,14 +895,34 @@ void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); GLint i; + GLboolean typeErrorFlag; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); FLUSH_CURRENT(ctx, 0); + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_2_BYTES: + case GL_3_BYTES: + case GL_4_BYTES: + typeErrorFlag = GL_FALSE; + break; + default: + typeErrorFlag = GL_TRUE; + } + for (i=0;i<n;i++) { GLuint list = translate_id( i, type, lists ); - Node *n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST_OFFSET, 1 ); + Node *n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST_OFFSET, 2 ); if (n) { n[1].ui = list; + n[2].b = typeErrorFlag; } } if (ctx->ExecuteFlag) { @@ -2495,6 +2534,18 @@ static void save_PointParameterfEXT( GLenum pname, GLfloat param ) save_PointParameterfvEXT(pname, ¶m); } +static void save_PointParameteriNV( GLenum pname, GLint param ) +{ + GLfloat p = (GLfloat) param; + save_PointParameterfvEXT(pname, &p); +} + +static void save_PointParameterivNV( GLenum pname, const GLint *param ) +{ + GLfloat p = (GLfloat) param[0]; + save_PointParameterfvEXT(pname, &p); +} + static void save_PointSize( GLfloat size ) { @@ -3227,7 +3278,7 @@ static void save_TexImage2D( GLenum target, static void save_TexImage3D( GLenum target, - GLint level, GLenum internalFormat, + GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, @@ -3782,7 +3833,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, } if (ctx->ExecuteFlag) { (*ctx->Exec->CompressedTexSubImage1DARB)(target, level, xoffset, - width, format, imageSize, data); + width, format, imageSize, data); } } @@ -3929,6 +3980,159 @@ save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) } +/* + * GL_NV_vertex_program + */ +#if FEATURE_NV_vertex_program +static void +save_BindProgramNV(GLenum target, GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_PROGRAM_NV, 2 ); + if (n) { + n[1].e = target; + n[2].ui = id; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->BindProgramNV)( target, id ); + } +} + +static void +save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_EXECUTE_PROGRAM_NV, 6 ); + if (n) { + n[1].e = target; + n[2].ui = id; + n[3].f = params[0]; + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ExecuteProgramNV)(target, id, params); + } +} + + +static void +save_ProgramParameter4fNV(GLenum target, GLuint index, + GLfloat x, GLfloat y, + GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6 ); + if (n) { + n[1].e = target; + n[2].ui = index; + n[3].f = x; + n[4].f = y; + n[5].f = z; + n[6].f = w; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ProgramParameter4fNV)(target, index, x, y, z, w); + } +} + + +static void +save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) +{ + save_ProgramParameter4fNV(target, index, params[0], params[1], + params[2], params[3]); +} + + +static void +save_ProgramParameter4dNV(GLenum target, GLuint index, + GLdouble x, GLdouble y, + GLdouble z, GLdouble w) +{ + save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, + (GLfloat) z, (GLfloat) w); +} + + +static void +save_ProgramParameter4dvNV(GLenum target, GLuint index, + const GLdouble *params) +{ + save_ProgramParameter4fNV(target, index, (GLfloat) params[0], + (GLfloat) params[1], (GLfloat) params[2], + (GLfloat) params[3]); +} + + +static void +save_ProgramParameters4dvNV(GLenum target, GLuint index, + GLuint num, const GLdouble *params) +{ + GLuint i; + for (i = 0; i < num; i++) { + save_ProgramParameter4dvNV(target, index + i, params + 4 * i); + } +} + + +static void +save_ProgramParameters4fvNV(GLenum target, GLuint index, + GLuint num, const GLfloat *params) +{ + GLuint i; + for (i = 0; i < num; i++) { + save_ProgramParameter4fvNV(target, index + i, params + 4 * i); + } +} + + + +static void +save_TrackMatrixNV(GLenum target, GLuint address, + GLenum matrix, GLenum transform) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_TRACK_MATRIX_NV, 4 ); + if (n) { + n[1].e = target; + n[2].ui = address; + n[3].e = matrix; + n[4].e = transform; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->TrackMatrixNV)(target, address, matrix, transform); + } +} +#endif /* FEATURE_NV_vertex_program */ + + +/* GL_EXT_stencil_two_side */ +static void save_ActiveStencilFaceEXT( GLenum face ) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1 ); + if (n) { + n[1].e = face; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ActiveStencilFaceEXT)( face ); + } +} + + + /* KW: Compile commands * * Will appear in the list before the vertex buffer containing the @@ -3947,6 +4151,21 @@ _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ) } +/* + * Compile an error into current display list. + */ +void +_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ) +{ + if (ctx->CompileFlag) + _mesa_save_error( ctx, error, s ); + + if (ctx->ExecuteFlag) + _mesa_error( ctx, error, s ); +} + + + static GLboolean islist(GLcontext *ctx, GLuint list) { @@ -3983,9 +4202,6 @@ execute_list( GLcontext *ctx, GLuint list ) if (ctx->Driver.BeginCallList) ctx->Driver.BeginCallList( ctx, list ); -/* fprintf(stderr, "execute list %d\n", list); */ -/* mesa_print_display_list( list ); */ - ctx->CallDepth++; n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); @@ -4042,7 +4258,11 @@ execute_list( GLcontext *ctx, GLuint list ) break; case OPCODE_CALL_LIST_OFFSET: /* Generated by glCallLists() so we must add ListBase */ - if (ctx->CallDepth<MAX_LIST_NESTING) { + if (n[2].b) { + /* user specified a bad datatype at compile time */ + _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); + } + else if (ctx->CallDepth < MAX_LIST_NESTING) { execute_list( ctx, ctx->List.ListBase + n[1].ui ); } break; @@ -4610,6 +4830,40 @@ execute_list( GLcontext *ctx, GLuint list ) case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */ (*ctx->Exec->SampleCoverageARB)(n[1].f, n[2].b); break; + case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */ + (*ctx->Exec->WindowPos3fMESA)( n[1].f, n[2].f, n[3].f ); + break; + case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */ + (*ctx->Exec->BindProgramNV)( n[1].e, n[2].ui ); + break; + case OPCODE_EXECUTE_PROGRAM_NV: + { + GLfloat v[4]; + v[0] = n[3].f; + v[1] = n[4].f; + v[2] = n[5].f; + v[3] = n[6].f; + (*ctx->Exec->ExecuteProgramNV)(n[1].e, n[2].ui, v); + } + break; + case OPCODE_REQUEST_PROGRAMS_RESIDENT_NV: + /* + (*ctx->Exec->RequestResidentProgramsNV)(); + */ + break; + case OPCODE_LOAD_PROGRAM_NV: + /* + (*ctx->Exec->LoadProgramNV)(); + */ + break; + case OPCODE_PROGRAM_PARAMETER4F_NV: + (*ctx->Exec->ProgramParameter4fNV)(n[1].e, n[2].ui, n[3].f, + n[4].f, n[5].f, n[6].f); + break; + case OPCODE_TRACK_MATRIX_NV: + (*ctx->Exec->TrackMatrixNV)(n[1].e, n[2].ui, n[3].e, n[4].e); + break; + case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -4619,8 +4873,8 @@ execute_list( GLcontext *ctx, GLuint list ) default: { char msg[1000]; - sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); - _mesa_problem( ctx, msg ); + _mesa_sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); + _mesa_problem(ctx, msg); } done = GL_TRUE; } @@ -4735,7 +4989,8 @@ _mesa_NewList( GLuint list, GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glNewList %u %s\n", list, _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glNewList %u %s\n", list, + _mesa_lookup_enum_by_nr(mode)); if (list==0) { _mesa_error( ctx, GL_INVALID_VALUE, "glNewList" ); @@ -4782,7 +5037,7 @@ _mesa_EndList( void ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glEndList\n"); + _mesa_debug(ctx, "glEndList\n"); /* Check that a list is under construction */ if (!ctx->CurrentListPtr) { @@ -4825,7 +5080,7 @@ _mesa_CallList( GLuint list ) if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_mesa_CallList %d\n", list); + _mesa_debug(ctx, "_mesa_CallList %d\n", list); /* mesa_print_display_list( list ); */ @@ -4858,7 +5113,25 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) GLboolean save_compile_flag; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_mesa_CallLists %d\n", n); + _mesa_debug(ctx, "_mesa_CallLists %d\n", n); + + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_2_BYTES: + case GL_3_BYTES: + case GL_4_BYTES: + /* OK */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)"); + return; + } /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. @@ -5526,6 +5799,26 @@ static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride, ctx->Exec->FogCoordPointerEXT( type, stride, ptr); } +/* GL_EXT_multi_draw_arrays */ +static void exec_MultiDrawArraysEXT(GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->MultiDrawArraysEXT( mode, first, count, primcount ); +} + +/* GL_EXT_multi_draw_arrays */ +static void exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, + GLenum type, const GLvoid **indices, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->MultiDrawElementsEXT(mode, count, type, indices, primcount); +} + + /* * Assign all the pointers in <table> to point to Mesa's display list @@ -5721,6 +6014,7 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) /* GL 1.1 */ table->AreTexturesResident = exec_AreTexturesResident; + table->AreTexturesResidentEXT = exec_AreTexturesResident; table->BindTexture = save_BindTexture; table->ColorPointer = exec_ColorPointer; table->CopyTexImage1D = save_CopyTexImage1D; @@ -5732,10 +6026,12 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->EdgeFlagPointer = exec_EdgeFlagPointer; table->EnableClientState = exec_EnableClientState; table->GenTextures = exec_GenTextures; + table->GenTexturesEXT = exec_GenTextures; table->GetPointerv = exec_GetPointerv; table->IndexPointer = exec_IndexPointer; table->InterleavedArrays = exec_InterleavedArrays; table->IsTexture = exec_IsTexture; + table->IsTextureEXT = exec_IsTexture; table->NormalPointer = exec_NormalPointer; table->PopClientAttrib = exec_PopClientAttrib; table->PrioritizeTextures = save_PrioritizeTextures; @@ -5769,18 +6065,31 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->CopyConvolutionFilter1D = exec_CopyConvolutionFilter1D; table->CopyConvolutionFilter2D = exec_CopyConvolutionFilter2D; table->GetColorTable = exec_GetColorTable; + table->GetColorTableEXT = exec_GetColorTable; table->GetColorTableParameterfv = exec_GetColorTableParameterfv; + table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv; table->GetColorTableParameteriv = exec_GetColorTableParameteriv; + table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv; table->GetConvolutionFilter = exec_GetConvolutionFilter; + table->GetConvolutionFilterEXT = exec_GetConvolutionFilter; table->GetConvolutionParameterfv = exec_GetConvolutionParameterfv; + table->GetConvolutionParameterfvEXT = exec_GetConvolutionParameterfv; table->GetConvolutionParameteriv = exec_GetConvolutionParameteriv; + table->GetConvolutionParameterivEXT = exec_GetConvolutionParameteriv; table->GetHistogram = exec_GetHistogram; + table->GetHistogramEXT = exec_GetHistogram; table->GetHistogramParameterfv = exec_GetHistogramParameterfv; + table->GetHistogramParameterfvEXT = exec_GetHistogramParameterfv; table->GetHistogramParameteriv = exec_GetHistogramParameteriv; + table->GetHistogramParameterivEXT = exec_GetHistogramParameteriv; table->GetMinmax = exec_GetMinmax; + table->GetMinmaxEXT = exec_GetMinmax; table->GetMinmaxParameterfv = exec_GetMinmaxParameterfv; + table->GetMinmaxParameterfvEXT = exec_GetMinmaxParameterfv; table->GetMinmaxParameteriv = exec_GetMinmaxParameteriv; + table->GetMinmaxParameterivEXT = exec_GetMinmaxParameteriv; table->GetSeparableFilter = exec_GetSeparableFilter; + table->GetSeparableFilterEXT = exec_GetSeparableFilter; table->Histogram = save_Histogram; table->Minmax = save_Minmax; table->ResetHistogram = save_ResetHistogram; @@ -5843,14 +6152,23 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->LockArraysEXT = exec_LockArraysEXT; table->UnlockArraysEXT = exec_UnlockArraysEXT; - /* GL_ARB_multitexture */ - table->ActiveTextureARB = save_ActiveTextureARB; - table->ClientActiveTextureARB = exec_ClientActiveTextureARB; + /* 145. GL_EXT_secondary_color */ + table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT; + + /* 148. GL_EXT_multi_draw_arrays */ + table->MultiDrawArraysEXT = exec_MultiDrawArraysEXT; + table->MultiDrawElementsEXT = exec_MultiDrawElementsEXT; - /* GL_EXT_blend_func_separate */ + /* 149. GL_EXT_fog_coord */ + table->FogCoordPointerEXT = exec_FogCoordPointerEXT; + + /* 173. GL_EXT_blend_func_separate */ table->BlendFuncSeparateEXT = save_BlendFuncSeparateEXT; - /* GL_MESA_window_pos */ + /* 196. GL_MESA_resize_buffers */ + table->ResizeBuffersMESA = exec_ResizeBuffersMESA; + + /* 197. GL_MESA_window_pos */ table->WindowPos2dMESA = save_WindowPos2dMESA; table->WindowPos2dvMESA = save_WindowPos2dvMESA; table->WindowPos2fMESA = save_WindowPos2fMESA; @@ -5876,16 +6194,57 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->WindowPos4sMESA = save_WindowPos4sMESA; table->WindowPos4svMESA = save_WindowPos4svMESA; - /* GL_MESA_resize_buffers */ - table->ResizeBuffersMESA = exec_ResizeBuffersMESA; +#if FEATURE_NV_vertex_program + /* 233. GL_NV_vertex_program */ + /* The following commands DO NOT go into display lists: + * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV, + * VertexAttribPointerNV, GetProgram*, GetVertexAttrib* + */ + table->BindProgramNV = save_BindProgramNV; + table->DeleteProgramsNV = _mesa_DeleteProgramsNV; + table->ExecuteProgramNV = save_ExecuteProgramNV; + table->GenProgramsNV = _mesa_GenProgramsNV; + table->AreProgramsResidentNV = _mesa_AreProgramsResidentNV; + table->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV; + table->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV; + table->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV; + table->GetProgramivNV = _mesa_GetProgramivNV; + table->GetProgramStringNV = _mesa_GetProgramStringNV; + table->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV; + table->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV; + table->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV; + table->GetVertexAttribivNV = _mesa_GetVertexAttribivNV; + table->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV; + table->IsProgramNV = _mesa_IsProgramNV; + table->LoadProgramNV = _mesa_LoadProgramNV; + table->ProgramParameter4dNV = save_ProgramParameter4dNV; + table->ProgramParameter4dvNV = save_ProgramParameter4dvNV; + table->ProgramParameter4fNV = save_ProgramParameter4fNV; + table->ProgramParameter4fvNV = save_ProgramParameter4fvNV; + table->ProgramParameters4dvNV = save_ProgramParameters4dvNV; + table->ProgramParameters4fvNV = save_ProgramParameters4fvNV; + table->TrackMatrixNV = save_TrackMatrixNV; + table->VertexAttribPointerNV = _mesa_VertexAttribPointerNV; +#endif + + /* 262. GL_NV_point_sprite */ + table->PointParameteriNV = save_PointParameteriNV; + table->PointParameterivNV = save_PointParameterivNV; + + /* 268. GL_EXT_stencil_two_side */ + table->ActiveStencilFaceEXT = save_ActiveStencilFaceEXT; - /* GL_ARB_transpose_matrix */ + /* ARB 1. GL_ARB_multitexture */ + table->ActiveTextureARB = save_ActiveTextureARB; + table->ClientActiveTextureARB = exec_ClientActiveTextureARB; + + /* ARB 3. GL_ARB_transpose_matrix */ table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB; table->LoadTransposeMatrixfARB = save_LoadTransposeMatrixfARB; table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB; table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB; - /* GL_ARB_multisample */ + /* ARB 5. GL_ARB_multisample */ table->SampleCoverageARB = save_SampleCoverageARB; /* ARB 12. GL_ARB_texture_compression */ @@ -5897,11 +6256,11 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB; table->GetCompressedTexImageARB = exec_GetCompressedTexImageARB; - /* GL_EXT_secondary_color */ - table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT; + /* ARB 14. GL_ARB_point_parameters */ + /* re-use EXT_point_parameters functions */ - /* GL_EXT_fog_coord */ - table->FogCoordPointerEXT = exec_FogCoordPointerEXT; + /* ARB 25. GL_ARB_window_pos */ + /* re-use MESA_window_pos functions */ } @@ -5919,19 +6278,19 @@ static const char *enum_string( GLenum k ) * Print the commands in a display list. For debugging only. * TODO: many commands aren't handled yet. */ -static void print_list( GLcontext *ctx, FILE *f, GLuint list ) +static void print_list( GLcontext *ctx, GLuint list ) { Node *n; GLboolean done; if (!glIsList(list)) { - fprintf(f,"%u is not a display list ID\n",list); + _mesa_printf("%u is not a display list ID\n", list); return; } n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list); - fprintf( f, "START-LIST %u, address %p\n", list, (void*)n ); + _mesa_printf("START-LIST %u, address %p\n", list, (void*)n ); done = n ? GL_FALSE : GL_TRUE; while (!done) { @@ -5945,149 +6304,162 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) else { switch (opcode) { case OPCODE_ACCUM: - fprintf(f,"accum %s %g\n", enum_string(n[1].e), n[2].f ); + _mesa_printf("accum %s %g\n", enum_string(n[1].e), n[2].f ); break; case OPCODE_BITMAP: - fprintf(f,"Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, + _mesa_printf("Bitmap %d %d %g %g %g %g %p\n", n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f, (void *) n[7].data ); break; case OPCODE_CALL_LIST: - fprintf(f,"CallList %d\n", (int) n[1].ui ); + _mesa_printf("CallList %d\n", (int) n[1].ui ); break; case OPCODE_CALL_LIST_OFFSET: - fprintf(f,"CallList %d + offset %u = %u\n", (int) n[1].ui, + _mesa_printf("CallList %d + offset %u = %u\n", (int) n[1].ui, ctx->List.ListBase, ctx->List.ListBase + n[1].ui ); break; case OPCODE_COLOR_TABLE_PARAMETER_FV: - fprintf(f,"ColorTableParameterfv %s %s %f %f %f %f\n", + _mesa_printf("ColorTableParameterfv %s %s %f %f %f %f\n", enum_string(n[1].e), enum_string(n[2].e), n[3].f, n[4].f, n[5].f, n[6].f); break; case OPCODE_COLOR_TABLE_PARAMETER_IV: - fprintf(f,"ColorTableParameteriv %s %s %d %d %d %d\n", + _mesa_printf("ColorTableParameteriv %s %s %d %d %d %d\n", enum_string(n[1].e), enum_string(n[2].e), n[3].i, n[4].i, n[5].i, n[6].i); break; case OPCODE_DISABLE: - fprintf(f,"Disable %s\n", enum_string(n[1].e)); + _mesa_printf("Disable %s\n", enum_string(n[1].e)); break; case OPCODE_ENABLE: - fprintf(f,"Enable %s\n", enum_string(n[1].e)); + _mesa_printf("Enable %s\n", enum_string(n[1].e)); break; case OPCODE_FRUSTUM: - fprintf(f,"Frustum %g %g %g %g %g %g\n", + _mesa_printf("Frustum %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); break; case OPCODE_LINE_STIPPLE: - fprintf(f,"LineStipple %d %x\n", n[1].i, (int) n[2].us ); + _mesa_printf("LineStipple %d %x\n", n[1].i, (int) n[2].us ); break; case OPCODE_LOAD_IDENTITY: - fprintf(f,"LoadIdentity\n"); + _mesa_printf("LoadIdentity\n"); break; case OPCODE_LOAD_MATRIX: - fprintf(f,"LoadMatrix\n"); - fprintf(f," %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - fprintf(f," %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - fprintf(f," %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - fprintf(f," %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); + _mesa_printf("LoadMatrix\n"); + _mesa_printf(" %8f %8f %8f %8f\n", + n[1].f, n[5].f, n[9].f, n[13].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[2].f, n[6].f, n[10].f, n[14].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[3].f, n[7].f, n[11].f, n[15].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_MULT_MATRIX: - fprintf(f,"MultMatrix (or Rotate)\n"); - fprintf(f," %8f %8f %8f %8f\n", n[1].f, n[5].f, n[9].f, n[13].f); - fprintf(f," %8f %8f %8f %8f\n", n[2].f, n[6].f, n[10].f, n[14].f); - fprintf(f," %8f %8f %8f %8f\n", n[3].f, n[7].f, n[11].f, n[15].f); - fprintf(f," %8f %8f %8f %8f\n", n[4].f, n[8].f, n[12].f, n[16].f); + _mesa_printf("MultMatrix (or Rotate)\n"); + _mesa_printf(" %8f %8f %8f %8f\n", + n[1].f, n[5].f, n[9].f, n[13].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[2].f, n[6].f, n[10].f, n[14].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[3].f, n[7].f, n[11].f, n[15].f); + _mesa_printf(" %8f %8f %8f %8f\n", + n[4].f, n[8].f, n[12].f, n[16].f); break; case OPCODE_ORTHO: - fprintf(f,"Ortho %g %g %g %g %g %g\n", + _mesa_printf("Ortho %g %g %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ); break; case OPCODE_POP_ATTRIB: - fprintf(f,"PopAttrib\n"); + _mesa_printf("PopAttrib\n"); break; case OPCODE_POP_MATRIX: - fprintf(f,"PopMatrix\n"); + _mesa_printf("PopMatrix\n"); break; case OPCODE_POP_NAME: - fprintf(f,"PopName\n"); + _mesa_printf("PopName\n"); break; case OPCODE_PUSH_ATTRIB: - fprintf(f,"PushAttrib %x\n", n[1].bf ); + _mesa_printf("PushAttrib %x\n", n[1].bf ); break; case OPCODE_PUSH_MATRIX: - fprintf(f,"PushMatrix\n"); + _mesa_printf("PushMatrix\n"); break; case OPCODE_PUSH_NAME: - fprintf(f,"PushName %d\n", (int) n[1].ui ); + _mesa_printf("PushName %d\n", (int) n[1].ui ); break; case OPCODE_RASTER_POS: - fprintf(f,"RasterPos %g %g %g %g\n", n[1].f, n[2].f,n[3].f,n[4].f); + _mesa_printf("RasterPos %g %g %g %g\n", + n[1].f, n[2].f,n[3].f,n[4].f); break; case OPCODE_ROTATE: - fprintf(f,"Rotate %g %g %g %g\n", n[1].f, n[2].f, n[3].f, n[4].f ); + _mesa_printf("Rotate %g %g %g %g\n", + n[1].f, n[2].f, n[3].f, n[4].f ); break; case OPCODE_SCALE: - fprintf(f,"Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); + _mesa_printf("Scale %g %g %g\n", n[1].f, n[2].f, n[3].f ); break; case OPCODE_TRANSLATE: - fprintf(f,"Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); + _mesa_printf("Translate %g %g %g\n", n[1].f, n[2].f, n[3].f ); break; case OPCODE_BIND_TEXTURE: - fprintf(f,"BindTexture %s %d\n", _mesa_lookup_enum_by_nr(n[1].ui), - n[2].ui); + _mesa_printf("BindTexture %s %d\n", + _mesa_lookup_enum_by_nr(n[1].ui), n[2].ui); break; case OPCODE_SHADE_MODEL: - fprintf(f,"ShadeModel %s\n", _mesa_lookup_enum_by_nr(n[1].ui)); + _mesa_printf("ShadeModel %s\n", + _mesa_lookup_enum_by_nr(n[1].ui)); break; case OPCODE_MAP1: - fprintf(f,"Map1 %s %.3f %.3f %d %d\n", + _mesa_printf("Map1 %s %.3f %.3f %d %d\n", _mesa_lookup_enum_by_nr(n[1].ui), n[2].f, n[3].f, n[4].i, n[5].i); break; case OPCODE_MAP2: - fprintf(f,"Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", - _mesa_lookup_enum_by_nr(n[1].ui), - n[2].f, n[3].f, n[4].f, n[5].f, - n[6].i, n[7].i, n[8].i, n[9].i); + _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", + _mesa_lookup_enum_by_nr(n[1].ui), + n[2].f, n[3].f, n[4].f, n[5].f, + n[6].i, n[7].i, n[8].i, n[9].i); break; case OPCODE_MAPGRID1: - fprintf(f,"MapGrid1 %d %.3f %.3f\n", n[1].i, n[2].f, n[3].f); + _mesa_printf("MapGrid1 %d %.3f %.3f\n", + n[1].i, n[2].f, n[3].f); break; case OPCODE_MAPGRID2: - fprintf(f,"MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", - n[1].i, n[2].f, n[3].f, - n[4].i, n[5].f, n[6].f); + _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", + n[1].i, n[2].f, n[3].f, + n[4].i, n[5].f, n[6].f); break; case OPCODE_EVALMESH1: - fprintf(f,"EvalMesh1 %d %d\n", n[1].i, n[2].i); + _mesa_printf("EvalMesh1 %d %d\n", n[1].i, n[2].i); break; case OPCODE_EVALMESH2: - fprintf(f,"EvalMesh2 %d %d %d %d\n", - n[1].i, n[2].i, n[3].i, n[4].i); + _mesa_printf("EvalMesh2 %d %d %d %d\n", + n[1].i, n[2].i, n[3].i, n[4].i); break; /* * meta opcodes/commands */ case OPCODE_ERROR: - fprintf(f,"Error: %s %s\n", enum_string(n[1].e), (const char *)n[2].data ); + _mesa_printf("Error: %s %s\n", + enum_string(n[1].e), (const char *)n[2].data ); break; case OPCODE_CONTINUE: - fprintf(f,"DISPLAY-LIST-CONTINUE\n"); + _mesa_printf("DISPLAY-LIST-CONTINUE\n"); n = (Node *) n[1].next; break; case OPCODE_END_OF_LIST: - fprintf(f,"END-LIST %u\n", list); + _mesa_printf("END-LIST %u\n", list); done = GL_TRUE; break; default: if (opcode < 0 || opcode > OPCODE_END_OF_LIST) { - fprintf(f,"ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", - opcode, (void*) n); + _mesa_printf("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n", + opcode, (void*) n); return; } else { - fprintf(f,"command %d, %u operands\n",opcode,InstSize[opcode]); + _mesa_printf("command %d, %u operands\n", opcode, InstSize[opcode]); } } /* increment n to point to next compiled command */ @@ -6108,5 +6480,5 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) void mesa_print_display_list( GLuint list ) { GET_CURRENT_CONTEXT(ctx); - print_list( ctx, stderr, list ); + print_list( ctx, list ); } diff --git a/xc/extras/Mesa/src/dlist.h b/xc/extras/Mesa/src/dlist.h index 58bbd7e42..9880aa079 100644 --- a/xc/extras/Mesa/src/dlist.h +++ b/xc/extras/Mesa/src/dlist.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -82,19 +82,20 @@ extern void _mesa_ListBase( GLuint base ); extern void _mesa_NewList( GLuint list, GLenum mode ); -extern void _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ); +extern void _mesa_init_dlist_table( struct _glapi_table *table, + GLuint tableSize ); extern void _mesa_save_error( GLcontext *ctx, GLenum error, const char *s ); +extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); -void * -_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); -int -_mesa_alloc_opcode( GLcontext *ctx, GLuint sz, - void (*execute)( GLcontext *, void * ), - void (*destroy)( GLcontext *, void * ), - void (*print)( GLcontext *, void * ) ); +extern void *_mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz ); + +extern int _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, + void (*execute)( GLcontext *, void * ), + void (*destroy)( GLcontext *, void * ), + void (*print)( GLcontext *, void * ) ); extern void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); diff --git a/xc/extras/Mesa/src/drawpix.c b/xc/extras/Mesa/src/drawpix.c index 45b0dfabd..3601a3ed8 100644 --- a/xc/extras/Mesa/src/drawpix.c +++ b/xc/extras/Mesa/src/drawpix.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.1 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,22 +23,16 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "drawpix.h" #include "feedback.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "state.h" #include "mtypes.h" -#endif - /* @@ -75,14 +69,15 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, &ctx->Unpack, pixels); } else if (ctx->RenderMode==GL_FEEDBACK) { + /* Feedback the current raster pos info */ if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT(ctx, 0); + FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoord ); + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); } } else if (ctx->RenderMode==GL_SELECT) { @@ -102,7 +97,8 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(width or height < 0)" ); + _mesa_error( ctx, GL_INVALID_VALUE, + "glReadPixels(width=%d height=%d)", width, height ); return; } @@ -116,7 +112,6 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, ctx->Driver.ReadPixels(ctx, x, y, width, height, format, type, &ctx->Pack, pixels); - } @@ -155,13 +150,13 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, } else if (ctx->RenderMode == GL_FEEDBACK) { if (ctx->Current.RasterPosValid) { - FLUSH_CURRENT(ctx, 0); + FLUSH_CURRENT( ctx, 0 ); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); - _mesa_feedback_vertex( ctx, - ctx->Current.RasterPos, - ctx->Current.RasterColor, - ctx->Current.RasterIndex, - ctx->Current.RasterTexCoord ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); } } else if (ctx->RenderMode == GL_SELECT) { @@ -210,7 +205,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, ctx->Current.RasterPos, ctx->Current.RasterColor, ctx->Current.RasterIndex, - ctx->Current.RasterTexCoord ); + ctx->Current.RasterTexCoords[0] ); } } else if (ctx->RenderMode==GL_SELECT) { @@ -221,3 +216,68 @@ _mesa_Bitmap( GLsizei width, GLsizei height, ctx->Current.RasterPos[0] += xmove; ctx->Current.RasterPos[1] += ymove; } + + + +#if 0 /* experimental */ +/* + * Execute glDrawDepthPixelsMESA(). This function accepts both a color + * image and depth (Z) image. Rasterization produces fragments with + * color and Z taken from these images. This function is intended for + * Z-compositing. Normally, this operation requires two glDrawPixels + * calls with stencil testing. + */ +void +_mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, + GLenum colorFormat, GLenum colorType, + const GLvoid *colors, + GLenum depthType, const GLvoid *depths ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glDrawDepthPixelsMESA(width or height < 0" ); + return; + } + + if (ctx->RenderMode==GL_RENDER) { + GLint x, y; + if (!colors || !depths || !ctx->Current.RasterPosValid) { + return; + } + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ + x = IROUND(ctx->Current.RasterPos[0]); + y = IROUND(ctx->Current.RasterPos[1]); + + ctx->OcclusionResult = GL_TRUE; + ctx->Driver.DrawDepthPixelsMESA(ctx, x, y, width, height, + colorFormat, colorType, colors, + depthType, depths, &ctx->Unpack); + } + else if (ctx->RenderMode==GL_FEEDBACK) { + /* Feedback the current raster pos info */ + if (ctx->Current.RasterPosValid) { + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.RasterColor, + ctx->Current.RasterIndex, + ctx->Current.RasterTexCoords[0] ); + } + } + else if (ctx->RenderMode==GL_SELECT) { + if (ctx->Current.RasterPosValid) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } + } +} + +#endif diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index 7be8dbf44..2f8f4dab1 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "enable.h" @@ -36,55 +33,90 @@ #include "simple_list.h" #include "mtypes.h" #include "enums.h" - #include "math/m_matrix.h" #include "math/m_xform.h" -#endif + + +#define CHECK_EXTENSION(EXTNAME, CAP) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ + return; \ + } + static void client_state( GLcontext *ctx, GLenum cap, GLboolean state ) { GLuint flag; - GLboolean *var; + GLuint *var; switch (cap) { - case GL_VERTEX_ARRAY: - var = &ctx->Array.Vertex.Enabled; - flag = _NEW_ARRAY_VERTEX; - break; - case GL_NORMAL_ARRAY: - var = &ctx->Array.Normal.Enabled; - flag = _NEW_ARRAY_NORMAL; - break; - case GL_COLOR_ARRAY: - var = &ctx->Array.Color.Enabled; - flag = _NEW_ARRAY_COLOR; - break; - case GL_INDEX_ARRAY: - var = &ctx->Array.Index.Enabled; - flag = _NEW_ARRAY_INDEX; - break; - case GL_TEXTURE_COORD_ARRAY: - var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; - flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); - break; - case GL_EDGE_FLAG_ARRAY: - var = &ctx->Array.EdgeFlag.Enabled; - flag = _NEW_ARRAY_EDGEFLAG; - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - var = &ctx->Array.FogCoord.Enabled; - flag = _NEW_ARRAY_FOGCOORD; - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - var = &ctx->Array.SecondaryColor.Enabled; - flag = _NEW_ARRAY_SECONDARYCOLOR; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); - return; + case GL_VERTEX_ARRAY: + var = &ctx->Array.Vertex.Enabled; + flag = _NEW_ARRAY_VERTEX; + break; + case GL_NORMAL_ARRAY: + var = &ctx->Array.Normal.Enabled; + flag = _NEW_ARRAY_NORMAL; + break; + case GL_COLOR_ARRAY: + var = &ctx->Array.Color.Enabled; + flag = _NEW_ARRAY_COLOR0; + break; + case GL_INDEX_ARRAY: + var = &ctx->Array.Index.Enabled; + flag = _NEW_ARRAY_INDEX; + break; + case GL_TEXTURE_COORD_ARRAY: + var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; + flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); + break; + case GL_EDGE_FLAG_ARRAY: + var = &ctx->Array.EdgeFlag.Enabled; + flag = _NEW_ARRAY_EDGEFLAG; + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + var = &ctx->Array.FogCoord.Enabled; + flag = _NEW_ARRAY_FOGCOORD; + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + var = &ctx->Array.SecondaryColor.Enabled; + flag = _NEW_ARRAY_COLOR1; + break; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION(NV_vertex_program, cap); + { + GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; + var = &ctx->Array.VertexAttrib[n].Enabled; + flag = _NEW_ARRAY_ATTRIB(n); + } + break; +#endif /* FEATURE_NV_vertex_program */ + + default: + _mesa_error( ctx, GL_INVALID_ENUM, + "glEnable/DisableClientState(0x%x)", cap); + return; } if (*var == state) @@ -125,709 +157,731 @@ _mesa_DisableClientState( GLenum cap ) } +#undef CHECK_EXTENSION +#define CHECK_EXTENSION(EXTNAME, CAP) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ + return; \ + } + + /* * Perform glEnable and glDisable calls. */ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) { if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "%s %s (newstate is %x)\n", - state ? "glEnable" : "glDisable", - _mesa_lookup_enum_by_nr(cap), - ctx->NewState); + _mesa_debug(ctx, "%s %s (newstate is %x)\n", + state ? "glEnable" : "glDisable", + _mesa_lookup_enum_by_nr(cap), + ctx->NewState); switch (cap) { - case GL_ALPHA_TEST: - if (ctx->Color.AlphaEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.AlphaEnabled = state; - break; - case GL_AUTO_NORMAL: - if (ctx->Eval.AutoNormal == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.AutoNormal = state; - break; - case GL_BLEND: - if (ctx->Color.BlendEnabled == state) - return; - - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.BlendEnabled = state; - /* The following needed to accomodate 1.0 RGB logic op blending */ - ctx->Color.ColorLogicOpEnabled = - (ctx->Color.BlendEquation == GL_LOGIC_OP && state); - break; - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: { - GLuint p = cap-GL_CLIP_PLANE0; - - if (ctx->Transform.ClipEnabled[p] == state) - return; - - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.ClipEnabled[p] = state; - - if (state) { - ctx->Transform._AnyClip++; - - if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { - _math_matrix_analyse( &ctx->ProjectionMatrix ); - } - - /* This derived state also calculated in clip.c and - * from _mesa_update_state() on changes to EyeUserPlane - * and ctx->ProjectionMatrix respectively. - */ - _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], - ctx->Transform.EyeUserPlane[p], - ctx->ProjectionMatrix.inv ); + case GL_ALPHA_TEST: + if (ctx->Color.AlphaEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.AlphaEnabled = state; + break; + case GL_AUTO_NORMAL: + if (ctx->Eval.AutoNormal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.AutoNormal = state; + break; + case GL_BLEND: + if (ctx->Color.BlendEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEnabled = state; + /* The following needed to accomodate 1.0 RGB logic op blending */ + ctx->Color.ColorLogicOpEnabled = + (ctx->Color.BlendEquation == GL_LOGIC_OP && state); + break; + case GL_CLIP_PLANE0: + case GL_CLIP_PLANE1: + case GL_CLIP_PLANE2: + case GL_CLIP_PLANE3: + case GL_CLIP_PLANE4: + case GL_CLIP_PLANE5: + { + const GLuint p = cap - GL_CLIP_PLANE0; + + if ((ctx->Transform.ClipPlanesEnabled & (1 << p)) == ((GLuint) state << p)) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + + if (state) { + ctx->Transform.ClipPlanesEnabled |= (1 << p); + + if (ctx->ProjectionMatrixStack.Top->flags & MAT_DIRTY) + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); + + /* This derived state also calculated in clip.c and + * from _mesa_update_state() on changes to EyeUserPlane + * and ctx->ProjectionMatrix respectively. + */ + _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], + ctx->Transform.EyeUserPlane[p], + ctx->ProjectionMatrixStack.Top->inv ); + } + else { + ctx->Transform.ClipPlanesEnabled &= ~(1 << p); + } + } + break; + case GL_COLOR_MATERIAL: + if (ctx->Light.ColorMaterialEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ColorMaterialEnabled = state; + if (state) { + FLUSH_CURRENT(ctx, 0); + _mesa_update_color_material( ctx, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); + } + break; + case GL_CULL_FACE: + if (ctx->Polygon.CullFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.CullFlag = state; + break; + case GL_DEPTH_TEST: + if (state && ctx->Visual.depthBits==0) { + _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); + return; + } + if (ctx->Depth.Test==state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Test = state; + break; + case GL_DITHER: + if (ctx->NoDither) { + state = GL_FALSE; /* MESA_NO_DITHER env var */ + } + if (ctx->Color.DitherFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.DitherFlag = state; + break; + case GL_FOG: + if (ctx->Fog.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Enabled = state; + break; + case GL_HISTOGRAM: + CHECK_EXTENSION(EXT_histogram, cap); + if (ctx->Pixel.HistogramEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.HistogramEnabled = state; + break; + case GL_LIGHT0: + case GL_LIGHT1: + case GL_LIGHT2: + case GL_LIGHT3: + case GL_LIGHT4: + case GL_LIGHT5: + case GL_LIGHT6: + case GL_LIGHT7: + if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; + if (state) { + insert_at_tail(&ctx->Light.EnabledList, + &ctx->Light.Light[cap-GL_LIGHT0]); + } + else { + remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); + } + break; + case GL_LIGHTING: + if (ctx->Light.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Enabled = state; + + if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) + ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; + else + ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; + + if ((ctx->Light.Enabled && + ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) + || ctx->Fog.ColorSumEnabled) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + else + ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; + + break; + case GL_LINE_SMOOTH: + if (ctx->Line.SmoothFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_LINE_SMOOTH; + break; + case GL_LINE_STIPPLE: + if (ctx->Line.StippleFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.StippleFlag = state; + ctx->_TriangleCaps ^= DD_LINE_STIPPLE; + break; + case GL_INDEX_LOGIC_OP: + if (ctx->Color.IndexLogicOpEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.IndexLogicOpEnabled = state; + break; + case GL_COLOR_LOGIC_OP: + if (ctx->Color.ColorLogicOpEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ColorLogicOpEnabled = state; + break; + case GL_MAP1_COLOR_4: + if (ctx->Eval.Map1Color4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Color4 = state; + break; + case GL_MAP1_INDEX: + if (ctx->Eval.Map1Index == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Index = state; + break; + case GL_MAP1_NORMAL: + if (ctx->Eval.Map1Normal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Normal = state; + break; + case GL_MAP1_TEXTURE_COORD_1: + if (ctx->Eval.Map1TextureCoord1 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord1 = state; + break; + case GL_MAP1_TEXTURE_COORD_2: + if (ctx->Eval.Map1TextureCoord2 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord2 = state; + break; + case GL_MAP1_TEXTURE_COORD_3: + if (ctx->Eval.Map1TextureCoord3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord3 = state; + break; + case GL_MAP1_TEXTURE_COORD_4: + if (ctx->Eval.Map1TextureCoord4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord4 = state; + break; + case GL_MAP1_VERTEX_3: + if (ctx->Eval.Map1Vertex3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Vertex3 = state; + break; + case GL_MAP1_VERTEX_4: + if (ctx->Eval.Map1Vertex4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Vertex4 = state; + break; + case GL_MAP2_COLOR_4: + if (ctx->Eval.Map2Color4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Color4 = state; + break; + case GL_MAP2_INDEX: + if (ctx->Eval.Map2Index == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Index = state; + break; + case GL_MAP2_NORMAL: + if (ctx->Eval.Map2Normal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Normal = state; + break; + case GL_MAP2_TEXTURE_COORD_1: + if (ctx->Eval.Map2TextureCoord1 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord1 = state; + break; + case GL_MAP2_TEXTURE_COORD_2: + if (ctx->Eval.Map2TextureCoord2 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord2 = state; + break; + case GL_MAP2_TEXTURE_COORD_3: + if (ctx->Eval.Map2TextureCoord3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord3 = state; + break; + case GL_MAP2_TEXTURE_COORD_4: + if (ctx->Eval.Map2TextureCoord4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord4 = state; + break; + case GL_MAP2_VERTEX_3: + if (ctx->Eval.Map2Vertex3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Vertex3 = state; + break; + case GL_MAP2_VERTEX_4: + if (ctx->Eval.Map2Vertex4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Vertex4 = state; + break; + case GL_MINMAX: + if (ctx->Pixel.MinMaxEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.MinMaxEnabled = state; + break; + case GL_NORMALIZE: + if (ctx->Transform.Normalize == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.Normalize = state; + break; + case GL_POINT_SMOOTH: + if (ctx->Point.SmoothFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_POINT_SMOOTH; + break; + case GL_POLYGON_SMOOTH: + if (ctx->Polygon.SmoothFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_TRI_SMOOTH; + break; + case GL_POLYGON_STIPPLE: + if (ctx->Polygon.StippleFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.StippleFlag = state; + ctx->_TriangleCaps ^= DD_TRI_STIPPLE; + break; + case GL_POLYGON_OFFSET_POINT: + if (ctx->Polygon.OffsetPoint==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetPoint = state; + break; + case GL_POLYGON_OFFSET_LINE: + if (ctx->Polygon.OffsetLine==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetLine = state; + break; + case GL_POLYGON_OFFSET_FILL: + /*case GL_POLYGON_OFFSET_EXT:*/ + if (ctx->Polygon.OffsetFill==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetFill = state; + break; + case GL_RESCALE_NORMAL_EXT: + if (ctx->Transform.RescaleNormals == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.RescaleNormals = state; + break; + case GL_SCISSOR_TEST: + if (ctx->Scissor.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.Enabled = state; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + if (ctx->Texture.SharedPalette == state) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + ctx->Texture.SharedPalette = state; + break; + case GL_STENCIL_TEST: + if (state && ctx->Visual.stencilBits==0) { + _mesa_warning(ctx, + "glEnable(GL_STENCIL_TEST) but no stencil buffer"); + return; + } + if (ctx->Stencil.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Enabled = state; + break; + case GL_TEXTURE_1D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; + if (state) + newenabled |= TEXTURE_1D_BIT; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; } - else { - ctx->Transform._AnyClip--; + case GL_TEXTURE_2D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; + if (state) + newenabled |= TEXTURE_2D_BIT; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; } - } - break; - case GL_COLOR_MATERIAL: - if (ctx->Light.ColorMaterialEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.ColorMaterialEnabled = state; - if (state) { - FLUSH_CURRENT(ctx, 0); - _mesa_update_color_material( ctx, ctx->Current.Color ); + case GL_TEXTURE_3D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; + if (state) + newenabled |= TEXTURE_3D_BIT; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; } - break; - case GL_CULL_FACE: - if (ctx->Polygon.CullFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.CullFlag = state; - break; - case GL_DEPTH_TEST: - if (state && ctx->Visual.depthBits==0) { - _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); - return; + case GL_TEXTURE_GEN_Q: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; + if (state) + newenabled |= Q_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } - if (ctx->Depth.Test==state) - return; - FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.Test = state; - break; - case GL_DITHER: - if (ctx->NoDither) { - state = GL_FALSE; /* MESA_NO_DITHER env var */ + case GL_TEXTURE_GEN_R: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; + if (state) + newenabled |= R_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } - if (ctx->Color.DitherFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.DitherFlag = state; - break; - case GL_FOG: - if (ctx->Fog.Enabled==state) - return; - FLUSH_VERTICES(ctx, _NEW_FOG); - ctx->Fog.Enabled = state; break; - case GL_HISTOGRAM: - if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEnable(GL_HISTOGRAM)"); - return; + case GL_TEXTURE_GEN_S: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; + if (state) + newenabled |= S_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } - if (ctx->Pixel.HistogramEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.HistogramEnabled = state; break; - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; - if (state) { - insert_at_tail(&ctx->Light.EnabledList, - &ctx->Light.Light[cap-GL_LIGHT0]); - } - else { - remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); + case GL_TEXTURE_GEN_T: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; + if (state) + newenabled |= T_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; } break; - case GL_LIGHTING: - if (ctx->Light.Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_LIGHT); - ctx->Light.Enabled = state; - - if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) - ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; - else - ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; - - if ((ctx->Light.Enabled && - ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) - || ctx->Fog.ColorSumEnabled) - ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; - else - ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; - break; - case GL_LINE_SMOOTH: - if (ctx->Line.SmoothFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_LINE); - ctx->Line.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_LINE_SMOOTH; - break; - case GL_LINE_STIPPLE: - if (ctx->Line.StippleFlag == state) - return; - FLUSH_VERTICES(ctx, _NEW_LINE); - ctx->Line.StippleFlag = state; - ctx->_TriangleCaps ^= DD_LINE_STIPPLE; - break; - case GL_INDEX_LOGIC_OP: - if (ctx->Color.IndexLogicOpEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.IndexLogicOpEnabled = state; - break; - case GL_COLOR_LOGIC_OP: - if (ctx->Color.ColorLogicOpEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.ColorLogicOpEnabled = state; - break; - case GL_MAP1_COLOR_4: - if (ctx->Eval.Map1Color4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Color4 = state; - break; - case GL_MAP1_INDEX: - if (ctx->Eval.Map1Index == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Index = state; - break; - case GL_MAP1_NORMAL: - if (ctx->Eval.Map1Normal == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Normal = state; - break; - case GL_MAP1_TEXTURE_COORD_1: - if (ctx->Eval.Map1TextureCoord1 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord1 = state; - break; - case GL_MAP1_TEXTURE_COORD_2: - if (ctx->Eval.Map1TextureCoord2 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord2 = state; - break; - case GL_MAP1_TEXTURE_COORD_3: - if (ctx->Eval.Map1TextureCoord3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord3 = state; - break; - case GL_MAP1_TEXTURE_COORD_4: - if (ctx->Eval.Map1TextureCoord4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1TextureCoord4 = state; - break; - case GL_MAP1_VERTEX_3: - if (ctx->Eval.Map1Vertex3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Vertex3 = state; - break; - case GL_MAP1_VERTEX_4: - if (ctx->Eval.Map1Vertex4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map1Vertex4 = state; - break; - case GL_MAP2_COLOR_4: - if (ctx->Eval.Map2Color4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Color4 = state; - break; - case GL_MAP2_INDEX: - if (ctx->Eval.Map2Index == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Index = state; - break; - case GL_MAP2_NORMAL: - if (ctx->Eval.Map2Normal == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Normal = state; - break; - case GL_MAP2_TEXTURE_COORD_1: - if (ctx->Eval.Map2TextureCoord1 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord1 = state; - break; - case GL_MAP2_TEXTURE_COORD_2: - if (ctx->Eval.Map2TextureCoord2 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord2 = state; - break; - case GL_MAP2_TEXTURE_COORD_3: - if (ctx->Eval.Map2TextureCoord3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord3 = state; - break; - case GL_MAP2_TEXTURE_COORD_4: - if (ctx->Eval.Map2TextureCoord4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2TextureCoord4 = state; - break; - case GL_MAP2_VERTEX_3: - if (ctx->Eval.Map2Vertex3 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Vertex3 = state; - break; - case GL_MAP2_VERTEX_4: - if (ctx->Eval.Map2Vertex4 == state) - return; - FLUSH_VERTICES(ctx, _NEW_EVAL); - ctx->Eval.Map2Vertex4 = state; - break; - case GL_MINMAX: - if (ctx->Pixel.MinMaxEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.MinMaxEnabled = state; - break; - case GL_NORMALIZE: - if (ctx->Transform.Normalize == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.Normalize = state; - break; - case GL_POINT_SMOOTH: - if (ctx->Point.SmoothFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_POINT_SMOOTH; - break; - case GL_POLYGON_SMOOTH: - if (ctx->Polygon.SmoothFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.SmoothFlag = state; - ctx->_TriangleCaps ^= DD_TRI_SMOOTH; - break; - case GL_POLYGON_STIPPLE: - if (ctx->Polygon.StippleFlag==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.StippleFlag = state; - ctx->_TriangleCaps ^= DD_TRI_STIPPLE; - break; - case GL_POLYGON_OFFSET_POINT: - if (ctx->Polygon.OffsetPoint==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.OffsetPoint = state; - break; - case GL_POLYGON_OFFSET_LINE: - if (ctx->Polygon.OffsetLine==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.OffsetLine = state; - break; - case GL_POLYGON_OFFSET_FILL: - /*case GL_POLYGON_OFFSET_EXT:*/ - if (ctx->Polygon.OffsetFill==state) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); - ctx->Polygon.OffsetFill = state; - break; - case GL_RESCALE_NORMAL_EXT: - if (ctx->Transform.RescaleNormals == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.RescaleNormals = state; - break; - case GL_SCISSOR_TEST: - if (ctx->Scissor.Enabled==state) - return; - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.Enabled = state; - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - if (ctx->Texture.SharedPalette == state) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - ctx->Texture.SharedPalette = state; - break; - case GL_STENCIL_TEST: - if (state && ctx->Visual.stencilBits==0) { - _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); - return; - } - if (ctx->Stencil.Enabled==state) - return; - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.Enabled = state; - break; - case GL_TEXTURE_1D: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D; - if (state) - newenabled |= TEXTURE0_1D; - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - case GL_TEXTURE_2D: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D; - if (state) - newenabled |= TEXTURE0_2D; - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - case GL_TEXTURE_3D: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D; - if (state) - newenabled |= TEXTURE0_3D; - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } - case GL_TEXTURE_GEN_Q: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; - if (state) - newenabled |= Q_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - case GL_TEXTURE_GEN_R: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; - if (state) - newenabled |= R_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - break; - case GL_TEXTURE_GEN_S: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; - if (state) - newenabled |= S_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - break; - case GL_TEXTURE_GEN_T: { - GLuint unit = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; - if (state) - newenabled |= T_BIT; - if (texUnit->TexGenEnabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->TexGenEnabled = newenabled; - break; - } - break; - - /* - * CLIENT STATE!!! - */ - case GL_VERTEX_ARRAY: - case GL_NORMAL_ARRAY: - case GL_COLOR_ARRAY: - case GL_INDEX_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - case GL_EDGE_FLAG_ARRAY: - case GL_FOG_COORDINATE_ARRAY_EXT: - case GL_SECONDARY_COLOR_ARRAY_EXT: - client_state( ctx, cap, state ); - return; + /* + * CLIENT STATE!!! + */ + case GL_VERTEX_ARRAY: + case GL_NORMAL_ARRAY: + case GL_COLOR_ARRAY: + case GL_INDEX_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + case GL_EDGE_FLAG_ARRAY: + case GL_FOG_COORDINATE_ARRAY_EXT: + case GL_SECONDARY_COLOR_ARRAY_EXT: + client_state( ctx, cap, state ); + return; /* GL_HP_occlusion_test */ - case GL_OCCLUSION_TEST_HP: - if (!ctx->Extensions.HP_occlusion_test) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Depth.OcclusionTest == state) - return; - FLUSH_VERTICES(ctx, _NEW_DEPTH); - ctx->Depth.OcclusionTest = state; - if (state) - ctx->OcclusionResult = ctx->OcclusionResultSaved; - else - ctx->OcclusionResultSaved = ctx->OcclusionResult; - break; + case GL_OCCLUSION_TEST_HP: + CHECK_EXTENSION(HP_occlusion_test, cap); + if (ctx->Depth.OcclusionTest == state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.OcclusionTest = state; + if (state) + ctx->OcclusionResult = ctx->OcclusionResultSaved; + else + ctx->OcclusionResultSaved = ctx->OcclusionResult; + break; /* GL_SGIS_pixel_texture */ - case GL_PIXEL_TEXTURE_SGIS: - if (!ctx->Extensions.SGIS_pixel_texture) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PixelTextureEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PixelTextureEnabled = state; - break; + case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION(SGIS_pixel_texture, cap); + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; /* GL_SGIX_pixel_texture */ - case GL_PIXEL_TEX_GEN_SGIX: - if (!ctx->Extensions.SGIX_pixel_texture) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PixelTextureEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PixelTextureEnabled = state; - break; + case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION(SGIX_pixel_texture, cap); + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; /* GL_SGI_color_table */ - case GL_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.ColorTableEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.ColorTableEnabled = state; - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PostConvolutionColorTableEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostConvolutionColorTableEnabled = state; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_color_table && !ctx->Extensions.ARB_imaging) { - _mesa_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.PostColorMatrixColorTableEnabled = state; - break; + case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table, cap); + if (ctx->Pixel.ColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.ColorTableEnabled = state; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table, cap); + if (ctx->Pixel.PostConvolutionColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionColorTableEnabled = state; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table, cap); + if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixColorTableEnabled = state; + break; /* GL_EXT_convolution */ - case GL_CONVOLUTION_1D: - if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Pixel.Convolution1DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Convolution1DEnabled = state; - break; - case GL_CONVOLUTION_2D: - if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Pixel.Convolution2DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Convolution2DEnabled = state; - break; - case GL_SEPARABLE_2D: - if (!ctx->Extensions.EXT_convolution && !ctx->Extensions.ARB_imaging) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Pixel.Separable2DEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_PIXEL); - ctx->Pixel.Separable2DEnabled = state; - break; + case GL_CONVOLUTION_1D: + CHECK_EXTENSION(EXT_convolution, cap); + if (ctx->Pixel.Convolution1DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution1DEnabled = state; + break; + case GL_CONVOLUTION_2D: + CHECK_EXTENSION(EXT_convolution, cap); + if (ctx->Pixel.Convolution2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution2DEnabled = state; + break; + case GL_SEPARABLE_2D: + CHECK_EXTENSION(EXT_convolution, cap); + if (ctx->Pixel.Separable2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Separable2DEnabled = state; + break; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE; - if (state) - newenabled |= TEXTURE0_CUBE; - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Enabled = newenabled; - break; - } + case GL_TEXTURE_CUBE_MAP_ARB: + { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; + CHECK_EXTENSION(ARB_texture_cube_map, cap); + if (state) + newenabled |= TEXTURE_CUBE_BIT; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + } + break; + /* GL_EXT_secondary_color */ - case GL_COLOR_SUM_EXT: - if (!ctx->Extensions.EXT_secondary_color) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Fog.ColorSumEnabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_FOG); - ctx->Fog.ColorSumEnabled = state; - - if ((ctx->Light.Enabled && - ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) - || ctx->Fog.ColorSumEnabled) - ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; - else - ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; + case GL_COLOR_SUM_EXT: + CHECK_EXTENSION(EXT_secondary_color, cap); + if (ctx->Fog.ColorSumEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.ColorSumEnabled = state; + + if ((ctx->Light.Enabled && + ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) + || ctx->Fog.ColorSumEnabled) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + else + ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; - break; + break; /* GL_ARB_multisample */ - case GL_MULTISAMPLE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.Enabled == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.Enabled = state; - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleAlphaToCoverage == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleAlphaToCoverage = state; - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleAlphaToOne == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleAlphaToOne = state; - break; - case GL_SAMPLE_COVERAGE_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleCoverage == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleCoverage = state; - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Multisample.SampleCoverageInvert == state) - return; - FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); - ctx->Multisample.SampleCoverageInvert = state; - break; + case GL_MULTISAMPLE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.Enabled = state; + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleAlphaToCoverage == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleAlphaToCoverage = state; + break; + case GL_SAMPLE_ALPHA_TO_ONE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleAlphaToOne == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleAlphaToOne = state; + break; + case GL_SAMPLE_COVERAGE_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleCoverage == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleCoverage = state; + break; + case GL_SAMPLE_COVERAGE_INVERT_ARB: + CHECK_EXTENSION(ARB_multisample, cap); + if (ctx->Multisample.SampleCoverageInvert == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleCoverageInvert = state; + break; /* GL_IBM_rasterpos_clip */ - case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (!ctx->Extensions.IBM_rasterpos_clip) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Transform.RasterPositionUnclipped == state) - return; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->Transform.RasterPositionUnclipped = state; - break; + case GL_RASTER_POSITION_UNCLIPPED_IBM: + CHECK_EXTENSION(IBM_rasterpos_clip, cap); + if (ctx->Transform.RasterPositionUnclipped == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.RasterPositionUnclipped = state; + break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (!ctx->Extensions.MESA_sprite_point) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - if (ctx->Point.SpriteMode == state) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.SpriteMode = state; - break; + /* GL_NV_point_sprite */ + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION(NV_point_sprite, cap); + if (ctx->Point.PointSprite == state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.PointSprite = state; + break; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION(NV_vertex_program, cap); + if (ctx->VertexProgram.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_PROGRAM); /* XXX OK? */ + ctx->VertexProgram.Enabled = state; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION(NV_vertex_program, cap); + if (ctx->VertexProgram.PointSizeEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT | _NEW_PROGRAM); + ctx->VertexProgram.PointSizeEnabled = state; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION(NV_vertex_program, cap); + if (ctx->VertexProgram.TwoSideEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PROGRAM); /* XXX OK? */ + ctx->VertexProgram.TwoSideEnabled = state; + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program, cap); + { + const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Attrib[map] = state; + } + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program, cap); + { + const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Attrib[map] = state; + } + break; +#endif /* FEATURE_NV_vertex_program */ /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION(NV_texture_rectangle, cap); { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_RECT; - if (!ctx->Extensions.NV_texture_rectangle) { - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } + GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; + CHECK_EXTENSION(NV_texture_rectangle, cap); if (state) - newenabled |= TEXTURE0_RECT; + newenabled |= TEXTURE_RECT_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -835,8 +889,18 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; + /* GL_EXT_stencil_two_side */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION(EXT_stencil_two_side, cap); + if (ctx->Stencil.TestTwoSide == state) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.TestTwoSide = state; + break; + default: - _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + _mesa_error(ctx, GL_INVALID_ENUM, + "%s(0x%x)", state ? "glEnable" : "glDisable", cap); return; } @@ -846,8 +910,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } - - void _mesa_Enable( GLenum cap ) { @@ -858,7 +920,6 @@ _mesa_Enable( GLenum cap ) } - void _mesa_Disable( GLenum cap ) { @@ -869,6 +930,13 @@ _mesa_Disable( GLenum cap ) } +#undef CHECK_EXTENSION +#define CHECK_EXTENSION(EXTNAME) \ + if (!ctx->Extensions.EXTNAME) { \ + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ + return GL_FALSE; \ + } + GLboolean _mesa_IsEnabled( GLenum cap ) @@ -887,7 +955,7 @@ _mesa_IsEnabled( GLenum cap ) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - return ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0]; + return (ctx->Transform.ClipPlanesEnabled >> (cap - GL_CLIP_PLANE0)) & 1; case GL_COLOR_MATERIAL: return ctx->Light.ColorMaterialEnabled; case GL_CULL_FACE: @@ -898,14 +966,6 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Color.DitherFlag; case GL_FOG: return ctx->Fog.Enabled; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - return ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } case GL_LIGHTING: return ctx->Light.Enabled; case GL_LIGHT0: @@ -961,8 +1021,6 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Eval.Map2Vertex3; case GL_MAP2_VERTEX_4: return ctx->Eval.Map2Vertex4; - case GL_MINMAX: - return ctx->Pixel.MinMaxEnabled; case GL_NORMALIZE: return ctx->Transform.Normalize; case GL_POINT_SMOOTH: @@ -988,37 +1046,44 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Stencil.Enabled; case GL_TEXTURE_1D: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_1D) ? GL_TRUE : GL_FALSE; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_2D: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_2D) ? GL_TRUE : GL_FALSE; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_3D: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_3D) ? GL_TRUE : GL_FALSE; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_Q: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_R: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_S: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_T: { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; } @@ -1026,133 +1091,195 @@ _mesa_IsEnabled( GLenum cap ) * CLIENT STATE!!! */ case GL_VERTEX_ARRAY: - return ctx->Array.Vertex.Enabled; + return (ctx->Array.Vertex.Enabled != 0); case GL_NORMAL_ARRAY: - return ctx->Array.Normal.Enabled; + return (ctx->Array.Normal.Enabled != 0); case GL_COLOR_ARRAY: - return ctx->Array.Color.Enabled; + return (ctx->Array.Color.Enabled != 0); case GL_INDEX_ARRAY: - return ctx->Array.Index.Enabled; + return (ctx->Array.Index.Enabled != 0); case GL_TEXTURE_COORD_ARRAY: - return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; + return (ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled != 0); case GL_EDGE_FLAG_ARRAY: - return ctx->Array.EdgeFlag.Enabled; + return (ctx->Array.EdgeFlag.Enabled != 0); + case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION(EXT_fog_coord); + return (ctx->Array.FogCoord.Enabled != 0); + case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION(EXT_secondary_color); + return (ctx->Array.SecondaryColor.Enabled != 0); + + /* GL_EXT_histogram */ + case GL_HISTOGRAM: + CHECK_EXTENSION(EXT_histogram); + return ctx->Pixel.HistogramEnabled; + case GL_MINMAX: + CHECK_EXTENSION(EXT_histogram); + return ctx->Pixel.MinMaxEnabled; /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - return ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); - return GL_FALSE; - } + CHECK_EXTENSION(HP_occlusion_test); + return ctx->Depth.OcclusionTest; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION(SGIS_pixel_texture); return ctx->Pixel.PixelTextureEnabled; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION(SGIX_pixel_texture); return ctx->Pixel.PixelTextureEnabled; /* GL_SGI_color_table */ case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.ColorTableEnabled; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostConvolutionColorTableEnabled; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION(SGI_color_table); return ctx->Pixel.PostColorMatrixColorTableEnabled; /* GL_EXT_convolution */ case GL_CONVOLUTION_1D: + CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Convolution1DEnabled; case GL_CONVOLUTION_2D: + CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Convolution2DEnabled; case GL_SEPARABLE_2D: + CHECK_EXTENSION(EXT_convolution); return ctx->Pixel.Separable2DEnabled; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) { - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; + CHECK_EXTENSION(ARB_texture_cube_map); + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; } /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.Enabled; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleAlphaToCoverage; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleAlphaToOne; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleCoverage; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - return ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; - } + CHECK_EXTENSION(ARB_multisample); + return ctx->Multisample.SampleCoverageInvert; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - return ctx->Transform.RasterPositionUnclipped; + CHECK_EXTENSION(IBM_rasterpos_clip); + return ctx->Transform.RasterPositionUnclipped; + + /* GL_NV_point_sprite */ + case GL_POINT_SPRITE_NV: + return ctx->Point.PointSprite; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.Enabled; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.PointSizeEnabled; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION(NV_vertex_program); + return ctx->VertexProgram.TwoSideEnabled; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION(NV_vertex_program); + { + GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; + return (ctx->Array.VertexAttrib[n].Enabled != 0); } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program); + { + const GLuint map = (GLuint) (cap - GL_MAP1_VERTEX_ATTRIB0_4_NV); + return ctx->Eval.Map1Attrib[map]; } - - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - return ctx->Point.SpriteMode; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION(NV_vertex_program); + { + const GLuint map = (GLuint) (cap - GL_MAP2_VERTEX_ATTRIB0_4_NV); + return ctx->Eval.Map2Attrib[map]; + } +#endif /* FEATURE_NV_vertex_program */ /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: - if (ctx->Extensions.NV_texture_rectangle) { + CHECK_EXTENSION(NV_texture_rectangle); + { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_RECT) ? GL_TRUE : GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); - return GL_FALSE; + return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE; } + /* GL_EXT_stencil_two_side */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION(EXT_stencil_two_side); + return ctx->Stencil.TestTwoSide; + default: - _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); return GL_FALSE; } } diff --git a/xc/extras/Mesa/src/enums.c b/xc/extras/Mesa/src/enums.c index 6801e8f5c..999c40a48 100644 --- a/xc/extras/Mesa/src/enums.c +++ b/xc/extras/Mesa/src/enums.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0.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"), @@ -23,17 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "enums.h" -#include "mem.h" -#endif +#include "imports.h" typedef struct { @@ -775,10 +771,21 @@ enum_elt all_enums[] = { "GL_OCCLUSION_TEST_RESULT_HP", 0x8166 }, { "GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500 }, - { "GL_TEXTUER_LOD_BIAS_EXT", 0x8501 }, - - { "GL_NORMAL_MAP_NV", 0x8511 }, - { "GL_REFLECTION_MAP_NV", 0x8512 }, + { "GL_TEXTURE_LOD_BIAS_EXT", 0x8501 }, + + /* GL_ARB_texture_cube_map */ + { "GL_NORMAL_MAP_ARB", 0x8511 }, + { "GL_REFLECTION_MAP_ARB", 0x8512 }, + { "GL_TEXTURE_CUBE_MAP_ARB", 0x8513 }, + { "GL_TEXTURE_BINDING_CUBE_MAP_ARB", 0x8514 }, + { "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB", 0x8515 }, + { "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB", 0x8516 }, + { "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB", 0x8517 }, + { "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB", 0x8518 }, + { "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB", 0x8519 }, + { "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB", 0x851a }, + { "GL_PROXY_TEXTURE_CUBE_MAP_ARB", 0x851b }, + { "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", 0x851c }, { "GL_PREFER_DOUBLEBUFFER_HINT_PGI", 107000 }, { "GL_STRICT_DEPTHFUNC_HINT_PGI", 107030 }, @@ -840,11 +847,44 @@ enum_elt all_enums[] = { "GL_DOT3_RGBA_EXT", 0x8741 }, /* GL_ARB_texture_env_dot3 */ - { "GL_DOT3_RGB_EXT", 0x86ae }, - { "GL_DOT3_RGBA_EXT", 0x86af }, + { "GL_DOT3_RGB_ARB", 0x86ae }, + { "GL_DOT3_RGBA_ARB", 0x86af }, /* GL_ARB_texture_border_clamp */ { "GL_CLAMP_TO_BORDER_ARB", 0x812D }, + + /* GL_ATI_texture_env_combine3 */ + { "GL_MODULATE_ADD_ATI", 0x8744 }, + { "GL_MODULATE_SIGNED_ADD_ATI", 0x8745 }, + { "GL_MODULATE_SUBTRACT_ATI", 0x8746 }, + + /* GL_ARB_texture_compression */ + { "GL_COMPRESSED_ALPHA_ARB", 0x84E9 }, + { "GL_COMPRESSED_LUMINANCE_ARB", 0x84EA }, + { "GL_COMPRESSED_LUMINANCE_ALPHA_ARB", 0x84EB }, + { "GL_COMPRESSED_INTENSITY_ARB", 0x84EC }, + { "GL_COMPRESSED_RGB_ARB", 0x84ED }, + { "GL_COMPRESSED_RGBA_ARB", 0x84EE }, + { "GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB", 0x86A0 }, + { "GL_TEXTURE_COMPRESSED_ARB", 0x86A1 }, + { "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A2 }, + { "GL_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A3 }, + + /* GL_EXT_texture_compression_s3tc */ + { "GL_COMPRESSED_RGB_S3TC_DXT1_EXT", 0x83F0 }, + { "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", 0x83F1 }, + { "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT", 0x83F2 }, + { "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT", 0x83F3 }, + + /* GL_S3_s3tc */ + { "GL_RGB_S3TC", 0x83A0 }, + { "GL_RGB4_S3TC", 0x83A1 }, + { "GL_RGBA_S3TC", 0x83A2 }, + { "GL_RGBA4_S3TC", 0x83A3 }, + + /* GL_3DFX_texture_compression_FXT1 */ + { "GL_COMPRESSED_RGB_FXT1_3DFX", 0x86B0 }, + { "GL_COMPRESSED_RGBA_FXT1_3DFX", 0x86B1 }, }; #define Elements(x) sizeof(x)/sizeof(*x) @@ -856,7 +896,7 @@ static int sorted = 0; static int compar_name( const enum_elt *a, const enum_elt *b ) { - return strcmp(a->c, b->c); + return _mesa_strcmp(a->c, b->c); } @@ -927,7 +967,7 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } else { /* this isn't re-entrant safe, no big deal here */ - sprintf(token_tmp, "0x%x", nr); + _mesa_sprintf(token_tmp, "0x%x", nr); return token_tmp; } } diff --git a/xc/extras/Mesa/src/eval.c b/xc/extras/Mesa/src/eval.c index a3fb0e9b5..b9c09a569 100644 --- a/xc/extras/Mesa/src/eval.c +++ b/xc/extras/Mesa/src/eval.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -37,18 +37,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "eval.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "mtypes.h" -#endif /* @@ -77,7 +73,122 @@ GLuint _mesa_evaluator_components( GLenum target ) case GL_MAP2_TEXTURE_COORD_2: return 2; case GL_MAP2_TEXTURE_COORD_3: return 3; case GL_MAP2_TEXTURE_COORD_4: return 4; - default: return 0; + default: break; + } + + /* XXX need to check for the vertex program extension + if (!ctx->Extensions.NV_vertex_program) + return 0; + */ + + if (target >= GL_MAP1_VERTEX_ATTRIB0_4_NV && + target <= GL_MAP1_VERTEX_ATTRIB15_4_NV) + return 4; + + if (target >= GL_MAP2_VERTEX_ATTRIB0_4_NV && + target <= GL_MAP2_VERTEX_ATTRIB15_4_NV) + return 4; + + return 0; +} + + +/* + * Return pointer to the gl_1d_map struct for the named target. + */ +static struct gl_1d_map * +get_1d_map( GLcontext *ctx, GLenum target ) +{ + switch (target) { + case GL_MAP1_VERTEX_3: + return &ctx->EvalMap.Map1Vertex3; + case GL_MAP1_VERTEX_4: + return &ctx->EvalMap.Map1Vertex4; + case GL_MAP1_INDEX: + return &ctx->EvalMap.Map1Index; + case GL_MAP1_COLOR_4: + return &ctx->EvalMap.Map1Color4; + case GL_MAP1_NORMAL: + return &ctx->EvalMap.Map1Normal; + case GL_MAP1_TEXTURE_COORD_1: + return &ctx->EvalMap.Map1Texture1; + case GL_MAP1_TEXTURE_COORD_2: + return &ctx->EvalMap.Map1Texture2; + case GL_MAP1_TEXTURE_COORD_3: + return &ctx->EvalMap.Map1Texture3; + case GL_MAP1_TEXTURE_COORD_4: + return &ctx->EvalMap.Map1Texture4; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + if (!ctx->Extensions.NV_vertex_program) + return NULL; + return &ctx->EvalMap.Map1Attrib[target - GL_MAP1_VERTEX_ATTRIB0_4_NV]; + default: + return NULL; + } +} + + +/* + * Return pointer to the gl_2d_map struct for the named target. + */ +static struct gl_2d_map * +get_2d_map( GLcontext *ctx, GLenum target ) +{ + switch (target) { + case GL_MAP2_VERTEX_3: + return &ctx->EvalMap.Map2Vertex3; + case GL_MAP2_VERTEX_4: + return &ctx->EvalMap.Map2Vertex4; + case GL_MAP2_INDEX: + return &ctx->EvalMap.Map2Index; + case GL_MAP2_COLOR_4: + return &ctx->EvalMap.Map2Color4; + case GL_MAP2_NORMAL: + return &ctx->EvalMap.Map2Normal; + case GL_MAP2_TEXTURE_COORD_1: + return &ctx->EvalMap.Map2Texture1; + case GL_MAP2_TEXTURE_COORD_2: + return &ctx->EvalMap.Map2Texture2; + case GL_MAP2_TEXTURE_COORD_3: + return &ctx->EvalMap.Map2Texture3; + case GL_MAP2_TEXTURE_COORD_4: + return &ctx->EvalMap.Map2Texture4; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + if (!ctx->Extensions.NV_vertex_program) + return NULL; + return &ctx->EvalMap.Map2Attrib[target - GL_MAP2_VERTEX_ATTRIB0_4_NV]; + default: + return NULL; } } @@ -95,20 +206,19 @@ GLuint _mesa_evaluator_components( GLenum target ) * of memory. */ GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, - const GLfloat *points ) + const GLfloat *points ) { GLfloat *buffer, *p; GLint i, k, size = _mesa_evaluator_components(target); - if (!points || size==0) { + if (!points || !size) return NULL; - } buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); - if(buffer) - for(i=0, p=buffer; i<uorder; i++, points+=ustride) - for(k=0; k<size; k++) + if (buffer) + for (i = 0, p = buffer; i < uorder; i++, points += ustride) + for (k = 0; k < size; k++) *p++ = points[k]; return buffer; @@ -120,20 +230,19 @@ GLfloat *_mesa_copy_map_points1f( GLenum target, GLint ustride, GLint uorder, * Same as above but convert doubles to floats. */ GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, - const GLdouble *points ) + const GLdouble *points ) { GLfloat *buffer, *p; GLint i, k, size = _mesa_evaluator_components(target); - if (!points || size==0) { + if (!points || !size) return NULL; - } buffer = (GLfloat *) MALLOC(uorder * size * sizeof(GLfloat)); - if(buffer) - for(i=0, p=buffer; i<uorder; i++, points+=ustride) - for(k=0; k<size; k++) + if (buffer) + for (i = 0, p = buffer; i < uorder; i++, points += ustride) + for (k = 0; k < size; k++) *p++ = (GLfloat) points[k]; return buffer; @@ -152,9 +261,9 @@ GLfloat *_mesa_copy_map_points1d( GLenum target, GLint ustride, GLint uorder, * of memory. */ GLfloat *_mesa_copy_map_points2f( GLenum target, - GLint ustride, GLint uorder, - GLint vstride, GLint vorder, - const GLfloat *points ) + GLint ustride, GLint uorder, + GLint vstride, GLint vorder, + const GLfloat *points ) { GLfloat *buffer, *p; GLint i, j, k, size, dsize, hsize; @@ -195,9 +304,9 @@ GLfloat *_mesa_copy_map_points2f( GLenum target, * Same as above but convert doubles to floats. */ GLfloat *_mesa_copy_map_points2d(GLenum target, - GLint ustride, GLint uorder, - GLint vstride, GLint vorder, - const GLdouble *points ) + GLint ustride, GLint uorder, + GLint vstride, GLint vorder, + const GLdouble *points ) { GLfloat *buffer, *p; GLint i, j, k, size, hsize, dsize; @@ -250,10 +359,10 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GET_CURRENT_CONTEXT(ctx); GLint k; GLfloat *pnts; - struct gl_1d_map *map = 0; - ASSERT_OUTSIDE_BEGIN_END(ctx); + struct gl_1d_map *map = NULL; - assert(type == GL_FLOAT || type == GL_DOUBLE); + ASSERT_OUTSIDE_BEGIN_END(ctx); + ASSERT(type == GL_FLOAT || type == GL_DOUBLE); if (u1 == u2) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap1(u1,u2)" ); @@ -284,37 +393,10 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, return; } - switch (target) { - case GL_MAP1_VERTEX_3: - map = &ctx->EvalMap.Map1Vertex3; - break; - case GL_MAP1_VERTEX_4: - map = &ctx->EvalMap.Map1Vertex4; - break; - case GL_MAP1_INDEX: - map = &ctx->EvalMap.Map1Index; - break; - case GL_MAP1_COLOR_4: - map = &ctx->EvalMap.Map1Color4; - break; - case GL_MAP1_NORMAL: - map = &ctx->EvalMap.Map1Normal; - break; - case GL_MAP1_TEXTURE_COORD_1: - map = &ctx->EvalMap.Map1Texture1; - break; - case GL_MAP1_TEXTURE_COORD_2: - map = &ctx->EvalMap.Map1Texture2; - break; - case GL_MAP1_TEXTURE_COORD_3: - map = &ctx->EvalMap.Map1Texture3; - break; - case GL_MAP1_TEXTURE_COORD_4: - map = &ctx->EvalMap.Map1Texture4; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); - return; + map = get_1d_map(ctx, target); + if (!map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); + return; } /* make copy of the control points */ @@ -360,8 +442,10 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GET_CURRENT_CONTEXT(ctx); GLint k; GLfloat *pnts; - struct gl_2d_map *map = 0; + struct gl_2d_map *map = NULL; + ASSERT_OUTSIDE_BEGIN_END(ctx); + ASSERT(type == GL_FLOAT || type == GL_DOUBLE); if (u1==u2) { _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" ); @@ -403,37 +487,10 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, return; } - switch (target) { - case GL_MAP2_VERTEX_3: - map = &ctx->EvalMap.Map2Vertex3; - break; - case GL_MAP2_VERTEX_4: - map = &ctx->EvalMap.Map2Vertex4; - break; - case GL_MAP2_INDEX: - map = &ctx->EvalMap.Map2Index; - break; - case GL_MAP2_COLOR_4: - map = &ctx->EvalMap.Map2Color4; - break; - case GL_MAP2_NORMAL: - map = &ctx->EvalMap.Map2Normal; - break; - case GL_MAP2_TEXTURE_COORD_1: - map = &ctx->EvalMap.Map2Texture1; - break; - case GL_MAP2_TEXTURE_COORD_2: - map = &ctx->EvalMap.Map2Texture2; - break; - case GL_MAP2_TEXTURE_COORD_3: - map = &ctx->EvalMap.Map2Texture3; - break; - case GL_MAP2_TEXTURE_COORD_4: - map = &ctx->EvalMap.Map2Texture4; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); - return; + map = get_2d_map(ctx, target); + if (!map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); + return; } /* make copy of the control points */ @@ -487,98 +544,34 @@ void _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); + struct gl_1d_map *map1d; + struct gl_2d_map *map2d; GLint i, n; GLfloat *data; + GLuint comps; + ASSERT_OUTSIDE_BEGIN_END(ctx); + comps = _mesa_evaluator_components(target); + if (!comps) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); + return; + } + + map1d = get_1d_map(ctx, target); + map2d = get_2d_map(ctx, target); + ASSERT(map1d || map2d); + switch (query) { case GL_COEFF: - switch (target) { - case GL_MAP1_COLOR_4: - data = ctx->EvalMap.Map1Color4.Points; - n = ctx->EvalMap.Map1Color4.Order * 4; - break; - case GL_MAP1_INDEX: - data = ctx->EvalMap.Map1Index.Points; - n = ctx->EvalMap.Map1Index.Order; - break; - case GL_MAP1_NORMAL: - data = ctx->EvalMap.Map1Normal.Points; - n = ctx->EvalMap.Map1Normal.Order * 3; - break; - case GL_MAP1_TEXTURE_COORD_1: - data = ctx->EvalMap.Map1Texture1.Points; - n = ctx->EvalMap.Map1Texture1.Order * 1; - break; - case GL_MAP1_TEXTURE_COORD_2: - data = ctx->EvalMap.Map1Texture2.Points; - n = ctx->EvalMap.Map1Texture2.Order * 2; - break; - case GL_MAP1_TEXTURE_COORD_3: - data = ctx->EvalMap.Map1Texture3.Points; - n = ctx->EvalMap.Map1Texture3.Order * 3; - break; - case GL_MAP1_TEXTURE_COORD_4: - data = ctx->EvalMap.Map1Texture4.Points; - n = ctx->EvalMap.Map1Texture4.Order * 4; - break; - case GL_MAP1_VERTEX_3: - data = ctx->EvalMap.Map1Vertex3.Points; - n = ctx->EvalMap.Map1Vertex3.Order * 3; - break; - case GL_MAP1_VERTEX_4: - data = ctx->EvalMap.Map1Vertex4.Points; - n = ctx->EvalMap.Map1Vertex4.Order * 4; - break; - case GL_MAP2_COLOR_4: - data = ctx->EvalMap.Map2Color4.Points; - n = ctx->EvalMap.Map2Color4.Uorder - * ctx->EvalMap.Map2Color4.Vorder * 4; - break; - case GL_MAP2_INDEX: - data = ctx->EvalMap.Map2Index.Points; - n = ctx->EvalMap.Map2Index.Uorder - * ctx->EvalMap.Map2Index.Vorder; - break; - case GL_MAP2_NORMAL: - data = ctx->EvalMap.Map2Normal.Points; - n = ctx->EvalMap.Map2Normal.Uorder - * ctx->EvalMap.Map2Normal.Vorder * 3; - break; - case GL_MAP2_TEXTURE_COORD_1: - data = ctx->EvalMap.Map2Texture1.Points; - n = ctx->EvalMap.Map2Texture1.Uorder - * ctx->EvalMap.Map2Texture1.Vorder * 1; - break; - case GL_MAP2_TEXTURE_COORD_2: - data = ctx->EvalMap.Map2Texture2.Points; - n = ctx->EvalMap.Map2Texture2.Uorder - * ctx->EvalMap.Map2Texture2.Vorder * 2; - break; - case GL_MAP2_TEXTURE_COORD_3: - data = ctx->EvalMap.Map2Texture3.Points; - n = ctx->EvalMap.Map2Texture3.Uorder - * ctx->EvalMap.Map2Texture3.Vorder * 3; - break; - case GL_MAP2_TEXTURE_COORD_4: - data = ctx->EvalMap.Map2Texture4.Points; - n = ctx->EvalMap.Map2Texture4.Uorder - * ctx->EvalMap.Map2Texture4.Vorder * 4; - break; - case GL_MAP2_VERTEX_3: - data = ctx->EvalMap.Map2Vertex3.Points; - n = ctx->EvalMap.Map2Vertex3.Uorder - * ctx->EvalMap.Map2Vertex3.Vorder * 3; - break; - case GL_MAP2_VERTEX_4: - data = ctx->EvalMap.Map2Vertex4.Points; - n = ctx->EvalMap.Map2Vertex4.Uorder - * ctx->EvalMap.Map2Vertex4.Vorder * 4; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); - return; - } + if (map1d) { + data = map1d->Points; + n = map1d->Order * comps; + } + else { + data = map2d->Points; + n = map2d->Uorder * map2d->Vorder * comps; + } if (data) { for (i=0;i<n;i++) { v[i] = data[i]; @@ -586,170 +579,25 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) } break; case GL_ORDER: - switch (target) { - case GL_MAP1_COLOR_4: - *v = ctx->EvalMap.Map1Color4.Order; - break; - case GL_MAP1_INDEX: - *v = ctx->EvalMap.Map1Index.Order; - break; - case GL_MAP1_NORMAL: - *v = ctx->EvalMap.Map1Normal.Order; - break; - case GL_MAP1_TEXTURE_COORD_1: - *v = ctx->EvalMap.Map1Texture1.Order; - break; - case GL_MAP1_TEXTURE_COORD_2: - *v = ctx->EvalMap.Map1Texture2.Order; - break; - case GL_MAP1_TEXTURE_COORD_3: - *v = ctx->EvalMap.Map1Texture3.Order; - break; - case GL_MAP1_TEXTURE_COORD_4: - *v = ctx->EvalMap.Map1Texture4.Order; - break; - case GL_MAP1_VERTEX_3: - *v = ctx->EvalMap.Map1Vertex3.Order; - break; - case GL_MAP1_VERTEX_4: - *v = ctx->EvalMap.Map1Vertex4.Order; - break; - case GL_MAP2_COLOR_4: - v[0] = ctx->EvalMap.Map2Color4.Uorder; - v[1] = ctx->EvalMap.Map2Color4.Vorder; - break; - case GL_MAP2_INDEX: - v[0] = ctx->EvalMap.Map2Index.Uorder; - v[1] = ctx->EvalMap.Map2Index.Vorder; - break; - case GL_MAP2_NORMAL: - v[0] = ctx->EvalMap.Map2Normal.Uorder; - v[1] = ctx->EvalMap.Map2Normal.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_1: - v[0] = ctx->EvalMap.Map2Texture1.Uorder; - v[1] = ctx->EvalMap.Map2Texture1.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_2: - v[0] = ctx->EvalMap.Map2Texture2.Uorder; - v[1] = ctx->EvalMap.Map2Texture2.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_3: - v[0] = ctx->EvalMap.Map2Texture3.Uorder; - v[1] = ctx->EvalMap.Map2Texture3.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_4: - v[0] = ctx->EvalMap.Map2Texture4.Uorder; - v[1] = ctx->EvalMap.Map2Texture4.Vorder; - break; - case GL_MAP2_VERTEX_3: - v[0] = ctx->EvalMap.Map2Vertex3.Uorder; - v[1] = ctx->EvalMap.Map2Vertex3.Vorder; - break; - case GL_MAP2_VERTEX_4: - v[0] = ctx->EvalMap.Map2Vertex4.Uorder; - v[1] = ctx->EvalMap.Map2Vertex4.Vorder; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); - return; - } + if (map1d) { + v[0] = (GLdouble) map1d->Order; + } + else { + v[0] = (GLdouble) map2d->Uorder; + v[1] = (GLdouble) map2d->Vorder; + } break; case GL_DOMAIN: - switch (target) { - case GL_MAP1_COLOR_4: - v[0] = ctx->EvalMap.Map1Color4.u1; - v[1] = ctx->EvalMap.Map1Color4.u2; - break; - case GL_MAP1_INDEX: - v[0] = ctx->EvalMap.Map1Index.u1; - v[1] = ctx->EvalMap.Map1Index.u2; - break; - case GL_MAP1_NORMAL: - v[0] = ctx->EvalMap.Map1Normal.u1; - v[1] = ctx->EvalMap.Map1Normal.u2; - break; - case GL_MAP1_TEXTURE_COORD_1: - v[0] = ctx->EvalMap.Map1Texture1.u1; - v[1] = ctx->EvalMap.Map1Texture1.u2; - break; - case GL_MAP1_TEXTURE_COORD_2: - v[0] = ctx->EvalMap.Map1Texture2.u1; - v[1] = ctx->EvalMap.Map1Texture2.u2; - break; - case GL_MAP1_TEXTURE_COORD_3: - v[0] = ctx->EvalMap.Map1Texture3.u1; - v[1] = ctx->EvalMap.Map1Texture3.u2; - break; - case GL_MAP1_TEXTURE_COORD_4: - v[0] = ctx->EvalMap.Map1Texture4.u1; - v[1] = ctx->EvalMap.Map1Texture4.u2; - break; - case GL_MAP1_VERTEX_3: - v[0] = ctx->EvalMap.Map1Vertex3.u1; - v[1] = ctx->EvalMap.Map1Vertex3.u2; - break; - case GL_MAP1_VERTEX_4: - v[0] = ctx->EvalMap.Map1Vertex4.u1; - v[1] = ctx->EvalMap.Map1Vertex4.u2; - break; - case GL_MAP2_COLOR_4: - v[0] = ctx->EvalMap.Map2Color4.u1; - v[1] = ctx->EvalMap.Map2Color4.u2; - v[2] = ctx->EvalMap.Map2Color4.v1; - v[3] = ctx->EvalMap.Map2Color4.v2; - break; - case GL_MAP2_INDEX: - v[0] = ctx->EvalMap.Map2Index.u1; - v[1] = ctx->EvalMap.Map2Index.u2; - v[2] = ctx->EvalMap.Map2Index.v1; - v[3] = ctx->EvalMap.Map2Index.v2; - break; - case GL_MAP2_NORMAL: - v[0] = ctx->EvalMap.Map2Normal.u1; - v[1] = ctx->EvalMap.Map2Normal.u2; - v[2] = ctx->EvalMap.Map2Normal.v1; - v[3] = ctx->EvalMap.Map2Normal.v2; - break; - case GL_MAP2_TEXTURE_COORD_1: - v[0] = ctx->EvalMap.Map2Texture1.u1; - v[1] = ctx->EvalMap.Map2Texture1.u2; - v[2] = ctx->EvalMap.Map2Texture1.v1; - v[3] = ctx->EvalMap.Map2Texture1.v2; - break; - case GL_MAP2_TEXTURE_COORD_2: - v[0] = ctx->EvalMap.Map2Texture2.u1; - v[1] = ctx->EvalMap.Map2Texture2.u2; - v[2] = ctx->EvalMap.Map2Texture2.v1; - v[3] = ctx->EvalMap.Map2Texture2.v2; - break; - case GL_MAP2_TEXTURE_COORD_3: - v[0] = ctx->EvalMap.Map2Texture3.u1; - v[1] = ctx->EvalMap.Map2Texture3.u2; - v[2] = ctx->EvalMap.Map2Texture3.v1; - v[3] = ctx->EvalMap.Map2Texture3.v2; - break; - case GL_MAP2_TEXTURE_COORD_4: - v[0] = ctx->EvalMap.Map2Texture4.u1; - v[1] = ctx->EvalMap.Map2Texture4.u2; - v[2] = ctx->EvalMap.Map2Texture4.v1; - v[3] = ctx->EvalMap.Map2Texture4.v2; - break; - case GL_MAP2_VERTEX_3: - v[0] = ctx->EvalMap.Map2Vertex3.u1; - v[1] = ctx->EvalMap.Map2Vertex3.u2; - v[2] = ctx->EvalMap.Map2Vertex3.v1; - v[3] = ctx->EvalMap.Map2Vertex3.v2; - break; - case GL_MAP2_VERTEX_4: - v[0] = ctx->EvalMap.Map2Vertex4.u1; - v[1] = ctx->EvalMap.Map2Vertex4.u2; - v[2] = ctx->EvalMap.Map2Vertex4.v1; - v[3] = ctx->EvalMap.Map2Vertex4.v2; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(target)" ); - } + if (map1d) { + v[0] = (GLdouble) map1d->u1; + v[1] = (GLdouble) map1d->u2; + } + else { + v[0] = (GLdouble) map2d->u1; + v[1] = (GLdouble) map2d->u2; + v[2] = (GLdouble) map2d->v1; + v[3] = (GLdouble) map2d->v2; + } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapdv(query)" ); @@ -761,98 +609,34 @@ void _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); + struct gl_1d_map *map1d; + struct gl_2d_map *map2d; GLint i, n; GLfloat *data; + GLuint comps; + ASSERT_OUTSIDE_BEGIN_END(ctx); + comps = _mesa_evaluator_components(target); + if (!comps) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); + return; + } + + map1d = get_1d_map(ctx, target); + map2d = get_2d_map(ctx, target); + ASSERT(map1d || map2d); + switch (query) { case GL_COEFF: - switch (target) { - case GL_MAP1_COLOR_4: - data = ctx->EvalMap.Map1Color4.Points; - n = ctx->EvalMap.Map1Color4.Order * 4; - break; - case GL_MAP1_INDEX: - data = ctx->EvalMap.Map1Index.Points; - n = ctx->EvalMap.Map1Index.Order; - break; - case GL_MAP1_NORMAL: - data = ctx->EvalMap.Map1Normal.Points; - n = ctx->EvalMap.Map1Normal.Order * 3; - break; - case GL_MAP1_TEXTURE_COORD_1: - data = ctx->EvalMap.Map1Texture1.Points; - n = ctx->EvalMap.Map1Texture1.Order * 1; - break; - case GL_MAP1_TEXTURE_COORD_2: - data = ctx->EvalMap.Map1Texture2.Points; - n = ctx->EvalMap.Map1Texture2.Order * 2; - break; - case GL_MAP1_TEXTURE_COORD_3: - data = ctx->EvalMap.Map1Texture3.Points; - n = ctx->EvalMap.Map1Texture3.Order * 3; - break; - case GL_MAP1_TEXTURE_COORD_4: - data = ctx->EvalMap.Map1Texture4.Points; - n = ctx->EvalMap.Map1Texture4.Order * 4; - break; - case GL_MAP1_VERTEX_3: - data = ctx->EvalMap.Map1Vertex3.Points; - n = ctx->EvalMap.Map1Vertex3.Order * 3; - break; - case GL_MAP1_VERTEX_4: - data = ctx->EvalMap.Map1Vertex4.Points; - n = ctx->EvalMap.Map1Vertex4.Order * 4; - break; - case GL_MAP2_COLOR_4: - data = ctx->EvalMap.Map2Color4.Points; - n = ctx->EvalMap.Map2Color4.Uorder - * ctx->EvalMap.Map2Color4.Vorder * 4; - break; - case GL_MAP2_INDEX: - data = ctx->EvalMap.Map2Index.Points; - n = ctx->EvalMap.Map2Index.Uorder - * ctx->EvalMap.Map2Index.Vorder; - break; - case GL_MAP2_NORMAL: - data = ctx->EvalMap.Map2Normal.Points; - n = ctx->EvalMap.Map2Normal.Uorder - * ctx->EvalMap.Map2Normal.Vorder * 3; - break; - case GL_MAP2_TEXTURE_COORD_1: - data = ctx->EvalMap.Map2Texture1.Points; - n = ctx->EvalMap.Map2Texture1.Uorder - * ctx->EvalMap.Map2Texture1.Vorder * 1; - break; - case GL_MAP2_TEXTURE_COORD_2: - data = ctx->EvalMap.Map2Texture2.Points; - n = ctx->EvalMap.Map2Texture2.Uorder - * ctx->EvalMap.Map2Texture2.Vorder * 2; - break; - case GL_MAP2_TEXTURE_COORD_3: - data = ctx->EvalMap.Map2Texture3.Points; - n = ctx->EvalMap.Map2Texture3.Uorder - * ctx->EvalMap.Map2Texture3.Vorder * 3; - break; - case GL_MAP2_TEXTURE_COORD_4: - data = ctx->EvalMap.Map2Texture4.Points; - n = ctx->EvalMap.Map2Texture4.Uorder - * ctx->EvalMap.Map2Texture4.Vorder * 4; - break; - case GL_MAP2_VERTEX_3: - data = ctx->EvalMap.Map2Vertex3.Points; - n = ctx->EvalMap.Map2Vertex3.Uorder - * ctx->EvalMap.Map2Vertex3.Vorder * 3; - break; - case GL_MAP2_VERTEX_4: - data = ctx->EvalMap.Map2Vertex4.Points; - n = ctx->EvalMap.Map2Vertex4.Uorder - * ctx->EvalMap.Map2Vertex4.Vorder * 4; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); - return; - } + if (map1d) { + data = map1d->Points; + n = map1d->Order * comps; + } + else { + data = map2d->Points; + n = map2d->Uorder * map2d->Vorder * comps; + } if (data) { for (i=0;i<n;i++) { v[i] = data[i]; @@ -860,170 +644,25 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) } break; case GL_ORDER: - switch (target) { - case GL_MAP1_COLOR_4: - *v = (GLfloat) ctx->EvalMap.Map1Color4.Order; - break; - case GL_MAP1_INDEX: - *v = (GLfloat) ctx->EvalMap.Map1Index.Order; - break; - case GL_MAP1_NORMAL: - *v = (GLfloat) ctx->EvalMap.Map1Normal.Order; - break; - case GL_MAP1_TEXTURE_COORD_1: - *v = (GLfloat) ctx->EvalMap.Map1Texture1.Order; - break; - case GL_MAP1_TEXTURE_COORD_2: - *v = (GLfloat) ctx->EvalMap.Map1Texture2.Order; - break; - case GL_MAP1_TEXTURE_COORD_3: - *v = (GLfloat) ctx->EvalMap.Map1Texture3.Order; - break; - case GL_MAP1_TEXTURE_COORD_4: - *v = (GLfloat) ctx->EvalMap.Map1Texture4.Order; - break; - case GL_MAP1_VERTEX_3: - *v = (GLfloat) ctx->EvalMap.Map1Vertex3.Order; - break; - case GL_MAP1_VERTEX_4: - *v = (GLfloat) ctx->EvalMap.Map1Vertex4.Order; - break; - case GL_MAP2_COLOR_4: - v[0] = (GLfloat) ctx->EvalMap.Map2Color4.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Color4.Vorder; - break; - case GL_MAP2_INDEX: - v[0] = (GLfloat) ctx->EvalMap.Map2Index.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Index.Vorder; - break; - case GL_MAP2_NORMAL: - v[0] = (GLfloat) ctx->EvalMap.Map2Normal.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Normal.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_1: - v[0] = (GLfloat) ctx->EvalMap.Map2Texture1.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Texture1.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_2: - v[0] = (GLfloat) ctx->EvalMap.Map2Texture2.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Texture2.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_3: - v[0] = (GLfloat) ctx->EvalMap.Map2Texture3.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Texture3.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_4: - v[0] = (GLfloat) ctx->EvalMap.Map2Texture4.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Texture4.Vorder; - break; - case GL_MAP2_VERTEX_3: - v[0] = (GLfloat) ctx->EvalMap.Map2Vertex3.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Vertex3.Vorder; - break; - case GL_MAP2_VERTEX_4: - v[0] = (GLfloat) ctx->EvalMap.Map2Vertex4.Uorder; - v[1] = (GLfloat) ctx->EvalMap.Map2Vertex4.Vorder; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); - return; - } + if (map1d) { + v[0] = (GLfloat) map1d->Order; + } + else { + v[0] = (GLfloat) map2d->Uorder; + v[1] = (GLfloat) map2d->Vorder; + } break; case GL_DOMAIN: - switch (target) { - case GL_MAP1_COLOR_4: - v[0] = ctx->EvalMap.Map1Color4.u1; - v[1] = ctx->EvalMap.Map1Color4.u2; - break; - case GL_MAP1_INDEX: - v[0] = ctx->EvalMap.Map1Index.u1; - v[1] = ctx->EvalMap.Map1Index.u2; - break; - case GL_MAP1_NORMAL: - v[0] = ctx->EvalMap.Map1Normal.u1; - v[1] = ctx->EvalMap.Map1Normal.u2; - break; - case GL_MAP1_TEXTURE_COORD_1: - v[0] = ctx->EvalMap.Map1Texture1.u1; - v[1] = ctx->EvalMap.Map1Texture1.u2; - break; - case GL_MAP1_TEXTURE_COORD_2: - v[0] = ctx->EvalMap.Map1Texture2.u1; - v[1] = ctx->EvalMap.Map1Texture2.u2; - break; - case GL_MAP1_TEXTURE_COORD_3: - v[0] = ctx->EvalMap.Map1Texture3.u1; - v[1] = ctx->EvalMap.Map1Texture3.u2; - break; - case GL_MAP1_TEXTURE_COORD_4: - v[0] = ctx->EvalMap.Map1Texture4.u1; - v[1] = ctx->EvalMap.Map1Texture4.u2; - break; - case GL_MAP1_VERTEX_3: - v[0] = ctx->EvalMap.Map1Vertex3.u1; - v[1] = ctx->EvalMap.Map1Vertex3.u2; - break; - case GL_MAP1_VERTEX_4: - v[0] = ctx->EvalMap.Map1Vertex4.u1; - v[1] = ctx->EvalMap.Map1Vertex4.u2; - break; - case GL_MAP2_COLOR_4: - v[0] = ctx->EvalMap.Map2Color4.u1; - v[1] = ctx->EvalMap.Map2Color4.u2; - v[2] = ctx->EvalMap.Map2Color4.v1; - v[3] = ctx->EvalMap.Map2Color4.v2; - break; - case GL_MAP2_INDEX: - v[0] = ctx->EvalMap.Map2Index.u1; - v[1] = ctx->EvalMap.Map2Index.u2; - v[2] = ctx->EvalMap.Map2Index.v1; - v[3] = ctx->EvalMap.Map2Index.v2; - break; - case GL_MAP2_NORMAL: - v[0] = ctx->EvalMap.Map2Normal.u1; - v[1] = ctx->EvalMap.Map2Normal.u2; - v[2] = ctx->EvalMap.Map2Normal.v1; - v[3] = ctx->EvalMap.Map2Normal.v2; - break; - case GL_MAP2_TEXTURE_COORD_1: - v[0] = ctx->EvalMap.Map2Texture1.u1; - v[1] = ctx->EvalMap.Map2Texture1.u2; - v[2] = ctx->EvalMap.Map2Texture1.v1; - v[3] = ctx->EvalMap.Map2Texture1.v2; - break; - case GL_MAP2_TEXTURE_COORD_2: - v[0] = ctx->EvalMap.Map2Texture2.u1; - v[1] = ctx->EvalMap.Map2Texture2.u2; - v[2] = ctx->EvalMap.Map2Texture2.v1; - v[3] = ctx->EvalMap.Map2Texture2.v2; - break; - case GL_MAP2_TEXTURE_COORD_3: - v[0] = ctx->EvalMap.Map2Texture3.u1; - v[1] = ctx->EvalMap.Map2Texture3.u2; - v[2] = ctx->EvalMap.Map2Texture3.v1; - v[3] = ctx->EvalMap.Map2Texture3.v2; - break; - case GL_MAP2_TEXTURE_COORD_4: - v[0] = ctx->EvalMap.Map2Texture4.u1; - v[1] = ctx->EvalMap.Map2Texture4.u2; - v[2] = ctx->EvalMap.Map2Texture4.v1; - v[3] = ctx->EvalMap.Map2Texture4.v2; - break; - case GL_MAP2_VERTEX_3: - v[0] = ctx->EvalMap.Map2Vertex3.u1; - v[1] = ctx->EvalMap.Map2Vertex3.u2; - v[2] = ctx->EvalMap.Map2Vertex3.v1; - v[3] = ctx->EvalMap.Map2Vertex3.v2; - break; - case GL_MAP2_VERTEX_4: - v[0] = ctx->EvalMap.Map2Vertex4.u1; - v[1] = ctx->EvalMap.Map2Vertex4.u2; - v[2] = ctx->EvalMap.Map2Vertex4.v1; - v[3] = ctx->EvalMap.Map2Vertex4.v2; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(target)" ); - } + if (map1d) { + v[0] = map1d->u1; + v[1] = map1d->u2; + } + else { + v[0] = map2d->u1; + v[1] = map2d->u2; + v[2] = map2d->v1; + v[3] = map2d->v2; + } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapfv(query)" ); @@ -1035,98 +674,34 @@ void _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); + struct gl_1d_map *map1d; + struct gl_2d_map *map2d; GLuint i, n; GLfloat *data; + GLuint comps; + ASSERT_OUTSIDE_BEGIN_END(ctx); + comps = _mesa_evaluator_components(target); + if (!comps) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); + return; + } + + map1d = get_1d_map(ctx, target); + map2d = get_2d_map(ctx, target); + ASSERT(map1d || map2d); + switch (query) { case GL_COEFF: - switch (target) { - case GL_MAP1_COLOR_4: - data = ctx->EvalMap.Map1Color4.Points; - n = ctx->EvalMap.Map1Color4.Order * 4; - break; - case GL_MAP1_INDEX: - data = ctx->EvalMap.Map1Index.Points; - n = ctx->EvalMap.Map1Index.Order; - break; - case GL_MAP1_NORMAL: - data = ctx->EvalMap.Map1Normal.Points; - n = ctx->EvalMap.Map1Normal.Order * 3; - break; - case GL_MAP1_TEXTURE_COORD_1: - data = ctx->EvalMap.Map1Texture1.Points; - n = ctx->EvalMap.Map1Texture1.Order * 1; - break; - case GL_MAP1_TEXTURE_COORD_2: - data = ctx->EvalMap.Map1Texture2.Points; - n = ctx->EvalMap.Map1Texture2.Order * 2; - break; - case GL_MAP1_TEXTURE_COORD_3: - data = ctx->EvalMap.Map1Texture3.Points; - n = ctx->EvalMap.Map1Texture3.Order * 3; - break; - case GL_MAP1_TEXTURE_COORD_4: - data = ctx->EvalMap.Map1Texture4.Points; - n = ctx->EvalMap.Map1Texture4.Order * 4; - break; - case GL_MAP1_VERTEX_3: - data = ctx->EvalMap.Map1Vertex3.Points; - n = ctx->EvalMap.Map1Vertex3.Order * 3; - break; - case GL_MAP1_VERTEX_4: - data = ctx->EvalMap.Map1Vertex4.Points; - n = ctx->EvalMap.Map1Vertex4.Order * 4; - break; - case GL_MAP2_COLOR_4: - data = ctx->EvalMap.Map2Color4.Points; - n = ctx->EvalMap.Map2Color4.Uorder - * ctx->EvalMap.Map2Color4.Vorder * 4; - break; - case GL_MAP2_INDEX: - data = ctx->EvalMap.Map2Index.Points; - n = ctx->EvalMap.Map2Index.Uorder - * ctx->EvalMap.Map2Index.Vorder; - break; - case GL_MAP2_NORMAL: - data = ctx->EvalMap.Map2Normal.Points; - n = ctx->EvalMap.Map2Normal.Uorder - * ctx->EvalMap.Map2Normal.Vorder * 3; - break; - case GL_MAP2_TEXTURE_COORD_1: - data = ctx->EvalMap.Map2Texture1.Points; - n = ctx->EvalMap.Map2Texture1.Uorder - * ctx->EvalMap.Map2Texture1.Vorder * 1; - break; - case GL_MAP2_TEXTURE_COORD_2: - data = ctx->EvalMap.Map2Texture2.Points; - n = ctx->EvalMap.Map2Texture2.Uorder - * ctx->EvalMap.Map2Texture2.Vorder * 2; - break; - case GL_MAP2_TEXTURE_COORD_3: - data = ctx->EvalMap.Map2Texture3.Points; - n = ctx->EvalMap.Map2Texture3.Uorder - * ctx->EvalMap.Map2Texture3.Vorder * 3; - break; - case GL_MAP2_TEXTURE_COORD_4: - data = ctx->EvalMap.Map2Texture4.Points; - n = ctx->EvalMap.Map2Texture4.Uorder - * ctx->EvalMap.Map2Texture4.Vorder * 4; - break; - case GL_MAP2_VERTEX_3: - data = ctx->EvalMap.Map2Vertex3.Points; - n = ctx->EvalMap.Map2Vertex3.Uorder - * ctx->EvalMap.Map2Vertex3.Vorder * 3; - break; - case GL_MAP2_VERTEX_4: - data = ctx->EvalMap.Map2Vertex4.Points; - n = ctx->EvalMap.Map2Vertex4.Uorder - * ctx->EvalMap.Map2Vertex4.Vorder * 4; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); - return; - } + if (map1d) { + data = map1d->Points; + n = map1d->Order * comps; + } + else { + data = map2d->Points; + n = map2d->Uorder * map2d->Vorder * comps; + } if (data) { for (i=0;i<n;i++) { v[i] = ROUNDF(data[i]); @@ -1134,170 +709,25 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) } break; case GL_ORDER: - switch (target) { - case GL_MAP1_COLOR_4: - *v = ctx->EvalMap.Map1Color4.Order; - break; - case GL_MAP1_INDEX: - *v = ctx->EvalMap.Map1Index.Order; - break; - case GL_MAP1_NORMAL: - *v = ctx->EvalMap.Map1Normal.Order; - break; - case GL_MAP1_TEXTURE_COORD_1: - *v = ctx->EvalMap.Map1Texture1.Order; - break; - case GL_MAP1_TEXTURE_COORD_2: - *v = ctx->EvalMap.Map1Texture2.Order; - break; - case GL_MAP1_TEXTURE_COORD_3: - *v = ctx->EvalMap.Map1Texture3.Order; - break; - case GL_MAP1_TEXTURE_COORD_4: - *v = ctx->EvalMap.Map1Texture4.Order; - break; - case GL_MAP1_VERTEX_3: - *v = ctx->EvalMap.Map1Vertex3.Order; - break; - case GL_MAP1_VERTEX_4: - *v = ctx->EvalMap.Map1Vertex4.Order; - break; - case GL_MAP2_COLOR_4: - v[0] = ctx->EvalMap.Map2Color4.Uorder; - v[1] = ctx->EvalMap.Map2Color4.Vorder; - break; - case GL_MAP2_INDEX: - v[0] = ctx->EvalMap.Map2Index.Uorder; - v[1] = ctx->EvalMap.Map2Index.Vorder; - break; - case GL_MAP2_NORMAL: - v[0] = ctx->EvalMap.Map2Normal.Uorder; - v[1] = ctx->EvalMap.Map2Normal.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_1: - v[0] = ctx->EvalMap.Map2Texture1.Uorder; - v[1] = ctx->EvalMap.Map2Texture1.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_2: - v[0] = ctx->EvalMap.Map2Texture2.Uorder; - v[1] = ctx->EvalMap.Map2Texture2.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_3: - v[0] = ctx->EvalMap.Map2Texture3.Uorder; - v[1] = ctx->EvalMap.Map2Texture3.Vorder; - break; - case GL_MAP2_TEXTURE_COORD_4: - v[0] = ctx->EvalMap.Map2Texture4.Uorder; - v[1] = ctx->EvalMap.Map2Texture4.Vorder; - break; - case GL_MAP2_VERTEX_3: - v[0] = ctx->EvalMap.Map2Vertex3.Uorder; - v[1] = ctx->EvalMap.Map2Vertex3.Vorder; - break; - case GL_MAP2_VERTEX_4: - v[0] = ctx->EvalMap.Map2Vertex4.Uorder; - v[1] = ctx->EvalMap.Map2Vertex4.Vorder; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); - return; - } + if (map1d) { + v[0] = map1d->Order; + } + else { + v[0] = map2d->Uorder; + v[1] = map2d->Vorder; + } break; case GL_DOMAIN: - switch (target) { - case GL_MAP1_COLOR_4: - v[0] = ROUNDF(ctx->EvalMap.Map1Color4.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Color4.u2); - break; - case GL_MAP1_INDEX: - v[0] = ROUNDF(ctx->EvalMap.Map1Index.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Index.u2); - break; - case GL_MAP1_NORMAL: - v[0] = ROUNDF(ctx->EvalMap.Map1Normal.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Normal.u2); - break; - case GL_MAP1_TEXTURE_COORD_1: - v[0] = ROUNDF(ctx->EvalMap.Map1Texture1.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Texture1.u2); - break; - case GL_MAP1_TEXTURE_COORD_2: - v[0] = ROUNDF(ctx->EvalMap.Map1Texture2.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Texture2.u2); - break; - case GL_MAP1_TEXTURE_COORD_3: - v[0] = ROUNDF(ctx->EvalMap.Map1Texture3.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Texture3.u2); - break; - case GL_MAP1_TEXTURE_COORD_4: - v[0] = ROUNDF(ctx->EvalMap.Map1Texture4.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Texture4.u2); - break; - case GL_MAP1_VERTEX_3: - v[0] = ROUNDF(ctx->EvalMap.Map1Vertex3.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Vertex3.u2); - break; - case GL_MAP1_VERTEX_4: - v[0] = ROUNDF(ctx->EvalMap.Map1Vertex4.u1); - v[1] = ROUNDF(ctx->EvalMap.Map1Vertex4.u2); - break; - case GL_MAP2_COLOR_4: - v[0] = ROUNDF(ctx->EvalMap.Map2Color4.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Color4.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Color4.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Color4.v2); - break; - case GL_MAP2_INDEX: - v[0] = ROUNDF(ctx->EvalMap.Map2Index.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Index.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Index.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Index.v2); - break; - case GL_MAP2_NORMAL: - v[0] = ROUNDF(ctx->EvalMap.Map2Normal.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Normal.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Normal.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Normal.v2); - break; - case GL_MAP2_TEXTURE_COORD_1: - v[0] = ROUNDF(ctx->EvalMap.Map2Texture1.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Texture1.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Texture1.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Texture1.v2); - break; - case GL_MAP2_TEXTURE_COORD_2: - v[0] = ROUNDF(ctx->EvalMap.Map2Texture2.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Texture2.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Texture2.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Texture2.v2); - break; - case GL_MAP2_TEXTURE_COORD_3: - v[0] = ROUNDF(ctx->EvalMap.Map2Texture3.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Texture3.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Texture3.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Texture3.v2); - break; - case GL_MAP2_TEXTURE_COORD_4: - v[0] = ROUNDF(ctx->EvalMap.Map2Texture4.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Texture4.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Texture4.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Texture4.v2); - break; - case GL_MAP2_VERTEX_3: - v[0] = ROUNDF(ctx->EvalMap.Map2Vertex3.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Vertex3.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Vertex3.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Vertex3.v2); - break; - case GL_MAP2_VERTEX_4: - v[0] = ROUNDF(ctx->EvalMap.Map2Vertex4.u1); - v[1] = ROUNDF(ctx->EvalMap.Map2Vertex4.u2); - v[2] = ROUNDF(ctx->EvalMap.Map2Vertex4.v1); - v[3] = ROUNDF(ctx->EvalMap.Map2Vertex4.v2); - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(target)" ); - } + if (map1d) { + v[0] = ROUNDF(map1d->u1); + v[1] = ROUNDF(map1d->u2); + } + else { + v[0] = ROUNDF(map2d->u1); + v[1] = ROUNDF(map2d->u2); + v[2] = ROUNDF(map2d->v1); + v[3] = ROUNDF(map2d->v2); + } break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetMapiv(query)" ); diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c index b4ed8ed91..c61127490 100644 --- a/xc/extras/Mesa/src/extensions.c +++ b/xc/extras/Mesa/src/extensions.c @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,17 +22,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "extensions.h" -#include "mem.h" #include "simple_list.h" #include "mtypes.h" -#endif #define MAX_EXT_NAMELEN 80 @@ -55,17 +49,25 @@ static struct { const char *name; int flag_offset; } default_extensions[] = { + { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, { OFF, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, + { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) }, + { OFF, "GL_ARB_shadow", F(ARB_shadow) }, + { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) }, + { OFF, "GL_ARB_texture_env_crossbar", F(ARB_texture_env_crossbar) }, { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { ON, "GL_ARB_transpose_matrix", 0 }, + { ON, "GL_ARB_window_pos", F(ARB_window_pos) }, + { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)}, + { OFF, "GL_ATI_texture_env_combine3", F(ATI_texture_env_combine3)}, { ON, "GL_EXT_abgr", 0 }, { ON, "GL_EXT_bgra", 0 }, { OFF, "GL_EXT_blend_color", F(EXT_blend_color) }, @@ -74,19 +76,21 @@ static struct { { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, - { OFF, "GL_EXT_cull_vertex", 0 }, { OFF, "GL_EXT_convolution", F(EXT_convolution) }, { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, + { OFF, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, { OFF, "GL_EXT_point_parameters", F(EXT_point_parameters) }, { ON, "GL_EXT_polygon_offset", F(EXT_polygon_offset) }, { ON, "GL_EXT_rescale_normal", F(EXT_rescale_normal) }, { OFF, "GL_EXT_secondary_color", F(EXT_secondary_color) }, + { OFF, "GL_EXT_shadow_funcs", F(EXT_shadow_funcs) }, { OFF, "GL_EXT_shared_texture_palette", F(EXT_shared_texture_palette) }, { OFF, "GL_EXT_stencil_wrap", F(EXT_stencil_wrap) }, + { OFF, "GL_EXT_stencil_two_side", F(EXT_stencil_two_side) }, { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, { OFF, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, @@ -102,13 +106,17 @@ static struct { { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, { OFF, "GL_IBM_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, { OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) }, + { OFF, "GL_MESA_pack_invert", F(MESA_pack_invert) }, { OFF, "GL_MESA_packed_depth_stencil", 0 }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, - { OFF, "GL_MESA_sprite_point", F(MESA_sprite_point) }, + { OFF, "GL_MESA_ycbcr_texture", F(MESA_ycbcr_texture) }, { ON, "GL_MESA_window_pos", F(MESA_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, + { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, - { ON, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, + { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { OFF, "GL_SGI_color_matrix", F(SGI_color_matrix) }, { OFF, "GL_SGI_color_table", F(SGI_color_table) }, { OFF, "GL_SGIS_generate_mipmap", F(SGIS_generate_mipmap) }, @@ -119,7 +127,8 @@ static struct { { OFF, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) }, { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, - { OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) } + { OFF, "GL_3DFX_texture_compression_FXT1", F(TDFX_texture_compression_FXT1) }, + { OFF, "GL_APPLE_client_storage", F(APPLE_client_storage) } }; @@ -133,14 +142,21 @@ void _mesa_enable_sw_extensions(GLcontext *ctx) { const char *extensions[] = { + "GL_ARB_depth_texture", "GL_ARB_imaging", "GL_ARB_multitexture", + "GL_ARB_point_parameters", + "GL_ARB_shadow", + "GL_ARB_shadow_ambient", "GL_ARB_texture_border_clamp", "GL_ARB_texture_cube_map", "GL_ARB_texture_env_add", "GL_ARB_texture_env_combine", + "GL_ARB_texture_env_crossbar", "GL_ARB_texture_env_dot3", "GL_ARB_texture_mirrored_repeat", + "GL_ATI_texture_env_combine3", + "GL_ATI_texture_mirror_once", "GL_EXT_blend_color", "GL_EXT_blend_func_separate", "GL_EXT_blend_logic_op", @@ -151,9 +167,11 @@ _mesa_enable_sw_extensions(GLcontext *ctx) "GL_EXT_histogram", "GL_EXT_paletted_texture", "GL_EXT_point_parameters", + "GL_EXT_shadow_funcs", "GL_EXT_secondary_color", "GL_EXT_shared_texture_palette", "GL_EXT_stencil_wrap", + "GL_EXT_stencil_two_side", "GL_EXT_texture_edge_clamp", "GL_EXT_texture_env_add", "GL_EXT_texture_env_combine", @@ -162,12 +180,24 @@ _mesa_enable_sw_extensions(GLcontext *ctx) "GL_HP_occlusion_test", "GL_IBM_texture_mirrored_repeat", "GL_INGR_blend_func_separate", + "GL_MESA_pack_invert", "GL_MESA_resize_buffers", + "GL_MESA_ycbcr_texture", "GL_NV_blend_square", +#if FEATURE_NV_fragment_program + "GL_NV_fragment_program", +#endif + "GL_NV_light_max_exponent", + "GL_NV_point_sprite", "GL_NV_texgen_reflection", "GL_NV_texture_rectangle", +#if FEATURE_NV_vertex_program + "GL_NV_vertex_program", + "GL_NV_vertex_program1_1", +#endif "GL_SGI_color_matrix", "GL_SGI_color_table", + "GL_SGI_texture_color_table", "GL_SGIS_generate_mipmap", "GL_SGIS_pixel_texture", "GL_SGIS_texture_edge_clamp", @@ -240,6 +270,40 @@ _mesa_enable_1_3_extensions(GLcontext *ctx) /* + * Enable all OpenGL 1.4 features and extensions. + */ +void +_mesa_enable_1_4_extensions(GLcontext *ctx) +{ + const char *extensions[] = { + "GL_ARB_depth_texture", + "GL_ARB_point_parameters", + "GL_ARB_shadow", + "GL_ARB_texture_env_crossbar", + "GL_ARB_texture_mirrored_repeat", + "GL_ARB_window_pos", + "GL_EXT_blend_color", + "GL_EXT_blend_func_separate", + "GL_EXT_blend_logic_op", + "GL_EXT_blend_minmax", + "GL_EXT_blend_subtract", + "GL_EXT_fog_coord", + "GL_EXT_multi_draw_arrays", + "GL_EXT_secondary_color", + "GL_EXT_stencil_wrap", + "GL_SGIS_generate_mipmap", + NULL + }; + GLuint i; + + for (i = 0; extensions[i]; i++) { + _mesa_enable_extension(ctx, extensions[i]); + } +} + + + +/* * Add a new extenstion. This would be called from a Mesa driver. */ void @@ -256,7 +320,7 @@ _mesa_add_extension( GLcontext *ctx, { struct extension *t = MALLOC_STRUCT(extension); t->enabled = enabled; - strncpy(t->name, name, MAX_EXT_NAMELEN); + _mesa_strncpy(t->name, name, MAX_EXT_NAMELEN); t->name[MAX_EXT_NAMELEN] = 0; t->flag = flag_ptr; if (t->flag) @@ -278,7 +342,7 @@ set_extension( GLcontext *ctx, const char *name, GLint state ) */ struct extension *i; foreach( i, ctx->Extensions.ext_list ) - if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) + if (_mesa_strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) break; if (i == ctx->Extensions.ext_list) { @@ -320,7 +384,7 @@ _mesa_extension_is_enabled( GLcontext *ctx, const char *name) { struct extension *i; foreach( i, ctx->Extensions.ext_list ) - if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) { + if (_mesa_strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) { if (i->enabled) return GL_TRUE; else @@ -387,18 +451,18 @@ _mesa_extensions_get_string( GLcontext *ctx ) GLuint len = 0; foreach (i, ctx->Extensions.ext_list) if (i->enabled) - len += strlen(i->name) + 1; + len += _mesa_strlen(i->name) + 1; if (len == 0) return ""; - str = (char *)MALLOC(len * sizeof(char)); + str = (char *) _mesa_malloc(len * sizeof(char)); ctx->Extensions.ext_string = str; foreach (i, ctx->Extensions.ext_list) if (i->enabled) { - strcpy(str, i->name); - str += strlen(str); + _mesa_strcpy(str, i->name); + str += _mesa_strlen(str); *str++ = ' '; } diff --git a/xc/extras/Mesa/src/extensions.h b/xc/extras/Mesa/src/extensions.h index 79293852e..fee9d0d57 100644 --- a/xc/extras/Mesa/src/extensions.h +++ b/xc/extras/Mesa/src/extensions.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -36,6 +36,8 @@ extern void _mesa_enable_imaging_extensions(GLcontext *ctx); extern void _mesa_enable_1_3_extensions(GLcontext *ctx); +extern void _mesa_enable_1_4_extensions(GLcontext *ctx); + extern void _mesa_add_extension( GLcontext *ctx, GLboolean enabled, const char *name, GLboolean *flag_ptr ); diff --git a/xc/extras/Mesa/src/feedback.c b/xc/extras/Mesa/src/feedback.c index 8d88b7a81..bcb4d4b4a 100644 --- a/xc/extras/Mesa/src/feedback.c +++ b/xc/extras/Mesa/src/feedback.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" @@ -35,7 +32,6 @@ #include "macros.h" #include "mmath.h" #include "mtypes.h" -#endif @@ -339,7 +335,7 @@ _mesa_RenderMode( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode)); FLUSH_VERTICES(ctx, _NEW_RENDERMODE); diff --git a/xc/extras/Mesa/src/fog.c b/xc/extras/Mesa/src/fog.c index caa84298f..8a65ffaed 100644 --- a/xc/extras/Mesa/src/fog.c +++ b/xc/extras/Mesa/src/fog.c @@ -24,15 +24,11 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "fog.h" #include "mtypes.h" -#endif diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index 9acefb053..36eeb9e07 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" @@ -37,9 +34,8 @@ #include "macros.h" #include "mmath.h" #include "mtypes.h" - +#include "texcompress.h" #include "math/m_matrix.h" -#endif @@ -58,43 +54,39 @@ #endif - /* Check if named extension is enabled, if not generate error and return */ #define CHECK_EXTENSION_B(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char message[100]; \ - sprintf(message, "glGetBooleanv(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, message); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetBooleanv(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_I(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char message[100]; \ - sprintf(message, "glGetIntegerv(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, message); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetIntegerv(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_F(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char message[100]; \ - sprintf(message, "glGetFloatv(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, message); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetFloatv(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_D(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char message[100]; \ - sprintf(message, "glGetDoublev(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, message); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetDoublev(0x%x)", (int) PNAME); \ return; \ } + static GLenum pixel_texgen_mode(const GLcontext *ctx) { @@ -135,7 +127,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname)); + _mesa_debug(ctx, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname)); if (ctx->Driver.GetBooleanv && (*ctx->Driver.GetBooleanv)(ctx, pname, params)) @@ -176,7 +168,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->Color.AlphaFunc); break; case GL_ALPHA_TEST_REF: - *params = FLOAT_TO_BOOL((GLfloat) ctx->Color.AlphaRef / CHAN_MAXF); + *params = ctx->Color.AlphaRef ? GL_TRUE : GL_FALSE; break; case GL_ATTRIB_STACK_DEPTH: *params = INT_TO_BOOL(ctx->AttribStackDepth); @@ -235,7 +227,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - *params = ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0]; + if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) + *params = GL_TRUE; + else + *params = GL_FALSE; break; case GL_COLOR_CLEAR_VALUE: params[0] = ctx->Color.ClearColor[0] ? GL_TRUE : GL_FALSE; @@ -266,10 +261,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOL(ctx->Current.Color[0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.Color[1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.Color[2]); - params[3] = FLOAT_TO_BOOL(ctx->Current.Color[3]); + params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); + params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -277,9 +272,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]); + params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_BOOL(ctx->Current.RasterColor[0]); @@ -300,20 +295,20 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[3] = FLOAT_TO_BOOL(ctx->Current.RasterPos[3]); break; case GL_CURRENT_RASTER_TEXTURE_COORDS: - params[0] = FLOAT_TO_BOOL(ctx->Current.RasterMultiTexCoord[texUnit][0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.RasterMultiTexCoord[texUnit][1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.RasterMultiTexCoord[texUnit][2]); - params[3] = FLOAT_TO_BOOL(ctx->Current.RasterMultiTexCoord[texUnit][3]); + params[0] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][2]); + params[3] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoords[texUnit][3]); break; case GL_CURRENT_RASTER_POSITION_VALID: *params = ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][0]); - params[1] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][1]); - params[2] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][2]); - params[3] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texUnit][3]); + params[0] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]); + params[1] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]); + params[2] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]); + params[3] = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]); break; case GL_DEPTH_BIAS: *params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias); @@ -398,15 +393,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_GREEN_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram) { - *params = ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } - break; case GL_INDEX_BITS: *params = INT_TO_BOOL( ctx->Visual.indexBits ); break; @@ -630,16 +616,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = INT_TO_BOOL(MAX_WIDTH); params[1] = INT_TO_BOOL(MAX_HEIGHT); break; - case GL_MINMAX: - *params = ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { - params[i] = FLOAT_TO_BOOL(ctx->ModelView.m[i]); + params[i] = FLOAT_TO_BOOL(ctx->ModelviewMatrixStack.Top->m[i]); } break; case GL_MODELVIEW_STACK_DEPTH: - *params = INT_TO_BOOL(ctx->ModelViewStackDepth + 1); + *params = INT_TO_BOOL(ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: *params = INT_TO_BOOL(ctx->Select.NameStackDepth); @@ -671,6 +654,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection); break; @@ -762,11 +748,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_PROJECTION_MATRIX: for (i=0;i<16;i++) { - params[i] = FLOAT_TO_BOOL(ctx->ProjectionMatrix.m[i]); + params[i] = FLOAT_TO_BOOL(ctx->ProjectionMatrixStack.Top->m[i]); } break; case GL_PROJECTION_STACK_DEPTH: - *params = INT_TO_BOOL(ctx->ProjectionStackDepth + 1); + *params = INT_TO_BOOL(ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: *params = ENUM_TO_BOOL(ctx->Pixel.ReadBuffer); @@ -814,28 +800,28 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Stencil.Clear); break; case GL_STENCIL_FAIL: - *params = ENUM_TO_BOOL(ctx->Stencil.FailFunc); + *params = ENUM_TO_BOOL(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_FUNC: - *params = ENUM_TO_BOOL(ctx->Stencil.Function); + *params = ENUM_TO_BOOL(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_FAIL: - *params = ENUM_TO_BOOL(ctx->Stencil.ZFailFunc); + *params = ENUM_TO_BOOL(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_PASS: - *params = ENUM_TO_BOOL(ctx->Stencil.ZPassFunc); + *params = ENUM_TO_BOOL(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: - *params = INT_TO_BOOL(ctx->Stencil.Ref); + *params = INT_TO_BOOL(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_TEST: *params = ctx->Stencil.Enabled; break; case GL_STENCIL_VALUE_MASK: - *params = INT_TO_BOOL(ctx->Stencil.ValueMask); + *params = INT_TO_BOOL(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_WRITEMASK: - *params = INT_TO_BOOL(ctx->Stencil.WriteMask); + *params = INT_TO_BOOL(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); break; case GL_STEREO: *params = ctx->Visual.stereoMode; @@ -887,11 +873,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_TEXTURE_MATRIX: for (i=0;i<16;i++) { params[i] = - FLOAT_TO_BOOL(ctx->TextureMatrix[texUnit].m[i]); + FLOAT_TO_BOOL(ctx->TextureMatrixStack[texUnit].Top->m[i]); } break; case GL_TEXTURE_STACK_DEPTH: - *params = INT_TO_BOOL(ctx->TextureStackDepth[texUnit] + 1); + *params = INT_TO_BOOL(ctx->TextureMatrixStack[texUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: *params = INT_TO_BOOL(ctx->Unpack.Alignment); @@ -917,6 +903,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_UNPACK_IMAGE_HEIGHT_EXT: *params = ctx->Unpack.ImageHeight; break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + *params = ctx->Unpack.ClientStorage; + break; case GL_VIEWPORT: params[0] = INT_TO_BOOL(ctx->Viewport.X); params[1] = INT_TO_BOOL(ctx->Viewport.Y); @@ -1010,58 +999,50 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: - *params = ctx->Const.MaxTextureUnits; + CHECK_EXTENSION_B(ARB_multitexture, pname); + *params = INT_TO_BOOL(ctx->Const.MaxTextureUnits); break; case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_B(ARB_multitexture, pname); *params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_B(ARB_multitexture, pname); *params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; + CHECK_EXTENSION_B(ARB_texture_cube_map, pname); + *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; + CHECK_EXTENSION_B(ARB_texture_cube_map, pname); + *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = INT_TO_BOOL(1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + CHECK_EXTENSION_B(ARB_texture_cube_map, pname); + *params = INT_TO_BOOL(1 << (ctx->Const.MaxCubeTextureLevels - 1)); break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = INT_TO_BOOL(ctx->Hint.TextureCompression); - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + CHECK_EXTENSION_B(ARB_texture_compression, pname); + *params = INT_TO_BOOL(ctx->Hint.TextureCompression); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + CHECK_EXTENSION_B(ARB_texture_compression, pname); + *params = INT_TO_BOOL(_mesa_get_compressed_formats(ctx, NULL)); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - GLuint i; - for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) - params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]); + CHECK_EXTENSION_B(ARB_texture_compression, pname); + { + GLint formats[100]; + GLuint i, n; + n = _mesa_get_compressed_formats(ctx, formats); + for (i = 0; i < n; i++) + params[i] = INT_TO_BOOL(formats[i]); } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); break; /* GL_EXT_compiled_vertex_array */ @@ -1077,7 +1058,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ColorMatrix.m); + _math_transposef(tm, ctx->ColorMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1087,7 +1068,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ModelView.m); + _math_transposef(tm, ctx->ModelviewMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1097,7 +1078,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ProjectionMatrix.m); + _math_transposef(tm, ctx->ProjectionMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1107,7 +1088,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->TextureMatrix[texUnit].m); + _math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m); for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(tm[i]); } @@ -1116,26 +1097,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - } + CHECK_EXTENSION_B(HP_occlusion_test, pname); + *params = ctx->Depth.OcclusionTest; return; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = ctx->OcclusionResult; - else - *params = ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - } + CHECK_EXTENSION_B(HP_occlusion_test, pname); + if (ctx->Depth.OcclusionTest) + *params = ctx->OcclusionResult; + else + *params = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; return; /* GL_SGIS_pixel_texture */ @@ -1154,11 +1127,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_SGI_color_matrix (also in 1.2 imaging) */ case GL_COLOR_MATRIX_SGI: for (i=0;i<16;i++) { - params[i] = FLOAT_TO_BOOL(ctx->ColorMatrix.m[i]); + params[i] = FLOAT_TO_BOOL(ctx->ColorMatrixStack.Top->m[i]); } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - *params = INT_TO_BOOL(ctx->ColorStackDepth + 1); + *params = INT_TO_BOOL(ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: *params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH); @@ -1190,57 +1163,60 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = ctx->Pixel.Convolution1DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(EXT_convolution, pname); + *params = ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = ctx->Pixel.Convolution2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(EXT_convolution, pname); + *params = ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = ctx->Pixel.Separable2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(EXT_convolution, pname); + *params = ctx->Pixel.Separable2DEnabled; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]); break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[1]); break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[2]); break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[3]); break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[0]); break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[1]); break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_B(EXT_convolution, pname); *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_B(EXT_histogram, pname); + *params = ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_B(EXT_histogram, pname); + *params = ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: *params = ctx->Pixel.ColorTableEnabled; @@ -1254,39 +1230,49 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); *params = ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); FLUSH_CURRENT(ctx, 0); - params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]); - params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]); - params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]); + params[0] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); + params[1] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); + params[2] = INT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); *params = ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); *params = ENUM_TO_BOOL(ctx->Array.SecondaryColor.Type); break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_B(EXT_secondary_color, pname); *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride); break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); FLUSH_CURRENT(ctx, 0); - *params = FLOAT_TO_BOOL(ctx->Current.FogCoord); + *params = FLOAT_TO_BOOL(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); break; case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); *params = ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); *params = ENUM_TO_BOOL(ctx->Array.FogCoord.Type); break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_B(EXT_fog_coord, pname); *params = INT_TO_BOOL(ctx->Array.FogCoord.Stride); break; @@ -1297,121 +1283,170 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureMaxAnisotropy); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - return; - } + CHECK_EXTENSION_B(EXT_texture_filter_anisotropic, pname); + *params = FLOAT_TO_BOOL(ctx->Const.MaxTextureMaxAnisotropy); break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue); break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = 0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; - } + CHECK_EXTENSION_B(ARB_multisample, pname); + *params = 0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBoolean"); - return; - } + CHECK_EXTENSION_B(IBM_rasterpos_clip, pname); + *params = ctx->Transform.RasterPositionUnclipped; break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); - return; - } + /* GL_NV_point_sprite */ + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = ctx->Point.PointSprite; + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = ENUM_TO_BOOL(ctx->Point.SpriteRMode); break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = ENUM_TO_BOOL(ctx->Hint.GenerateMipmap); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); - return; + CHECK_EXTENSION_B(SGIS_generate_mipmap, pname); + *params = ENUM_TO_BOOL(ctx->Hint.GenerateMipmap); + break; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = ctx->VertexProgram.Enabled; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = ctx->VertexProgram.PointSizeEnabled; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = ctx->VertexProgram.TwoSideEnabled; + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = (MAX_PROGRAM_STACK_DEPTH > 0) ? GL_TRUE : GL_FALSE; + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = (MAX_PROGRAM_MATRICES > 0) ? GL_TRUE : GL_FALSE; + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = (ctx->CurrentStack->Depth > 0) ? GL_TRUE : GL_FALSE; + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = (ctx->Transform.MatrixMode != 0) ? GL_TRUE : GL_FALSE; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = (ctx->VertexProgram.CurrentID != 0) ? GL_TRUE : GL_FALSE; + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + *params = (ctx->VertexProgram.ErrorPos != 0) ? GL_TRUE : GL_FALSE; + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; + *params = ctx->Array.VertexAttrib[n].Enabled; + } + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; + *params = ctx->Eval.Map1Attrib[n]; + } + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; + *params = ctx->Eval.Map2Attrib[n]; } break; +#endif /* FEATURE_NV_vertex_program */ /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: @@ -1427,8 +1462,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Const.MaxTextureRectSize); break; + /* GL_EXT_stencil_two_side */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_B(EXT_stencil_two_side, pname); + *params = ctx->Stencil.TestTwoSide; + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_B(EXT_stencil_two_side, pname); + *params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; + default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } } @@ -1451,7 +1496,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname)); + _mesa_debug(ctx, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname)); if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params)) return; @@ -1491,7 +1536,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = ENUM_TO_DOUBLE(ctx->Color.AlphaFunc); break; case GL_ALPHA_TEST_REF: - *params = (GLdouble) ctx->Color.AlphaRef / CHAN_MAXF; + *params = (GLdouble) ctx->Color.AlphaRef; break; case GL_ATTRIB_STACK_DEPTH: *params = (GLdouble ) (ctx->AttribStackDepth); @@ -1550,13 +1595,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - *params = (GLdouble) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0]; + if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) + *params = 1.0; + else + *params = 0.0; break; case GL_COLOR_CLEAR_VALUE: - params[0] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[0]); - params[1] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[1]); - params[2] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[2]); - params[3] = (GLdouble) CHAN_TO_FLOAT(ctx->Color.ClearColor[3]); + params[0] = (GLdouble) ctx->Color.ClearColor[0]; + params[1] = (GLdouble) ctx->Color.ClearColor[1]; + params[2] = (GLdouble) ctx->Color.ClearColor[2]; + params[3] = (GLdouble) ctx->Color.ClearColor[3]; break; case GL_COLOR_MATERIAL: *params = (GLdouble) ctx->Light.ColorMaterialEnabled; @@ -1581,10 +1629,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.Color[0]); - params[1] = (ctx->Current.Color[1]); - params[2] = (ctx->Current.Color[2]); - params[3] = (ctx->Current.Color[3]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -1592,9 +1640,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = (GLdouble) ctx->Current.Normal[0]; - params[1] = (GLdouble) ctx->Current.Normal[1]; - params[2] = (GLdouble) ctx->Current.Normal[2]; + params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; + params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; + params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; break; case GL_CURRENT_RASTER_COLOR: params[0] = (GLdouble) ctx->Current.RasterColor[0]; @@ -1615,20 +1663,20 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) params[3] = (GLdouble) ctx->Current.RasterPos[3]; break; case GL_CURRENT_RASTER_TEXTURE_COORDS: - params[0] = (GLdouble) ctx->Current.RasterMultiTexCoord[texUnit][0]; - params[1] = (GLdouble) ctx->Current.RasterMultiTexCoord[texUnit][1]; - params[2] = (GLdouble) ctx->Current.RasterMultiTexCoord[texUnit][2]; - params[3] = (GLdouble) ctx->Current.RasterMultiTexCoord[texUnit][3]; + params[0] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][0]; + params[1] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][1]; + params[2] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][2]; + params[3] = (GLdouble) ctx->Current.RasterTexCoords[texUnit][3]; break; case GL_CURRENT_RASTER_POSITION_VALID: *params = (GLdouble) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = (GLdouble) ctx->Current.Texcoord[texUnit][0]; - params[1] = (GLdouble) ctx->Current.Texcoord[texUnit][1]; - params[2] = (GLdouble) ctx->Current.Texcoord[texUnit][2]; - params[3] = (GLdouble) ctx->Current.Texcoord[texUnit][3]; + params[0] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; break; case GL_DEPTH_BIAS: *params = (GLdouble) ctx->Pixel.DepthBias; @@ -1713,15 +1761,6 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_GREEN_SCALE: *params = (GLdouble) ctx->Pixel.GreenScale; break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } - break; case GL_INDEX_BITS: *params = (GLdouble) ctx->Visual.indexBits; break; @@ -1945,16 +1984,13 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) params[0] = (GLdouble) MAX_WIDTH; params[1] = (GLdouble) MAX_HEIGHT; break; - case GL_MINMAX: - *params = (GLdouble) ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { - params[i] = (GLdouble) ctx->ModelView.m[i]; + params[i] = (GLdouble) ctx->ModelviewMatrixStack.Top->m[i]; } break; case GL_MODELVIEW_STACK_DEPTH: - *params = (GLdouble) (ctx->ModelViewStackDepth + 1); + *params = (GLdouble) (ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: *params = (GLdouble) ctx->Select.NameStackDepth; @@ -1986,6 +2022,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = (GLdouble) ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = (GLdouble) ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection); break; @@ -2077,11 +2116,11 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_PROJECTION_MATRIX: for (i=0;i<16;i++) { - params[i] = (GLdouble) ctx->ProjectionMatrix.m[i]; + params[i] = (GLdouble) ctx->ProjectionMatrixStack.Top->m[i]; } break; case GL_PROJECTION_STACK_DEPTH: - *params = (GLdouble) (ctx->ProjectionStackDepth + 1); + *params = (GLdouble) (ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: *params = ENUM_TO_DOUBLE(ctx->Pixel.ReadBuffer); @@ -2129,28 +2168,28 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Stencil.Clear; break; case GL_STENCIL_FAIL: - *params = ENUM_TO_DOUBLE(ctx->Stencil.FailFunc); + *params = ENUM_TO_DOUBLE(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_FUNC: - *params = ENUM_TO_DOUBLE(ctx->Stencil.Function); + *params = ENUM_TO_DOUBLE(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_FAIL: - *params = ENUM_TO_DOUBLE(ctx->Stencil.ZFailFunc); + *params = ENUM_TO_DOUBLE(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_PASS: - *params = ENUM_TO_DOUBLE(ctx->Stencil.ZPassFunc); + *params = ENUM_TO_DOUBLE(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: - *params = (GLdouble) ctx->Stencil.Ref; + *params = (GLdouble) ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_TEST: *params = (GLdouble) ctx->Stencil.Enabled; break; case GL_STENCIL_VALUE_MASK: - *params = (GLdouble) ctx->Stencil.ValueMask; + *params = (GLdouble) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_WRITEMASK: - *params = (GLdouble) ctx->Stencil.WriteMask; + *params = (GLdouble) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; break; case GL_STEREO: *params = (GLdouble) ctx->Visual.stereoMode; @@ -2199,11 +2238,11 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_TEXTURE_MATRIX: for (i=0;i<16;i++) { - params[i] = (GLdouble) ctx->TextureMatrix[texUnit].m[i]; + params[i] = (GLdouble) ctx->TextureMatrixStack[texUnit].Top->m[i]; } break; case GL_TEXTURE_STACK_DEPTH: - *params = (GLdouble) (ctx->TextureStackDepth[texUnit] + 1); + *params = (GLdouble) (ctx->TextureMatrixStack[texUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: *params = (GLdouble) ctx->Unpack.Alignment; @@ -2229,6 +2268,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_UNPACK_IMAGE_HEIGHT_EXT: *params = (GLdouble) ctx->Unpack.ImageHeight; break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + *params = (GLdouble) ctx->Unpack.ClientStorage; + break; case GL_VIEWPORT: params[0] = (GLdouble) ctx->Viewport.X; params[1] = (GLdouble) ctx->Viewport.Y; @@ -2322,58 +2364,50 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: + CHECK_EXTENSION_D(ARB_multitexture, pname); *params = (GLdouble) ctx->Const.MaxTextureUnits; break; case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_D(ARB_multitexture, pname); *params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_D(ARB_multitexture, pname); *params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(ARB_texture_cube_map, pname); + *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLdouble) textureUnit->CurrentCubeMap->Name; - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(ARB_texture_cube_map, pname); + *params = (GLdouble) textureUnit->CurrentCubeMap->Name; + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLdouble) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(ARB_texture_cube_map, pname); + *params = (GLdouble) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLdouble) ctx->Hint.TextureCompression; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + CHECK_EXTENSION_D(ARB_texture_compression, pname); + *params = (GLdouble) ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + CHECK_EXTENSION_D(ARB_texture_compression, pname); + *params = (GLdouble) _mesa_get_compressed_formats(ctx, NULL); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - GLuint i; - for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) - params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i]; + CHECK_EXTENSION_D(ARB_texture_compression, pname); + { + GLint formats[100]; + GLuint i, n; + n = _mesa_get_compressed_formats(ctx, formats); + for (i = 0; i < n; i++) + params[i] = (GLdouble) formats[i]; } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); break; /* GL_EXT_compiled_vertex_array */ @@ -2389,7 +2423,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ColorMatrix.m); + _math_transposef(tm, ctx->ColorMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2399,7 +2433,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ModelView.m); + _math_transposef(tm, ctx->ModelviewMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2409,7 +2443,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ProjectionMatrix.m); + _math_transposef(tm, ctx->ProjectionMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2419,7 +2453,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->TextureMatrix[texUnit].m); + _math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m); for (i=0;i<16;i++) { params[i] = (GLdouble) tm[i]; } @@ -2428,27 +2462,19 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = (GLdouble) ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - } - return; + CHECK_EXTENSION_D(HP_occlusion_test, pname); + *params = (GLdouble) ctx->Depth.OcclusionTest; + break; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = (GLdouble) ctx->OcclusionResult; - else - *params = (GLdouble) ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - } - return; + CHECK_EXTENSION_D(HP_occlusion_test, pname); + if (ctx->Depth.OcclusionTest) + *params = (GLdouble) ctx->OcclusionResult; + else + *params = (GLdouble) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: @@ -2466,11 +2492,11 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_SGI_color_matrix (also in 1.2 imaging) */ case GL_COLOR_MATRIX_SGI: for (i=0;i<16;i++) { - params[i] = (GLdouble) ctx->ColorMatrix.m[i]; + params[i] = (GLdouble) ctx->ColorMatrixStack.Top->m[i]; } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - *params = (GLdouble) (ctx->ColorStackDepth + 1); + *params = (GLdouble) (ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: *params = (GLdouble) MAX_COLOR_STACK_DEPTH; @@ -2502,57 +2528,60 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.Convolution1DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(EXT_convolution, pname); + *params = (GLdouble) ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.Convolution2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(EXT_convolution, pname); + *params = (GLdouble) ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLdouble) ctx->Pixel.Separable2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(EXT_convolution, pname); + *params = (GLdouble) ctx->Pixel.Separable2DEnabled; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_D(EXT_convolution, pname); *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_D(EXT_histogram, pname); + *params = (GLdouble) ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_D(EXT_histogram, pname); + *params = (GLdouble) ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: *params = (GLdouble) ctx->Pixel.ColorTableEnabled; @@ -2566,39 +2595,49 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_D(EXT_secondary_color, pname); *params = (GLdouble) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_D(EXT_secondary_color, pname); FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.SecondaryColor[0]); - params[1] = (ctx->Current.SecondaryColor[1]); - params[2] = (ctx->Current.SecondaryColor[2]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_D(EXT_secondary_color, pname); *params = (GLdouble) ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_D(EXT_secondary_color, pname); *params = (GLdouble) ctx->Array.SecondaryColor.Type; break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_D(EXT_secondary_color, pname); *params = (GLdouble) ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_D(EXT_secondary_color, pname); *params = (GLdouble) ctx->Array.SecondaryColor.Stride; break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_D(EXT_fog_coord, pname); FLUSH_CURRENT(ctx, 0); - *params = (GLdouble) ctx->Current.FogCoord; + *params = (GLdouble) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; break; case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_D(EXT_fog_coord, pname); *params = (GLdouble) ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_D(EXT_fog_coord, pname); *params = (GLdouble) ctx->Array.FogCoord.Type; break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_D(EXT_fog_coord, pname); *params = (GLdouble) ctx->Array.FogCoord.Stride; break; @@ -2609,121 +2648,170 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = (GLdouble) ctx->Const.MaxTextureMaxAnisotropy; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - return; - } + CHECK_EXTENSION_D(EXT_texture_filter_anisotropic, pname); + *params = (GLdouble) ctx->Const.MaxTextureMaxAnisotropy; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = (GLdouble) ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = (GLdouble) ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = (GLdouble) ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverageValue; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLdouble) ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = (GLdouble) ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = 0.0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(ARB_multisample, pname); + *params = 0.0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = (GLdouble) ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; - } + CHECK_EXTENSION_D(IBM_rasterpos_clip, pname); + *params = (GLdouble) ctx->Transform.RasterPositionUnclipped; break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLdouble) ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); - return; - } + /* GL_NV_point_sprite */ + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = (GLdouble) ctx->Point.PointSprite; + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = (GLdouble) ctx->Point.SpriteRMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLdouble) ctx->Hint.GenerateMipmap; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); - return; + CHECK_EXTENSION_D(SGIS_generate_mipmap, pname); + *params = (GLdouble) ctx->Hint.GenerateMipmap; + break; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->VertexProgram.Enabled; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->VertexProgram.PointSizeEnabled; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->VertexProgram.TwoSideEnabled; + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) MAX_PROGRAM_STACK_DEPTH; + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) MAX_PROGRAM_MATRICES; + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->CurrentStack->Depth; + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->Transform.MatrixMode; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->VertexProgram.CurrentID; + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + *params = (GLdouble) ctx->VertexProgram.ErrorPos; + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_D(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; + *params = (GLdouble) ctx->Array.VertexAttrib[n].Enabled; + } + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; + *params = (GLdouble) ctx->Eval.Map1Attrib[n]; + } + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; + *params = (GLdouble) ctx->Eval.Map2Attrib[n]; } break; +#endif /* FEATURE_NV_vertex_program */ /* GL_NV_texture_rectangle */ case GL_TEXTURE_RECTANGLE_NV: @@ -2739,19 +2827,22 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Const.MaxTextureRectSize; break; + /* GL_EXT_stencil_two_side */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_D(EXT_stencil_two_side, pname); + *params = (GLdouble) ctx->Stencil.TestTwoSide; + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_D(EXT_stencil_two_side, pname); + *params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; + default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname); } } -#define GET_FLOAT_ERROR \ -{ \ - char s[100]; \ - sprintf(s, "glGetFloatv(0x%x)", pname); \ - _mesa_error(ctx, GL_INVALID_ENUM, s); \ -} - void _mesa_GetFloatv( GLenum pname, GLfloat *params ) { @@ -2770,7 +2861,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname)); + _mesa_debug(ctx, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname)); if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params)) return; @@ -2810,7 +2901,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ENUM_TO_FLOAT(ctx->Color.AlphaFunc); break; case GL_ALPHA_TEST_REF: - *params = (GLfloat) ctx->Color.AlphaRef / CHAN_MAXF; + *params = (GLfloat) ctx->Color.AlphaRef; break; case GL_ATTRIB_STACK_DEPTH: *params = (GLfloat) (ctx->AttribStackDepth); @@ -2869,13 +2960,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - *params = (GLfloat) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0]; + if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) + *params = 1.0; + else + *params = 0.0; break; case GL_COLOR_CLEAR_VALUE: - params[0] = CHAN_TO_FLOAT(ctx->Color.ClearColor[0]); - params[1] = CHAN_TO_FLOAT(ctx->Color.ClearColor[1]); - params[2] = CHAN_TO_FLOAT(ctx->Color.ClearColor[2]); - params[3] = CHAN_TO_FLOAT(ctx->Color.ClearColor[3]); + params[0] = ctx->Color.ClearColor[0]; + params[1] = ctx->Color.ClearColor[1]; + params[2] = ctx->Color.ClearColor[2]; + params[3] = ctx->Color.ClearColor[3]; break; case GL_COLOR_MATERIAL: *params = (GLfloat) ctx->Light.ColorMaterialEnabled; @@ -2900,10 +2994,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.Color[0]); - params[1] = (ctx->Current.Color[1]); - params[2] = (ctx->Current.Color[2]); - params[3] = (ctx->Current.Color[3]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; + params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -2911,9 +3005,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Normal[0]; - params[1] = ctx->Current.Normal[1]; - params[2] = ctx->Current.Normal[2]; + params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; break; case GL_CURRENT_RASTER_COLOR: params[0] = ctx->Current.RasterColor[0]; @@ -2934,20 +3028,20 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[3] = ctx->Current.RasterPos[3]; break; case GL_CURRENT_RASTER_TEXTURE_COORDS: - params[0] = ctx->Current.RasterMultiTexCoord[texUnit][0]; - params[1] = ctx->Current.RasterMultiTexCoord[texUnit][1]; - params[2] = ctx->Current.RasterMultiTexCoord[texUnit][2]; - params[3] = ctx->Current.RasterMultiTexCoord[texUnit][3]; + params[0] = ctx->Current.RasterTexCoords[texUnit][0]; + params[1] = ctx->Current.RasterTexCoords[texUnit][1]; + params[2] = ctx->Current.RasterTexCoords[texUnit][2]; + params[3] = ctx->Current.RasterTexCoords[texUnit][3]; break; case GL_CURRENT_RASTER_POSITION_VALID: *params = (GLfloat) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = (GLfloat) ctx->Current.Texcoord[texUnit][0]; - params[1] = (GLfloat) ctx->Current.Texcoord[texUnit][1]; - params[2] = (GLfloat) ctx->Current.Texcoord[texUnit][2]; - params[3] = (GLfloat) ctx->Current.Texcoord[texUnit][3]; + params[0] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; break; case GL_DEPTH_BIAS: *params = (GLfloat) ctx->Pixel.DepthBias; @@ -3032,15 +3126,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_GREEN_SCALE: *params = (GLfloat) ctx->Pixel.GreenScale; break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.HistogramEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } - break; case GL_INDEX_BITS: *params = (GLfloat) ctx->Visual.indexBits; break; @@ -3264,16 +3349,13 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat) MAX_WIDTH; params[1] = (GLfloat) MAX_HEIGHT; break; - case GL_MINMAX: - *params = (GLfloat) ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { - params[i] = ctx->ModelView.m[i]; + params[i] = ctx->ModelviewMatrixStack.Top->m[i]; } break; case GL_MODELVIEW_STACK_DEPTH: - *params = (GLfloat) (ctx->ModelViewStackDepth + 1); + *params = (GLfloat) (ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: *params = (GLfloat) ctx->Select.NameStackDepth; @@ -3305,6 +3387,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = (GLfloat) ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = (GLfloat) ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); break; @@ -3398,11 +3483,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_PROJECTION_MATRIX: for (i=0;i<16;i++) { - params[i] = ctx->ProjectionMatrix.m[i]; + params[i] = ctx->ProjectionMatrixStack.Top->m[i]; } break; case GL_PROJECTION_STACK_DEPTH: - *params = (GLfloat) (ctx->ProjectionStackDepth + 1); + *params = (GLfloat) (ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: *params = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer); @@ -3450,28 +3535,28 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Stencil.Clear; break; case GL_STENCIL_FAIL: - *params = ENUM_TO_FLOAT(ctx->Stencil.FailFunc); + *params = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_FUNC: - *params = ENUM_TO_FLOAT(ctx->Stencil.Function); + *params = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_FAIL: - *params = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc); + *params = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_PASS_DEPTH_PASS: - *params = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc); + *params = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: - *params = (GLfloat) ctx->Stencil.Ref; + *params = (GLfloat) ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_TEST: *params = (GLfloat) ctx->Stencil.Enabled; break; case GL_STENCIL_VALUE_MASK: - *params = (GLfloat) ctx->Stencil.ValueMask; + *params = (GLfloat) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_WRITEMASK: - *params = (GLfloat) ctx->Stencil.WriteMask; + *params = (GLfloat) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; break; case GL_STEREO: *params = (GLfloat) ctx->Visual.stereoMode; @@ -3520,11 +3605,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_TEXTURE_MATRIX: for (i=0;i<16;i++) { - params[i] = ctx->TextureMatrix[texUnit].m[i]; + params[i] = ctx->TextureMatrixStack[texUnit].Top->m[i]; } break; case GL_TEXTURE_STACK_DEPTH: - *params = (GLfloat) (ctx->TextureStackDepth[texUnit] + 1); + *params = (GLfloat) (ctx->TextureMatrixStack[texUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: *params = (GLfloat) ctx->Unpack.Alignment; @@ -3550,6 +3635,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_UNPACK_IMAGE_HEIGHT_EXT: *params = (GLfloat) ctx->Unpack.ImageHeight; break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + *params = (GLfloat) ctx->Unpack.ClientStorage; + break; case GL_VIEWPORT: params[0] = (GLfloat) ctx->Viewport.X; params[1] = (GLfloat) ctx->Viewport.Y; @@ -3643,105 +3731,91 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: + CHECK_EXTENSION_F(ARB_multitexture, pname); *params = (GLfloat) ctx->Const.MaxTextureUnits; break; case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_F(ARB_multitexture, pname); *params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_F(ARB_multitexture, pname); *params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(ARB_texture_cube_map, pname); + *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLfloat) textureUnit->CurrentCubeMap->Name; - else - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(ARB_texture_cube_map, pname); + *params = (GLfloat) textureUnit->CurrentCubeMap->Name; + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLfloat) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(ARB_texture_cube_map, pname); + *params = (GLfloat) (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLfloat) ctx->Hint.TextureCompression; - } - else - GET_FLOAT_ERROR; + CHECK_EXTENSION_F(ARB_texture_compression, pname); + *params = (GLfloat) ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; - } - else - GET_FLOAT_ERROR; + CHECK_EXTENSION_F(ARB_texture_compression, pname); + *params = (GLfloat) _mesa_get_compressed_formats(ctx, NULL); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - GLuint i; - for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) - params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i]; + CHECK_EXTENSION_F(ARB_texture_compression, pname); + { + GLint formats[100]; + GLuint i, n; + n = _mesa_get_compressed_formats(ctx, formats); + for (i = 0; i < n; i++) + params[i] = (GLfloat) formats[i]; } - else - GET_FLOAT_ERROR; break; /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); *params = (GLfloat) ctx->Array.LockFirst; break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_F(EXT_compiled_vertex_array, pname); *params = (GLfloat) ctx->Array.LockCount; break; /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - _math_transposef(params, ctx->ColorMatrix.m); + _math_transposef(params, ctx->ColorMatrixStack.Top->m); break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - _math_transposef(params, ctx->ModelView.m); + _math_transposef(params, ctx->ModelviewMatrixStack.Top->m); break; case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - _math_transposef(params, ctx->ProjectionMatrix.m); + _math_transposef(params, ctx->ProjectionMatrixStack.Top->m); break; case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - _math_transposef(params, ctx->TextureMatrix[texUnit].m); + _math_transposef(params, ctx->TextureMatrixStack[texUnit].Top->m); break; /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = (GLfloat) ctx->Depth.OcclusionTest; - } - else { - GET_FLOAT_ERROR; - } - return; + CHECK_EXTENSION_F(HP_occlusion_test, pname); + *params = (GLfloat) ctx->Depth.OcclusionTest; + break; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = (GLfloat) ctx->OcclusionResult; - else - *params = (GLfloat) ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - GET_FLOAT_ERROR; - } - return; + CHECK_EXTENSION_F(HP_occlusion_test, pname); + if (ctx->Depth.OcclusionTest) + *params = (GLfloat) ctx->OcclusionResult; + else + *params = (GLfloat) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: @@ -3759,11 +3833,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_SGI_color_matrix (also in 1.2 imaging) */ case GL_COLOR_MATRIX_SGI: for (i=0;i<16;i++) { - params[i] = ctx->ColorMatrix.m[i]; + params[i] = ctx->ColorMatrixStack.Top->m[i]; } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - *params = (GLfloat) (ctx->ColorStackDepth + 1); + *params = (GLfloat) (ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: *params = (GLfloat) MAX_COLOR_STACK_DEPTH; @@ -3795,57 +3869,60 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.Convolution1DEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_convolution, pname); + *params = (GLfloat) ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.Convolution2DEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_convolution, pname); + *params = (GLfloat) ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLfloat) ctx->Pixel.Separable2DEnabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_convolution, pname); + *params = (GLfloat) ctx->Pixel.Separable2DEnabled; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_F(EXT_convolution, pname); *params = ctx->Pixel.PostConvolutionBias[2]; break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_F(EXT_histogram, pname); + *params = (GLfloat) ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_F(EXT_histogram, pname); + *params = (GLfloat) ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: *params = (GLfloat) ctx->Pixel.ColorTableEnabled; @@ -3859,39 +3936,49 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); *params = (GLfloat) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.SecondaryColor[0]); - params[1] = (ctx->Current.SecondaryColor[1]); - params[2] = (ctx->Current.SecondaryColor[2]); + params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; + params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; + params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); *params = (GLfloat) ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); *params = (GLfloat) ctx->Array.SecondaryColor.Type; break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); *params = (GLfloat) ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_F(EXT_secondary_color, pname); *params = (GLfloat) ctx->Array.SecondaryColor.Stride; break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); FLUSH_CURRENT(ctx, 0); - *params = (GLfloat) ctx->Current.FogCoord; + *params = (GLfloat) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; break; case GL_FOG_COORDINATE_ARRAY_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); *params = (GLfloat) ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); *params = (GLfloat) ctx->Array.FogCoord.Type; break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_F(EXT_fog_coord, pname); *params = (GLfloat) ctx->Array.FogCoord.Stride; break; @@ -3902,119 +3989,167 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = ctx->Const.MaxTextureMaxAnisotropy; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(EXT_texture_filter_anisotropic, pname); + *params = ctx->Const.MaxTextureMaxAnisotropy; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.Enabled; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = (GLfloat) ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleAlphaToOne; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = (GLfloat) ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleCoverage; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = (GLfloat) ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = ctx->Multisample.SampleCoverageValue; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLfloat) ctx->Multisample.SampleCoverageInvert; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = (GLfloat) ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = 0.0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0.0; /* XXX fix someday */ - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(ARB_multisample, pname); + *params = 0.0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = (GLfloat) ctx->Transform.RasterPositionUnclipped; - } - else { - GET_FLOAT_ERROR; - return; - } + CHECK_EXTENSION_F(IBM_rasterpos_clip, pname); + *params = (GLfloat) ctx->Transform.RasterPositionUnclipped; break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLfloat) ctx->Point.SpriteMode; - } - else { - GET_FLOAT_ERROR; - return; - } + /* GL_NV_point_sprite */ + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = (GLfloat) ctx->Point.PointSprite; + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = (GLfloat) ctx->Point.SpriteRMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLfloat) ctx->Hint.GenerateMipmap; - } - else { - GET_FLOAT_ERROR; - return; + CHECK_EXTENSION_F(SGIS_generate_mipmap, pname); + *params = (GLfloat) ctx->Hint.GenerateMipmap; + break; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->VertexProgram.Enabled; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->VertexProgram.PointSizeEnabled; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->VertexProgram.TwoSideEnabled; + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) MAX_PROGRAM_STACK_DEPTH; + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) MAX_PROGRAM_MATRICES; + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->CurrentStack->Depth; + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->Transform.MatrixMode; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->VertexProgram.CurrentID; + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + *params = (GLfloat) ctx->VertexProgram.ErrorPos; + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_F(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; + *params = (GLfloat) ctx->Array.VertexAttrib[n].Enabled; + } + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; + *params = (GLfloat) ctx->Eval.Map1Attrib[n]; + } + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; + *params = (GLfloat) ctx->Eval.Map2Attrib[n]; } break; @@ -4031,9 +4166,20 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXTENSION_F(NV_texture_rectangle, pname); *params = (GLfloat) ctx->Const.MaxTextureRectSize; break; +#endif /* FEATURE_NV_vertex_program */ + + /* GL_EXT_stencil_two_side */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_F(EXT_stencil_two_side, pname); + *params = (GLfloat) ctx->Stencil.TestTwoSide; + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_F(EXT_stencil_two_side, pname); + *params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; - default: - GET_FLOAT_ERROR; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname); } } @@ -4056,7 +4202,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname)); + _mesa_debug(ctx, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname)); if (ctx->Driver.GetIntegerv && (*ctx->Driver.GetIntegerv)(ctx, pname, params)) @@ -4094,7 +4240,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Color.AlphaEnabled; break; case GL_ALPHA_TEST_REF: - *params = FLOAT_TO_INT( (GLfloat) ctx->Color.AlphaRef / CHAN_MAXF ); + *params = FLOAT_TO_INT(ctx->Color.AlphaRef); break; case GL_ALPHA_TEST_FUNC: *params = (GLint) ctx->Color.AlphaFunc; @@ -4156,8 +4302,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_CLIP_PLANE3: case GL_CLIP_PLANE4: case GL_CLIP_PLANE5: - i = (GLint) (pname - GL_CLIP_PLANE0); - *params = (GLint) ctx->Transform.ClipEnabled[i]; + if (ctx->Transform.ClipPlanesEnabled & (1 << (pname - GL_CLIP_PLANE0))) + *params = 1; + else + *params = 0; break; case GL_COLOR_CLEAR_VALUE: params[0] = FLOAT_TO_INT( (ctx->Color.ClearColor[0]) ); @@ -4188,10 +4336,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_COLOR: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT( ( ctx->Current.Color[0] ) ); - params[1] = FLOAT_TO_INT( ( ctx->Current.Color[1] ) ); - params[2] = FLOAT_TO_INT( ( ctx->Current.Color[2] ) ); - params[3] = FLOAT_TO_INT( ( ctx->Current.Color[3] ) ); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); + params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); break; case GL_CURRENT_INDEX: FLUSH_CURRENT(ctx, 0); @@ -4199,9 +4347,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_NORMAL: FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] ); - params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] ); - params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] ); + params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); + params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); + params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_INT( ctx->Current.RasterColor[0] ); @@ -4222,20 +4370,20 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[3] = (GLint) ctx->Current.RasterPos[3]; break; case GL_CURRENT_RASTER_TEXTURE_COORDS: - params[0] = (GLint) ctx->Current.RasterMultiTexCoord[texUnit][0]; - params[1] = (GLint) ctx->Current.RasterMultiTexCoord[texUnit][1]; - params[2] = (GLint) ctx->Current.RasterMultiTexCoord[texUnit][2]; - params[3] = (GLint) ctx->Current.RasterMultiTexCoord[texUnit][3]; + params[0] = (GLint) ctx->Current.RasterTexCoords[texUnit][0]; + params[1] = (GLint) ctx->Current.RasterTexCoords[texUnit][1]; + params[2] = (GLint) ctx->Current.RasterTexCoords[texUnit][2]; + params[3] = (GLint) ctx->Current.RasterTexCoords[texUnit][3]; break; case GL_CURRENT_RASTER_POSITION_VALID: *params = (GLint) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: FLUSH_CURRENT(ctx, 0); - params[0] = (GLint) ctx->Current.Texcoord[texUnit][0]; - params[1] = (GLint) ctx->Current.Texcoord[texUnit][1]; - params[2] = (GLint) ctx->Current.Texcoord[texUnit][2]; - params[3] = (GLint) ctx->Current.Texcoord[texUnit][3]; + params[0] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]; + params[1] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]; + params[2] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]; + params[3] = (GLint) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]; break; case GL_DEPTH_BIAS: *params = (GLint) ctx->Pixel.DepthBias; @@ -4320,15 +4468,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_GREEN_SCALE: *params = (GLint) ctx->Pixel.GreenScale; break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.HistogramEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); - return; - } - break; case GL_INDEX_BITS: *params = (GLint) ctx->Visual.indexBits; break; @@ -4552,16 +4691,13 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = (GLint) MAX_WIDTH; params[1] = (GLint) MAX_HEIGHT; break; - case GL_MINMAX: - *params = (GLint) ctx->Pixel.MinMaxEnabled; - break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { - params[i] = (GLint) ctx->ModelView.m[i]; + params[i] = (GLint) ctx->ModelviewMatrixStack.Top->m[i]; } break; case GL_MODELVIEW_STACK_DEPTH: - *params = (GLint) (ctx->ModelViewStackDepth + 1); + *params = (GLint) (ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: *params = (GLint) ctx->Select.NameStackDepth; @@ -4593,6 +4729,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_PACK_IMAGE_HEIGHT_EXT: *params = ctx->Pack.ImageHeight; break; + case GL_PACK_INVERT_MESA: + *params = ctx->Pack.Invert; + break; case GL_PERSPECTIVE_CORRECTION_HINT: *params = (GLint) ctx->Hint.PerspectiveCorrection; break; @@ -4684,11 +4823,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_PROJECTION_MATRIX: for (i=0;i<16;i++) { - params[i] = (GLint) ctx->ProjectionMatrix.m[i]; + params[i] = (GLint) ctx->ProjectionMatrixStack.Top->m[i]; } break; case GL_PROJECTION_STACK_DEPTH: - *params = (GLint) (ctx->ProjectionStackDepth + 1); + *params = (GLint) (ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: *params = (GLint) ctx->Pixel.ReadBuffer; @@ -4736,28 +4875,28 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Stencil.Clear; break; case GL_STENCIL_FAIL: - *params = (GLint) ctx->Stencil.FailFunc; + *params = (GLint) ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_FUNC: - *params = (GLint) ctx->Stencil.Function; + *params = (GLint) ctx->Stencil.Function[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_PASS_DEPTH_FAIL: - *params = (GLint) ctx->Stencil.ZFailFunc; + *params = (GLint) ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_PASS_DEPTH_PASS: - *params = (GLint) ctx->Stencil.ZPassFunc; + *params = (GLint) ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_REF: - *params = (GLint) ctx->Stencil.Ref; + *params = (GLint) ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_TEST: *params = (GLint) ctx->Stencil.Enabled; break; case GL_STENCIL_VALUE_MASK: - *params = (GLint) ctx->Stencil.ValueMask; + *params = (GLint) ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; break; case GL_STENCIL_WRITEMASK: - *params = (GLint) ctx->Stencil.WriteMask; + *params = (GLint) ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; break; case GL_STEREO: *params = (GLint) ctx->Visual.stereoMode; @@ -4806,11 +4945,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_TEXTURE_MATRIX: for (i=0;i<16;i++) { - params[i] = (GLint) ctx->TextureMatrix[texUnit].m[i]; + params[i] = (GLint) ctx->TextureMatrixStack[texUnit].Top->m[i]; } break; case GL_TEXTURE_STACK_DEPTH: - *params = (GLint) (ctx->TextureStackDepth[texUnit] + 1); + *params = (GLint) (ctx->TextureMatrixStack[texUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: *params = ctx->Unpack.Alignment; @@ -4836,6 +4975,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_UNPACK_IMAGE_HEIGHT_EXT: *params = ctx->Unpack.ImageHeight; break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + *params = ctx->Unpack.ClientStorage; + break; case GL_VIEWPORT: params[0] = (GLint) ctx->Viewport.X; params[1] = (GLint) ctx->Viewport.Y; @@ -4929,65 +5071,53 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: + CHECK_EXTENSION_I(ARB_multitexture, pname); *params = ctx->Const.MaxTextureUnits; break; case GL_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_I(ARB_multitexture, pname); *params = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: + CHECK_EXTENSION_I(ARB_multitexture, pname); *params = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; break; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(ARB_texture_cube_map, pname); + *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = textureUnit->CurrentCubeMap->Name; - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(ARB_texture_cube_map, pname); + *params = textureUnit->CurrentCubeMap->Name; + break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - if (ctx->Extensions.ARB_texture_cube_map) - *params = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(ARB_texture_cube_map, pname); + *params = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLint) ctx->Hint.TextureCompression; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + CHECK_EXTENSION_I(ARB_texture_compression, pname); + *params = (GLint) ctx->Hint.TextureCompression; break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLint) ctx->Const.NumCompressedTextureFormats; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + CHECK_EXTENSION_I(ARB_texture_compression, pname); + *params = (GLint) _mesa_get_compressed_formats(ctx, NULL); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - if (ctx->Extensions.ARB_texture_compression) { - GLuint i; - for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) - params[i] = (GLint) ctx->Const.CompressedTextureFormats[i]; - } - else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + CHECK_EXTENSION_I(ARB_texture_compression, pname); + (void) _mesa_get_compressed_formats(ctx, params); break; /* GL_EXT_compiled_vertex_array */ case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: + CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); *params = ctx->Array.LockFirst; break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: + CHECK_EXTENSION_I(EXT_compiled_vertex_array, pname); *params = ctx->Array.LockCount; break; @@ -4996,7 +5126,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ColorMatrix.m); + _math_transposef(tm, ctx->ColorMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -5006,7 +5136,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ModelView.m); + _math_transposef(tm, ctx->ModelviewMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -5016,7 +5146,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->ProjectionMatrix.m); + _math_transposef(tm, ctx->ProjectionMatrixStack.Top->m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -5026,7 +5156,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) { GLfloat tm[16]; GLuint i; - _math_transposef(tm, ctx->TextureMatrix[texUnit].m); + _math_transposef(tm, ctx->TextureMatrixStack[texUnit].Top->m); for (i=0;i<16;i++) { params[i] = (GLint) tm[i]; } @@ -5035,199 +5165,201 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_HP_occlusion_test */ case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - *params = (GLint) ctx->Depth.OcclusionTest; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } - return; + CHECK_EXTENSION_I(HP_occlusion_test, pname); + *params = (GLint) ctx->Depth.OcclusionTest; + break; case GL_OCCLUSION_TEST_RESULT_HP: - if (ctx->Extensions.HP_occlusion_test) { - if (ctx->Depth.OcclusionTest) - *params = (GLint) ctx->OcclusionResult; - else - *params = (GLint) ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } - return; + CHECK_EXTENSION_I(HP_occlusion_test, pname); + if (ctx->Depth.OcclusionTest) + *params = (GLint) ctx->OcclusionResult; + else + *params = (GLint) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + break; /* GL_SGIS_pixel_texture */ case GL_PIXEL_TEXTURE_SGIS: + CHECK_EXTENSION_I(SGIS_pixel_texture, pname); *params = (GLint) ctx->Pixel.PixelTextureEnabled; break; /* GL_SGIX_pixel_texture */ case GL_PIXEL_TEX_GEN_SGIX: + CHECK_EXTENSION_I(SGIX_pixel_texture, pname); *params = (GLint) ctx->Pixel.PixelTextureEnabled; break; case GL_PIXEL_TEX_GEN_MODE_SGIX: + CHECK_EXTENSION_I(SGIX_pixel_texture, pname); *params = (GLint) pixel_texgen_mode(ctx); break; /* GL_SGI_color_matrix (also in 1.2 imaging) */ case GL_COLOR_MATRIX_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); for (i=0;i<16;i++) { - params[i] = (GLint) ctx->ColorMatrix.m[i]; + params[i] = (GLint) ctx->ColorMatrixStack.Top->m[i]; } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - *params = ctx->ColorStackDepth + 1; + CHECK_EXTENSION_I(SGI_color_matrix, pname); + *params = ctx->ColorMatrixStack.Depth + 1; break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = MAX_COLOR_STACK_DEPTH; break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixScale[0]; break; case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixScale[1]; break; case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixScale[2]; break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixScale[3]; break; case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixBias[0]; break; case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixBias[1]; break; case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixBias[2]; break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + CHECK_EXTENSION_I(SGI_color_matrix, pname); *params = (GLint) ctx->Pixel.PostColorMatrixBias[3]; break; /* GL_EXT_convolution (also in 1.2 imaging) */ case GL_CONVOLUTION_1D_EXT: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.Convolution1DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(EXT_convolution, pname); + *params = (GLint) ctx->Pixel.Convolution1DEnabled; break; case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.Convolution2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(EXT_convolution, pname); + *params = (GLint) ctx->Pixel.Convolution2DEnabled; break; case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution || ctx->Extensions.ARB_imaging) { - *params = (GLint) ctx->Pixel.Separable2DEnabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(EXT_convolution, pname); + *params = (GLint) ctx->Pixel.Separable2DEnabled; break; case GL_POST_CONVOLUTION_RED_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionScale[0]; break; case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionScale[1]; break; case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionScale[2]; break; case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionScale[3]; break; case GL_POST_CONVOLUTION_RED_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionBias[0]; break; case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionBias[1]; break; case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; break; case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + CHECK_EXTENSION_I(EXT_convolution, pname); *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; break; + /* GL_EXT_histogram (also in 1.2 imaging) */ + case GL_HISTOGRAM: + CHECK_EXTENSION_I(EXT_histogram, pname); + *params = (GLint) ctx->Pixel.HistogramEnabled; + break; + case GL_MINMAX: + CHECK_EXTENSION_I(EXT_histogram, pname); + *params = (GLint) ctx->Pixel.MinMaxEnabled; + break; + /* GL_SGI_color_table (also in 1.2 imaging */ case GL_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table, pname); *params = (GLint) ctx->Pixel.ColorTableEnabled; break; case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table, pname); *params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled; break; case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + CHECK_EXTENSION_I(SGI_color_table, pname); *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; break; /* GL_EXT_secondary_color */ case GL_COLOR_SUM_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); *params = (GLint) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[0]) ); - params[1] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[1]) ); - params[2] = FLOAT_TO_INT( (ctx->Current.SecondaryColor[2]) ); + params[0] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]) ); + params[1] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]) ); + params[2] = FLOAT_TO_INT( (ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]) ); break; case GL_SECONDARY_COLOR_ARRAY_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); *params = (GLint) ctx->Array.SecondaryColor.Enabled; break; case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); *params = (GLint) ctx->Array.SecondaryColor.Type; break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); *params = (GLint) ctx->Array.SecondaryColor.Stride; break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: + CHECK_EXTENSION_I(EXT_secondary_color, pname); *params = (GLint) ctx->Array.SecondaryColor.Stride; break; /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: - if (ctx->Extensions.EXT_fog_coord) { - FLUSH_CURRENT(ctx, 0); - *params = (GLint) ctx->Current.FogCoord; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord, pname); + FLUSH_CURRENT(ctx, 0); + *params = (GLint) ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; break; case GL_FOG_COORDINATE_ARRAY_EXT: - if (ctx->Extensions.EXT_fog_coord) { - *params = (GLint) ctx->Array.FogCoord.Enabled; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord, pname); + *params = (GLint) ctx->Array.FogCoord.Enabled; break; case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - if (ctx->Extensions.EXT_fog_coord) { - *params = (GLint) ctx->Array.FogCoord.Type; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord, pname); + *params = (GLint) ctx->Array.FogCoord.Type; break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - if (ctx->Extensions.EXT_fog_coord) { - *params = (GLint) ctx->Array.FogCoord.Stride; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - } + CHECK_EXTENSION_I(EXT_fog_coord, pname); + *params = (GLint) ctx->Array.FogCoord.Stride; break; /* GL_EXT_texture_lod_bias */ @@ -5237,119 +5369,167 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_EXT_texture_filter_anisotropic */ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = (GLint) ctx->Const.MaxTextureMaxAnisotropy; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - return; - } + CHECK_EXTENSION_I(EXT_texture_filter_anisotropic, pname); + *params = (GLint) ctx->Const.MaxTextureMaxAnisotropy; break; /* GL_ARB_multisample */ case GL_MULTISAMPLE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.Enabled; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = (GLint) ctx->Multisample.Enabled; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleAlphaToCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = (GLint) ctx->Multisample.SampleAlphaToCoverage; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleAlphaToOne; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = (GLint) ctx->Multisample.SampleAlphaToOne; break; case GL_SAMPLE_COVERAGE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleCoverage; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = (GLint) ctx->Multisample.SampleCoverage; break; case GL_SAMPLE_COVERAGE_VALUE_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleCoverageValue; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = (GLint) ctx->Multisample.SampleCoverageValue; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = (GLint) ctx->Multisample.SampleCoverageInvert; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = (GLint) ctx->Multisample.SampleCoverageInvert; break; case GL_SAMPLE_BUFFERS_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = 0; /* XXX fix someday */ break; case GL_SAMPLES_ARB: - if (ctx->Extensions.ARB_multisample) { - *params = 0; /* XXX fix someday */ - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(ARB_multisample, pname); + *params = 0; /* XXX fix someday */ break; /* GL_IBM_rasterpos_clip */ case GL_RASTER_POSITION_UNCLIPPED_IBM: - if (ctx->Extensions.IBM_rasterpos_clip) { - *params = (GLint) ctx->Transform.RasterPositionUnclipped; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; - } + CHECK_EXTENSION_I(IBM_rasterpos_clip, pname); + *params = (GLint) ctx->Transform.RasterPositionUnclipped; break; - /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - *params = (GLint) ctx->Point.SpriteMode; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); - return; - } + /* GL_NV_point_sprite */ + case GL_POINT_SPRITE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = (GLint) ctx->Point.PointSprite; + break; + case GL_POINT_SPRITE_R_MODE_NV: + CHECK_EXTENSION_B(NV_point_sprite, pname); + *params = (GLint) ctx->Point.SpriteRMode; break; /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLint) ctx->Hint.GenerateMipmap; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); - return; + CHECK_EXTENSION_I(SGIS_generate_mipmap, pname); + *params = (GLint) ctx->Hint.GenerateMipmap; + break; + +#if FEATURE_NV_vertex_program + case GL_VERTEX_PROGRAM_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = (GLint) ctx->VertexProgram.Enabled; + break; + case GL_VERTEX_PROGRAM_POINT_SIZE_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = (GLint) ctx->VertexProgram.PointSizeEnabled; + break; + case GL_VERTEX_PROGRAM_TWO_SIDE_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = (GLint) ctx->VertexProgram.TwoSideEnabled; + break; + case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = MAX_PROGRAM_STACK_DEPTH; + break; + case GL_MAX_TRACK_MATRICES_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = MAX_PROGRAM_MATRICES; + break; + case GL_CURRENT_MATRIX_STACK_DEPTH_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = ctx->CurrentStack->Depth; + break; + case GL_CURRENT_MATRIX_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = (GLint) ctx->Transform.MatrixMode; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = (GLint) ctx->VertexProgram.CurrentID; + break; + case GL_PROGRAM_ERROR_POSITION_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + *params = (GLint) ctx->VertexProgram.ErrorPos; + break; + case GL_VERTEX_ATTRIB_ARRAY0_NV: + case GL_VERTEX_ATTRIB_ARRAY1_NV: + case GL_VERTEX_ATTRIB_ARRAY2_NV: + case GL_VERTEX_ATTRIB_ARRAY3_NV: + case GL_VERTEX_ATTRIB_ARRAY4_NV: + case GL_VERTEX_ATTRIB_ARRAY5_NV: + case GL_VERTEX_ATTRIB_ARRAY6_NV: + case GL_VERTEX_ATTRIB_ARRAY7_NV: + case GL_VERTEX_ATTRIB_ARRAY8_NV: + case GL_VERTEX_ATTRIB_ARRAY9_NV: + case GL_VERTEX_ATTRIB_ARRAY10_NV: + case GL_VERTEX_ATTRIB_ARRAY11_NV: + case GL_VERTEX_ATTRIB_ARRAY12_NV: + case GL_VERTEX_ATTRIB_ARRAY13_NV: + case GL_VERTEX_ATTRIB_ARRAY14_NV: + case GL_VERTEX_ATTRIB_ARRAY15_NV: + CHECK_EXTENSION_I(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_VERTEX_ATTRIB_ARRAY0_NV; + *params = (GLint) ctx->Array.VertexAttrib[n].Enabled; + } + break; + case GL_MAP1_VERTEX_ATTRIB0_4_NV: + case GL_MAP1_VERTEX_ATTRIB1_4_NV: + case GL_MAP1_VERTEX_ATTRIB2_4_NV: + case GL_MAP1_VERTEX_ATTRIB3_4_NV: + case GL_MAP1_VERTEX_ATTRIB4_4_NV: + case GL_MAP1_VERTEX_ATTRIB5_4_NV: + case GL_MAP1_VERTEX_ATTRIB6_4_NV: + case GL_MAP1_VERTEX_ATTRIB7_4_NV: + case GL_MAP1_VERTEX_ATTRIB8_4_NV: + case GL_MAP1_VERTEX_ATTRIB9_4_NV: + case GL_MAP1_VERTEX_ATTRIB10_4_NV: + case GL_MAP1_VERTEX_ATTRIB11_4_NV: + case GL_MAP1_VERTEX_ATTRIB12_4_NV: + case GL_MAP1_VERTEX_ATTRIB13_4_NV: + case GL_MAP1_VERTEX_ATTRIB14_4_NV: + case GL_MAP1_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP1_VERTEX_ATTRIB0_4_NV; + *params = (GLint) ctx->Eval.Map1Attrib[n]; + } + break; + case GL_MAP2_VERTEX_ATTRIB0_4_NV: + case GL_MAP2_VERTEX_ATTRIB1_4_NV: + case GL_MAP2_VERTEX_ATTRIB2_4_NV: + case GL_MAP2_VERTEX_ATTRIB3_4_NV: + case GL_MAP2_VERTEX_ATTRIB4_4_NV: + case GL_MAP2_VERTEX_ATTRIB5_4_NV: + case GL_MAP2_VERTEX_ATTRIB6_4_NV: + case GL_MAP2_VERTEX_ATTRIB7_4_NV: + case GL_MAP2_VERTEX_ATTRIB8_4_NV: + case GL_MAP2_VERTEX_ATTRIB9_4_NV: + case GL_MAP2_VERTEX_ATTRIB10_4_NV: + case GL_MAP2_VERTEX_ATTRIB11_4_NV: + case GL_MAP2_VERTEX_ATTRIB12_4_NV: + case GL_MAP2_VERTEX_ATTRIB13_4_NV: + case GL_MAP2_VERTEX_ATTRIB14_4_NV: + case GL_MAP2_VERTEX_ATTRIB15_4_NV: + CHECK_EXTENSION_B(NV_vertex_program, pname); + { + GLuint n = (GLuint) pname - GL_MAP2_VERTEX_ATTRIB0_4_NV; + *params = (GLint) ctx->Eval.Map2Attrib[n]; } break; @@ -5366,9 +5546,20 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXTENSION_I(NV_texture_rectangle, pname); *params = (GLint) ctx->Const.MaxTextureRectSize; break; +#endif /* FEATURE_NV_vertex_program */ + + /* GL_EXT_stencil_two_side */ + case GL_STENCIL_TEST_TWO_SIDE_EXT: + CHECK_EXTENSION_I(EXT_stencil_two_side, pname); + *params = (GLint) ctx->Stencil.TestTwoSide; + break; + case GL_ACTIVE_STENCIL_FACE_EXT: + CHECK_EXTENSION_I(EXT_stencil_two_side, pname); + *params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); + break; default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } } @@ -5385,7 +5576,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) return; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname)); + _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname)); if (ctx->Driver.GetPointerv && (*ctx->Driver.GetPointerv)(ctx, pname, params)) @@ -5436,8 +5627,9 @@ _mesa_GetString( GLenum name ) GET_CURRENT_CONTEXT(ctx); static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; - static const char *version_1_2 = "1.2 Mesa 4.0.4"; - static const char *version_1_3 = "1.3 Mesa 4.0.4"; + static const char *version_1_2 = "1.2 Mesa 5.0"; + static const char *version_1_3 = "1.3 Mesa 5.0"; + static const char *version_1_4 = "1.4 Mesa 5.0"; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); @@ -5448,29 +5640,51 @@ _mesa_GetString( GLenum name ) if (str) return str; - switch (name) { - case GL_VENDOR: - return (const GLubyte *) vendor; - case GL_RENDERER: - return (const GLubyte *) renderer; - case GL_VERSION: - if (ctx->Extensions.ARB_multitexture && - ctx->Extensions.ARB_multisample && - ctx->Extensions.ARB_texture_border_clamp && - ctx->Extensions.ARB_texture_compression && - ctx->Extensions.ARB_texture_cube_map && - ctx->Extensions.EXT_texture_env_add && - ctx->Extensions.ARB_texture_env_combine && - ctx->Extensions.ARB_texture_env_dot3) - return (const GLubyte *) version_1_3; - else - return (const GLubyte *) version_1_2; - case GL_EXTENSIONS: - return (const GLubyte *) _mesa_extensions_get_string(ctx); - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); - return (const GLubyte *) 0; - } + switch (name) { + case GL_VENDOR: + return (const GLubyte *) vendor; + case GL_RENDERER: + return (const GLubyte *) renderer; + case GL_VERSION: + if (ctx->Extensions.ARB_multisample && + ctx->Extensions.ARB_multitexture && + ctx->Extensions.ARB_texture_border_clamp && + ctx->Extensions.ARB_texture_compression && + ctx->Extensions.ARB_texture_cube_map && + ctx->Extensions.EXT_texture_env_add && + ctx->Extensions.ARB_texture_env_combine && + ctx->Extensions.ARB_texture_env_dot3) { + if (ctx->Extensions.ARB_depth_texture && + ctx->Extensions.ARB_shadow && + ctx->Extensions.ARB_texture_env_crossbar && + ctx->Extensions.ARB_texture_mirrored_repeat && + ctx->Extensions.ARB_window_pos && + ctx->Extensions.EXT_blend_color && + ctx->Extensions.EXT_blend_func_separate && + ctx->Extensions.EXT_blend_logic_op && + ctx->Extensions.EXT_blend_minmax && + ctx->Extensions.EXT_blend_subtract && + ctx->Extensions.EXT_fog_coord && + ctx->Extensions.EXT_multi_draw_arrays && + ctx->Extensions.EXT_point_parameters && /*aka ARB*/ + ctx->Extensions.EXT_secondary_color && + ctx->Extensions.EXT_stencil_wrap && + ctx->Extensions.SGIS_generate_mipmap) { + return (const GLubyte *) version_1_4; + } + else { + return (const GLubyte *) version_1_3; + } + } + else { + return (const GLubyte *) version_1_2; + } + case GL_EXTENSIONS: + return (const GLubyte *) _mesa_extensions_get_string(ctx); + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); + return (const GLubyte *) 0; + } } } @@ -5486,7 +5700,7 @@ _mesa_GetError( void ) ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e)); + _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e)); ctx->ErrorValue = (GLenum) GL_NO_ERROR; return e; diff --git a/xc/extras/Mesa/src/glapi.c b/xc/extras/Mesa/src/glapi.c index 550a57aa9..3cb4ccca3 100644 --- a/xc/extras/Mesa/src/glapi.c +++ b/xc/extras/Mesa/src/glapi.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.1 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -36,11 +36,17 @@ * flexible enough to be reused in several places: XFree86, DRI- * based libGL.so, and perhaps the SGI SI. * - * There are no dependencies on Mesa in this code. + * NOTE: There are no dependencies on Mesa in this code. * * Versions (API changes): * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0 * 2001/01/16 - added dispatch override feature for Mesa 3.5 + * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1. + * 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints + * itself (using offset ~0). _glapi_add_entrypoint() can be + * called afterward and it'll fill in the correct dispatch + * offset. This allows DRI libGL to avoid probing for DRI + * drivers! No changes to the public glapi interface. */ @@ -54,20 +60,37 @@ /***** BEGIN NO-OP DISPATCH *****/ static GLboolean WarnFlag = GL_FALSE; +static _glapi_warning_func warning_func; + +/* + * Enable/disable printing of warning messages. + */ void _glapi_noop_enable_warnings(GLboolean enable) { WarnFlag = enable; } +/* + * Register a callback function for reporting errors. + */ +void +_glapi_set_warning_func( _glapi_warning_func func ) +{ + warning_func = func; +} + static GLboolean warn(void) { - if (WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) + if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) + && warning_func) { return GL_TRUE; - else + } + else { return GL_FALSE; + } } @@ -75,21 +98,19 @@ warn(void) #define KEYWORD2 #define NAME(func) NoOp##func -#define F stderr +#define F NULL -#define DISPATCH(func, args, msg) \ - if (warn()) { \ - fprintf(stderr, "GL User Error: calling "); \ - fprintf msg; \ - fprintf(stderr, " without a current context\n"); \ +#define DISPATCH(func, args, msg) \ + if (warn()) { \ + warning_func(NULL, "GL User Error: called without context:"); \ + warning_func msg; \ } -#define RETURN_DISPATCH(func, args, msg) \ - if (warn()) { \ - fprintf(stderr, "GL User Error: calling "); \ - fprintf msg; \ - fprintf(stderr, " without a current context\n"); \ - } \ +#define RETURN_DISPATCH(func, args, msg) \ + if (warn()) { \ + warning_func(NULL, "GL User Error: called without context:"); \ + warning_func msg; \ + } \ return 0 #define DISPATCH_TABLE_NAME __glapi_noop_table @@ -100,7 +121,7 @@ warn(void) static int NoOpUnused(void) { if (warn()) { - fprintf(stderr, "GL User Error: calling extension function without a current context\n"); + warning_func(NULL, "GL User Error: calling extension function without a current context\n"); } return 0; } @@ -169,12 +190,10 @@ struct _glapi_table *_glapi_RealDispatch = (struct _glapi_table *) __glapi_noop_ void *_glapi_Context = NULL; -static GLuint MaxDispatchOffset = sizeof(struct _glapi_table) / sizeof(void *) - 1; -static GLboolean GetSizeCalled = GL_FALSE; - static GLboolean DispatchOverride = GL_FALSE; + /* strdup() is actually not a standard ANSI C or POSIX routine. * Irix will not define it if ANSI mode is in effect. */ @@ -193,8 +212,7 @@ str_dup(const char *str) /* * We should call this periodically from a function such as glXMakeCurrent - * in order to test if multiple threads are being used. When we detect - * that situation we should then call _glapi_enable_thread_safety() + * in order to test if multiple threads are being used. */ void _glapi_check_multithread(void) @@ -421,42 +439,6 @@ _glapi_get_override_dispatch(int layer) } - -/* - * Return size of dispatch table struct as number of functions (or - * slots). - */ -GLuint -_glapi_get_dispatch_table_size(void) -{ - /* return sizeof(struct _glapi_table) / sizeof(void *);*/ - GetSizeCalled = GL_TRUE; - return MaxDispatchOffset + 1; -} - - - -/* - * Get API dispatcher version string. - */ -const char * -_glapi_get_version(void) -{ - return "20010116"; /* YYYYMMDD */ -} - - -/* - * For each entry in static_functions[] which use this function - * we should implement a dispatch function in glapitemp.h and - * in glapinoop.c - */ -static int NotImplemented(void) -{ - return 0; -} - - struct name_address_offset { const char *Name; GLvoid *Address; @@ -464,1287 +446,8 @@ struct name_address_offset { }; -static struct name_address_offset static_functions[] = { - /* GL 1.1 */ - { "glNewList", (GLvoid *) glNewList, _gloffset_NewList }, - { "glEndList", (GLvoid *) glEndList, _gloffset_EndList }, - { "glCallList", (GLvoid *) glCallList, _gloffset_CallList }, - { "glCallLists", (GLvoid *) glCallLists, _gloffset_CallLists }, - { "glDeleteLists", (GLvoid *) glDeleteLists, _gloffset_DeleteLists }, - { "glGenLists", (GLvoid *) glGenLists, _gloffset_GenLists }, - { "glListBase", (GLvoid *) glListBase, _gloffset_ListBase }, - { "glBegin", (GLvoid *) glBegin, _gloffset_Begin }, - { "glBitmap", (GLvoid *) glBitmap, _gloffset_Bitmap }, - { "glColor3b", (GLvoid *) glColor3b, _gloffset_Color3b }, - { "glColor3bv", (GLvoid *) glColor3bv, _gloffset_Color3bv }, - { "glColor3d", (GLvoid *) glColor3d, _gloffset_Color3d }, - { "glColor3dv", (GLvoid *) glColor3dv, _gloffset_Color3dv }, - { "glColor3f", (GLvoid *) glColor3f, _gloffset_Color3f }, - { "glColor3fv", (GLvoid *) glColor3fv, _gloffset_Color3fv }, - { "glColor3i", (GLvoid *) glColor3i, _gloffset_Color3i }, - { "glColor3iv", (GLvoid *) glColor3iv, _gloffset_Color3iv }, - { "glColor3s", (GLvoid *) glColor3s, _gloffset_Color3s }, - { "glColor3sv", (GLvoid *) glColor3sv, _gloffset_Color3sv }, - { "glColor3ub", (GLvoid *) glColor3ub, _gloffset_Color3ub }, - { "glColor3ubv", (GLvoid *) glColor3ubv, _gloffset_Color3ubv }, - { "glColor3ui", (GLvoid *) glColor3ui, _gloffset_Color3ui }, - { "glColor3uiv", (GLvoid *) glColor3uiv, _gloffset_Color3uiv }, - { "glColor3us", (GLvoid *) glColor3us, _gloffset_Color3us }, - { "glColor3usv", (GLvoid *) glColor3usv, _gloffset_Color3usv }, - { "glColor4b", (GLvoid *) glColor4b, _gloffset_Color4b }, - { "glColor4bv", (GLvoid *) glColor4bv, _gloffset_Color4bv }, - { "glColor4d", (GLvoid *) glColor4d, _gloffset_Color4d }, - { "glColor4dv", (GLvoid *) glColor4dv, _gloffset_Color4dv }, - { "glColor4f", (GLvoid *) glColor4f, _gloffset_Color4f }, - { "glColor4fv", (GLvoid *) glColor4fv, _gloffset_Color4fv }, - { "glColor4i", (GLvoid *) glColor4i, _gloffset_Color4i }, - { "glColor4iv", (GLvoid *) glColor4iv, _gloffset_Color4iv }, - { "glColor4s", (GLvoid *) glColor4s, _gloffset_Color4s }, - { "glColor4sv", (GLvoid *) glColor4sv, _gloffset_Color4sv }, - { "glColor4ub", (GLvoid *) glColor4ub, _gloffset_Color4ub }, - { "glColor4ubv", (GLvoid *) glColor4ubv, _gloffset_Color4ubv }, - { "glColor4ui", (GLvoid *) glColor4ui, _gloffset_Color4ui }, - { "glColor4uiv", (GLvoid *) glColor4uiv, _gloffset_Color4uiv }, - { "glColor4us", (GLvoid *) glColor4us, _gloffset_Color4us }, - { "glColor4usv", (GLvoid *) glColor4usv, _gloffset_Color4usv }, - { "glEdgeFlag", (GLvoid *) glEdgeFlag, _gloffset_EdgeFlag }, - { "glEdgeFlagv", (GLvoid *) glEdgeFlagv, _gloffset_EdgeFlagv }, - { "glEnd", (GLvoid *) glEnd, _gloffset_End }, - { "glIndexd", (GLvoid *) glIndexd, _gloffset_Indexd }, - { "glIndexdv", (GLvoid *) glIndexdv, _gloffset_Indexdv }, - { "glIndexf", (GLvoid *) glIndexf, _gloffset_Indexf }, - { "glIndexfv", (GLvoid *) glIndexfv, _gloffset_Indexfv }, - { "glIndexi", (GLvoid *) glIndexi, _gloffset_Indexi }, - { "glIndexiv", (GLvoid *) glIndexiv, _gloffset_Indexiv }, - { "glIndexs", (GLvoid *) glIndexs, _gloffset_Indexs }, - { "glIndexsv", (GLvoid *) glIndexsv, _gloffset_Indexsv }, - { "glNormal3b", (GLvoid *) glNormal3b, _gloffset_Normal3b }, - { "glNormal3bv", (GLvoid *) glNormal3bv, _gloffset_Normal3bv }, - { "glNormal3d", (GLvoid *) glNormal3d, _gloffset_Normal3d }, - { "glNormal3dv", (GLvoid *) glNormal3dv, _gloffset_Normal3dv }, - { "glNormal3f", (GLvoid *) glNormal3f, _gloffset_Normal3f }, - { "glNormal3fv", (GLvoid *) glNormal3fv, _gloffset_Normal3fv }, - { "glNormal3i", (GLvoid *) glNormal3i, _gloffset_Normal3i }, - { "glNormal3iv", (GLvoid *) glNormal3iv, _gloffset_Normal3iv }, - { "glNormal3s", (GLvoid *) glNormal3s, _gloffset_Normal3s }, - { "glNormal3sv", (GLvoid *) glNormal3sv, _gloffset_Normal3sv }, - { "glRasterPos2d", (GLvoid *) glRasterPos2d, _gloffset_RasterPos2d }, - { "glRasterPos2dv", (GLvoid *) glRasterPos2dv, _gloffset_RasterPos2dv }, - { "glRasterPos2f", (GLvoid *) glRasterPos2f, _gloffset_RasterPos2f }, - { "glRasterPos2fv", (GLvoid *) glRasterPos2fv, _gloffset_RasterPos2fv }, - { "glRasterPos2i", (GLvoid *) glRasterPos2i, _gloffset_RasterPos2i }, - { "glRasterPos2iv", (GLvoid *) glRasterPos2iv, _gloffset_RasterPos2iv }, - { "glRasterPos2s", (GLvoid *) glRasterPos2s, _gloffset_RasterPos2s }, - { "glRasterPos2sv", (GLvoid *) glRasterPos2sv, _gloffset_RasterPos2sv }, - { "glRasterPos3d", (GLvoid *) glRasterPos3d, _gloffset_RasterPos3d }, - { "glRasterPos3dv", (GLvoid *) glRasterPos3dv, _gloffset_RasterPos3dv }, - { "glRasterPos3f", (GLvoid *) glRasterPos3f, _gloffset_RasterPos3f }, - { "glRasterPos3fv", (GLvoid *) glRasterPos3fv, _gloffset_RasterPos3fv }, - { "glRasterPos3i", (GLvoid *) glRasterPos3i, _gloffset_RasterPos3i }, - { "glRasterPos3iv", (GLvoid *) glRasterPos3iv, _gloffset_RasterPos3iv }, - { "glRasterPos3s", (GLvoid *) glRasterPos3s, _gloffset_RasterPos3s }, - { "glRasterPos3sv", (GLvoid *) glRasterPos3sv, _gloffset_RasterPos3sv }, - { "glRasterPos4d", (GLvoid *) glRasterPos4d, _gloffset_RasterPos4d }, - { "glRasterPos4dv", (GLvoid *) glRasterPos4dv, _gloffset_RasterPos4dv }, - { "glRasterPos4f", (GLvoid *) glRasterPos4f, _gloffset_RasterPos4f }, - { "glRasterPos4fv", (GLvoid *) glRasterPos4fv, _gloffset_RasterPos4fv }, - { "glRasterPos4i", (GLvoid *) glRasterPos4i, _gloffset_RasterPos4i }, - { "glRasterPos4iv", (GLvoid *) glRasterPos4iv, _gloffset_RasterPos4iv }, - { "glRasterPos4s", (GLvoid *) glRasterPos4s, _gloffset_RasterPos4s }, - { "glRasterPos4sv", (GLvoid *) glRasterPos4sv, _gloffset_RasterPos4sv }, - { "glRectd", (GLvoid *) glRectd, _gloffset_Rectd }, - { "glRectdv", (GLvoid *) glRectdv, _gloffset_Rectdv }, - { "glRectf", (GLvoid *) glRectf, _gloffset_Rectf }, - { "glRectfv", (GLvoid *) glRectfv, _gloffset_Rectfv }, - { "glRecti", (GLvoid *) glRecti, _gloffset_Recti }, - { "glRectiv", (GLvoid *) glRectiv, _gloffset_Rectiv }, - { "glRects", (GLvoid *) glRects, _gloffset_Rects }, - { "glRectsv", (GLvoid *) glRectsv, _gloffset_Rectsv }, - { "glTexCoord1d", (GLvoid *) glTexCoord1d, _gloffset_TexCoord1d }, - { "glTexCoord1dv", (GLvoid *) glTexCoord1dv, _gloffset_TexCoord1dv }, - { "glTexCoord1f", (GLvoid *) glTexCoord1f, _gloffset_TexCoord1f }, - { "glTexCoord1fv", (GLvoid *) glTexCoord1fv, _gloffset_TexCoord1fv }, - { "glTexCoord1i", (GLvoid *) glTexCoord1i, _gloffset_TexCoord1i }, - { "glTexCoord1iv", (GLvoid *) glTexCoord1iv, _gloffset_TexCoord1iv }, - { "glTexCoord1s", (GLvoid *) glTexCoord1s, _gloffset_TexCoord1s }, - { "glTexCoord1sv", (GLvoid *) glTexCoord1sv, _gloffset_TexCoord1sv }, - { "glTexCoord2d", (GLvoid *) glTexCoord2d, _gloffset_TexCoord2d }, - { "glTexCoord2dv", (GLvoid *) glTexCoord2dv, _gloffset_TexCoord2dv }, - { "glTexCoord2f", (GLvoid *) glTexCoord2f, _gloffset_TexCoord2f }, - { "glTexCoord2fv", (GLvoid *) glTexCoord2fv, _gloffset_TexCoord2fv }, - { "glTexCoord2i", (GLvoid *) glTexCoord2i, _gloffset_TexCoord2i }, - { "glTexCoord2iv", (GLvoid *) glTexCoord2iv, _gloffset_TexCoord2iv }, - { "glTexCoord2s", (GLvoid *) glTexCoord2s, _gloffset_TexCoord2s }, - { "glTexCoord2sv", (GLvoid *) glTexCoord2sv, _gloffset_TexCoord2sv }, - { "glTexCoord3d", (GLvoid *) glTexCoord3d, _gloffset_TexCoord3d }, - { "glTexCoord3dv", (GLvoid *) glTexCoord3dv, _gloffset_TexCoord3dv }, - { "glTexCoord3f", (GLvoid *) glTexCoord3f, _gloffset_TexCoord3f }, - { "glTexCoord3fv", (GLvoid *) glTexCoord3fv, _gloffset_TexCoord3fv }, - { "glTexCoord3i", (GLvoid *) glTexCoord3i, _gloffset_TexCoord3i }, - { "glTexCoord3iv", (GLvoid *) glTexCoord3iv, _gloffset_TexCoord3iv }, - { "glTexCoord3s", (GLvoid *) glTexCoord3s, _gloffset_TexCoord3s }, - { "glTexCoord3sv", (GLvoid *) glTexCoord3sv, _gloffset_TexCoord3sv }, - { "glTexCoord4d", (GLvoid *) glTexCoord4d, _gloffset_TexCoord4d }, - { "glTexCoord4dv", (GLvoid *) glTexCoord4dv, _gloffset_TexCoord4dv }, - { "glTexCoord4f", (GLvoid *) glTexCoord4f, _gloffset_TexCoord4f }, - { "glTexCoord4fv", (GLvoid *) glTexCoord4fv, _gloffset_TexCoord4fv }, - { "glTexCoord4i", (GLvoid *) glTexCoord4i, _gloffset_TexCoord4i }, - { "glTexCoord4iv", (GLvoid *) glTexCoord4iv, _gloffset_TexCoord4iv }, - { "glTexCoord4s", (GLvoid *) glTexCoord4s, _gloffset_TexCoord4s }, - { "glTexCoord4sv", (GLvoid *) glTexCoord4sv, _gloffset_TexCoord4sv }, - { "glVertex2d", (GLvoid *) glVertex2d, _gloffset_Vertex2d }, - { "glVertex2dv", (GLvoid *) glVertex2dv, _gloffset_Vertex2dv }, - { "glVertex2f", (GLvoid *) glVertex2f, _gloffset_Vertex2f }, - { "glVertex2fv", (GLvoid *) glVertex2fv, _gloffset_Vertex2fv }, - { "glVertex2i", (GLvoid *) glVertex2i, _gloffset_Vertex2i }, - { "glVertex2iv", (GLvoid *) glVertex2iv, _gloffset_Vertex2iv }, - { "glVertex2s", (GLvoid *) glVertex2s, _gloffset_Vertex2s }, - { "glVertex2sv", (GLvoid *) glVertex2sv, _gloffset_Vertex2sv }, - { "glVertex3d", (GLvoid *) glVertex3d, _gloffset_Vertex3d }, - { "glVertex3dv", (GLvoid *) glVertex3dv, _gloffset_Vertex3dv }, - { "glVertex3f", (GLvoid *) glVertex3f, _gloffset_Vertex3f }, - { "glVertex3fv", (GLvoid *) glVertex3fv, _gloffset_Vertex3fv }, - { "glVertex3i", (GLvoid *) glVertex3i, _gloffset_Vertex3i }, - { "glVertex3iv", (GLvoid *) glVertex3iv, _gloffset_Vertex3iv }, - { "glVertex3s", (GLvoid *) glVertex3s, _gloffset_Vertex3s }, - { "glVertex3sv", (GLvoid *) glVertex3sv, _gloffset_Vertex3sv }, - { "glVertex4d", (GLvoid *) glVertex4d, _gloffset_Vertex4d }, - { "glVertex4dv", (GLvoid *) glVertex4dv, _gloffset_Vertex4dv }, - { "glVertex4f", (GLvoid *) glVertex4f, _gloffset_Vertex4f }, - { "glVertex4fv", (GLvoid *) glVertex4fv, _gloffset_Vertex4fv }, - { "glVertex4i", (GLvoid *) glVertex4i, _gloffset_Vertex4i }, - { "glVertex4iv", (GLvoid *) glVertex4iv, _gloffset_Vertex4iv }, - { "glVertex4s", (GLvoid *) glVertex4s, _gloffset_Vertex4s }, - { "glVertex4sv", (GLvoid *) glVertex4sv, _gloffset_Vertex4sv }, - { "glClipPlane", (GLvoid *) glClipPlane, _gloffset_ClipPlane }, - { "glColorMaterial", (GLvoid *) glColorMaterial, _gloffset_ColorMaterial }, - { "glCullFace", (GLvoid *) glCullFace, _gloffset_CullFace }, - { "glFogf", (GLvoid *) glFogf, _gloffset_Fogf }, - { "glFogfv", (GLvoid *) glFogfv, _gloffset_Fogfv }, - { "glFogi", (GLvoid *) glFogi, _gloffset_Fogi }, - { "glFogiv", (GLvoid *) glFogiv, _gloffset_Fogiv }, - { "glFrontFace", (GLvoid *) glFrontFace, _gloffset_FrontFace }, - { "glHint", (GLvoid *) glHint, _gloffset_Hint }, - { "glLightf", (GLvoid *) glLightf, _gloffset_Lightf }, - { "glLightfv", (GLvoid *) glLightfv, _gloffset_Lightfv }, - { "glLighti", (GLvoid *) glLighti, _gloffset_Lighti }, - { "glLightiv", (GLvoid *) glLightiv, _gloffset_Lightiv }, - { "glLightModelf", (GLvoid *) glLightModelf, _gloffset_LightModelf }, - { "glLightModelfv", (GLvoid *) glLightModelfv, _gloffset_LightModelfv }, - { "glLightModeli", (GLvoid *) glLightModeli, _gloffset_LightModeli }, - { "glLightModeliv", (GLvoid *) glLightModeliv, _gloffset_LightModeliv }, - { "glLineStipple", (GLvoid *) glLineStipple, _gloffset_LineStipple }, - { "glLineWidth", (GLvoid *) glLineWidth, _gloffset_LineWidth }, - { "glMaterialf", (GLvoid *) glMaterialf, _gloffset_Materialf }, - { "glMaterialfv", (GLvoid *) glMaterialfv, _gloffset_Materialfv }, - { "glMateriali", (GLvoid *) glMateriali, _gloffset_Materiali }, - { "glMaterialiv", (GLvoid *) glMaterialiv, _gloffset_Materialiv }, - { "glPointSize", (GLvoid *) glPointSize, _gloffset_PointSize }, - { "glPolygonMode", (GLvoid *) glPolygonMode, _gloffset_PolygonMode }, - { "glPolygonStipple", (GLvoid *) glPolygonStipple, _gloffset_PolygonStipple }, - { "glScissor", (GLvoid *) glScissor, _gloffset_Scissor }, - { "glShadeModel", (GLvoid *) glShadeModel, _gloffset_ShadeModel }, - { "glTexParameterf", (GLvoid *) glTexParameterf, _gloffset_TexParameterf }, - { "glTexParameterfv", (GLvoid *) glTexParameterfv, _gloffset_TexParameterfv }, - { "glTexParameteri", (GLvoid *) glTexParameteri, _gloffset_TexParameteri }, - { "glTexParameteriv", (GLvoid *) glTexParameteriv, _gloffset_TexParameteriv }, - { "glTexImage1D", (GLvoid *) glTexImage1D, _gloffset_TexImage1D }, - { "glTexImage2D", (GLvoid *) glTexImage2D, _gloffset_TexImage2D }, - { "glTexEnvf", (GLvoid *) glTexEnvf, _gloffset_TexEnvf }, - { "glTexEnvfv", (GLvoid *) glTexEnvfv, _gloffset_TexEnvfv }, - { "glTexEnvi", (GLvoid *) glTexEnvi, _gloffset_TexEnvi }, - { "glTexEnviv", (GLvoid *) glTexEnviv, _gloffset_TexEnviv }, - { "glTexGend", (GLvoid *) glTexGend, _gloffset_TexGend }, - { "glTexGendv", (GLvoid *) glTexGendv, _gloffset_TexGendv }, - { "glTexGenf", (GLvoid *) glTexGenf, _gloffset_TexGenf }, - { "glTexGenfv", (GLvoid *) glTexGenfv, _gloffset_TexGenfv }, - { "glTexGeni", (GLvoid *) glTexGeni, _gloffset_TexGeni }, - { "glTexGeniv", (GLvoid *) glTexGeniv, _gloffset_TexGeniv }, - { "glFeedbackBuffer", (GLvoid *) glFeedbackBuffer, _gloffset_FeedbackBuffer }, - { "glSelectBuffer", (GLvoid *) glSelectBuffer, _gloffset_SelectBuffer }, - { "glRenderMode", (GLvoid *) glRenderMode, _gloffset_RenderMode }, - { "glInitNames", (GLvoid *) glInitNames, _gloffset_InitNames }, - { "glLoadName", (GLvoid *) glLoadName, _gloffset_LoadName }, - { "glPassThrough", (GLvoid *) glPassThrough, _gloffset_PassThrough }, - { "glPopName", (GLvoid *) glPopName, _gloffset_PopName }, - { "glPushName", (GLvoid *) glPushName, _gloffset_PushName }, - { "glDrawBuffer", (GLvoid *) glDrawBuffer, _gloffset_DrawBuffer }, - { "glClear", (GLvoid *) glClear, _gloffset_Clear }, - { "glClearAccum", (GLvoid *) glClearAccum, _gloffset_ClearAccum }, - { "glClearIndex", (GLvoid *) glClearIndex, _gloffset_ClearIndex }, - { "glClearColor", (GLvoid *) glClearColor, _gloffset_ClearColor }, - { "glClearStencil", (GLvoid *) glClearStencil, _gloffset_ClearStencil }, - { "glClearDepth", (GLvoid *) glClearDepth, _gloffset_ClearDepth }, - { "glStencilMask", (GLvoid *) glStencilMask, _gloffset_StencilMask }, - { "glColorMask", (GLvoid *) glColorMask, _gloffset_ColorMask }, - { "glDepthMask", (GLvoid *) glDepthMask, _gloffset_DepthMask }, - { "glIndexMask", (GLvoid *) glIndexMask, _gloffset_IndexMask }, - { "glAccum", (GLvoid *) glAccum, _gloffset_Accum }, - { "glDisable", (GLvoid *) glDisable, _gloffset_Disable }, - { "glEnable", (GLvoid *) glEnable, _gloffset_Enable }, - { "glFinish", (GLvoid *) glFinish, _gloffset_Finish }, - { "glFlush", (GLvoid *) glFlush, _gloffset_Flush }, - { "glPopAttrib", (GLvoid *) glPopAttrib, _gloffset_PopAttrib }, - { "glPushAttrib", (GLvoid *) glPushAttrib, _gloffset_PushAttrib }, - { "glMap1d", (GLvoid *) glMap1d, _gloffset_Map1d }, - { "glMap1f", (GLvoid *) glMap1f, _gloffset_Map1f }, - { "glMap2d", (GLvoid *) glMap2d, _gloffset_Map2d }, - { "glMap2f", (GLvoid *) glMap2f, _gloffset_Map2f }, - { "glMapGrid1d", (GLvoid *) glMapGrid1d, _gloffset_MapGrid1d }, - { "glMapGrid1f", (GLvoid *) glMapGrid1f, _gloffset_MapGrid1f }, - { "glMapGrid2d", (GLvoid *) glMapGrid2d, _gloffset_MapGrid2d }, - { "glMapGrid2f", (GLvoid *) glMapGrid2f, _gloffset_MapGrid2f }, - { "glEvalCoord1d", (GLvoid *) glEvalCoord1d, _gloffset_EvalCoord1d }, - { "glEvalCoord1dv", (GLvoid *) glEvalCoord1dv, _gloffset_EvalCoord1dv }, - { "glEvalCoord1f", (GLvoid *) glEvalCoord1f, _gloffset_EvalCoord1f }, - { "glEvalCoord1fv", (GLvoid *) glEvalCoord1fv, _gloffset_EvalCoord1fv }, - { "glEvalCoord2d", (GLvoid *) glEvalCoord2d, _gloffset_EvalCoord2d }, - { "glEvalCoord2dv", (GLvoid *) glEvalCoord2dv, _gloffset_EvalCoord2dv }, - { "glEvalCoord2f", (GLvoid *) glEvalCoord2f, _gloffset_EvalCoord2f }, - { "glEvalCoord2fv", (GLvoid *) glEvalCoord2fv, _gloffset_EvalCoord2fv }, - { "glEvalMesh1", (GLvoid *) glEvalMesh1, _gloffset_EvalMesh1 }, - { "glEvalPoint1", (GLvoid *) glEvalPoint1, _gloffset_EvalPoint1 }, - { "glEvalMesh2", (GLvoid *) glEvalMesh2, _gloffset_EvalMesh2 }, - { "glEvalPoint2", (GLvoid *) glEvalPoint2, _gloffset_EvalPoint2 }, - { "glAlphaFunc", (GLvoid *) glAlphaFunc, _gloffset_AlphaFunc }, - { "glBlendFunc", (GLvoid *) glBlendFunc, _gloffset_BlendFunc }, - { "glLogicOp", (GLvoid *) glLogicOp, _gloffset_LogicOp }, - { "glStencilFunc", (GLvoid *) glStencilFunc, _gloffset_StencilFunc }, - { "glStencilOp", (GLvoid *) glStencilOp, _gloffset_StencilOp }, - { "glDepthFunc", (GLvoid *) glDepthFunc, _gloffset_DepthFunc }, - { "glPixelZoom", (GLvoid *) glPixelZoom, _gloffset_PixelZoom }, - { "glPixelTransferf", (GLvoid *) glPixelTransferf, _gloffset_PixelTransferf }, - { "glPixelTransferi", (GLvoid *) glPixelTransferi, _gloffset_PixelTransferi }, - { "glPixelStoref", (GLvoid *) glPixelStoref, _gloffset_PixelStoref }, - { "glPixelStorei", (GLvoid *) glPixelStorei, _gloffset_PixelStorei }, - { "glPixelMapfv", (GLvoid *) glPixelMapfv, _gloffset_PixelMapfv }, - { "glPixelMapuiv", (GLvoid *) glPixelMapuiv, _gloffset_PixelMapuiv }, - { "glPixelMapusv", (GLvoid *) glPixelMapusv, _gloffset_PixelMapusv }, - { "glReadBuffer", (GLvoid *) glReadBuffer, _gloffset_ReadBuffer }, - { "glCopyPixels", (GLvoid *) glCopyPixels, _gloffset_CopyPixels }, - { "glReadPixels", (GLvoid *) glReadPixels, _gloffset_ReadPixels }, - { "glDrawPixels", (GLvoid *) glDrawPixels, _gloffset_DrawPixels }, - { "glGetBooleanv", (GLvoid *) glGetBooleanv, _gloffset_GetBooleanv }, - { "glGetClipPlane", (GLvoid *) glGetClipPlane, _gloffset_GetClipPlane }, - { "glGetDoublev", (GLvoid *) glGetDoublev, _gloffset_GetDoublev }, - { "glGetError", (GLvoid *) glGetError, _gloffset_GetError }, - { "glGetFloatv", (GLvoid *) glGetFloatv, _gloffset_GetFloatv }, - { "glGetIntegerv", (GLvoid *) glGetIntegerv, _gloffset_GetIntegerv }, - { "glGetLightfv", (GLvoid *) glGetLightfv, _gloffset_GetLightfv }, - { "glGetLightiv", (GLvoid *) glGetLightiv, _gloffset_GetLightiv }, - { "glGetMapdv", (GLvoid *) glGetMapdv, _gloffset_GetMapdv }, - { "glGetMapfv", (GLvoid *) glGetMapfv, _gloffset_GetMapfv }, - { "glGetMapiv", (GLvoid *) glGetMapiv, _gloffset_GetMapiv }, - { "glGetMaterialfv", (GLvoid *) glGetMaterialfv, _gloffset_GetMaterialfv }, - { "glGetMaterialiv", (GLvoid *) glGetMaterialiv, _gloffset_GetMaterialiv }, - { "glGetPixelMapfv", (GLvoid *) glGetPixelMapfv, _gloffset_GetPixelMapfv }, - { "glGetPixelMapuiv", (GLvoid *) glGetPixelMapuiv, _gloffset_GetPixelMapuiv }, - { "glGetPixelMapusv", (GLvoid *) glGetPixelMapusv, _gloffset_GetPixelMapusv }, - { "glGetPolygonStipple", (GLvoid *) glGetPolygonStipple, _gloffset_GetPolygonStipple }, - { "glGetString", (GLvoid *) glGetString, _gloffset_GetString }, - { "glGetTexEnvfv", (GLvoid *) glGetTexEnvfv, _gloffset_GetTexEnvfv }, - { "glGetTexEnviv", (GLvoid *) glGetTexEnviv, _gloffset_GetTexEnviv }, - { "glGetTexGendv", (GLvoid *) glGetTexGendv, _gloffset_GetTexGendv }, - { "glGetTexGenfv", (GLvoid *) glGetTexGenfv, _gloffset_GetTexGenfv }, - { "glGetTexGeniv", (GLvoid *) glGetTexGeniv, _gloffset_GetTexGeniv }, - { "glGetTexImage", (GLvoid *) glGetTexImage, _gloffset_GetTexImage }, - { "glGetTexParameterfv", (GLvoid *) glGetTexParameterfv, _gloffset_GetTexParameterfv }, - { "glGetTexParameteriv", (GLvoid *) glGetTexParameteriv, _gloffset_GetTexParameteriv }, - { "glGetTexLevelParameterfv", (GLvoid *) glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv }, - { "glGetTexLevelParameteriv", (GLvoid *) glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv }, - { "glIsEnabled", (GLvoid *) glIsEnabled, _gloffset_IsEnabled }, - { "glIsList", (GLvoid *) glIsList, _gloffset_IsList }, - { "glDepthRange", (GLvoid *) glDepthRange, _gloffset_DepthRange }, - { "glFrustum", (GLvoid *) glFrustum, _gloffset_Frustum }, - { "glLoadIdentity", (GLvoid *) glLoadIdentity, _gloffset_LoadIdentity }, - { "glLoadMatrixf", (GLvoid *) glLoadMatrixf, _gloffset_LoadMatrixf }, - { "glLoadMatrixd", (GLvoid *) glLoadMatrixd, _gloffset_LoadMatrixd }, - { "glMatrixMode", (GLvoid *) glMatrixMode, _gloffset_MatrixMode }, - { "glMultMatrixf", (GLvoid *) glMultMatrixf, _gloffset_MultMatrixf }, - { "glMultMatrixd", (GLvoid *) glMultMatrixd, _gloffset_MultMatrixd }, - { "glOrtho", (GLvoid *) glOrtho, _gloffset_Ortho }, - { "glPopMatrix", (GLvoid *) glPopMatrix, _gloffset_PopMatrix }, - { "glPushMatrix", (GLvoid *) glPushMatrix, _gloffset_PushMatrix }, - { "glRotated", (GLvoid *) glRotated, _gloffset_Rotated }, - { "glRotatef", (GLvoid *) glRotatef, _gloffset_Rotatef }, - { "glScaled", (GLvoid *) glScaled, _gloffset_Scaled }, - { "glScalef", (GLvoid *) glScalef, _gloffset_Scalef }, - { "glTranslated", (GLvoid *) glTranslated, _gloffset_Translated }, - { "glTranslatef", (GLvoid *) glTranslatef, _gloffset_Translatef }, - { "glViewport", (GLvoid *) glViewport, _gloffset_Viewport }, - /* 1.1 */ - { "glArrayElement", (GLvoid *) glArrayElement, _gloffset_ArrayElement }, - { "glColorPointer", (GLvoid *) glColorPointer, _gloffset_ColorPointer }, - { "glDisableClientState", (GLvoid *) glDisableClientState, _gloffset_DisableClientState }, - { "glDrawArrays", (GLvoid *) glDrawArrays, _gloffset_DrawArrays }, - { "glDrawElements", (GLvoid *) glDrawElements, _gloffset_DrawElements }, - { "glEdgeFlagPointer", (GLvoid *) glEdgeFlagPointer, _gloffset_EdgeFlagPointer }, - { "glEnableClientState", (GLvoid *) glEnableClientState, _gloffset_EnableClientState }, - { "glGetPointerv", (GLvoid *) glGetPointerv, _gloffset_GetPointerv }, - { "glIndexPointer", (GLvoid *) glIndexPointer, _gloffset_IndexPointer }, - { "glInterleavedArrays", (GLvoid *) glInterleavedArrays, _gloffset_InterleavedArrays }, - { "glNormalPointer", (GLvoid *) glNormalPointer, _gloffset_NormalPointer }, - { "glTexCoordPointer", (GLvoid *) glTexCoordPointer, _gloffset_TexCoordPointer }, - { "glVertexPointer", (GLvoid *) glVertexPointer, _gloffset_VertexPointer }, - { "glPolygonOffset", (GLvoid *) glPolygonOffset, _gloffset_PolygonOffset }, - { "glCopyTexImage1D", (GLvoid *) glCopyTexImage1D, _gloffset_CopyTexImage1D }, - { "glCopyTexImage2D", (GLvoid *) glCopyTexImage2D, _gloffset_CopyTexImage2D }, - { "glCopyTexSubImage1D", (GLvoid *) glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D }, - { "glCopyTexSubImage2D", (GLvoid *) glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D }, - { "glTexSubImage1D", (GLvoid *) glTexSubImage1D, _gloffset_TexSubImage1D }, - { "glTexSubImage2D", (GLvoid *) glTexSubImage2D, _gloffset_TexSubImage2D }, - { "glAreTexturesResident", (GLvoid *) glAreTexturesResident, _gloffset_AreTexturesResident }, - { "glBindTexture", (GLvoid *) glBindTexture, _gloffset_BindTexture }, - { "glDeleteTextures", (GLvoid *) glDeleteTextures, _gloffset_DeleteTextures }, - { "glGenTextures", (GLvoid *) glGenTextures, _gloffset_GenTextures }, - { "glIsTexture", (GLvoid *) glIsTexture, _gloffset_IsTexture }, - { "glPrioritizeTextures", (GLvoid *) glPrioritizeTextures, _gloffset_PrioritizeTextures }, - { "glIndexub", (GLvoid *) glIndexub, _gloffset_Indexub }, - { "glIndexubv", (GLvoid *) glIndexubv, _gloffset_Indexubv }, - { "glPopClientAttrib", (GLvoid *) glPopClientAttrib, _gloffset_PopClientAttrib }, - { "glPushClientAttrib", (GLvoid *) glPushClientAttrib, _gloffset_PushClientAttrib }, - /* 1.2 */ -#ifdef GL_VERSION_1_2 -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) NotImplemented -#endif - { "glBlendColor", (GLvoid *) NAME(glBlendColor), _gloffset_BlendColor }, - { "glBlendEquation", (GLvoid *) NAME(glBlendEquation), _gloffset_BlendEquation }, - { "glDrawRangeElements", (GLvoid *) NAME(glDrawRangeElements), _gloffset_DrawRangeElements }, - { "glColorTable", (GLvoid *) NAME(glColorTable), _gloffset_ColorTable }, - { "glColorTableParameterfv", (GLvoid *) NAME(glColorTableParameterfv), _gloffset_ColorTableParameterfv }, - { "glColorTableParameteriv", (GLvoid *) NAME(glColorTableParameteriv), _gloffset_ColorTableParameteriv }, - { "glCopyColorTable", (GLvoid *) NAME(glCopyColorTable), _gloffset_CopyColorTable }, - { "glGetColorTable", (GLvoid *) NAME(glGetColorTable), _gloffset_GetColorTable }, - { "glGetColorTableParameterfv", (GLvoid *) NAME(glGetColorTableParameterfv), _gloffset_GetColorTableParameterfv }, - { "glGetColorTableParameteriv", (GLvoid *) NAME(glGetColorTableParameteriv), _gloffset_GetColorTableParameteriv }, - { "glColorSubTable", (GLvoid *) NAME(glColorSubTable), _gloffset_ColorSubTable }, - { "glCopyColorSubTable", (GLvoid *) NAME(glCopyColorSubTable), _gloffset_CopyColorSubTable }, - { "glConvolutionFilter1D", (GLvoid *) NAME(glConvolutionFilter1D), _gloffset_ConvolutionFilter1D }, - { "glConvolutionFilter2D", (GLvoid *) NAME(glConvolutionFilter2D), _gloffset_ConvolutionFilter2D }, - { "glConvolutionParameterf", (GLvoid *) NAME(glConvolutionParameterf), _gloffset_ConvolutionParameterf }, - { "glConvolutionParameterfv", (GLvoid *) NAME(glConvolutionParameterfv), _gloffset_ConvolutionParameterfv }, - { "glConvolutionParameteri", (GLvoid *) NAME(glConvolutionParameteri), _gloffset_ConvolutionParameteri }, - { "glConvolutionParameteriv", (GLvoid *) NAME(glConvolutionParameteriv), _gloffset_ConvolutionParameteriv }, - { "glCopyConvolutionFilter1D", (GLvoid *) NAME(glCopyConvolutionFilter1D), _gloffset_CopyConvolutionFilter1D }, - { "glCopyConvolutionFilter2D", (GLvoid *) NAME(glCopyConvolutionFilter2D), _gloffset_CopyConvolutionFilter2D }, - { "glGetConvolutionFilter", (GLvoid *) NAME(glGetConvolutionFilter), _gloffset_GetConvolutionFilter }, - { "glGetConvolutionParameterfv", (GLvoid *) NAME(glGetConvolutionParameterfv), _gloffset_GetConvolutionParameterfv }, - { "glGetConvolutionParameteriv", (GLvoid *) NAME(glGetConvolutionParameteriv), _gloffset_GetConvolutionParameteriv }, - { "glGetSeparableFilter", (GLvoid *) NAME(glGetSeparableFilter), _gloffset_GetSeparableFilter }, - { "glSeparableFilter2D", (GLvoid *) NAME(glSeparableFilter2D), _gloffset_SeparableFilter2D }, - { "glGetHistogram", (GLvoid *) NAME(glGetHistogram), _gloffset_GetHistogram }, - { "glGetHistogramParameterfv", (GLvoid *) NAME(glGetHistogramParameterfv), _gloffset_GetHistogramParameterfv }, - { "glGetHistogramParameteriv", (GLvoid *) NAME(glGetHistogramParameteriv), _gloffset_GetHistogramParameteriv }, - { "glGetMinmax", (GLvoid *) NAME(glGetMinmax), _gloffset_GetMinmax }, - { "glGetMinmaxParameterfv", (GLvoid *) NAME(glGetMinmaxParameterfv), _gloffset_GetMinmaxParameterfv }, - { "glGetMinmaxParameteriv", (GLvoid *) NAME(glGetMinmaxParameteriv), _gloffset_GetMinmaxParameteriv }, - { "glHistogram", (GLvoid *) NAME(glHistogram), _gloffset_Histogram }, - { "glMinmax", (GLvoid *) NAME(glMinmax), _gloffset_Minmax }, - { "glResetHistogram", (GLvoid *) NAME(glResetHistogram), _gloffset_ResetHistogram }, - { "glResetMinmax", (GLvoid *) NAME(glResetMinmax), _gloffset_ResetMinmax }, - { "glTexImage3D", (GLvoid *) NAME(glTexImage3D), _gloffset_TexImage3D }, - { "glTexSubImage3D", (GLvoid *) NAME(glTexSubImage3D), _gloffset_TexSubImage3D }, - { "glCopyTexSubImage3D", (GLvoid *) NAME(glCopyTexSubImage3D), _gloffset_CopyTexSubImage3D }, -#undef NAME - - /* 1.3 */ -#ifdef GL_VERSION_1_3 -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) NotImplemented -#endif - { "glActiveTexture", (GLvoid *) NAME(glActiveTexture), _gloffset_ActiveTextureARB }, - { "glClientActiveTexture", (GLvoid *) NAME(glClientActiveTexture), _gloffset_ClientActiveTextureARB }, - { "glCompressedTexImage1D", (GLvoid *) NAME(glCompressedTexImage1D), _gloffset_CompressedTexImage1DARB }, - { "glCompressedTexImage2D", (GLvoid *) NAME(glCompressedTexImage2D), _gloffset_CompressedTexImage2DARB }, - { "glCompressedTexImage3D", (GLvoid *) NAME(glCompressedTexImage3D), _gloffset_CompressedTexImage3DARB }, - { "glCompressedTexSubImage1D", (GLvoid *) NAME(glCompressedTexSubImage1D), _gloffset_CompressedTexSubImage1DARB }, - { "glCompressedTexSubImage2D", (GLvoid *) NAME(glCompressedTexSubImage2D), _gloffset_CompressedTexSubImage2DARB }, - { "glCompressedTexSubImage3D", (GLvoid *) NAME(glCompressedTexSubImage3D), _gloffset_CompressedTexSubImage3DARB }, - { "glGetCompressedTexImage", (GLvoid *) NAME(glGetCompressedTexImage), _gloffset_GetCompressedTexImageARB }, - { "glMultiTexCoord1d", (GLvoid *) NAME(glMultiTexCoord1d), _gloffset_MultiTexCoord1dARB }, - { "glMultiTexCoord1dv", (GLvoid *) NAME(glMultiTexCoord1dv), _gloffset_MultiTexCoord1dvARB }, - { "glMultiTexCoord1f", (GLvoid *) NAME(glMultiTexCoord1f), _gloffset_MultiTexCoord1fARB }, - { "glMultiTexCoord1fv", (GLvoid *) NAME(glMultiTexCoord1fv), _gloffset_MultiTexCoord1fvARB }, - { "glMultiTexCoord1i", (GLvoid *) NAME(glMultiTexCoord1i), _gloffset_MultiTexCoord1iARB }, - { "glMultiTexCoord1iv", (GLvoid *) NAME(glMultiTexCoord1iv), _gloffset_MultiTexCoord1ivARB }, - { "glMultiTexCoord1s", (GLvoid *) NAME(glMultiTexCoord1s), _gloffset_MultiTexCoord1sARB }, - { "glMultiTexCoord1sv", (GLvoid *) NAME(glMultiTexCoord1sv), _gloffset_MultiTexCoord1svARB }, - { "glMultiTexCoord2d", (GLvoid *) NAME(glMultiTexCoord2d), _gloffset_MultiTexCoord2dARB }, - { "glMultiTexCoord2dv", (GLvoid *) NAME(glMultiTexCoord2dv), _gloffset_MultiTexCoord2dvARB }, - { "glMultiTexCoord2f", (GLvoid *) NAME(glMultiTexCoord2f), _gloffset_MultiTexCoord2fARB }, - { "glMultiTexCoord2fv", (GLvoid *) NAME(glMultiTexCoord2fv), _gloffset_MultiTexCoord2fvARB }, - { "glMultiTexCoord2i", (GLvoid *) NAME(glMultiTexCoord2i), _gloffset_MultiTexCoord2iARB }, - { "glMultiTexCoord2iv", (GLvoid *) NAME(glMultiTexCoord2iv), _gloffset_MultiTexCoord2ivARB }, - { "glMultiTexCoord2s", (GLvoid *) NAME(glMultiTexCoord2s), _gloffset_MultiTexCoord2sARB }, - { "glMultiTexCoord2sv", (GLvoid *) NAME(glMultiTexCoord2sv), _gloffset_MultiTexCoord2svARB }, - { "glMultiTexCoord3d", (GLvoid *) NAME(glMultiTexCoord3d), _gloffset_MultiTexCoord3dARB }, - { "glMultiTexCoord3dv", (GLvoid *) NAME(glMultiTexCoord3dv), _gloffset_MultiTexCoord3dvARB }, - { "glMultiTexCoord3f", (GLvoid *) NAME(glMultiTexCoord3f), _gloffset_MultiTexCoord3fARB }, - { "glMultiTexCoord3fv", (GLvoid *) NAME(glMultiTexCoord3fv), _gloffset_MultiTexCoord3fvARB }, - { "glMultiTexCoord3i", (GLvoid *) NAME(glMultiTexCoord3i), _gloffset_MultiTexCoord3iARB }, - { "glMultiTexCoord3iv", (GLvoid *) NAME(glMultiTexCoord3iv), _gloffset_MultiTexCoord3ivARB }, - { "glMultiTexCoord3s", (GLvoid *) NAME(glMultiTexCoord3s), _gloffset_MultiTexCoord3sARB }, - { "glMultiTexCoord3sv", (GLvoid *) NAME(glMultiTexCoord3sv), _gloffset_MultiTexCoord3svARB }, - { "glMultiTexCoord4d", (GLvoid *) NAME(glMultiTexCoord4d), _gloffset_MultiTexCoord4dARB }, - { "glMultiTexCoord4dv", (GLvoid *) NAME(glMultiTexCoord4dv), _gloffset_MultiTexCoord4dvARB }, - { "glMultiTexCoord4f", (GLvoid *) NAME(glMultiTexCoord4f), _gloffset_MultiTexCoord4fARB }, - { "glMultiTexCoord4fv", (GLvoid *) NAME(glMultiTexCoord4fv), _gloffset_MultiTexCoord4fvARB }, - { "glMultiTexCoord4i", (GLvoid *) NAME(glMultiTexCoord4i), _gloffset_MultiTexCoord4iARB }, - { "glMultiTexCoord4iv", (GLvoid *) NAME(glMultiTexCoord4iv), _gloffset_MultiTexCoord4ivARB }, - { "glMultiTexCoord4s", (GLvoid *) NAME(glMultiTexCoord4s), _gloffset_MultiTexCoord4sARB }, - { "glMultiTexCoord4sv", (GLvoid *) NAME(glMultiTexCoord4sv), _gloffset_MultiTexCoord4svARB }, - { "glLoadTransposeMatrixd", (GLvoid *) NAME(glLoadTransposeMatrixd), _gloffset_LoadTransposeMatrixdARB }, - { "glLoadTransposeMatrixf", (GLvoid *) NAME(glLoadTransposeMatrixf), _gloffset_LoadTransposeMatrixfARB }, - { "glMultTransposeMatrixd", (GLvoid *) NAME(glMultTransposeMatrixd), _gloffset_MultTransposeMatrixdARB }, - { "glMultTransposeMatrixf", (GLvoid *) NAME(glMultTransposeMatrixf), _gloffset_MultTransposeMatrixfARB }, - { "glSampleCoverage", (GLvoid *) NAME(glSampleCoverage), _gloffset_SampleCoverageARB }, -#if 0 - { "glSamplePass", (GLvoid *) NAME(glSamplePass), _gloffset_SamplePassARB }, -#endif -#undef NAME - - /* ARB 1. GL_ARB_multitexture */ -#ifdef GL_ARB_multitexture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) NotImplemented -#endif - { "glActiveTextureARB", (GLvoid *) NAME(glActiveTextureARB), _gloffset_ActiveTextureARB }, - { "glClientActiveTextureARB", (GLvoid *) NAME(glClientActiveTextureARB), _gloffset_ClientActiveTextureARB }, - { "glMultiTexCoord1dARB", (GLvoid *) NAME(glMultiTexCoord1dARB), _gloffset_MultiTexCoord1dARB }, - { "glMultiTexCoord1dvARB", (GLvoid *) NAME(glMultiTexCoord1dvARB), _gloffset_MultiTexCoord1dvARB }, - { "glMultiTexCoord1fARB", (GLvoid *) NAME(glMultiTexCoord1fARB), _gloffset_MultiTexCoord1fARB }, - { "glMultiTexCoord1fvARB", (GLvoid *) NAME(glMultiTexCoord1fvARB), _gloffset_MultiTexCoord1fvARB }, - { "glMultiTexCoord1iARB", (GLvoid *) NAME(glMultiTexCoord1iARB), _gloffset_MultiTexCoord1iARB }, - { "glMultiTexCoord1ivARB", (GLvoid *) NAME(glMultiTexCoord1ivARB), _gloffset_MultiTexCoord1ivARB }, - { "glMultiTexCoord1sARB", (GLvoid *) NAME(glMultiTexCoord1sARB), _gloffset_MultiTexCoord1sARB }, - { "glMultiTexCoord1svARB", (GLvoid *) NAME(glMultiTexCoord1svARB), _gloffset_MultiTexCoord1svARB }, - { "glMultiTexCoord2dARB", (GLvoid *) NAME(glMultiTexCoord2dARB), _gloffset_MultiTexCoord2dARB }, - { "glMultiTexCoord2dvARB", (GLvoid *) NAME(glMultiTexCoord2dvARB), _gloffset_MultiTexCoord2dvARB }, - { "glMultiTexCoord2fARB", (GLvoid *) NAME(glMultiTexCoord2fARB), _gloffset_MultiTexCoord2fARB }, - { "glMultiTexCoord2fvARB", (GLvoid *) NAME(glMultiTexCoord2fvARB), _gloffset_MultiTexCoord2fvARB }, - { "glMultiTexCoord2iARB", (GLvoid *) NAME(glMultiTexCoord2iARB), _gloffset_MultiTexCoord2iARB }, - { "glMultiTexCoord2ivARB", (GLvoid *) NAME(glMultiTexCoord2ivARB), _gloffset_MultiTexCoord2ivARB }, - { "glMultiTexCoord2sARB", (GLvoid *) NAME(glMultiTexCoord2sARB), _gloffset_MultiTexCoord2sARB }, - { "glMultiTexCoord2svARB", (GLvoid *) NAME(glMultiTexCoord2svARB), _gloffset_MultiTexCoord2svARB }, - { "glMultiTexCoord3dARB", (GLvoid *) NAME(glMultiTexCoord3dARB), _gloffset_MultiTexCoord3dARB }, - { "glMultiTexCoord3dvARB", (GLvoid *) NAME(glMultiTexCoord3dvARB), _gloffset_MultiTexCoord3dvARB }, - { "glMultiTexCoord3fARB", (GLvoid *) NAME(glMultiTexCoord3fARB), _gloffset_MultiTexCoord3fARB }, - { "glMultiTexCoord3fvARB", (GLvoid *) NAME(glMultiTexCoord3fvARB), _gloffset_MultiTexCoord3fvARB }, - { "glMultiTexCoord3iARB", (GLvoid *) NAME(glMultiTexCoord3iARB), _gloffset_MultiTexCoord3iARB }, - { "glMultiTexCoord3ivARB", (GLvoid *) NAME(glMultiTexCoord3ivARB), _gloffset_MultiTexCoord3ivARB }, - { "glMultiTexCoord3sARB", (GLvoid *) NAME(glMultiTexCoord3sARB), _gloffset_MultiTexCoord3sARB }, - { "glMultiTexCoord3svARB", (GLvoid *) NAME(glMultiTexCoord3svARB), _gloffset_MultiTexCoord3svARB }, - { "glMultiTexCoord4dARB", (GLvoid *) NAME(glMultiTexCoord4dARB), _gloffset_MultiTexCoord4dARB }, - { "glMultiTexCoord4dvARB", (GLvoid *) NAME(glMultiTexCoord4dvARB), _gloffset_MultiTexCoord4dvARB }, - { "glMultiTexCoord4fARB", (GLvoid *) NAME(glMultiTexCoord4fARB), _gloffset_MultiTexCoord4fARB }, - { "glMultiTexCoord4fvARB", (GLvoid *) NAME(glMultiTexCoord4fvARB), _gloffset_MultiTexCoord4fvARB }, - { "glMultiTexCoord4iARB", (GLvoid *) NAME(glMultiTexCoord4iARB), _gloffset_MultiTexCoord4iARB }, - { "glMultiTexCoord4ivARB", (GLvoid *) NAME(glMultiTexCoord4ivARB), _gloffset_MultiTexCoord4ivARB }, - { "glMultiTexCoord4sARB", (GLvoid *) NAME(glMultiTexCoord4sARB), _gloffset_MultiTexCoord4sARB }, - { "glMultiTexCoord4svARB", (GLvoid *) NAME(glMultiTexCoord4svARB), _gloffset_MultiTexCoord4svARB }, -#undef NAME - - /* ARB 3. GL_ARB_transpose_matrix */ -#ifdef GL_ARB_transpose_matrix -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) NotImplemented -#endif - { "glLoadTransposeMatrixdARB", (GLvoid *) NAME(glLoadTransposeMatrixdARB), _gloffset_LoadTransposeMatrixdARB }, - { "glLoadTransposeMatrixfARB", (GLvoid *) NAME(glLoadTransposeMatrixfARB), _gloffset_LoadTransposeMatrixfARB }, - { "glMultTransposeMatrixdARB", (GLvoid *) NAME(glMultTransposeMatrixdARB), _gloffset_MultTransposeMatrixdARB }, - { "glMultTransposeMatrixfARB", (GLvoid *) NAME(glMultTransposeMatrixfARB), _gloffset_MultTransposeMatrixfARB }, -#undef NAME - - /* ARB 5. GL_ARB_multisample */ -#ifdef GL_ARB_multisample -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glSampleCoverageARB", NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB }, -#undef NAME - - /* ARB 12. GL_ARB_texture_compression */ -#ifdef GL_ARB_texture_compression -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glCompressedTexImage3DARB", NAME(glCompressedTexImage3DARB), _gloffset_CompressedTexImage3DARB }, - { "glCompressedTexImage2DARB", NAME(glCompressedTexImage2DARB), _gloffset_CompressedTexImage2DARB }, - { "glCompressedTexImage1DARB", NAME(glCompressedTexImage1DARB), _gloffset_CompressedTexImage1DARB }, - { "glCompressedTexSubImage3DARB", NAME(glCompressedTexSubImage3DARB), _gloffset_CompressedTexSubImage3DARB }, - { "glCompressedTexSubImage2DARB", NAME(glCompressedTexSubImage2DARB), _gloffset_CompressedTexSubImage2DARB }, - { "glCompressedTexSubImage1DARB", NAME(glCompressedTexSubImage1DARB), _gloffset_CompressedTexSubImage1DARB }, - { "glGetCompressedTexImageARB", NAME(glGetCompressedTexImageARB), _gloffset_GetCompressedTexImageARB }, -#undef NAME - - /* 2. GL_EXT_blend_color */ -#ifdef GL_EXT_blend_color -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glBlendColorEXT", NAME(glBlendColorEXT), _gloffset_BlendColor }, -#undef NAME - - /* 3. GL_EXT_polygon_offset */ -#ifdef GL_EXT_polygon_offset -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glPolygonOffsetEXT", NAME(glPolygonOffsetEXT), _gloffset_PolygonOffsetEXT }, -#undef NAME - - /* 6. GL_EXT_texture3D */ -#ifdef GL_EXT_texture3D -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glCopyTexSubImage3DEXT", NAME(glCopyTexSubImage3DEXT), _gloffset_CopyTexSubImage3D }, - { "glTexImage3DEXT", NAME(glTexImage3DEXT), _gloffset_TexImage3D }, - { "glTexSubImage3DEXT", NAME(glTexSubImage3DEXT), _gloffset_TexSubImage3D }, -#undef NAME - - /* 7. GL_SGI_texture_filter4 */ -#ifdef GL_SGI_texture_filter4 -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glGetTexFilterFuncSGIS", NAME(glGetTexFilterFuncSGIS), _gloffset_GetTexFilterFuncSGIS }, - { "glTexFilterFuncSGIS", NAME(glTexFilterFuncSGIS), _gloffset_TexFilterFuncSGIS }, -#undef NAME - - /* 9. GL_EXT_subtexture */ -#ifdef GL_EXT_subtexture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glTexSubImage1DEXT", NAME(glTexSubImage1DEXT), _gloffset_TexSubImage1D }, - { "glTexSubImage2DEXT", NAME(glTexSubImage2DEXT), _gloffset_TexSubImage2D }, -#undef NAME - - /* 10. GL_EXT_copy_texture */ -#ifdef GL_EXT_copy_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glCopyTexImage1DEXT", NAME(glCopyTexImage1DEXT), _gloffset_CopyTexImage1D }, - { "glCopyTexImage2DEXT", NAME(glCopyTexImage2DEXT), _gloffset_CopyTexImage2D }, - { "glCopyTexSubImage1DEXT", NAME(glCopyTexSubImage1DEXT), _gloffset_CopyTexSubImage1D }, - { "glCopyTexSubImage2DEXT", NAME(glCopyTexSubImage2DEXT), _gloffset_CopyTexSubImage2D }, -#undef NAME - - /* 11. GL_EXT_histogram */ -#ifdef GL_EXT_histogram -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glGetHistogramEXT", NAME(glGetHistogramEXT), _gloffset_GetHistogramEXT }, - { "glGetHistogramParameterfvEXT", NAME(glGetHistogramParameterfvEXT), _gloffset_GetHistogramParameterfvEXT }, - { "glGetHistogramParameterivEXT", NAME(glGetHistogramParameterivEXT), _gloffset_GetHistogramParameterivEXT }, - { "glGetMinmaxEXT", NAME(glGetMinmaxEXT), _gloffset_GetMinmaxEXT }, - { "glGetMinmaxParameterfvEXT", NAME(glGetMinmaxParameterfvEXT), _gloffset_GetMinmaxParameterfvEXT }, - { "glGetMinmaxParameterivEXT", NAME(glGetMinmaxParameterivEXT), _gloffset_GetMinmaxParameterivEXT }, - { "glHistogramEXT", NAME(glHistogramEXT), _gloffset_Histogram }, - { "glMinmaxEXT", NAME(glMinmaxEXT), _gloffset_Minmax }, - { "glResetHistogramEXT", NAME(glResetHistogramEXT), _gloffset_ResetHistogram }, - { "glResetMinmaxEXT", NAME(glResetMinmaxEXT), _gloffset_ResetMinmax }, -#undef NAME - - /* 12. GL_EXT_convolution */ -#ifdef GL_EXT_convolution -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glConvolutionFilter1DEXT", NAME(glConvolutionFilter1DEXT), _gloffset_ConvolutionFilter1D }, - { "glConvolutionFilter2DEXT", NAME(glConvolutionFilter2DEXT), _gloffset_ConvolutionFilter2D }, - { "glConvolutionParameterfEXT", NAME(glConvolutionParameterfEXT), _gloffset_ConvolutionParameterf }, - { "glConvolutionParameterfvEXT", NAME(glConvolutionParameterfvEXT), _gloffset_ConvolutionParameterfv }, - { "glConvolutionParameteriEXT", NAME(glConvolutionParameteriEXT), _gloffset_ConvolutionParameteri }, - { "glConvolutionParameterivEXT", NAME(glConvolutionParameterivEXT), _gloffset_ConvolutionParameteriv }, - { "glCopyConvolutionFilter1DEXT", NAME(glCopyConvolutionFilter1DEXT), _gloffset_CopyConvolutionFilter1D }, - { "glCopyConvolutionFilter2DEXT", NAME(glCopyConvolutionFilter2DEXT), _gloffset_CopyConvolutionFilter2D }, - { "glGetConvolutionFilterEXT", NAME(glGetConvolutionFilterEXT), _gloffset_GetConvolutionFilterEXT }, - { "glGetConvolutionParameterivEXT", NAME(glGetConvolutionParameterivEXT), _gloffset_GetConvolutionParameterivEXT }, - { "glGetConvolutionParameterfvEXT", NAME(glGetConvolutionParameterfvEXT), _gloffset_GetConvolutionParameterfvEXT }, - { "glGetSeparableFilterEXT", NAME(glGetSeparableFilterEXT), _gloffset_GetSeparableFilterEXT }, - { "glSeparableFilter2DEXT", NAME(glSeparableFilter2DEXT), _gloffset_SeparableFilter2D }, -#undef NAME - - /* 14. GL_SGI_color_table */ -#ifdef GL_SGI_color_table -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glColorTableSGI", NAME(glColorTableSGI), _gloffset_ColorTable }, - { "glColorTableParameterfvSGI", NAME(glColorTableParameterfvSGI), _gloffset_ColorTableParameterfv }, - { "glColorTableParameterivSGI", NAME(glColorTableParameterivSGI), _gloffset_ColorTableParameteriv }, - { "glCopyColorTableSGI", NAME(glCopyColorTableSGI), _gloffset_CopyColorTable }, - { "glGetColorTableSGI", NAME(glGetColorTableSGI), _gloffset_GetColorTableSGI }, - { "glGetColorTableParameterfvSGI", NAME(glGetColorTableParameterfvSGI), _gloffset_GetColorTableParameterfvSGI }, - { "glGetColorTableParameterivSGI", NAME(glGetColorTableParameterivSGI), _gloffset_GetColorTableParameterivSGI }, -#undef NAME - - /* 15. GL_SGIS_pixel_texture */ -#ifdef GL_SGIS_pixel_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glPixelTexGenParameterfSGIS", NAME(glPixelTexGenParameterfSGIS), _gloffset_PixelTexGenParameterfSGIS }, - { "glPixelTexGenParameterfvSGIS", NAME(glPixelTexGenParameterfvSGIS), _gloffset_PixelTexGenParameterfvSGIS }, - { "glPixelTexGenParameteriSGIS", NAME(glPixelTexGenParameteriSGIS), _gloffset_PixelTexGenParameteriSGIS }, - { "glPixelTexGenParameterivSGIS", NAME(glPixelTexGenParameterivSGIS), _gloffset_PixelTexGenParameterivSGIS }, - { "glGetPixelTexGenParameterfvSGIS", NAME(glGetPixelTexGenParameterfvSGIS), _gloffset_GetPixelTexGenParameterfvSGIS }, - { "glGetPixelTexGenParameterivSGIS", NAME(glGetPixelTexGenParameterivSGIS), _gloffset_GetPixelTexGenParameterivSGIS }, -#undef NAME - - /* 15a. GL_SGIX_pixel_texture */ -#ifdef GL_SGIX_pixel_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glPixelTexGenSGIX", NAME(glPixelTexGenSGIX), _gloffset_PixelTexGenSGIX }, -#undef NAME - - /* 16. GL_SGIS_texture4D */ -#ifdef GL_SGIS_texture4D -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glTexImage4DSGIS", NAME(glTexImage4DSGIS), _gloffset_TexImage4DSGIS }, - { "glTexSubImage4DSGIS", NAME(glTexSubImage4DSGIS), _gloffset_TexSubImage4DSGIS }, -#undef NAME - - /* 20. GL_EXT_texture_object */ -#ifdef GL_EXT_texture_object -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glAreTexturesResidentEXT", NAME(glAreTexturesResidentEXT), _gloffset_AreTexturesResidentEXT }, - { "glBindTextureEXT", NAME(glBindTextureEXT), _gloffset_BindTexture }, - { "glDeleteTexturesEXT", NAME(glDeleteTexturesEXT), _gloffset_DeleteTextures }, - { "glGenTexturesEXT", NAME(glGenTexturesEXT), _gloffset_GenTexturesEXT }, - { "glIsTextureEXT", NAME(glIsTextureEXT), _gloffset_IsTextureEXT }, - { "glPrioritizeTexturesEXT", NAME(glPrioritizeTexturesEXT), _gloffset_PrioritizeTextures }, -#undef NAME - - /* 21. GL_SGIS_detail_texture */ -#ifdef GL_SGIS_detail_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glDetailTexFuncSGIS", NAME(glDetailTexFuncSGIS), _gloffset_DetailTexFuncSGIS }, - { "glGetDetailTexFuncSGIS", NAME(glGetDetailTexFuncSGIS), _gloffset_GetDetailTexFuncSGIS }, -#undef NAME - - /* 22. GL_SGIS_sharpen_texture */ -#ifdef GL_SGIS_sharpen_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glGetSharpenTexFuncSGIS", NAME(glGetSharpenTexFuncSGIS), _gloffset_GetSharpenTexFuncSGIS }, - { "glSharpenTexFuncSGIS", NAME(glSharpenTexFuncSGIS), _gloffset_SharpenTexFuncSGIS }, -#undef NAME - - /* 25. GL_SGIS_multisample */ -#ifdef GL_SGIS_multisample -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glSampleMaskSGIS", NAME(glSampleMaskSGIS), _gloffset_SampleMaskSGIS }, - { "glSamplePatternSGIS", NAME(glSamplePatternSGIS), _gloffset_SamplePatternSGIS }, -#undef NAME - - /* 30. GL_EXT_vertex_array */ -#ifdef GL_EXT_vertex_array -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glArrayElementEXT", NAME(glArrayElementEXT), _gloffset_ArrayElement }, - { "glColorPointerEXT", NAME(glColorPointerEXT), _gloffset_ColorPointerEXT }, - { "glDrawArraysEXT", NAME(glDrawArraysEXT), _gloffset_DrawArrays }, - { "glEdgeFlagPointerEXT", NAME(glEdgeFlagPointerEXT), _gloffset_EdgeFlagPointerEXT }, - { "glGetPointervEXT", NAME(glGetPointervEXT), _gloffset_GetPointerv }, - { "glIndexPointerEXT", NAME(glIndexPointerEXT), _gloffset_IndexPointerEXT }, - { "glNormalPointerEXT", NAME(glNormalPointerEXT), _gloffset_NormalPointerEXT }, - { "glTexCoordPointerEXT", NAME(glTexCoordPointerEXT), _gloffset_TexCoordPointerEXT }, - { "glVertexPointerEXT", NAME(glVertexPointerEXT), _gloffset_VertexPointerEXT }, -#undef NAME - - /* 37. GL_EXT_blend_minmax */ -#ifdef GL_EXT_blend_minmax -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glBlendEquationEXT", NAME(glBlendEquationEXT), _gloffset_BlendEquation }, -#undef NAME - - /* 52. GL_SGIX_sprite */ -#ifdef GL_SGIX_sprite -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glSpriteParameterfSGIX", NAME(glSpriteParameterfSGIX), _gloffset_SpriteParameterfSGIX }, - { "glSpriteParameterfvSGIX", NAME(glSpriteParameterfvSGIX), _gloffset_SpriteParameterfvSGIX }, - { "glSpriteParameteriSGIX", NAME(glSpriteParameteriSGIX), _gloffset_SpriteParameteriSGIX }, - { "glSpriteParameterivSGIX", NAME(glSpriteParameterivSGIX), _gloffset_SpriteParameterivSGIX }, -#undef NAME - - /* 54. GL_EXT_point_parameters */ -#ifdef GL_EXT_point_parameters -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glPointParameterfEXT", NAME(glPointParameterfEXT), _gloffset_PointParameterfEXT }, - { "glPointParameterfvEXT", NAME(glPointParameterfvEXT), _gloffset_PointParameterfvEXT }, - { "glPointParameterfSGIS", NAME(glPointParameterfSGIS), _gloffset_PointParameterfEXT }, - { "glPointParameterfvSGIS", NAME(glPointParameterfvSGIS), _gloffset_PointParameterfvEXT }, -#undef NAME - - /* 55. GL_SGIX_instruments */ -#ifdef GL_SGIX_instruments -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glInstrumentsBufferSGIX", NAME(glInstrumentsBufferSGIX), _gloffset_InstrumentsBufferSGIX }, - { "glStartInstrumentsSGIX", NAME(glStartInstrumentsSGIX), _gloffset_StartInstrumentsSGIX }, - { "glStopInstrumentsSGIX", NAME(glStopInstrumentsSGIX), _gloffset_StopInstrumentsSGIX }, - { "glReadInstrumentsSGIX", NAME(glReadInstrumentsSGIX), _gloffset_ReadInstrumentsSGIX }, - { "glPollInstrumentsSGIX", NAME(glPollInstrumentsSGIX), _gloffset_PollInstrumentsSGIX }, - { "glGetInstrumentsSGIX", NAME(glGetInstrumentsSGIX), _gloffset_GetInstrumentsSGIX }, -#undef NAME - - /* 57. GL_SGIX_framezoom */ -#ifdef GL_SGIX_framezoom -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glFrameZoomSGIX", NAME(glFrameZoomSGIX), _gloffset_FrameZoomSGIX }, -#undef NAME - - /* 58. GL_SGIX_tag_sample_buffer */ -#ifdef GL_SGIX_tag_sample_buffer -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glTagSampleBufferSGIX", NAME(glTagSampleBufferSGIX), _gloffset_TagSampleBufferSGIX }, -#undef NAME - - /* 60. GL_SGIX_reference_plane */ -#ifdef GL_SGIX_reference_plane -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glReferencePlaneSGIX", NAME(glReferencePlaneSGIX), _gloffset_ReferencePlaneSGIX }, -#undef NAME - - /* 61. GL_SGIX_flush_raster */ -#ifdef GL_SGIX_flush_raster -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glFlushRasterSGIX", NAME(glFlushRasterSGIX), _gloffset_FlushRasterSGIX }, -#undef NAME - - /* 66. GL_HP_image_transform */ -#if 0 -#ifdef GL_HP_image_transform -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glGetImageTransformParameterfvHP", NAME(glGetImageTransformParameterfvHP), _gloffset_GetImageTransformParameterfvHP }, - { "glGetImageTransformParameterivHP", NAME(glGetImageTransformParameterivHP), _gloffset_GetImageTransformParameterivHP }, - { "glImageTransformParameterfHP", NAME(glImageTransformParameterfHP), _gloffset_ImageTransformParameterfHP }, - { "glImageTransformParameterfvHP", NAME(glImageTransformParameterfvHP), _gloffset_ImageTransformParameterfvHP }, - { "glImageTransformParameteriHP", NAME(glImageTransformParameteriHP), _gloffset_ImageTransformParameteriHP }, - { "glImageTransformParameterivHP", NAME(glImageTransformParameterivHP), _gloffset_ImageTransformParameterivHP }, -#undef NAME -#endif - - /* 74. GL_EXT_color_subtable */ -#ifdef GL_EXT_color_subtable -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glColorSubTableEXT", NAME(glColorSubTableEXT), _gloffset_ColorSubTable }, - { "glCopyColorSubTableEXT", NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable }, -#undef NAME - - /* 77. GL_PGI_misc_hints */ -#ifdef GL_PGI_misc_hints -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glHintPGI", NAME(glHintPGI), _gloffset_HintPGI }, -#undef NAME - - /* 78. GL_EXT_paletted_texture */ -#ifdef GL_EXT_paletted_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glColorTableEXT", NAME(glColorTableEXT), _gloffset_ColorTable }, - { "glGetColorTableEXT", NAME(glGetColorTableEXT), _gloffset_GetColorTable }, - { "glGetColorTableParameterfvEXT", NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv }, - { "glGetColorTableParameterivEXT", NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv }, -#undef NAME - - /* 80. GL_SGIX_list_priority */ -#ifdef GL_SGIX_list_priority -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glGetListParameterfvSGIX", NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX }, - { "glGetListParameterivSGIX", NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX }, - { "glListParameterfSGIX", NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX }, - { "glListParameterfvSGIX", NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX }, - { "glListParameteriSGIX", NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX }, - { "glListParameterivSGIX", NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX }, -#undef NAME - - /* 94. GL_EXT_index_material */ -#ifdef GL_EXT_index_material -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glIndexMaterialEXT", NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, -#undef NAME - - /* 95. GL_EXT_index_func */ -#ifdef GL_EXT_index_func -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glIndexFuncEXT", NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, -#undef NAME - - /* 97. GL_EXT_compiled_vertex_array */ -#ifdef GL_EXT_compiled_vertex_array -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glLockArraysEXT", NAME(glLockArraysEXT), _gloffset_LockArraysEXT }, - { "glUnlockArraysEXT", NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT }, -#undef NAME - - /* 98. GL_EXT_cull_vertex */ -#ifdef GL_EXT_cull_vertex -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glCullParameterfvEXT", NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT }, - { "glCullParameterdvEXT", NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT }, -#undef NAME - - /* 102. GL_SGIX_fragment_lighting */ -#ifdef GL_SGIX_fragment_lighting -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glFragmentColorMaterialSGIX", NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX }, - { "glFragmentLightfSGIX", NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX }, - { "glFragmentLightfvSGIX", NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX }, - { "glFragmentLightiSGIX", NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX }, - { "glFragmentLightivSGIX", NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX }, - { "glFragmentLightModelfSGIX", NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX }, - { "glFragmentLightModelfvSGIX", NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX }, - { "glFragmentLightModeliSGIX", NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX }, - { "glFragmentLightModelivSGIX", NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX }, - { "glFragmentMaterialfSGIX", NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX }, - { "glFragmentMaterialfvSGIX", NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX }, - { "glFragmentMaterialiSGIX", NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX }, - { "glFragmentMaterialivSGIX", NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX }, - { "glGetFragmentLightfvSGIX", NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX }, - { "glGetFragmentLightivSGIX", NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX }, - { "glGetFragmentMaterialfvSGIX", NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX }, - { "glGetFragmentMaterialivSGIX", NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX }, - { "glLightEnviSGIX", NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX }, -#undef NAME - - /* 112. GL_EXT_draw_range_elements */ -#if 000 -#ifdef GL_EXT_draw_range_elements -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glDrawRangeElementsEXT", NAME(glDrawRangeElementsEXT), _gloffset_DrawRangeElementsEXT }, -#undef NAME -#endif - - /* 117. GL_EXT_light_texture */ -#if 000 -#ifdef GL_EXT_light_texture -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glApplyTextureEXT", NAME(glApplyTextureEXT), _gloffset_ApplyTextureEXT }, - { "glTextureLightEXT", NAME(glTextureLightEXT), _gloffset_TextureLightEXT }, - { "glTextureMaterialEXT", NAME(glTextureMaterialEXT), _gloffset_TextureMaterialEXT }, -#undef NAME - - /* 135. GL_INTEL_texture_scissor */ -#ifdef GL_INTEL_texture_scissor -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glTexScissorINTEL", NAME(glTexScissorINTEL), _gloffset_TexScissorINTEL }, - { "glTexScissorFuncINTEL", NAME(glTexScissorFuncINTEL), _gloffset_glTexScissorFuncINTEL }, -#undef NAME - - /* 136. GL_INTEL_parallel_arrays */ -#ifdef GL_INTEL_parallel_arrays -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glVertexPointervINTEL", NAME(glVertexPointervINTEL), _gloffset_VertexPointervINTEL }, - { "glNormalPointervINTEL", NAME(glNormalPointervINTEL), _gloffset_NormalPointervINTEL }, - { "glColorPointervINTEL", NAME(glColorPointervINTEL), _gloffset_ColorPointervINTEL }, - { "glTexCoordPointervINTEL", NAME(glTexCoordPointervINTEL), _gloffset_glxCoordPointervINTEL }, -#undef NAME -#endif - - /* 138. GL_EXT_pixel_transform */ -#if 000 -#ifdef GL_EXT_pixel_transform -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glPixelTransformParameteriEXT", NAME(glPixelTransformParameteriEXT), _gloffset_PixelTransformParameteriEXT }, - { "glPixelTransformParameterfEXT", NAME(glPixelTransformParameterfEXT), _gloffset_PixelTransformParameterfEXT }, - { "glPixelTransformParameterivEXT", NAME(glPixelTransformParameterivEXT), _gloffset_PixelTransformParameterivEXT }, - { "glPixelTransformParameterfvEXT", NAME(glPixelTransformParameterfvEXT), _gloffset_PixelTransformParameterfvEXT }, - { "glGetPixelTransformParameterivEXT", NAME(glGetPixelTransformParameterivEXT), _gloffset_GetPixelTransformParameterivEXT }, - { "glGetPixelTransformParameterfvEXT", NAME(glGetPixelTransformParameterfvEXT), _gloffset_GetPixelTransformParameterfvEXT }, -#undef NAME -#endif - - /* 145. GL_EXT_secondary_color */ -#ifdef GL_EXT_secondary_color -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glSecondaryColor3bEXT", NAME(glSecondaryColor3bEXT), _gloffset_SecondaryColor3bEXT }, - { "glSecondaryColor3dEXT", NAME(glSecondaryColor3dEXT), _gloffset_SecondaryColor3dEXT }, - { "glSecondaryColor3fEXT", NAME(glSecondaryColor3fEXT), _gloffset_SecondaryColor3fEXT }, - { "glSecondaryColor3iEXT", NAME(glSecondaryColor3iEXT), _gloffset_SecondaryColor3iEXT }, - { "glSecondaryColor3sEXT", NAME(glSecondaryColor3sEXT), _gloffset_SecondaryColor3sEXT }, - { "glSecondaryColor3ubEXT", NAME(glSecondaryColor3ubEXT), _gloffset_SecondaryColor3ubEXT }, - { "glSecondaryColor3uiEXT", NAME(glSecondaryColor3uiEXT), _gloffset_SecondaryColor3uiEXT }, - { "glSecondaryColor3usEXT", NAME(glSecondaryColor3usEXT), _gloffset_SecondaryColor3usEXT }, - { "glSecondaryColor3bvEXT", NAME(glSecondaryColor3bvEXT), _gloffset_SecondaryColor3bvEXT }, - { "glSecondaryColor3dvEXT", NAME(glSecondaryColor3dvEXT), _gloffset_SecondaryColor3dvEXT }, - { "glSecondaryColor3fvEXT", NAME(glSecondaryColor3fvEXT), _gloffset_SecondaryColor3fvEXT }, - { "glSecondaryColor3ivEXT", NAME(glSecondaryColor3ivEXT), _gloffset_SecondaryColor3ivEXT }, - { "glSecondaryColor3svEXT", NAME(glSecondaryColor3svEXT), _gloffset_SecondaryColor3svEXT }, - { "glSecondaryColor3ubvEXT", NAME(glSecondaryColor3ubvEXT), _gloffset_SecondaryColor3ubvEXT }, - { "glSecondaryColor3uivEXT", NAME(glSecondaryColor3uivEXT), _gloffset_SecondaryColor3uivEXT }, - { "glSecondaryColor3usvEXT", NAME(glSecondaryColor3usvEXT), _gloffset_SecondaryColor3usvEXT }, - { "glSecondaryColorPointerEXT", NAME(glSecondaryColorPointerEXT), _gloffset_SecondaryColorPointerEXT }, -#undef NAME - - /* 147. GL_EXT_texture_perturb_normal */ -#if 000 -#ifdef GL_EXT_texture_perturb_normal -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glTextureNormalEXT", NAME(glTextureNormalEXT), _gloffset_TextureNormalEXT }, -#undef NAME -#endif - - /* 148. GL_EXT_multi_draw_arrays */ -#if 000 -#ifdef GL_EXT_multi_draw_arrays -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glMultiDrawArraysEXT", NAME(glMultiDrawArraysEXT), _gloffset_MultiDrawArraysEXT }, -#undef NAME -#endif - - /* 149. GL_EXT_fog_coord */ -#ifdef GL_EXT_fog_coord -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glFogCoordfEXT", NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, - { "glFogCoordfvEXT", NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, - { "glFogCoorddEXT", NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoorddvEXT", NAME(glFogCoorddvEXT), _gloffset_FogCoorddvEXT }, - { "glFogCoordPointerEXT", NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, -#undef NAME - - /* 156. GL_EXT_coordinate_frame */ -#if 000 -#ifdef GL_EXT_coordinate_frame -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glTangent3bEXT", NAME(glTangent3bEXT), _gloffset_Tangent3bEXT }, - { "glTangent3dEXT", NAME(glTangent3dEXT), _gloffset_Tangent3dEXT }, - { "glTangent3fEXT", NAME(glTangent3fEXT), _gloffset_Tangent3fEXT }, - { "glTangent3iEXT", NAME(glTangent3iEXT), _gloffset_Tangent3iEXT }, - { "glTangent3sEXT", NAME(glTangent3sEXT), _gloffset_Tangent3sEXT }, - { "glTangent3bvEXT", NAME(glTangent3bvEXT), _gloffset_Tangent3bvEXT }, - { "glTangent3dvEXT", NAME(glTangent3dvEXT), _gloffset_Tangent3dvEXT }, - { "glTangent3fvEXT", NAME(glTangent3fvEXT), _gloffset_Tangent3fvEXT }, - { "glTangent3ivEXT", NAME(glTangent3ivEXT), _gloffset_Tangent3ivEXT }, - { "glTangent3svEXT", NAME(glTangent3svEXT), _gloffset_Tangent3svEXT }, - { "glBinormal3bEXT", NAME(glBinormal3bEXT), _gloffset_Binormal3bEXT }, - { "glBinormal3dEXT", NAME(glBinormal3dEXT), _gloffset_Binormal3dEXT }, - { "glBinormal3fEXT", NAME(glBinormal3fEXT), _gloffset_Binormal3fEXT }, - { "glBinormal3iEXT", NAME(glBinormal3iEXT), _gloffset_Binormal3iEXT }, - { "glBinormal3sEXT", NAME(glBinormal3sEXT), _gloffset_Binormal3sEXT }, - { "glBinormal3bvEXT", NAME(glBinormal3bvEXT), _gloffset_Binormal3bvEXT }, - { "glBinormal3dvEXT", NAME(glBinormal3dvEXT), _gloffset_Binormal3dvEXT }, - { "glBinormal3fvEXT", NAME(glBinormal3fvEXT), _gloffset_Binormal3fvEXT }, - { "glBinormal3ivEXT", NAME(glBinormal3ivEXT), _gloffset_Binormal3ivEXT }, - { "glBinormal3svEXT", NAME(glBinormal3svEXT), _gloffset_Binormal3svEXT }, - { "glTangentPointerEXT", NAME(glTangentPointerEXT), _gloffset_TangentPointerEXT }, - { "glBinormalPointerEXT", NAME(glBinormalPointerEXT), _gloffset_BinormalPointerEXT }, -#undef NAME -#endif - - /* 164. GL_SUN_global_alpha */ -#if 000 -#ifdef GL_SUN_global_alpha -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glGlobalAlphaFactorbSUN", NAME(glGlobalAlphaFactorbSUN), _gloffset_GlobalAlphaFactorbSUN }, - { "glGlobalAlphaFactorsSUN", NAME(glGlobalAlphaFactorsSUN), _gloffset_GlobalAlphaFactorsSUN }, - { "glGlobalAlphaFactoriSUN", NAME(glGlobalAlphaFactoriSUN), _gloffset_GlobalAlphaFactoriSUN }, - { "glGlobalAlphaFactorfSUN", NAME(glGlobalAlphaFactorfSUN), _gloffset_GlobalAlphaFactorfSUN }, - { "glGlobalAlphaFactordSUN", NAME(glGlobalAlphaFactordSUN), _gloffset_GlobalAlphaFactordSUN }, - { "glGlobalAlphaFactorubSUN", NAME(glGlobalAlphaFactorubSUN), _gloffset_GlobalAlphaFactorubSUN }, - { "glGlobalAlphaFactorusSUN", NAME(glGlobalAlphaFactorusSUN), _gloffset_GlobalAlphaFactorusSUN }, - { "glGlobalAlphaFactoruiSUN", NAME(glGlobalAlphaFactoruiSUN), _gloffset_GlobalAlphaFactoruiSUN }, -#undef NAME -#endif - - /* 165. GL_SUN_triangle_list */ -#if 000 -#ifdef GL_SUN_triangle_list -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glReplacementCodeuiSUN", NAME(glReplacementCodeuiSUN), _gloffset_ReplacementCodeuiSUN }, - { "glReplacementCodeusSUN", NAME(glReplacementCodeusSUN), _gloffset_ReplacementCodeusSUN }, - { "glReplacementCodeubSUN", NAME(glReplacementCodeubSUN), _gloffset_ReplacementCodeubSUN }, - { "glReplacementCodeuivSUN", NAME(glReplacementCodeuivSUN), _gloffset_ReplacementCodeuivSUN }, - { "glReplacementCodeusvSUN", NAME(glReplacementCodeusvSUN), _gloffset_ReplacementCodeusvSUN }, - { "glReplacementCodeubvSUN", NAME(glReplacementCodeubvSUN), _gloffset_ReplacementCodeubvSUN }, - { "glReplacementCodePointerSUN", NAME(glReplacementCodePointerSUN), _gloffset_ReplacementCodePointerSUN }, -#undef NAME -#endif - - /* 166. GL_SUN_vertex */ -#if 000 -#ifdef GL_SUN_vertex -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glColor4ubVertex2fSUN", NAME(glColor4ubVertex2fSUN), _gloffset_Color4ubVertex2fSUN }, - { "glColor4ubVertex2fvSUN", NAME(glColor4ubVertex2fvSUN), _gloffset_Color4ubVertex2fvSUN }, - { "glColor4ubVertex3fSUN", NAME(glColor4ubVertex3fSUN), _gloffset_Color4ubVertex3fSUN }, - { "glColor4ubVertex3fvSUN", NAME(glColor4ubVertex3fvSUN), _gloffset_Color4ubVertex3fvSUN }, - { "glColor3fVertex3fSUN", NAME(glColor3fVertex3fSUN), _gloffset_Color3fVertex3fSUN }, - { "glColor3fVertex3fvSUN", NAME(glColor3fVertex3fvSUN), _gloffset_Color3fVertex3fvSUN }, - { "glNormal3fVertex3fSUN", NAME(glNormal3fVertex3fSUN), _gloffset_Normal3fVertex3fSUN }, - { "glNormal3fVertex3fvSUN", NAME(glNormal3fVertex3fvSUN), _gloffset_Normal3fVertex3fvSUN }, - { "glColor4fNormal3fVertex3fSUN", NAME(glColor4fNormal3fVertex3fSUN), _gloffset_Color4fNormal3fVertex3fSUN }, - { "glColor4fNormal3fVertex3fvSUN", NAME(glColor4fNormal3fVertex3fvSUN), _gloffset_Color4fNormal3fVertex3fvSUN }, - { "glTexCoord2fVertex3fSUN", NAME(glTexCoord2fVertex3fSUN), _gloffset_TexCoord2fVertex3fSUN }, - { "glTexCoord2fVertex3fvSUN", NAME(glTexCoord2fVertex3fvSUN), _gloffset_TexCoord2fVertex3fvSUN }, - { "glTexCoord4fVertex4fSUN", NAME(glTexCoord4fVertex4fSUN), _gloffset_TexCoord4fVertex4fSUN }, - { "glTexCoord4fVertex4fvSUN", NAME(glTexCoord4fVertex4fvSUN), _gloffset_TexCoord4fVertex4fvSUN }, - { "glTexCoord2fColor4ubVertex3fSUN", NAME(glTexCoord2fColor4ubVertex3fSUN), _gloffset_TexCoord2fColor4ubVertex3fSUN }, - { "glTexCoord2fColor4ubVertex3fvSUN", NAME(glTexCoord2fColor4ubVertex3fvSUN), _gloffset_TexCoord2fColor4ubVertex3fvSUN }, - { "glTexCoord2fColor3fVertex3fSUN", NAME(glTexCoord2fColor3fVertex3fSUN), _gloffset_TexCoord2fColor3fVertex3fSUN }, - { "glTexCoord2fColor3fVertex3fvSUN", NAME(glTexCoord2fColor3fVertex3fvSUN), _gloffset_TexCoord2fColor3fVertex3fvSUN }, - { "glTexCoord2fNormal3fVertex3fSUN", NAME(glTexCoord2fNormal3fVertex3fSUN), _gloffset_TexCoord2fNormal3fVertex3fSUN }, - { "glTexCoord2fNormal3fVertex3fvSUN", NAME(glTexCoord2fNormal3fVertex3fvSUN), _gloffset_TexCoord2fNormal3fVertex3fvSUN }, - { "glTexCoord2fColor4fNormal3fVertex3fSUN", NAME(glTexCoord2fColor4fNormal3fVertex3fSUN), _gloffset_TexCoord2fColor4fNormal3fVertex3fSUN }, - { "glTexCoord2fColor4fNormal3fVertex3fvSUN", NAME(glTexCoord2fColor4fNormal3fVertex3fvSUN), _gloffset_TexCoord2fColor4fNormal3fVertex3fvSUN }, - { "glTexCoord4fColor4fNormal3fVertex4fSUN", NAME(glTexCoord4fColor4fNormal3fVertex4fSUN), _gloffset_TexCoord4fColor4fNormal3fVertex4fSUN }, - { "glTexCoord4fColor4fNormal3fVertex4fvSUN", NAME(glTexCoord4fColor4fNormal3fVertex4fvSUN), _gloffset_TexCoord4fColor4fNormal3fVertex4fvSUN }, - { "glReplacementCodeuiVertex3fSUN", NAME(glReplacementCodeuiVertex3fSUN), _gloffset_ReplacementCodeuiVertex3fSUN }, - { "glReplacementCodeuiVertex3fvSUN", NAME(glReplacementCodeuiVertex3fvSUN), _gloffset_ReplacementCodeuiVertex3fvSUN }, - { "glReplacementCodeuiColor4ubVertex3fSUN", NAME(glReplacementCodeuiColor4ubVertex3fSUN), _gloffset_ReplacementCodeuiColor4ubVertex3fSUN }, - { "glReplacementCodeuiColor4ubVertex3fvSUN", NAME(glReplacementCodeuiColor4ubVertex3fvSUN), _gloffset_ReplacementCodeuiColor4ubVertex3fvSUN }, - { "glReplacementCodeuiColor3fVertex3fSUN", NAME(glReplacementCodeuiColor3fVertex3fSUN), _gloffset_ReplacementCodeuiColor3fVertex3fSUN }, - { "glReplacementCodeuiColor3fVertex3fvSUN", NAME(glReplacementCodeuiColor3fVertex3fvSUN), _gloffset_ReplacementCodeuiColor3fVertex3fvSUN }, - { "glReplacementCodeuiNormal3fVertex3fSUN", NAME(glReplacementCodeuiNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiNormal3fVertex3fSUN }, - { "glReplacementCodeuiNormal3fVertex3fvSUN", NAME(glReplacementCodeuiNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiNormal3fVertex3fvSUN }, - { "glReplacementCodeuiColor4fNormal3fVertex3fSUN", NAME(glReplacementCodeuiColor4fNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiColor4fNormal3fVertex3fSUN }, - { "glReplacementCodeuiColor4fNormal3fVertex3fvSUN", NAME(glReplacementCodeuiColor4fNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiColor4fNormal3fVertex3fvSUN }, - { "glReplacementCodeuiTexCoord2fVertex3fSUN", NAME(glReplacementCodeuiTexCoord2fVertex3fSUN), _gloffset_ReplacementCodeuiTexCoord2fVertex3fSUN }, - { "glReplacementCodeuiTexCoord2fVertex3fvSUN", NAME(glReplacementCodeuiTexCoord2fVertex3fvSUN), _gloffset_ReplacementCodeuiTexCoord2fVertex3fvSUN }, - { "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN", NAME(glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN }, - { "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN", NAME(glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN }, - { "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN", NAME(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN }, - { "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN", NAME(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN }, -#undef NAME -#endif - - /* 173. GL_EXT/INGR_blend_func_separate */ -#ifdef GL_EXT_blend_func_separate -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glBlendFuncSeparateEXT", NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, - { "glBlendFuncSeparateINGR", NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, -#undef NAME - - /* 188. GL_EXT_vertex_weighting */ -#ifdef GL_EXT_vertex_weighting -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glVertexWeightfEXT", NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT }, - { "glVertexWeightfvEXT", NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT }, - { "glVertexWeightPointerEXT", NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT }, -#undef NAME - - /* 190. GL_NV_vertex_array_range */ -#ifdef GL_NV_vertex_array_range -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glFlushVertexArrayRangeNV", NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV }, - { "glVertexArrayRangeNV", NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV }, -#undef NAME - - /* 191. GL_NV_register_combiners */ -#ifdef GL_NV_register_combiners -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glCombinerParameterfvNV", NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV }, - { "glCombinerParameterfNV", NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV }, - { "glCombinerParameterivNV", NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV }, - { "glCombinerParameteriNV", NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV }, - { "glCombinerInputNV", NAME(glCombinerInputNV), _gloffset_CombinerInputNV }, - { "glCombinerOutputNV", NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV }, - { "glFinalCombinerInputNV", NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV }, - { "glGetCombinerInputParameterfvNV", NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV }, - { "glGetCombinerInputParameterivNV", NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV }, - { "glGetCombinerOutputParameterfvNV", NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV }, - { "glGetCombinerOutputParameterivNV", NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV }, - { "glGetFinalCombinerInputParameterfvNV", NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV }, - { "glGetFinalCombinerInputParameterivNV", NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV }, -#undef NAME - - /* 196. GL_MESA_resize_buffers */ -#ifdef MESA_resize_buffers -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glResizeBuffersMESA", NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, -#undef NAME - - /* 197. GL_MESA_window_pos */ -#ifdef MESA_window_pos -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glWindowPos2iMESA", NAME(glWindowPos2iMESA), _gloffset_WindowPos2iMESA }, - { "glWindowPos2sMESA", NAME(glWindowPos2sMESA), _gloffset_WindowPos2sMESA }, - { "glWindowPos2fMESA", NAME(glWindowPos2fMESA), _gloffset_WindowPos2fMESA }, - { "glWindowPos2dMESA", NAME(glWindowPos2dMESA), _gloffset_WindowPos2dMESA }, - { "glWindowPos2ivMESA", NAME(glWindowPos2ivMESA), _gloffset_WindowPos2ivMESA }, - { "glWindowPos2svMESA", NAME(glWindowPos2svMESA), _gloffset_WindowPos2svMESA }, - { "glWindowPos2fvMESA", NAME(glWindowPos2fvMESA), _gloffset_WindowPos2fvMESA }, - { "glWindowPos2dvMESA", NAME(glWindowPos2dvMESA), _gloffset_WindowPos2dvMESA }, - { "glWindowPos3iMESA", NAME(glWindowPos3iMESA), _gloffset_WindowPos3iMESA }, - { "glWindowPos3sMESA", NAME(glWindowPos3sMESA), _gloffset_WindowPos3sMESA }, - { "glWindowPos3fMESA", NAME(glWindowPos3fMESA), _gloffset_WindowPos3fMESA }, - { "glWindowPos3dMESA", NAME(glWindowPos3dMESA), _gloffset_WindowPos3dMESA }, - { "glWindowPos3ivMESA", NAME(glWindowPos3ivMESA), _gloffset_WindowPos3ivMESA }, - { "glWindowPos3svMESA", NAME(glWindowPos3svMESA), _gloffset_WindowPos3svMESA }, - { "glWindowPos3fvMESA", NAME(glWindowPos3fvMESA), _gloffset_WindowPos3fvMESA }, - { "glWindowPos3dvMESA", NAME(glWindowPos3dvMESA), _gloffset_WindowPos3dvMESA }, - { "glWindowPos4iMESA", NAME(glWindowPos4iMESA), _gloffset_WindowPos4iMESA }, - { "glWindowPos4sMESA", NAME(glWindowPos4sMESA), _gloffset_WindowPos4sMESA }, - { "glWindowPos4fMESA", NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, - { "glWindowPos4dMESA", NAME(glWindowPos4dMESA), _gloffset_WindowPos4dMESA }, - { "glWindowPos4ivMESA", NAME(glWindowPos4ivMESA), _gloffset_WindowPos4ivMESA }, - { "glWindowPos4svMESA", NAME(glWindowPos4svMESA), _gloffset_WindowPos4svMESA }, - { "glWindowPos4fvMESA", NAME(glWindowPos4fvMESA), _gloffset_WindowPos4fvMESA }, - { "glWindowPos4dvMESA", NAME(glWindowPos4dvMESA), _gloffset_WindowPos4dvMESA }, -#undef NAME - - /* 209. WGL_EXT_multisample */ -#ifdef WGL_EXT_multisample -#define NAME(X) (GLvoid *) X -#else -#define NAME(X) (GLvoid *) NotImplemented -#endif - { "glSampleMaskEXT", NAME(glSampleMaskEXT), _gloffset_SampleMaskSGIS }, - { "glSamplePatternEXT", NAME(glSamplePatternEXT), _gloffset_SamplePatternSGIS }, -#undef NAME - - { NULL, NULL } /* end of list marker */ -}; +/* The code in this file is auto-generated with Python */ +#include "glprocs.h" @@ -1787,8 +490,20 @@ get_static_proc_address(const char *funcName) * Extension function management. */ +/* + * Number of extension functions which we can dynamically add at runtime. + */ +#define MAX_EXTENSION_FUNCS 300 + + +/* + * The disptach table size (number of entries) is the sizeof the + * _glapi_table struct plus the number of dynamic entries we can add. + * The extra slots can be filled in by DRI drivers that register new extension + * functions. + */ +#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) -#define MAX_EXTENSION_FUNCS 1000 static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; static GLuint NumExtEntryPoints = 0; @@ -1822,7 +537,7 @@ generate_entrypoint(GLuint functionOffset) * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) * 14 15 16 17 18 19 */ - static const unsigned char temp[] = { + static const unsigned char insn_template[] = { 0xa1, 0x00, 0x00, 0x00, 0x00, 0x85, 0xc0, 0x74, 0x06, @@ -1830,10 +545,10 @@ generate_entrypoint(GLuint functionOffset) 0xe8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 }; - unsigned char *code = malloc(sizeof(temp)); + unsigned char *code = (unsigned char *) malloc(sizeof(insn_template)); unsigned int next_insn; if (code) { - memcpy(code, temp, sizeof(temp)); + memcpy(code, insn_template, sizeof(insn_template)); *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; @@ -1867,7 +582,7 @@ generate_entrypoint(GLuint functionOffset) 0x01000000 /* nop */ }; #endif - unsigned int *code = malloc(sizeof(insn_template)); + unsigned int *code = (unsigned int *) malloc(sizeof(insn_template)); unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch; if (code) { memcpy(code, insn_template, sizeof(insn_template)); @@ -1893,10 +608,42 @@ generate_entrypoint(GLuint functionOffset) return code; #else return NULL; -#endif +#endif /* USE_*_ASM */ } +/* + * This function inserts a new dispatch offset into the assembly language + * stub that was generated with the preceeding function. + */ +static void +fill_in_entrypoint_offset(void *entrypoint, GLuint offset) +{ +#if defined(USE_X86_ASM) + + unsigned char *code = (unsigned char *) entrypoint; + *(unsigned int *)(code + 0x0b) = offset * 4; + *(unsigned int *)(code + 0x16) = offset * 4; + +#elif defined(USE_SPARC_ASM) + + /* XXX this hasn't been tested! */ + unsigned int *code = (unsigned int *) entrypoint; +#ifdef __sparc_v9__ + code[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */ + code[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */ + code[6] |= ((offset * 8) >> 10); + code[7] |= ((offset * 8) & ((1 << 10) - 1)); + __glapi_sparc_icache_flush(&code[6]); +#else /* __sparc_v9__ */ + code[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */ + code[2] |= (offset * 4); + __glapi_sparc_icache_flush(&code[2]); +#endif /* __sparc_v9__ */ + +#endif /* USE_*_ASM */ +} + /* * Add a new extension function entrypoint. @@ -1905,6 +652,10 @@ generate_entrypoint(GLuint functionOffset) GLboolean _glapi_add_entrypoint(const char *funcName, GLuint offset) { + /* trivial rejection test */ + if (!funcName || funcName[0] != 'g' || funcName[1] != 'l') + return GL_FALSE; + /* first check if the named function is already statically present */ { GLint index = get_static_proc_offset(funcName); @@ -1913,103 +664,56 @@ _glapi_add_entrypoint(const char *funcName, GLuint offset) } } + /* See if this function has already been dynamically added */ { - /* make sure this offset/name pair is legal */ - const char *name = _glapi_get_proc_name(offset); - if (name && strcmp(name, funcName) != 0) - return GL_FALSE; /* bad name! */ - } - - { - /* be sure index and name match known data */ GLuint i; for (i = 0; i < NumExtEntryPoints; i++) { if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - /* function already registered with api */ + /* function already registered */ if (ExtEntryTable[i].Offset == offset) { return GL_TRUE; /* offsets match */ } + else if (ExtEntryTable[i].Offset == ~0 + && offset < DISPATCH_TABLE_SIZE) { + /* need to patch-up the dispatch code */ + if (offset != ~0) { + fill_in_entrypoint_offset(ExtEntryTable[i].Address, offset); + ExtEntryTable[i].Offset = offset; + } + return GL_TRUE; + } else { return GL_FALSE; /* bad offset! */ } } } + } - /* Make sure we don't try to add a new entrypoint after someone - * has already called _glapi_get_dispatch_table_size()! If that's - * happened the caller's information would become out of date. - */ - if (GetSizeCalled) - return GL_FALSE; - - /* make sure we have space */ - if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) { - return GL_FALSE; - } - else { - void *entrypoint = generate_entrypoint(offset); - if (!entrypoint) - return GL_FALSE; - - ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entrypoint; - NumExtEntryPoints++; + /* This is a new function, try to add it. */ + if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS || + offset >= DISPATCH_TABLE_SIZE) { + /* No space left */ + return GL_FALSE; + } + else { + void *entrypoint = generate_entrypoint(offset); + if (!entrypoint) + return GL_FALSE; /* couldn't generate assembly */ - if (offset > MaxDispatchOffset) - MaxDispatchOffset = offset; + /* OK! */ + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = offset; + ExtEntryTable[NumExtEntryPoints].Address = entrypoint; + NumExtEntryPoints++; - return GL_TRUE; /* success */ - } + return GL_TRUE; /* success */ } - /* should never get here, but play it safe */ + /* should never get here, silence compiler warnings */ return GL_FALSE; } - -#if 0000 /* prototype code for dynamic extension slot allocation */ - -static int NextFreeOffset = 409; /*XXX*/ -#define MAX_DISPATCH_TABLE_SIZE 1000 - -/* - * Dynamically allocate a dispatch slot for an extension entrypoint - * and generate the assembly language dispatch stub. - * Return the dispatch offset for the function or -1 if no room or error. - */ -GLint -_glapi_add_entrypoint2(const char *funcName) -{ - int offset; - - /* first see if extension func is already known */ - offset = _glapi_get_proc_offset(funcName); - if (offset >= 0) - return offset; - - if (NumExtEntryPoints < MAX_EXTENSION_FUNCS - && NextFreeOffset < MAX_DISPATCH_TABLE_SIZE) { - void *entryPoint; - offset = NextFreeOffset; - entryPoint = generate_entrypoint(offset); - if (entryPoint) { - NextFreeOffset++; - ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entryPoint; - NumExtEntryPoints++; - return offset; - } - } - return -1; -} - -#endif - - - /* * Return offset of entrypoint for named function within dispatch table. */ @@ -2045,9 +749,35 @@ _glapi_get_proc_address(const char *funcName) } /* search static functions */ - return get_static_proc_address(funcName); -} + { + const GLvoid *func = get_static_proc_address(funcName); + if (func) + return func; + } + /* generate new entrypoint - use a temporary dispatch offset of + * ~0 (i.e. -1). Later, when the driver calls _glapi_add_entrypoint() + * we'll put in the proper offset. If that never happens, and the + * user calls this function, he'll segfault. That's what you get + * when you try calling a GL function that doesn't really exist. + */ + if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) { + GLvoid *entrypoint = generate_entrypoint(~0); + if (!entrypoint) + return GL_FALSE; + + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = ~0; + ExtEntryTable[NumExtEntryPoints].Address = entrypoint; + NumExtEntryPoints++; + + return entrypoint; + } + else { + /* no space for new functions! */ + return NULL; + } +} @@ -2060,6 +790,8 @@ _glapi_get_proc_name(GLuint offset) { const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); GLuint i; + + /* search built-in functions */ for (i = 0; i < n; i++) { if (static_functions[i].Offset == offset) return static_functions[i].Name; @@ -2077,6 +809,29 @@ _glapi_get_proc_name(GLuint offset) /* + * Return size of dispatch table struct as number of functions (or + * slots). + */ +GLuint +_glapi_get_dispatch_table_size(void) +{ + return DISPATCH_TABLE_SIZE; +} + + + +/* + * Get API dispatcher version string. + */ +const char * +_glapi_get_version(void) +{ + return "20021001"; /* YYYYMMDD */ +} + + + +/* * Make sure there are no NULL pointers in the given dispatch table. * Intended for debugging purposes. */ @@ -2144,5 +899,21 @@ _glapi_check_table(const struct _glapi_table *table) assert(secondaryColor3fOffset == offset); assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (void *) &glSecondaryColor3fEXT); } + { + GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV"); + char *pointParameterivFunc = (char*) &table->PointParameterivNV; + GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *); + assert(pointParameterivOffset == _gloffset_PointParameterivNV); + assert(pointParameterivOffset == offset); + assert(_glapi_get_proc_address("glPointParameterivNV") == (void *) &glPointParameterivNV); + } + { + GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV"); + char *setFenceFunc = (char*) &table->SetFenceNV; + GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *); + assert(setFenceOffset == _gloffset_SetFenceNV); + assert(setFenceOffset == offset); + assert(_glapi_get_proc_address("glSetFenceNV") == (void *) &glSetFenceNV); + } #endif } diff --git a/xc/extras/Mesa/src/glapi.h b/xc/extras/Mesa/src/glapi.h index 73782f8c4..41d7aaf02 100644 --- a/xc/extras/Mesa/src/glapi.h +++ b/xc/extras/Mesa/src/glapi.h @@ -32,6 +32,8 @@ struct _glapi_table; +typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); + extern void *_glapi_Context; @@ -41,6 +43,8 @@ extern struct _glapi_table *_glapi_Dispatch; extern void _glapi_noop_enable_warnings(GLboolean enable); +extern void +_glapi_set_warning_func(_glapi_warning_func func); extern void _glapi_check_multithread(void); diff --git a/xc/extras/Mesa/src/glapioffsets.h b/xc/extras/Mesa/src/glapioffsets.h index c1c82bba0..4223395f3 100644 --- a/xc/extras/Mesa/src/glapioffsets.h +++ b/xc/extras/Mesa/src/glapioffsets.h @@ -415,7 +415,7 @@ #define _gloffset_MultTransposeMatrixfARB 410 #define _gloffset_MultTransposeMatrixdARB 411 #define _gloffset_SampleCoverageARB 412 -#define _gloffset_SamplePassARB 413 +#define _gloffset___unused413 413 #define _gloffset_PolygonOffsetEXT 414 #define _gloffset_GetTexFilterFuncSGIS 415 #define _gloffset_TexFilterFuncSGIS 416 @@ -580,5 +580,81 @@ #define _gloffset_SecondaryColor3usEXT 575 #define _gloffset_SecondaryColor3usvEXT 576 #define _gloffset_SecondaryColorPointerEXT 577 +#define _gloffset_AreProgramsResidentNV 578 +#define _gloffset_BindProgramNV 579 +#define _gloffset_DeleteProgramsNV 580 +#define _gloffset_ExecuteProgramNV 581 +#define _gloffset_GenProgramsNV 582 +#define _gloffset_GetProgramParameterdvNV 583 +#define _gloffset_GetProgramParameterfvNV 584 +#define _gloffset_GetProgramivNV 585 +#define _gloffset_GetProgramStringNV 586 +#define _gloffset_GetTrackMatrixivNV 587 +#define _gloffset_GetVertexAttribdvNV 588 +#define _gloffset_GetVertexAttribfvNV 589 +#define _gloffset_GetVertexAttribivNV 590 +#define _gloffset_GetVertexAttribPointervNV 591 +#define _gloffset_IsProgramNV 592 +#define _gloffset_LoadProgramNV 593 +#define _gloffset_ProgramParameter4dNV 594 +#define _gloffset_ProgramParameter4dvNV 595 +#define _gloffset_ProgramParameter4fNV 596 +#define _gloffset_ProgramParameter4fvNV 597 +#define _gloffset_ProgramParameters4dvNV 598 +#define _gloffset_ProgramParameters4fvNV 599 +#define _gloffset_RequestResidentProgramsNV 600 +#define _gloffset_TrackMatrixNV 601 +#define _gloffset_VertexAttribPointerNV 602 +#define _gloffset_VertexAttrib1dNV 603 +#define _gloffset_VertexAttrib1dvNV 604 +#define _gloffset_VertexAttrib1fNV 605 +#define _gloffset_VertexAttrib1fvNV 606 +#define _gloffset_VertexAttrib1sNV 607 +#define _gloffset_VertexAttrib1svNV 608 +#define _gloffset_VertexAttrib2dNV 609 +#define _gloffset_VertexAttrib2dvNV 610 +#define _gloffset_VertexAttrib2fNV 611 +#define _gloffset_VertexAttrib2fvNV 612 +#define _gloffset_VertexAttrib2sNV 613 +#define _gloffset_VertexAttrib2svNV 614 +#define _gloffset_VertexAttrib3dNV 615 +#define _gloffset_VertexAttrib3dvNV 616 +#define _gloffset_VertexAttrib3fNV 617 +#define _gloffset_VertexAttrib3fvNV 618 +#define _gloffset_VertexAttrib3sNV 619 +#define _gloffset_VertexAttrib3svNV 620 +#define _gloffset_VertexAttrib4dNV 621 +#define _gloffset_VertexAttrib4dvNV 622 +#define _gloffset_VertexAttrib4fNV 623 +#define _gloffset_VertexAttrib4fvNV 624 +#define _gloffset_VertexAttrib4sNV 625 +#define _gloffset_VertexAttrib4svNV 626 +#define _gloffset_VertexAttrib4ubNV 627 +#define _gloffset_VertexAttrib4ubvNV 628 +#define _gloffset_VertexAttribs1dvNV 629 +#define _gloffset_VertexAttribs1fvNV 630 +#define _gloffset_VertexAttribs1svNV 631 +#define _gloffset_VertexAttribs2dvNV 632 +#define _gloffset_VertexAttribs2fvNV 633 +#define _gloffset_VertexAttribs2svNV 634 +#define _gloffset_VertexAttribs3dvNV 635 +#define _gloffset_VertexAttribs3fvNV 636 +#define _gloffset_VertexAttribs3svNV 637 +#define _gloffset_VertexAttribs4dvNV 638 +#define _gloffset_VertexAttribs4fvNV 639 +#define _gloffset_VertexAttribs4svNV 640 +#define _gloffset_VertexAttribs4ubvNV 641 +#define _gloffset_PointParameteriNV 642 +#define _gloffset_PointParameterivNV 643 +#define _gloffset_MultiDrawArraysEXT 644 +#define _gloffset_MultiDrawElementsEXT 645 +#define _gloffset_ActiveStencilFaceEXT 646 +#define _gloffset_DeleteFencesNV 647 +#define _gloffset_GenFencesNV 648 +#define _gloffset_IsFenceNV 649 +#define _gloffset_TestFenceNV 650 +#define _gloffset_GetFenceivNV 651 +#define _gloffset_FinishFenceNV 652 +#define _gloffset_SetFenceNV 653 #endif diff --git a/xc/extras/Mesa/src/glapitable.h b/xc/extras/Mesa/src/glapitable.h index f16af91e7..f75ee10ca 100644 --- a/xc/extras/Mesa/src/glapitable.h +++ b/xc/extras/Mesa/src/glapitable.h @@ -294,7 +294,7 @@ struct _glapi_table void (*GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */ GLboolean (*IsEnabled)(GLenum cap); /* 286 */ GLboolean (*IsList)(GLuint list); /* 287 */ - void (*DepthRange)(GLclampd near, GLclampd far); /* 288 */ + void (*DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */ void (*Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */ void (*LoadIdentity)(void); /* 290 */ void (*LoadMatrixf)(const GLfloat * m); /* 291 */ @@ -335,7 +335,7 @@ struct _glapi_table void (*CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */ void (*DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */ void (*GenTextures)(GLsizei n, GLuint * textures); /* 328 */ - void (*GetPointerv)(GLenum pname, GLvoid * * params); /* 329 */ + void (*GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */ GLboolean (*IsTexture)(GLuint texture); /* 330 */ void (*PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */ void (*TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */ @@ -377,7 +377,7 @@ struct _glapi_table void (*Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */ void (*ResetHistogram)(GLenum target); /* 369 */ void (*ResetMinmax)(GLenum target); /* 370 */ - void (*TexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ + void (*TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */ void (*TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */ void (*CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */ void (*ActiveTextureARB)(GLenum texture); /* 374 */ @@ -419,7 +419,7 @@ struct _glapi_table void (*MultTransposeMatrixfARB)(const GLfloat * m); /* 410 */ void (*MultTransposeMatrixdARB)(const GLdouble * m); /* 411 */ void (*SampleCoverageARB)(GLclampf value, GLboolean invert); /* 412 */ - void (*SamplePassARB)(GLenum pass); /* 413 */ + void (*__unused413)(void); /* 413 */ void (*PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 414 */ void (*GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights); /* 415 */ void (*TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights); /* 416 */ @@ -504,7 +504,7 @@ struct _glapi_table void (*VertexWeightfvEXT)(const GLfloat * weight); /* 495 */ void (*VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 496 */ void (*FlushVertexArrayRangeNV)(void); /* 497 */ - void (*VertexArrayRangeNV)(GLsizei size, const GLvoid * pointer); /* 498 */ + void (*VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 498 */ void (*CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 499 */ void (*CombinerParameterfNV)(GLenum pname, GLfloat param); /* 500 */ void (*CombinerParameterivNV)(GLenum pname, const GLint * params); /* 501 */ @@ -584,6 +584,82 @@ struct _glapi_table void (*SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 575 */ void (*SecondaryColor3usvEXT)(const GLushort * v); /* 576 */ void (*SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 577 */ + GLboolean (*AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 578 */ + void (*BindProgramNV)(GLenum target, GLuint id); /* 579 */ + void (*DeleteProgramsNV)(GLsizei n, const GLuint * ids); /* 580 */ + void (*ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 581 */ + void (*GenProgramsNV)(GLsizei n, GLuint * ids); /* 582 */ + void (*GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 583 */ + void (*GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 584 */ + void (*GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 585 */ + void (*GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 586 */ + void (*GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 587 */ + void (*GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 588 */ + void (*GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 589 */ + void (*GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 590 */ + void (*GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 591 */ + GLboolean (*IsProgramNV)(GLuint id); /* 592 */ + void (*LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 593 */ + void (*ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 594 */ + void (*ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params); /* 595 */ + void (*ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 596 */ + void (*ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params); /* 597 */ + void (*ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 598 */ + void (*ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 599 */ + void (*RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 600 */ + void (*TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 601 */ + void (*VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 602 */ + void (*VertexAttrib1dNV)(GLuint index, GLdouble x); /* 603 */ + void (*VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 604 */ + void (*VertexAttrib1fNV)(GLuint index, GLfloat x); /* 605 */ + void (*VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 606 */ + void (*VertexAttrib1sNV)(GLuint index, GLshort x); /* 607 */ + void (*VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 608 */ + void (*VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 609 */ + void (*VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 610 */ + void (*VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 611 */ + void (*VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 612 */ + void (*VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 613 */ + void (*VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 614 */ + void (*VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 615 */ + void (*VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 616 */ + void (*VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 617 */ + void (*VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 618 */ + void (*VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 619 */ + void (*VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 620 */ + void (*VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 621 */ + void (*VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 622 */ + void (*VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 623 */ + void (*VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 624 */ + void (*VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 625 */ + void (*VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 626 */ + void (*VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 627 */ + void (*VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 628 */ + void (*VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 629 */ + void (*VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 630 */ + void (*VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 631 */ + void (*VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 632 */ + void (*VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 633 */ + void (*VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 634 */ + void (*VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 635 */ + void (*VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 636 */ + void (*VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 637 */ + void (*VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 638 */ + void (*VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 639 */ + void (*VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 640 */ + void (*VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */ + void (*PointParameteriNV)(GLenum pname, GLint params); /* 642 */ + void (*PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */ + void (*MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */ + void (*MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */ + void (*ActiveStencilFaceEXT)(GLenum face); /* 646 */ + void (*DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 647 */ + void (*GenFencesNV)(GLsizei n, GLuint * fences); /* 648 */ + GLboolean (*IsFenceNV)(GLuint fence); /* 649 */ + GLboolean (*TestFenceNV)(GLuint fence); /* 650 */ + void (*GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 651 */ + void (*FinishFenceNV)(GLuint fence); /* 652 */ + void (*SetFenceNV)(GLuint fence, GLenum condition); /* 653 */ }; #endif diff --git a/xc/extras/Mesa/src/glapitemp.h b/xc/extras/Mesa/src/glapitemp.h index 6ed64f7a1..ba6a09378 100644 --- a/xc/extras/Mesa/src/glapitemp.h +++ b/xc/extras/Mesa/src/glapitemp.h @@ -1,28 +1,5 @@ -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - +/* DO NOT EDIT! This file is generated by the glapitemp.py script. */ /* * This file is a template which generates the OpenGL API entry point @@ -69,3579 +46,4190 @@ #error RETURN_DISPATCH must be defined #endif +GLAPI void GLAPIENTRY gl__unused413(void); /* silence warning */ -/* - * XXX - * Most functions need the msg (printf-message) parameter to be finished. - * I.e. replace ";" with the real info. - */ - -/* - * XXX - * Someday this code should be automatically generated from a spec file - * like that used in the SGI OpenGL SI. - */ +KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode) +{ + DISPATCH(NewList, (list, mode), (F, "glNewList(%d, 0x%x);\n", list, mode)); +} +KEYWORD1 void KEYWORD2 NAME(EndList)(void) +{ + DISPATCH(EndList, (), (F, "glEndList();\n")); +} +KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) +{ + DISPATCH(CallList, (list), (F, "glCallList(%d);\n", list)); +} -/* GL 1.0 */ +KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid * lists) +{ + DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);\n", n, type, (void *) lists)); +} -KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value) +KEYWORD1 void KEYWORD2 NAME(DeleteLists)(GLuint list, GLsizei range) { - DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %g);", op, value)); + DISPATCH(DeleteLists, (list, range), (F, "glDeleteLists(%d, %d);\n", list, range)); } -KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref) +KEYWORD1 GLuint KEYWORD2 NAME(GenLists)(GLsizei range) { - DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %g);", func, ref)); + RETURN_DISPATCH(GenLists, (range), (F, "glGenLists(%d);\n", range)); } -KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) +KEYWORD1 void KEYWORD2 NAME(ListBase)(GLuint base) { - DISPATCH(ArrayElement, (i), (F, ";")); + DISPATCH(ListBase, (base), (F, "glListBase(%d);\n", base)); } KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode) { - DISPATCH(Begin, (mode), (F, "glBegin(0x%x);", mode)); + DISPATCH(Begin, (mode), (F, "glBegin(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) +KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap) { - DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d %d %g %g %g %g %p;", width, height, xorig, yorig, xmove, ymove, bitmap)); + DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d, %d, %f, %f, %f, %f, %p);\n", width, height, xorig, yorig, xmove, ymove, (void *) bitmap)); } -KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor) +KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) { - DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);", sfactor, dfactor)); + DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) +KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte * v) { - DISPATCH(CallList, (list), (F, "glCallList(%u);", list)); + DISPATCH(Color3bv, (v), (F, "glColor3bv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid *lists) +KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) { - DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);", n, type, lists)); + DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%f, %f, %f);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask) +KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble * v) { - DISPATCH(Clear, (mask), (F, "glClear(0x%x);", mask)); + DISPATCH(Color3dv, (v), (F, "glColor3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) { - DISPATCH(ClearAccum, (red, green, blue, alpha), (F, "glClearAccum(%g, %g, %g, %g);", red, green, blue, alpha)); + DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%f, %f, %f);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat * v) { - DISPATCH(ClearColor, (red, green, blue, alpha), (F, "glClearColor(%g, %g, %g, %g);", red, green, blue, alpha)); + DISPATCH(Color3fv, (v), (F, "glColor3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(ClearDepth)(GLclampd depth) +KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) { - DISPATCH(ClearDepth, (depth), (F, "glClearDepth(%g);", depth)); + DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(ClearIndex)(GLfloat c) +KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint * v) { - DISPATCH(ClearIndex, (c), (F, "glClearIndex(%g);", c)); + DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(ClearStencil)(GLint s) +KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) { - DISPATCH(ClearStencil, (s), (F, "glClearStencil(%d);", s)); + DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble *equation) +KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort * v) { - DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(%p);", (void *) equation)); + DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) +KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) { - DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);", red, green, blue)); + DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) +KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte * v) { - DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%g, %g, %g);", red, green, blue)); + DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) +KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) { - DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%g, %g, %g);", red, green, blue)); + DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) +KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint * v) { - DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);", red, green, blue)); + DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) +KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) { - DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);", red, green, blue)); + DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) +KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort * v) { - DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%u, %u, %u);", red, green, blue)); + DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) +KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) { - DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%u, %u, %u);", red, green, blue)); + DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) +KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte * v) { - DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%u, %u, %u);", red, green, blue)); + DISPATCH(Color4bv, (v), (F, "glColor4bv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) +KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { - DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);", red, green, blue, alpha)); + DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%f, %f, %f, %f);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) +KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble * v) { - DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%g, %g, %g, %g);", red, green, blue, alpha)); + DISPATCH(Color4dv, (v), (F, "glColor4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4b(%g, %g, %g, %g);", red, green, blue, alpha)); + DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4f(%f, %f, %f, %f);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat * v) +{ + DISPATCH(Color4fv, (v), (F, "glColor4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) { - DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d);", red, green, blue)); + DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint * v) +{ + DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) { - DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);", red, green, blue, alpha)); + DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort * v) +{ + DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%u, %u, %u, %u);", red, green, blue, alpha)); + DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte * v) +{ + DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) { - DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%u, %u, %u, %u);", red, green, blue, alpha)); + DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%d, %d, %d, %d);\n", red, green, blue, alpha)); +} + +KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint * v) +{ + DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) { - DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%u, %u, %u, %u);", red, green, blue, alpha)); + DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%d, %d, %d, %d);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte *v) +KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort * v) { - DISPATCH(Color3bv, (v), (F, "glColor3bf(%p);", v)); + DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) { - DISPATCH(Color3dv, (v), (F, "glColor3dv(%p);", (void *) v)); + DISPATCH(EdgeFlag, (flag), (F, "glEdgeFlag(%d);\n", flag)); } -KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean * flag) { - DISPATCH(Color3fv, (v), (F, "glColor3fv(%p);", (void *) v)); + DISPATCH(EdgeFlagv, (flag), (F, "glEdgeFlagv(%p);\n", (void *) flag)); } -KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(End)(void) { - DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);", (void *) v)); + DISPATCH(End, (), (F, "glEnd();\n")); } -KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) { - DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);", (void *) v)); + DISPATCH(Indexd, (c), (F, "glIndexd(%f);\n", c)); } -KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte *v) +KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble * c) { - DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);", (void *) v)); + DISPATCH(Indexdv, (c), (F, "glIndexdv(%p);\n", (void *) c)); } -KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint *v) +KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) { - DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);", (void *) v)); + DISPATCH(Indexf, (c), (F, "glIndexf(%f);\n", c)); } -KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort *v) +KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat * c) { - DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);", (void *) v)); + DISPATCH(Indexfv, (c), (F, "glIndexfv(%p);\n", (void *) c)); } -KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte *v) +KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) { - DISPATCH(Color4bv, (v), (F, "glColor3bv(%p);", v)); + DISPATCH(Indexi, (c), (F, "glIndexi(%d);\n", c)); } -KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint * c) { - DISPATCH(Color4dv, (v), (F, "glColor4dv(%p);", (void *) v)); + DISPATCH(Indexiv, (c), (F, "glIndexiv(%p);\n", (void *) c)); } -KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) { - DISPATCH(Color4fv, (v), (F, "glColor4fv(%p);", (void *) v)); + DISPATCH(Indexs, (c), (F, "glIndexs(%d);\n", c)); } -KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort * c) { - DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);", (void *) v)); + DISPATCH(Indexsv, (c), (F, "glIndexsv(%p);\n", (void *) c)); } -KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) { - DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);", (void *) v)); + DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);\n", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte *v) +KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte * v) { - DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);", (void *) v)); + DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint *v) +KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) { - DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);", (void *) v)); + DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);\n", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort *v) +KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble * v) { - DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);", (void *) v)); + DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) { - DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);", red, green, blue, alpha)); + DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%f, %f, %f);\n", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(ColorMaterial)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat * v) { - DISPATCH(ColorMaterial, (face, mode), (F, "glColorMaterial(0x%x, 0x%x);", face, mode)); + DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) +KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) { - DISPATCH(CopyPixels, (x, y, width, height, type), (F, "glCopyPixels(%d, %d, %d, %d, 0x%x;", x, y, width, height, type)); + DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);\n", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(CullFace)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint * v) { - DISPATCH(CullFace, (mode), (F, "glCullFace(0x%x);", mode)); + DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(DepthFunc)(GLenum func) +KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) { - DISPATCH(DepthFunc, (func), (F, "glDepthFunc(0x%x);", func)); + DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);\n", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(DepthMask)(GLboolean flag) +KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort * v) { - DISPATCH(DepthMask, (flag), (F, "glDepthMask(%d);", flag)); + DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(DepthRange)(GLclampd nearVal, GLclampd farVal) +KEYWORD1 void KEYWORD2 NAME(RasterPos2d)(GLdouble x, GLdouble y) { - DISPATCH(DepthRange, (nearVal, farVal), (F, "glDepthRange(%g, %g;", nearVal, farVal)); + DISPATCH(RasterPos2d, (x, y), (F, "glRasterPos2d(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(DeleteLists)(GLuint list, GLsizei range) +KEYWORD1 void KEYWORD2 NAME(RasterPos2dv)(const GLdouble * v) { - DISPATCH(DeleteLists, (list, range), (F, "glDeleteLists(%u, %d);", list, range)); + DISPATCH(RasterPos2dv, (v), (F, "glRasterPos2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(Disable)(GLenum cap) +KEYWORD1 void KEYWORD2 NAME(RasterPos2f)(GLfloat x, GLfloat y) { - DISPATCH(Disable, (cap), (F, "glDisable(0x%x);", cap)); + DISPATCH(RasterPos2f, (x, y), (F, "glRasterPos2f(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(DrawBuffer)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(RasterPos2fv)(const GLfloat * v) { - DISPATCH(DrawBuffer, (mode), (F, "glDrawBuffer(0x%x);", mode)); + DISPATCH(RasterPos2fv, (v), (F, "glRasterPos2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) +KEYWORD1 void KEYWORD2 NAME(RasterPos2i)(GLint x, GLint y) { - DISPATCH(DrawElements, (mode, count, type, indices), (F, "glDrawElements(0x%x, %d, 0x%x, %p;", mode, count, type, indices)); + DISPATCH(RasterPos2i, (x, y), (F, "glRasterPos2i(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(RasterPos2iv)(const GLint * v) { - DISPATCH(DrawPixels, (width, height, format, type, pixels), (F, "glDrawPixels(%d, %d, 0x%x, 0x%x, %p);", width, height, format, type, pixels)); + DISPATCH(RasterPos2iv, (v), (F, "glRasterPos2iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) +KEYWORD1 void KEYWORD2 NAME(RasterPos2s)(GLshort x, GLshort y) { - DISPATCH(EdgeFlag, (flag), (F, ";")); + DISPATCH(RasterPos2s, (x, y), (F, "glRasterPos2s(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean *flag) +KEYWORD1 void KEYWORD2 NAME(RasterPos2sv)(const GLshort * v) { - DISPATCH(EdgeFlagv, (flag), (F, ";")); + DISPATCH(RasterPos2sv, (v), (F, "glRasterPos2sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap) +KEYWORD1 void KEYWORD2 NAME(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(Enable, (cap), (F, "glEnable(0x%x);", cap)); + DISPATCH(RasterPos3d, (x, y, z), (F, "glRasterPos3d(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(End)(void) +KEYWORD1 void KEYWORD2 NAME(RasterPos3dv)(const GLdouble * v) { - DISPATCH(End, (), (F, "glEnd();")); + DISPATCH(RasterPos3dv, (v), (F, "glRasterPos3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(EndList)(void) +KEYWORD1 void KEYWORD2 NAME(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(EndList, (), (F, "glEndList();")); + DISPATCH(RasterPos3f, (x, y, z), (F, "glRasterPos3f(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) +KEYWORD1 void KEYWORD2 NAME(RasterPos3fv)(const GLfloat * v) { - DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%g);", u)); + DISPATCH(RasterPos3fv, (v), (F, "glRasterPos3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) +KEYWORD1 void KEYWORD2 NAME(RasterPos3i)(GLint x, GLint y, GLint z) +{ + DISPATCH(RasterPos3i, (x, y, z), (F, "glRasterPos3i(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(RasterPos3iv)(const GLint * v) { - DISPATCH(EvalCoord1f, (u), (F, ";")); + DISPATCH(RasterPos3iv, (v), (F, "glRasterPos3iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble *u) +KEYWORD1 void KEYWORD2 NAME(RasterPos3s)(GLshort x, GLshort y, GLshort z) { - DISPATCH(EvalCoord1dv, (u), (F, ";")); + DISPATCH(RasterPos3s, (x, y, z), (F, "glRasterPos3s(%d, %d, %d);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat *u) +KEYWORD1 void KEYWORD2 NAME(RasterPos3sv)(const GLshort * v) { - DISPATCH(EvalCoord1fv, (u), (F, ";")); + DISPATCH(RasterPos3sv, (v), (F, "glRasterPos3sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) +KEYWORD1 void KEYWORD2 NAME(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - DISPATCH(EvalCoord2d, (u, v), (F, ";")); + DISPATCH(RasterPos4d, (x, y, z, w), (F, "glRasterPos4d(%f, %f, %f, %f);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) +KEYWORD1 void KEYWORD2 NAME(RasterPos4dv)(const GLdouble * v) { - DISPATCH(EvalCoord2f, (u, v), (F, ";")); + DISPATCH(RasterPos4dv, (v), (F, "glRasterPos4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble *u) +KEYWORD1 void KEYWORD2 NAME(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - DISPATCH(EvalCoord2dv, (u), (F, ";")); + DISPATCH(RasterPos4f, (x, y, z, w), (F, "glRasterPos4f(%f, %f, %f, %f);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat *u) +KEYWORD1 void KEYWORD2 NAME(RasterPos4fv)(const GLfloat * v) { - DISPATCH(EvalCoord2fv, (u), (F, ";")); + DISPATCH(RasterPos4fv, (v), (F, "glRasterPos4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2) +KEYWORD1 void KEYWORD2 NAME(RasterPos4i)(GLint x, GLint y, GLint z, GLint w) { - DISPATCH(EvalMesh1, (mode, i1, i2), (F, "glEvalMesh(0x%x, %d, %d);", mode, i1, i2)); + DISPATCH(RasterPos4i, (x, y, z, w), (F, "glRasterPos4i(%d, %d, %d, %d);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +KEYWORD1 void KEYWORD2 NAME(RasterPos4iv)(const GLint * v) { - DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, "glEvalMesh2(0x%x, %d, %d, %d, %d);", mode, i1, i2, j1, j2)); + DISPATCH(RasterPos4iv, (v), (F, "glRasterPos4iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) +KEYWORD1 void KEYWORD2 NAME(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w) { - DISPATCH(EvalPoint1, (i), (F, ";")); + DISPATCH(RasterPos4s, (x, y, z, w), (F, "glRasterPos4s(%d, %d, %d, %d);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) +KEYWORD1 void KEYWORD2 NAME(RasterPos4sv)(const GLshort * v) { - DISPATCH(EvalPoint2, (i, j), (F, ";")); + DISPATCH(RasterPos4sv, (v), (F, "glRasterPos4sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat *buffer) +KEYWORD1 void KEYWORD2 NAME(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) { - DISPATCH(FeedbackBuffer, (size, type, buffer), (F, "glFeedbackBuffer(%d, 0x%x, %p);", size, type, (void *) buffer)); + DISPATCH(Rectd, (x1, y1, x2, y2), (F, "glRectd(%f, %f, %f, %f);\n", x1, y1, x2, y2)); } -KEYWORD1 void KEYWORD2 NAME(Finish)(void) +KEYWORD1 void KEYWORD2 NAME(Rectdv)(const GLdouble * v1, const GLdouble * v2) { - DISPATCH(Finish, (), (F, "glFinish();")); + DISPATCH(Rectdv, (v1, v2), (F, "glRectdv(%p, %p);\n", (void *) v1, (void *) v2)); } -KEYWORD1 void KEYWORD2 NAME(Flush)(void) +KEYWORD1 void KEYWORD2 NAME(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) { - DISPATCH(Flush, (), (F, "glFlush();")); + DISPATCH(Rectf, (x1, y1, x2, y2), (F, "glRectf(%f, %f, %f, %f);\n", x1, y1, x2, y2)); } -KEYWORD1 void KEYWORD2 NAME(Fogf)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Rectfv)(const GLfloat * v1, const GLfloat * v2) { - DISPATCH(Fogf, (pname, param), (F, "glFogf(0x%x, %g);", pname, param)); + DISPATCH(Rectfv, (v1, v2), (F, "glRectfv(%p, %p);\n", (void *) v1, (void *) v2)); } -KEYWORD1 void KEYWORD2 NAME(Fogi)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(Recti)(GLint x1, GLint y1, GLint x2, GLint y2) { - DISPATCH(Fogi, (pname, param), (F, "glFogi(0x%x, %d);", pname, param)); + DISPATCH(Recti, (x1, y1, x2, y2), (F, "glRecti(%d, %d, %d, %d);\n", x1, y1, x2, y2)); } -KEYWORD1 void KEYWORD2 NAME(Fogfv)(GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(Rectiv)(const GLint * v1, const GLint * v2) { - DISPATCH(Fogfv, (pname, params), (F, "glFogfv(0x%x, %p);", pname, (void *) params)); + DISPATCH(Rectiv, (v1, v2), (F, "glRectiv(%p, %p);\n", (void *) v1, (void *) v2)); } -KEYWORD1 void KEYWORD2 NAME(Fogiv)(GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2) { - DISPATCH(Fogiv, (pname, params), (F, "glFogiv(0x%x, %p);", pname, (void *) params)); + DISPATCH(Rects, (x1, y1, x2, y2), (F, "glRects(%d, %d, %d, %d);\n", x1, y1, x2, y2)); } -KEYWORD1 void KEYWORD2 NAME(FrontFace)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(Rectsv)(const GLshort * v1, const GLshort * v2) { - DISPATCH(FrontFace, (mode), (F, "glFrontFace(0x%x);", mode)); + DISPATCH(Rectsv, (v1, v2), (F, "glRectsv(%p, %p);\n", (void *) v1, (void *) v2)); } -KEYWORD1 void KEYWORD2 NAME(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) +KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) { - DISPATCH(Frustum, (left, right, bottom, top, nearval, farval), (F, "glFrustum(%f, %f, %f, %f, %f, %f);", left, right, bottom, top, nearval, farval)); + DISPATCH(TexCoord1d, (s), (F, "glTexCoord1d(%f);\n", s)); } -KEYWORD1 GLuint KEYWORD2 NAME(GenLists)(GLsizei range) +KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble * v) { - RETURN_DISPATCH(GenLists, (range), (F, "glGenLists(%d);", range)); + DISPATCH(TexCoord1dv, (v), (F, "glTexCoord1dv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetBooleanv)(GLenum pname, GLboolean *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) { - DISPATCH(GetBooleanv, (pname, params), (F, "glGetBooleanv(0x%x, %p);", pname, params)); + DISPATCH(TexCoord1f, (s), (F, "glTexCoord1f(%f);\n", s)); } -KEYWORD1 void KEYWORD2 NAME(GetClipPlane)(GLenum plane, GLdouble *equation) +KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat * v) { - DISPATCH(GetClipPlane, (plane, equation), (F, "glGetClipPlane(x0%x, %p);", plane, (void *) equation)); + DISPATCH(TexCoord1fv, (v), (F, "glTexCoord1fv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetDoublev)(GLenum pname, GLdouble *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) { - DISPATCH(GetDoublev, (pname, params), (F, "glGetDoublev(0x%x, %p);", pname, (void *) params)); + DISPATCH(TexCoord1i, (s), (F, "glTexCoord1i(%d);\n", s)); } -KEYWORD1 GLenum KEYWORD2 NAME(GetError)(void) +KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint * v) { - RETURN_DISPATCH(GetError, (), (F, "glGetError();")); + DISPATCH(TexCoord1iv, (v), (F, "glTexCoord1iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetFloatv)(GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) { - DISPATCH(GetFloatv, (pname, params), (F, "glGetFloatv(0x%x, %p);", pname, (void *) params)); + DISPATCH(TexCoord1s, (s), (F, "glTexCoord1s(%d);\n", s)); } -KEYWORD1 void KEYWORD2 NAME(GetIntegerv)(GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort * v) { - DISPATCH(GetIntegerv, (pname, params), (F, "glGetIntegerv(0x%x, %p);", pname, (void *) params)); + DISPATCH(TexCoord1sv, (v), (F, "glTexCoord1sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetLightfv)(GLenum light, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) { - DISPATCH(GetLightfv, (light, pname, params), (F, "glGetLightfv(0x%x, 0x%x, %p);", light, pname, (void *) params)); + DISPATCH(TexCoord2d, (s, t), (F, "glTexCoord2d(%f, %f);\n", s, t)); } -KEYWORD1 void KEYWORD2 NAME(GetLightiv)(GLenum light, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble * v) { - DISPATCH(GetLightiv, (light, pname, params), (F, "glGetLightiv(0x%x, 0x%x, %p);", light, pname, (void *) params)); + DISPATCH(TexCoord2dv, (v), (F, "glTexCoord2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(GetMapdv)(GLenum target, GLenum query, GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) { - DISPATCH(GetMapdv, (target, query, v), (F, "glGetMapdv(0x%x, 0x%x, %p);", target, query, (void *) v)); + DISPATCH(TexCoord2f, (s, t), (F, "glTexCoord2f(%f, %f);\n", s, t)); } -KEYWORD1 void KEYWORD2 NAME(GetMapfv)(GLenum target, GLenum query, GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat * v) { - DISPATCH(GetMapfv, (target, query, v), (F, "glGetMapfv(0x%x, 0x%x, %p);", target, query, (void *) v)); + DISPATCH(TexCoord2fv, (v), (F, "glTexCoord2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(GetMapiv)(GLenum target, GLenum query, GLint *v) +KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) { - DISPATCH(GetMapiv, (target, query, v), (F, "glGetMapiv(0x%x, 0x%x, %p);", target, query, (void *) v)); + DISPATCH(TexCoord2i, (s, t), (F, "glTexCoord2i(%d, %d);\n", s, t)); } -KEYWORD1 void KEYWORD2 NAME(GetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint * v) { - DISPATCH(GetMaterialfv, (face, pname, params), (F, "glGetMaterialfv(0x%x, 0x%x, %p;", face, pname, (void *) params)); + DISPATCH(TexCoord2iv, (v), (F, "glTexCoord2iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetMaterialiv)(GLenum face, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) { - DISPATCH(GetMaterialiv, (face, pname, params), (F, "glGetMaterialiv(0x%x, 0x%x, %p);", face, pname, (void *) params)); + DISPATCH(TexCoord2s, (s, t), (F, "glTexCoord2s(%d, %d);\n", s, t)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelMapfv)(GLenum map, GLfloat *values) +KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort * v) { - DISPATCH(GetPixelMapfv, (map, values), (F, "glGetPixelMapfv(0x%x, %p);", map, (void *) values)); + DISPATCH(TexCoord2sv, (v), (F, "glTexCoord2sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelMapuiv)(GLenum map, GLuint *values) +KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) { - DISPATCH(GetPixelMapuiv, (map, values), (F, "glGetPixelMapuiv(0x%x, %p);", map, (void *) values)); + DISPATCH(TexCoord3d, (s, t, r), (F, "glTexCoord3d(%f, %f, %f);\n", s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelMapusv)(GLenum map, GLushort *values) +KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble * v) { - DISPATCH(GetPixelMapusv, (map, values), (F, "glGetPixelMapusv(0x%x, %p);", map, (void *) values)); + DISPATCH(TexCoord3dv, (v), (F, "glTexCoord3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(GetPolygonStipple)(GLubyte *mask) +KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) { - DISPATCH(GetPolygonStipple, (mask), (F, "glGetPolygonStipple(%p);", mask)); + DISPATCH(TexCoord3f, (s, t, r), (F, "glTexCoord3f(%f, %f, %f);\n", s, t, r)); } -KEYWORD1 const GLubyte * KEYWORD2 NAME(GetString)(GLenum name) +KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat * v) { - RETURN_DISPATCH(GetString, (name), (F, "glGetString(0x%x);", name)); + DISPATCH(TexCoord3fv, (v), (F, "glTexCoord3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) { - DISPATCH(GetTexEnvfv, (target, pname, params), (F, "glGettexEnvfv(0x%x, 0x%x, %p);", target, pname, (void *) params)); + DISPATCH(TexCoord3i, (s, t, r), (F, "glTexCoord3i(%d, %d, %d);\n", s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(GetTexEnviv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint * v) { - DISPATCH(GetTexEnviv, (target, pname, params), (F, "glGetTexEnviv(0x%x, 0x%x, %p);", target, pname, (void *) params)); + DISPATCH(TexCoord3iv, (v), (F, "glTexCoord3iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetTexGeniv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) { - DISPATCH(GetTexGeniv, (target, pname, params), (F, "glGetTexGeniv(0x%x, 0x%x, %p);", target, pname, (void *) params)); + DISPATCH(TexCoord3s, (s, t, r), (F, "glTexCoord3s(%d, %d, %d);\n", s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(GetTexGendv)(GLenum target, GLenum pname, GLdouble *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort * v) { - DISPATCH(GetTexGendv, (target, pname, params), (F, "glGetTexGendv(0x%x, 0x%x, %p;", target, pname, (void *) params)); + DISPATCH(TexCoord3sv, (v), (F, "glTexCoord3sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetTexGenfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) { - DISPATCH(GetTexGenfv, (target, pname, params), (F, "glGetTexGenfv(0x%x, 0x%x, %p);", target, pname, (void *) params)); + DISPATCH(TexCoord4d, (s, t, r, q), (F, "glTexCoord4d(%f, %f, %f, %f);\n", s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble * v) { - DISPATCH(GetTexImage, (target, level, format, type, pixels), (F, "glGetTexImage(0x%x, %d, 0x%x, 0x%x, %p);", target, level, format, type, pixels)); + DISPATCH(TexCoord4dv, (v), (F, "glTexCoord4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - DISPATCH(GetTexLevelParameterfv, (target, level, pname, params), (F, "glGetTexLevelParameterfv(0x%x, %d, 0x%x, %p);", target, level, pname, (void *) params)); + DISPATCH(TexCoord4f, (s, t, r, q), (F, "glTexCoord4f(%f, %f, %f, %f);\n", s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat * v) { - DISPATCH(GetTexLevelParameteriv, (target, level, pname, params), (F, "glGetTexLevelParameteriv(0x%x, %d, 0x%x, %p);", target, level, pname, (void *) params)); + DISPATCH(TexCoord4fv, (v), (F, "glTexCoord4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) { - DISPATCH(GetTexParameterfv, (target, pname, params), (F, "glGetTexParameterfv(0x%x, 0x%x, %p);", target, pname, (void *) params)); + DISPATCH(TexCoord4i, (s, t, r, q), (F, "glTexCoord4i(%d, %d, %d, %d);\n", s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(GetTexParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint * v) { - DISPATCH(GetTexParameteriv, (target, pname, params), (F, "glGetTexParameteriv(0x%x, 0x%x, %p);", target, pname, (void *) params)); + DISPATCH(TexCoord4iv, (v), (F, "glTexCoord4iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) { - DISPATCH(Hint, (target, mode), (F, "glHint(0x%x, 0x%x);", target, mode)); + DISPATCH(TexCoord4s, (s, t, r, q), (F, "glTexCoord4s(%d, %d, %d, %d);\n", s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) +KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort * v) { - DISPATCH(Indexd, (c), (F, ";")); + DISPATCH(TexCoord4sv, (v), (F, "glTexCoord4sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble *c) +KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) { - DISPATCH(Indexdv, (c), (F, ";")); + DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) +KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble * v) { - DISPATCH(Indexf, (c), (F, ";")); + DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat *c) +KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) { - DISPATCH(Indexfv, (c), (F, ";")); + DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) +KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat * v) { - DISPATCH(Indexi, (c), (F, ";")); + DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint *c) +KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) { - DISPATCH(Indexiv, (c), (F, ";")); + DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) +KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint * v) { - DISPATCH(Indexs, (c), (F, ";")); + DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort *c) +KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) { - DISPATCH(Indexsv, (c), (F, ";")); + DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) +KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort * v) { - DISPATCH(Indexub, (c), (F, ";")); + DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte *c) +KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(Indexubv, (c), (F, ";")); + DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) +KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble * v) { - DISPATCH(IndexMask, (mask), (F, "glIndexMask(%u);", mask)); + DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(InitNames)(void) +KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(InitNames, (), (F, "glInitNames();")); + DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) +KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat * v) { - RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);", cap)); + DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) +KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) +{ + DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint * v) +{ + DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) { - RETURN_DISPATCH(IsList, (list), (F, "glIsList(%u);", list)); + DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort * v) +{ + DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble * v) +{ + DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat * v) +{ + DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) +{ + DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint * v) +{ + DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) +{ + DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort * v) +{ + DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble * equation) +{ + DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(0x%x, %p);\n", plane, (void *) equation)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorMaterial)(GLenum face, GLenum mode) +{ + DISPATCH(ColorMaterial, (face, mode), (F, "glColorMaterial(0x%x, 0x%x);\n", face, mode)); +} + +KEYWORD1 void KEYWORD2 NAME(CullFace)(GLenum mode) +{ + DISPATCH(CullFace, (mode), (F, "glCullFace(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogf)(GLenum pname, GLfloat param) +{ + DISPATCH(Fogf, (pname, param), (F, "glFogf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogfv)(GLenum pname, const GLfloat * params) +{ + DISPATCH(Fogfv, (pname, params), (F, "glFogfv(0x%x, %p);\n", pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogi)(GLenum pname, GLint param) +{ + DISPATCH(Fogi, (pname, param), (F, "glFogi(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(Fogiv)(GLenum pname, const GLint * params) +{ + DISPATCH(Fogiv, (pname, params), (F, "glFogiv(0x%x, %p);\n", pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FrontFace)(GLenum mode) +{ + DISPATCH(FrontFace, (mode), (F, "glFrontFace(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode) +{ + DISPATCH(Hint, (target, mode), (F, "glHint(0x%x, 0x%x);\n", target, mode)); } KEYWORD1 void KEYWORD2 NAME(Lightf)(GLenum light, GLenum pname, GLfloat param) { - DISPATCH(Lightf, (light, pname, param), (F, "glLightfv(0x%x, 0x%x, %g);", light, pname, param)); + DISPATCH(Lightf, (light, pname, param), (F, "glLightf(0x%x, 0x%x, %f);\n", light, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(Lighti)(GLenum light, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(Lightfv)(GLenum light, GLenum pname, const GLfloat * params) { - DISPATCH(Lighti, (light, pname, param), (F, "glLighti(0x%x, 0x%x, %d);", light, pname, param)); + DISPATCH(Lightfv, (light, pname, params), (F, "glLightfv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Lightfv)(GLenum light, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(Lighti)(GLenum light, GLenum pname, GLint param) { - DISPATCH(Lightfv, (light, pname, params), (F, "glLightfv(0x%x, 0x%x, %p);", light, pname, (void *) params)); + DISPATCH(Lighti, (light, pname, param), (F, "glLighti(0x%x, 0x%x, %d);\n", light, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(Lightiv)(GLenum light, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(Lightiv)(GLenum light, GLenum pname, const GLint * params) { - DISPATCH(Lightiv, (light, pname, params), (F, "glLightiv(0x%x, 0x%x, %p);", light, pname, (void *) params)); + DISPATCH(Lightiv, (light, pname, params), (F, "glLightiv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(LightModelf)(GLenum pname, GLfloat param) { - DISPATCH(LightModelf, (pname, param), (F, "glLightModelf(0x%x, %f);", pname, param)); + DISPATCH(LightModelf, (pname, param), (F, "glLightModelf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(LightModelfv)(GLenum pname, const GLfloat * params) +{ + DISPATCH(LightModelfv, (pname, params), (F, "glLightModelfv(0x%x, %p);\n", pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(LightModeli)(GLenum pname, GLint param) { - DISPATCH(LightModeli, (pname, param), (F, "glLightModeli(0x%x, %d);", pname, param)); + DISPATCH(LightModeli, (pname, param), (F, "glLightModeli(0x%x, %d);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(LightModelfv)(GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(LightModeliv)(GLenum pname, const GLint * params) { - DISPATCH(LightModelfv, (pname, params), (F, "glLightModelfv(0x%x, %p);", pname, (void *) params)); + DISPATCH(LightModeliv, (pname, params), (F, "glLightModeliv(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(LightModeliv)(GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(LineStipple)(GLint factor, GLushort pattern) { - DISPATCH(LightModeliv, (pname, params), (F, "glLightModeliv(0x%x, %p);", pname, (void *) params)); + DISPATCH(LineStipple, (factor, pattern), (F, "glLineStipple(%d, %d);\n", factor, pattern)); } KEYWORD1 void KEYWORD2 NAME(LineWidth)(GLfloat width) { - DISPATCH(LineWidth, (width), (F, "glLineWidth(%g);", width)); + DISPATCH(LineWidth, (width), (F, "glLineWidth(%f);\n", width)); } -KEYWORD1 void KEYWORD2 NAME(LineStipple)(GLint factor, GLushort pattern) +KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) { - DISPATCH(LineStipple, (factor, pattern), (F, "glLineStipple(%d, 0x%x);", factor, pattern)); + DISPATCH(Materialf, (face, pname, param), (F, "glMaterialf(0x%x, 0x%x, %f);\n", face, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(ListBase)(GLuint base) +KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat * params) { - DISPATCH(ListBase, (base), (F, "glListbase(%d);", base)); + DISPATCH(Materialfv, (face, pname, params), (F, "glMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(LoadIdentity)(void) +KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) { - DISPATCH(LoadIdentity, (), (F, "glLoadIdentity();")); + DISPATCH(Materiali, (face, pname, param), (F, "glMateriali(0x%x, 0x%x, %d);\n", face, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(LoadMatrixd)(const GLdouble *m) +KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint * params) { - DISPATCH(LoadMatrixd, (m), (F, "glLoadMatirxd(%p);", (void *) m)); + DISPATCH(Materialiv, (face, pname, params), (F, "glMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(LoadMatrixf)(const GLfloat *m) +KEYWORD1 void KEYWORD2 NAME(PointSize)(GLfloat size) { - DISPATCH(LoadMatrixf, (m), (F, "glLoadMatrixf(%p);", (void *) m)); + DISPATCH(PointSize, (size), (F, "glPointSize(%f);\n", size)); } -KEYWORD1 void KEYWORD2 NAME(LoadName)(GLuint name) +KEYWORD1 void KEYWORD2 NAME(PolygonMode)(GLenum face, GLenum mode) { - DISPATCH(LoadName, (name), (F, "glLoadName(%u);", name)); + DISPATCH(PolygonMode, (face, mode), (F, "glPolygonMode(0x%x, 0x%x);\n", face, mode)); } -KEYWORD1 void KEYWORD2 NAME(LogicOp)(GLenum opcode) +KEYWORD1 void KEYWORD2 NAME(PolygonStipple)(const GLubyte * mask) { - DISPATCH(LogicOp, (opcode), (F, "glLogicOp(0x%x);", opcode)); + DISPATCH(PolygonStipple, (mask), (F, "glPolygonStipple(%p);\n", (void *) mask)); } -KEYWORD1 void KEYWORD2 NAME(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points) +KEYWORD1 void KEYWORD2 NAME(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(Map1d, (target, u1, u2, stride, order, points), (F, ";")); + DISPATCH(Scissor, (x, y, width, height), (F, "glScissor(%d, %d, %d, %d);\n", x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(ShadeModel)(GLenum mode) { - DISPATCH(Map1f, (target, u1, u2, stride, order, points), (F, ";")); + DISPATCH(ShadeModel, (mode), (F, "glShadeModel(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points) +KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) { - DISPATCH(Map2d, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, ";")); + DISPATCH(TexParameterf, (target, pname, param), (F, "glTexParameterf(0x%x, 0x%x, %f);\n", target, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { - DISPATCH(Map2f, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, ";")); + DISPATCH(TexParameterfv, (target, pname, params), (F, "glTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2) +KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) { - DISPATCH(MapGrid1d, (un, u1, u2), (F, ";")); + DISPATCH(TexParameteri, (target, pname, param), (F, "glTexParameteri(0x%x, 0x%x, %d);\n", target, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2) +KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint * params) { - DISPATCH(MapGrid1f, (un, u1, u2), (F, ";")); + DISPATCH(TexParameteriv, (target, pname, params), (F, "glTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) +KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(MapGrid2d, (un, u1, u2, vn, v1, v2), (F, ";")); + DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, "glTexImage1D(0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, border, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) +KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, ";")); + DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, "glTexImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, border, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) { - DISPATCH(Materialf, (face, pname, param), (F, ";")); + DISPATCH(TexEnvf, (target, pname, param), (F, "glTexEnvf(0x%x, 0x%x, %f);\n", target, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params) { - DISPATCH(Materiali, (face, pname, param), (F, ";")); + DISPATCH(TexEnvfv, (target, pname, params), (F, "glTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) { - DISPATCH(Materialfv, (face, pname, params), (F, ";")); + DISPATCH(TexEnvi, (target, pname, param), (F, "glTexEnvi(0x%x, 0x%x, %d);\n", target, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint * params) { - DISPATCH(Materialiv, (face, pname, params), (F, ";")); + DISPATCH(TexEnviv, (target, pname, params), (F, "glTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) { - DISPATCH(MatrixMode, (mode), (F, "glMatrixMode(0x%x);", mode)); + DISPATCH(TexGend, (coord, pname, param), (F, "glTexGend(0x%x, 0x%x, %f);\n", coord, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(MultMatrixd)(const GLdouble *m) +KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble * params) { - DISPATCH(MultMatrixd, (m), (F, "glMultMatrixd(%p);", (void *) m)); + DISPATCH(TexGendv, (coord, pname, params), (F, "glTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultMatrixf)(const GLfloat *m) +KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) { - DISPATCH(MultMatrixf, (m), (F, "glMultMatrixf(%p);", (void *) m)); + DISPATCH(TexGenf, (coord, pname, param), (F, "glTexGenf(0x%x, 0x%x, %f);\n", coord, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat * params) { - DISPATCH(NewList, (list, mode), (F, ";")); + DISPATCH(TexGenfv, (coord, pname, params), (F, "glTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) +KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) { - DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);", nx, ny, nz)); + DISPATCH(TexGeni, (coord, pname, param), (F, "glTexGeni(0x%x, 0x%x, %d);\n", coord, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte *v) +KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint * params) { - DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);", (void *) v)); + DISPATCH(TexGeniv, (coord, pname, params), (F, "glTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) +KEYWORD1 void KEYWORD2 NAME(FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer) { - DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);", nx, ny, nz)); + DISPATCH(FeedbackBuffer, (size, type, buffer), (F, "glFeedbackBuffer(%d, 0x%x, %p);\n", size, type, (void *) buffer)); } -KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(SelectBuffer)(GLsizei size, GLuint * buffer) { - DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p);", (void *) v)); + DISPATCH(SelectBuffer, (size, buffer), (F, "glSelectBuffer(%d, %p);\n", size, (void *) buffer)); } -KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) +KEYWORD1 GLint KEYWORD2 NAME(RenderMode)(GLenum mode) { - DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%g, %g, %g);", nx, ny, nz)); + RETURN_DISPATCH(RenderMode, (mode), (F, "glRenderMode(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(InitNames)(void) { - DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p);", (void *) v)); + DISPATCH(InitNames, (), (F, "glInitNames();\n")); } -KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) +KEYWORD1 void KEYWORD2 NAME(LoadName)(GLuint name) { - DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);", nx, ny, nz)); + DISPATCH(LoadName, (name), (F, "glLoadName(%d);\n", name)); } -KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(PassThrough)(GLfloat token) { - DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);", (void *) v)); + DISPATCH(PassThrough, (token), (F, "glPassThrough(%f);\n", token)); } -KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) +KEYWORD1 void KEYWORD2 NAME(PopName)(void) { - DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);", nx, ny, nz)); + DISPATCH(PopName, (), (F, "glPopName();\n")); } -KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(PushName)(GLuint name) { - DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);", (void *) v)); + DISPATCH(PushName, (name), (F, "glPushName(%d);\n", name)); } -KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) +KEYWORD1 void KEYWORD2 NAME(DrawBuffer)(GLenum mode) { - DISPATCH(Ortho, (left, right, bottom, top, nearval, farval), (F, "glOrtho(%f, %f, %f, %f, %f, %f);", left, right, bottom, top, nearval, farval)); + DISPATCH(DrawBuffer, (mode), (F, "glDrawBuffer(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(PassThrough)(GLfloat token) +KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask) { - DISPATCH(PassThrough, (token), (F, "glPassThrough(%f);", token)); + DISPATCH(Clear, (mask), (F, "glClear(%p);\n", (void *) mask)); } -KEYWORD1 void KEYWORD2 NAME(PixelMapfv)(GLenum map, GLint mapsize, const GLfloat *values) +KEYWORD1 void KEYWORD2 NAME(ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - DISPATCH(PixelMapfv, (map, mapsize, values), (F, ";")); + DISPATCH(ClearAccum, (red, green, blue, alpha), (F, "glClearAccum(%f, %f, %f, %f);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(PixelMapuiv)(GLenum map, GLint mapsize, const GLuint *values) +KEYWORD1 void KEYWORD2 NAME(ClearIndex)(GLfloat c) { - DISPATCH(PixelMapuiv, (map, mapsize, values), (F, ";")); + DISPATCH(ClearIndex, (c), (F, "glClearIndex(%f);\n", c)); } -KEYWORD1 void KEYWORD2 NAME(PixelMapusv)(GLenum map, GLint mapsize, const GLushort *values) +KEYWORD1 void KEYWORD2 NAME(ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - DISPATCH(PixelMapusv, (map, mapsize, values), (F, ";")); + DISPATCH(ClearColor, (red, green, blue, alpha), (F, "glClearColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(PixelStoref)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(ClearStencil)(GLint s) { - DISPATCH(PixelStoref, (pname, param), (F, "glPixelStoref(0x%x, %f);", pname, param)); + DISPATCH(ClearStencil, (s), (F, "glClearStencil(%d);\n", s)); } -KEYWORD1 void KEYWORD2 NAME(PixelStorei)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(ClearDepth)(GLclampd depth) { - DISPATCH(PixelStorei, (pname, param), (F, "glPixelStorei(0x%x, %d);", pname, param)); + DISPATCH(ClearDepth, (depth), (F, "glClearDepth(%f);\n", depth)); } -KEYWORD1 void KEYWORD2 NAME(PixelTransferf)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(StencilMask)(GLuint mask) { - DISPATCH(PixelTransferf, (pname, param), (F, "glPixelTransferf(0x%x, %f);", pname, param)); + DISPATCH(StencilMask, (mask), (F, "glStencilMask(%d);\n", mask)); } -KEYWORD1 void KEYWORD2 NAME(PixelTransferi)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - DISPATCH(PixelTransferi, (pname, param), (F, "glPixelTransferi(0x%x, %d);", pname, param)); + DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(PixelZoom)(GLfloat xfactor, GLfloat yfactor) +KEYWORD1 void KEYWORD2 NAME(DepthMask)(GLboolean flag) { - DISPATCH(PixelZoom, (xfactor, yfactor), (F, "glPixelZoom(%f, %f);", xfactor, yfactor)); + DISPATCH(DepthMask, (flag), (F, "glDepthMask(%d);\n", flag)); } -KEYWORD1 void KEYWORD2 NAME(PointSize)(GLfloat size) +KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) { - DISPATCH(PointSize, (size), (F, "glPointSize(%f);", size)); + DISPATCH(IndexMask, (mask), (F, "glIndexMask(%d);\n", mask)); } -KEYWORD1 void KEYWORD2 NAME(PolygonMode)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value) { - DISPATCH(PolygonMode, (face, mode), (F, "glPolygonMode(0x%x, 0x%x);", face, mode)); + DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %f);\n", op, value)); } -KEYWORD1 void KEYWORD2 NAME(PolygonStipple)(const GLubyte *pattern) +KEYWORD1 void KEYWORD2 NAME(Disable)(GLenum cap) { - DISPATCH(PolygonStipple, (pattern), (F, "glPolygonStipple(%p);", pattern)); + DISPATCH(Disable, (cap), (F, "glDisable(0x%x);\n", cap)); } -KEYWORD1 void KEYWORD2 NAME(PopAttrib)(void) +KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap) { - DISPATCH(PopAttrib, (), (F, "glPopAttrib();")); + DISPATCH(Enable, (cap), (F, "glEnable(0x%x);\n", cap)); } -KEYWORD1 void KEYWORD2 NAME(PopMatrix)(void) +KEYWORD1 void KEYWORD2 NAME(Finish)(void) { - DISPATCH(PopMatrix, (), (F, "glPopMatrix();")); + DISPATCH(Finish, (), (F, "glFinish();\n")); } -KEYWORD1 void KEYWORD2 NAME(PopName)(void) +KEYWORD1 void KEYWORD2 NAME(Flush)(void) +{ + DISPATCH(Flush, (), (F, "glFlush();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(PopAttrib)(void) { - DISPATCH(PopName, (), (F, "glPopName();")); + DISPATCH(PopAttrib, (), (F, "glPopAttrib();\n")); } KEYWORD1 void KEYWORD2 NAME(PushAttrib)(GLbitfield mask) { - DISPATCH(PushAttrib, (mask), (F, "glPushAttrib(0x%x)", mask)); + DISPATCH(PushAttrib, (mask), (F, "glPushAttrib(%p);\n", (void *) mask)); } -KEYWORD1 void KEYWORD2 NAME(PushMatrix)(void) +KEYWORD1 void KEYWORD2 NAME(Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points) { - DISPATCH(PushMatrix, (), (F, "glPushMatrix();")); + DISPATCH(Map1d, (target, u1, u2, stride, order, points), (F, "glMap1d(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (void *) points)); } -KEYWORD1 void KEYWORD2 NAME(PushName)(GLuint name) +KEYWORD1 void KEYWORD2 NAME(Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points) { - DISPATCH(PushName, (name), (F, "glPushName(%u)", name)); + DISPATCH(Map1f, (target, u1, u2, stride, order, points), (F, "glMap1f(0x%x, %f, %f, %d, %d, %p);\n", target, u1, u2, stride, order, (void *) points)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2d)(GLdouble x, GLdouble y) +KEYWORD1 void KEYWORD2 NAME(Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points) { - DISPATCH(RasterPos2d, (x, y), (F, "glRasterPos2d(%g, %g);", x, y)); + DISPATCH(Map2d, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2d(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (void *) points)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2f)(GLfloat x, GLfloat y) +KEYWORD1 void KEYWORD2 NAME(Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points) { - DISPATCH(RasterPos2f, (x, y), (F, "glRasterPos2f(%g, %g);", x, y)); + DISPATCH(Map2f, (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points), (F, "glMap2f(0x%x, %f, %f, %d, %d, %f, %f, %d, %d, %p);\n", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, (void *) points)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2i)(GLint x, GLint y) +KEYWORD1 void KEYWORD2 NAME(MapGrid1d)(GLint un, GLdouble u1, GLdouble u2) { - DISPATCH(RasterPos2i, (x, y), (F, "glRasterPos2i(%d, %d);", x, y)); + DISPATCH(MapGrid1d, (un, u1, u2), (F, "glMapGrid1d(%d, %f, %f);\n", un, u1, u2)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2s)(GLshort x, GLshort y) +KEYWORD1 void KEYWORD2 NAME(MapGrid1f)(GLint un, GLfloat u1, GLfloat u2) { - DISPATCH(RasterPos2s, (x, y), (F, "glRasterPos2s(%d, %d);", x, y)); + DISPATCH(MapGrid1f, (un, u1, u2), (F, "glMapGrid1f(%d, %f, %f);\n", un, u1, u2)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3d)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) { - DISPATCH(RasterPos3d, (x, y, z), (F, "glRasterPos3d(%g, %g, %g);", x, y, z)); + DISPATCH(MapGrid2d, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2d(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3f)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) { - DISPATCH(RasterPos3f, (x, y, z), (F, "glRasterPos3f(%g, %g, %g);", x, y, z)); + DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, "glMapGrid2f(%d, %f, %f, %d, %f, %f);\n", un, u1, u2, vn, v1, v2)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3i)(GLint x, GLint y, GLint z) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) { - DISPATCH(RasterPos3i, (x, y, z), (F, "glRasterPos3i(%d, %d, %d);", x, y, z)); + DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%f);\n", u)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3s)(GLshort x, GLshort y, GLshort z) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble * u) { - DISPATCH(RasterPos3s, (x, y, z), (F, "glRasterPos3s(%d, %d, %d);", x, y, z)); + DISPATCH(EvalCoord1dv, (u), (F, "glEvalCoord1dv(%p);\n", (void *) u)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) { - DISPATCH(RasterPos4d, (x, y, z, w), (F, "glRasterPos4d(%g, %g, %g, %g);", x, y, z, w)); + DISPATCH(EvalCoord1f, (u), (F, "glEvalCoord1f(%f);\n", u)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat * u) { - DISPATCH(RasterPos4f, (x, y, z, w), (F, "glRasterPos4f(%g, %g, %g, %g);", x, y, z, w)); + DISPATCH(EvalCoord1fv, (u), (F, "glEvalCoord1fv(%p);\n", (void *) u)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4i)(GLint x, GLint y, GLint z, GLint w) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) { - DISPATCH(RasterPos4i, (x, y, z, w), (F, "glRasterPos4i(%d, %d, %d, %d);", x, y, z, w)); + DISPATCH(EvalCoord2d, (u, v), (F, "glEvalCoord2d(%f, %f);\n", u, v)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble * u) { - DISPATCH(RasterPos4s, (x, y, z, w), (F, "glRasterPos4s(%d, %d, %d, %d);", x, y, z, w)); + DISPATCH(EvalCoord2dv, (u), (F, "glEvalCoord2dv(%p /* %g, %g */);\n", (void *) u, u[0], u[1])); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) { - DISPATCH(RasterPos2dv, (v), (F, ";")); + DISPATCH(EvalCoord2f, (u, v), (F, "glEvalCoord2f(%f, %f);\n", u, v)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat * u) { - DISPATCH(RasterPos2fv, (v), (F, ";")); + DISPATCH(EvalCoord2fv, (u), (F, "glEvalCoord2fv(%p /* %g, %g */);\n", (void *) u, u[0], u[1])); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2) { - DISPATCH(RasterPos2iv, (v), (F, ";")); + DISPATCH(EvalMesh1, (mode, i1, i2), (F, "glEvalMesh1(0x%x, %d, %d);\n", mode, i1, i2)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos2sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) { - DISPATCH(RasterPos2sv, (v), (F, ";")); + DISPATCH(EvalPoint1, (i), (F, "glEvalPoint1(%d);\n", i)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { - DISPATCH(RasterPos3dv, (v), (F, ";")); + DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, "glEvalMesh2(0x%x, %d, %d, %d, %d);\n", mode, i1, i2, j1, j2)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) { - DISPATCH(RasterPos3fv, (v), (F, ";")); + DISPATCH(EvalPoint2, (i, j), (F, "glEvalPoint2(%d, %d);\n", i, j)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref) { - DISPATCH(RasterPos3iv, (v), (F, ";")); + DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %f);\n", func, ref)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor) { - DISPATCH(RasterPos3sv, (v), (F, ";")); + DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);\n", sfactor, dfactor)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(LogicOp)(GLenum opcode) { - DISPATCH(RasterPos4dv, (v), (F, ";")); + DISPATCH(LogicOp, (opcode), (F, "glLogicOp(0x%x);\n", opcode)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(StencilFunc)(GLenum func, GLint ref, GLuint mask) { - DISPATCH(RasterPos4fv, (v), (F, ";")); + DISPATCH(StencilFunc, (func, ref, mask), (F, "glStencilFunc(0x%x, %d, %d);\n", func, ref, mask)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { - DISPATCH(RasterPos4iv, (v), (F, ";")); + DISPATCH(StencilOp, (fail, zfail, zpass), (F, "glStencilOp(0x%x, 0x%x, 0x%x);\n", fail, zfail, zpass)); } -KEYWORD1 void KEYWORD2 NAME(RasterPos4sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(DepthFunc)(GLenum func) +{ + DISPATCH(DepthFunc, (func), (F, "glDepthFunc(0x%x);\n", func)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelZoom)(GLfloat xfactor, GLfloat yfactor) +{ + DISPATCH(PixelZoom, (xfactor, yfactor), (F, "glPixelZoom(%f, %f);\n", xfactor, yfactor)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransferf)(GLenum pname, GLfloat param) +{ + DISPATCH(PixelTransferf, (pname, param), (F, "glPixelTransferf(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransferi)(GLenum pname, GLint param) { - DISPATCH(RasterPos4sv, (v), (F, ";")); + DISPATCH(PixelTransferi, (pname, param), (F, "glPixelTransferi(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelStoref)(GLenum pname, GLfloat param) +{ + DISPATCH(PixelStoref, (pname, param), (F, "glPixelStoref(0x%x, %f);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelStorei)(GLenum pname, GLint param) +{ + DISPATCH(PixelStorei, (pname, param), (F, "glPixelStorei(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelMapfv)(GLenum map, GLint mapsize, const GLfloat * values) +{ + DISPATCH(PixelMapfv, (map, mapsize, values), (F, "glPixelMapfv(0x%x, %d, %p);\n", map, mapsize, (void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelMapuiv)(GLenum map, GLint mapsize, const GLuint * values) +{ + DISPATCH(PixelMapuiv, (map, mapsize, values), (F, "glPixelMapuiv(0x%x, %d, %p);\n", map, mapsize, (void *) values)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelMapusv)(GLenum map, GLint mapsize, const GLushort * values) +{ + DISPATCH(PixelMapusv, (map, mapsize, values), (F, "glPixelMapusv(0x%x, %d, %p);\n", map, mapsize, (void *) values)); } KEYWORD1 void KEYWORD2 NAME(ReadBuffer)(GLenum mode) { - DISPATCH(ReadBuffer, (mode), (F, ";")); + DISPATCH(ReadBuffer, (mode), (F, "glReadBuffer(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) { - DISPATCH(ReadPixels, (x, y, width, height, format, type, pixels), (F, ";")); + DISPATCH(CopyPixels, (x, y, width, height, type), (F, "glCopyPixels(%d, %d, %d, %d, 0x%x);\n", x, y, width, height, type)); } -KEYWORD1 void KEYWORD2 NAME(Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) +KEYWORD1 void KEYWORD2 NAME(ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels) { - DISPATCH(Rectd, (x1, y1, x2, y2), (F, ";")); + DISPATCH(ReadPixels, (x, y, width, height, format, type, pixels), (F, "glReadPixels(%d, %d, %d, %d, 0x%x, 0x%x, %p);\n", x, y, width, height, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(Rectdv)(const GLdouble *v1, const GLdouble *v2) +KEYWORD1 void KEYWORD2 NAME(DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(Rectdv, (v1, v2), (F, ";")); + DISPATCH(DrawPixels, (width, height, format, type, pixels), (F, "glDrawPixels(%d, %d, 0x%x, 0x%x, %p);\n", width, height, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +KEYWORD1 void KEYWORD2 NAME(GetBooleanv)(GLenum pname, GLboolean * params) { - DISPATCH(Rectf, (x1, y1, x2, y2), (F, ";")); + DISPATCH(GetBooleanv, (pname, params), (F, "glGetBooleanv(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Rectfv)(const GLfloat *v1, const GLfloat *v2) +KEYWORD1 void KEYWORD2 NAME(GetClipPlane)(GLenum plane, GLdouble * equation) { - DISPATCH(Rectfv, (v1, v2), (F, ";")); + DISPATCH(GetClipPlane, (plane, equation), (F, "glGetClipPlane(0x%x, %p);\n", plane, (void *) equation)); } -KEYWORD1 void KEYWORD2 NAME(Recti)(GLint x1, GLint y1, GLint x2, GLint y2) +KEYWORD1 void KEYWORD2 NAME(GetDoublev)(GLenum pname, GLdouble * params) { - DISPATCH(Recti, (x1, y1, x2, y2), (F, ";")); + DISPATCH(GetDoublev, (pname, params), (F, "glGetDoublev(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Rectiv)(const GLint *v1, const GLint *v2) +KEYWORD1 GLenum KEYWORD2 NAME(GetError)(void) { - DISPATCH(Rectiv, (v1, v2), (F, ";")); + RETURN_DISPATCH(GetError, (), (F, "glGetError();\n")); } -KEYWORD1 void KEYWORD2 NAME(Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2) +KEYWORD1 void KEYWORD2 NAME(GetFloatv)(GLenum pname, GLfloat * params) { - DISPATCH(Rects, (x1, y1, x2, y2), (F, ";")); + DISPATCH(GetFloatv, (pname, params), (F, "glGetFloatv(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Rectsv)(const GLshort *v1, const GLshort *v2) +KEYWORD1 void KEYWORD2 NAME(GetIntegerv)(GLenum pname, GLint * params) { - DISPATCH(Rectsv, (v1, v2), (F, ";")); + DISPATCH(GetIntegerv, (pname, params), (F, "glGetIntegerv(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 GLint KEYWORD2 NAME(RenderMode)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(GetLightfv)(GLenum light, GLenum pname, GLfloat * params) { - RETURN_DISPATCH(RenderMode, (mode), (F, "glRenderMode(0x%x);", mode)); + DISPATCH(GetLightfv, (light, pname, params), (F, "glGetLightfv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(GetLightiv)(GLenum light, GLenum pname, GLint * params) { - DISPATCH(Rotated, (angle, x, y, z), (F, ";")); + DISPATCH(GetLightiv, (light, pname, params), (F, "glGetLightiv(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(GetMapdv)(GLenum target, GLenum query, GLdouble * v) { - DISPATCH(Rotatef, (angle, x, y, z), (F, "glRotatef(%g, %g, %g, %g);", angle, x, y, z)); + DISPATCH(GetMapdv, (target, query, v), (F, "glGetMapdv(0x%x, 0x%x, %p);\n", target, query, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(SelectBuffer)(GLsizei size, GLuint *buffer) +KEYWORD1 void KEYWORD2 NAME(GetMapfv)(GLenum target, GLenum query, GLfloat * v) { - DISPATCH(SelectBuffer, (size, buffer), (F, ";")); + DISPATCH(GetMapfv, (target, query, v), (F, "glGetMapfv(0x%x, 0x%x, %p);\n", target, query, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Scaled)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(GetMapiv)(GLenum target, GLenum query, GLint * v) { - DISPATCH(Scaled, (x, y, z), (F, ";")); + DISPATCH(GetMapiv, (target, query, v), (F, "glGetMapiv(0x%x, 0x%x, %p);\n", target, query, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(Scalef)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params) { - DISPATCH(Scalef, (x, y, z), (F, "glScalef(%g, %g, %g);", x, y, z)); + DISPATCH(GetMaterialfv, (face, pname, params), (F, "glGetMaterialfv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(GetMaterialiv)(GLenum face, GLenum pname, GLint * params) { - DISPATCH(Scissor, (x, y, width, height), (F, "glScissor(%d, %d, %d, %d);", x, y, width, height)); + DISPATCH(GetMaterialiv, (face, pname, params), (F, "glGetMaterialiv(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(ShadeModel)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(GetPixelMapfv)(GLenum map, GLfloat * values) { - DISPATCH(ShadeModel, (mode), (F, "glShadeModel(0x%x);", mode)); + DISPATCH(GetPixelMapfv, (map, values), (F, "glGetPixelMapfv(0x%x, %p);\n", map, (void *) values)); } -KEYWORD1 void KEYWORD2 NAME(StencilFunc)(GLenum func, GLint ref, GLuint mask) +KEYWORD1 void KEYWORD2 NAME(GetPixelMapuiv)(GLenum map, GLuint * values) { - DISPATCH(StencilFunc, (func, ref, mask), (F, ";")); + DISPATCH(GetPixelMapuiv, (map, values), (F, "glGetPixelMapuiv(0x%x, %p);\n", map, (void *) values)); } -KEYWORD1 void KEYWORD2 NAME(StencilMask)(GLuint mask) +KEYWORD1 void KEYWORD2 NAME(GetPixelMapusv)(GLenum map, GLushort * values) { - DISPATCH(StencilMask, (mask), (F, ";")); + DISPATCH(GetPixelMapusv, (map, values), (F, "glGetPixelMapusv(0x%x, %p);\n", map, (void *) values)); } -KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) +KEYWORD1 void KEYWORD2 NAME(GetPolygonStipple)(GLubyte * mask) { - DISPATCH(StencilOp, (fail, zfail, zpass), (F, ";")); + DISPATCH(GetPolygonStipple, (mask), (F, "glGetPolygonStipple(%p);\n", (void *) mask)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) +KEYWORD1 const GLubyte * KEYWORD2 NAME(GetString)(GLenum name) { - DISPATCH(TexCoord1d, (s), (F, ";")); + RETURN_DISPATCH(GetString, (name), (F, "glGetString(0x%x);\n", name)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) +KEYWORD1 void KEYWORD2 NAME(GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(TexCoord1f, (s), (F, ";")); + DISPATCH(GetTexEnvfv, (target, pname, params), (F, "glGetTexEnvfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) +KEYWORD1 void KEYWORD2 NAME(GetTexEnviv)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(TexCoord1i, (s), (F, ";")); + DISPATCH(GetTexEnviv, (target, pname, params), (F, "glGetTexEnviv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) +KEYWORD1 void KEYWORD2 NAME(GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params) { - DISPATCH(TexCoord1s, (s), (F, ";")); + DISPATCH(GetTexGendv, (coord, pname, params), (F, "glGetTexGendv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) +KEYWORD1 void KEYWORD2 NAME(GetTexGenfv)(GLenum coord, GLenum pname, GLfloat * params) { - DISPATCH(TexCoord2d, (s, t), (F, ";")); + DISPATCH(GetTexGenfv, (coord, pname, params), (F, "glGetTexGenfv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) +KEYWORD1 void KEYWORD2 NAME(GetTexGeniv)(GLenum coord, GLenum pname, GLint * params) { - DISPATCH(TexCoord2f, (s, t), (F, ";")); + DISPATCH(GetTexGeniv, (coord, pname, params), (F, "glGetTexGeniv(0x%x, 0x%x, %p);\n", coord, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) +KEYWORD1 void KEYWORD2 NAME(GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels) { - DISPATCH(TexCoord2s, (s, t), (F, ";")); + DISPATCH(GetTexImage, (target, level, format, type, pixels), (F, "glGetTexImage(0x%x, %d, 0x%x, 0x%x, %p);\n", target, level, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) +KEYWORD1 void KEYWORD2 NAME(GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(TexCoord2i, (s, t), (F, ";")); + DISPATCH(GetTexParameterfv, (target, pname, params), (F, "glGetTexParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) +KEYWORD1 void KEYWORD2 NAME(GetTexParameteriv)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(TexCoord3d, (s, t, r), (F, ";")); + DISPATCH(GetTexParameteriv, (target, pname, params), (F, "glGetTexParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) +KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params) { - DISPATCH(TexCoord3f, (s, t, r), (F, ";")); + DISPATCH(GetTexLevelParameterfv, (target, level, pname, params), (F, "glGetTexLevelParameterfv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) +KEYWORD1 void KEYWORD2 NAME(GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params) { - DISPATCH(TexCoord3i, (s, t, r), (F, ";")); + DISPATCH(GetTexLevelParameteriv, (target, level, pname, params), (F, "glGetTexLevelParameteriv(0x%x, %d, 0x%x, %p);\n", target, level, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) +KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) { - DISPATCH(TexCoord3s, (s, t, r), (F, ";")); + RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);\n", cap)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) +KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) { - DISPATCH(TexCoord4d, (s, t, r, q), (F, ";")); + RETURN_DISPATCH(IsList, (list), (F, "glIsList(%d);\n", list)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) +KEYWORD1 void KEYWORD2 NAME(DepthRange)(GLclampd zNear, GLclampd zFar) { - DISPATCH(TexCoord4f, (s, t, r, q), (F, ";")); + DISPATCH(DepthRange, (zNear, zFar), (F, "glDepthRange(%f, %f);\n", zNear, zFar)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) +KEYWORD1 void KEYWORD2 NAME(Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { - DISPATCH(TexCoord4i, (s, t, r, q), (F, ";")); + DISPATCH(Frustum, (left, right, bottom, top, zNear, zFar), (F, "glFrustum(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) +KEYWORD1 void KEYWORD2 NAME(LoadIdentity)(void) { - DISPATCH(TexCoord4s, (s, t, r, q), (F, ";")); + DISPATCH(LoadIdentity, (), (F, "glLoadIdentity();\n")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(LoadMatrixf)(const GLfloat * m) { - DISPATCH(TexCoord1dv, (v), (F, ";")); + DISPATCH(LoadMatrixf, (m), (F, "glLoadMatrixf(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(LoadMatrixd)(const GLdouble * m) { - DISPATCH(TexCoord1fv, (v), (F, ";")); + DISPATCH(LoadMatrixd, (m), (F, "glLoadMatrixd(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode) { - DISPATCH(TexCoord1iv, (v), (F, ";")); + DISPATCH(MatrixMode, (mode), (F, "glMatrixMode(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(MultMatrixf)(const GLfloat * m) { - DISPATCH(TexCoord1sv, (v), (F, ";")); + DISPATCH(MultMatrixf, (m), (F, "glMultMatrixf(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(MultMatrixd)(const GLdouble * m) { - DISPATCH(TexCoord2dv, (v), (F, ";")); + DISPATCH(MultMatrixd, (m), (F, "glMultMatrixd(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) { - DISPATCH(TexCoord2fv, (v), (F, ";")); + DISPATCH(Ortho, (left, right, bottom, top, zNear, zFar), (F, "glOrtho(%f, %f, %f, %f, %f, %f);\n", left, right, bottom, top, zNear, zFar)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(PopMatrix)(void) { - DISPATCH(TexCoord2iv, (v), (F, ";")); + DISPATCH(PopMatrix, (), (F, "glPopMatrix();\n")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(PushMatrix)(void) { - DISPATCH(TexCoord2sv, (v), (F, ";")); + DISPATCH(PushMatrix, (), (F, "glPushMatrix();\n")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(TexCoord3dv, (v), (F, ";")); + DISPATCH(Rotated, (angle, x, y, z), (F, "glRotated(%f, %f, %f, %f);\n", angle, x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(TexCoord3fv, (v), (F, ";")); + DISPATCH(Rotatef, (angle, x, y, z), (F, "glRotatef(%f, %f, %f, %f);\n", angle, x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(Scaled)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(TexCoord3iv, (v), (F, ";")); + DISPATCH(Scaled, (x, y, z), (F, "glScaled(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(Scalef)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(TexCoord3sv, (v), (F, ";")); + DISPATCH(Scalef, (x, y, z), (F, "glScalef(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(TexCoord4dv, (v), (F, ";")); + DISPATCH(Translated, (x, y, z), (F, "glTranslated(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(TexCoord4fv, (v), (F, ";")); + DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(TexCoord4iv, (v), (F, ";")); + DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);\n", x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) { - DISPATCH(TexCoord4sv, (v), (F, ";")); + DISPATCH(ArrayElement, (i), (F, "glArrayElement(%d);\n", i)); } -KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) +KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexGend, (coord, pname, param), (F, ";")); + DISPATCH(ColorPointer, (size, type, stride, pointer), (F, "glColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble *params) +KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum array) { - DISPATCH(TexGendv, (coord, pname, params), (F, ";")); + DISPATCH(DisableClientState, (array), (F, "glDisableClientState(0x%x);\n", array)); } -KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) { - DISPATCH(TexGenf, (coord, pname, param), (F, ";")); + DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArrays(0x%x, %d, %d);\n", mode, first, count)); } -KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices) { - DISPATCH(TexGenfv, (coord, pname, params), (F, ";")); + DISPATCH(DrawElements, (mode, count, type, indices), (F, "glDrawElements(0x%x, %d, 0x%x, %p);\n", mode, count, type, (void *) indices)); } -KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexGeni, (coord, pname, param), (F, ";")); + DISPATCH(EdgeFlagPointer, (stride, pointer), (F, "glEdgeFlagPointer(%d, %p);\n", stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum array) { - DISPATCH(TexGeniv, (coord, pname, params), (F, ";")); + DISPATCH(EnableClientState, (array), (F, "glEnableClientState(0x%x);\n", array)); } -KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid ** params) { - DISPATCH(TexEnvf, (target, pname, param), (F, ";")); + DISPATCH(GetPointerv, (pname, params), (F, "glGetPointerv(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexEnvfv, (target, pname, param), (F, ";")); + DISPATCH(IndexPointer, (type, stride, pointer), (F, "glIndexPointer(0x%x, %d, %p);\n", type, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexEnvi, (target, pname, param), (F, ";")); + DISPATCH(InterleavedArrays, (format, stride, pointer), (F, "glInterleavedArrays(0x%x, %d, %p);\n", format, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexEnviv, (target, pname, param), (F, ";")); + DISPATCH(NormalPointer, (type, stride, pointer), (F, "glNormalPointer(0x%x, %d, %p);\n", type, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, ";")); + DISPATCH(TexCoordPointer, (size, type, stride, pointer), (F, "glTexCoordPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, ";")); + DISPATCH(VertexPointer, (size, type, stride, pointer), (F, "glVertexPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) { - DISPATCH(TexParameterf, (target, pname, param), (F, ";")); + DISPATCH(PolygonOffset, (factor, units), (F, "glPolygonOffset(%f, %f);\n", factor, units)); } -KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { - DISPATCH(TexParameterfv, (target, pname, params), (F, ";")); + DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); } -KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - DISPATCH(TexParameteri, (target, pname, param), (F, ";")); + DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); } -KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { - DISPATCH(TexParameteriv, (target, pname, params), (F, ";")); + DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1D(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(Translated, (x, y, z), (F, "glTranslated(%g, %g, %g);", x, y, z)); + DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2D(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%g, %g, %g);", x, y, z)); + DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1D(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) +KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);", x, y)); + DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble *v) +KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences) { - DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p);", (void *) v)); + RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);\n", n, (void *) textures, (void *) residences)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) +KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) { - DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%g, %g);", x, y)); + DISPATCH(BindTexture, (target, texture), (F, "glBindTexture(0x%x, %d);\n", target, texture)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint * textures) { - DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p);", (void *) v)); + DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);\n", n, (void *) textures)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) +KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint * textures) { - DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);", x, y)); + DISPATCH(GenTextures, (n, textures), (F, "glGenTextures(%d, %p);\n", n, (void *) textures)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint *v) +KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) { - DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);", (void *) v)); + RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%d);\n", texture)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) +KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities) { - DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);", x, y)); + DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTextures(%d, %p, %p);\n", n, (void *) textures, (void *) priorities)); } -KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) { - DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);", (void *) v)); + DISPATCH(Indexub, (c), (F, "glIndexub(%d);\n", c)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte * c) { - DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);", x, y, z)); + DISPATCH(Indexubv, (c), (F, "glIndexubv(%p);\n", (void *) c)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) { - DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p);", (void *) v)); + DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();\n")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) { - DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%g, %g, %g);", x, y, z)); + DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(%p);\n", (void *) mask)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p);", (void *) v)); + DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColor(%f, %f, %f, %f);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) +KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) { - DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);", x, y, z)); + DISPATCH(BlendEquation, (mode), (F, "glBlendEquation(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) { - DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);", (void *) v)); + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElements(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (void *) indices)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) +KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) { - DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);", x, y, z)); + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTable(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) table)); } -KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { - DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);", (void *) v)); + DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params) { - DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);", x, y, z, w)); + DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p);", (void *) v)); + DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTable(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table) { - DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);", x, y, z, w)); + DISPATCH(GetColorTable, (target, format, type, table), (F, "glGetColorTable(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) table)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p);", (void *) v)); + DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, "glGetColorTableParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);", x, y, z, w)); + DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, "glGetColorTableParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) { - DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);", (void *) v)); + DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTable(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) +KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { - DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);", x, y, z, w)); + DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTable(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) { - DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);", (void *) v)); + DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1D(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) image)); } +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) +{ + DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (void *) image)); +} -KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) { - DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);", x, y, width, height)); + DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterf(0x%x, 0x%x, %f);\n", target, pname, params)); } +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params) +{ + DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); +} +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) +{ + DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteri(0x%x, 0x%x, %d);\n", target, pname, params)); +} -/* GL 1.1 */ +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params) +{ + DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); +} -KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);", n, (void *) textures, (void *) residences)); + DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1D(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(ArrayElement, (i), (F, ";")); + DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2D(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image) { - DISPATCH(BindTexture, (target, texture), (F, ";")); + DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, "glGetConvolutionFilter(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) image)); } -KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(ColorPointer, (size, type, stride, ptr), (F, ";")); + DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, "glGetConvolutionParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, ";")); + DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, "glGetConvolutionParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) { - DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, ";")); + DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, "glGetSeparableFilter(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (void *) row, (void *) column, (void *) span)); } -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) { - DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, ";")); + DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2D(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (void *) row, (void *) column)); } -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { - DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, ";")); + DISPATCH(GetHistogram, (target, reset, format, type, values), (F, "glGetHistogram(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); } -KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint *textures) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTextures(%d, %p);", n, (void *) textures)); + DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, "glGetHistogramParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum cap) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(DisableClientState, (cap), (F, "glDisableClientState(0x%x);", cap)); + DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, "glGetHistogramParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) +KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { - DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArrays(0x%x, %d, %d);", mode, first, count)); + DISPATCH(GetMinmax, (target, reset, format, type, values), (F, "glGetMinmax(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(EdgeFlagPointer, (stride, ptr), (F, "glEdgeFlagPointer(%d, %p);", stride, (void *) ptr)); + DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, "glGetMinmaxParameterfv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum cap) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(EnableClientState, (cap), (F, "glEnableClientState(0x%x)", cap)); + DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, "glGetMinmaxParameteriv(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint *textures) +KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) { - DISPATCH(GenTextures, (n, textures), (F, "glGenTextures(%d, %p);", n, (void *) textures)); + DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogram(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); } -KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid **params) +KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) { - DISPATCH(GetPointerv, (pname, params), (F, "glGetPointerv(0x%x, %p);", pname, (void *) params)); + DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmax(0x%x, 0x%x, %d);\n", target, internalformat, sink)); } -KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) { - DISPATCH(IndexPointer, (type, stride, ptr), (F, "glIndexPointer(0x%x, %d, %p);", type, stride, ptr)); + DISPATCH(ResetHistogram, (target), (F, "glResetHistogram(0x%x);\n", target)); } -KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer) +KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) { - DISPATCH(InterleavedArrays, (format, stride, pointer), (F, "glInterleavedArrays(0x%x, %d, %p);", format, stride, pointer)); + DISPATCH(ResetMinmax, (target), (F, "glResetMinmax(0x%x);\n", target)); } -KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) +KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { - RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%u);", texture)); + DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3D(0x%x, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(NormalPointer, (type, stride, ptr), (F, "glNormalPointer(0x%x, %d, %p);", type, stride, (void *) ptr)); + DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(PolygonOffset, (factor, units), (F, "glPolygonOffset(%g, %g);", factor, units)); + DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) +KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) { - DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();")); + DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTextureARB(0x%x);\n", texture)); } -KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities) +KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) { - DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTextures(%d, %p, %p);", n, (void *) textures, (void *) priorities)); + DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTextureARB(0x%x);\n", texture)); } -KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) { - DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(0x%x)", mask)); + DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1dARB(0x%x, %f);\n", target, s)); } -KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble * v) { - DISPATCH(TexCoordPointer, (size, type, stride, ptr), (F, ";")); + DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dvARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) { - DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1fARB(0x%x, %f);\n", target, s)); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat * v) { - DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fvARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) { - DISPATCH(VertexPointer, (size, type, stride, ptr), (F, ";")); + DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1iARB(0x%x, %d);\n", target, s)); } +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1ivARB(0x%x, %p);\n", target, (void *) v)); +} -/* GL 1.2 */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) +{ + DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1sARB(0x%x, %d);\n", target, s)); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort * v) { - DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, ";")); + DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1svARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) { - DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, ";")); + DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2dARB(0x%x, %f, %f);\n", target, s, t)); } -KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble * v) { - DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dvARB(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) { - DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2fARB(0x%x, %f, %f);\n", target, s, t)); } -/* GL_ARB_imaging */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fvARB(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); +} -KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf r, GLclampf g, GLclampf b, GLclampf a) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) { - DISPATCH(BlendColor, (r, g, b, a), (F, ";")); + DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2iARB(0x%x, %d, %d);\n", target, s, t)); } -KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint * v) { - DISPATCH(BlendEquation, (mode), (F, ";")); + DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2ivARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) { - DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, ";")); + DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2sARB(0x%x, %d, %d);\n", target, s, t)); } -KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort * v) { - DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); + DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2svARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) { - DISPATCH(ColorTableParameterfv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3dARB(0x%x, %f, %f, %f);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble * v) { - DISPATCH(ColorTableParameteriv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dvARB(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) { - DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, ";")); + DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3fARB(0x%x, %f, %f, %f);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat * v) { - DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, ";")); + DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fvARB(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) { - DISPATCH(ConvolutionParameterf, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3iARB(0x%x, %d, %d, %d);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint * v) { - DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3ivARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) { - DISPATCH(ConvolutionParameteri, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3sARB(0x%x, %d, %d, %d);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort * v) { - DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3svARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { - DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, ";")); + DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4dARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble * v) { - DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, ";")); + DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dvARB(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, ";")); + DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4fARB(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat * v) { - DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, ";")); + DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fvARB(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) { - DISPATCH(GetColorTable, (target, format, type, table), (F, ";")); + DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4iARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint * v) { - DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4ivARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { - DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4sARB(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort * v) { - DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, ";")); + DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4svARB(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat * m) { - DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, ";")); + DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble * m) { - DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, ";")); + DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixdARB(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat * m) { - DISPATCH(GetHistogram, (target, reset, format, type, values), (F, ";")); + DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixfARB(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble * m) { - DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, ";")); + DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixdARB(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) { - DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, ";")); + DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);\n", value, invert)); } -KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(__unused413)(void) { - DISPATCH(GetMinmax, (target, reset, format, types, values), (F, ";")); + DISPATCH(__unused413, (), (F, "gl__unused413();\n")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) { - DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, ";")); + DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) { - DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, ";")); + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) { - DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, ";")); + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) { - DISPATCH(Histogram, (target, width, internalformat, sink), (F, ";")); + DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) { - DISPATCH(Minmax, (target, internalformat, sink), (F, ";")); + DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) { - DISPATCH(ResetMinmax, (target), (F, ";")); + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img) { - DISPATCH(ResetHistogram, (target), (F, ";")); + DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImageARB(0x%x, %d, %p);\n", target, level, (void *) img)); } -KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) +KEYWORD1 void KEYWORD2 NAME(ActiveTexture)(GLenum texture) { - DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, ";")); + DISPATCH(ActiveTextureARB, (texture), (F, "glActiveTexture(0x%x);\n", texture)); } -/*** - *** Extension functions - ***/ +KEYWORD1 void KEYWORD2 NAME(ClientActiveTexture)(GLenum texture) +{ + DISPATCH(ClientActiveTextureARB, (texture), (F, "glClientActiveTexture(0x%x);\n", texture)); +} -/* 2. GL_EXT_blend_color */ -KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1d)(GLenum target, GLdouble s) { - DISPATCH(BlendColor, (red, green, blue, alpha), (F, ";")); + DISPATCH(MultiTexCoord1dARB, (target, s), (F, "glMultiTexCoord1d(0x%x, %f);\n", target, s)); } -/* 3. GL_EXT_polygon_offset */ -KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dv)(GLenum target, const GLdouble * v) { - DISPATCH(PolygonOffsetEXT, (factor, bias), (F, ";")); + DISPATCH(MultiTexCoord1dvARB, (target, v), (F, "glMultiTexCoord1dv(0x%x, %p);\n", target, (void *) v)); } -/* 6. GL_EXT_texture3D */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1f)(GLenum target, GLfloat s) +{ + DISPATCH(MultiTexCoord1fARB, (target, s), (F, "glMultiTexCoord1f(0x%x, %f);\n", target, s)); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fv)(GLenum target, const GLfloat * v) { - DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, ";")); + DISPATCH(MultiTexCoord1fvARB, (target, v), (F, "glMultiTexCoord1fv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1i)(GLenum target, GLint s) { - DISPATCH(TexImage3D, (target, level, internalFormat, width, height, depth, border, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord1iARB, (target, s), (F, "glMultiTexCoord1i(0x%x, %d);\n", target, s)); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iv)(GLenum target, const GLint * v) { - DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord1ivARB, (target, v), (F, "glMultiTexCoord1iv(0x%x, %p);\n", target, (void *) v)); } -/* 7. GL_SGI_texture_filter4 */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1s)(GLenum target, GLshort s) +{ + DISPATCH(MultiTexCoord1sARB, (target, s), (F, "glMultiTexCoord1s(0x%x, %d);\n", target, s)); +} -KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat *weights) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sv)(GLenum target, const GLshort * v) { - DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, ";")); + DISPATCH(MultiTexCoord1svARB, (target, v), (F, "glMultiTexCoord1sv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat *weights) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t) { - DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, ";")); + DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, "glMultiTexCoord2d(0x%x, %f, %f);\n", target, s, t)); } -/* 9. GL_EXT_subtexture */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dv)(GLenum target, const GLdouble * v) +{ + DISPATCH(MultiTexCoord2dvARB, (target, v), (F, "glMultiTexCoord2dv(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t) { - DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, ";")); + DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, "glMultiTexCoord2f(0x%x, %f, %f);\n", target, s, t)); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fv)(GLenum target, const GLfloat * v) { - DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord2fvARB, (target, v), (F, "glMultiTexCoord2fv(0x%x, %p /* %g, %g */);\n", target, (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2i)(GLenum target, GLint s, GLint t) { - DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, ";")); + DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, "glMultiTexCoord2i(0x%x, %d, %d);\n", target, s, t)); } -/* 10. GL_EXT_copy_texture */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iv)(GLenum target, const GLint * v) +{ + DISPATCH(MultiTexCoord2ivARB, (target, v), (F, "glMultiTexCoord2iv(0x%x, %p);\n", target, (void *) v)); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t) { - DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, ";")); + DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, "glMultiTexCoord2s(0x%x, %d, %d);\n", target, s, t)); } -KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sv)(GLenum target, const GLshort * v) { - DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, ";")); + DISPATCH(MultiTexCoord2svARB, (target, v), (F, "glMultiTexCoord2sv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r) { - DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, ";")); + DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, "glMultiTexCoord3d(0x%x, %f, %f, %f);\n", target, s, t, r)); } -/* 11. GL_EXT_histogram */ -KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dv)(GLenum target, const GLdouble * v) { - DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, ";")); + DISPATCH(MultiTexCoord3dvARB, (target, v), (F, "glMultiTexCoord3dv(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r) { - DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, "glMultiTexCoord3f(0x%x, %f, %f, %f);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fv)(GLenum target, const GLfloat * v) { - DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3fvARB, (target, v), (F, "glMultiTexCoord3fv(0x%x, %p /* %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r) { - DISPATCH(GetMinmaxEXT, (target, reset, format, types, values), (F, ";")); + DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, "glMultiTexCoord3i(0x%x, %d, %d, %d);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iv)(GLenum target, const GLint * v) { - DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3ivARB, (target, v), (F, "glMultiTexCoord3iv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r) { - DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, "glMultiTexCoord3s(0x%x, %d, %d, %d);\n", target, s, t, r)); } -KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sv)(GLenum target, const GLshort * v) { - DISPATCH(Histogram, (target, width, internalformat, sink), (F, ";")); + DISPATCH(MultiTexCoord3svARB, (target, v), (F, "glMultiTexCoord3sv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) { - DISPATCH(Minmax, (target, internalformat, sink), (F, ";")); + DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, "glMultiTexCoord4d(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dv)(GLenum target, const GLdouble * v) { - DISPATCH(ResetHistogram, (target), (F, ";")); + DISPATCH(MultiTexCoord4dvARB, (target, v), (F, "glMultiTexCoord4dv(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - DISPATCH(ResetMinmax, (target), (F, ";")); + DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, "glMultiTexCoord4f(0x%x, %f, %f, %f, %f);\n", target, s, t, r, q)); } -/* 12. GL_EXT_convolution */ +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fv)(GLenum target, const GLfloat * v) +{ + DISPATCH(MultiTexCoord4fvARB, (target, v), (F, "glMultiTexCoord4fv(0x%x, %p /* %g, %g, %g, %g */);\n", target, (void *) v, v[0], v[1], v[2], v[3])); +} -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q) { - DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, ";")); + DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, "glMultiTexCoord4i(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iv)(GLenum target, const GLint * v) { - DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, ";")); + DISPATCH(MultiTexCoord4ivARB, (target, v), (F, "glMultiTexCoord4iv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) { - DISPATCH(ConvolutionParameterf, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, "glMultiTexCoord4s(0x%x, %d, %d, %d, %d);\n", target, s, t, r, q)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sv)(GLenum target, const GLshort * v) { - DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, ";")); + DISPATCH(MultiTexCoord4svARB, (target, v), (F, "glMultiTexCoord4sv(0x%x, %p);\n", target, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixf)(const GLfloat * m) { - DISPATCH(ConvolutionParameteri, (target, pname, params), (F, ";")); + DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixf(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble * m) { - DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, ";")); + DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixd(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixf)(const GLfloat * m) { - DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, ";")); + DISPATCH(MultTransposeMatrixfARB, (m), (F, "glMultTransposeMatrixf(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixd)(const GLdouble * m) { - DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, ";")); + DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixd(%p);\n", (void *) m)); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(SampleCoverage)(GLclampf value, GLboolean invert) { - DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, ";")); + DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverage(%f, %d);\n", value, invert)); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data) { - DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3D(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, depth, border, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data) { - DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2D(0x%x, %d, 0x%x, %d, %d, %d, %d, %p);\n", target, level, internalformat, width, height, border, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data) { - DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, ";")); + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1D(0x%x, %d, 0x%x, %d, %d, %d, %p);\n", target, level, internalformat, width, border, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data) { - DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, ";")); + DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3D(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, (void *) data)); } -/* 14. GL_SGI_color_table */ +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data) +{ + DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2D(0x%x, %d, %d, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, yoffset, width, height, format, imageSize, (void *) data)); +} -KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data) { - DISPATCH(ColorTableParameterfv, (target, pname, params), (F, ";")); + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1D(0x%x, %d, %d, %d, 0x%x, %d, %p);\n", target, level, xoffset, width, format, imageSize, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImage)(GLenum target, GLint level, GLvoid * img) { - DISPATCH(ColorTableParameteriv, (target, pname, params), (F, ";")); + DISPATCH(GetCompressedTexImageARB, (target, level, img), (F, "glGetCompressedTexImage(0x%x, %d, %p);\n", target, level, (void *) img)); } -KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +/* No dispatch for WeightbvARB() */ +/* No dispatch for WeightsvARB() */ +/* No dispatch for WeightivARB() */ +/* No dispatch for WeightfvARB() */ +/* No dispatch for WeightdvARB() */ +/* No dispatch for WeightubvARB() */ +/* No dispatch for WeightusvARB() */ +/* No dispatch for WeightuivARB() */ +/* No dispatch for WeightPointerARB() */ +/* No dispatch for VertexBlendARB() */ +/* No dispatch for CurrentPaletteMatrixARB() */ +/* No dispatch for MatrixIndexubvARB() */ +/* No dispatch for MatrixIndexusvARB() */ +/* No dispatch for MatrixIndexuivARB() */ +/* No dispatch for MatrixIndexPointerARB() */ +KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); + DISPATCH(BlendColor, (red, green, blue, alpha), (F, "glBlendColorEXT(%f, %f, %f, %f);\n", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) { - DISPATCH(CopyColorTable, (target, internalFormat, x, y, width), (F, ";")); + DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(GetColorTableSGI, (target, format, type, table), (F, ";")); + DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, "glTexImage3DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, border, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat *params) + +KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, ";")); + DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, "glTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat * weights) { - DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, ";")); + DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, "glGetTexFilterFuncSGIS(0x%x, 0x%x, %p);\n", target, filter, (void *) weights)); } -/* ??. GL_SGIX_pixel_texture */ +KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat * weights) +{ + DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, "glTexFilterFuncSGIS(0x%x, 0x%x, %d, %p);\n", target, filter, n, (void *) weights)); +} -KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(PixelTexGenSGIX, (mode), (F, ";")); + DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, "glTexSubImage1DEXT(0x%x, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, width, format, type, (void *) pixels)); } -/* 15. GL_SGIS_pixel_texture */ +KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels) +{ + DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, "glTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, width, height, format, type, (void *) pixels)); +} -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum target, GLfloat value) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { - DISPATCH(PixelTexGenParameterfSGIS, (target, value), (F, ";")); + DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, "glCopyTexImage1DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, border)); } -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum target, const GLfloat *value) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - DISPATCH(PixelTexGenParameterfvSGIS, (target, value), (F, ";")); + DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, "glCopyTexImage2DEXT(0x%x, %d, 0x%x, %d, %d, %d, %d, %d);\n", target, level, internalformat, x, y, width, height, border)); } -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum target, GLint value) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { - DISPATCH(PixelTexGenParameteriSGIS, (target, value), (F, ";")); + DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, "glCopyTexSubImage1DEXT(0x%x, %d, %d, %d, %d, %d);\n", target, level, xoffset, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum target, const GLint *value) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(PixelTexGenParameterivSGIS, (target, value), (F, ";")); + DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, "glCopyTexSubImage2DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum target, GLfloat *value) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(GetPixelTexGenParameterfvSGIS, (target, value), (F, ";")); + DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, "glCopyTexSubImage3DEXT(0x%x, %d, %d, %d, %d, %d, %d, %d, %d);\n", target, level, xoffset, yoffset, zoffset, x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum target, GLint *value) +KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { - DISPATCH(GetPixelTexGenParameterivSGIS, (target, value), (F, ";")); + DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, "glGetHistogramEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); } -/* 16. GL_SGIS_texture4D */ +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, "glGetHistogramParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); +} -KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(TexImage4DSGIS, (target, level, internalFormat, width, height, depth, extent, border, format, type, pixels), (F, ";")); + DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, "glGetHistogramParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values) { - DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, extent, format, type, pixels), (F, ";")); + DISPATCH(GetMinmaxEXT, (target, reset, format, type, values), (F, "glGetMinmaxEXT(0x%x, %d, 0x%x, 0x%x, %p);\n", target, reset, format, type, (void *) values)); } -/* 20. GL_EXT_texture_object */ +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) +{ + DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, "glGetMinmaxParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); +} -KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint *textures) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(GenTextures, (n, textures), (F, ";")); + DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, "glGetMinmaxParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint *texture) +KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) { - DISPATCH(DeleteTextures, (n, texture), (F, ";")); + DISPATCH(Histogram, (target, width, internalformat, sink), (F, "glHistogramEXT(0x%x, %d, 0x%x, %d);\n", target, width, internalformat, sink)); } -KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) +KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) { - DISPATCH(BindTexture, (target, texture), (F, ";")); + DISPATCH(Minmax, (target, internalformat, sink), (F, "glMinmaxEXT(0x%x, 0x%x, %d);\n", target, internalformat, sink)); } -KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint *textures, const GLclampf *priorities) +KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) { - DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, ";")); + DISPATCH(ResetHistogram, (target), (F, "glResetHistogramEXT(0x%x);\n", target)); } -KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint *textures, GLboolean *residences) +KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) { - RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d %p %p);", n, (void *) textures, (void *) residences)); + DISPATCH(ResetMinmax, (target), (F, "glResetMinmaxEXT(0x%x);\n", target)); } -KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image) { - RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTextureEXT(%u);", texture)); + DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, "glConvolutionFilter1DEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) image)); } -/* 21. GL_SGIS_detail_texture */ +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image) +{ + DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, "glConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, height, format, type, (void *) image)); +} -KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) { - DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, ";")); + DISPATCH(ConvolutionParameterf, (target, pname, params), (F, "glConvolutionParameterfEXT(0x%x, 0x%x, %f);\n", target, pname, params)); } -KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat * params) { - DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, ";")); + DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, "glConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -/* 22. GL_SGIS_sharpen_texture */ +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) +{ + DISPATCH(ConvolutionParameteri, (target, pname, params), (F, "glConvolutionParameteriEXT(0x%x, 0x%x, %d);\n", target, pname, params)); +} -KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint * params) { - DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, ";")); + DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, "glConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, ";")); + DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, "glCopyConvolutionFilter1DEXT(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } -/* 25. GL_SGIS_multisample */ +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, "glCopyConvolutionFilter2DEXT(0x%x, 0x%x, %d, %d, %d, %d);\n", target, internalformat, x, y, width, height)); +} -KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * image) { - DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); + DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, "glGetConvolutionFilterEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) image)); } -KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); + DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, "glGetConvolutionParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -/* 30. GL_EXT_vertex_array */ +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint * params) +{ + DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, "glGetConvolutionParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); +} -KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span) { - DISPATCH(VertexPointerEXT, (size, type, stride, count, ptr), (F, ";")); + DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, "glGetSeparableFilterEXT(0x%x, 0x%x, 0x%x, %p, %p, %p);\n", target, format, type, (void *) row, (void *) column, (void *) span)); } -KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column) { - DISPATCH(NormalPointerEXT, (type, stride, count, ptr), (F, ";")); + DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, "glSeparableFilter2DEXT(0x%x, 0x%x, %d, %d, 0x%x, 0x%x, %p, %p);\n", target, internalformat, width, height, format, type, (void *) row, (void *) column)); } -KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) { - DISPATCH(ColorPointerEXT, (size, type, stride, count, ptr), (F, ";")); + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, "glColorTableSGI(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalformat, width, format, type, (void *) table)); } -KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat * params) { - DISPATCH(IndexPointerEXT, (type, stride, count, ptr), (F, ";")); + DISPATCH(ColorTableParameterfv, (target, pname, params), (F, "glColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint * params) { - DISPATCH(ColorPointerEXT, (size, type, stride, count, ptr), (F, ";")); + DISPATCH(ColorTableParameteriv, (target, pname, params), (F, "glColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *ptr) +KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - DISPATCH(EdgeFlagPointerEXT, (stride, count, ptr), (F, ";")); + DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, "glCopyColorTableSGI(0x%x, 0x%x, %d, %d, %d);\n", target, internalformat, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, void **params) +KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid * table) { - DISPATCH(GetPointerv, (pname, params), (F, ";")); + DISPATCH(GetColorTableSGI, (target, format, type, table), (F, "glGetColorTableSGI(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) table)); } -KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(DrawArrays, (mode, first, count), (F, ";")); + DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, "glGetColorTableParameterfvSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -/* 37. GL_EXT_blend_minmax */ -KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);", mode)); + DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, "glGetColorTableParameterivSGI(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -/* 52. GL_SGIX_sprite */ +KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) +{ + DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); +} -KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum pname, GLint param) { - DISPATCH(SpriteParameterfSGIX, (pname, param), (F, ";")); + DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params) { - DISPATCH(SpriteParameterfvSGIX, (pname, param), (F, ";")); + DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param) { - DISPATCH(SpriteParameteriSGIX, (pname, param), (F, ";")); + DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params) { - DISPATCH(SpriteParameterivSGIX, (pname, param), (F, ";")); + DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (void *) params)); } -/* 54. GL_EXT_point_parameters */ +KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params) +{ + DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (void *) params)); +} -KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum target, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params) { - DISPATCH(PointParameterfEXT, (target, param), (F, ";")); + DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum target, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); + DISPATCH(TexImage4DSGIS, (target, level, internalformat, width, height, depth, size4d, border, format, type, pixels), (F, "glTexImage4DSGIS(0x%x, %d, 0x%x, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, internalformat, width, height, depth, size4d, border, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum target, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels) { - DISPATCH(PointParameterfEXT, (target, param), (F, ";")); + DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels), (F, "glTexSubImage4DSGIS(0x%x, %d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x, 0x%x, %p);\n", target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, (void *) pixels)); } -KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum target, const GLfloat *param) +KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint * textures, GLboolean * residences) { - DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); + RETURN_DISPATCH(AreTexturesResidentEXT, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d, %p, %p);\n", n, (void *) textures, (void *) residences)); } -/* 55. GL_SGIX_instruments */ -KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) { - RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, ";")); + DISPATCH(BindTexture, (target, texture), (F, "glBindTextureEXT(0x%x, %d);\n", target, texture)); } -KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint *buf) +KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint * textures) { - DISPATCH(InstrumentsBufferSGIX, (size, buf), (F, ";")); + DISPATCH(DeleteTextures, (n, textures), (F, "glDeleteTexturesEXT(%d, %p);\n", n, (void *) textures)); } -KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint *markerp) +KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint * textures) { - RETURN_DISPATCH(PollInstrumentsSGIX, (markerp), (F, ";")); + DISPATCH(GenTexturesEXT, (n, textures), (F, "glGenTexturesEXT(%d, %p);\n", n, (void *) textures)); } -KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) +KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) { - DISPATCH(ReadInstrumentsSGIX, (marker), (F, ";")); + RETURN_DISPATCH(IsTextureEXT, (texture), (F, "glIsTextureEXT(%d);\n", texture)); } -KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint * textures, const GLclampf * priorities) { - DISPATCH(StartInstrumentsSGIX, (), (F, ";")); + DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, "glPrioritizeTexturesEXT(%d, %p, %p);\n", n, (void *) textures, (void *) priorities)); } -KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) +KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) { - DISPATCH(StopInstrumentsSGIX, (marker), (F, ";")); + DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, "glDetailTexFuncSGIS(0x%x, %d, %p);\n", target, n, (void *) points)); } -/* 57. GL_SGIX_framezoom */ -KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) +KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat * points) { - DISPATCH(FrameZoomSGIX, (factor), (F, ";")); + DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, "glGetDetailTexFuncSGIS(0x%x, %p);\n", target, (void *) points)); } -/* 58. GL_SGIX_tag_sample_buffer */ -KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat * points) { - DISPATCH(TagSampleBufferSGIX, (), (F, ";")); + DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, "glSharpenTexFuncSGIS(0x%x, %d, %p);\n", target, n, (void *) points)); } -/* 60. GL_SGIX_reference_plane */ -KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble *plane) +KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat * points) { - DISPATCH(ReferencePlaneSGIX, (plane), (F, ";")); + DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, "glGetSharpenTexFuncSGIS(0x%x, %p);\n", target, (void *) points)); } -/* 61. GL_SGIX_flush_raster */ -KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) { - DISPATCH(FlushRasterSGIX, (), (F, ";")); + DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); } -/* 66. GL_HP_image_transform */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(GetImageTransformParameterfvHP)(GLenum target, GLenum pname, GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) { - DISPATCH(GetImageTransformParameterfvHP, (target, pname, param), (F, ";")); + DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); } -KEYWORD1 void KEYWORD2 NAME(GetImageTransformParameterivHP)(GLenum target, GLenum pname, GLint *param) +KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) { - DISPATCH(GetImageTransformParameterivHP, (target, pname, param), (F, ";")); + DISPATCH(ArrayElement, (i), (F, "glArrayElementEXT(%d);\n", i)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterfHP)(GLenum target, GLenum pname, const GLfloat param) +KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { - DISPATCH(ImageTransformParameterfHP, (target, pname, param), (F, ";")); + DISPATCH(ColorPointerEXT, (size, type, stride, count, pointer), (F, "glColorPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterfvHP)(GLenum target, GLenum pname, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) { - DISPATCH(ImageTransformParameterfvHP, (target, pname, param), (F, ";")); + DISPATCH(DrawArrays, (mode, first, count), (F, "glDrawArraysEXT(0x%x, %d, %d);\n", mode, first, count)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameteriHP)(GLenum target, GLenum pname, const GLint param) +KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer) { - DISPATCH(ImageTransformParameteriHP, (target, pname, param), (F, ";")); + DISPATCH(EdgeFlagPointerEXT, (stride, count, pointer), (F, "glEdgeFlagPointerEXT(%d, %d, %p);\n", stride, count, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterivHP)(GLenum target, GLenum pname, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, GLvoid ** params) { - DISPATCH(ImageTransformParameterivHP, (target, pname, param), (F, ";")); + DISPATCH(GetPointerv, (pname, params), (F, "glGetPointervEXT(0x%x, %p);\n", pname, (void *) params)); } -#endif -/* 74. GL_EXT_color_subtable */ -KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data) +KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { - DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, ";")); + DISPATCH(IndexPointerEXT, (type, stride, count, pointer), (F, "glIndexPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { - DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, ";")); + DISPATCH(NormalPointerEXT, (type, stride, count, pointer), (F, "glNormalPointerEXT(0x%x, %d, %d, %p);\n", type, stride, count, (void *) pointer)); } -/* 77. GL_PGI_misc_hints */ -KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) +KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) { - DISPATCH(HintPGI, (target, mode), (F, ";")); + DISPATCH(TexCoordPointerEXT, (size, type, stride, count, pointer), (F, "glTexCoordPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (void *) pointer)); } -/* 78. GL_EXT_paletted_texture */ +KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer) +{ + DISPATCH(VertexPointerEXT, (size, type, stride, count, pointer), (F, "glVertexPointerEXT(%d, 0x%x, %d, %d, %p);\n", size, type, stride, count, (void *) pointer)); +} -KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) { - DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); + DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);\n", mode)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) { - DISPATCH(GetColorTableEXT, (target, format, type, table), (F, ";")); + DISPATCH(SpriteParameterfSGIX, (pname, param), (F, "glSpriteParameterfSGIX(0x%x, %f);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat * params) { - DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(SpriteParameterfvSGIX, (pname, params), (F, "glSpriteParameterfvSGIX(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) { - DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(SpriteParameteriSGIX, (pname, param), (F, "glSpriteParameteriSGIX(0x%x, %d);\n", pname, param)); } -/* 80. GL_SGIX_list_priority */ +KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint * params) +{ + DISPATCH(SpriteParameterivSGIX, (pname, params), (F, "glSpriteParameterivSGIX(0x%x, %p);\n", pname, (void *) params)); +} -KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum name, GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) { - DISPATCH(GetListParameterfvSGIX, (list, name, param), (F, ";")); + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum name, GLint *param) +KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * params) { - DISPATCH(GetListParameterivSGIX, (list, name, param), (F, ";")); + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum name, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(PointParameterfARB)(GLenum pname, GLfloat param) { - DISPATCH(ListParameterfSGIX, (list, name, param), (F, ";")); + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfARB(0x%x, %f);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum name, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(PointParameterfvARB)(GLenum pname, const GLfloat * params) { - DISPATCH(ListParameterfvSGIX, (list, name, param), (F, ";")); + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvARB(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum name, GLint param) +KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum pname, GLfloat param) { - DISPATCH(ListParameteriSGIX, (list, name, param), (F, ";")); + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum name, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum pname, const GLfloat * params) { - DISPATCH(ListParameterivSGIX, (list, name, param), (F, ";")); + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (void *) params)); } -/* 94. GL_EXT_index_material */ -KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) +KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) { - DISPATCH(IndexMaterialEXT, (face, mode), (F, ";")); + RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, "glGetInstrumentsSGIX();\n")); } -/* 95. GL_EXT_index_func */ -KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLfloat ref) +KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint * buffer) { - DISPATCH(IndexFuncEXT, (func, ref), (F, ";")); + DISPATCH(InstrumentsBufferSGIX, (size, buffer), (F, "glInstrumentsBufferSGIX(%d, %p);\n", size, (void *) buffer)); } -/* 97. GL_EXT_compiled_vertex_array */ -KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) +KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint * marker_p) { - DISPATCH(LockArraysEXT, (first, count), (F, ";")); + RETURN_DISPATCH(PollInstrumentsSGIX, (marker_p), (F, "glPollInstrumentsSGIX(%p);\n", (void *) marker_p)); } -KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) +KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) { - DISPATCH(UnlockArraysEXT, (), (F, ";")); + DISPATCH(ReadInstrumentsSGIX, (marker), (F, "glReadInstrumentsSGIX(%d);\n", marker)); } -/* 98. GL_EXT_cull_vertex */ -KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) { - DISPATCH(CullParameterfvEXT, (pname, params), (F, ";")); + DISPATCH(StartInstrumentsSGIX, (), (F, "glStartInstrumentsSGIX();\n")); } -KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble *params) +KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) { - DISPATCH(CullParameterdvEXT, (pname, params), (F, ";")); + DISPATCH(StopInstrumentsSGIX, (marker), (F, "glStopInstrumentsSGIX(%d);\n", marker)); } -/* 102. GL_SGIX_fragment_lighting */ -KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) { - DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, ";")); + DISPATCH(FrameZoomSGIX, (factor), (F, "glFrameZoomSGIX(%d);\n", factor)); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) { - DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, ";")); + DISPATCH(TagSampleBufferSGIX, (), (F, "glTagSampleBufferSGIX();\n")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) +/* No dispatch for DeformationMap3dSGIX() */ +/* No dispatch for DeformationMap3fSGIX() */ +/* No dispatch for DeformSGIX() */ +/* No dispatch for LoadIdentityDeformationMapSGIX() */ +KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble * equation) { - DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, ";")); + DISPATCH(ReferencePlaneSGIX, (equation), (F, "glReferencePlaneSGIX(%p);\n", (void *) equation)); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) { - DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, ";")); + DISPATCH(FlushRasterSGIX, (), (F, "glFlushRasterSGIX();\n")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) +/* No dispatch for FogFuncSGIS() */ +/* No dispatch for GetFogFuncSGIS() */ +/* No dispatch for ImageTransformParameteriHP() */ +/* No dispatch for ImageTransformParameterfHP() */ +/* No dispatch for ImageTransformParameterivHP() */ +/* No dispatch for ImageTransformParameterfvHP() */ +/* No dispatch for GetImageTransformParameterivHP() */ +/* No dispatch for GetImageTransformParameterfvHP() */ +KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data) { - DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, ";")); + DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, "glColorSubTableEXT(0x%x, %d, %d, 0x%x, 0x%x, %p);\n", target, start, count, format, type, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { - DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, ";")); + DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, "glCopyColorSubTableEXT(0x%x, %d, %d, %d, %d);\n", target, start, x, y, width)); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) { - DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, ";")); + DISPATCH(HintPGI, (target, mode), (F, "glHintPGI(0x%x, %d);\n", target, mode)); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid * table) { - DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, ";")); + DISPATCH(ColorTable, (target, internalFormat, width, format, type, table), (F, "glColorTableEXT(0x%x, 0x%x, %d, 0x%x, 0x%x, %p);\n", target, internalFormat, width, format, type, (void *) table)); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) +KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data) { - DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, ";")); + DISPATCH(GetColorTableEXT, (target, format, type, data), (F, "glGetColorTableEXT(0x%x, 0x%x, 0x%x, %p);\n", target, format, type, (void *) data)); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params) { - DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, ";")); + DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, "glGetColorTableParameterivEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params) { - DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, ";")); + DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, "glGetColorTableParameterfvEXT(0x%x, 0x%x, %p);\n", target, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum pname, GLfloat * params) { - DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, ";")); + DISPATCH(GetListParameterfvSGIX, (list, pname, params), (F, "glGetListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) +KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum pname, GLint * params) { - DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, ";")); + DISPATCH(GetListParameterivSGIX, (list, pname, params), (F, "glGetListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum pname, GLfloat param) { - DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, ";")); + DISPATCH(ListParameterfSGIX, (list, pname, param), (F, "glListParameterfSGIX(%d, 0x%x, %f);\n", list, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum pname, const GLfloat * params) { - DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, ";")); + DISPATCH(ListParameterfvSGIX, (list, pname, params), (F, "glListParameterfvSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum pname, GLint param) { - DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, ";")); + DISPATCH(ListParameteriSGIX, (list, pname, param), (F, "glListParameteriSGIX(%d, 0x%x, %d);\n", list, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum pname, const GLint * params) { - DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, ";")); + DISPATCH(ListParameterivSGIX, (list, pname, params), (F, "glListParameterivSGIX(%d, 0x%x, %p);\n", list, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) { - DISPATCH(LightEnviSGIX, (pname, param), (F, ";")); + DISPATCH(IndexMaterialEXT, (face, mode), (F, "glIndexMaterialEXT(0x%x, 0x%x);\n", face, mode)); } -/* 112. GL_EXT_draw_range_elements */ -KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLclampf ref) { - DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %u %u %d 0x%x %p);", mode, start, end, count, type, (void *) indices)); + DISPATCH(IndexFuncEXT, (func, ref), (F, "glIndexFuncEXT(0x%x, %f);\n", func, ref)); } -/* 117. GL_EXT_light_texture */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(ApplyTextureEXT)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) { - DISPATCH(ApplyTextureEXT, (mode), (F, "glApplyTextureEXT(0x%x);", mode)); + DISPATCH(LockArraysEXT, (first, count), (F, "glLockArraysEXT(%d, %d);\n", first, count)); } -KEYWORD1 void KEYWORD2 NAME(TextureLightEXT)(GLenum pname) +KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) { - DISPATCH(TextureLightEXT, (pname), (F, "glTextureLightEXT(0x%x);", pname)); + DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); } -KEYWORD1 void KEYWORD2 NAME(TextureMaterialEXT)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble * params) { - DISPATCH(TextureMaterialEXT, (face, mode), (F, "glTextureMaterialEXT(0x%x, 0x%x);", face, mode)); + DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (void *) params)); } -#endif -/* 135. GL_INTEL_texture_scissor */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(TexScissorINTEL)(GLenum target, GLclampf tlow, GLclampf thigh) +KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat * params) { - DISPATCH(TexScissorINTEL, (target, tlow, thigh), (F, "glTexScissorINTEL(0x%x %g %g);", target, tlow, thigh)); + DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(TexScissorFuncINTEL)(GLenum target, GLenum lfunc, GLenum hfunc) +KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) { - DISPATCH(TexScissorFuncINTEL, (target, lfunc, hfunc), (F, "glTexScissorFuncINTEL(0x%x 0x%x 0x%x);", target, tlow, thigh)); + DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, "glFragmentColorMaterialSGIX(0x%x, 0x%x);\n", face, mode)); } -#endif -/* 136. GL_INTEL_parallel_arrays */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(VertexPointervINTEL)(GLint size, GLenum type, const void ** pointer) +KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) { - DISPATCH(VertexPointervINTEL, (size, type, pointer), (F, "glVertexPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); + DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, "glFragmentLightfSGIX(0x%x, 0x%x, %f);\n", light, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(NormalPointervINTEL)(GLenum type, const void** pointer) +KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) { - DISPATCH(NormalPointervINTEL, (size, pointer), (F, "glNormalPointervINTEL(%d, %p);", size, pointer)); + DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, "glFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(ColorPointervINTEL)(GLint size, GLenum type, const void** pointer) +KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) { - DISPATCH(ColorPointervINTEL, (size, type, pointer), (F, "glColorPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); + DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, "glFragmentLightiSGIX(0x%x, 0x%x, %d);\n", light, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(TexCoordPointervINTEL)(GLint size, GLenum type, const void** pointer) +KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) { - DISPATCH(TexCoordPointervINTEL, (size, type, pointer), (F, "glTexCoordPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); + DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, "glFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) +{ + DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, "glFragmentLightModelfSGIX(0x%x, %f);\n", pname, param)); } -#endif -/* 138. GL_EXT_pixel_transform */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameteriEXT)(GLenum target, GLenum pname, const GLint param) +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) { - DISPATCH(PixelTransformParameteriEXT, (target, pname, param), (F, "glPixelTransformParameteriEXT(0x%x, 0x%x, %d);", target, pname, param)); + DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, "glFragmentLightModelfvSGIX(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfEXT)(GLenum target, GLenum pname, const GLfloat param) +KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) { - DISPATCH(PixelTransformParameterfEXT, (target, pname, param), (F, "glPixelTransformParameterfEXT(0x%x, 0x%x, %f);", target, pname, param)); + DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, "glFragmentLightModeliSGIX(0x%x, %d);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) { - DISPATCH(PixelTransformParameterivEXT, (target, pname, params), (F, "glPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, "glFragmentLightModelivSGIX(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) { - DISPATCH(PixelTransformParameterfvEXT, (target, pname, params), (F, "glPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, "glFragmentMaterialfSGIX(0x%x, 0x%x, %f);\n", face, pname, param)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) { - DISPATCH(GetPixelTransformParameterivEXT, (target, pname, params), (F, "glGetPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, "glFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) { - DISPATCH(GetPixelTransformParameterfvEXT, (target, pname, params), (F, "glGetPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, "glFragmentMaterialiSGIX(0x%x, 0x%x, %d);\n", face, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) +{ + DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, "glFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) +{ + DISPATCH(GetFragmentLightfvSGIX, (light, pname, params), (F, "glGetFragmentLightfvSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) +{ + DISPATCH(GetFragmentLightivSGIX, (light, pname, params), (F, "glGetFragmentLightivSGIX(0x%x, 0x%x, %p);\n", light, pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) +{ + DISPATCH(GetFragmentMaterialfvSGIX, (face, pname, params), (F, "glGetFragmentMaterialfvSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) +{ + DISPATCH(GetFragmentMaterialivSGIX, (face, pname, params), (F, "glGetFragmentMaterialivSGIX(0x%x, 0x%x, %p);\n", face, pname, (void *) params)); } -#endif -/* 145. GL_EXT_secondary_color */ +KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) +{ + DISPATCH(LightEnviSGIX, (pname, param), (F, "glLightEnviSGIX(0x%x, %d);\n", pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices) +{ + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %d, %d, %d, 0x%x, %p);\n", mode, start, end, count, type, (void *) indices)); +} +/* No dispatch for ApplyTextureEXT() */ +/* No dispatch for TextureLightEXT() */ +/* No dispatch for TextureMaterialEXT() */ +/* No dispatch for AsyncMarkerSGIX() */ +/* No dispatch for FinishAsyncSGIX() */ +/* No dispatch for PollAsyncSGIX() */ +/* No dispatch for GenAsyncMarkersSGIX() */ +/* No dispatch for DeleteAsyncMarkersSGIX() */ +/* No dispatch for IsAsyncMarkerSGIX() */ +/* No dispatch for VertexPointervINTEL() */ +/* No dispatch for NormalPointervINTEL() */ +/* No dispatch for ColorPointervINTEL() */ +/* No dispatch for TexCoordPointervINTEL() */ +/* No dispatch for PixelTransformParameteriEXT() */ +/* No dispatch for PixelTransformParameterfEXT() */ +/* No dispatch for PixelTransformParameterivEXT() */ +/* No dispatch for PixelTransformParameterfvEXT() */ KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) { - DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte *v) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte * v) { - DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) { - DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%g, %g, %g);", red, green, blue)); + DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v) { - DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%g, %g, %g);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) { - DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%g, %g, %g);", red, green, blue)); + DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%f, %f, %f);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v) { - DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%g, %g, %g);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) { - DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v) { - DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) { - DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v) { - DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) { - DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v) { - DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) { - DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v) { - DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) { - DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);\n", red, green, blue)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v) { - DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);", size, type, stride, pointer)); + DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); } -/* 149. GL_EXT_fog_coord */ +/* No dispatch for TextureNormalEXT() */ +KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) +{ + DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (void *) first, (void *) count, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) +{ + DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElementsEXT(0x%x, %p, 0x%x, %p, %d);\n", mode, (void *) count, type, (void *) indices, primcount)); +} KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) { - DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%g);", coord)); + DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%f);\n", coord)); } -KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat *coord) +KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) { - DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);", (void *) coord)); + DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (void *) coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord) { - DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%g);", coord)); + DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%f);\n", coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord) { - DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);", (void *) coord)); + DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);\n", (void *) coord)); } KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);", type, stride, (void *) pointer)); -} - -/* 173. GL_EXT/INGR_blend_func_separate */ + DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);\n", type, stride, (void *) pointer)); +} + +/* No dispatch for Tangent3bEXT() */ +/* No dispatch for Tangent3bvEXT() */ +/* No dispatch for Tangent3dEXT() */ +/* No dispatch for Tangent3dvEXT() */ +/* No dispatch for Tangent3fEXT() */ +/* No dispatch for Tangent3fvEXT() */ +/* No dispatch for Tangent3iEXT() */ +/* No dispatch for Tangent3ivEXT() */ +/* No dispatch for Tangent3sEXT() */ +/* No dispatch for Tangent3svEXT() */ +/* No dispatch for Binormal3bEXT() */ +/* No dispatch for Binormal3bvEXT() */ +/* No dispatch for Binormal3dEXT() */ +/* No dispatch for Binormal3dvEXT() */ +/* No dispatch for Binormal3fEXT() */ +/* No dispatch for Binormal3fvEXT() */ +/* No dispatch for Binormal3iEXT() */ +/* No dispatch for Binormal3ivEXT() */ +/* No dispatch for Binormal3sEXT() */ +/* No dispatch for Binormal3svEXT() */ +/* No dispatch for TangentPointerEXT() */ +/* No dispatch for BinormalPointerEXT() */ +/* No dispatch for FinishTextureSUNX() */ +/* No dispatch for GlobalAlphaFactorbSUN() */ +/* No dispatch for GlobalAlphaFactorsSUN() */ +/* No dispatch for GlobalAlphaFactoriSUN() */ +/* No dispatch for GlobalAlphaFactorfSUN() */ +/* No dispatch for GlobalAlphaFactordSUN() */ +/* No dispatch for GlobalAlphaFactorubSUN() */ +/* No dispatch for GlobalAlphaFactorusSUN() */ +/* No dispatch for GlobalAlphaFactoruiSUN() */ +/* No dispatch for ReplacementCodeuiSUN() */ +/* No dispatch for ReplacementCodeusSUN() */ +/* No dispatch for ReplacementCodeubSUN() */ +/* No dispatch for ReplacementCodeuivSUN() */ +/* No dispatch for ReplacementCodeusvSUN() */ +/* No dispatch for ReplacementCodeubvSUN() */ +/* No dispatch for ReplacementCodePointerSUN() */ +/* No dispatch for Color4ubVertex2fSUN() */ +/* No dispatch for Color4ubVertex2fvSUN() */ +/* No dispatch for Color4ubVertex3fSUN() */ +/* No dispatch for Color4ubVertex3fvSUN() */ +/* No dispatch for Color3fVertex3fSUN() */ +/* No dispatch for Color3fVertex3fvSUN() */ +/* No dispatch for Normal3fVertex3fSUN() */ +/* No dispatch for Normal3fVertex3fvSUN() */ +/* No dispatch for Color4fNormal3fVertex3fSUN() */ +/* No dispatch for Color4fNormal3fVertex3fvSUN() */ +/* No dispatch for TexCoord2fVertex3fSUN() */ +/* No dispatch for TexCoord2fVertex3fvSUN() */ +/* No dispatch for TexCoord4fVertex4fSUN() */ +/* No dispatch for TexCoord4fVertex4fvSUN() */ +/* No dispatch for TexCoord2fColor4ubVertex3fSUN() */ +/* No dispatch for TexCoord2fColor4ubVertex3fvSUN() */ +/* No dispatch for TexCoord2fColor3fVertex3fSUN() */ +/* No dispatch for TexCoord2fColor3fVertex3fvSUN() */ +/* No dispatch for TexCoord2fNormal3fVertex3fSUN() */ +/* No dispatch for TexCoord2fNormal3fVertex3fvSUN() */ +/* No dispatch for TexCoord2fColor4fNormal3fVertex3fSUN() */ +/* No dispatch for TexCoord2fColor4fNormal3fVertex3fvSUN() */ +/* No dispatch for TexCoord4fColor4fNormal3fVertex4fSUN() */ +/* No dispatch for TexCoord4fColor4fNormal3fVertex4fvSUN() */ +/* No dispatch for ReplacementCodeuiVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiColor4ubVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiColor4ubVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiColor3fVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiColor3fVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiNormal3fVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiNormal3fVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiColor4fNormal3fVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiColor4fNormal3fVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiTexCoord2fVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiTexCoord2fVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN() */ +/* No dispatch for ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN() */ +/* No dispatch for ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN() */ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { - DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, ";")); + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { - DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, ";")); + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) +{ + DISPATCH(VertexWeightfEXT, (weight), (F, "glVertexWeightfEXT(%f);\n", weight)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) +{ + DISPATCH(VertexWeightfvEXT, (weight), (F, "glVertexWeightfvEXT(%p);\n", (void *) weight)); +} + +KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, "glVertexWeightPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); } -/* 190. GL_NV_vertex_array_range */ KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void) { - DISPATCH(FlushVertexArrayRangeNV, (), (F, ";")); + DISPATCH(FlushVertexArrayRangeNV, (), (F, "glFlushVertexArrayRangeNV();\n")); } -KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei size, const GLvoid * pointer) +KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer) { - DISPATCH(VertexArrayRangeNV, (size, pointer), (F, ";")); + DISPATCH(VertexArrayRangeNV, (length, pointer), (F, "glVertexArrayRangeNV(%d, %p);\n", length, (void *) pointer)); } -/* 191. GL_NV_register_combiners */ KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params) { - DISPATCH(CombinerParameterfvNV, (pname, params), (F, ";")); + DISPATCH(CombinerParameterfvNV, (pname, params), (F, "glCombinerParameterfvNV(0x%x, %p);\n", pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param) { - DISPATCH(CombinerParameterfNV, (pname, param), (F, ";")); + DISPATCH(CombinerParameterfNV, (pname, param), (F, "glCombinerParameterfNV(0x%x, %f);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params) { - DISPATCH(CombinerParameterivNV, (pname, params), (F, ";")); + DISPATCH(CombinerParameterivNV, (pname, params), (F, "glCombinerParameterivNV(0x%x, %p);\n", pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param) { - DISPATCH(CombinerParameteriNV, (pname, param), (F, ";")); + DISPATCH(CombinerParameteriNV, (pname, param), (F, "glCombinerParameteriNV(0x%x, %d);\n", pname, param)); } KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) { - DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, ";")); + DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, "glCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);\n", stage, portion, variable, input, mapping, componentUsage)); } KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) { - DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, ";")); + DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, "glCombinerOutputNV(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, %d, %d, %d);\n", stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum)); } KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) { - DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, ";")); + DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, "glFinalCombinerInputNV(0x%x, 0x%x, 0x%x, 0x%x);\n", variable, input, mapping, componentUsage)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params) { - DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, ";")); + DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterfvNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params) { - DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, ";")); + DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, "glGetCombinerInputParameterivNV(0x%x, 0x%x, 0x%x, 0x%x, %p);\n", stage, portion, variable, pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params) { - DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, ";")); + DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterfvNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params) { - DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, ";")); + DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, "glGetCombinerOutputParameterivNV(0x%x, 0x%x, 0x%x, %p);\n", stage, portion, pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params) { -DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, ";")); + DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterfvNV(0x%x, 0x%x, %p);\n", variable, pname, (void *) params)); } KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params) { -DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, ";")); + DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, "glGetFinalCombinerInputParameterivNV(0x%x, 0x%x, %p);\n", variable, pname, (void *) params)); } -/* 194. GL_EXT_vertex_weighting */ -KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) +KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) { - DISPATCH(VertexWeightfEXT, (weight), (F, ";")); + DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();\n")); } -KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) +KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) { - DISPATCH(VertexWeightfvEXT, (weight), (F, ";")); + DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dMESA(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) +KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble * v) { - DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, ";")); + DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dvMESA(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -/* 196. GL_MESA_resize_buffers */ -KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) +KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) { - DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();")); + DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fMESA(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat * v) +{ + DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fvMESA(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); } -/* 197. GL_MESA_window_pos */ KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) { - DISPATCH(WindowPos2iMESA, (x, y), (F, ";")); + DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iMESA(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) +KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint * v) { - DISPATCH(WindowPos2sMESA, (x, y), (F, ";")); + DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2ivMESA(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) +KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) { - DISPATCH(WindowPos2fMESA, (x, y), (F, ";")); + DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sMESA(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) +KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort * v) { - DISPATCH(WindowPos2dMESA, (x, y), (F, ";")); + DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2svMESA(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(WindowPos2ivMESA, (p), (F, ";")); + DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dMESA(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble * v) { - DISPATCH(WindowPos2svMESA, (p), (F, ";")); + DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dvMESA(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(WindowPos2fvMESA, (p), (F, ";")); + DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fMESA(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat * v) { - DISPATCH(WindowPos2dvMESA, (p), (F, ";")); + DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fvMESA(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); } KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z) { - DISPATCH(WindowPos3iMESA, (x, y, z), (F, ";")); + DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iMESA(%d, %d, %d);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) +KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint * v) { - DISPATCH(WindowPos3sMESA, (x, y, z), (F, ";")); + DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3ivMESA(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) { - DISPATCH(WindowPos3fMESA, (x, y, z), (F, ";")); + DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sMESA(%d, %d, %d);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort * v) { - DISPATCH(WindowPos3dMESA, (x, y, z), (F, ";")); + DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3svMESA(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - DISPATCH(WindowPos3ivMESA, (p), (F, ";")); + DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, "glWindowPos4dMESA(%f, %f, %f, %f);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble * v) { - DISPATCH(WindowPos3svMESA, (p), (F, ";")); + DISPATCH(WindowPos4dvMESA, (v), (F, "glWindowPos4dvMESA(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - DISPATCH(WindowPos3fvMESA, (p), (F, ";")); + DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, "glWindowPos4fMESA(%f, %f, %f, %f);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble *p) +KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat * v) { - DISPATCH(WindowPos3dvMESA, (p), (F, ";")); + DISPATCH(WindowPos4fvMESA, (v), (F, "glWindowPos4fvMESA(%p /* %g, %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2], v[3])); } KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) { - DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, ";")); + DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, "glWindowPos4iMESA(%d, %d, %d, %d);\n", x, y, z, w)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint * v) +{ + DISPATCH(WindowPos4ivMESA, (v), (F, "glWindowPos4ivMESA(%p);\n", (void *) v)); } KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) { - DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, ";")); + DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, "glWindowPos4sMESA(%d, %d, %d, %d);\n", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) { - DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, ";")); + DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +/* No dispatch for MultiModeDrawArraysIBM() */ +/* No dispatch for MultiModeDrawElementsIBM() */ +/* No dispatch for ColorPointerListIBM() */ +/* No dispatch for SecondaryColorPointerListIBM() */ +/* No dispatch for EdgeFlagPointerListIBM() */ +/* No dispatch for FogCoordPointerListIBM() */ +/* No dispatch for IndexPointerListIBM() */ +/* No dispatch for NormalPointerListIBM() */ +/* No dispatch for TexCoordPointerListIBM() */ +/* No dispatch for VertexPointerListIBM() */ +KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) { - DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, ";")); + DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(%d);\n", mask)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint *p) +KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) { - DISPATCH(WindowPos4ivMESA, (p), (F, ";")); + DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskEXT(%f, %d);\n", value, invert)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort *p) +KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) { - DISPATCH(WindowPos4svMESA, (p), (F, ";")); + DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternEXT(0x%x);\n", pattern)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat *p) +/* No dispatch for TextureColorMaskSGIS() */ +/* No dispatch for IglooInterfaceSGIX() */ +KEYWORD1 void KEYWORD2 NAME(DeleteFencesNV)(GLsizei n, const GLuint * fences) { - DISPATCH(WindowPos4fvMESA, (p), (F, ";")); + DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (void *) fences)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble *p) +KEYWORD1 void KEYWORD2 NAME(GenFencesNV)(GLsizei n, GLuint * fences) { - DISPATCH(WindowPos4dvMESA, (p), (F, ";")); + DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (void *) fences)); } -/* 208. GL_3DFX_tbuffer */ -KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) +KEYWORD1 GLboolean KEYWORD2 NAME(IsFenceNV)(GLuint fence) { - DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(0x%x);", mask)); + RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); } -/* 209. WGL_EXT_multisample */ +KEYWORD1 GLboolean KEYWORD2 NAME(TestFenceNV)(GLuint fence) +{ + RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); +} -KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) +KEYWORD1 void KEYWORD2 NAME(GetFenceivNV)(GLuint fence, GLenum pname, GLint * params) { - DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); + DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) +KEYWORD1 void KEYWORD2 NAME(FinishFenceNV)(GLuint fence) { - DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); + DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); } -/* ARB 1. GL_ARB_multitexture */ +KEYWORD1 void KEYWORD2 NAME(SetFenceNV)(GLuint fence, GLenum condition) +{ + DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); +} -KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) +/* No dispatch for MapControlPointsNV() */ +/* No dispatch for MapParameterivNV() */ +/* No dispatch for MapParameterfvNV() */ +/* No dispatch for GetMapControlPointsNV() */ +/* No dispatch for GetMapParameterivNV() */ +/* No dispatch for GetMapParameterfvNV() */ +/* No dispatch for GetMapAttribParameterivNV() */ +/* No dispatch for GetMapAttribParameterfvNV() */ +/* No dispatch for EvalMapsNV() */ +/* No dispatch for CombinerStageParameterfvNV() */ +/* No dispatch for GetCombinerStageParameterfvNV() */ +KEYWORD1 void KEYWORD2 NAME(WindowPos2dARB)(GLdouble x, GLdouble y) { - DISPATCH(ActiveTextureARB, (texture), (F, ";")); + DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2dARB(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) +KEYWORD1 void KEYWORD2 NAME(WindowPos2fARB)(GLfloat x, GLfloat y) { - DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); + DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2fARB(%f, %f);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) +KEYWORD1 void KEYWORD2 NAME(WindowPos2iARB)(GLint x, GLint y) { - DISPATCH(MultiTexCoord1dARB, (target, s), (F, ";")); + DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2iARB(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos2sARB)(GLshort x, GLshort y) { - DISPATCH(MultiTexCoord1dvARB, (target, v), (F, ";")); + DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2sARB(%d, %d);\n", x, y)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) +KEYWORD1 void KEYWORD2 NAME(WindowPos2dvARB)(const GLdouble * p) { - DISPATCH(MultiTexCoord1fARB, (target, s), (F, ";")); + DISPATCH(WindowPos2dvMESA, (p), (F, "glWindowPos2dvARB(%p /* %g, %g */);\n", (void *) p, p[0], p[1])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos2fvARB)(const GLfloat * p) { - DISPATCH(MultiTexCoord1fvARB, (target, v), (F, ";")); + DISPATCH(WindowPos2fvMESA, (p), (F, "glWindowPos2fvARB(%p /* %g, %g */);\n", (void *) p, p[0], p[1])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) +KEYWORD1 void KEYWORD2 NAME(WindowPos2ivARB)(const GLint * p) { - DISPATCH(MultiTexCoord1iARB, (target, s), (F, ";")); + DISPATCH(WindowPos2ivMESA, (p), (F, "glWindowPos2ivARB(%p);\n", (void *) p)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos2svARB)(const GLshort * p) { - DISPATCH(MultiTexCoord1ivARB, (target, v), (F, ";")); + DISPATCH(WindowPos2svMESA, (p), (F, "glWindowPos2svARB(%p);\n", (void *) p)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) +KEYWORD1 void KEYWORD2 NAME(WindowPos3dARB)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(MultiTexCoord1sARB, (target, s), (F, ";")); + DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3dARB(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos3fARB)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(MultiTexCoord1svARB, (target, v), (F, ";")); + DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3fARB(%f, %f, %f);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) +KEYWORD1 void KEYWORD2 NAME(WindowPos3iARB)(GLint x, GLint y, GLint z) { - DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, ";")); + DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3iARB(%d, %d, %d);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos3sARB)(GLshort x, GLshort y, GLshort z) { - DISPATCH(MultiTexCoord2dvARB, (target, v), (F, ";")); + DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3sARB(%d, %d, %d);\n", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) +KEYWORD1 void KEYWORD2 NAME(WindowPos3dvARB)(const GLdouble * p) { - DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, ";")); + DISPATCH(WindowPos3dvMESA, (p), (F, "glWindowPos3dvARB(%p /* %g, %g, %g */);\n", (void *) p, p[0], p[1], p[2])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos3fvARB)(const GLfloat * p) { - DISPATCH(MultiTexCoord2fvARB, (target, v), (F, ";")); + DISPATCH(WindowPos3fvMESA, (p), (F, "glWindowPos3fvARB(%p /* %g, %g, %g */);\n", (void *) p, p[0], p[1], p[2])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) +KEYWORD1 void KEYWORD2 NAME(WindowPos3ivARB)(const GLint * p) { - DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, ";")); + DISPATCH(WindowPos3ivMESA, (p), (F, "glWindowPos3ivARB(%p);\n", (void *) p)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(WindowPos3svARB)(const GLshort * p) { - DISPATCH(MultiTexCoord2ivARB, (target, v), (F, ";")); + DISPATCH(WindowPos3svMESA, (p), (F, "glWindowPos3svARB(%p);\n", (void *) p)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) +KEYWORD1 GLboolean KEYWORD2 NAME(AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences) { - DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, ";")); + RETURN_DISPATCH(AreProgramsResidentNV, (n, ids, residences), (F, "glAreProgramsResidentNV(%d, %p, %p);\n", n, (void *) ids, (void *) residences)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(BindProgramNV)(GLenum target, GLuint id) { - DISPATCH(MultiTexCoord2svARB, (target, v), (F, ";")); + DISPATCH(BindProgramNV, (target, id), (F, "glBindProgramNV(0x%x, %d);\n", target, id)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +KEYWORD1 void KEYWORD2 NAME(DeleteProgramsNV)(GLsizei n, const GLuint * ids) { - DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, ";")); + DISPATCH(DeleteProgramsNV, (n, ids), (F, "glDeleteProgramsNV(%d, %p);\n", n, (void *) ids)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params) { - DISPATCH(MultiTexCoord3dvARB, (target, v), (F, ";")); + DISPATCH(ExecuteProgramNV, (target, id, params), (F, "glExecuteProgramNV(0x%x, %d, %p);\n", target, id, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +KEYWORD1 void KEYWORD2 NAME(GenProgramsNV)(GLsizei n, GLuint * ids) { - DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, ";")); + DISPATCH(GenProgramsNV, (n, ids), (F, "glGenProgramsNV(%d, %p);\n", n, (void *) ids)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params) { - DISPATCH(MultiTexCoord3fvARB, (target, v), (F, ";")); + DISPATCH(GetProgramParameterdvNV, (target, index, pname, params), (F, "glGetProgramParameterdvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) +KEYWORD1 void KEYWORD2 NAME(GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params) { - DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, ";")); + DISPATCH(GetProgramParameterfvNV, (target, index, pname, params), (F, "glGetProgramParameterfvNV(0x%x, %d, 0x%x, %p);\n", target, index, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(GetProgramivNV)(GLuint id, GLenum pname, GLint * params) { - DISPATCH(MultiTexCoord3ivARB, (target, v), (F, ";")); + DISPATCH(GetProgramivNV, (id, pname, params), (F, "glGetProgramivNV(%d, 0x%x, %p);\n", id, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) +KEYWORD1 void KEYWORD2 NAME(GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program) { - DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, ";")); + DISPATCH(GetProgramStringNV, (id, pname, program), (F, "glGetProgramStringNV(%d, 0x%x, %p);\n", id, pname, (void *) program)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params) { - DISPATCH(MultiTexCoord3svARB, (target, v), (F, ";")); + DISPATCH(GetTrackMatrixivNV, (target, address, pname, params), (F, "glGetTrackMatrixivNV(0x%x, %d, 0x%x, %p);\n", target, address, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params) { - DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, ";")); + DISPATCH(GetVertexAttribdvNV, (index, pname, params), (F, "glGetVertexAttribdvNV(%d, 0x%x, %p);\n", index, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params) { - DISPATCH(MultiTexCoord4dvARB, (target, v), (F, ";")); + DISPATCH(GetVertexAttribfvNV, (index, pname, params), (F, "glGetVertexAttribfvNV(%d, 0x%x, %p);\n", index, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params) { - DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, ";")); + DISPATCH(GetVertexAttribivNV, (index, pname, params), (F, "glGetVertexAttribivNV(%d, 0x%x, %p);\n", index, pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer) { - DISPATCH(MultiTexCoord4fvARB, (target, v), (F, ";")); + DISPATCH(GetVertexAttribPointervNV, (index, pname, pointer), (F, "glGetVertexAttribPointervNV(%d, 0x%x, %p);\n", index, pname, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) +KEYWORD1 GLboolean KEYWORD2 NAME(IsProgramNV)(GLuint id) { - DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, ";")); + RETURN_DISPATCH(IsProgramNV, (id), (F, "glIsProgramNV(%d);\n", id)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program) { - DISPATCH(MultiTexCoord4ivARB, (target, v), (F, ";")); + DISPATCH(LoadProgramNV, (target, id, len, program), (F, "glLoadProgramNV(0x%x, %d, %d, %p);\n", target, id, len, (void *) program)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dNV)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, ";")); + DISPATCH(ProgramParameter4dNV, (target, index, x, y, z, w), (F, "glProgramParameter4dNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4dvNV)(GLenum target, GLuint index, const GLdouble * params) { - DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); + DISPATCH(ProgramParameter4dvNV, (target, index, params), (F, "glProgramParameter4dvNV(0x%x, %d, %p /* %g, %g, %g, %g */);\n", target, index, (void *) params, params[0], params[1], params[2], params[3])); } +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fNV)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DISPATCH(ProgramParameter4fNV, (target, index, x, y, z, w), (F, "glProgramParameter4fNV(0x%x, %d, %f, %f, %f, %f);\n", target, index, x, y, z, w)); +} -/* ARB 3. GL_ARB_transpose_matrix */ -KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16]) +KEYWORD1 void KEYWORD2 NAME(ProgramParameter4fvNV)(GLenum target, GLuint index, const GLfloat * params) { - DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixARB(%p);", (void *) m)); + DISPATCH(ProgramParameter4fvNV, (target, index, params), (F, "glProgramParameter4fvNV(0x%x, %d, %p /* %g, %g, %g, %g */);\n", target, index, (void *) params, params[0], params[1], params[2], params[3])); } -KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat m[16]) +KEYWORD1 void KEYWORD2 NAME(ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params) { - DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", (void *) m)); + DISPATCH(ProgramParameters4dvNV, (target, index, num, params), (F, "glProgramParameters4dvNV(0x%x, %d, %d, %p /* %g, %g, %g, %g */);\n", target, index, num, (void *) params, params[0], params[1], params[2], params[3])); } -KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble m[16]) +KEYWORD1 void KEYWORD2 NAME(ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params) { - DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixfARB(%p)", (void *) m)); + DISPATCH(ProgramParameters4fvNV, (target, index, num, params), (F, "glProgramParameters4fvNV(0x%x, %d, %d, %p /* %g, %g, %g, %g */);\n", target, index, num, (void *) params, params[0], params[1], params[2], params[3])); } -KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16]) +KEYWORD1 void KEYWORD2 NAME(RequestResidentProgramsNV)(GLsizei n, const GLuint * ids) { - DISPATCH(MultTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", (void *) m)); + DISPATCH(RequestResidentProgramsNV, (n, ids), (F, "glRequestResidentProgramsNV(%d, %p);\n", n, (void *) ids)); } -/* ARB 5. GL_ARB_multisample */ -KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) +KEYWORD1 void KEYWORD2 NAME(TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform) { - DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);", value, invert)); + DISPATCH(TrackMatrixNV, (target, address, matrix, transform), (F, "glTrackMatrixNV(0x%x, %d, 0x%x, 0x%x);\n", target, address, matrix, transform)); } -/* -KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) +KEYWORD1 void KEYWORD2 NAME(VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(SamplePassARB, (pass), (F, "glSamplePassARB(0x%x);", pass)); + DISPATCH(VertexAttribPointerNV, (index, size, type, stride, pointer), (F, "glVertexAttribPointerNV(%d, %d, 0x%x, %d, %p);\n", index, size, type, stride, (void *) pointer)); } -*/ -/* ARB 12. GL_ARB_texture_compression */ -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dNV)(GLuint index, GLdouble x) { - DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB();")); + DISPATCH(VertexAttrib1dNV, (index, x), (F, "glVertexAttrib1dNV(%d, %f);\n", index, x)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1dvNV)(GLuint index, const GLdouble * v) { - DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB();")); + DISPATCH(VertexAttrib1dvNV, (index, v), (F, "glVertexAttrib1dvNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fNV)(GLuint index, GLfloat x) { - DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB();")); + DISPATCH(VertexAttrib1fNV, (index, x), (F, "glVertexAttrib1fNV(%d, %f);\n", index, x)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1fvNV)(GLuint index, const GLfloat * v) { - DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB();")); + DISPATCH(VertexAttrib1fvNV, (index, v), (F, "glVertexAttrib1fvNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1sNV)(GLuint index, GLshort x) { - DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB();")); + DISPATCH(VertexAttrib1sNV, (index, x), (F, "glVertexAttrib1sNV(%d, %d);\n", index, x)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib1svNV)(GLuint index, const GLshort * v) { - DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB();")); + DISPATCH(VertexAttrib1svNV, (index, v), (F, "glVertexAttrib1svNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint lod, GLvoid *img) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y) { - DISPATCH(GetCompressedTexImageARB, (target, lod, img), (F, "glGetCompressedTexImageARB();")); + DISPATCH(VertexAttrib2dNV, (index, x, y), (F, "glVertexAttrib2dNV(%d, %f, %f);\n", index, x, y)); } +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2dvNV)(GLuint index, const GLdouble * v) +{ + DISPATCH(VertexAttrib2dvNV, (index, v), (F, "glVertexAttrib2dvNV(%d, %p /* %g, %g */);\n", index, (void *) v, v[0], v[1])); +} -/* GL 1.3 */ +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y) +{ + DISPATCH(VertexAttrib2fNV, (index, x, y), (F, "glVertexAttrib2fNV(%d, %f, %f);\n", index, x, y)); +} -KEYWORD1 void KEYWORD2 NAME(ActiveTexture)(GLenum texture) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2fvNV)(GLuint index, const GLfloat * v) { - DISPATCH(ActiveTextureARB, (texture), (F, ";")); + DISPATCH(VertexAttrib2fvNV, (index, v), (F, "glVertexAttrib2fvNV(%d, %p /* %g, %g */);\n", index, (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(ClientActiveTexture)(GLenum texture) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y) { - DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); + DISPATCH(VertexAttrib2sNV, (index, x, y), (F, "glVertexAttrib2sNV(%d, %d, %d);\n", index, x, y)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib2svNV)(GLuint index, const GLshort * v) { - DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB();")); + DISPATCH(VertexAttrib2svNV, (index, v), (F, "glVertexAttrib2svNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB();")); + DISPATCH(VertexAttrib3dNV, (index, x, y, z), (F, "glVertexAttrib3dNV(%d, %f, %f, %f);\n", index, x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3dvNV)(GLuint index, const GLdouble * v) { - DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB();")); + DISPATCH(VertexAttrib3dvNV, (index, v), (F, "glVertexAttrib3dvNV(%d, %p /* %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB();")); + DISPATCH(VertexAttrib3fNV, (index, x, y, z), (F, "glVertexAttrib3fNV(%d, %f, %f, %f);\n", index, x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3fvNV)(GLuint index, const GLfloat * v) { - DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB();")); + DISPATCH(VertexAttrib3fvNV, (index, v), (F, "glVertexAttrib3fvNV(%d, %p /* %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z) { - DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB();")); + DISPATCH(VertexAttrib3sNV, (index, x, y, z), (F, "glVertexAttrib3sNV(%d, %d, %d, %d);\n", index, x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImage)(GLenum target, GLint lod, GLvoid *img) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib3svNV)(GLuint index, const GLshort * v) { - DISPATCH(GetCompressedTexImageARB, (target, lod, img), (F, "glGetCompressedTexImageARB();")); + DISPATCH(VertexAttrib3svNV, (index, v), (F, "glVertexAttrib3svNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1d)(GLenum target, GLdouble s) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - DISPATCH(MultiTexCoord1dARB, (target, s), (F, ";")); + DISPATCH(VertexAttrib4dNV, (index, x, y, z, w), (F, "glVertexAttrib4dNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dv)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4dvNV)(GLuint index, const GLdouble * v) { - DISPATCH(MultiTexCoord1dvARB, (target, v), (F, ";")); + DISPATCH(VertexAttrib4dvNV, (index, v), (F, "glVertexAttrib4dvNV(%d, %p /* %g, %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1f)(GLenum target, GLfloat s) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - DISPATCH(MultiTexCoord1fARB, (target, s), (F, ";")); + DISPATCH(VertexAttrib4fNV, (index, x, y, z, w), (F, "glVertexAttrib4fNV(%d, %f, %f, %f, %f);\n", index, x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fv)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4fvNV)(GLuint index, const GLfloat * v) { - DISPATCH(MultiTexCoord1fvARB, (target, v), (F, ";")); + DISPATCH(VertexAttrib4fvNV, (index, v), (F, "glVertexAttrib4fvNV(%d, %p /* %g, %g, %g, %g */);\n", index, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1i)(GLenum target, GLint s) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) { - DISPATCH(MultiTexCoord1iARB, (target, s), (F, ";")); + DISPATCH(VertexAttrib4sNV, (index, x, y, z, w), (F, "glVertexAttrib4sNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iv)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4svNV)(GLuint index, const GLshort * v) { - DISPATCH(MultiTexCoord1ivARB, (target, v), (F, ";")); + DISPATCH(VertexAttrib4svNV, (index, v), (F, "glVertexAttrib4svNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1s)(GLenum target, GLshort s) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) { - DISPATCH(MultiTexCoord1sARB, (target, s), (F, ";")); + DISPATCH(VertexAttrib4ubNV, (index, x, y, z, w), (F, "glVertexAttrib4ubNV(%d, %d, %d, %d, %d);\n", index, x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sv)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttrib4ubvNV)(GLuint index, const GLubyte * v) { - DISPATCH(MultiTexCoord1svARB, (target, v), (F, ";")); + DISPATCH(VertexAttrib4ubvNV, (index, v), (F, "glVertexAttrib4ubvNV(%d, %p);\n", index, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2d)(GLenum target, GLdouble s, GLdouble t) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v) { - DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, ";")); + DISPATCH(VertexAttribs1dvNV, (index, n, v), (F, "glVertexAttribs1dvNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dv)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v) { - DISPATCH(MultiTexCoord2dvARB, (target, v), (F, ";")); + DISPATCH(VertexAttribs1fvNV, (index, n, v), (F, "glVertexAttribs1fvNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2f)(GLenum target, GLfloat s, GLfloat t) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v) { - DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, ";")); + DISPATCH(VertexAttribs1svNV, (index, n, v), (F, "glVertexAttribs1svNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fv)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v) { - DISPATCH(MultiTexCoord2fvARB, (target, v), (F, ";")); + DISPATCH(VertexAttribs2dvNV, (index, n, v), (F, "glVertexAttribs2dvNV(%d, %d, %p /* %g, %g */);\n", index, n, (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2i)(GLenum target, GLint s, GLint t) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v) { - DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, ";")); + DISPATCH(VertexAttribs2fvNV, (index, n, v), (F, "glVertexAttribs2fvNV(%d, %d, %p /* %g, %g */);\n", index, n, (void *) v, v[0], v[1])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iv)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v) { - DISPATCH(MultiTexCoord2ivARB, (target, v), (F, ";")); + DISPATCH(VertexAttribs2svNV, (index, n, v), (F, "glVertexAttribs2svNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2s)(GLenum target, GLshort s, GLshort t) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v) { - DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, ";")); + DISPATCH(VertexAttribs3dvNV, (index, n, v), (F, "glVertexAttribs3dvNV(%d, %d, %p /* %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sv)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v) { - DISPATCH(MultiTexCoord2svARB, (target, v), (F, ";")); + DISPATCH(VertexAttribs3fvNV, (index, n, v), (F, "glVertexAttribs3fvNV(%d, %d, %p /* %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3d)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v) { - DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, ";")); + DISPATCH(VertexAttribs3svNV, (index, n, v), (F, "glVertexAttribs3svNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dv)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v) { - DISPATCH(MultiTexCoord3dvARB, (target, v), (F, ";")); + DISPATCH(VertexAttribs4dvNV, (index, n, v), (F, "glVertexAttribs4dvNV(%d, %d, %p /* %g, %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3f)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v) { - DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, ";")); + DISPATCH(VertexAttribs4fvNV, (index, n, v), (F, "glVertexAttribs4fvNV(%d, %d, %p /* %g, %g, %g, %g */);\n", index, n, (void *) v, v[0], v[1], v[2], v[3])); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fv)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v) { - DISPATCH(MultiTexCoord3fvARB, (target, v), (F, ";")); + DISPATCH(VertexAttribs4svNV, (index, n, v), (F, "glVertexAttribs4svNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3i)(GLenum target, GLint s, GLint t, GLint r) +KEYWORD1 void KEYWORD2 NAME(VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v) { - DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, ";")); + DISPATCH(VertexAttribs4ubvNV, (index, n, v), (F, "glVertexAttribs4ubvNV(%d, %d, %p);\n", index, n, (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iv)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(PointParameteriNV)(GLenum pname, GLint params) { - DISPATCH(MultiTexCoord3ivARB, (target, v), (F, ";")); + DISPATCH(PointParameteriNV, (pname, params), (F, "glPointParameteriNV(0x%x, %d);\n", pname, params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3s)(GLenum target, GLshort s, GLshort t, GLshort r) +KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * params) { - DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, ";")); + DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sv)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { - DISPATCH(MultiTexCoord3svARB, (target, v), (F, ";")); + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4d)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +KEYWORD1 void KEYWORD2 NAME(FogCoordf)(GLfloat coord) { - DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, ";")); + DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordf(%f);\n", coord)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dv)(GLenum target, const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(FogCoordfv)(const GLfloat * coord) { - DISPATCH(MultiTexCoord4dvARB, (target, v), (F, ";")); + DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfv(%p);\n", (void *) coord)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +KEYWORD1 void KEYWORD2 NAME(FogCoordd)(GLdouble coord) { - DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, ";")); + DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoordd(%f);\n", coord)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fv)(GLenum target, const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(FogCoorddv)(const GLdouble * coord) { - DISPATCH(MultiTexCoord4fvARB, (target, v), (F, ";")); + DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddv(%p);\n", (void *) coord)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4i)(GLenum target, GLint s, GLint t, GLint r, GLint q) +KEYWORD1 void KEYWORD2 NAME(FogCoordPointer)(GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, ";")); + DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointer(0x%x, %d, %p);\n", type, stride, (void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iv)(GLenum target, const GLint *v) +KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) { - DISPATCH(MultiTexCoord4ivARB, (target, v), (F, ";")); + DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (void *) first, (void *) count, primcount)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4s)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +KEYWORD1 void KEYWORD2 NAME(MultiDrawElements)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount) { - DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, ";")); + DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElements(0x%x, %p, 0x%x, %p, %d);\n", mode, (void *) count, type, (void *) indices, primcount)); } -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sv)(GLenum target, const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(PointParameterf)(GLenum pname, GLfloat param) { - DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); + DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterf(0x%x, %f);\n", pname, param)); } +KEYWORD1 void KEYWORD2 NAME(PointParameterfv)(GLenum pname, const GLfloat * params) +{ + DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfv(0x%x, %p);\n", pname, (void *) params)); +} -KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble m[16]) +KEYWORD1 void KEYWORD2 NAME(PointParameteri)(GLenum pname, GLint param) { - DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixARB(%p);", (void *) m)); + DISPATCH(PointParameteriNV, (pname, param), (F, "glPointParameteri(0x%x, %d);\n", pname, param)); } -KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixf)(const GLfloat m[16]) +KEYWORD1 void KEYWORD2 NAME(PointParameteriv)(GLenum pname, const GLint * params) { - DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", (void *) m)); + DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameteriv(0x%x, %p);\n", pname, (void *) params)); } -KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixd)(const GLdouble m[16]) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3b)(GLbyte red, GLbyte green, GLbyte blue) { - DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixfARB(%p)", (void *) m)); + DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3b(%d, %d, %d);\n", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixf)(const GLfloat m[16]) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bv)(const GLbyte * v) { - DISPATCH(MultTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", (void *) m)); + DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bv(%p);\n", (void *) v)); } -KEYWORD1 void KEYWORD2 NAME(SampleCoverage)(GLclampf value, GLboolean invert) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3d)(GLdouble red, GLdouble green, GLdouble blue) { - DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);", value, invert)); + DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3d(%f, %f, %f);\n", red, green, blue)); } -/* -KEYWORD1 void KEYWORD2 NAME(SamplePass)(GLenum pass) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dv)(const GLdouble * v) +{ + DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3f)(GLfloat red, GLfloat green, GLfloat blue) { - DISPATCH(SamplePassARB, (pass), (F, "glSamplePassARB(0x%x);", pass)); + DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3f(%f, %f, %f);\n", red, green, blue)); } -*/ +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fv)(const GLfloat * v) +{ + DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); +} +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3i)(GLint red, GLint green, GLint blue) +{ + DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3i(%d, %d, %d);\n", red, green, blue)); +} +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iv)(const GLint * v) +{ + DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3iv(%p);\n", (void *) v)); +} +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3s)(GLshort red, GLshort green, GLshort blue) +{ + DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3s(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sv)(const GLshort * v) +{ + DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3sv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ub)(GLubyte red, GLubyte green, GLubyte blue) +{ + DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ub(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubv)(const GLubyte * v) +{ + DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ui)(GLuint red, GLuint green, GLuint blue) +{ + DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3ui(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiv)(const GLuint * v) +{ + DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uiv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3us)(GLushort red, GLushort green, GLushort blue) +{ + DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3us(%d, %d, %d);\n", red, green, blue)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usv)(const GLushort * v) +{ + DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointer)(GLint size, GLenum type, GLsizei stride, const void * pointer) +{ + DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointer(%d, 0x%x, %d, %p);\n", size, type, stride, (void *) pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2d)(GLdouble x, GLdouble y) +{ + DISPATCH(WindowPos2dMESA, (x, y), (F, "glWindowPos2d(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dv)(const GLdouble * v) +{ + DISPATCH(WindowPos2dvMESA, (v), (F, "glWindowPos2dv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2f)(GLfloat x, GLfloat y) +{ + DISPATCH(WindowPos2fMESA, (x, y), (F, "glWindowPos2f(%f, %f);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2fv)(const GLfloat * v) +{ + DISPATCH(WindowPos2fvMESA, (v), (F, "glWindowPos2fv(%p /* %g, %g */);\n", (void *) v, v[0], v[1])); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2i)(GLint x, GLint y) +{ + DISPATCH(WindowPos2iMESA, (x, y), (F, "glWindowPos2i(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2iv)(const GLint * v) +{ + DISPATCH(WindowPos2ivMESA, (v), (F, "glWindowPos2iv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2s)(GLshort x, GLshort y) +{ + DISPATCH(WindowPos2sMESA, (x, y), (F, "glWindowPos2s(%d, %d);\n", x, y)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos2sv)(const GLshort * v) +{ + DISPATCH(WindowPos2svMESA, (v), (F, "glWindowPos2sv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3d)(GLdouble x, GLdouble y, GLdouble z) +{ + DISPATCH(WindowPos3dMESA, (x, y, z), (F, "glWindowPos3d(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3dv)(const GLdouble * v) +{ + DISPATCH(WindowPos3dvMESA, (v), (F, "glWindowPos3dv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3f)(GLfloat x, GLfloat y, GLfloat z) +{ + DISPATCH(WindowPos3fMESA, (x, y, z), (F, "glWindowPos3f(%f, %f, %f);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3fv)(const GLfloat * v) +{ + DISPATCH(WindowPos3fvMESA, (v), (F, "glWindowPos3fv(%p /* %g, %g, %g */);\n", (void *) v, v[0], v[1], v[2])); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3i)(GLint x, GLint y, GLint z) +{ + DISPATCH(WindowPos3iMESA, (x, y, z), (F, "glWindowPos3i(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3iv)(const GLint * v) +{ + DISPATCH(WindowPos3ivMESA, (v), (F, "glWindowPos3iv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3s)(GLshort x, GLshort y, GLshort z) +{ + DISPATCH(WindowPos3sMESA, (x, y, z), (F, "glWindowPos3s(%d, %d, %d);\n", x, y, z)); +} + +KEYWORD1 void KEYWORD2 NAME(WindowPos3sv)(const GLshort * v) +{ + DISPATCH(WindowPos3svMESA, (v), (F, "glWindowPos3sv(%p);\n", (void *) v)); +} + +KEYWORD1 void KEYWORD2 NAME(ActiveStencilFaceEXT)(GLenum face) +{ + DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); +} + + + +/* + * This is how a dispatch table can be initialized with all the functions + * we generated above. + */ #ifdef DISPATCH_TABLE_NAME #ifndef TABLE_ENTRY @@ -3955,7 +4543,6 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(Translated), TABLE_ENTRY(Translatef), TABLE_ENTRY(Viewport), - /* 1.1 */ TABLE_ENTRY(ArrayElement), TABLE_ENTRY(BindTexture), TABLE_ENTRY(ColorPointer), @@ -3986,7 +4573,6 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(TexSubImage2D), TABLE_ENTRY(PopClientAttrib), TABLE_ENTRY(PushClientAttrib), - /* 1.2 */ TABLE_ENTRY(BlendColor), TABLE_ENTRY(BlendEquation), TABLE_ENTRY(DrawRangeElements), @@ -4025,7 +4611,6 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(TexImage3D), TABLE_ENTRY(TexSubImage3D), TABLE_ENTRY(CopyTexSubImage3D), - /* GL_ARB_multitexture */ TABLE_ENTRY(ActiveTextureARB), TABLE_ENTRY(ClientActiveTextureARB), TABLE_ENTRY(MultiTexCoord1dARB), @@ -4060,108 +4645,74 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(MultiTexCoord4ivARB), TABLE_ENTRY(MultiTexCoord4sARB), TABLE_ENTRY(MultiTexCoord4svARB), - /* GL_ARB_transpose_matrix */ TABLE_ENTRY(LoadTransposeMatrixfARB), TABLE_ENTRY(LoadTransposeMatrixdARB), TABLE_ENTRY(MultTransposeMatrixfARB), TABLE_ENTRY(MultTransposeMatrixdARB), - /* GL_ARB_multisample */ TABLE_ENTRY(SampleCoverageARB), -#if 0 - TABLE_ENTRY(SamplePassARB), -#else - TABLE_ENTRY(Unused), -#endif - /* GL_EXT_blend_color */ - /* GL_EXT_polygon_offset */ + TABLE_ENTRY(__unused413), TABLE_ENTRY(PolygonOffsetEXT), - /* GL_EXT_texture3D */ - /* GL_EXT_subtexture */ - /* GL_SGIS_texture_filter4 */ TABLE_ENTRY(GetTexFilterFuncSGIS), TABLE_ENTRY(TexFilterFuncSGIS), - /* GL_EXT_subtexture */ - /* GL_EXT_copy_texture */ - /* GL_EXT_histogram */ TABLE_ENTRY(GetHistogramEXT), TABLE_ENTRY(GetHistogramParameterfvEXT), TABLE_ENTRY(GetHistogramParameterivEXT), TABLE_ENTRY(GetMinmaxEXT), TABLE_ENTRY(GetMinmaxParameterfvEXT), TABLE_ENTRY(GetMinmaxParameterivEXT), - /* GL_EXT_convolution */ TABLE_ENTRY(GetConvolutionFilterEXT), TABLE_ENTRY(GetConvolutionParameterfvEXT), TABLE_ENTRY(GetConvolutionParameterivEXT), TABLE_ENTRY(GetSeparableFilterEXT), - /* GL_SGI_color_table */ TABLE_ENTRY(GetColorTableSGI), TABLE_ENTRY(GetColorTableParameterfvSGI), TABLE_ENTRY(GetColorTableParameterivSGI), - /* GL_SGIX_pixel_texture */ TABLE_ENTRY(PixelTexGenSGIX), - /* GL_SGIS_pixel_texture */ TABLE_ENTRY(PixelTexGenParameteriSGIS), TABLE_ENTRY(PixelTexGenParameterivSGIS), TABLE_ENTRY(PixelTexGenParameterfSGIS), TABLE_ENTRY(PixelTexGenParameterfvSGIS), TABLE_ENTRY(GetPixelTexGenParameterivSGIS), TABLE_ENTRY(GetPixelTexGenParameterfvSGIS), - /* GL_SGIS_texture4D */ TABLE_ENTRY(TexImage4DSGIS), TABLE_ENTRY(TexSubImage4DSGIS), - /* GL_EXT_texture_object */ TABLE_ENTRY(AreTexturesResidentEXT), TABLE_ENTRY(GenTexturesEXT), TABLE_ENTRY(IsTextureEXT), - /* GL_SGIS_detail_texture */ TABLE_ENTRY(DetailTexFuncSGIS), TABLE_ENTRY(GetDetailTexFuncSGIS), - /* GL_SGIS_sharpen_texture */ TABLE_ENTRY(SharpenTexFuncSGIS), TABLE_ENTRY(GetSharpenTexFuncSGIS), - /* GL_SGIS_multisample */ TABLE_ENTRY(SampleMaskSGIS), TABLE_ENTRY(SamplePatternSGIS), - /* GL_EXT_vertex_array */ TABLE_ENTRY(ColorPointerEXT), TABLE_ENTRY(EdgeFlagPointerEXT), TABLE_ENTRY(IndexPointerEXT), TABLE_ENTRY(NormalPointerEXT), TABLE_ENTRY(TexCoordPointerEXT), TABLE_ENTRY(VertexPointerEXT), - /* GL_EXT_blend_minmax */ - /* GL_SGIX_sprite */ TABLE_ENTRY(SpriteParameterfSGIX), TABLE_ENTRY(SpriteParameterfvSGIX), TABLE_ENTRY(SpriteParameteriSGIX), TABLE_ENTRY(SpriteParameterivSGIX), - /* GL_EXT_point_parameters */ TABLE_ENTRY(PointParameterfEXT), TABLE_ENTRY(PointParameterfvEXT), - /* GL_SGIX_instruments */ TABLE_ENTRY(GetInstrumentsSGIX), TABLE_ENTRY(InstrumentsBufferSGIX), TABLE_ENTRY(PollInstrumentsSGIX), TABLE_ENTRY(ReadInstrumentsSGIX), TABLE_ENTRY(StartInstrumentsSGIX), TABLE_ENTRY(StopInstrumentsSGIX), - /* GL_SGIX_framezoom */ TABLE_ENTRY(FrameZoomSGIX), - /* GL_SGIX_tag_sample_buffer */ TABLE_ENTRY(TagSampleBufferSGIX), - /* GL_SGIX_reference_plane */ TABLE_ENTRY(ReferencePlaneSGIX), - /* GL_SGIX_flush_raster */ TABLE_ENTRY(FlushRasterSGIX), - /* GL_SGIX_list_priority */ TABLE_ENTRY(GetListParameterfvSGIX), TABLE_ENTRY(GetListParameterivSGIX), TABLE_ENTRY(ListParameterfSGIX), TABLE_ENTRY(ListParameterfvSGIX), TABLE_ENTRY(ListParameteriSGIX), TABLE_ENTRY(ListParameterivSGIX), - /* GL_SGIX_fragment_lighting */ TABLE_ENTRY(FragmentColorMaterialSGIX), TABLE_ENTRY(FragmentLightfSGIX), TABLE_ENTRY(FragmentLightfvSGIX), @@ -4180,14 +4731,11 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(GetFragmentMaterialfvSGIX), TABLE_ENTRY(GetFragmentMaterialivSGIX), TABLE_ENTRY(LightEnviSGIX), - /* GL_EXT_vertex_weighting */ TABLE_ENTRY(VertexWeightfEXT), TABLE_ENTRY(VertexWeightfvEXT), TABLE_ENTRY(VertexWeightPointerEXT), - /* GL_NV_vertex_array_range */ TABLE_ENTRY(FlushVertexArrayRangeNV), TABLE_ENTRY(VertexArrayRangeNV), - /* GL_NV_register_combiners */ TABLE_ENTRY(CombinerParameterfvNV), TABLE_ENTRY(CombinerParameterfNV), TABLE_ENTRY(CombinerParameterivNV), @@ -4201,9 +4749,7 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(GetCombinerOutputParameterivNV), TABLE_ENTRY(GetFinalCombinerInputParameterfvNV), TABLE_ENTRY(GetFinalCombinerInputParameterivNV), - /* GL_MESA_resize_buffers */ TABLE_ENTRY(ResizeBuffersMESA), - /* GL_MESA_window_pos */ TABLE_ENTRY(WindowPos2dMESA), TABLE_ENTRY(WindowPos2dvMESA), TABLE_ENTRY(WindowPos2fMESA), @@ -4228,33 +4774,23 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(WindowPos4ivMESA), TABLE_ENTRY(WindowPos4sMESA), TABLE_ENTRY(WindowPos4svMESA), - /* GL_EXT_draw_range_elements */ TABLE_ENTRY(BlendFuncSeparateEXT), - /* GL_EXT_index_material */ TABLE_ENTRY(IndexMaterialEXT), - /* GL_EXT_index_func */ TABLE_ENTRY(IndexFuncEXT), - /* GL_EXT_compiled_vertex_array */ TABLE_ENTRY(LockArraysEXT), TABLE_ENTRY(UnlockArraysEXT), - /* GL_EXT_cull_vertex */ TABLE_ENTRY(CullParameterdvEXT), TABLE_ENTRY(CullParameterfvEXT), - /* GL_PGI_misc_hints */ TABLE_ENTRY(HintPGI), - /* GL_EXT_fog_coord */ TABLE_ENTRY(FogCoordfEXT), TABLE_ENTRY(FogCoordfvEXT), TABLE_ENTRY(FogCoorddEXT), TABLE_ENTRY(FogCoorddvEXT), TABLE_ENTRY(FogCoordPointerEXT), - /* GL_EXT_color_table */ TABLE_ENTRY(GetColorTableEXT), TABLE_ENTRY(GetColorTableParameterivEXT), TABLE_ENTRY(GetColorTableParameterfvEXT), - /* GL_3DFX_tbuffer */ TABLE_ENTRY(TbufferMask3DFX), - /* GL_ARB_texture_compression */ TABLE_ENTRY(CompressedTexImage3DARB), TABLE_ENTRY(CompressedTexImage2DARB), TABLE_ENTRY(CompressedTexImage1DARB), @@ -4262,7 +4798,6 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(CompressedTexSubImage2DARB), TABLE_ENTRY(CompressedTexSubImage1DARB), TABLE_ENTRY(GetCompressedTexImageARB), - /* GL_EXT_secondary_color */ TABLE_ENTRY(SecondaryColor3bEXT), TABLE_ENTRY(SecondaryColor3bvEXT), TABLE_ENTRY(SecondaryColor3dEXT), @@ -4280,63 +4815,85 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(SecondaryColor3usEXT), TABLE_ENTRY(SecondaryColor3usvEXT), TABLE_ENTRY(SecondaryColorPointerEXT), -#if 0 - /* 1.3 */ - TABLE_ENTRY(ActiveTexture), - TABLE_ENTRY(ClientActiveTexture), - TABLE_ENTRY(CompressedTexImage1D), - TABLE_ENTRY(CompressedTexImage2D), - TABLE_ENTRY(CompressedTexImage3D), - TABLE_ENTRY(CompressedTexSubImage1D), - TABLE_ENTRY(CompressedTexSubImage2D), - TABLE_ENTRY(CompressedTexSubImage3D), - TABLE_ENTRY(GetCompressedTexImage), - TABLE_ENTRY(MultiTexCoord1d), - TABLE_ENTRY(MultiTexCoord1dv), - TABLE_ENTRY(MultiTexCoord1f), - TABLE_ENTRY(MultiTexCoord1fv), - TABLE_ENTRY(MultiTexCoord1i), - TABLE_ENTRY(MultiTexCoord1iv), - TABLE_ENTRY(MultiTexCoord1s), - TABLE_ENTRY(MultiTexCoord1sv), - TABLE_ENTRY(MultiTexCoord2d), - TABLE_ENTRY(MultiTexCoord2dv), - TABLE_ENTRY(MultiTexCoord2f), - TABLE_ENTRY(MultiTexCoord2fv), - TABLE_ENTRY(MultiTexCoord2i), - TABLE_ENTRY(MultiTexCoord2iv), - TABLE_ENTRY(MultiTexCoord2s), - TABLE_ENTRY(MultiTexCoord2sv), - TABLE_ENTRY(MultiTexCoord3d), - TABLE_ENTRY(MultiTexCoord3dv), - TABLE_ENTRY(MultiTexCoord3f), - TABLE_ENTRY(MultiTexCoord3fv), - TABLE_ENTRY(MultiTexCoord3i), - TABLE_ENTRY(MultiTexCoord3iv), - TABLE_ENTRY(MultiTexCoord3s), - TABLE_ENTRY(MultiTexCoord3sv), - TABLE_ENTRY(MultiTexCoord4d), - TABLE_ENTRY(MultiTexCoord4dv), - TABLE_ENTRY(MultiTexCoord4f), - TABLE_ENTRY(MultiTexCoord4fv), - TABLE_ENTRY(MultiTexCoord4i), - TABLE_ENTRY(MultiTexCoord4iv), - TABLE_ENTRY(MultiTexCoord4s), - TABLE_ENTRY(MultiTexCoord4sv), - TABLE_ENTRY(LoadTransposeMatrixd), - TABLE_ENTRY(LoadTransposeMatrixf), - TABLE_ENTRY(MultTransposeMatrixd), - TABLE_ENTRY(MultTransposeMatrixf), - TABLE_ENTRY(SampleCoverage), -#if 0 - TABLE_ENTRY(SamplePass), -#else - TABLE_ENTRY(Unused), -#endif -#endif + TABLE_ENTRY(AreProgramsResidentNV), + TABLE_ENTRY(BindProgramNV), + TABLE_ENTRY(DeleteProgramsNV), + TABLE_ENTRY(ExecuteProgramNV), + TABLE_ENTRY(GenProgramsNV), + TABLE_ENTRY(GetProgramParameterdvNV), + TABLE_ENTRY(GetProgramParameterfvNV), + TABLE_ENTRY(GetProgramivNV), + TABLE_ENTRY(GetProgramStringNV), + TABLE_ENTRY(GetTrackMatrixivNV), + TABLE_ENTRY(GetVertexAttribdvNV), + TABLE_ENTRY(GetVertexAttribfvNV), + TABLE_ENTRY(GetVertexAttribivNV), + TABLE_ENTRY(GetVertexAttribPointervNV), + TABLE_ENTRY(IsProgramNV), + TABLE_ENTRY(LoadProgramNV), + TABLE_ENTRY(ProgramParameter4dNV), + TABLE_ENTRY(ProgramParameter4dvNV), + TABLE_ENTRY(ProgramParameter4fNV), + TABLE_ENTRY(ProgramParameter4fvNV), + TABLE_ENTRY(ProgramParameters4dvNV), + TABLE_ENTRY(ProgramParameters4fvNV), + TABLE_ENTRY(RequestResidentProgramsNV), + TABLE_ENTRY(TrackMatrixNV), + TABLE_ENTRY(VertexAttribPointerNV), + TABLE_ENTRY(VertexAttrib1dNV), + TABLE_ENTRY(VertexAttrib1dvNV), + TABLE_ENTRY(VertexAttrib1fNV), + TABLE_ENTRY(VertexAttrib1fvNV), + TABLE_ENTRY(VertexAttrib1sNV), + TABLE_ENTRY(VertexAttrib1svNV), + TABLE_ENTRY(VertexAttrib2dNV), + TABLE_ENTRY(VertexAttrib2dvNV), + TABLE_ENTRY(VertexAttrib2fNV), + TABLE_ENTRY(VertexAttrib2fvNV), + TABLE_ENTRY(VertexAttrib2sNV), + TABLE_ENTRY(VertexAttrib2svNV), + TABLE_ENTRY(VertexAttrib3dNV), + TABLE_ENTRY(VertexAttrib3dvNV), + TABLE_ENTRY(VertexAttrib3fNV), + TABLE_ENTRY(VertexAttrib3fvNV), + TABLE_ENTRY(VertexAttrib3sNV), + TABLE_ENTRY(VertexAttrib3svNV), + TABLE_ENTRY(VertexAttrib4dNV), + TABLE_ENTRY(VertexAttrib4dvNV), + TABLE_ENTRY(VertexAttrib4fNV), + TABLE_ENTRY(VertexAttrib4fvNV), + TABLE_ENTRY(VertexAttrib4sNV), + TABLE_ENTRY(VertexAttrib4svNV), + TABLE_ENTRY(VertexAttrib4ubNV), + TABLE_ENTRY(VertexAttrib4ubvNV), + TABLE_ENTRY(VertexAttribs1dvNV), + TABLE_ENTRY(VertexAttribs1fvNV), + TABLE_ENTRY(VertexAttribs1svNV), + TABLE_ENTRY(VertexAttribs2dvNV), + TABLE_ENTRY(VertexAttribs2fvNV), + TABLE_ENTRY(VertexAttribs2svNV), + TABLE_ENTRY(VertexAttribs3dvNV), + TABLE_ENTRY(VertexAttribs3fvNV), + TABLE_ENTRY(VertexAttribs3svNV), + TABLE_ENTRY(VertexAttribs4dvNV), + TABLE_ENTRY(VertexAttribs4fvNV), + TABLE_ENTRY(VertexAttribs4svNV), + TABLE_ENTRY(VertexAttribs4ubvNV), + TABLE_ENTRY(PointParameteriNV), + TABLE_ENTRY(PointParameterivNV), + TABLE_ENTRY(MultiDrawArraysEXT), + TABLE_ENTRY(MultiDrawElementsEXT), + TABLE_ENTRY(ActiveStencilFaceEXT), + TABLE_ENTRY(DeleteFencesNV), + TABLE_ENTRY(GenFencesNV), + TABLE_ENTRY(IsFenceNV), + TABLE_ENTRY(TestFenceNV), + TABLE_ENTRY(GetFenceivNV), + TABLE_ENTRY(FinishFenceNV), + TABLE_ENTRY(SetFenceNV), /* A whole bunch of no-op functions. These might be called - * when someone tries to call a dynamically-registered extension - * function without a current rendering context. + * when someone tries to call a dynamically-registered + * extension function without a current rendering context. */ TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), @@ -4437,89 +4994,72 @@ void *DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused), - TABLE_ENTRY(Unused) }; #endif /* DISPATCH_TABLE_NAME */ - /* * This is just used to silence compiler warnings. * We list the functions which aren't otherwise used. */ #ifdef UNUSED_TABLE_NAME void *UNUSED_TABLE_NAME[] = { + TABLE_ENTRY(ActiveTexture), + TABLE_ENTRY(ClientActiveTexture), + TABLE_ENTRY(MultiTexCoord1d), + TABLE_ENTRY(MultiTexCoord1dv), + TABLE_ENTRY(MultiTexCoord1f), + TABLE_ENTRY(MultiTexCoord1fv), + TABLE_ENTRY(MultiTexCoord1i), + TABLE_ENTRY(MultiTexCoord1iv), + TABLE_ENTRY(MultiTexCoord1s), + TABLE_ENTRY(MultiTexCoord1sv), + TABLE_ENTRY(MultiTexCoord2d), + TABLE_ENTRY(MultiTexCoord2dv), + TABLE_ENTRY(MultiTexCoord2f), + TABLE_ENTRY(MultiTexCoord2fv), + TABLE_ENTRY(MultiTexCoord2i), + TABLE_ENTRY(MultiTexCoord2iv), + TABLE_ENTRY(MultiTexCoord2s), + TABLE_ENTRY(MultiTexCoord2sv), + TABLE_ENTRY(MultiTexCoord3d), + TABLE_ENTRY(MultiTexCoord3dv), + TABLE_ENTRY(MultiTexCoord3f), + TABLE_ENTRY(MultiTexCoord3fv), + TABLE_ENTRY(MultiTexCoord3i), + TABLE_ENTRY(MultiTexCoord3iv), + TABLE_ENTRY(MultiTexCoord3s), + TABLE_ENTRY(MultiTexCoord3sv), + TABLE_ENTRY(MultiTexCoord4d), + TABLE_ENTRY(MultiTexCoord4dv), + TABLE_ENTRY(MultiTexCoord4f), + TABLE_ENTRY(MultiTexCoord4fv), + TABLE_ENTRY(MultiTexCoord4i), + TABLE_ENTRY(MultiTexCoord4iv), + TABLE_ENTRY(MultiTexCoord4s), + TABLE_ENTRY(MultiTexCoord4sv), + TABLE_ENTRY(LoadTransposeMatrixf), + TABLE_ENTRY(LoadTransposeMatrixd), + TABLE_ENTRY(MultTransposeMatrixf), + TABLE_ENTRY(MultTransposeMatrixd), + TABLE_ENTRY(SampleCoverage), + TABLE_ENTRY(CompressedTexImage3D), + TABLE_ENTRY(CompressedTexImage2D), + TABLE_ENTRY(CompressedTexImage1D), + TABLE_ENTRY(CompressedTexSubImage3D), + TABLE_ENTRY(CompressedTexSubImage2D), + TABLE_ENTRY(CompressedTexSubImage1D), + TABLE_ENTRY(GetCompressedTexImage), TABLE_ENTRY(BlendColorEXT), - TABLE_ENTRY(CopyTexSubImage3DEXT), TABLE_ENTRY(TexImage3DEXT), TABLE_ENTRY(TexSubImage3DEXT), - TABLE_ENTRY(CopyTexSubImage1DEXT), TABLE_ENTRY(TexSubImage1DEXT), TABLE_ENTRY(TexSubImage2DEXT), TABLE_ENTRY(CopyTexImage1DEXT), TABLE_ENTRY(CopyTexImage2DEXT), + TABLE_ENTRY(CopyTexSubImage1DEXT), TABLE_ENTRY(CopyTexSubImage2DEXT), + TABLE_ENTRY(CopyTexSubImage3DEXT), TABLE_ENTRY(HistogramEXT), TABLE_ENTRY(MinmaxEXT), TABLE_ENTRY(ResetHistogramEXT), @@ -4533,17 +5073,19 @@ void *UNUSED_TABLE_NAME[] = { TABLE_ENTRY(CopyConvolutionFilter1DEXT), TABLE_ENTRY(CopyConvolutionFilter2DEXT), TABLE_ENTRY(SeparableFilter2DEXT), + TABLE_ENTRY(ColorTableSGI), TABLE_ENTRY(ColorTableParameterfvSGI), TABLE_ENTRY(ColorTableParameterivSGI), - TABLE_ENTRY(ColorTableSGI), TABLE_ENTRY(CopyColorTableSGI), - TABLE_ENTRY(DeleteTexturesEXT), TABLE_ENTRY(BindTextureEXT), + TABLE_ENTRY(DeleteTexturesEXT), TABLE_ENTRY(PrioritizeTexturesEXT), - TABLE_ENTRY(GetPointervEXT), TABLE_ENTRY(ArrayElementEXT), TABLE_ENTRY(DrawArraysEXT), + TABLE_ENTRY(GetPointervEXT), TABLE_ENTRY(BlendEquationEXT), + TABLE_ENTRY(PointParameterfARB), + TABLE_ENTRY(PointParameterfvARB), TABLE_ENTRY(PointParameterfSGIS), TABLE_ENTRY(PointParameterfvSGIS), TABLE_ENTRY(ColorSubTableEXT), @@ -4553,56 +5095,67 @@ void *UNUSED_TABLE_NAME[] = { TABLE_ENTRY(BlendFuncSeparateINGR), TABLE_ENTRY(SampleMaskEXT), TABLE_ENTRY(SamplePatternEXT), - TABLE_ENTRY(ActiveTexture), - TABLE_ENTRY(ClientActiveTexture), - TABLE_ENTRY(CompressedTexImage1D), - TABLE_ENTRY(CompressedTexImage2D), - TABLE_ENTRY(CompressedTexImage2DARB), - TABLE_ENTRY(CompressedTexImage3D), - TABLE_ENTRY(CompressedTexSubImage1D), - TABLE_ENTRY(CompressedTexSubImage2D), - TABLE_ENTRY(CompressedTexSubImage3D), - TABLE_ENTRY(GetCompressedTexImage), - TABLE_ENTRY(MultiTexCoord1d), - TABLE_ENTRY(MultiTexCoord1dv), - TABLE_ENTRY(MultiTexCoord1f), - TABLE_ENTRY(MultiTexCoord1fv), - TABLE_ENTRY(MultiTexCoord1i), - TABLE_ENTRY(MultiTexCoord1iv), - TABLE_ENTRY(MultiTexCoord1s), - TABLE_ENTRY(MultiTexCoord1sv), - TABLE_ENTRY(MultiTexCoord2d), - TABLE_ENTRY(MultiTexCoord2dv), - TABLE_ENTRY(MultiTexCoord2f), - TABLE_ENTRY(MultiTexCoord2fv), - TABLE_ENTRY(MultiTexCoord2i), - TABLE_ENTRY(MultiTexCoord2iv), - TABLE_ENTRY(MultiTexCoord2s), - TABLE_ENTRY(MultiTexCoord2sv), - TABLE_ENTRY(MultiTexCoord3d), - TABLE_ENTRY(MultiTexCoord3dv), - TABLE_ENTRY(MultiTexCoord3f), - TABLE_ENTRY(MultiTexCoord3fv), - TABLE_ENTRY(MultiTexCoord3i), - TABLE_ENTRY(MultiTexCoord3iv), - TABLE_ENTRY(MultiTexCoord3s), - TABLE_ENTRY(MultiTexCoord3sv), - TABLE_ENTRY(MultiTexCoord4d), - TABLE_ENTRY(MultiTexCoord4dv), - TABLE_ENTRY(MultiTexCoord4f), - TABLE_ENTRY(MultiTexCoord4fv), - TABLE_ENTRY(MultiTexCoord4i), - TABLE_ENTRY(MultiTexCoord4iv), - TABLE_ENTRY(MultiTexCoord4s), - TABLE_ENTRY(MultiTexCoord4sv), - TABLE_ENTRY(LoadTransposeMatrixd), - TABLE_ENTRY(LoadTransposeMatrixf), - TABLE_ENTRY(MultTransposeMatrixd), - TABLE_ENTRY(MultTransposeMatrixf), - TABLE_ENTRY(SampleCoverage), -#if 0 - TABLE_ENTRY(SamplePass) -#endif + TABLE_ENTRY(WindowPos2dARB), + TABLE_ENTRY(WindowPos2fARB), + TABLE_ENTRY(WindowPos2iARB), + TABLE_ENTRY(WindowPos2sARB), + TABLE_ENTRY(WindowPos2dvARB), + TABLE_ENTRY(WindowPos2fvARB), + TABLE_ENTRY(WindowPos2ivARB), + TABLE_ENTRY(WindowPos2svARB), + TABLE_ENTRY(WindowPos3dARB), + TABLE_ENTRY(WindowPos3fARB), + TABLE_ENTRY(WindowPos3iARB), + TABLE_ENTRY(WindowPos3sARB), + TABLE_ENTRY(WindowPos3dvARB), + TABLE_ENTRY(WindowPos3fvARB), + TABLE_ENTRY(WindowPos3ivARB), + TABLE_ENTRY(WindowPos3svARB), + TABLE_ENTRY(BlendFuncSeparate), + TABLE_ENTRY(FogCoordf), + TABLE_ENTRY(FogCoordfv), + TABLE_ENTRY(FogCoordd), + TABLE_ENTRY(FogCoorddv), + TABLE_ENTRY(FogCoordPointer), + TABLE_ENTRY(MultiDrawArrays), + TABLE_ENTRY(MultiDrawElements), + TABLE_ENTRY(PointParameterf), + TABLE_ENTRY(PointParameterfv), + TABLE_ENTRY(PointParameteri), + TABLE_ENTRY(PointParameteriv), + TABLE_ENTRY(SecondaryColor3b), + TABLE_ENTRY(SecondaryColor3bv), + TABLE_ENTRY(SecondaryColor3d), + TABLE_ENTRY(SecondaryColor3dv), + TABLE_ENTRY(SecondaryColor3f), + TABLE_ENTRY(SecondaryColor3fv), + TABLE_ENTRY(SecondaryColor3i), + TABLE_ENTRY(SecondaryColor3iv), + TABLE_ENTRY(SecondaryColor3s), + TABLE_ENTRY(SecondaryColor3sv), + TABLE_ENTRY(SecondaryColor3ub), + TABLE_ENTRY(SecondaryColor3ubv), + TABLE_ENTRY(SecondaryColor3ui), + TABLE_ENTRY(SecondaryColor3uiv), + TABLE_ENTRY(SecondaryColor3us), + TABLE_ENTRY(SecondaryColor3usv), + TABLE_ENTRY(SecondaryColorPointer), + TABLE_ENTRY(WindowPos2d), + TABLE_ENTRY(WindowPos2dv), + TABLE_ENTRY(WindowPos2f), + TABLE_ENTRY(WindowPos2fv), + TABLE_ENTRY(WindowPos2i), + TABLE_ENTRY(WindowPos2iv), + TABLE_ENTRY(WindowPos2s), + TABLE_ENTRY(WindowPos2sv), + TABLE_ENTRY(WindowPos3d), + TABLE_ENTRY(WindowPos3dv), + TABLE_ENTRY(WindowPos3f), + TABLE_ENTRY(WindowPos3fv), + TABLE_ENTRY(WindowPos3i), + TABLE_ENTRY(WindowPos3iv), + TABLE_ENTRY(WindowPos3s), + TABLE_ENTRY(WindowPos3sv), }; #endif /*UNUSED_TABLE_NAME*/ @@ -4615,3 +5168,4 @@ void *UNUSED_TABLE_NAME[] = { #undef DISPATCH_TABLE_NAME #undef UNUSED_TABLE_NAME #undef TABLE_ENTRY + diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h index 62fba6e00..794b99745 100644 --- a/xc/extras/Mesa/src/glheader.h +++ b/xc/extras/Mesa/src/glheader.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -46,7 +46,7 @@ -#ifdef XFree86Module +#if defined(XFree86LOADER) && defined(IN_MODULE) #include "xf86_ansic.h" #else #include <assert.h> @@ -66,6 +66,7 @@ #endif #endif #include <float.h> +#include <stdarg.h> #ifdef HAVE_CONFIG_H @@ -73,7 +74,6 @@ #endif - #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) # define __WIN32__ # define finite _finite @@ -256,6 +256,17 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #endif +/* + * Provide a reasonable replacement for __FUNCTION__ when using + * non-GNU C compilers. + */ +#if !defined(__GNUC__) +#define STRINGIZE(x) #x +#define STRINGIZE_EVAL(x) STRINGIZE(x) +#define __FUNCTION__ STRINGIZE_EVAL(__FILE__) ", line " STRINGIZE_EVAL(__LINE__) +#endif + + /* Some compilers don't like some of Mesa's const usage */ #ifdef NO_CONST # define CONST @@ -282,5 +293,4 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC typedef union { GLfloat f; GLint i; } fi_type; - #endif /* GLHEADER_H */ diff --git a/xc/extras/Mesa/src/glprocs.h b/xc/extras/Mesa/src/glprocs.h new file mode 100644 index 000000000..af7aea669 --- /dev/null +++ b/xc/extras/Mesa/src/glprocs.h @@ -0,0 +1,814 @@ +/* DO NOT EDIT - This file generated automatically by glprocs.py script */ + +/* This file is only included by glapi.c and is used for + * the GetProcAddress() function + */ + +static struct name_address_offset static_functions[] = { + { "glNewList", (GLvoid *) glNewList, _gloffset_NewList }, + { "glEndList", (GLvoid *) glEndList, _gloffset_EndList }, + { "glCallList", (GLvoid *) glCallList, _gloffset_CallList }, + { "glCallLists", (GLvoid *) glCallLists, _gloffset_CallLists }, + { "glDeleteLists", (GLvoid *) glDeleteLists, _gloffset_DeleteLists }, + { "glGenLists", (GLvoid *) glGenLists, _gloffset_GenLists }, + { "glListBase", (GLvoid *) glListBase, _gloffset_ListBase }, + { "glBegin", (GLvoid *) glBegin, _gloffset_Begin }, + { "glBitmap", (GLvoid *) glBitmap, _gloffset_Bitmap }, + { "glColor3b", (GLvoid *) glColor3b, _gloffset_Color3b }, + { "glColor3bv", (GLvoid *) glColor3bv, _gloffset_Color3bv }, + { "glColor3d", (GLvoid *) glColor3d, _gloffset_Color3d }, + { "glColor3dv", (GLvoid *) glColor3dv, _gloffset_Color3dv }, + { "glColor3f", (GLvoid *) glColor3f, _gloffset_Color3f }, + { "glColor3fv", (GLvoid *) glColor3fv, _gloffset_Color3fv }, + { "glColor3i", (GLvoid *) glColor3i, _gloffset_Color3i }, + { "glColor3iv", (GLvoid *) glColor3iv, _gloffset_Color3iv }, + { "glColor3s", (GLvoid *) glColor3s, _gloffset_Color3s }, + { "glColor3sv", (GLvoid *) glColor3sv, _gloffset_Color3sv }, + { "glColor3ub", (GLvoid *) glColor3ub, _gloffset_Color3ub }, + { "glColor3ubv", (GLvoid *) glColor3ubv, _gloffset_Color3ubv }, + { "glColor3ui", (GLvoid *) glColor3ui, _gloffset_Color3ui }, + { "glColor3uiv", (GLvoid *) glColor3uiv, _gloffset_Color3uiv }, + { "glColor3us", (GLvoid *) glColor3us, _gloffset_Color3us }, + { "glColor3usv", (GLvoid *) glColor3usv, _gloffset_Color3usv }, + { "glColor4b", (GLvoid *) glColor4b, _gloffset_Color4b }, + { "glColor4bv", (GLvoid *) glColor4bv, _gloffset_Color4bv }, + { "glColor4d", (GLvoid *) glColor4d, _gloffset_Color4d }, + { "glColor4dv", (GLvoid *) glColor4dv, _gloffset_Color4dv }, + { "glColor4f", (GLvoid *) glColor4f, _gloffset_Color4f }, + { "glColor4fv", (GLvoid *) glColor4fv, _gloffset_Color4fv }, + { "glColor4i", (GLvoid *) glColor4i, _gloffset_Color4i }, + { "glColor4iv", (GLvoid *) glColor4iv, _gloffset_Color4iv }, + { "glColor4s", (GLvoid *) glColor4s, _gloffset_Color4s }, + { "glColor4sv", (GLvoid *) glColor4sv, _gloffset_Color4sv }, + { "glColor4ub", (GLvoid *) glColor4ub, _gloffset_Color4ub }, + { "glColor4ubv", (GLvoid *) glColor4ubv, _gloffset_Color4ubv }, + { "glColor4ui", (GLvoid *) glColor4ui, _gloffset_Color4ui }, + { "glColor4uiv", (GLvoid *) glColor4uiv, _gloffset_Color4uiv }, + { "glColor4us", (GLvoid *) glColor4us, _gloffset_Color4us }, + { "glColor4usv", (GLvoid *) glColor4usv, _gloffset_Color4usv }, + { "glEdgeFlag", (GLvoid *) glEdgeFlag, _gloffset_EdgeFlag }, + { "glEdgeFlagv", (GLvoid *) glEdgeFlagv, _gloffset_EdgeFlagv }, + { "glEnd", (GLvoid *) glEnd, _gloffset_End }, + { "glIndexd", (GLvoid *) glIndexd, _gloffset_Indexd }, + { "glIndexdv", (GLvoid *) glIndexdv, _gloffset_Indexdv }, + { "glIndexf", (GLvoid *) glIndexf, _gloffset_Indexf }, + { "glIndexfv", (GLvoid *) glIndexfv, _gloffset_Indexfv }, + { "glIndexi", (GLvoid *) glIndexi, _gloffset_Indexi }, + { "glIndexiv", (GLvoid *) glIndexiv, _gloffset_Indexiv }, + { "glIndexs", (GLvoid *) glIndexs, _gloffset_Indexs }, + { "glIndexsv", (GLvoid *) glIndexsv, _gloffset_Indexsv }, + { "glNormal3b", (GLvoid *) glNormal3b, _gloffset_Normal3b }, + { "glNormal3bv", (GLvoid *) glNormal3bv, _gloffset_Normal3bv }, + { "glNormal3d", (GLvoid *) glNormal3d, _gloffset_Normal3d }, + { "glNormal3dv", (GLvoid *) glNormal3dv, _gloffset_Normal3dv }, + { "glNormal3f", (GLvoid *) glNormal3f, _gloffset_Normal3f }, + { "glNormal3fv", (GLvoid *) glNormal3fv, _gloffset_Normal3fv }, + { "glNormal3i", (GLvoid *) glNormal3i, _gloffset_Normal3i }, + { "glNormal3iv", (GLvoid *) glNormal3iv, _gloffset_Normal3iv }, + { "glNormal3s", (GLvoid *) glNormal3s, _gloffset_Normal3s }, + { "glNormal3sv", (GLvoid *) glNormal3sv, _gloffset_Normal3sv }, + { "glRasterPos2d", (GLvoid *) glRasterPos2d, _gloffset_RasterPos2d }, + { "glRasterPos2dv", (GLvoid *) glRasterPos2dv, _gloffset_RasterPos2dv }, + { "glRasterPos2f", (GLvoid *) glRasterPos2f, _gloffset_RasterPos2f }, + { "glRasterPos2fv", (GLvoid *) glRasterPos2fv, _gloffset_RasterPos2fv }, + { "glRasterPos2i", (GLvoid *) glRasterPos2i, _gloffset_RasterPos2i }, + { "glRasterPos2iv", (GLvoid *) glRasterPos2iv, _gloffset_RasterPos2iv }, + { "glRasterPos2s", (GLvoid *) glRasterPos2s, _gloffset_RasterPos2s }, + { "glRasterPos2sv", (GLvoid *) glRasterPos2sv, _gloffset_RasterPos2sv }, + { "glRasterPos3d", (GLvoid *) glRasterPos3d, _gloffset_RasterPos3d }, + { "glRasterPos3dv", (GLvoid *) glRasterPos3dv, _gloffset_RasterPos3dv }, + { "glRasterPos3f", (GLvoid *) glRasterPos3f, _gloffset_RasterPos3f }, + { "glRasterPos3fv", (GLvoid *) glRasterPos3fv, _gloffset_RasterPos3fv }, + { "glRasterPos3i", (GLvoid *) glRasterPos3i, _gloffset_RasterPos3i }, + { "glRasterPos3iv", (GLvoid *) glRasterPos3iv, _gloffset_RasterPos3iv }, + { "glRasterPos3s", (GLvoid *) glRasterPos3s, _gloffset_RasterPos3s }, + { "glRasterPos3sv", (GLvoid *) glRasterPos3sv, _gloffset_RasterPos3sv }, + { "glRasterPos4d", (GLvoid *) glRasterPos4d, _gloffset_RasterPos4d }, + { "glRasterPos4dv", (GLvoid *) glRasterPos4dv, _gloffset_RasterPos4dv }, + { "glRasterPos4f", (GLvoid *) glRasterPos4f, _gloffset_RasterPos4f }, + { "glRasterPos4fv", (GLvoid *) glRasterPos4fv, _gloffset_RasterPos4fv }, + { "glRasterPos4i", (GLvoid *) glRasterPos4i, _gloffset_RasterPos4i }, + { "glRasterPos4iv", (GLvoid *) glRasterPos4iv, _gloffset_RasterPos4iv }, + { "glRasterPos4s", (GLvoid *) glRasterPos4s, _gloffset_RasterPos4s }, + { "glRasterPos4sv", (GLvoid *) glRasterPos4sv, _gloffset_RasterPos4sv }, + { "glRectd", (GLvoid *) glRectd, _gloffset_Rectd }, + { "glRectdv", (GLvoid *) glRectdv, _gloffset_Rectdv }, + { "glRectf", (GLvoid *) glRectf, _gloffset_Rectf }, + { "glRectfv", (GLvoid *) glRectfv, _gloffset_Rectfv }, + { "glRecti", (GLvoid *) glRecti, _gloffset_Recti }, + { "glRectiv", (GLvoid *) glRectiv, _gloffset_Rectiv }, + { "glRects", (GLvoid *) glRects, _gloffset_Rects }, + { "glRectsv", (GLvoid *) glRectsv, _gloffset_Rectsv }, + { "glTexCoord1d", (GLvoid *) glTexCoord1d, _gloffset_TexCoord1d }, + { "glTexCoord1dv", (GLvoid *) glTexCoord1dv, _gloffset_TexCoord1dv }, + { "glTexCoord1f", (GLvoid *) glTexCoord1f, _gloffset_TexCoord1f }, + { "glTexCoord1fv", (GLvoid *) glTexCoord1fv, _gloffset_TexCoord1fv }, + { "glTexCoord1i", (GLvoid *) glTexCoord1i, _gloffset_TexCoord1i }, + { "glTexCoord1iv", (GLvoid *) glTexCoord1iv, _gloffset_TexCoord1iv }, + { "glTexCoord1s", (GLvoid *) glTexCoord1s, _gloffset_TexCoord1s }, + { "glTexCoord1sv", (GLvoid *) glTexCoord1sv, _gloffset_TexCoord1sv }, + { "glTexCoord2d", (GLvoid *) glTexCoord2d, _gloffset_TexCoord2d }, + { "glTexCoord2dv", (GLvoid *) glTexCoord2dv, _gloffset_TexCoord2dv }, + { "glTexCoord2f", (GLvoid *) glTexCoord2f, _gloffset_TexCoord2f }, + { "glTexCoord2fv", (GLvoid *) glTexCoord2fv, _gloffset_TexCoord2fv }, + { "glTexCoord2i", (GLvoid *) glTexCoord2i, _gloffset_TexCoord2i }, + { "glTexCoord2iv", (GLvoid *) glTexCoord2iv, _gloffset_TexCoord2iv }, + { "glTexCoord2s", (GLvoid *) glTexCoord2s, _gloffset_TexCoord2s }, + { "glTexCoord2sv", (GLvoid *) glTexCoord2sv, _gloffset_TexCoord2sv }, + { "glTexCoord3d", (GLvoid *) glTexCoord3d, _gloffset_TexCoord3d }, + { "glTexCoord3dv", (GLvoid *) glTexCoord3dv, _gloffset_TexCoord3dv }, + { "glTexCoord3f", (GLvoid *) glTexCoord3f, _gloffset_TexCoord3f }, + { "glTexCoord3fv", (GLvoid *) glTexCoord3fv, _gloffset_TexCoord3fv }, + { "glTexCoord3i", (GLvoid *) glTexCoord3i, _gloffset_TexCoord3i }, + { "glTexCoord3iv", (GLvoid *) glTexCoord3iv, _gloffset_TexCoord3iv }, + { "glTexCoord3s", (GLvoid *) glTexCoord3s, _gloffset_TexCoord3s }, + { "glTexCoord3sv", (GLvoid *) glTexCoord3sv, _gloffset_TexCoord3sv }, + { "glTexCoord4d", (GLvoid *) glTexCoord4d, _gloffset_TexCoord4d }, + { "glTexCoord4dv", (GLvoid *) glTexCoord4dv, _gloffset_TexCoord4dv }, + { "glTexCoord4f", (GLvoid *) glTexCoord4f, _gloffset_TexCoord4f }, + { "glTexCoord4fv", (GLvoid *) glTexCoord4fv, _gloffset_TexCoord4fv }, + { "glTexCoord4i", (GLvoid *) glTexCoord4i, _gloffset_TexCoord4i }, + { "glTexCoord4iv", (GLvoid *) glTexCoord4iv, _gloffset_TexCoord4iv }, + { "glTexCoord4s", (GLvoid *) glTexCoord4s, _gloffset_TexCoord4s }, + { "glTexCoord4sv", (GLvoid *) glTexCoord4sv, _gloffset_TexCoord4sv }, + { "glVertex2d", (GLvoid *) glVertex2d, _gloffset_Vertex2d }, + { "glVertex2dv", (GLvoid *) glVertex2dv, _gloffset_Vertex2dv }, + { "glVertex2f", (GLvoid *) glVertex2f, _gloffset_Vertex2f }, + { "glVertex2fv", (GLvoid *) glVertex2fv, _gloffset_Vertex2fv }, + { "glVertex2i", (GLvoid *) glVertex2i, _gloffset_Vertex2i }, + { "glVertex2iv", (GLvoid *) glVertex2iv, _gloffset_Vertex2iv }, + { "glVertex2s", (GLvoid *) glVertex2s, _gloffset_Vertex2s }, + { "glVertex2sv", (GLvoid *) glVertex2sv, _gloffset_Vertex2sv }, + { "glVertex3d", (GLvoid *) glVertex3d, _gloffset_Vertex3d }, + { "glVertex3dv", (GLvoid *) glVertex3dv, _gloffset_Vertex3dv }, + { "glVertex3f", (GLvoid *) glVertex3f, _gloffset_Vertex3f }, + { "glVertex3fv", (GLvoid *) glVertex3fv, _gloffset_Vertex3fv }, + { "glVertex3i", (GLvoid *) glVertex3i, _gloffset_Vertex3i }, + { "glVertex3iv", (GLvoid *) glVertex3iv, _gloffset_Vertex3iv }, + { "glVertex3s", (GLvoid *) glVertex3s, _gloffset_Vertex3s }, + { "glVertex3sv", (GLvoid *) glVertex3sv, _gloffset_Vertex3sv }, + { "glVertex4d", (GLvoid *) glVertex4d, _gloffset_Vertex4d }, + { "glVertex4dv", (GLvoid *) glVertex4dv, _gloffset_Vertex4dv }, + { "glVertex4f", (GLvoid *) glVertex4f, _gloffset_Vertex4f }, + { "glVertex4fv", (GLvoid *) glVertex4fv, _gloffset_Vertex4fv }, + { "glVertex4i", (GLvoid *) glVertex4i, _gloffset_Vertex4i }, + { "glVertex4iv", (GLvoid *) glVertex4iv, _gloffset_Vertex4iv }, + { "glVertex4s", (GLvoid *) glVertex4s, _gloffset_Vertex4s }, + { "glVertex4sv", (GLvoid *) glVertex4sv, _gloffset_Vertex4sv }, + { "glClipPlane", (GLvoid *) glClipPlane, _gloffset_ClipPlane }, + { "glColorMaterial", (GLvoid *) glColorMaterial, _gloffset_ColorMaterial }, + { "glCullFace", (GLvoid *) glCullFace, _gloffset_CullFace }, + { "glFogf", (GLvoid *) glFogf, _gloffset_Fogf }, + { "glFogfv", (GLvoid *) glFogfv, _gloffset_Fogfv }, + { "glFogi", (GLvoid *) glFogi, _gloffset_Fogi }, + { "glFogiv", (GLvoid *) glFogiv, _gloffset_Fogiv }, + { "glFrontFace", (GLvoid *) glFrontFace, _gloffset_FrontFace }, + { "glHint", (GLvoid *) glHint, _gloffset_Hint }, + { "glLightf", (GLvoid *) glLightf, _gloffset_Lightf }, + { "glLightfv", (GLvoid *) glLightfv, _gloffset_Lightfv }, + { "glLighti", (GLvoid *) glLighti, _gloffset_Lighti }, + { "glLightiv", (GLvoid *) glLightiv, _gloffset_Lightiv }, + { "glLightModelf", (GLvoid *) glLightModelf, _gloffset_LightModelf }, + { "glLightModelfv", (GLvoid *) glLightModelfv, _gloffset_LightModelfv }, + { "glLightModeli", (GLvoid *) glLightModeli, _gloffset_LightModeli }, + { "glLightModeliv", (GLvoid *) glLightModeliv, _gloffset_LightModeliv }, + { "glLineStipple", (GLvoid *) glLineStipple, _gloffset_LineStipple }, + { "glLineWidth", (GLvoid *) glLineWidth, _gloffset_LineWidth }, + { "glMaterialf", (GLvoid *) glMaterialf, _gloffset_Materialf }, + { "glMaterialfv", (GLvoid *) glMaterialfv, _gloffset_Materialfv }, + { "glMateriali", (GLvoid *) glMateriali, _gloffset_Materiali }, + { "glMaterialiv", (GLvoid *) glMaterialiv, _gloffset_Materialiv }, + { "glPointSize", (GLvoid *) glPointSize, _gloffset_PointSize }, + { "glPolygonMode", (GLvoid *) glPolygonMode, _gloffset_PolygonMode }, + { "glPolygonStipple", (GLvoid *) glPolygonStipple, _gloffset_PolygonStipple }, + { "glScissor", (GLvoid *) glScissor, _gloffset_Scissor }, + { "glShadeModel", (GLvoid *) glShadeModel, _gloffset_ShadeModel }, + { "glTexParameterf", (GLvoid *) glTexParameterf, _gloffset_TexParameterf }, + { "glTexParameterfv", (GLvoid *) glTexParameterfv, _gloffset_TexParameterfv }, + { "glTexParameteri", (GLvoid *) glTexParameteri, _gloffset_TexParameteri }, + { "glTexParameteriv", (GLvoid *) glTexParameteriv, _gloffset_TexParameteriv }, + { "glTexImage1D", (GLvoid *) glTexImage1D, _gloffset_TexImage1D }, + { "glTexImage2D", (GLvoid *) glTexImage2D, _gloffset_TexImage2D }, + { "glTexEnvf", (GLvoid *) glTexEnvf, _gloffset_TexEnvf }, + { "glTexEnvfv", (GLvoid *) glTexEnvfv, _gloffset_TexEnvfv }, + { "glTexEnvi", (GLvoid *) glTexEnvi, _gloffset_TexEnvi }, + { "glTexEnviv", (GLvoid *) glTexEnviv, _gloffset_TexEnviv }, + { "glTexGend", (GLvoid *) glTexGend, _gloffset_TexGend }, + { "glTexGendv", (GLvoid *) glTexGendv, _gloffset_TexGendv }, + { "glTexGenf", (GLvoid *) glTexGenf, _gloffset_TexGenf }, + { "glTexGenfv", (GLvoid *) glTexGenfv, _gloffset_TexGenfv }, + { "glTexGeni", (GLvoid *) glTexGeni, _gloffset_TexGeni }, + { "glTexGeniv", (GLvoid *) glTexGeniv, _gloffset_TexGeniv }, + { "glFeedbackBuffer", (GLvoid *) glFeedbackBuffer, _gloffset_FeedbackBuffer }, + { "glSelectBuffer", (GLvoid *) glSelectBuffer, _gloffset_SelectBuffer }, + { "glRenderMode", (GLvoid *) glRenderMode, _gloffset_RenderMode }, + { "glInitNames", (GLvoid *) glInitNames, _gloffset_InitNames }, + { "glLoadName", (GLvoid *) glLoadName, _gloffset_LoadName }, + { "glPassThrough", (GLvoid *) glPassThrough, _gloffset_PassThrough }, + { "glPopName", (GLvoid *) glPopName, _gloffset_PopName }, + { "glPushName", (GLvoid *) glPushName, _gloffset_PushName }, + { "glDrawBuffer", (GLvoid *) glDrawBuffer, _gloffset_DrawBuffer }, + { "glClear", (GLvoid *) glClear, _gloffset_Clear }, + { "glClearAccum", (GLvoid *) glClearAccum, _gloffset_ClearAccum }, + { "glClearIndex", (GLvoid *) glClearIndex, _gloffset_ClearIndex }, + { "glClearColor", (GLvoid *) glClearColor, _gloffset_ClearColor }, + { "glClearStencil", (GLvoid *) glClearStencil, _gloffset_ClearStencil }, + { "glClearDepth", (GLvoid *) glClearDepth, _gloffset_ClearDepth }, + { "glStencilMask", (GLvoid *) glStencilMask, _gloffset_StencilMask }, + { "glColorMask", (GLvoid *) glColorMask, _gloffset_ColorMask }, + { "glDepthMask", (GLvoid *) glDepthMask, _gloffset_DepthMask }, + { "glIndexMask", (GLvoid *) glIndexMask, _gloffset_IndexMask }, + { "glAccum", (GLvoid *) glAccum, _gloffset_Accum }, + { "glDisable", (GLvoid *) glDisable, _gloffset_Disable }, + { "glEnable", (GLvoid *) glEnable, _gloffset_Enable }, + { "glFinish", (GLvoid *) glFinish, _gloffset_Finish }, + { "glFlush", (GLvoid *) glFlush, _gloffset_Flush }, + { "glPopAttrib", (GLvoid *) glPopAttrib, _gloffset_PopAttrib }, + { "glPushAttrib", (GLvoid *) glPushAttrib, _gloffset_PushAttrib }, + { "glMap1d", (GLvoid *) glMap1d, _gloffset_Map1d }, + { "glMap1f", (GLvoid *) glMap1f, _gloffset_Map1f }, + { "glMap2d", (GLvoid *) glMap2d, _gloffset_Map2d }, + { "glMap2f", (GLvoid *) glMap2f, _gloffset_Map2f }, + { "glMapGrid1d", (GLvoid *) glMapGrid1d, _gloffset_MapGrid1d }, + { "glMapGrid1f", (GLvoid *) glMapGrid1f, _gloffset_MapGrid1f }, + { "glMapGrid2d", (GLvoid *) glMapGrid2d, _gloffset_MapGrid2d }, + { "glMapGrid2f", (GLvoid *) glMapGrid2f, _gloffset_MapGrid2f }, + { "glEvalCoord1d", (GLvoid *) glEvalCoord1d, _gloffset_EvalCoord1d }, + { "glEvalCoord1dv", (GLvoid *) glEvalCoord1dv, _gloffset_EvalCoord1dv }, + { "glEvalCoord1f", (GLvoid *) glEvalCoord1f, _gloffset_EvalCoord1f }, + { "glEvalCoord1fv", (GLvoid *) glEvalCoord1fv, _gloffset_EvalCoord1fv }, + { "glEvalCoord2d", (GLvoid *) glEvalCoord2d, _gloffset_EvalCoord2d }, + { "glEvalCoord2dv", (GLvoid *) glEvalCoord2dv, _gloffset_EvalCoord2dv }, + { "glEvalCoord2f", (GLvoid *) glEvalCoord2f, _gloffset_EvalCoord2f }, + { "glEvalCoord2fv", (GLvoid *) glEvalCoord2fv, _gloffset_EvalCoord2fv }, + { "glEvalMesh1", (GLvoid *) glEvalMesh1, _gloffset_EvalMesh1 }, + { "glEvalPoint1", (GLvoid *) glEvalPoint1, _gloffset_EvalPoint1 }, + { "glEvalMesh2", (GLvoid *) glEvalMesh2, _gloffset_EvalMesh2 }, + { "glEvalPoint2", (GLvoid *) glEvalPoint2, _gloffset_EvalPoint2 }, + { "glAlphaFunc", (GLvoid *) glAlphaFunc, _gloffset_AlphaFunc }, + { "glBlendFunc", (GLvoid *) glBlendFunc, _gloffset_BlendFunc }, + { "glLogicOp", (GLvoid *) glLogicOp, _gloffset_LogicOp }, + { "glStencilFunc", (GLvoid *) glStencilFunc, _gloffset_StencilFunc }, + { "glStencilOp", (GLvoid *) glStencilOp, _gloffset_StencilOp }, + { "glDepthFunc", (GLvoid *) glDepthFunc, _gloffset_DepthFunc }, + { "glPixelZoom", (GLvoid *) glPixelZoom, _gloffset_PixelZoom }, + { "glPixelTransferf", (GLvoid *) glPixelTransferf, _gloffset_PixelTransferf }, + { "glPixelTransferi", (GLvoid *) glPixelTransferi, _gloffset_PixelTransferi }, + { "glPixelStoref", (GLvoid *) glPixelStoref, _gloffset_PixelStoref }, + { "glPixelStorei", (GLvoid *) glPixelStorei, _gloffset_PixelStorei }, + { "glPixelMapfv", (GLvoid *) glPixelMapfv, _gloffset_PixelMapfv }, + { "glPixelMapuiv", (GLvoid *) glPixelMapuiv, _gloffset_PixelMapuiv }, + { "glPixelMapusv", (GLvoid *) glPixelMapusv, _gloffset_PixelMapusv }, + { "glReadBuffer", (GLvoid *) glReadBuffer, _gloffset_ReadBuffer }, + { "glCopyPixels", (GLvoid *) glCopyPixels, _gloffset_CopyPixels }, + { "glReadPixels", (GLvoid *) glReadPixels, _gloffset_ReadPixels }, + { "glDrawPixels", (GLvoid *) glDrawPixels, _gloffset_DrawPixels }, + { "glGetBooleanv", (GLvoid *) glGetBooleanv, _gloffset_GetBooleanv }, + { "glGetClipPlane", (GLvoid *) glGetClipPlane, _gloffset_GetClipPlane }, + { "glGetDoublev", (GLvoid *) glGetDoublev, _gloffset_GetDoublev }, + { "glGetError", (GLvoid *) glGetError, _gloffset_GetError }, + { "glGetFloatv", (GLvoid *) glGetFloatv, _gloffset_GetFloatv }, + { "glGetIntegerv", (GLvoid *) glGetIntegerv, _gloffset_GetIntegerv }, + { "glGetLightfv", (GLvoid *) glGetLightfv, _gloffset_GetLightfv }, + { "glGetLightiv", (GLvoid *) glGetLightiv, _gloffset_GetLightiv }, + { "glGetMapdv", (GLvoid *) glGetMapdv, _gloffset_GetMapdv }, + { "glGetMapfv", (GLvoid *) glGetMapfv, _gloffset_GetMapfv }, + { "glGetMapiv", (GLvoid *) glGetMapiv, _gloffset_GetMapiv }, + { "glGetMaterialfv", (GLvoid *) glGetMaterialfv, _gloffset_GetMaterialfv }, + { "glGetMaterialiv", (GLvoid *) glGetMaterialiv, _gloffset_GetMaterialiv }, + { "glGetPixelMapfv", (GLvoid *) glGetPixelMapfv, _gloffset_GetPixelMapfv }, + { "glGetPixelMapuiv", (GLvoid *) glGetPixelMapuiv, _gloffset_GetPixelMapuiv }, + { "glGetPixelMapusv", (GLvoid *) glGetPixelMapusv, _gloffset_GetPixelMapusv }, + { "glGetPolygonStipple", (GLvoid *) glGetPolygonStipple, _gloffset_GetPolygonStipple }, + { "glGetString", (GLvoid *) glGetString, _gloffset_GetString }, + { "glGetTexEnvfv", (GLvoid *) glGetTexEnvfv, _gloffset_GetTexEnvfv }, + { "glGetTexEnviv", (GLvoid *) glGetTexEnviv, _gloffset_GetTexEnviv }, + { "glGetTexGendv", (GLvoid *) glGetTexGendv, _gloffset_GetTexGendv }, + { "glGetTexGenfv", (GLvoid *) glGetTexGenfv, _gloffset_GetTexGenfv }, + { "glGetTexGeniv", (GLvoid *) glGetTexGeniv, _gloffset_GetTexGeniv }, + { "glGetTexImage", (GLvoid *) glGetTexImage, _gloffset_GetTexImage }, + { "glGetTexParameterfv", (GLvoid *) glGetTexParameterfv, _gloffset_GetTexParameterfv }, + { "glGetTexParameteriv", (GLvoid *) glGetTexParameteriv, _gloffset_GetTexParameteriv }, + { "glGetTexLevelParameterfv", (GLvoid *) glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv }, + { "glGetTexLevelParameteriv", (GLvoid *) glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv }, + { "glIsEnabled", (GLvoid *) glIsEnabled, _gloffset_IsEnabled }, + { "glIsList", (GLvoid *) glIsList, _gloffset_IsList }, + { "glDepthRange", (GLvoid *) glDepthRange, _gloffset_DepthRange }, + { "glFrustum", (GLvoid *) glFrustum, _gloffset_Frustum }, + { "glLoadIdentity", (GLvoid *) glLoadIdentity, _gloffset_LoadIdentity }, + { "glLoadMatrixf", (GLvoid *) glLoadMatrixf, _gloffset_LoadMatrixf }, + { "glLoadMatrixd", (GLvoid *) glLoadMatrixd, _gloffset_LoadMatrixd }, + { "glMatrixMode", (GLvoid *) glMatrixMode, _gloffset_MatrixMode }, + { "glMultMatrixf", (GLvoid *) glMultMatrixf, _gloffset_MultMatrixf }, + { "glMultMatrixd", (GLvoid *) glMultMatrixd, _gloffset_MultMatrixd }, + { "glOrtho", (GLvoid *) glOrtho, _gloffset_Ortho }, + { "glPopMatrix", (GLvoid *) glPopMatrix, _gloffset_PopMatrix }, + { "glPushMatrix", (GLvoid *) glPushMatrix, _gloffset_PushMatrix }, + { "glRotated", (GLvoid *) glRotated, _gloffset_Rotated }, + { "glRotatef", (GLvoid *) glRotatef, _gloffset_Rotatef }, + { "glScaled", (GLvoid *) glScaled, _gloffset_Scaled }, + { "glScalef", (GLvoid *) glScalef, _gloffset_Scalef }, + { "glTranslated", (GLvoid *) glTranslated, _gloffset_Translated }, + { "glTranslatef", (GLvoid *) glTranslatef, _gloffset_Translatef }, + { "glViewport", (GLvoid *) glViewport, _gloffset_Viewport }, + { "glArrayElement", (GLvoid *) glArrayElement, _gloffset_ArrayElement }, + { "glColorPointer", (GLvoid *) glColorPointer, _gloffset_ColorPointer }, + { "glDisableClientState", (GLvoid *) glDisableClientState, _gloffset_DisableClientState }, + { "glDrawArrays", (GLvoid *) glDrawArrays, _gloffset_DrawArrays }, + { "glDrawElements", (GLvoid *) glDrawElements, _gloffset_DrawElements }, + { "glEdgeFlagPointer", (GLvoid *) glEdgeFlagPointer, _gloffset_EdgeFlagPointer }, + { "glEnableClientState", (GLvoid *) glEnableClientState, _gloffset_EnableClientState }, + { "glGetPointerv", (GLvoid *) glGetPointerv, _gloffset_GetPointerv }, + { "glIndexPointer", (GLvoid *) glIndexPointer, _gloffset_IndexPointer }, + { "glInterleavedArrays", (GLvoid *) glInterleavedArrays, _gloffset_InterleavedArrays }, + { "glNormalPointer", (GLvoid *) glNormalPointer, _gloffset_NormalPointer }, + { "glTexCoordPointer", (GLvoid *) glTexCoordPointer, _gloffset_TexCoordPointer }, + { "glVertexPointer", (GLvoid *) glVertexPointer, _gloffset_VertexPointer }, + { "glPolygonOffset", (GLvoid *) glPolygonOffset, _gloffset_PolygonOffset }, + { "glCopyTexImage1D", (GLvoid *) glCopyTexImage1D, _gloffset_CopyTexImage1D }, + { "glCopyTexImage2D", (GLvoid *) glCopyTexImage2D, _gloffset_CopyTexImage2D }, + { "glCopyTexSubImage1D", (GLvoid *) glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D }, + { "glCopyTexSubImage2D", (GLvoid *) glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D }, + { "glTexSubImage1D", (GLvoid *) glTexSubImage1D, _gloffset_TexSubImage1D }, + { "glTexSubImage2D", (GLvoid *) glTexSubImage2D, _gloffset_TexSubImage2D }, + { "glAreTexturesResident", (GLvoid *) glAreTexturesResident, _gloffset_AreTexturesResident }, + { "glBindTexture", (GLvoid *) glBindTexture, _gloffset_BindTexture }, + { "glDeleteTextures", (GLvoid *) glDeleteTextures, _gloffset_DeleteTextures }, + { "glGenTextures", (GLvoid *) glGenTextures, _gloffset_GenTextures }, + { "glIsTexture", (GLvoid *) glIsTexture, _gloffset_IsTexture }, + { "glPrioritizeTextures", (GLvoid *) glPrioritizeTextures, _gloffset_PrioritizeTextures }, + { "glIndexub", (GLvoid *) glIndexub, _gloffset_Indexub }, + { "glIndexubv", (GLvoid *) glIndexubv, _gloffset_Indexubv }, + { "glPopClientAttrib", (GLvoid *) glPopClientAttrib, _gloffset_PopClientAttrib }, + { "glPushClientAttrib", (GLvoid *) glPushClientAttrib, _gloffset_PushClientAttrib }, + { "glBlendColor", (GLvoid *) glBlendColor, _gloffset_BlendColor }, + { "glBlendEquation", (GLvoid *) glBlendEquation, _gloffset_BlendEquation }, + { "glDrawRangeElements", (GLvoid *) glDrawRangeElements, _gloffset_DrawRangeElements }, + { "glColorTable", (GLvoid *) glColorTable, _gloffset_ColorTable }, + { "glColorTableParameterfv", (GLvoid *) glColorTableParameterfv, _gloffset_ColorTableParameterfv }, + { "glColorTableParameteriv", (GLvoid *) glColorTableParameteriv, _gloffset_ColorTableParameteriv }, + { "glCopyColorTable", (GLvoid *) glCopyColorTable, _gloffset_CopyColorTable }, + { "glGetColorTable", (GLvoid *) glGetColorTable, _gloffset_GetColorTable }, + { "glGetColorTableParameterfv", (GLvoid *) glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv }, + { "glGetColorTableParameteriv", (GLvoid *) glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv }, + { "glColorSubTable", (GLvoid *) glColorSubTable, _gloffset_ColorSubTable }, + { "glCopyColorSubTable", (GLvoid *) glCopyColorSubTable, _gloffset_CopyColorSubTable }, + { "glConvolutionFilter1D", (GLvoid *) glConvolutionFilter1D, _gloffset_ConvolutionFilter1D }, + { "glConvolutionFilter2D", (GLvoid *) glConvolutionFilter2D, _gloffset_ConvolutionFilter2D }, + { "glConvolutionParameterf", (GLvoid *) glConvolutionParameterf, _gloffset_ConvolutionParameterf }, + { "glConvolutionParameterfv", (GLvoid *) glConvolutionParameterfv, _gloffset_ConvolutionParameterfv }, + { "glConvolutionParameteri", (GLvoid *) glConvolutionParameteri, _gloffset_ConvolutionParameteri }, + { "glConvolutionParameteriv", (GLvoid *) glConvolutionParameteriv, _gloffset_ConvolutionParameteriv }, + { "glCopyConvolutionFilter1D", (GLvoid *) glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D }, + { "glCopyConvolutionFilter2D", (GLvoid *) glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D }, + { "glGetConvolutionFilter", (GLvoid *) glGetConvolutionFilter, _gloffset_GetConvolutionFilter }, + { "glGetConvolutionParameterfv", (GLvoid *) glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv }, + { "glGetConvolutionParameteriv", (GLvoid *) glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv }, + { "glGetSeparableFilter", (GLvoid *) glGetSeparableFilter, _gloffset_GetSeparableFilter }, + { "glSeparableFilter2D", (GLvoid *) glSeparableFilter2D, _gloffset_SeparableFilter2D }, + { "glGetHistogram", (GLvoid *) glGetHistogram, _gloffset_GetHistogram }, + { "glGetHistogramParameterfv", (GLvoid *) glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv }, + { "glGetHistogramParameteriv", (GLvoid *) glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv }, + { "glGetMinmax", (GLvoid *) glGetMinmax, _gloffset_GetMinmax }, + { "glGetMinmaxParameterfv", (GLvoid *) glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv }, + { "glGetMinmaxParameteriv", (GLvoid *) glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv }, + { "glHistogram", (GLvoid *) glHistogram, _gloffset_Histogram }, + { "glMinmax", (GLvoid *) glMinmax, _gloffset_Minmax }, + { "glResetHistogram", (GLvoid *) glResetHistogram, _gloffset_ResetHistogram }, + { "glResetMinmax", (GLvoid *) glResetMinmax, _gloffset_ResetMinmax }, + { "glTexImage3D", (GLvoid *) glTexImage3D, _gloffset_TexImage3D }, + { "glTexSubImage3D", (GLvoid *) glTexSubImage3D, _gloffset_TexSubImage3D }, + { "glCopyTexSubImage3D", (GLvoid *) glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D }, + { "glActiveTextureARB", (GLvoid *) glActiveTextureARB, _gloffset_ActiveTextureARB }, + { "glClientActiveTextureARB", (GLvoid *) glClientActiveTextureARB, _gloffset_ClientActiveTextureARB }, + { "glMultiTexCoord1dARB", (GLvoid *) glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB }, + { "glMultiTexCoord1dvARB", (GLvoid *) glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB }, + { "glMultiTexCoord1fARB", (GLvoid *) glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB }, + { "glMultiTexCoord1fvARB", (GLvoid *) glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB }, + { "glMultiTexCoord1iARB", (GLvoid *) glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB }, + { "glMultiTexCoord1ivARB", (GLvoid *) glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB }, + { "glMultiTexCoord1sARB", (GLvoid *) glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB }, + { "glMultiTexCoord1svARB", (GLvoid *) glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB }, + { "glMultiTexCoord2dARB", (GLvoid *) glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB }, + { "glMultiTexCoord2dvARB", (GLvoid *) glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB }, + { "glMultiTexCoord2fARB", (GLvoid *) glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB }, + { "glMultiTexCoord2fvARB", (GLvoid *) glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB }, + { "glMultiTexCoord2iARB", (GLvoid *) glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB }, + { "glMultiTexCoord2ivARB", (GLvoid *) glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB }, + { "glMultiTexCoord2sARB", (GLvoid *) glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB }, + { "glMultiTexCoord2svARB", (GLvoid *) glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB }, + { "glMultiTexCoord3dARB", (GLvoid *) glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB }, + { "glMultiTexCoord3dvARB", (GLvoid *) glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB }, + { "glMultiTexCoord3fARB", (GLvoid *) glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB }, + { "glMultiTexCoord3fvARB", (GLvoid *) glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB }, + { "glMultiTexCoord3iARB", (GLvoid *) glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB }, + { "glMultiTexCoord3ivARB", (GLvoid *) glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB }, + { "glMultiTexCoord3sARB", (GLvoid *) glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB }, + { "glMultiTexCoord3svARB", (GLvoid *) glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB }, + { "glMultiTexCoord4dARB", (GLvoid *) glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB }, + { "glMultiTexCoord4dvARB", (GLvoid *) glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB }, + { "glMultiTexCoord4fARB", (GLvoid *) glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB }, + { "glMultiTexCoord4fvARB", (GLvoid *) glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB }, + { "glMultiTexCoord4iARB", (GLvoid *) glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB }, + { "glMultiTexCoord4ivARB", (GLvoid *) glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB }, + { "glMultiTexCoord4sARB", (GLvoid *) glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB }, + { "glMultiTexCoord4svARB", (GLvoid *) glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB }, + { "glLoadTransposeMatrixfARB", (GLvoid *) glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB }, + { "glLoadTransposeMatrixdARB", (GLvoid *) glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB }, + { "glMultTransposeMatrixfARB", (GLvoid *) glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB }, + { "glMultTransposeMatrixdARB", (GLvoid *) glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB }, + { "glSampleCoverageARB", (GLvoid *) glSampleCoverageARB, _gloffset_SampleCoverageARB }, + { "glCompressedTexImage3DARB", (GLvoid *) glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB }, + { "glCompressedTexImage2DARB", (GLvoid *) glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB }, + { "glCompressedTexImage1DARB", (GLvoid *) glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB }, + { "glCompressedTexSubImage3DARB", (GLvoid *) glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB }, + { "glCompressedTexSubImage2DARB", (GLvoid *) glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB }, + { "glCompressedTexSubImage1DARB", (GLvoid *) glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB }, + { "glGetCompressedTexImageARB", (GLvoid *) glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB }, + { "glActiveTexture", (GLvoid *) glActiveTexture, _gloffset_ActiveTextureARB }, + { "glClientActiveTexture", (GLvoid *) glClientActiveTexture, _gloffset_ClientActiveTextureARB }, + { "glMultiTexCoord1d", (GLvoid *) glMultiTexCoord1d, _gloffset_MultiTexCoord1dARB }, + { "glMultiTexCoord1dv", (GLvoid *) glMultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB }, + { "glMultiTexCoord1f", (GLvoid *) glMultiTexCoord1f, _gloffset_MultiTexCoord1fARB }, + { "glMultiTexCoord1fv", (GLvoid *) glMultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB }, + { "glMultiTexCoord1i", (GLvoid *) glMultiTexCoord1i, _gloffset_MultiTexCoord1iARB }, + { "glMultiTexCoord1iv", (GLvoid *) glMultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB }, + { "glMultiTexCoord1s", (GLvoid *) glMultiTexCoord1s, _gloffset_MultiTexCoord1sARB }, + { "glMultiTexCoord1sv", (GLvoid *) glMultiTexCoord1sv, _gloffset_MultiTexCoord1svARB }, + { "glMultiTexCoord2d", (GLvoid *) glMultiTexCoord2d, _gloffset_MultiTexCoord2dARB }, + { "glMultiTexCoord2dv", (GLvoid *) glMultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB }, + { "glMultiTexCoord2f", (GLvoid *) glMultiTexCoord2f, _gloffset_MultiTexCoord2fARB }, + { "glMultiTexCoord2fv", (GLvoid *) glMultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB }, + { "glMultiTexCoord2i", (GLvoid *) glMultiTexCoord2i, _gloffset_MultiTexCoord2iARB }, + { "glMultiTexCoord2iv", (GLvoid *) glMultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB }, + { "glMultiTexCoord2s", (GLvoid *) glMultiTexCoord2s, _gloffset_MultiTexCoord2sARB }, + { "glMultiTexCoord2sv", (GLvoid *) glMultiTexCoord2sv, _gloffset_MultiTexCoord2svARB }, + { "glMultiTexCoord3d", (GLvoid *) glMultiTexCoord3d, _gloffset_MultiTexCoord3dARB }, + { "glMultiTexCoord3dv", (GLvoid *) glMultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB }, + { "glMultiTexCoord3f", (GLvoid *) glMultiTexCoord3f, _gloffset_MultiTexCoord3fARB }, + { "glMultiTexCoord3fv", (GLvoid *) glMultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB }, + { "glMultiTexCoord3i", (GLvoid *) glMultiTexCoord3i, _gloffset_MultiTexCoord3iARB }, + { "glMultiTexCoord3iv", (GLvoid *) glMultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB }, + { "glMultiTexCoord3s", (GLvoid *) glMultiTexCoord3s, _gloffset_MultiTexCoord3sARB }, + { "glMultiTexCoord3sv", (GLvoid *) glMultiTexCoord3sv, _gloffset_MultiTexCoord3svARB }, + { "glMultiTexCoord4d", (GLvoid *) glMultiTexCoord4d, _gloffset_MultiTexCoord4dARB }, + { "glMultiTexCoord4dv", (GLvoid *) glMultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB }, + { "glMultiTexCoord4f", (GLvoid *) glMultiTexCoord4f, _gloffset_MultiTexCoord4fARB }, + { "glMultiTexCoord4fv", (GLvoid *) glMultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB }, + { "glMultiTexCoord4i", (GLvoid *) glMultiTexCoord4i, _gloffset_MultiTexCoord4iARB }, + { "glMultiTexCoord4iv", (GLvoid *) glMultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB }, + { "glMultiTexCoord4s", (GLvoid *) glMultiTexCoord4s, _gloffset_MultiTexCoord4sARB }, + { "glMultiTexCoord4sv", (GLvoid *) glMultiTexCoord4sv, _gloffset_MultiTexCoord4svARB }, + { "glLoadTransposeMatrixf", (GLvoid *) glLoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB }, + { "glLoadTransposeMatrixd", (GLvoid *) glLoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB }, + { "glMultTransposeMatrixf", (GLvoid *) glMultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB }, + { "glMultTransposeMatrixd", (GLvoid *) glMultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB }, + { "glSampleCoverage", (GLvoid *) glSampleCoverage, _gloffset_SampleCoverageARB }, + { "glCompressedTexImage3D", (GLvoid *) glCompressedTexImage3D, _gloffset_CompressedTexImage3DARB }, + { "glCompressedTexImage2D", (GLvoid *) glCompressedTexImage2D, _gloffset_CompressedTexImage2DARB }, + { "glCompressedTexImage1D", (GLvoid *) glCompressedTexImage1D, _gloffset_CompressedTexImage1DARB }, + { "glCompressedTexSubImage3D", (GLvoid *) glCompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB }, + { "glCompressedTexSubImage2D", (GLvoid *) glCompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB }, + { "glCompressedTexSubImage1D", (GLvoid *) glCompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB }, + { "glGetCompressedTexImage", (GLvoid *) glGetCompressedTexImage, _gloffset_GetCompressedTexImageARB }, + { "glBlendColorEXT", (GLvoid *) glBlendColorEXT, _gloffset_BlendColor }, + { "glPolygonOffsetEXT", (GLvoid *) glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT }, + { "glTexImage3DEXT", (GLvoid *) glTexImage3DEXT, _gloffset_TexImage3D }, + { "glTexSubImage3DEXT", (GLvoid *) glTexSubImage3DEXT, _gloffset_TexSubImage3D }, + { "glGetTexFilterFuncSGIS", (GLvoid *) glGetTexFilterFuncSGIS, _gloffset_GetTexFilterFuncSGIS }, + { "glTexFilterFuncSGIS", (GLvoid *) glTexFilterFuncSGIS, _gloffset_TexFilterFuncSGIS }, + { "glTexSubImage1DEXT", (GLvoid *) glTexSubImage1DEXT, _gloffset_TexSubImage1D }, + { "glTexSubImage2DEXT", (GLvoid *) glTexSubImage2DEXT, _gloffset_TexSubImage2D }, + { "glCopyTexImage1DEXT", (GLvoid *) glCopyTexImage1DEXT, _gloffset_CopyTexImage1D }, + { "glCopyTexImage2DEXT", (GLvoid *) glCopyTexImage2DEXT, _gloffset_CopyTexImage2D }, + { "glCopyTexSubImage1DEXT", (GLvoid *) glCopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D }, + { "glCopyTexSubImage2DEXT", (GLvoid *) glCopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D }, + { "glCopyTexSubImage3DEXT", (GLvoid *) glCopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D }, + { "glGetHistogramEXT", (GLvoid *) glGetHistogramEXT, _gloffset_GetHistogramEXT }, + { "glGetHistogramParameterfvEXT", (GLvoid *) glGetHistogramParameterfvEXT, _gloffset_GetHistogramParameterfvEXT }, + { "glGetHistogramParameterivEXT", (GLvoid *) glGetHistogramParameterivEXT, _gloffset_GetHistogramParameterivEXT }, + { "glGetMinmaxEXT", (GLvoid *) glGetMinmaxEXT, _gloffset_GetMinmaxEXT }, + { "glGetMinmaxParameterfvEXT", (GLvoid *) glGetMinmaxParameterfvEXT, _gloffset_GetMinmaxParameterfvEXT }, + { "glGetMinmaxParameterivEXT", (GLvoid *) glGetMinmaxParameterivEXT, _gloffset_GetMinmaxParameterivEXT }, + { "glHistogramEXT", (GLvoid *) glHistogramEXT, _gloffset_Histogram }, + { "glMinmaxEXT", (GLvoid *) glMinmaxEXT, _gloffset_Minmax }, + { "glResetHistogramEXT", (GLvoid *) glResetHistogramEXT, _gloffset_ResetHistogram }, + { "glResetMinmaxEXT", (GLvoid *) glResetMinmaxEXT, _gloffset_ResetMinmax }, + { "glConvolutionFilter1DEXT", (GLvoid *) glConvolutionFilter1DEXT, _gloffset_ConvolutionFilter1D }, + { "glConvolutionFilter2DEXT", (GLvoid *) glConvolutionFilter2DEXT, _gloffset_ConvolutionFilter2D }, + { "glConvolutionParameterfEXT", (GLvoid *) glConvolutionParameterfEXT, _gloffset_ConvolutionParameterf }, + { "glConvolutionParameterfvEXT", (GLvoid *) glConvolutionParameterfvEXT, _gloffset_ConvolutionParameterfv }, + { "glConvolutionParameteriEXT", (GLvoid *) glConvolutionParameteriEXT, _gloffset_ConvolutionParameteri }, + { "glConvolutionParameterivEXT", (GLvoid *) glConvolutionParameterivEXT, _gloffset_ConvolutionParameteriv }, + { "glCopyConvolutionFilter1DEXT", (GLvoid *) glCopyConvolutionFilter1DEXT, _gloffset_CopyConvolutionFilter1D }, + { "glCopyConvolutionFilter2DEXT", (GLvoid *) glCopyConvolutionFilter2DEXT, _gloffset_CopyConvolutionFilter2D }, + { "glGetConvolutionFilterEXT", (GLvoid *) glGetConvolutionFilterEXT, _gloffset_GetConvolutionFilterEXT }, + { "glGetConvolutionParameterfvEXT", (GLvoid *) glGetConvolutionParameterfvEXT, _gloffset_GetConvolutionParameterfvEXT }, + { "glGetConvolutionParameterivEXT", (GLvoid *) glGetConvolutionParameterivEXT, _gloffset_GetConvolutionParameterivEXT }, + { "glGetSeparableFilterEXT", (GLvoid *) glGetSeparableFilterEXT, _gloffset_GetSeparableFilterEXT }, + { "glSeparableFilter2DEXT", (GLvoid *) glSeparableFilter2DEXT, _gloffset_SeparableFilter2D }, + { "glColorTableSGI", (GLvoid *) glColorTableSGI, _gloffset_ColorTable }, + { "glColorTableParameterfvSGI", (GLvoid *) glColorTableParameterfvSGI, _gloffset_ColorTableParameterfv }, + { "glColorTableParameterivSGI", (GLvoid *) glColorTableParameterivSGI, _gloffset_ColorTableParameteriv }, + { "glCopyColorTableSGI", (GLvoid *) glCopyColorTableSGI, _gloffset_CopyColorTable }, + { "glGetColorTableSGI", (GLvoid *) glGetColorTableSGI, _gloffset_GetColorTableSGI }, + { "glGetColorTableParameterfvSGI", (GLvoid *) glGetColorTableParameterfvSGI, _gloffset_GetColorTableParameterfvSGI }, + { "glGetColorTableParameterivSGI", (GLvoid *) glGetColorTableParameterivSGI, _gloffset_GetColorTableParameterivSGI }, + { "glPixelTexGenSGIX", (GLvoid *) glPixelTexGenSGIX, _gloffset_PixelTexGenSGIX }, + { "glPixelTexGenParameteriSGIS", (GLvoid *) glPixelTexGenParameteriSGIS, _gloffset_PixelTexGenParameteriSGIS }, + { "glPixelTexGenParameterivSGIS", (GLvoid *) glPixelTexGenParameterivSGIS, _gloffset_PixelTexGenParameterivSGIS }, + { "glPixelTexGenParameterfSGIS", (GLvoid *) glPixelTexGenParameterfSGIS, _gloffset_PixelTexGenParameterfSGIS }, + { "glPixelTexGenParameterfvSGIS", (GLvoid *) glPixelTexGenParameterfvSGIS, _gloffset_PixelTexGenParameterfvSGIS }, + { "glGetPixelTexGenParameterivSGIS", (GLvoid *) glGetPixelTexGenParameterivSGIS, _gloffset_GetPixelTexGenParameterivSGIS }, + { "glGetPixelTexGenParameterfvSGIS", (GLvoid *) glGetPixelTexGenParameterfvSGIS, _gloffset_GetPixelTexGenParameterfvSGIS }, + { "glTexImage4DSGIS", (GLvoid *) glTexImage4DSGIS, _gloffset_TexImage4DSGIS }, + { "glTexSubImage4DSGIS", (GLvoid *) glTexSubImage4DSGIS, _gloffset_TexSubImage4DSGIS }, + { "glAreTexturesResidentEXT", (GLvoid *) glAreTexturesResidentEXT, _gloffset_AreTexturesResidentEXT }, + { "glBindTextureEXT", (GLvoid *) glBindTextureEXT, _gloffset_BindTexture }, + { "glDeleteTexturesEXT", (GLvoid *) glDeleteTexturesEXT, _gloffset_DeleteTextures }, + { "glGenTexturesEXT", (GLvoid *) glGenTexturesEXT, _gloffset_GenTexturesEXT }, + { "glIsTextureEXT", (GLvoid *) glIsTextureEXT, _gloffset_IsTextureEXT }, + { "glPrioritizeTexturesEXT", (GLvoid *) glPrioritizeTexturesEXT, _gloffset_PrioritizeTextures }, + { "glDetailTexFuncSGIS", (GLvoid *) glDetailTexFuncSGIS, _gloffset_DetailTexFuncSGIS }, + { "glGetDetailTexFuncSGIS", (GLvoid *) glGetDetailTexFuncSGIS, _gloffset_GetDetailTexFuncSGIS }, + { "glSharpenTexFuncSGIS", (GLvoid *) glSharpenTexFuncSGIS, _gloffset_SharpenTexFuncSGIS }, + { "glGetSharpenTexFuncSGIS", (GLvoid *) glGetSharpenTexFuncSGIS, _gloffset_GetSharpenTexFuncSGIS }, + { "glSampleMaskSGIS", (GLvoid *) glSampleMaskSGIS, _gloffset_SampleMaskSGIS }, + { "glSamplePatternSGIS", (GLvoid *) glSamplePatternSGIS, _gloffset_SamplePatternSGIS }, + { "glArrayElementEXT", (GLvoid *) glArrayElementEXT, _gloffset_ArrayElement }, + { "glColorPointerEXT", (GLvoid *) glColorPointerEXT, _gloffset_ColorPointerEXT }, + { "glDrawArraysEXT", (GLvoid *) glDrawArraysEXT, _gloffset_DrawArrays }, + { "glEdgeFlagPointerEXT", (GLvoid *) glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT }, + { "glGetPointervEXT", (GLvoid *) glGetPointervEXT, _gloffset_GetPointerv }, + { "glIndexPointerEXT", (GLvoid *) glIndexPointerEXT, _gloffset_IndexPointerEXT }, + { "glNormalPointerEXT", (GLvoid *) glNormalPointerEXT, _gloffset_NormalPointerEXT }, + { "glTexCoordPointerEXT", (GLvoid *) glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT }, + { "glVertexPointerEXT", (GLvoid *) glVertexPointerEXT, _gloffset_VertexPointerEXT }, + { "glBlendEquationEXT", (GLvoid *) glBlendEquationEXT, _gloffset_BlendEquation }, + { "glSpriteParameterfSGIX", (GLvoid *) glSpriteParameterfSGIX, _gloffset_SpriteParameterfSGIX }, + { "glSpriteParameterfvSGIX", (GLvoid *) glSpriteParameterfvSGIX, _gloffset_SpriteParameterfvSGIX }, + { "glSpriteParameteriSGIX", (GLvoid *) glSpriteParameteriSGIX, _gloffset_SpriteParameteriSGIX }, + { "glSpriteParameterivSGIX", (GLvoid *) glSpriteParameterivSGIX, _gloffset_SpriteParameterivSGIX }, + { "glPointParameterfEXT", (GLvoid *) glPointParameterfEXT, _gloffset_PointParameterfEXT }, + { "glPointParameterfvEXT", (GLvoid *) glPointParameterfvEXT, _gloffset_PointParameterfvEXT }, + { "glPointParameterfARB", (GLvoid *) glPointParameterfARB, _gloffset_PointParameterfEXT }, + { "glPointParameterfvARB", (GLvoid *) glPointParameterfvARB, _gloffset_PointParameterfvEXT }, + { "glPointParameterfSGIS", (GLvoid *) glPointParameterfSGIS, _gloffset_PointParameterfEXT }, + { "glPointParameterfvSGIS", (GLvoid *) glPointParameterfvSGIS, _gloffset_PointParameterfvEXT }, + { "glGetInstrumentsSGIX", (GLvoid *) glGetInstrumentsSGIX, _gloffset_GetInstrumentsSGIX }, + { "glInstrumentsBufferSGIX", (GLvoid *) glInstrumentsBufferSGIX, _gloffset_InstrumentsBufferSGIX }, + { "glPollInstrumentsSGIX", (GLvoid *) glPollInstrumentsSGIX, _gloffset_PollInstrumentsSGIX }, + { "glReadInstrumentsSGIX", (GLvoid *) glReadInstrumentsSGIX, _gloffset_ReadInstrumentsSGIX }, + { "glStartInstrumentsSGIX", (GLvoid *) glStartInstrumentsSGIX, _gloffset_StartInstrumentsSGIX }, + { "glStopInstrumentsSGIX", (GLvoid *) glStopInstrumentsSGIX, _gloffset_StopInstrumentsSGIX }, + { "glFrameZoomSGIX", (GLvoid *) glFrameZoomSGIX, _gloffset_FrameZoomSGIX }, + { "glTagSampleBufferSGIX", (GLvoid *) glTagSampleBufferSGIX, _gloffset_TagSampleBufferSGIX }, + { "glReferencePlaneSGIX", (GLvoid *) glReferencePlaneSGIX, _gloffset_ReferencePlaneSGIX }, + { "glFlushRasterSGIX", (GLvoid *) glFlushRasterSGIX, _gloffset_FlushRasterSGIX }, + { "glColorSubTableEXT", (GLvoid *) glColorSubTableEXT, _gloffset_ColorSubTable }, + { "glCopyColorSubTableEXT", (GLvoid *) glCopyColorSubTableEXT, _gloffset_CopyColorSubTable }, + { "glHintPGI", (GLvoid *) glHintPGI, _gloffset_HintPGI }, + { "glColorTableEXT", (GLvoid *) glColorTableEXT, _gloffset_ColorTable }, + { "glGetColorTableEXT", (GLvoid *) glGetColorTableEXT, _gloffset_GetColorTableEXT }, + { "glGetColorTableParameterivEXT", (GLvoid *) glGetColorTableParameterivEXT, _gloffset_GetColorTableParameterivEXT }, + { "glGetColorTableParameterfvEXT", (GLvoid *) glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfvEXT }, + { "glGetListParameterfvSGIX", (GLvoid *) glGetListParameterfvSGIX, _gloffset_GetListParameterfvSGIX }, + { "glGetListParameterivSGIX", (GLvoid *) glGetListParameterivSGIX, _gloffset_GetListParameterivSGIX }, + { "glListParameterfSGIX", (GLvoid *) glListParameterfSGIX, _gloffset_ListParameterfSGIX }, + { "glListParameterfvSGIX", (GLvoid *) glListParameterfvSGIX, _gloffset_ListParameterfvSGIX }, + { "glListParameteriSGIX", (GLvoid *) glListParameteriSGIX, _gloffset_ListParameteriSGIX }, + { "glListParameterivSGIX", (GLvoid *) glListParameterivSGIX, _gloffset_ListParameterivSGIX }, + { "glIndexMaterialEXT", (GLvoid *) glIndexMaterialEXT, _gloffset_IndexMaterialEXT }, + { "glIndexFuncEXT", (GLvoid *) glIndexFuncEXT, _gloffset_IndexFuncEXT }, + { "glLockArraysEXT", (GLvoid *) glLockArraysEXT, _gloffset_LockArraysEXT }, + { "glUnlockArraysEXT", (GLvoid *) glUnlockArraysEXT, _gloffset_UnlockArraysEXT }, + { "glCullParameterdvEXT", (GLvoid *) glCullParameterdvEXT, _gloffset_CullParameterdvEXT }, + { "glCullParameterfvEXT", (GLvoid *) glCullParameterfvEXT, _gloffset_CullParameterfvEXT }, + { "glFragmentColorMaterialSGIX", (GLvoid *) glFragmentColorMaterialSGIX, _gloffset_FragmentColorMaterialSGIX }, + { "glFragmentLightfSGIX", (GLvoid *) glFragmentLightfSGIX, _gloffset_FragmentLightfSGIX }, + { "glFragmentLightfvSGIX", (GLvoid *) glFragmentLightfvSGIX, _gloffset_FragmentLightfvSGIX }, + { "glFragmentLightiSGIX", (GLvoid *) glFragmentLightiSGIX, _gloffset_FragmentLightiSGIX }, + { "glFragmentLightivSGIX", (GLvoid *) glFragmentLightivSGIX, _gloffset_FragmentLightivSGIX }, + { "glFragmentLightModelfSGIX", (GLvoid *) glFragmentLightModelfSGIX, _gloffset_FragmentLightModelfSGIX }, + { "glFragmentLightModelfvSGIX", (GLvoid *) glFragmentLightModelfvSGIX, _gloffset_FragmentLightModelfvSGIX }, + { "glFragmentLightModeliSGIX", (GLvoid *) glFragmentLightModeliSGIX, _gloffset_FragmentLightModeliSGIX }, + { "glFragmentLightModelivSGIX", (GLvoid *) glFragmentLightModelivSGIX, _gloffset_FragmentLightModelivSGIX }, + { "glFragmentMaterialfSGIX", (GLvoid *) glFragmentMaterialfSGIX, _gloffset_FragmentMaterialfSGIX }, + { "glFragmentMaterialfvSGIX", (GLvoid *) glFragmentMaterialfvSGIX, _gloffset_FragmentMaterialfvSGIX }, + { "glFragmentMaterialiSGIX", (GLvoid *) glFragmentMaterialiSGIX, _gloffset_FragmentMaterialiSGIX }, + { "glFragmentMaterialivSGIX", (GLvoid *) glFragmentMaterialivSGIX, _gloffset_FragmentMaterialivSGIX }, + { "glGetFragmentLightfvSGIX", (GLvoid *) glGetFragmentLightfvSGIX, _gloffset_GetFragmentLightfvSGIX }, + { "glGetFragmentLightivSGIX", (GLvoid *) glGetFragmentLightivSGIX, _gloffset_GetFragmentLightivSGIX }, + { "glGetFragmentMaterialfvSGIX", (GLvoid *) glGetFragmentMaterialfvSGIX, _gloffset_GetFragmentMaterialfvSGIX }, + { "glGetFragmentMaterialivSGIX", (GLvoid *) glGetFragmentMaterialivSGIX, _gloffset_GetFragmentMaterialivSGIX }, + { "glLightEnviSGIX", (GLvoid *) glLightEnviSGIX, _gloffset_LightEnviSGIX }, + { "glDrawRangeElementsEXT", (GLvoid *) glDrawRangeElementsEXT, _gloffset_DrawRangeElements }, + { "glSecondaryColor3bEXT", (GLvoid *) glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT }, + { "glSecondaryColor3bvEXT", (GLvoid *) glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT }, + { "glSecondaryColor3dEXT", (GLvoid *) glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT }, + { "glSecondaryColor3dvEXT", (GLvoid *) glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT }, + { "glSecondaryColor3fEXT", (GLvoid *) glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT }, + { "glSecondaryColor3fvEXT", (GLvoid *) glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT }, + { "glSecondaryColor3iEXT", (GLvoid *) glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT }, + { "glSecondaryColor3ivEXT", (GLvoid *) glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT }, + { "glSecondaryColor3sEXT", (GLvoid *) glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT }, + { "glSecondaryColor3svEXT", (GLvoid *) glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT }, + { "glSecondaryColor3ubEXT", (GLvoid *) glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT }, + { "glSecondaryColor3ubvEXT", (GLvoid *) glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT }, + { "glSecondaryColor3uiEXT", (GLvoid *) glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT }, + { "glSecondaryColor3uivEXT", (GLvoid *) glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT }, + { "glSecondaryColor3usEXT", (GLvoid *) glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT }, + { "glSecondaryColor3usvEXT", (GLvoid *) glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT }, + { "glSecondaryColorPointerEXT", (GLvoid *) glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT }, + { "glMultiDrawArraysEXT", (GLvoid *) glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT }, + { "glMultiDrawElementsEXT", (GLvoid *) glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT }, + { "glFogCoordfEXT", (GLvoid *) glFogCoordfEXT, _gloffset_FogCoordfEXT }, + { "glFogCoordfvEXT", (GLvoid *) glFogCoordfvEXT, _gloffset_FogCoordfvEXT }, + { "glFogCoorddEXT", (GLvoid *) glFogCoorddEXT, _gloffset_FogCoorddEXT }, + { "glFogCoorddvEXT", (GLvoid *) glFogCoorddvEXT, _gloffset_FogCoorddvEXT }, + { "glFogCoordPointerEXT", (GLvoid *) glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT }, + { "glBlendFuncSeparateEXT", (GLvoid *) glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT }, + { "glBlendFuncSeparateINGR", (GLvoid *) glBlendFuncSeparateINGR, _gloffset_BlendFuncSeparateEXT }, + { "glVertexWeightfEXT", (GLvoid *) glVertexWeightfEXT, _gloffset_VertexWeightfEXT }, + { "glVertexWeightfvEXT", (GLvoid *) glVertexWeightfvEXT, _gloffset_VertexWeightfvEXT }, + { "glVertexWeightPointerEXT", (GLvoid *) glVertexWeightPointerEXT, _gloffset_VertexWeightPointerEXT }, + { "glFlushVertexArrayRangeNV", (GLvoid *) glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV }, + { "glVertexArrayRangeNV", (GLvoid *) glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV }, + { "glCombinerParameterfvNV", (GLvoid *) glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV }, + { "glCombinerParameterfNV", (GLvoid *) glCombinerParameterfNV, _gloffset_CombinerParameterfNV }, + { "glCombinerParameterivNV", (GLvoid *) glCombinerParameterivNV, _gloffset_CombinerParameterivNV }, + { "glCombinerParameteriNV", (GLvoid *) glCombinerParameteriNV, _gloffset_CombinerParameteriNV }, + { "glCombinerInputNV", (GLvoid *) glCombinerInputNV, _gloffset_CombinerInputNV }, + { "glCombinerOutputNV", (GLvoid *) glCombinerOutputNV, _gloffset_CombinerOutputNV }, + { "glFinalCombinerInputNV", (GLvoid *) glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV }, + { "glGetCombinerInputParameterfvNV", (GLvoid *) glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV }, + { "glGetCombinerInputParameterivNV", (GLvoid *) glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV }, + { "glGetCombinerOutputParameterfvNV", (GLvoid *) glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV }, + { "glGetCombinerOutputParameterivNV", (GLvoid *) glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV }, + { "glGetFinalCombinerInputParameterfvNV", (GLvoid *) glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV }, + { "glGetFinalCombinerInputParameterivNV", (GLvoid *) glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV }, + { "glResizeBuffersMESA", (GLvoid *) glResizeBuffersMESA, _gloffset_ResizeBuffersMESA }, + { "glWindowPos2dMESA", (GLvoid *) glWindowPos2dMESA, _gloffset_WindowPos2dMESA }, + { "glWindowPos2dvMESA", (GLvoid *) glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA }, + { "glWindowPos2fMESA", (GLvoid *) glWindowPos2fMESA, _gloffset_WindowPos2fMESA }, + { "glWindowPos2fvMESA", (GLvoid *) glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA }, + { "glWindowPos2iMESA", (GLvoid *) glWindowPos2iMESA, _gloffset_WindowPos2iMESA }, + { "glWindowPos2ivMESA", (GLvoid *) glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA }, + { "glWindowPos2sMESA", (GLvoid *) glWindowPos2sMESA, _gloffset_WindowPos2sMESA }, + { "glWindowPos2svMESA", (GLvoid *) glWindowPos2svMESA, _gloffset_WindowPos2svMESA }, + { "glWindowPos3dMESA", (GLvoid *) glWindowPos3dMESA, _gloffset_WindowPos3dMESA }, + { "glWindowPos3dvMESA", (GLvoid *) glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA }, + { "glWindowPos3fMESA", (GLvoid *) glWindowPos3fMESA, _gloffset_WindowPos3fMESA }, + { "glWindowPos3fvMESA", (GLvoid *) glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA }, + { "glWindowPos3iMESA", (GLvoid *) glWindowPos3iMESA, _gloffset_WindowPos3iMESA }, + { "glWindowPos3ivMESA", (GLvoid *) glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA }, + { "glWindowPos3sMESA", (GLvoid *) glWindowPos3sMESA, _gloffset_WindowPos3sMESA }, + { "glWindowPos3svMESA", (GLvoid *) glWindowPos3svMESA, _gloffset_WindowPos3svMESA }, + { "glWindowPos4dMESA", (GLvoid *) glWindowPos4dMESA, _gloffset_WindowPos4dMESA }, + { "glWindowPos4dvMESA", (GLvoid *) glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA }, + { "glWindowPos4fMESA", (GLvoid *) glWindowPos4fMESA, _gloffset_WindowPos4fMESA }, + { "glWindowPos4fvMESA", (GLvoid *) glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA }, + { "glWindowPos4iMESA", (GLvoid *) glWindowPos4iMESA, _gloffset_WindowPos4iMESA }, + { "glWindowPos4ivMESA", (GLvoid *) glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA }, + { "glWindowPos4sMESA", (GLvoid *) glWindowPos4sMESA, _gloffset_WindowPos4sMESA }, + { "glWindowPos4svMESA", (GLvoid *) glWindowPos4svMESA, _gloffset_WindowPos4svMESA }, + { "glTbufferMask3DFX", (GLvoid *) glTbufferMask3DFX, _gloffset_TbufferMask3DFX }, + { "glSampleMaskEXT", (GLvoid *) glSampleMaskEXT, _gloffset_SampleMaskSGIS }, + { "glSamplePatternEXT", (GLvoid *) glSamplePatternEXT, _gloffset_SamplePatternSGIS }, + { "glDeleteFencesNV", (GLvoid *) glDeleteFencesNV, _gloffset_DeleteFencesNV }, + { "glGenFencesNV", (GLvoid *) glGenFencesNV, _gloffset_GenFencesNV }, + { "glIsFenceNV", (GLvoid *) glIsFenceNV, _gloffset_IsFenceNV }, + { "glTestFenceNV", (GLvoid *) glTestFenceNV, _gloffset_TestFenceNV }, + { "glGetFenceivNV", (GLvoid *) glGetFenceivNV, _gloffset_GetFenceivNV }, + { "glFinishFenceNV", (GLvoid *) glFinishFenceNV, _gloffset_FinishFenceNV }, + { "glSetFenceNV", (GLvoid *) glSetFenceNV, _gloffset_SetFenceNV }, + { "glWindowPos2dARB", (GLvoid *) glWindowPos2dARB, _gloffset_WindowPos2dMESA }, + { "glWindowPos2fARB", (GLvoid *) glWindowPos2fARB, _gloffset_WindowPos2fMESA }, + { "glWindowPos2iARB", (GLvoid *) glWindowPos2iARB, _gloffset_WindowPos2iMESA }, + { "glWindowPos2sARB", (GLvoid *) glWindowPos2sARB, _gloffset_WindowPos2sMESA }, + { "glWindowPos2dvARB", (GLvoid *) glWindowPos2dvARB, _gloffset_WindowPos2dvMESA }, + { "glWindowPos2fvARB", (GLvoid *) glWindowPos2fvARB, _gloffset_WindowPos2fvMESA }, + { "glWindowPos2ivARB", (GLvoid *) glWindowPos2ivARB, _gloffset_WindowPos2ivMESA }, + { "glWindowPos2svARB", (GLvoid *) glWindowPos2svARB, _gloffset_WindowPos2svMESA }, + { "glWindowPos3dARB", (GLvoid *) glWindowPos3dARB, _gloffset_WindowPos3dMESA }, + { "glWindowPos3fARB", (GLvoid *) glWindowPos3fARB, _gloffset_WindowPos3fMESA }, + { "glWindowPos3iARB", (GLvoid *) glWindowPos3iARB, _gloffset_WindowPos3iMESA }, + { "glWindowPos3sARB", (GLvoid *) glWindowPos3sARB, _gloffset_WindowPos3sMESA }, + { "glWindowPos3dvARB", (GLvoid *) glWindowPos3dvARB, _gloffset_WindowPos3dvMESA }, + { "glWindowPos3fvARB", (GLvoid *) glWindowPos3fvARB, _gloffset_WindowPos3fvMESA }, + { "glWindowPos3ivARB", (GLvoid *) glWindowPos3ivARB, _gloffset_WindowPos3ivMESA }, + { "glWindowPos3svARB", (GLvoid *) glWindowPos3svARB, _gloffset_WindowPos3svMESA }, + { "glAreProgramsResidentNV", (GLvoid *) glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV }, + { "glBindProgramNV", (GLvoid *) glBindProgramNV, _gloffset_BindProgramNV }, + { "glDeleteProgramsNV", (GLvoid *) glDeleteProgramsNV, _gloffset_DeleteProgramsNV }, + { "glExecuteProgramNV", (GLvoid *) glExecuteProgramNV, _gloffset_ExecuteProgramNV }, + { "glGenProgramsNV", (GLvoid *) glGenProgramsNV, _gloffset_GenProgramsNV }, + { "glGetProgramParameterdvNV", (GLvoid *) glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV }, + { "glGetProgramParameterfvNV", (GLvoid *) glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV }, + { "glGetProgramivNV", (GLvoid *) glGetProgramivNV, _gloffset_GetProgramivNV }, + { "glGetProgramStringNV", (GLvoid *) glGetProgramStringNV, _gloffset_GetProgramStringNV }, + { "glGetTrackMatrixivNV", (GLvoid *) glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV }, + { "glGetVertexAttribdvNV", (GLvoid *) glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV }, + { "glGetVertexAttribfvNV", (GLvoid *) glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV }, + { "glGetVertexAttribivNV", (GLvoid *) glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV }, + { "glGetVertexAttribPointervNV", (GLvoid *) glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV }, + { "glIsProgramNV", (GLvoid *) glIsProgramNV, _gloffset_IsProgramNV }, + { "glLoadProgramNV", (GLvoid *) glLoadProgramNV, _gloffset_LoadProgramNV }, + { "glProgramParameter4dNV", (GLvoid *) glProgramParameter4dNV, _gloffset_ProgramParameter4dNV }, + { "glProgramParameter4dvNV", (GLvoid *) glProgramParameter4dvNV, _gloffset_ProgramParameter4dvNV }, + { "glProgramParameter4fNV", (GLvoid *) glProgramParameter4fNV, _gloffset_ProgramParameter4fNV }, + { "glProgramParameter4fvNV", (GLvoid *) glProgramParameter4fvNV, _gloffset_ProgramParameter4fvNV }, + { "glProgramParameters4dvNV", (GLvoid *) glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV }, + { "glProgramParameters4fvNV", (GLvoid *) glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV }, + { "glRequestResidentProgramsNV", (GLvoid *) glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV }, + { "glTrackMatrixNV", (GLvoid *) glTrackMatrixNV, _gloffset_TrackMatrixNV }, + { "glVertexAttribPointerNV", (GLvoid *) glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV }, + { "glVertexAttrib1dNV", (GLvoid *) glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV }, + { "glVertexAttrib1dvNV", (GLvoid *) glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV }, + { "glVertexAttrib1fNV", (GLvoid *) glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV }, + { "glVertexAttrib1fvNV", (GLvoid *) glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV }, + { "glVertexAttrib1sNV", (GLvoid *) glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV }, + { "glVertexAttrib1svNV", (GLvoid *) glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV }, + { "glVertexAttrib2dNV", (GLvoid *) glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV }, + { "glVertexAttrib2dvNV", (GLvoid *) glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV }, + { "glVertexAttrib2fNV", (GLvoid *) glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV }, + { "glVertexAttrib2fvNV", (GLvoid *) glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV }, + { "glVertexAttrib2sNV", (GLvoid *) glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV }, + { "glVertexAttrib2svNV", (GLvoid *) glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV }, + { "glVertexAttrib3dNV", (GLvoid *) glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV }, + { "glVertexAttrib3dvNV", (GLvoid *) glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV }, + { "glVertexAttrib3fNV", (GLvoid *) glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV }, + { "glVertexAttrib3fvNV", (GLvoid *) glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV }, + { "glVertexAttrib3sNV", (GLvoid *) glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV }, + { "glVertexAttrib3svNV", (GLvoid *) glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV }, + { "glVertexAttrib4dNV", (GLvoid *) glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV }, + { "glVertexAttrib4dvNV", (GLvoid *) glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV }, + { "glVertexAttrib4fNV", (GLvoid *) glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV }, + { "glVertexAttrib4fvNV", (GLvoid *) glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV }, + { "glVertexAttrib4sNV", (GLvoid *) glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV }, + { "glVertexAttrib4svNV", (GLvoid *) glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV }, + { "glVertexAttrib4ubNV", (GLvoid *) glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV }, + { "glVertexAttrib4ubvNV", (GLvoid *) glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV }, + { "glVertexAttribs1dvNV", (GLvoid *) glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV }, + { "glVertexAttribs1fvNV", (GLvoid *) glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV }, + { "glVertexAttribs1svNV", (GLvoid *) glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV }, + { "glVertexAttribs2dvNV", (GLvoid *) glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV }, + { "glVertexAttribs2fvNV", (GLvoid *) glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV }, + { "glVertexAttribs2svNV", (GLvoid *) glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV }, + { "glVertexAttribs3dvNV", (GLvoid *) glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV }, + { "glVertexAttribs3fvNV", (GLvoid *) glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV }, + { "glVertexAttribs3svNV", (GLvoid *) glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV }, + { "glVertexAttribs4dvNV", (GLvoid *) glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV }, + { "glVertexAttribs4fvNV", (GLvoid *) glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV }, + { "glVertexAttribs4svNV", (GLvoid *) glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV }, + { "glVertexAttribs4ubvNV", (GLvoid *) glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV }, + { "glPointParameteriNV", (GLvoid *) glPointParameteriNV, _gloffset_PointParameteriNV }, + { "glPointParameterivNV", (GLvoid *) glPointParameterivNV, _gloffset_PointParameterivNV }, + { "glBlendFuncSeparate", (GLvoid *) glBlendFuncSeparate, _gloffset_BlendFuncSeparateEXT }, + { "glFogCoordf", (GLvoid *) glFogCoordf, _gloffset_FogCoordfEXT }, + { "glFogCoordfv", (GLvoid *) glFogCoordfv, _gloffset_FogCoordfvEXT }, + { "glFogCoordd", (GLvoid *) glFogCoordd, _gloffset_FogCoorddEXT }, + { "glFogCoorddv", (GLvoid *) glFogCoorddv, _gloffset_FogCoorddvEXT }, + { "glFogCoordPointer", (GLvoid *) glFogCoordPointer, _gloffset_FogCoordPointerEXT }, + { "glMultiDrawArrays", (GLvoid *) glMultiDrawArrays, _gloffset_MultiDrawArraysEXT }, + { "glMultiDrawElements", (GLvoid *) glMultiDrawElements, _gloffset_MultiDrawElementsEXT }, + { "glPointParameterf", (GLvoid *) glPointParameterf, _gloffset_PointParameterfEXT }, + { "glPointParameterfv", (GLvoid *) glPointParameterfv, _gloffset_PointParameterfvEXT }, + { "glPointParameteri", (GLvoid *) glPointParameteri, _gloffset_PointParameteriNV }, + { "glPointParameteriv", (GLvoid *) glPointParameteriv, _gloffset_PointParameterivNV }, + { "glSecondaryColor3b", (GLvoid *) glSecondaryColor3b, _gloffset_SecondaryColor3bEXT }, + { "glSecondaryColor3bv", (GLvoid *) glSecondaryColor3bv, _gloffset_SecondaryColor3bvEXT }, + { "glSecondaryColor3d", (GLvoid *) glSecondaryColor3d, _gloffset_SecondaryColor3dEXT }, + { "glSecondaryColor3dv", (GLvoid *) glSecondaryColor3dv, _gloffset_SecondaryColor3dvEXT }, + { "glSecondaryColor3f", (GLvoid *) glSecondaryColor3f, _gloffset_SecondaryColor3fEXT }, + { "glSecondaryColor3fv", (GLvoid *) glSecondaryColor3fv, _gloffset_SecondaryColor3fvEXT }, + { "glSecondaryColor3i", (GLvoid *) glSecondaryColor3i, _gloffset_SecondaryColor3iEXT }, + { "glSecondaryColor3iv", (GLvoid *) glSecondaryColor3iv, _gloffset_SecondaryColor3ivEXT }, + { "glSecondaryColor3s", (GLvoid *) glSecondaryColor3s, _gloffset_SecondaryColor3sEXT }, + { "glSecondaryColor3sv", (GLvoid *) glSecondaryColor3sv, _gloffset_SecondaryColor3svEXT }, + { "glSecondaryColor3ub", (GLvoid *) glSecondaryColor3ub, _gloffset_SecondaryColor3ubEXT }, + { "glSecondaryColor3ubv", (GLvoid *) glSecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT }, + { "glSecondaryColor3ui", (GLvoid *) glSecondaryColor3ui, _gloffset_SecondaryColor3uiEXT }, + { "glSecondaryColor3uiv", (GLvoid *) glSecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT }, + { "glSecondaryColor3us", (GLvoid *) glSecondaryColor3us, _gloffset_SecondaryColor3usEXT }, + { "glSecondaryColor3usv", (GLvoid *) glSecondaryColor3usv, _gloffset_SecondaryColor3usvEXT }, + { "glSecondaryColorPointer", (GLvoid *) glSecondaryColorPointer, _gloffset_SecondaryColorPointerEXT }, + { "glWindowPos2d", (GLvoid *) glWindowPos2d, _gloffset_WindowPos2dMESA }, + { "glWindowPos2dv", (GLvoid *) glWindowPos2dv, _gloffset_WindowPos2dvMESA }, + { "glWindowPos2f", (GLvoid *) glWindowPos2f, _gloffset_WindowPos2fMESA }, + { "glWindowPos2fv", (GLvoid *) glWindowPos2fv, _gloffset_WindowPos2fvMESA }, + { "glWindowPos2i", (GLvoid *) glWindowPos2i, _gloffset_WindowPos2iMESA }, + { "glWindowPos2iv", (GLvoid *) glWindowPos2iv, _gloffset_WindowPos2ivMESA }, + { "glWindowPos2s", (GLvoid *) glWindowPos2s, _gloffset_WindowPos2sMESA }, + { "glWindowPos2sv", (GLvoid *) glWindowPos2sv, _gloffset_WindowPos2svMESA }, + { "glWindowPos3d", (GLvoid *) glWindowPos3d, _gloffset_WindowPos3dMESA }, + { "glWindowPos3dv", (GLvoid *) glWindowPos3dv, _gloffset_WindowPos3dvMESA }, + { "glWindowPos3f", (GLvoid *) glWindowPos3f, _gloffset_WindowPos3fMESA }, + { "glWindowPos3fv", (GLvoid *) glWindowPos3fv, _gloffset_WindowPos3fvMESA }, + { "glWindowPos3i", (GLvoid *) glWindowPos3i, _gloffset_WindowPos3iMESA }, + { "glWindowPos3iv", (GLvoid *) glWindowPos3iv, _gloffset_WindowPos3ivMESA }, + { "glWindowPos3s", (GLvoid *) glWindowPos3s, _gloffset_WindowPos3sMESA }, + { "glWindowPos3sv", (GLvoid *) glWindowPos3sv, _gloffset_WindowPos3svMESA }, + { "glActiveStencilFaceEXT", (GLvoid *) glActiveStencilFaceEXT, _gloffset_ActiveStencilFaceEXT }, + { NULL, NULL } /* end of list marker */ +}; diff --git a/xc/extras/Mesa/src/glthread.c b/xc/extras/Mesa/src/glthread.c index b48aed899..5fa831397 100644 --- a/xc/extras/Mesa/src/glthread.c +++ b/xc/extras/Mesa/src/glthread.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -30,12 +30,8 @@ */ -#ifdef PC_ALL -#include "all.h" -#else #include "glheader.h" #include "glthread.h" -#endif /* @@ -291,6 +287,46 @@ _glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +/* + * BeOS threads + */ +#ifdef BEOS_THREADS + +unsigned long +_glthread_GetID(void) +{ + return (unsigned long) find_thread(NULL); +} + +void +_glthread_InitTSD(_glthread_TSD *tsd) +{ + tsd->key = tls_allocate(); + tsd->initMagic = INIT_MAGIC; +} + +void * +_glthread_GetTSD(_glthread_TSD *tsd) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + return tls_get(tsd->key); +} + +void +_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + _glthread_InitTSD(tsd); + } + tls_set(tsd->key, ptr); +} + +#endif /* BEOS_THREADS */ + + + #else /* THREADS */ diff --git a/xc/extras/Mesa/src/glthread.h b/xc/extras/Mesa/src/glthread.h index 3bcee3b29..051965446 100644 --- a/xc/extras/Mesa/src/glthread.h +++ b/xc/extras/Mesa/src/glthread.h @@ -100,6 +100,9 @@ typedef pthread_mutex_t _glthread_Mutex; #define _glthread_INIT_MUTEX(name) \ pthread_mutex_init(&(name), NULL) +#define _glthread_DESTROY_MUTEX(name) \ + pthread_mutex_destroy(&(name)) + #define _glthread_LOCK_MUTEX(name) \ (void) pthread_mutex_lock(&(name)) @@ -133,6 +136,7 @@ typedef mutex_t _glthread_Mutex; /* XXX need to really implement mutex-related macros */ #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 #define _glthread_INIT_MUTEX(name) (void) name +#define _glthread_DESTROY_MUTEX(name) (void) name #define _glthread_LOCK_MUTEX(name) (void) name #define _glthread_UNLOCK_MUTEX(name) (void) name @@ -161,6 +165,7 @@ typedef CRITICAL_SECTION _glthread_Mutex; /* XXX need to really implement mutex-related macros */ #define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 #define _glthread_INIT_MUTEX(name) (void) name +#define _glthread_DESTROY_MUTEX(name) (void) name #define _glthread_LOCK_MUTEX(name) (void) name #define _glthread_UNLOCK_MUTEX(name) (void) name @@ -196,6 +201,9 @@ typedef xmutex_rec _glthread_Mutex; #define _glthread_INIT_MUTEX(name) \ xmutex_init(&(name)) +#define _glthread_DESTROY_MUTEX(name) \ + xmutex_clear(&(name)) + #define _glthread_LOCK_MUTEX(name) \ (void) xmutex_lock(&(name)) @@ -206,6 +214,36 @@ typedef xmutex_rec _glthread_Mutex; +/* + * BeOS threads. R5.x required. + */ +#ifdef BEOS_THREADS +#include <kernel/OS.h> +#include <support/TLS.h> + +typedef struct { + int32 key; + int initMagic; +} _glthread_TSD; + +typedef thread_id _glthread_Thread; + +/* Use Benaphore, aka speeder semaphore */ +typedef struct { + int32 lock; + sem_id sem; +} benaphore; +typedef benaphore _glthread_Mutex; + +#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, +create_sem(0, #name"_benaphore") } +#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0 +#define _glthread_LOCK_MUTEX(name) if((atomic_add(&(name.lock), 1)) >= 1) acquire_sem(name.sem) +#define _glthread_UNLOCK_MUTEX(name) if((atomic_add(&(name.lock), -1)) > 1) release_sem(name.sem) + +#endif /* BEOS_THREADS */ + + #ifndef THREADS @@ -223,6 +261,8 @@ typedef GLuint _glthread_Mutex; #define _glthread_INIT_MUTEX(name) (void) name +#define _glthread_DESTROY_MUTEX(name) (void) name + #define _glthread_LOCK_MUTEX(name) (void) name #define _glthread_UNLOCK_MUTEX(name) (void) name diff --git a/xc/extras/Mesa/src/hash.c b/xc/extras/Mesa/src/hash.c index 54f49d426..32e37a268 100644 --- a/xc/extras/Mesa/src/hash.c +++ b/xc/extras/Mesa/src/hash.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,43 +23,48 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "glthread.h" #include "hash.h" -#include "mem.h" -#endif +#include "context.h" -/* - * Generic hash table. - * - * This is used to implement display list and texture object lookup. - * NOTE: key=0 is illegal. +/** + * \file hash.c + * \brief Generic hash table. Used for display lists and texture objects. + * The hash functions are thread-safe. + * \author Brian Paul + * \note key=0 is illegal */ -#define TABLE_SIZE 1024 +#define TABLE_SIZE 1023 /**< Size of lookup table/array */ +/** + * An entry in the hash table. This struct is private to this file. + */ struct HashEntry { - GLuint Key; - void *Data; - struct HashEntry *Next; + GLuint Key; /**< the entry's key */ + void *Data; /**< the entry's data */ + struct HashEntry *Next; /**< pointer to next entry */ }; +/** + * The hashtable data structure. This is an opaque types (it's not + * defined in the .h file). + */ struct _mesa_HashTable { - struct HashEntry *Table[TABLE_SIZE]; - GLuint MaxKey; - _glthread_Mutex Mutex; + struct HashEntry *Table[TABLE_SIZE]; /**< the lookup table */ + GLuint MaxKey; /**< highest key inserted so far */ + _glthread_Mutex Mutex; /**< mutual exclusion lock */ }; -/* - * Return pointer to a new, empty hash table. +/** + * Create a new hash table. + * \return pointer to a new, empty hash table. */ struct _mesa_HashTable *_mesa_NewHashTable(void) { @@ -72,8 +77,9 @@ struct _mesa_HashTable *_mesa_NewHashTable(void) -/* +/** * Delete a hash table. + * \param table - the hash table to delete */ void _mesa_DeleteHashTable(struct _mesa_HashTable *table) { @@ -87,16 +93,17 @@ void _mesa_DeleteHashTable(struct _mesa_HashTable *table) entry = next; } } + _glthread_DESTROY_MUTEX(table->Mutex); FREE(table); } -/* +/** * Lookup an entry in the hash table. - * Input: table - the hash table - * key - the key - * Return: user data pointer or NULL if key not in table + * \param table - the hash table + * \param key - the key + * \return pointer to user's data or NULL if key not in table */ void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) { @@ -119,12 +126,12 @@ void *_mesa_HashLookup(const struct _mesa_HashTable *table, GLuint key) -/* +/** * Insert into the hash table. If an entry with this key already exists * we'll replace the existing entry. - * Input: table - the hash table - * key - the key (not zero) - * data - pointer to user data + * \param table - the hash table + * \param key - the key (not zero) + * \param data - pointer to user data */ void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) { @@ -164,10 +171,10 @@ void _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) -/* +/** * Remove an entry from the hash table. - * Input: table - the hash table - * key - key of entry to remove + * \param table - the hash table + * \param key - key of entry to remove */ void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) { @@ -204,10 +211,12 @@ void _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) -/* - * Return the key of the "first" entry in the hash table. +/** + * Get the key of the "first" entry in the hash table. * This is used in the course of deleting all display lists when * a context is destroyed. + * \param table - the hash table + * \return key for the "first" entry in the hash table. */ GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table) { @@ -226,8 +235,9 @@ GLuint _mesa_HashFirstEntry(struct _mesa_HashTable *table) -/* +/** * Dump contents of hash table for debugging. + * \param table - the hash table */ void _mesa_HashPrint(const struct _mesa_HashTable *table) { @@ -236,7 +246,7 @@ void _mesa_HashPrint(const struct _mesa_HashTable *table) for (i=0;i<TABLE_SIZE;i++) { const struct HashEntry *entry = table->Table[i]; while (entry) { - printf("%u %p\n", entry->Key, entry->Data); + _mesa_debug(NULL, "%u %p\n", entry->Key, entry->Data); entry = entry->Next; } } @@ -244,11 +254,11 @@ void _mesa_HashPrint(const struct _mesa_HashTable *table) -/* +/** * Find a block of 'numKeys' adjacent unused hash keys. - * Input: table - the hash table - * numKeys - number of keys needed - * Return: starting key of free block or 0 if failure + * \param table - the hash table + * \param numKeys - number of keys needed + * \return Starting key of free block or 0 if failure */ GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys) { @@ -293,17 +303,19 @@ int main(int argc, char *argv[]) int a, b, c; struct HashTable *t; - printf("&a = %p\n", &a); - printf("&b = %p\n", &b); + _mesa_printf("&a = %p\n", &a); + _mesa_printf("&b = %p\n", &b); t = _mesa_NewHashTable(); _mesa_HashInsert(t, 501, &a); _mesa_HashInsert(t, 10, &c); _mesa_HashInsert(t, 0xfffffff8, &b); _mesa_HashPrint(t); - printf("Find 501: %p\n", _mesa_HashLookup(t,501)); - printf("Find 1313: %p\n", _mesa_HashLookup(t,1313)); - printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100)); + + _mesa_printf("Find 501: %p\n", _mesa_HashLookup(t,501)); + _mesa_printf("Find 1313: %p\n", _mesa_HashLookup(t,1313)); + _mesa_printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100)); + _mesa_DeleteHashTable(t); return 0; diff --git a/xc/extras/Mesa/src/hash.h b/xc/extras/Mesa/src/hash.h index a6ed16ccc..07bdef46c 100644 --- a/xc/extras/Mesa/src/hash.h +++ b/xc/extras/Mesa/src/hash.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -31,6 +31,9 @@ #include "glheader.h" +/** + * Opaque hash table type. + */ struct HashTable; diff --git a/xc/extras/Mesa/src/highpc.c b/xc/extras/Mesa/src/highpc.c deleted file mode 100644 index d35a5ae61..000000000 --- a/xc/extras/Mesa/src/highpc.c +++ /dev/null @@ -1,120 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - - -#ifdef PC_HEADER -#include "all.h" -#else -#include "glheader.h" -#include "mtypes.h" -#endif - - -/* - * This is the highest address in Mesa - */ -extern void mesa_highpc(void); /* silence compiler warning */ -void mesa_highpc(void) { } - -#if defined(__GNUC__) && defined(__linux__) - -void monstartup( char *lowpc, char *highpc ); -void _mcleanup( void ); -void mesa_lowpc( void ); -void mesa_highpc( void ); - -static int profile = 0; - -extern void force_init_prof( void ); /* silence compiler warning */ -void force_init_prof( void ) -{ - FILE *fp; - - if (profile) return; - - profile = 1; - - monstartup( (char *)mesa_lowpc, (char *)mesa_highpc ); - - fprintf(stderr, "Starting profiling, %x %x\n", - (unsigned int)mesa_lowpc, - (unsigned int)mesa_highpc); - - if ((fp = fopen( "mesa_lowpc", "w" )) != NULL) { - fprintf( fp, "0x%08x ", (unsigned int)mesa_lowpc ); - fclose( fp ); - } -} - -/* - * Start profiling - */ -extern void init_prof(void); /* silence compiler warning */ -void __attribute__ ((constructor)) -init_prof( void ) -{ - FILE *fp; - char *s = getenv("MESA_MON"); - - if (s == NULL || atoi(s) == 0) - return; - - profile = 1; - - monstartup( (char *)mesa_lowpc, (char *)mesa_highpc ); - - fprintf(stderr, "Starting profiling, %x %x\n", - (unsigned int)mesa_lowpc, - (unsigned int)mesa_highpc); - - if ((fp = fopen( "mesa_lowpc", "w" )) != NULL) { - fprintf( fp, "0x%08x ", (unsigned int)mesa_lowpc ); - fclose( fp ); - } -} - - - -/* - * Finish profiling - */ -extern void fini_prof(void); /* silence compiler warning */ -void __attribute__ ((destructor)) -fini_prof( void ) -{ - if (profile) { - _mcleanup( ); - - fprintf(stderr, "Finished profiling\n"); - } -} - -#else - -void force_init_prof( void ) -{ -} - -#endif diff --git a/xc/extras/Mesa/src/hint.c b/xc/extras/Mesa/src/hint.c index 9a946d6dc..90ccc8bf6 100644 --- a/xc/extras/Mesa/src/hint.c +++ b/xc/extras/Mesa/src/hint.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,15 +24,11 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "enums.h" #include "context.h" #include "hint.h" -#include "state.h" -#endif +#include "imports.h" @@ -41,49 +37,44 @@ _mesa_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - (void) _mesa_try_Hint( ctx, target, mode ); -} - -GLboolean -_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) -{ if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glHint %s %d\n", _mesa_lookup_enum_by_nr(target), mode); + _mesa_debug(ctx, "glHint %s %d\n", + _mesa_lookup_enum_by_nr(target), mode); if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); - return GL_FALSE; + return; } switch (target) { case GL_FOG_HINT: if (ctx->Hint.Fog == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.Fog = mode; break; case GL_LINE_SMOOTH_HINT: if (ctx->Hint.LineSmooth == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.LineSmooth = mode; break; case GL_PERSPECTIVE_CORRECTION_HINT: if (ctx->Hint.PerspectiveCorrection == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PerspectiveCorrection = mode; break; case GL_POINT_SMOOTH_HINT: if (ctx->Hint.PointSmooth == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PointSmooth = mode; break; case GL_POLYGON_SMOOTH_HINT: if (ctx->Hint.PolygonSmooth == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PolygonSmooth = mode; break; @@ -91,7 +82,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: if (ctx->Hint.ClipVolumeClipping == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.ClipVolumeClipping = mode; break; @@ -100,10 +91,10 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_TEXTURE_COMPRESSION_HINT_ARB: if (!ctx->Extensions.ARB_texture_compression) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); - return GL_FALSE; + return; } if (ctx->Hint.TextureCompression == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.TextureCompression = mode; break; @@ -112,22 +103,20 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_GENERATE_MIPMAP_HINT_SGIS: if (!ctx->Extensions.SGIS_generate_mipmap) { _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); - return GL_FALSE; + return; } if (ctx->Hint.GenerateMipmap == mode) - return GL_TRUE; + return; FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.GenerateMipmap = mode; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); - return GL_FALSE; + return; } if (ctx->Driver.Hint) { (*ctx->Driver.Hint)( ctx, target, mode ); } - - return GL_TRUE; } diff --git a/xc/extras/Mesa/src/hint.h b/xc/extras/Mesa/src/hint.h index 8432337b2..f33be7b54 100644 --- a/xc/extras/Mesa/src/hint.h +++ b/xc/extras/Mesa/src/hint.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -31,9 +31,6 @@ #include "mtypes.h" -extern GLboolean -_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ); - extern void _mesa_Hint( GLenum target, GLenum mode ); diff --git a/xc/extras/Mesa/src/histogram.c b/xc/extras/Mesa/src/histogram.c index 8ee061168..805438f2f 100644 --- a/xc/extras/Mesa/src/histogram.c +++ b/xc/extras/Mesa/src/histogram.c @@ -1,4 +1,3 @@ -/* $Id: histogram.c,v 1.1.1.1 2002/10/22 13:05:10 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -25,16 +24,12 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" #include "histogram.h" #include "mmath.h" -#endif /* diff --git a/xc/extras/Mesa/src/histogram.h b/xc/extras/Mesa/src/histogram.h index 8c620f750..61fdeb319 100644 --- a/xc/extras/Mesa/src/histogram.h +++ b/xc/extras/Mesa/src/histogram.h @@ -1,10 +1,9 @@ -/* $Id: histogram.h,v 1.1.1.1 2002/10/22 13:05:10 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -28,14 +27,8 @@ #ifndef HISTOGRAM_H #define HISTOGRAM_H - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "mtypes.h" -#endif - extern void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index da2e6953f..4c042315d 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,22 +23,16 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" +#include "imports.h" #include "histogram.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "pixel.h" #include "mtypes.h" -#endif - /* @@ -56,7 +50,9 @@ const struct gl_pixelstore_attrib _mesa_native_packing = { 0, /* ImageHeight */ 0, /* SkipImages */ GL_FALSE, /* SwapBytes */ - GL_FALSE /* LsbFirst */ + GL_FALSE, /* LsbFirst */ + GL_FALSE, /* ClientStorage */ + GL_FALSE /* Invert */ }; @@ -183,17 +179,17 @@ GLint _mesa_sizeof_packed_type( GLenum type ) case GL_UNSIGNED_BYTE_2_3_3_REV: return sizeof(GLubyte); case GL_UNSIGNED_SHORT_5_6_5: - return sizeof(GLshort); + return sizeof(GLushort); case GL_UNSIGNED_SHORT_5_6_5_REV: - return sizeof(GLshort); + return sizeof(GLushort); case GL_UNSIGNED_SHORT_4_4_4_4: - return sizeof(GLshort); + return sizeof(GLushort); case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return sizeof(GLshort); + return sizeof(GLushort); case GL_UNSIGNED_SHORT_5_5_5_1: - return sizeof(GLshort); + return sizeof(GLushort); case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return sizeof(GLshort); + return sizeof(GLushort); case GL_UNSIGNED_INT_8_8_8_8: return sizeof(GLuint); case GL_UNSIGNED_INT_8_8_8_8_REV: @@ -202,6 +198,9 @@ GLint _mesa_sizeof_packed_type( GLenum type ) return sizeof(GLuint); case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLuint); + case GL_UNSIGNED_SHORT_8_8_MESA: + case GL_UNSIGNED_SHORT_8_8_REV_MESA: + return sizeof(GLushort); default: return -1; } @@ -244,6 +243,8 @@ GLint _mesa_components_in_format( GLenum format ) return 4; case GL_ABGR_EXT: return 4; + case GL_YCBCR_MESA: + return 2; default: return -1; } @@ -283,7 +284,7 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: if (format == GL_RGB || format == GL_BGR) - return sizeof(GLshort); + return sizeof(GLushort); else return -1; /* error */ case GL_UNSIGNED_SHORT_4_4_4_4: @@ -302,6 +303,12 @@ GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) return sizeof(GLuint); else return -1; + case GL_UNSIGNED_SHORT_8_8_MESA: + case GL_UNSIGNED_SHORT_8_8_REV_MESA: + if (format == GL_YCBCR_MESA) + return sizeof(GLushort); + else + return -1; default: return -1; } @@ -392,6 +399,12 @@ _mesa_is_legal_format_and_type( GLenum format, GLenum type ) default: return GL_FALSE; } + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_MESA || + type == GL_UNSIGNED_SHORT_8_8_REV_MESA) + return GL_TRUE; + else + return GL_FALSE; default: ; /* fall-through */ } @@ -475,6 +488,7 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing, else { /* Non-BITMAP data */ GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; + GLint topOfImage; bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); @@ -490,9 +504,19 @@ _mesa_image_address( const struct gl_pixelstore_attrib *packing, bytes_per_image = bytes_per_row * rows_per_image; + if (packing->Invert) { + /* set pixel_addr to the last row */ + topOfImage = bytes_per_row * (height - 1); + bytes_per_row = -bytes_per_row; + } + else { + topOfImage = 0; + } + /* compute final pixel address */ pixel_addr = (GLubyte *) image + (skipimages + img) * bytes_per_image + + topOfImage + (skiprows + row) * bytes_per_row + (skippixels + column) * bytes_per_pixel; } @@ -513,14 +537,18 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, ASSERT(packing); if (type == GL_BITMAP) { /* BITMAP data */ + GLint bytes; if (packing->RowLength == 0) { - GLint bytes = (width + 7) / 8; - return bytes; + bytes = (width + 7) / 8; } else { - GLint bytes = (packing->RowLength + 7) / 8; - return bytes; + bytes = (packing->RowLength + 7) / 8; + } + if (packing->Invert) { + /* negate the bytes per row (negative row stride) */ + bytes = -bytes; } + return bytes; } else { /* Non-BITMAP data */ @@ -537,6 +565,8 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, remainder = bytesPerRow % packing->Alignment; if (remainder > 0) bytesPerRow += (packing->Alignment - remainder); + if (packing->Invert) + bytesPerRow = -bytesPerRow; return bytesPerRow; } } @@ -544,6 +574,46 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, /* + * Compute the stride between images in a 3D texture (in bytes) for the given + * pixel packing parameters and image width, format and type. + */ +GLint +_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLint height, + GLenum format, GLenum type ) +{ + ASSERT(packing); + ASSERT(type != GL_BITMAP); + + { + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + GLint bytesPerRow, bytesPerImage, remainder; + + if (bytesPerPixel <= 0) + return -1; /* error */ + if (packing->RowLength == 0) { + bytesPerRow = bytesPerPixel * width; + } + else { + bytesPerRow = bytesPerPixel * packing->RowLength; + } + remainder = bytesPerRow % packing->Alignment; + if (remainder > 0) + bytesPerRow += (packing->Alignment - remainder); + + if (packing->ImageHeight == 0) + bytesPerImage = bytesPerRow * height; + else + bytesPerImage = bytesPerRow * packing->ImageHeight; + + return bytesPerImage; + } +} + + + + +/* * Unpack a 32x32 pixel polygon stipple from user memory using the * current pixel unpack settings. */ diff --git a/xc/extras/Mesa/src/image.h b/xc/extras/Mesa/src/image.h index de1546a27..39260f0b4 100644 --- a/xc/extras/Mesa/src/image.h +++ b/xc/extras/Mesa/src/image.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -68,6 +68,11 @@ _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, GLint width, GLenum format, GLenum type ); +extern GLint +_mesa_image_image_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLint height, + GLenum format, GLenum type ); + extern void _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], const struct gl_pixelstore_attrib *unpacking ); diff --git a/xc/extras/Mesa/src/imports.c b/xc/extras/Mesa/src/imports.c index c19e51d65..3d197563e 100644 --- a/xc/extras/Mesa/src/imports.c +++ b/xc/extras/Mesa/src/imports.c @@ -1,10 +1,8 @@ -/* $Id: imports.c,v 1.1.1.1 2002/10/22 13:05:51 alanh Exp $ */ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -26,146 +24,671 @@ /* - * Imports are functions which the device driver or window system or + * Imports are services which the device driver or window system or * operating system provides to the core renderer. The core renderer (Mesa) * will call these functions in order to do memory allocation, simple I/O, * etc. * - * Some drivers will need to implement these functions themselves but - * many (most?) Mesa drivers will be fine using these. + * Some drivers will want to override/replace this file with something + * specialized, but that'll be rare. + * + * Eventually, I want to move roll the glheader.h file into this. + * + * The OpenGL SI's __GLimports structure allows per-context specification of + * replacements for the standard C lib functions. In practice that's probably + * never needed; compile-time replacements are far more likely. * - * A server-side GL renderer will likely not use these functions since - * the renderer should use the XFree86-wrapped system calls. + * The _mesa_foo() functions defined here don't in general take a context + * parameter. I guess we can change that someday, if need be. + * So for now, the __GLimports stuff really isn't used. */ #include "glheader.h" -#include "imports.h" -#include "mem.h" #include "mtypes.h" +#include "context.h" +#include "imports.h" -static void * -_mesa_Malloc(__GLcontext *gc, size_t size) +#define MAXSTRING 4000 /* for vsnprintf() */ + +#ifdef WIN32 +#define vsnprintf _vsnprintf +#elif defined(__IBMC__) || defined(__IBMCPP__) || defined(VMS) +extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg); +#endif + + +/**********************************************************************/ +/* Wrappers for standard C library functions */ +/**********************************************************************/ + +/* + * Functions still needed: + * scanf + * qsort + * bsearch + * rand and RAND_MAX + */ + +void * +_mesa_malloc(size_t bytes) { - return MALLOC(size); +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86malloc(bytes); +#else + return malloc(bytes); +#endif } -static void * -_mesa_Calloc(__GLcontext *gc, size_t numElem, size_t elemSize) + +void * +_mesa_calloc(size_t bytes) { - return CALLOC(numElem * elemSize); +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86calloc(1, bytes); +#else + return calloc(1, bytes); +#endif } -static void * -_mesa_Realloc(__GLcontext *gc, void *oldAddr, size_t newSize) + +void +_mesa_free(void *ptr) { - return realloc(oldAddr, newSize); +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86free(ptr); +#else + free(ptr); +#endif } -static void -_mesa_Free(__GLcontext *gc, void *addr) + +void * +_mesa_align_malloc(size_t bytes, unsigned long alignment) { - FREE(addr); + unsigned long ptr, buf; + + ASSERT( alignment > 0 ); + + /* Allocate extra memory to accomodate rounding up the address for + * alignment and to record the real malloc address. + */ + ptr = (unsigned long) _mesa_malloc(bytes + alignment + sizeof(void *)); + if (!ptr) + return NULL; + + buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1); + *(unsigned long *)(buf - sizeof(void *)) = ptr; + +#ifdef DEBUG + /* mark the non-aligned area */ + while ( ptr < buf - sizeof(void *) ) { + *(unsigned long *)ptr = 0xcdcdcdcd; + ptr += sizeof(unsigned long); + } +#endif + + return (void *) buf; } -/* Must be before '#undef getenv' for inclusion in XFree86. - */ -static char * CAPI -_mesa_getenv(__GLcontext *gc, const char *var) + +void * +_mesa_align_calloc(size_t bytes, unsigned long alignment) { - (void) gc; + unsigned long ptr, buf; + + ASSERT( alignment > 0 ); + + ptr = (unsigned long) _mesa_calloc(bytes + alignment + sizeof(void *)); + if (!ptr) + return NULL; + + buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1); + *(unsigned long *)(buf - sizeof(void *)) = ptr; + +#ifdef DEBUG + /* mark the non-aligned area */ + while ( ptr < buf - sizeof(void *) ) { + *(unsigned long *)ptr = 0xcdcdcdcd; + ptr += sizeof(unsigned long); + } +#endif + + return (void *)buf; +} + + +void +_mesa_align_free(void *ptr) +{ +#if 0 + _mesa_free( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) ); +#else + /* The actuall address to free is stuffed in the word immediately + * before the address the client sees. + */ + void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); + void *realAddr = *cubbyHole; + _mesa_free(realAddr); +#endif +} + + +void * +_mesa_memcpy(void *dest, const void *src, size_t n) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86memcpy(dest, src, n); +#elif defined(SUNOS4) + return memcpy((char *) dest, (char *) src, (int) n); +#else + return memcpy(dest, src, n); +#endif +} + + +void +_mesa_memset( void *dst, int val, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86memset( dst, val, n ); +#elif defined(SUNOS4) + memset( (char *) dst, (int) val, (int) n ); +#else + memset(dst, val, n); +#endif +} + + +void +_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) +{ + while (n-- > 0) + *dst++ = val; +} + + +void +_mesa_bzero( void *dst, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86memset( dst, 0, n ); +#elif defined(__FreeBSD__) + bzero( dst, n ); +#else + memset( dst, 0, n ); +#endif +} + + +double +_mesa_sin(double a) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86sin(a); +#else + return sin(a); +#endif +} + + +double +_mesa_cos(double a) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86cos(a); +#else + return cos(a); +#endif +} + + +double +_mesa_sqrt(double x) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86sqrt(x); +#else + return sqrt(x); +#endif +} + + +double +_mesa_pow(double x, double y) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86pow(x, y); +#else + return pow(x, y); +#endif +} + + +char * +_mesa_getenv( const char *var ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86getenv(var); +#else return getenv(var); +#endif } -static void -_mesa_warning(__GLcontext *gc, char *str) + +char * +_mesa_strstr( const char *haystack, const char *needle ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strstr(haystack, needle); +#else + return strstr(haystack, needle); +#endif +} + + +char * +_mesa_strncat( char *dest, const char *src, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strncat(dest, src, n); +#else + return strncat(dest, src, n); +#endif +} + + +char * +_mesa_strcpy( char *dest, const char *src ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strcpy(dest, src); +#else + return strcpy(dest, src); +#endif +} + + +char * +_mesa_strncpy( char *dest, const char *src, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strncpy(dest, src, n); +#else + return strncpy(dest, src, n); +#endif +} + + +size_t +_mesa_strlen( const char *s ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strlen(s); +#else + return strlen(s); +#endif +} + + +int +_mesa_strcmp( const char *s1, const char *s2 ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strcmp(s1, s2); +#else + return strcmp(s1, s2); +#endif +} + + +int +_mesa_strncmp( const char *s1, const char *s2, size_t n ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strncmp(s1, s2, n); +#else + return strncmp(s1, s2, n); +#endif +} + + +char * +_mesa_strdup( const char *s ) +{ + int l = _mesa_strlen(s); + char *s2 = (char *) _mesa_malloc(l + 1); + if (s2) + _mesa_strcpy(s2, s); + return s2; +} + + +int +_mesa_atoi(const char *s) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86atoi(s); +#else + return atoi(s); +#endif +} + + +double +_mesa_strtod( const char *s, char **end ) +{ +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86strtod(s, end); +#else + return strtod(s, end); +#endif +} + + +int +_mesa_sprintf( char *str, const char *fmt, ... ) +{ + int r; + va_list args; + va_start( args, fmt ); + va_end( args ); +#if defined(XFree86LOADER) && defined(IN_MODULE) + r = xf86vsprintf( str, fmt, args ); +#else + r = vsprintf( str, fmt, args ); +#endif + return r; +} + + +void +_mesa_printf( const char *fmtString, ... ) +{ + char s[MAXSTRING]; + va_list args; + va_start( args, fmtString ); + vsnprintf(s, MAXSTRING, fmtString, args); + va_end( args ); +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86printf("%s", s); +#else + printf("%s", s); +#endif +} + + +void +_mesa_warning( GLcontext *ctx, const char *fmtString, ... ) { GLboolean debug; + char str[MAXSTRING]; + va_list args; + (void) ctx; + va_start( args, fmtString ); + (void) vsnprintf( str, MAXSTRING, fmtString, args ); + va_end( args ); #ifdef DEBUG - debug = GL_TRUE; + debug = GL_TRUE; /* always print warning */ #else -/* Whacko XFree86 macro: + debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE; +#endif + if (debug) { +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86fprintf(stderr, "Mesa warning: %s\n", str); +#else + fprintf(stderr, "Mesa warning: %s\n", str); +#endif + } +} + + +/* + * This function is called when the Mesa user has stumbled into a code + * path which may not be implemented fully or correctly. */ -#ifdef getenv -#undef getenv +void +_mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) +{ + va_list args; + char str[MAXSTRING]; + (void) ctx; + + va_start( args, fmtString ); + vsnprintf( str, MAXSTRING, fmtString, args ); + va_end( args ); + +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86fprintf(stderr, "Mesa implementation error: %s\n", str); + xf86fprintf(stderr, "Please report to the DRI project at dri.sourceforge.net\n"); +#else + fprintf(stderr, "Mesa implementation error: %s\n", str); + fprintf(stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); #endif - if (gc->imports.getenv(gc, "MESA_DEBUG")) { +} + + +/* + * If in debug mode, print error message to stdout. + * Also, record the error code by calling _mesa_record_error(). + * Input: ctx - the GL context + * error - the error value + * fmtString - printf-style format string, followed by optional args + */ +void +_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) +{ + const char *debugEnv; + GLboolean debug; + + debugEnv = _mesa_getenv("MESA_DEBUG"); + +#ifdef DEBUG + if (debugEnv && _mesa_strstr(debugEnv, "silent")) + debug = GL_FALSE; + else debug = GL_TRUE; - } - else { +#else + if (debugEnv) + debug = GL_TRUE; + else debug = GL_FALSE; - } #endif + if (debug) { - fprintf(stderr, "Mesa warning: %s\n", str); + va_list args; + char where[MAXSTRING]; + const char *errstr; + + va_start( args, fmtString ); + vsnprintf( where, MAXSTRING, fmtString, args ); + va_end( args ); + + switch (error) { + case GL_NO_ERROR: + errstr = "GL_NO_ERROR"; + break; + case GL_INVALID_VALUE: + errstr = "GL_INVALID_VALUE"; + break; + case GL_INVALID_ENUM: + errstr = "GL_INVALID_ENUM"; + break; + case GL_INVALID_OPERATION: + errstr = "GL_INVALID_OPERATION"; + break; + case GL_STACK_OVERFLOW: + errstr = "GL_STACK_OVERFLOW"; + break; + case GL_STACK_UNDERFLOW: + errstr = "GL_STACK_UNDERFLOW"; + break; + case GL_OUT_OF_MEMORY: + errstr = "GL_OUT_OF_MEMORY"; + break; + case GL_TABLE_TOO_LARGE: + errstr = "GL_TABLE_TOO_LARGE"; + break; + default: + errstr = "unknown"; + break; + } + _mesa_debug(ctx, "Mesa user error: %s in %s\n", errstr, where); } + + _mesa_record_error(ctx, error); +} + + +/* + * Call this to report debug information. Uses stderr. + */ +void +_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) +{ + char s[MAXSTRING]; + va_list args; + va_start(args, fmtString); + vsnprintf(s, MAXSTRING, fmtString, args); + va_end(args); +#if defined(XFree86LOADER) && defined(IN_MODULE) + xf86fprintf(stderr, "Mesa: %s", s); +#else + fprintf(stderr, "Mesa: %s", s); +#endif +} + + + +/**********************************************************************/ +/* Default Imports Wrapper */ +/**********************************************************************/ + +static void * +default_malloc(__GLcontext *gc, size_t size) +{ + (void) gc; + return _mesa_malloc(size); +} + +static void * +default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) +{ + (void) gc; + return _mesa_calloc(numElem * elemSize); +} + +static void * +default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) +{ + (void) gc; +#if defined(XFree86LOADER) && defined(IN_MODULE) + return xf86realloc(oldAddr, newSize); +#else + return realloc(oldAddr, newSize); +#endif } static void -_mesa_fatal(__GLcontext *gc, char *str) +default_free(__GLcontext *gc, void *addr) { - fprintf(stderr, "%s\n", str); + (void) gc; + _mesa_free(addr); +} + +static char * CAPI +default_getenv( __GLcontext *gc, const char *var ) +{ + (void) gc; + return _mesa_getenv(var); +} + +static void +default_warning(__GLcontext *gc, char *str) +{ + _mesa_warning(gc, str); +} + +static void +default_fatal(__GLcontext *gc, char *str) +{ + _mesa_problem(gc, str); abort(); } static int CAPI -_mesa_atoi(__GLcontext *gc, const char *str) +default_atoi(__GLcontext *gc, const char *str) { (void) gc; return atoi(str); } static int CAPI -_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) +default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) { - /* XXX fix this */ - return sprintf(str, fmt); + int r; + va_list args; + va_start( args, fmt ); + r = vsprintf( str, fmt, args ); + va_end( args ); + return r; } static void * CAPI -_mesa_fopen(__GLcontext *gc, const char *path, const char *mode) +default_fopen(__GLcontext *gc, const char *path, const char *mode) { return fopen(path, mode); } static int CAPI -_mesa_fclose(__GLcontext *gc, void *stream) +default_fclose(__GLcontext *gc, void *stream) { return fclose((FILE *) stream); } static int CAPI -_mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) +default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) { - /* XXX fix this */ - return fprintf((FILE *) stream, fmt); + int r; + va_list args; + va_start( args, fmt ); + r = vfprintf( (FILE *) stream, fmt, args ); + va_end( args ); + return r; } /* XXX this really is driver-specific and can't be here */ static __GLdrawablePrivate * -_mesa_GetDrawablePrivate(__GLcontext *gc) +default_GetDrawablePrivate(__GLcontext *gc) { return NULL; } + + +/* + * Initialize a __GLimports object to point to the functions in + * this file. This is to be called from device drivers. + * Input: imports - the object to init + * driverCtx - pointer to device driver-specific data + */ void -_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other) -{ - imports->malloc = _mesa_Malloc; - imports->calloc = _mesa_Calloc; - imports->realloc = _mesa_Realloc; - imports->free = _mesa_Free; - imports->warning = _mesa_warning; - imports->fatal = _mesa_fatal; - imports->getenv = _mesa_getenv; - imports->atoi = _mesa_atoi; - imports->sprintf = _mesa_sprintf; - imports->fopen = _mesa_fopen; - imports->fclose = _mesa_fclose; - imports->fprintf = _mesa_fprintf; - imports->getDrawablePrivate = _mesa_GetDrawablePrivate; -/* imports->wscx = driverCtx; */ +_mesa_init_default_imports(__GLimports *imports, void *driverCtx) +{ + imports->malloc = default_malloc; + imports->calloc = default_calloc; + imports->realloc = default_realloc; + imports->free = default_free; + imports->warning = default_warning; + imports->fatal = default_fatal; + imports->getenv = default_getenv; /* not used for now */ + imports->atoi = default_atoi; + imports->sprintf = default_sprintf; + imports->fopen = default_fopen; + imports->fclose = default_fclose; + imports->fprintf = default_fprintf; + imports->getDrawablePrivate = default_GetDrawablePrivate; imports->other = driverCtx; } diff --git a/xc/extras/Mesa/src/imports.h b/xc/extras/Mesa/src/imports.h index 53c823c34..936976fd0 100644 --- a/xc/extras/Mesa/src/imports.h +++ b/xc/extras/Mesa/src/imports.h @@ -1,10 +1,8 @@ -/* $Id: imports.h,v 1.1.1.1 2002/10/22 13:05:51 alanh Exp $ */ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -25,15 +23,180 @@ */ +/* + * This file provides wrappers for all the standard C library functions + * like malloc, free, printf, getenv, etc. + */ + + #ifndef IMPORTS_H #define IMPORTS_H -#include "glheader.h" +#define MALLOC(BYTES) _mesa_malloc(BYTES) +#define CALLOC(BYTES) _mesa_calloc(BYTES) +#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) +#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) +#define FREE(PTR) _mesa_free(PTR) +#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N) +#define ALIGN_CALLOC(BYTES, N) _mesa_align_calloc(BYTES, N) +#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) +#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) +#define ALIGN_FREE(PTR) _mesa_align_free(PTR) -extern void -_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other); +#define MEMCPY( DST, SRC, BYTES) _mesa_memcpy(DST, SRC, BYTES) +#define MEMSET( DST, VAL, N ) _mesa_memset(DST, VAL, N) +extern void _mesa_memset16( GLushort *dst, GLushort val, size_t n ); + +#define MEMSET16( DST, VAL, N ) \ + _mesa_memset16( (GLushort *) (DST), (GLushort) (VAL), (size_t) (N) ) +/* MACs and BeOS don't support static larger than 32kb, so... */ +#if defined(macintosh) && !defined(__MRC__) +/*extern char *AGLAlloc(int size);*/ +/*extern void AGLFree(char* ptr);*/ +# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_alloc(sizeof(TYPE)*(SIZE)) +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_alloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) + +# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) +# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) +#elif defined(__BEOS__) +# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)_mesa_malloc(sizeof(TYPE)*(SIZE)) +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])_mesa_malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) +# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) +# define UNDEFARRAY(NAME) do {if ((NAME)) {_mesa_free((char*)NAME);} }while (0) +#else +# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE] +# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2] +# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3] +# define CHECKARRAY(NAME,CMD) do {} while(0) +# define UNDEFARRAY(NAME) #endif + + +#ifdef MESA_EXTERNAL_BUFFERALLOC +/* + * If you want Mesa's depth/stencil/accum/etc buffers to be allocated + * with a specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC + * and implement _ext_mesa_alloc/free_pixelbuffer() in your app. + * Contributed by Gerk Huisma (gerk@five-d.demon.nl). + */ +extern void *_ext_mesa_alloc_pixelbuffer( unsigned int size ); +extern void _ext_mesa_free_pixelbuffer( void *pb ); + +#define MESA_PBUFFER_ALLOC(BYTES) (void *) _ext_mesa_alloc_pixelbuffer(BYTES) +#define MESA_PBUFFER_FREE(PTR) _ext_mesa_free_pixelbuffer(PTR) +#else +/* Default buffer allocation uses the aligned allocation routines: */ +#define MESA_PBUFFER_ALLOC(BYTES) (void *) _mesa_align_malloc(BYTES, 512) +#define MESA_PBUFFER_FREE(PTR) _mesa_align_free(PTR) +#endif + + +extern void * +_mesa_malloc( size_t bytes ); + +extern void * +_mesa_calloc( size_t bytes ); + +extern void +_mesa_free( void *ptr ); + +extern void * +_mesa_align_malloc( size_t bytes, unsigned long alignment ); + +extern void * +_mesa_align_calloc( size_t bytes, unsigned long alignment ); + +extern void +_mesa_align_free( void *ptr ); + +extern void * +_mesa_memcpy( void *dest, const void *src, size_t n ); + +extern void +_mesa_memset( void *dst, int val, size_t n ); + +extern void +_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); + +extern void +_mesa_bzero( void *dst, size_t n ); + + +extern double +_mesa_sin(double a); + +extern double +_mesa_cos(double a); + +extern double +_mesa_sqrt(double x); + +extern double +_mesa_pow(double x, double y); + + +extern char * +_mesa_getenv( const char *var ); + +extern char * +_mesa_strstr( const char *haystack, const char *needle ); + +extern char * +_mesa_strncat( char *dest, const char *src, size_t n ); + +extern char * +_mesa_strcpy( char *dest, const char *src ); + +extern char * +_mesa_strncpy( char *dest, const char *src, size_t n ); + +extern size_t +_mesa_strlen( const char *s ); + +extern int +_mesa_strcmp( const char *s1, const char *s2 ); + +extern int +_mesa_strncmp( const char *s1, const char *s2, size_t n ); + +extern char * +_mesa_strdup( const char *s ); + +extern int +_mesa_atoi( const char *s ); + +extern double +_mesa_strtod( const char *s, char **end ); + +extern int +_mesa_sprintf( char *str, const char *fmt, ... ); + +extern void +_mesa_printf( const char *fmtString, ... ); + + +extern void +_mesa_warning( __GLcontext *gc, const char *fmtString, ... ); + +extern void +_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ); + +extern void +_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); + +extern void +_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); + + +extern void +_mesa_init_default_imports( __GLimports *imports, void *driverCtx ); + + +#endif /* IMPORTS_H */ + diff --git a/xc/extras/Mesa/src/light.c b/xc/extras/Mesa/src/light.c index c649ce2d8..25ff41889 100644 --- a/xc/extras/Mesa/src/light.c +++ b/xc/extras/Mesa/src/light.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,23 +24,18 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "enums.h" #include "light.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "simple_list.h" #include "mtypes.h" - #include "math/m_xform.h" #include "math/m_matrix.h" -#endif /* XXX this is a bit of a hack needed for compilation within XFree86 */ @@ -56,7 +51,7 @@ _mesa_ShadeModel( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); if (mode != GL_FLAT && mode != GL_SMOOTH) { _mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" ); @@ -90,7 +85,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) struct gl_light *l = &ctx->Light.Light[i]; if (i < 0 || i >= (GLint) ctx->Const.MaxLights) { - _mesa_error( ctx, GL_INVALID_ENUM, "glLight" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glLight(light=0x%x)", light ); return; } @@ -116,7 +111,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) case GL_POSITION: { GLfloat tmp[4]; /* transform position by ModelView matrix */ - TRANSFORM_POINT( tmp, ctx->ModelView.m, params ); + TRANSFORM_POINT( tmp, ctx->ModelviewMatrixStack.Top->m, params ); if (TEST_EQ_4V(l->EyePosition, tmp)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); @@ -130,10 +125,10 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) case GL_SPOT_DIRECTION: { GLfloat tmp[4]; /* transform direction by inverse modelview */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } - TRANSFORM_NORMAL( tmp, params, ctx->ModelView.inv ); + TRANSFORM_NORMAL( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_3V(l->EyeDirection, tmp)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); @@ -160,7 +155,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); l->SpotCutoff = params[0]; - l->_CosCutoff = (GLfloat) cos(params[0]*DEG2RAD); + l->_CosCutoff = (GLfloat) _mesa_cos(params[0]*DEG2RAD); if (l->_CosCutoff < 0) l->_CosCutoff = 0; if (l->SpotCutoff != 180.0F) @@ -199,7 +194,7 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) l->QuadraticAttenuation = params[0]; break; default: - _mesa_error( ctx, GL_INVALID_ENUM, "glLight" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glLight(pname=0x%x)", pname ); return; } @@ -418,7 +413,8 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) newenum = GL_SEPARATE_SPECULAR_COLOR; else { - _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param=0x0%x)", + (GLint) params[0] ); return; } if (ctx->Light.Model.ColorControl == newenum) @@ -435,7 +431,7 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) break; default: - _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname ); break; } @@ -616,7 +612,7 @@ void _mesa_update_material( GLcontext *ctx, bitmask &= ~ctx->Light.ColorMaterialBitmask; if (MESA_VERBOSE&VERBOSE_IMMEDIATE) - fprintf(stderr, "_mesa_update_material, mask 0x%x\n", bitmask); + _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask); if (!bitmask) return; @@ -713,25 +709,16 @@ void _mesa_update_material( GLcontext *ctx, ctx->Light.Material[1].SpecularIndex = src[1].SpecularIndex; } - if (0) - { + if (0) { struct gl_material *mat = &ctx->Light.Material[0]; - fprintf(stderr, "update_mat emission : %f %f %f\n", - mat->Emission[0], - mat->Emission[1], - mat->Emission[2]); - fprintf(stderr, "update_mat specular : %f %f %f\n", - mat->Specular[0], - mat->Specular[1], - mat->Specular[2]); - fprintf(stderr, "update_mat diffuse : %f %f %f\n", - mat->Diffuse[0], - mat->Diffuse[1], - mat->Diffuse[2]); - fprintf(stderr, "update_mat ambient : %f %f %f\n", - mat->Ambient[0], - mat->Ambient[1], - mat->Ambient[2]); + _mesa_debug(ctx, "update_mat emission : %f %f %f\n", + mat->Emission[0], mat->Emission[1], mat->Emission[2]); + _mesa_debug(ctx, "update_mat specular : %f %f %f\n", + mat->Specular[0], mat->Specular[1], mat->Specular[2]); + _mesa_debug(ctx, "update_mat diffuse : %f %f %f\n", + mat->Diffuse[0], mat->Diffuse[1], mat->Diffuse[2]); + _mesa_debug(ctx, "update_mat ambient : %f %f %f\n", + mat->Ambient[0], mat->Ambient[1], mat->Ambient[2]); } } @@ -753,7 +740,7 @@ void _mesa_update_color_material( GLcontext *ctx, GLuint bitmask = ctx->Light.ColorMaterialBitmask; if (MESA_VERBOSE&VERBOSE_IMMEDIATE) - fprintf(stderr, "_mesa_update_color_material, mask 0x%x\n", bitmask); + _mesa_debug(ctx, "_mesa_update_color_material, mask 0x%x\n", bitmask); /* update emissive colors */ if (bitmask & FRONT_EMISSION_BIT) { @@ -830,25 +817,16 @@ void _mesa_update_color_material( GLcontext *ctx, } } - if (0) - { + if (0) { struct gl_material *mat = &ctx->Light.Material[0]; - fprintf(stderr, "update_color_mat emission : %f %f %f\n", - mat->Emission[0], - mat->Emission[1], - mat->Emission[2]); - fprintf(stderr, "update_color_mat specular : %f %f %f\n", - mat->Specular[0], - mat->Specular[1], - mat->Specular[2]); - fprintf(stderr, "update_color_mat diffuse : %f %f %f\n", - mat->Diffuse[0], - mat->Diffuse[1], - mat->Diffuse[2]); - fprintf(stderr, "update_color_mat ambient : %f %f %f\n", - mat->Ambient[0], - mat->Ambient[1], - mat->Ambient[2]); + _mesa_debug(ctx, "update_color_mat emission : %f %f %f\n", + mat->Emission[0], mat->Emission[1], mat->Emission[2]); + _mesa_debug(ctx, "update_color_mat specular : %f %f %f\n", + mat->Specular[0], mat->Specular[1], mat->Specular[2]); + _mesa_debug(ctx, "update_color_mat diffuse : %f %f %f\n", + mat->Diffuse[0], mat->Diffuse[1], mat->Diffuse[2]); + _mesa_debug(ctx, "update_color_mat ambient : %f %f %f\n", + mat->Ambient[0], mat->Ambient[1], mat->Ambient[2]); } } @@ -867,9 +845,9 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glColorMaterial %s %s\n", - _mesa_lookup_enum_by_nr(face), - _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glColorMaterial %s %s\n", + _mesa_lookup_enum_by_nr(face), + _mesa_lookup_enum_by_nr(mode)); bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial"); @@ -885,7 +863,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) if (ctx->Light.ColorMaterialEnabled) { FLUSH_CURRENT( ctx, 0 ); - _mesa_update_color_material( ctx, ctx->Current.Color ); + _mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } if (ctx->Driver.ColorMaterial) @@ -1059,7 +1037,7 @@ static void validate_spot_exp_table( struct gl_light *l ) for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { if (clamp == 0) { - tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); + tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); if (tmp < FLT_MIN * 100.0) { tmp = 0.0; clamp = 1; @@ -1117,7 +1095,7 @@ static void validate_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess ) GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1); if (x < 0.005) /* underflow check */ x = 0.005; - t = pow(x, shininess); + t = _mesa_pow(x, shininess); if (t > 1e-20) m[j] = (GLfloat) t; else @@ -1257,16 +1235,21 @@ _mesa_compute_light_positions( GLcontext *ctx ) COPY_3V( ctx->_EyeZDir, eye_z ); } else { - TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelView.m ); + TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelviewMatrixStack.Top->m ); } foreach (light, &ctx->Light.EnabledList) { if (ctx->_NeedEyeCoords) { COPY_4FV( light->_Position, light->EyePosition ); +#if 0 + light->_Position[0] /= light->_Position[3]; + light->_Position[1] /= light->_Position[3]; + light->_Position[2] /= light->_Position[3]; +#endif } else { - TRANSFORM_POINT( light->_Position, ctx->ModelView.inv, + TRANSFORM_POINT( light->_Position, ctx->ModelviewMatrixStack.Top->inv, light->EyePosition ); } @@ -1290,7 +1273,7 @@ _mesa_compute_light_positions( GLcontext *ctx ) else { TRANSFORM_NORMAL( light->_NormDirection, light->EyeDirection, - ctx->ModelView.m); + ctx->ModelviewMatrixStack.Top->m); } NORMALIZE_3FV( light->_NormDirection ); diff --git a/xc/extras/Mesa/src/light.h b/xc/extras/Mesa/src/light.h index bee9b4f40..557e48802 100644 --- a/xc/extras/Mesa/src/light.h +++ b/xc/extras/Mesa/src/light.h @@ -85,7 +85,7 @@ do { \ float f = (dp * (SHINE_TABLE_SIZE-1)); \ int k = (int) f; \ if (k > SHINE_TABLE_SIZE-2) \ - result = (GLfloat) pow( dp, _tab->shininess ); \ + result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \ else \ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ } while (0) diff --git a/xc/extras/Mesa/src/lines.c b/xc/extras/Mesa/src/lines.c index a596a9362..7ffa50272 100644 --- a/xc/extras/Mesa/src/lines.c +++ b/xc/extras/Mesa/src/lines.c @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "depth.h" @@ -35,8 +32,6 @@ #include "mmath.h" #include "texstate.h" #include "mtypes.h" -#endif - void diff --git a/xc/extras/Mesa/src/lowpc.c b/xc/extras/Mesa/src/lowpc.c deleted file mode 100644 index 848e703e0..000000000 --- a/xc/extras/Mesa/src/lowpc.c +++ /dev/null @@ -1,30 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - - -/* - * This is the lowest address in Mesa - */ -void mesa_lowpc(void) { } diff --git a/xc/extras/Mesa/src/macros.h b/xc/extras/Mesa/src/macros.h index b3502b609..dbe097961 100644 --- a/xc/extras/Mesa/src/macros.h +++ b/xc/extras/Mesa/src/macros.h @@ -58,15 +58,6 @@ #endif - -/* - * Bitmask helpers - */ -#define SET_BITS(WORD, BITS) (WORD) |= (BITS) -#define CLEAR_BITS(WORD, BITS) (WORD) &= ~(BITS) -#define TEST_BITS(WORD, BITS) ((WORD) & (BITS)) - - /* Stepping a GLfloat pointer by a byte stride */ #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) @@ -121,6 +112,27 @@ do { \ (DST)[3] = (SRC)[3]; \ } while (0) +#define COPY_2V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ +} while (0) + +#define COPY_3V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ +} while (0) + +#define COPY_4V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ + (DST)[3] = (CAST)(SRC)[3]; \ +} while (0) + #if defined(__i386__) #define COPY_4UBV(DST, SRC) \ do { \ @@ -453,7 +465,7 @@ do { \ -/* Generic color packing macros. +/* Generic color packing macros * XXX We may move these into texutil.h at some point. */ diff --git a/xc/extras/Mesa/src/math/m_debug.h b/xc/extras/Mesa/src/math/m_debug.h index 4795c5207..6476b6de2 100644 --- a/xc/extras/Mesa/src/math/m_debug.h +++ b/xc/extras/Mesa/src/math/m_debug.h @@ -1,4 +1,3 @@ -/* $Id: m_debug.h,v 1.1.1.1 2002/10/22 13:06:31 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __M_DEBUG_H__ diff --git a/xc/extras/Mesa/src/math/m_debug_clip.c b/xc/extras/Mesa/src/math/m_debug_clip.c index 634f5922c..867850c61 100644 --- a/xc/extras/Mesa/src/math/m_debug_clip.c +++ b/xc/extras/Mesa/src/math/m_debug_clip.c @@ -1,8 +1,7 @@ -/* $Id: m_debug_clip.c,v 1.1.1.1 2002/10/22 13:06:32 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -24,13 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "m_matrix.h" #include "m_xform.h" @@ -48,10 +47,12 @@ static char *cnames[2] = { "_mesa_clip_tab", "_mesa_clip_np_tab" }; +#ifdef RUN_DEBUG_BENCHMARK static char *cstrings[2] = { "clip, perspective divide", "clip, no divide" }; +#endif /* ============================================================= @@ -253,20 +254,20 @@ static int test_cliptest_function( clip_func func, int np, } if ( dco != rco ) { - printf( "\n-----------------------------\n" ); - printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); return 0; } if ( dca != rca ) { - printf( "\n-----------------------------\n" ); - printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); return 0; } for ( i = 0 ; i < TEST_COUNT ; i++ ) { if ( dm[i] != rm[i] ) { - printf( "\n-----------------------------\n" ); - printf( "(i = %i)\n", i ); - printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "(i = %i)\n", i ); + _mesa_printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); return 0; } } @@ -280,19 +281,19 @@ static int test_cliptest_function( clip_func func, int np, for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "\n-----------------------------\n" ); - printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", + _mesa_printf( "\n-----------------------------\n" ); + _mesa_printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", i, j, dm[i], rm[i] ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]-d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]-d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]-d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][3], r[i][3], r[i][3]-d[i][3], MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); return 0; @@ -311,26 +312,26 @@ void _math_test_all_cliptest_functions( char *description ) if ( first_time ) { first_time = 0; - mesa_profile = getenv( "MESA_PROFILE" ); + mesa_profile = _mesa_getenv( "MESA_PROFILE" ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "cliptest results after hooking in %s functions:\n", description ); + _mesa_printf( "cliptest results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n\t" ); + _mesa_printf( "\n\t" ); for ( psize = 2 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); + _mesa_printf( " p%d\t", psize ); } - printf( "\n--------------------------------------------------------\n\t" ); + _mesa_printf( "\n--------------------------------------------------------\n\t" ); } #endif @@ -341,23 +342,23 @@ void _math_test_all_cliptest_functions( char *description ) if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "%s[%d] failed test (%s)", + _mesa_sprintf( buf, "%s[%d] failed test (%s)", cnames[np], psize, description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " %li\t", benchmark_tab[np][psize-1] ); + _mesa_printf( " %li\t", benchmark_tab[np][psize-1] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " | [%s]\n\t", cstrings[np] ); + _mesa_printf( " | [%s]\n\t", cstrings[np] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + _mesa_printf( "\n" ); #endif } diff --git a/xc/extras/Mesa/src/math/m_debug_norm.c b/xc/extras/Mesa/src/math/m_debug_norm.c index 2646c5263..4de90e3d6 100644 --- a/xc/extras/Mesa/src/math/m_debug_norm.c +++ b/xc/extras/Mesa/src/math/m_debug_norm.c @@ -1,10 +1,9 @@ -/* $Id: m_debug_norm.c,v 1.1.1.1 2002/10/22 13:06:32 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,13 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "m_matrix.h" @@ -119,14 +118,14 @@ static char *norm_strings[8] = { static void ref_norm_transform_rescale( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { GLuint i; const GLfloat *s = in->start; const GLfloat *m = mat->inv; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; (void) lengths; @@ -142,14 +141,14 @@ static void ref_norm_transform_rescale( const GLmatrix *mat, static void ref_norm_transform_normalize( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { GLuint i; const GLfloat *s = in->start; const GLfloat *m = mat->inv; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; for ( i = 0 ; i < in->count ; i++ ) { GLfloat t[3]; @@ -181,12 +180,21 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, * Normal transformation tests */ +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + + static int test_norm_function( normal_func func, int mtype, long *cycles ) { - GLvector3f source[1], dest[1], dest2[1], ref[1], ref2[1]; + GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; GLmatrix mat[1]; - GLfloat s[TEST_COUNT][5], d[TEST_COUNT][3], r[TEST_COUNT][3]; - GLfloat d2[TEST_COUNT][3], r2[TEST_COUNT][3], length[TEST_COUNT]; + GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; + GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; GLfloat scale; GLfloat *m; int i, j; @@ -232,34 +240,34 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) ); } - source->data = (GLfloat(*)[3])s; - source->start = (GLfloat *)s; + source->data = (GLfloat(*)[4]) s; + source->start = (GLfloat *) s; source->count = TEST_COUNT; source->stride = sizeof(s[0]); source->flags = 0; - dest->data = (GLfloat(*)[3])d; - dest->start = (GLfloat *)d; + dest->data = d; + dest->start = (GLfloat *) d; dest->count = TEST_COUNT; - dest->stride = sizeof(float[3]); + dest->stride = sizeof(float[4]); dest->flags = 0; - dest2->data = (GLfloat(*)[3])d2; - dest2->start = (GLfloat *)d2; + dest2->data = d2; + dest2->start = (GLfloat *) d2; dest2->count = TEST_COUNT; - dest2->stride = sizeof(float[3]); + dest2->stride = sizeof(float[4]); dest2->flags = 0; - ref->data = (GLfloat(*)[3])r; - ref->start = (GLfloat *)r; + ref->data = r; + ref->start = (GLfloat *) r; ref->count = TEST_COUNT; - ref->stride = sizeof(float[3]); + ref->stride = sizeof(float[4]); ref->flags = 0; - ref2->data = (GLfloat(*)[3])r2; - ref2->start = (GLfloat *)r2; + ref2->data = r2; + ref2->start = (GLfloat *) r2; ref2->count = TEST_COUNT; - ref2->stride = sizeof(float[3]); + ref2->stride = sizeof(float[4]); ref2->flags = 0; if ( norm_normalize_types[mtype] == 0 ) { @@ -282,15 +290,15 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 3 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf( "-----------------------------\n" ); + _mesa_printf( "(i = %i, j = %i)\n", i, j ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]/d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]/d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]/d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); return 0; @@ -298,15 +306,15 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) if ( norm_normalize_types[mtype] != 0 ) { if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { - printf( "------------------- precalculated length case ------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf( "------------------- precalculated length case ------\n" ); + _mesa_printf( "(i = %i, j = %i)\n", i, j ); + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][0], r2[i][0], r2[i][0]/d2[i][0], MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][1], r2[i][1], r2[i][1]/d2[i][1], MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][2], r2[i][2], r2[i][2]/d2[i][2], MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); return 0; @@ -334,11 +342,11 @@ void _math_test_all_normal_transform_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "normal transform results after hooking in %s functions:\n", + _mesa_printf( "normal transform results after hooking in %s functions:\n", description ); - printf( "\n-------------------------------------------------------\n" ); + _mesa_printf( "\n-------------------------------------------------------\n" ); } #endif @@ -348,21 +356,21 @@ void _math_test_all_normal_transform_functions( char *description ) if ( test_norm_function( func, mtype, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", + _mesa_sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", norm_strings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( " %li\t", benchmark_tab[mtype] ); - printf( " | [%s]\n", norm_strings[mtype] ); + _mesa_printf( " %li\t", benchmark_tab[mtype] ); + _mesa_printf( " | [%s]\n", norm_strings[mtype] ); } #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n" ); + _mesa_printf( "\n" ); fflush( stdout ); } #endif diff --git a/xc/extras/Mesa/src/math/m_debug_util.h b/xc/extras/Mesa/src/math/m_debug_util.h index 1cc77fd44..9b89c90e3 100644 --- a/xc/extras/Mesa/src/math/m_debug_util.h +++ b/xc/extras/Mesa/src/math/m_debug_util.h @@ -1,4 +1,3 @@ -/* $Id: m_debug_util.h,v 1.1.1.1 2002/10/22 13:06:27 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __M_DEBUG_UTIL_H__ @@ -263,15 +262,6 @@ static int significand_match( GLfloat a, GLfloat b ) enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; -static void init_matrix( GLfloat *m ) -{ - m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; - m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; - m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; - m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; -} - - /* Ensure our arrays are correctly aligned. */ #if defined(__GNUC__) diff --git a/xc/extras/Mesa/src/math/m_debug_xform.c b/xc/extras/Mesa/src/math/m_debug_xform.c index 7566bf060..c197d953e 100644 --- a/xc/extras/Mesa/src/math/m_debug_xform.c +++ b/xc/extras/Mesa/src/math/m_debug_xform.c @@ -1,4 +1,3 @@ -/* $Id: m_debug_xform.c,v 1.1.1.1 2002/10/22 13:06:28 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -31,7 +30,7 @@ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "m_matrix.h" #include "m_xform.h" @@ -150,6 +149,14 @@ static void ref_transform( GLvector4f *dst, * Vertex transformation tests */ +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + static GLfloat s[TEST_COUNT][4] ALIGN16; static GLfloat d[TEST_COUNT][4] ALIGN16; static GLfloat r[TEST_COUNT][4] ALIGN16; @@ -242,18 +249,18 @@ static int test_transform_function( transform_func func, int psize, for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf("-----------------------------\n" ); + _mesa_printf("(i = %i, j = %i)\n", i, j ); + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]-d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]-d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]-d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf("%f \t %f \t [diff = %e - %i bit missed]\n", d[i][3], r[i][3], r[i][3]-d[i][3], MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); return 0; @@ -280,19 +287,19 @@ void _math_test_all_transform_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf("counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "transform results after hooking in %s functions:\n", description ); + _mesa_printf("transform results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n" ); + _mesa_printf("\n" ); for ( psize = 1 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); + _mesa_printf(" p%d\t", psize ); } - printf( "\n--------------------------------------------------------\n" ); + _mesa_printf("\n--------------------------------------------------------\n" ); } #endif @@ -303,23 +310,23 @@ void _math_test_all_transform_functions( char *description ) if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + _mesa_sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", psize, mstrings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " %li\t", benchmark_tab[psize-1][mtype] ); + _mesa_printf(" %li\t", benchmark_tab[psize-1][mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " | [%s]\n", mstrings[mtype] ); + _mesa_printf(" | [%s]\n", mstrings[mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + _mesa_printf( "\n" ); #endif } diff --git a/xc/extras/Mesa/src/math/m_matrix.c b/xc/extras/Mesa/src/math/m_matrix.c index 8653c0c46..9f17e2cfc 100644 --- a/xc/extras/Mesa/src/math/m_matrix.c +++ b/xc/extras/Mesa/src/math/m_matrix.c @@ -1,8 +1,7 @@ -/* $Id: m_matrix.c,v 1.1.1.1 2002/10/22 13:06:30 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,7 +22,6 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/math/m_matrix.c,v 1.2 2002/09/12 15:16:51 tsi Exp $ */ /* @@ -35,11 +33,10 @@ * 3. Transformation of a point p by a matrix M is: p' = M * p */ -#include <math.h> - #include "glheader.h" +#include "imports.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "m_matrix.h" @@ -137,25 +134,25 @@ static void print_matrix_floats( const GLfloat m[16] ) { int i; for (i=0;i<4;i++) { - fprintf(stderr,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); + _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); } } void _math_matrix_print( const GLmatrix *m ) { - fprintf(stderr, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); + _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); print_matrix_floats(m->m); - fprintf(stderr, "Inverse: \n"); + _mesa_debug(NULL, "Inverse: \n"); if (m->inv) { GLfloat prod[16]; print_matrix_floats(m->inv); matmul4(prod, m->m, m->inv); - fprintf(stderr, "Mat * Inverse:\n"); + _mesa_debug(NULL, "Mat * Inverse:\n"); print_matrix_floats(prod); } else { - fprintf(stderr, " - not available\n"); + _mesa_debug(NULL, " - not available\n"); } } @@ -470,6 +467,7 @@ static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) #if 0 +/* broken */ static GLboolean invert_matrix_perspective( GLmatrix *mat ) { const GLfloat *in = mat->m; @@ -538,123 +536,181 @@ static GLboolean matrix_invert( GLmatrix *mat ) /* * Generate a 4x4 transformation matrix from glRotate parameters, and * postmultiply the input matrix by it. + * This function contributed by Erich Boleyn (erich@uruk.org). + * Optimizatios contributed by Rudolf Opalla (rudi@khm.de). */ void _math_matrix_rotate( GLmatrix *mat, GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { - /* This function contributed by Erich Boleyn (erich@uruk.org) */ - GLfloat mag, s, c; - GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c; + GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; GLfloat m[16]; + GLboolean optimized; s = (GLfloat) sin( angle * DEG2RAD ); c = (GLfloat) cos( angle * DEG2RAD ); - mag = (GLfloat) GL_SQRT( x*x + y*y + z*z ); + MEMCPY(m, Identity, sizeof(GLfloat)*16); + optimized = GL_FALSE; - if (mag <= 1.0e-4) { - /* generate an identity matrix and return */ - MEMCPY(m, Identity, sizeof(GLfloat)*16); - return; - } +#define M(row,col) m[col*4+row] - x /= mag; - y /= mag; - z /= mag; + if (x == 0.0F) { + if (y == 0.0F) { + if (z != 0.0F) { + optimized = GL_TRUE; + /* rotate only around z-axis */ + M(0,0) = c; + M(1,1) = c; + if (z < 0.0F) { + M(0,1) = s; + M(1,0) = -s; + } + else { + M(0,1) = -s; + M(1,0) = s; + } + } + } + else if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around y-axis */ + M(0,0) = c; + M(2,2) = c; + if (y < 0.0F) { + M(0,2) = -s; + M(2,0) = s; + } + else { + M(0,2) = s; + M(2,0) = -s; + } + } + } + else if (y == 0.0F) { + if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around x-axis */ + M(1,1) = c; + M(2,2) = c; + if (y < 0.0F) { + M(1,2) = s; + M(2,1) = -s; + } + else { + M(1,2) = -s; + M(2,1) = s; + } + } + } -#define M(row,col) m[col*4+row] + if (!optimized) { + const GLfloat mag = (GLfloat) GL_SQRT(x * x + y * y + z * z); - /* - * Arbitrary axis rotation matrix. - * - * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied - * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation - * (which is about the X-axis), and the two composite transforms - * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary - * from the arbitrary axis to the X-axis then back. They are - * all elementary rotations. - * - * Rz' is a rotation about the Z-axis, to bring the axis vector - * into the x-z plane. Then Ry' is applied, rotating about the - * Y-axis to bring the axis vector parallel with the X-axis. The - * rotation about the X-axis is then performed. Ry and Rz are - * simply the respective inverse transforms to bring the arbitrary - * axis back to it's original orientation. The first transforms - * Rz' and Ry' are considered inverses, since the data from the - * arbitrary axis gives you info on how to get to it, not how - * to get away from it, and an inverse must be applied. - * - * The basic calculation used is to recognize that the arbitrary - * axis vector (x, y, z), since it is of unit length, actually - * represents the sines and cosines of the angles to rotate the - * X-axis to the same orientation, with theta being the angle about - * Z and phi the angle about Y (in the order described above) - * as follows: - * - * cos ( theta ) = x / sqrt ( 1 - z^2 ) - * sin ( theta ) = y / sqrt ( 1 - z^2 ) - * - * cos ( phi ) = sqrt ( 1 - z^2 ) - * sin ( phi ) = z - * - * Note that cos ( phi ) can further be inserted to the above - * formulas: - * - * cos ( theta ) = x / cos ( phi ) - * sin ( theta ) = y / sin ( phi ) - * - * ...etc. Because of those relations and the standard trigonometric - * relations, it is pssible to reduce the transforms down to what - * is used below. It may be that any primary axis chosen will give the - * same results (modulo a sign convention) using thie method. - * - * Particularly nice is to notice that all divisions that might - * have caused trouble when parallel to certain planes or - * axis go away with care paid to reducing the expressions. - * After checking, it does perform correctly under all cases, since - * in all the cases of division where the denominator would have - * been zero, the numerator would have been zero as well, giving - * the expected result. - */ + if (mag <= 1.0e-4) { + /* no rotation, leave mat as-is */ + return; + } - xx = x * x; - yy = y * y; - zz = z * z; - xy = x * y; - yz = y * z; - zx = z * x; - xs = x * s; - ys = y * s; - zs = z * s; - one_c = 1.0F - c; - - M(0,0) = (one_c * xx) + c; - M(0,1) = (one_c * xy) - zs; - M(0,2) = (one_c * zx) + ys; - M(0,3) = 0.0F; - - M(1,0) = (one_c * xy) + zs; - M(1,1) = (one_c * yy) + c; - M(1,2) = (one_c * yz) - xs; - M(1,3) = 0.0F; - - M(2,0) = (one_c * zx) - ys; - M(2,1) = (one_c * yz) + xs; - M(2,2) = (one_c * zz) + c; - M(2,3) = 0.0F; - - M(3,0) = 0.0F; - M(3,1) = 0.0F; - M(3,2) = 0.0F; - M(3,3) = 1.0F; + x /= mag; + y /= mag; + z /= mag; + + + /* + * Arbitrary axis rotation matrix. + * + * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied + * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation + * (which is about the X-axis), and the two composite transforms + * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary + * from the arbitrary axis to the X-axis then back. They are + * all elementary rotations. + * + * Rz' is a rotation about the Z-axis, to bring the axis vector + * into the x-z plane. Then Ry' is applied, rotating about the + * Y-axis to bring the axis vector parallel with the X-axis. The + * rotation about the X-axis is then performed. Ry and Rz are + * simply the respective inverse transforms to bring the arbitrary + * axis back to it's original orientation. The first transforms + * Rz' and Ry' are considered inverses, since the data from the + * arbitrary axis gives you info on how to get to it, not how + * to get away from it, and an inverse must be applied. + * + * The basic calculation used is to recognize that the arbitrary + * axis vector (x, y, z), since it is of unit length, actually + * represents the sines and cosines of the angles to rotate the + * X-axis to the same orientation, with theta being the angle about + * Z and phi the angle about Y (in the order described above) + * as follows: + * + * cos ( theta ) = x / sqrt ( 1 - z^2 ) + * sin ( theta ) = y / sqrt ( 1 - z^2 ) + * + * cos ( phi ) = sqrt ( 1 - z^2 ) + * sin ( phi ) = z + * + * Note that cos ( phi ) can further be inserted to the above + * formulas: + * + * cos ( theta ) = x / cos ( phi ) + * sin ( theta ) = y / sin ( phi ) + * + * ...etc. Because of those relations and the standard trigonometric + * relations, it is pssible to reduce the transforms down to what + * is used below. It may be that any primary axis chosen will give the + * same results (modulo a sign convention) using thie method. + * + * Particularly nice is to notice that all divisions that might + * have caused trouble when parallel to certain planes or + * axis go away with care paid to reducing the expressions. + * After checking, it does perform correctly under all cases, since + * in all the cases of division where the denominator would have + * been zero, the numerator would have been zero as well, giving + * the expected result. + */ + + xx = x * x; + yy = y * y; + zz = z * z; + xy = x * y; + yz = y * z; + zx = z * x; + xs = x * s; + ys = y * s; + zs = z * s; + one_c = 1.0F - c; + + /* We already hold the identity-matrix so we can skip some statements */ + M(0,0) = (one_c * xx) + c; + M(0,1) = (one_c * xy) - zs; + M(0,2) = (one_c * zx) + ys; +/* M(0,3) = 0.0F; */ + + M(1,0) = (one_c * xy) + zs; + M(1,1) = (one_c * yy) + c; + M(1,2) = (one_c * yz) - xs; +/* M(1,3) = 0.0F; */ + + M(2,0) = (one_c * zx) - ys; + M(2,1) = (one_c * yz) + xs; + M(2,2) = (one_c * zz) + c; +/* M(2,3) = 0.0F; */ +/* + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +*/ + } #undef M matrix_multf( mat, m, MAT_FLAG_ROTATION ); } + void _math_matrix_frustum( GLmatrix *mat, GLfloat left, GLfloat right, @@ -985,11 +1041,10 @@ _math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) void _math_matrix_ctr( GLmatrix *m ) { - if ( m->m == 0 ) { - m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); - } - MEMCPY( m->m, Identity, sizeof(Identity) ); - m->inv = 0; + m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + if (m->m) + MEMCPY( m->m, Identity, sizeof(Identity) ); + m->inv = NULL; m->type = MATRIX_IDENTITY; m->flags = 0; } @@ -997,13 +1052,13 @@ _math_matrix_ctr( GLmatrix *m ) void _math_matrix_dtr( GLmatrix *m ) { - if ( m->m != 0 ) { + if (m->m) { ALIGN_FREE( m->m ); - m->m = 0; + m->m = NULL; } - if ( m->inv != 0 ) { + if (m->inv) { ALIGN_FREE( m->inv ); - m->inv = 0; + m->inv = NULL; } } @@ -1011,9 +1066,10 @@ _math_matrix_dtr( GLmatrix *m ) void _math_matrix_alloc_inv( GLmatrix *m ) { - if ( m->inv == 0 ) { + if (!m->inv) { m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); - MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); + if (m->inv) + MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); } } diff --git a/xc/extras/Mesa/src/math/m_norm_tmp.h b/xc/extras/Mesa/src/math/m_norm_tmp.h index b0e3e1785..90ca38093 100644 --- a/xc/extras/Mesa/src/math/m_norm_tmp.h +++ b/xc/extras/Mesa/src/math/m_norm_tmp.h @@ -1,10 +1,9 @@ -/* $Id: m_norm_tmp.h,v 1.1.1.1 2002/10/22 13:06:32 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -28,25 +27,34 @@ * New (3.1) transformation code written by Keith Whitwell. */ -#include <math.h> -#include "m_vertices.h" +/* Functions to tranform a vector of normals. This includes applying + * the transformation matrix, rescaling and normalization. + */ +/* + * mat - the 4x4 transformation matrix + * scale - uniform scale factor of the transformation matrix (not always used) + * in - the source vector of normals + * lengths - length of each incoming normal (may be NULL) (a display list + * optimization) + * dest - the destination vector of normals + */ static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; - GLfloat *m = mat->inv; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + GLuint i; if (!lengths) { STRIDE_LOOP { @@ -65,8 +73,7 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, out[i][1] = (GLfloat) (ty * scale); out[i][2] = (GLfloat) (tz * scale); } - else - { + else { out[i][0] = out[i][1] = out[i][2] = 0; } } @@ -102,19 +109,20 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; - GLfloat *m = mat->inv; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; GLfloat m0 = m[0]; GLfloat m5 = m[5]; GLfloat m10 = m[10]; + GLuint i; + if (!lengths) { STRIDE_LOOP { GLfloat tx, ty, tz; @@ -132,8 +140,7 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, out[i][1] = (GLfloat) (ty * scale); out[i][2] = (GLfloat) (tz * scale); } - else - { + else { out[i][0] = out[i][1] = out[i][2] = 0; } } @@ -167,20 +174,22 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; const GLfloat *m = mat->inv; - GLfloat m0 = scale*m[0]; - GLfloat m5 = scale*m[5]; - GLfloat m10 = scale*m[10]; + const GLfloat m0 = scale*m[0]; + const GLfloat m5 = scale*m[5]; + const GLfloat m10 = scale*m[10]; + GLuint i; + (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0; @@ -190,26 +199,29 @@ TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, dest->count = in->count; } + static void _XFORMAPI TAG(transform_rescale_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; /* Since we are unlikely to have < 3 vertices in the buffer, * it makes sense to pre-multiply by scale. */ const GLfloat *m = mat->inv; - GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; - GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; - GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; + const GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; + const GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; + const GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; + GLuint i; + (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0 + uy * m1 + uz * m2; @@ -223,21 +235,23 @@ TAG(transform_rescale_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_normals_no_rot)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; const GLfloat *m = mat->inv; - GLfloat m0 = m[0]; - GLfloat m5 = m[5]; - GLfloat m10 = m[10]; + const GLfloat m0 = m[0]; + const GLfloat m5 = m[5]; + const GLfloat m10 = m[10]; + GLuint i; + (void) scale; (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0; @@ -251,21 +265,23 @@ TAG(transform_normals_no_rot)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; const GLfloat *m = mat->inv; - GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; - GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; - GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + const GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; + const GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; + const GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + GLuint i; + (void) scale; (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0 + uy * m1 + uz * m2; @@ -279,17 +295,19 @@ TAG(transform_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(normalize_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + GLuint i; + (void) mat; (void) scale; + if (lengths) { STRIDE_LOOP { const GLfloat x = from[0], y = from[1], z = from[2]; @@ -323,17 +341,19 @@ TAG(normalize_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(rescale_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + GLuint i; + (void) mat; (void) lengths; + STRIDE_LOOP { SCALE_SCALAR_3V( out[i], scale, from ); } diff --git a/xc/extras/Mesa/src/math/m_translate.c b/xc/extras/Mesa/src/math/m_translate.c index 6e4dcee06..9cf0c39a3 100644 --- a/xc/extras/Mesa/src/math/m_translate.c +++ b/xc/extras/Mesa/src/math/m_translate.c @@ -1,10 +1,9 @@ -/* $Id: m_translate.c,v 1.1.1.1 2002/10/22 13:06:28 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -32,7 +31,6 @@ #include "glheader.h" #include "mtypes.h" /* GLchan hack */ #include "colormac.h" -#include "mem.h" #include "mmath.h" #include "m_translate.h" diff --git a/xc/extras/Mesa/src/math/m_vector.c b/xc/extras/Mesa/src/math/m_vector.c index c04143be2..e01c87d67 100644 --- a/xc/extras/Mesa/src/math/m_vector.c +++ b/xc/extras/Mesa/src/math/m_vector.c @@ -1,4 +1,3 @@ -/* $Id: m_vector.c,v 1.1.1.1 2002/10/22 13:06:29 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -30,8 +29,9 @@ #include "glheader.h" +#include "imports.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "m_vector.h" @@ -367,36 +367,36 @@ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) GLfloat *d = (GLfloat *)v->data; GLuint j, i = 0, count; - printf("data-start\n"); + _mesa_printf("data-start\n"); for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(t, i, d[0], d[1], d[2], d[3]); - printf("start-count(%u)\n", v->count); + _mesa_printf("start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d, v->stride), i++) if (cullmask[i]) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(t, i, d[0], d[1], d[2], d[3]); } else { for ( ; i < count ; STRIDE_F(d, v->stride), i++) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(t, i, d[0], d[1], d[2], d[3]); } for (j = v->size ; j < 4; j++) { if ((v->flags & (1<<j)) == 0) { - printf("checking col %u is clean as advertised ", j); + _mesa_printf("checking col %u is clean as advertised ", j); for (i = 0, d = (GLfloat *) v->data ; i < count && d[j] == c[j] ; i++, STRIDE_F(d, v->stride)) {}; if (i == count) - printf(" --> ok\n"); + _mesa_printf(" --> ok\n"); else - printf(" --> Failed at %u ******\n", i); + _mesa_printf(" --> Failed at %u ******\n", i); } } } @@ -410,20 +410,20 @@ void _mesa_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling ) GLfloat *d = (GLfloat *)v->data; GLuint i = 0, count; - printf("data-start\n"); + _mesa_printf("data-start\n"); for ( ; d != v->start ; STRIDE_F(d,v->stride), i++) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); - printf("start-count(%u)\n", v->count); + _mesa_printf("start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d,v->stride), i++) if (cullmask[i]) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf("%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); } else { for ( ; i < count ; STRIDE_F(d,v->stride), i++) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf("%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); } } diff --git a/xc/extras/Mesa/src/math/m_xform.c b/xc/extras/Mesa/src/math/m_xform.c index 183d58fa6..be8a74a78 100644 --- a/xc/extras/Mesa/src/math/m_xform.c +++ b/xc/extras/Mesa/src/math/m_xform.c @@ -1,4 +1,3 @@ -/* $Id: m_xform.c,v 1.1.1.1 2002/10/22 13:06:31 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -35,8 +34,6 @@ * 3. Transformation of a point p by a matrix M is: p' = M * p */ -#include <math.h> - #include "glheader.h" #include "macros.h" #include "mmath.h" @@ -220,6 +217,5 @@ _math_init( void ) { _math_init_transformation(); _math_init_translate(); - _math_init_vertices(); _math_init_eval(); } diff --git a/xc/extras/Mesa/src/math/m_xform.h b/xc/extras/Mesa/src/math/m_xform.h index e4e31327a..badc29eaf 100644 --- a/xc/extras/Mesa/src/math/m_xform.h +++ b/xc/extras/Mesa/src/math/m_xform.h @@ -1,4 +1,3 @@ -/* $Id: m_xform.h,v 1.1.1.1 2002/10/22 13:06:31 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -155,9 +154,9 @@ typedef void (*vec_copy_func)( GLvector4f *to, */ typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, GLfloat scale, - CONST GLvector3f *in, + CONST GLvector4f *in, CONST GLfloat lengths[], - GLvector3f *dest ); + GLvector4f *dest ); /* Flags for selecting a normal transformation function. diff --git a/xc/extras/Mesa/src/matrix.c b/xc/extras/Mesa/src/matrix.c index c97b28951..b9c069cc2 100644 --- a/xc/extras/Mesa/src/matrix.c +++ b/xc/extras/Mesa/src/matrix.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -34,52 +34,17 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "buffers.h" #include "context.h" #include "enums.h" #include "macros.h" #include "matrix.h" -#include "mem.h" #include "mmath.h" #include "mtypes.h" - #include "math/m_matrix.h" -#endif - - -/**********************************************************************/ -/* API functions */ -/**********************************************************************/ - - -#define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \ -do { \ - if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \ - switch (ctx->Transform.MatrixMode) { \ - case GL_MODELVIEW: \ - mat = &ctx->ModelView; \ - flags |= _NEW_MODELVIEW; \ - break; \ - case GL_PROJECTION: \ - mat = &ctx->ProjectionMatrix; \ - flags |= _NEW_PROJECTION; \ - break; \ - case GL_TEXTURE: \ - mat = &ctx->TextureMatrix[ctx->Texture.CurrentUnit]; \ - flags |= _NEW_TEXTURE_MATRIX; \ - break; \ - case GL_COLOR: \ - mat = &ctx->ColorMatrix; \ - flags |= _NEW_COLOR_MATRIX; \ - break; \ - default: \ - _mesa_problem(ctx, where); \ - } \ -} while (0) + void @@ -88,11 +53,8 @@ _mesa_Frustum( GLdouble left, GLdouble right, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glFrustrum" ); - if (nearval <= 0.0 || farval <= 0.0 || nearval == farval || @@ -103,9 +65,11 @@ _mesa_Frustum( GLdouble left, GLdouble right, return; } - _math_matrix_frustum( mat, (GLfloat) left, (GLfloat) right, + _math_matrix_frustum( ctx->CurrentStack->Top, + (GLfloat) left, (GLfloat) right, (GLfloat) bottom, (GLfloat) top, (GLfloat) nearval, (GLfloat) farval ); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -115,10 +79,11 @@ _mesa_Ortho( GLdouble left, GLdouble right, GLdouble nearval, GLdouble farval ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glOrtho" ); + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glFrustum(%f, %f, %f, %f, %f, %f)\n", + left, right, bottom, top, nearval, farval); if (left == right || bottom == top || @@ -128,9 +93,11 @@ _mesa_Ortho( GLdouble left, GLdouble right, return; } - _math_matrix_ortho( mat, (GLfloat) left, (GLfloat) right, + _math_matrix_ortho( ctx->CurrentStack->Top, + (GLfloat) left, (GLfloat) right, (GLfloat) bottom, (GLfloat) top, (GLfloat) nearval, (GLfloat) farval ); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -140,19 +107,43 @@ _mesa_MatrixMode( GLenum mode ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); + if (ctx->Transform.MatrixMode == mode && mode != GL_TEXTURE) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + switch (mode) { - case GL_MODELVIEW: - case GL_PROJECTION: - case GL_TEXTURE: - case GL_COLOR: - if (ctx->Transform.MatrixMode == mode) - return; - ctx->Transform.MatrixMode = mode; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - break; - default: + case GL_MODELVIEW: + ctx->CurrentStack = &ctx->ModelviewMatrixStack; + break; + case GL_PROJECTION: + ctx->CurrentStack = &ctx->ProjectionMatrixStack; + break; + case GL_TEXTURE: + ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit]; + break; + case GL_COLOR: + ctx->CurrentStack = &ctx->ColorMatrixStack; + break; + case GL_MATRIX0_NV: + case GL_MATRIX1_NV: + case GL_MATRIX2_NV: + case GL_MATRIX3_NV: + case GL_MATRIX4_NV: + case GL_MATRIX5_NV: + case GL_MATRIX6_NV: + case GL_MATRIX7_NV: + if (!ctx->Extensions.NV_vertex_program) { _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" ); + return; + } + ctx->CurrentStack = &ctx->ProgramMatrixStack[mode - GL_MATRIX0_NV]; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glMatrixMode" ); + return; } + + ctx->Transform.MatrixMode = mode; } @@ -161,51 +152,22 @@ void _mesa_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); + struct matrix_stack *stack = ctx->CurrentStack; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPushMatrix %s\n", - _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); - - switch (ctx->Transform.MatrixMode) { - case GL_MODELVIEW: - if (ctx->ModelViewStackDepth >= MAX_MODELVIEW_STACK_DEPTH - 1) { - _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix"); - return; - } - _math_matrix_copy( &ctx->ModelViewStack[ctx->ModelViewStackDepth++], - &ctx->ModelView ); - break; - case GL_PROJECTION: - if (ctx->ProjectionStackDepth >= MAX_PROJECTION_STACK_DEPTH - 1) { - _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix"); - return; - } - _math_matrix_copy( &ctx->ProjectionStack[ctx->ProjectionStackDepth++], - &ctx->ProjectionMatrix ); - break; - case GL_TEXTURE: - { - GLuint t = ctx->Texture.CurrentUnit; - if (ctx->TextureStackDepth[t] >= MAX_TEXTURE_STACK_DEPTH - 1) { - _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix"); - return; - } - _math_matrix_copy( &ctx->TextureStack[t][ctx->TextureStackDepth[t]++], - &ctx->TextureMatrix[t] ); - } - break; - case GL_COLOR: - if (ctx->ColorStackDepth >= MAX_COLOR_STACK_DEPTH - 1) { - _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix"); - return; - } - _math_matrix_copy( &ctx->ColorStack[ctx->ColorStackDepth++], - &ctx->ColorMatrix ); - break; - default: - _mesa_problem(ctx, "Bad matrix mode in _mesa_PushMatrix"); + _mesa_debug(ctx, "glPushMatrix %s\n", + _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); + + if (stack->Depth + 1 >= stack->MaxDepth) { + _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushMatrix" ); + return; } + _math_matrix_copy( &stack->Stack[stack->Depth + 1], + &stack->Stack[stack->Depth] ); + stack->Depth++; + stack->Top = &(stack->Stack[stack->Depth]); + ctx->NewState |= stack->DirtyFlag; } @@ -214,56 +176,20 @@ void _mesa_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); + struct matrix_stack *stack = ctx->CurrentStack; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPopMatrix %s\n", - _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); - - switch (ctx->Transform.MatrixMode) { - case GL_MODELVIEW: - if (ctx->ModelViewStackDepth==0) { - _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix"); - return; - } - _math_matrix_copy( &ctx->ModelView, - &ctx->ModelViewStack[--ctx->ModelViewStackDepth] ); - ctx->NewState |= _NEW_MODELVIEW; - break; - case GL_PROJECTION: - if (ctx->ProjectionStackDepth==0) { - _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix"); - return; - } - - _math_matrix_copy( &ctx->ProjectionMatrix, - &ctx->ProjectionStack[--ctx->ProjectionStackDepth] ); - ctx->NewState |= _NEW_PROJECTION; - break; - case GL_TEXTURE: - { - GLuint t = ctx->Texture.CurrentUnit; - if (ctx->TextureStackDepth[t]==0) { - _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix"); - return; - } - _math_matrix_copy(&ctx->TextureMatrix[t], - &ctx->TextureStack[t][--ctx->TextureStackDepth[t]]); - ctx->NewState |= _NEW_TEXTURE_MATRIX; - } - break; - case GL_COLOR: - if (ctx->ColorStackDepth==0) { - _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix"); - return; - } - _math_matrix_copy(&ctx->ColorMatrix, - &ctx->ColorStack[--ctx->ColorStackDepth]); - ctx->NewState |= _NEW_COLOR_MATRIX; - break; - default: - _mesa_problem(ctx, "Bad matrix mode in _mesa_PopMatrix"); + _mesa_debug(ctx, "glPopMatrix %s\n", + _mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode)); + + if (stack->Depth == 0) { + _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopMatrix" ); + return; } + stack->Depth--; + stack->Top = &(stack->Stack[stack->Depth]); + ctx->NewState |= stack->DirtyFlag; } @@ -272,10 +198,13 @@ void _mesa_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity"); - _math_matrix_set_identity( mat ); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glLoadIdentity()"); + + _math_matrix_set_identity( ctx->CurrentStack->Top ); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -283,11 +212,18 @@ void _mesa_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; if (!m) return; + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, + "glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", + m[0], m[4], m[8], m[12], + m[1], m[5], m[9], m[13], + m[2], m[6], m[10], m[14], + m[3], m[7], m[11], m[15]); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix"); - _math_matrix_loadf( mat, m ); + _math_matrix_loadf( ctx->CurrentStack->Top, m ); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -311,11 +247,17 @@ void _mesa_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; if (!m) return; + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, + "glMultMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n", + m[0], m[4], m[8], m[12], + m[1], m[5], m[9], m[13], + m[2], m[6], m[10], m[14], + m[3], m[7], m[11], m[15]); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" ); - _math_matrix_mul_floats( mat, m ); + _math_matrix_mul_floats( ctx->CurrentStack->Top, m ); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -345,9 +287,8 @@ _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (angle != 0.0F) { - GLmatrix *mat = 0; - GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glRotate" ); - _math_matrix_rotate( mat, angle, x, y, z ); + _math_matrix_rotate( ctx->CurrentStack->Top, angle, x, y, z); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } } @@ -365,10 +306,9 @@ void _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale"); - _math_matrix_scale( mat, x, y, z ); + _math_matrix_scale( ctx->CurrentStack->Top, x, y, z); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -386,10 +326,9 @@ void _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - GLmatrix *mat = 0; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate"); - _math_matrix_translate( mat, x, y, z ); + _math_matrix_translate( ctx->CurrentStack->Top, x, y, z); + ctx->NewState |= ctx->CurrentStack->DirtyFlag; } @@ -463,14 +402,15 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y, const GLfloat n = ctx->Viewport.Near; const GLfloat f = ctx->Viewport.Far; + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glViewport %d %d %d %d\n", x, y, width, height); + if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glViewport" ); + _mesa_error( ctx, GL_INVALID_VALUE, + "glViewport(%d, %d, %d, %d)", x, y, width, height ); return; } - if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glViewport %d %d %d %d\n", x, y, width, height); - /* clamp width, and height to implementation dependent range */ width = CLAMP( width, 1, MAX_WIDTH ); height = CLAMP( height, 1, MAX_HEIGHT ); @@ -525,7 +465,7 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glDepthRange %f %f\n", nearval, farval); + _mesa_debug(ctx, "glDepthRange %f %f\n", nearval, farval); n = (GLfloat) CLAMP( nearval, 0.0, 1.0 ); f = (GLfloat) CLAMP( farval, 0.0, 1.0 ); diff --git a/xc/extras/Mesa/src/mem.c b/xc/extras/Mesa/src/mem.c deleted file mode 100644 index 511b5b05a..000000000 --- a/xc/extras/Mesa/src/mem.c +++ /dev/null @@ -1,251 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - - -/* - * Memory allocation functions. Called via the MALLOC, CALLOC and - * FREE macros when DEBUG symbol is defined. - * You might want to set breakpoints on these functions or plug in - * other memory allocation functions. The Mesa sources should only - * use the MALLOC and FREE macros (which could also be overriden). - */ - -#ifdef PC_HEADER -#include "all.h" -#else -#include "glheader.h" -#include "config.h" -#include "macros.h" -#include "mem.h" -#endif - - -#if defined(WIN32) && defined(_DEBUG) - -/* - * N-byte aligned memory allocation functions. Called via the ALIGN_MALLOC, - * ALIGN_CALLOC and ALIGN_FREE macros. Debug versions? - * These functions allow dynamically allocated memory to be correctly - * aligned for improved cache utilization and specialized assembly - * support. - */ - -/* - * Allocate N-byte aligned memory (uninitialized) - */ -void * -_mesa_align_malloc_dbg(size_t bytes, unsigned long alignment, const char *_file, int _line ) -{ - unsigned long ptr, buf; - - ASSERT( alignment > 0 ); - - ptr = (unsigned long) _malloc_dbg( bytes + alignment, _NORMAL_BLOCK, _file, _line ); - - buf = (ptr + alignment) & ~(unsigned long)(alignment - 1); - *(unsigned long *)(buf - sizeof(void *)) = ptr; - -#ifdef DEBUG - /* mark the non-aligned area */ - while ( ptr < buf - sizeof(void *) ) { - *(unsigned long *)ptr = 0xcdcdcdcd; - ptr += sizeof(unsigned long); - } -#endif - - return (void *)buf; -} - - -/* - * Allocate N-byte aligned memory and initialize to zero - */ -void * -_mesa_align_calloc_dbg(size_t bytes, unsigned long alignment, const char *_file, int _line) -{ - unsigned long ptr, buf; - - ASSERT( alignment > 0 ); - - ptr = (unsigned long) _calloc_dbg( 1, bytes + alignment, _NORMAL_BLOCK, _file, _line ); - - buf = (ptr + alignment) & ~(unsigned long)(alignment - 1); - *(unsigned long *)(buf - sizeof(void *)) = ptr; - -#ifdef DEBUG - /* mark the non-aligned area */ - while ( ptr < buf - sizeof(void *) ) { - *(unsigned long *)ptr = 0xcdcdcdcd; - ptr += sizeof(unsigned long); - } -#endif - - return (void *)buf; -} - - -/* - * Free N-byte aligned memory - */ -void -_mesa_align_free_dbg(void *ptr, const char *_file, int _line) -{ - /* The actuall address to free is stuffed in the word immediately - * before the address the client sees. - */ - void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); - void *realAddr = *cubbyHole; - _free_dbg(realAddr, _NORMAL_BLOCK ); -} - - -#else /* WIN32 && _DEBUG */ - - -/* - * Allocate memory (uninitialized) - */ -void * -_mesa_malloc(size_t bytes) -{ - return malloc(bytes); -} - - -/* - * Allocate memory and initialize to zero. - */ -void * -_mesa_calloc(size_t bytes) -{ - return calloc(1, bytes); -} - - -/* - * Free memory - */ -void -_mesa_free(void *ptr) -{ - free(ptr); -} - - - -/* - * N-byte aligned memory allocation functions. Called via the ALIGN_MALLOC, - * ALIGN_CALLOC and ALIGN_FREE macros. Debug versions? - * These functions allow dynamically allocated memory to be correctly - * aligned for improved cache utilization and specialized assembly - * support. - */ - - -/* - * Allocate N-byte aligned memory (uninitialized) - */ -void * -_mesa_align_malloc(size_t bytes, unsigned long alignment) -{ - unsigned long ptr, buf; - - ASSERT( alignment > 0 ); - - ptr = (unsigned long) MALLOC( bytes + alignment ); - - buf = (ptr + alignment) & ~(unsigned long)(alignment - 1); - *(unsigned long *)(buf - sizeof(void *)) = ptr; - -#ifdef DEBUG - /* mark the non-aligned area */ - while ( ptr < buf - sizeof(void *) ) { - *(unsigned long *)ptr = 0xcdcdcdcd; - ptr += sizeof(unsigned long); - } -#endif - - return (void *)buf; -} - - -/* - * Allocate N-byte aligned memory and initialize to zero - */ -void * -_mesa_align_calloc(size_t bytes, unsigned long alignment) -{ - unsigned long ptr, buf; - - ASSERT( alignment > 0 ); - - ptr = (unsigned long) CALLOC( bytes + alignment ); - - buf = (ptr + alignment) & ~(unsigned long)(alignment - 1); - *(unsigned long *)(buf - sizeof(void *)) = ptr; - -#ifdef DEBUG - /* mark the non-aligned area */ - while ( ptr < buf - sizeof(void *) ) { - *(unsigned long *)ptr = 0xcdcdcdcd; - ptr += sizeof(unsigned long); - } -#endif - - return (void *)buf; -} - - -/* - * Free N-byte aligned memory - */ -void -_mesa_align_free(void *ptr) -{ -#if 0 - FREE( (void *)(*(unsigned long *)((unsigned long)ptr - sizeof(void *))) ); -#else - /* The actuall address to free is stuffed in the word immediately - * before the address the client sees. - */ - void **cubbyHole = (void **) ((char *) ptr - sizeof(void *)); - void *realAddr = *cubbyHole; - FREE(realAddr); -#endif -} - - -#endif /* WIN32 && _DEBUG */ - - -/* - * Set a block of GLushorts to a particular value. - */ -void -_mesa_memset16( GLushort *dst, GLushort val, size_t n ) -{ - while (n-- > 0) - *dst++ = val; -} diff --git a/xc/extras/Mesa/src/mem.h b/xc/extras/Mesa/src/mem.h deleted file mode 100644 index d27361e76..000000000 --- a/xc/extras/Mesa/src/mem.h +++ /dev/null @@ -1,179 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 4.0.2 - * - * Copyright (C) 1999-2002 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 MEM_H -#define MEM_H - - -#include "glheader.h" -/* Do not reference mtypes.h from this file. - */ - -/* - * Memory allocation - */ -#if defined(WIN32) && defined(_DEBUG) -#include <malloc.h> -#ifndef _CRTDBG_MAP_ALLOC - #define _CRTDBG_MAP_ALLOC 1 -#endif -#include <crtdbg.h> - -#define _mesa_malloc(n) _malloc_dbg( n, _NORMAL_BLOCK, __FILE__ , __LINE__ ) -#define _mesa_calloc(n) _calloc_dbg( 1, n, _NORMAL_BLOCK, __FILE__ , __LINE__ ) -#define _mesa_free(p) _free_dbg(p, _NORMAL_BLOCK ) - -extern void *_mesa_align_malloc_dbg(size_t bytes, unsigned long alignment, const char *_file, int _line ); -extern void *_mesa_align_calloc_dbg(size_t bytes, unsigned long alignment, const char *_file, int _line ); -extern void _mesa_align_free_dbg(void *ptr, const char *_file, int _line); - -#define _mesa_align_malloc( s, a ) _mesa_align_malloc_dbg( s, a, __FILE__ , __LINE__ ) -#define _mesa_align_calloc( s, a ) _mesa_align_calloc_dbg( s, a, __FILE__ , __LINE__ ) -#define _mesa_align_free(p) _mesa_align_free_dbg(p, __FILE__ , __LINE__) - -#else /* WIN32 && _DEBUG */ - -extern void *_mesa_malloc(size_t bytes); -extern void *_mesa_calloc(size_t bytes); -extern void _mesa_free(void *ptr); - -extern void *_mesa_align_malloc(size_t bytes, unsigned long alignment); -extern void *_mesa_align_calloc(size_t bytes, unsigned long alignment); -extern void _mesa_align_free(void *ptr); - -#endif /* WIN32 && _DEBUG */ - - -#ifdef DEBUG - -/* call Mesa memory functions */ -#define MALLOC(BYTES) _mesa_malloc(BYTES) -#define CALLOC(BYTES) _mesa_calloc(BYTES) -#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) -#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T)) -#define FREE(PTR) _mesa_free(PTR) - -#else - -/* directly call C lib memory functions */ -#define MALLOC(BYTES) (void *) malloc(BYTES) -#define CALLOC(BYTES) (void *) calloc(1, BYTES) -#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T)) -#define CALLOC_STRUCT(T) (struct T *) calloc(1,sizeof(struct T)) -#define FREE(PTR) free(PTR) - -#endif - -/* call Mesa N-byte aligned memory functions */ -#define ALIGN_MALLOC(BYTES, N) (void *) _mesa_align_malloc(BYTES, N) -#define ALIGN_CALLOC(BYTES, N) (void *) _mesa_align_calloc(BYTES, N) -#define ALIGN_MALLOC_STRUCT(T, N) (struct T *) _mesa_align_malloc(sizeof(struct T), N) -#define ALIGN_CALLOC_STRUCT(T, N) (struct T *) _mesa_align_calloc(sizeof(struct T), N) -#define ALIGN_FREE(PTR) _mesa_align_free(PTR) - - -#ifdef MESA_EXTERNAL_BUFFERALLOC -/* - * If you want Mesa's depth/stencil/accum/etc buffers to be allocated - * with a specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC - * and implement _ext_mesa_alloc/free_pixelbuffer() in your app. - * Contributed by Gerk Huisma (gerk@five-d.demon.nl). - */ -extern void *_ext_mesa_alloc_pixelbuffer( unsigned int size ); -extern void _ext_mesa_free_pixelbuffer( void *pb ); - -#define MESA_PBUFFER_ALLOC(BYTES) (void *) _ext_mesa_alloc_pixelbuffer(BYTES) -#define MESA_PBUFFER_FREE(PTR) _ext_mesa_free_pixelbuffer(PTR) -#else -/* Default buffer allocation uses the aligned allocation routines: */ -#define MESA_PBUFFER_ALLOC(BYTES) (void *) _mesa_align_malloc(BYTES, 512) -#define MESA_PBUFFER_FREE(PTR) _mesa_align_free(PTR) -#endif - - -/* Memory copy: */ -#ifdef SUNOS4 -#define MEMCPY( DST, SRC, BYTES) \ - memcpy( (char *) (DST), (char *) (SRC), (int) (BYTES) ) -#else -#define MEMCPY( DST, SRC, BYTES) \ - memcpy( (void *) (DST), (void *) (SRC), (size_t) (BYTES) ) -#endif - - -/* Memory set: */ -#ifdef SUNOS4 -#define MEMSET( DST, VAL, N ) \ - memset( (char *) (DST), (int) (VAL), (int) (N) ) -#else -#define MEMSET( DST, VAL, N ) \ - memset( (void *) (DST), (int) (VAL), (size_t) (N) ) -#endif - -extern void _mesa_memset16( GLushort *dst, GLushort val, size_t n ); - -#define MEMSET16( DST, VAL, N ) \ - _mesa_memset16( (GLushort *) (DST), (GLushort) (VAL), (size_t) (N) ) - - -/* On some systems we might want to use bzero() (but is bzero portable?) */ -#if defined(__FreeBSD__) -#define BZERO( ADDR, N ) \ - bzero( (void *) (ADDR), (size_t) (N) ) -#else -#define BZERO( ADDR, N ) \ - memset( (void *) (ADDR), 0, (size_t) (N) ) -#endif - - -/* MACs and BeOS don't support static larger than 32kb, so... */ -#if defined(macintosh) && !defined(__MRC__) -/*extern char *AGLAlloc(int size);*/ -/*extern void AGLFree(char* ptr);*/ -# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)MALLOC(sizeof(TYPE)*(SIZE)) -# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])MALLOC(sizeof(TYPE)*(SIZE1)*(SIZE2)) -# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])MALLOC(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) - -# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) -# define UNDEFARRAY(NAME) do {if ((NAME)) {FREE((char*)NAME);} }while (0) -#elif defined(__BEOS__) -# define DEFARRAY(TYPE,NAME,SIZE) TYPE *NAME = (TYPE*)malloc(sizeof(TYPE)*(SIZE)) -# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE (*NAME)[SIZE2] = (TYPE(*)[SIZE2])malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)) -# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE (*NAME)[SIZE2][SIZE3] = (TYPE(*)[SIZE2][SIZE3])malloc(sizeof(TYPE)*(SIZE1)*(SIZE2)*(SIZE3)) -# define CHECKARRAY(NAME,CMD) do {if (!(NAME)) {CMD;}} while (0) -# define UNDEFARRAY(NAME) do {if ((NAME)) {free((char*)NAME);} }while (0) -#else -# define DEFARRAY(TYPE,NAME,SIZE) TYPE NAME[SIZE] -# define DEFMARRAY(TYPE,NAME,SIZE1,SIZE2) TYPE NAME[SIZE1][SIZE2] -# define DEFMNARRAY(TYPE,NAME,SIZE1,SIZE2,SIZE3) TYPE NAME[SIZE1][SIZE2][SIZE3] -# define CHECKARRAY(NAME,CMD) do {} while(0) -# define UNDEFARRAY(NAME) -#endif - - - - -#endif diff --git a/xc/extras/Mesa/src/mmath.c b/xc/extras/Mesa/src/mmath.c index 78afabdfa..6abeb74cf 100644 --- a/xc/extras/Mesa/src/mmath.c +++ b/xc/extras/Mesa/src/mmath.c @@ -24,12 +24,8 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "mmath.h" -#endif static int in_fast_math; @@ -66,7 +62,7 @@ static void init_sqrt(void) */ fi.i = (i << 16) | (127 << 23); - fi.f = sqrt(fi.f); + fi.f = _mesa_sqrt(fi.f); /* * Take the square root then strip the first 7 bits of @@ -119,7 +115,7 @@ float gl_sqrt( float x ) num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23); return num.f; #else - return (GLfloat) sqrt(x); + return (GLfloat) _mesa_sqrt(x); #endif } @@ -149,8 +145,8 @@ _mesa_init_math(void) #if defined(_FPU_GETCW) && defined(_FPU_SETCW) { - const char *debug = getenv("MESA_DEBUG"); - if (debug && strcmp(debug, "FP")==0) { + const char *debug = _mesa_getenv("MESA_DEBUG"); + if (debug && _mesa_strcmp(debug, "FP")==0) { /* die on FP exceptions */ fpu_control_t mask; _FPU_GETCW(mask); diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index c39c93004..e5a662cbc 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -36,6 +36,7 @@ #include "glheader.h" +#include "imports.h" /* Do not reference mtypes.h from this file. */ @@ -132,7 +133,7 @@ __inline END_FAST_MATH(unsigned short x) #define HAVE_FAST_MATH #else -#define START_FAST_MATH(x) (void)(x) +#define START_FAST_MATH(x) x = 0 #define END_FAST_MATH(x) (void)(x) /* The mac float really is a float, with the same precision as a @@ -168,12 +169,12 @@ extern float gl_sqrt(float x); */ #define NORMALIZE_3FV( V ) \ do { \ - GLfloat len = LEN_SQUARED_3FV(V); \ + GLfloat len = (GLfloat) LEN_SQUARED_3FV(V); \ if (len) { \ len = (GLfloat) (1.0 / GL_SQRT(len)); \ - (V)[0] = (GLfloat) ((V)[0] * len); \ - (V)[1] = (GLfloat) ((V)[1] * len); \ - (V)[2] = (GLfloat) ((V)[2] * len); \ + (V)[0] = (GLfloat) ((V)[0] * len); \ + (V)[1] = (GLfloat) ((V)[1] * len); \ + (V)[2] = (GLfloat) ((V)[2] * len); \ } \ } while(0) @@ -191,6 +192,14 @@ do { \ #define CEILF(x) ceil(x) #define FLOORF(x) floor(x) #define FABSF(x) fabs(x) +#elif defined(__WIN32__) +#define CEILF(x) ((GLfloat)ceil(x)) +#define FLOORF(x) ((GLfloat)floor(x)) +#define FABSF(x) ((GLfloat)fabs(x)) +#elif defined(XFree86LOADER) && defined(IN_MODULE) +#define CEILF(x) ((GLfloat) xf86ceil(x)) +#define FLOORF(x) ((GLfloat) xf86floor(x)) +#define FABSF(x) ((GLfloat) xf86fabs(x)) #else #define CEILF(x) ceilf(x) #define FLOORF(x) floorf(x) @@ -395,29 +404,29 @@ static INLINE int iceil(float f) * This function/macro is sensitive to precision. Test carefully * if you change it. */ -#define UNCLAMPED_FLOAT_TO_UBYTE(b, f) \ +#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ do { \ union { GLfloat r; GLuint i; } __tmp; \ __tmp.r = (f); \ - b = ((__tmp.i >= IEEE_0996) \ + ub = ((__tmp.i >= IEEE_0996) \ ? ((GLint)__tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \ : (__tmp.r = __tmp.r*(255.0F/256.0F) + 32768.0F, \ (GLubyte)__tmp.i)); \ } while (0) -#define CLAMPED_FLOAT_TO_UBYTE(b, f) \ - UNCLAMPED_FLOAT_TO_UBYTE(b, f) +#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ + UNCLAMPED_FLOAT_TO_UBYTE(ub, f) #define COPY_FLOAT( dst, src ) \ ((fi_type *) &(dst))->i = ((fi_type *) &(src))->i #else /* USE_IEEE */ -#define UNCLAMPED_FLOAT_TO_UBYTE(b, f) \ - b = ((GLubyte) IROUND(CLAMP(f, 0.0F, 1.0F) * 255.0F)) +#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ + ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F)) -#define CLAMPED_FLOAT_TO_UBYTE(b, f) \ - b = ((GLubyte) IROUND((f) * 255.0F)) +#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ + ub = ((GLubyte) IROUND((f) * 255.0F)) #define COPY_FLOAT( dst, src ) (dst) = (src) @@ -488,7 +497,10 @@ extern float _mesa_ubyte_to_float_color_tab[256]; #define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767)))) #define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15))) #define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16))) -#define UNCLAMPED_FLOAT_TO_USHORT(us, f) us = (GLushort) ((f) * 65535.0F) +#define UNCLAMPED_FLOAT_TO_USHORT(us, f) \ + us = ( (GLushort) IROUND( CLAMP((f), 0.0, 1.0) * 65535.0F) ) +#define CLAMPED_FLOAT_TO_USHORT(us, f) \ + us = ( (GLushort) IROUND( (f) * 65535.0F) ) @@ -518,24 +530,24 @@ do { \ } while (0) #define INTERP_UI( t, dstui, outui, inui ) \ - dstui = (GLuint) (GLint) LINTERP( t, (GLfloat) (outui), (GLfloat) (inui) ) + dstui = (GLuint) (GLint) LINTERP( (t), (GLfloat) (outui), (GLfloat) (inui) ) #define INTERP_F( t, dstf, outf, inf ) \ dstf = LINTERP( t, outf, inf ) -#define INTERP_4F( t, dst, out, in ) \ -do { \ - (dst)[0] = LINTERP( (t), (out)[0], (in)[0] ); \ - (dst)[1] = LINTERP( (t), (out)[1], (in)[1] ); \ - (dst)[2] = LINTERP( (t), (out)[2], (in)[2] ); \ - (dst)[3] = LINTERP( (t), (out)[3], (in)[3] ); \ +#define INTERP_4F( t, dst, out, in ) \ +do { \ + dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ + dst[3] = LINTERP( (t), (out)[3], (in)[3] ); \ } while (0) -#define INTERP_3F( t, dst, out, in ) \ -do { \ - (dst)[0] = LINTERP( (t), (out)[0], (in)[0] ); \ - (dst)[1] = LINTERP( (t), (out)[1], (in)[1] ); \ - (dst)[2] = LINTERP( (t), (out)[2], (in)[2] ); \ +#define INTERP_3F( t, dst, out, in ) \ +do { \ + dst[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + dst[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + dst[2] = LINTERP( (t), (out)[2], (in)[2] ); \ } while (0) #define INTERP_4CHAN( t, dst, out, in ) \ @@ -554,12 +566,12 @@ do { \ } while (0) #define INTERP_SZ( t, vec, to, out, in, sz ) \ -do { \ +do { \ switch (sz) { \ - case 4: (vec)[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ - case 3: (vec)[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ - case 2: (vec)[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ - case 1: (vec)[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ + case 4: vec[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ + case 3: vec[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ + case 2: vec[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ + case 1: vec[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ } \ } while(0) @@ -567,13 +579,21 @@ do { \ /* * Fixed point arithmetic macros */ +#ifdef FIXED_14 +#define FIXED_ONE 0x00004000 +#define FIXED_HALF 0x00002000 +#define FIXED_FRAC_MASK 0x00003FFF +#define FIXED_SCALE 16384.0f +#define FIXED_SHIFT 14 +#else #define FIXED_ONE 0x00000800 #define FIXED_HALF 0x00000400 #define FIXED_FRAC_MASK 0x000007FF -#define FIXED_INT_MASK (~FIXED_FRAC_MASK) -#define FIXED_EPSILON 1 #define FIXED_SCALE 2048.0f #define FIXED_SHIFT 11 +#endif +#define FIXED_INT_MASK (~FIXED_FRAC_MASK) +#define FIXED_EPSILON 1 #define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) #define IntToFixed(I) ((I) << FIXED_SHIFT) #define FixedToInt(X) ((X) >> FIXED_SHIFT) @@ -584,18 +604,72 @@ do { \ #define PosFloatToFixed(X) FloatToFixed(X) #define SignedFloatToFixed(X) FloatToFixed(X) -#ifdef USE_IEEE /* Returns TRUE for x == Inf or x == NaN. */ +#ifdef USE_IEEE static INLINE int IS_INF_OR_NAN( float x ) { union {float f; int i;} tmp; tmp.f = x; return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); } +#elif defined(isfinite) +#define IS_INF_OR_NAN(x) (!isfinite(x)) +#elif defined(finite) +#define IS_INF_OR_NAN(x) (!finite(x)) +#elif __VMS +#define IS_INF_OR_NAN(x) (!finite(x)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define IS_INF_OR_NAN(x) (!isfinite(x)) #else -#define IS_INF_OR_NAN(x) (!finite(x)) +#define IS_INF_OR_NAN(x) (!finite(x)) +#endif + + +/* + * Return log_base_2(x). + */ +#ifdef USE_IEEE + +#if 0 +/* This is pretty fast, but not accurate enough (only 2 fractional bits). + * Based on code from http://www.stereopsis.com/log2.html + */ +static INLINE GLfloat LOG2(GLfloat x) +{ + const GLfloat y = x * x * x * x; + const GLuint ix = *((GLuint *) &y); + const GLuint exp = (ix >> 23) & 0xFF; + const GLint log2 = ((GLint) exp) - 127; + return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */ +} #endif +/* Pretty fast, and accurate. + * Based on code from http://www.flipcode.com/totd/ + */ +static INLINE GLfloat LOG2(GLfloat val) +{ + GLint *exp_ptr = (GLint *) &val; + GLint x = *exp_ptr; + const GLint log_2 = ((x >> 23) & 255) - 128; + x &= ~(255 << 23); + x += 127 << 23; + *exp_ptr = x; + val = ((-1.0f/3) * val + 2) * val - 2.0f/3; + return val + log_2; +} + +#else /* USE_IEEE */ + +/* Slow, portable solution. + * NOTE: log_base_2(x) = log(x) / log(2) + * NOTE: 1.442695 = 1/log(2). + */ +#define LOG2(x) ((GLfloat) (log(x) * 1.442695F)) + +#endif /* USE_IEEE */ + + extern void _mesa_init_math(void); diff --git a/xc/extras/Mesa/src/mtypes.h b/xc/extras/Mesa/src/mtypes.h index 82a8c2ab7..7ace44d43 100644 --- a/xc/extras/Mesa/src/mtypes.h +++ b/xc/extras/Mesa/src/mtypes.h @@ -1,8 +1,7 @@ -/* $Id: mtypes.h,v 1.1.1.1 2002/10/22 13:05:27 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,6 +23,10 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * \file mtypes.h + * \brief Main Mesa data structures. + */ #ifndef TYPES_H #define TYPES_H @@ -63,11 +66,11 @@ #define CHAN_MAXF 1.0F #define CHAN_TYPE GL_FLOAT #else -#error illegal number of color channel bits +#error "illegal number of color channel bits" #endif -/* +/** * Accumulation buffer data type: */ #if ACCUM_BITS==8 @@ -81,7 +84,7 @@ #endif -/* +/** * Stencil buffer data type: */ #if STENCIL_BITS==8 @@ -95,20 +98,20 @@ #endif -/* +/** * Depth buffer data type: */ typedef GLuint GLdepth; /* Must be 32-bits! */ -/* +/** * Fixed point data type: */ typedef int GLfixed; -/* +/** * Some forward type declarations */ struct _mesa_HashTable; @@ -120,7 +123,52 @@ typedef struct gl_frame_buffer GLframebuffer; -/* Maximum number of temporary vertices required for clipping. (Used +/* These define the aliases between numbered vertex attributes and + * conventional OpenGL vertex attributes. We use these values in + * quite a few places. New in Mesa 4.1. + */ +#define VERT_ATTRIB_POS 0 +#define VERT_ATTRIB_WEIGHT 1 +#define VERT_ATTRIB_NORMAL 2 +#define VERT_ATTRIB_COLOR0 3 +#define VERT_ATTRIB_COLOR1 4 +#define VERT_ATTRIB_FOG 5 +#define VERT_ATTRIB_SIX 6 +#define VERT_ATTRIB_SEVEN 7 +#define VERT_ATTRIB_TEX0 8 +#define VERT_ATTRIB_TEX1 9 +#define VERT_ATTRIB_TEX2 10 +#define VERT_ATTRIB_TEX3 11 +#define VERT_ATTRIB_TEX4 12 +#define VERT_ATTRIB_TEX5 13 +#define VERT_ATTRIB_TEX6 14 +#define VERT_ATTRIB_TEX7 15 +#define VERT_ATTRIB_MAX 16 + +/* These are used in bitfields in many places */ +#define VERT_BIT_POS (1 << VERT_ATTRIB_POS) +#define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT) +#define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL) +#define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0) +#define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1) +#define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG) +#define VERT_BIT_SIX (1 << VERT_ATTRIB_SIX) +#define VERT_BIT_SEVEN (1 << VERT_ATTRIB_SEVEN) +#define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0) +#define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1) +#define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2) +#define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3) +#define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4) +#define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5) +#define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6) +#define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7) + +#define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u))) + + + +/** + * Maximum number of temporary vertices required for clipping. (Used * in array_cache and tnl modules). */ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) @@ -185,7 +233,7 @@ struct gl_shine_tab { struct gl_light { - struct gl_light *next; /* double linked list with sentinel */ + struct gl_light *next; /* double linked list with sentinel */ struct gl_light *prev; GLfloat Ambient[4]; /* ambient color */ @@ -252,29 +300,31 @@ struct gl_accum_attrib { /* - * Used in DrawDestMask below + * Used in _DrawDestMask and _ReadSrcMask below to identify color buffers. */ -#define FRONT_LEFT_BIT 1 -#define FRONT_RIGHT_BIT 2 -#define BACK_LEFT_BIT 4 -#define BACK_RIGHT_BIT 8 - +#define FRONT_LEFT_BIT 0x1 +#define FRONT_RIGHT_BIT 0x2 +#define BACK_LEFT_BIT 0x4 +#define BACK_RIGHT_BIT 0x8 +#define AUX0_BIT 0x10 +#define AUX1_BIT 0x20 +#define AUX2_BIT 0x40 +#define AUX3_BIT 0x80 struct gl_colorbuffer_attrib { GLuint ClearIndex; /* Index to use for glClear */ - GLchan ClearColor[4]; /* Color to use for glClear */ + GLclampf ClearColor[4]; /* Color to use for glClear */ GLuint IndexMask; /* Color index write mask */ GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ - GLenum DrawBuffer; /* Which buffer to draw into */ - GLenum DriverDrawBuffer; /* Current device driver dest buffer */ - GLubyte DrawDestMask; /* bitwise-OR of bitflags above */ + GLenum DrawBuffer; /* Which buffer to draw into */ + GLubyte _DrawDestMask; /* bitwise-OR of FRONT/BACK_LEFT/RIGHT_BITs */ /* alpha testing */ GLboolean AlphaEnabled; /* Alpha test enabled flag */ GLenum AlphaFunc; /* Alpha test function */ - GLchan AlphaRef; /* Alpha ref value as GLchan */ + GLclampf AlphaRef; /* blending */ GLboolean BlendEnabled; /* Blending enabled flag */ @@ -297,25 +347,21 @@ struct gl_colorbuffer_attrib { struct gl_current_attrib { /* These values valid only when FLUSH_VERTICES has been called. */ - GLfloat Normal[3]; /* Current vertex normal */ - GLfloat Color[4]; /* Current RGBA color */ - GLfloat SecondaryColor[4]; /* Current secondary color */ - GLfloat FogCoord; /* Current Fog coord */ + GLfloat Attrib[VERT_ATTRIB_MAX][4]; /* Current vertex attributes */ + /* indexed by VERT_ATTRIB_* */ GLuint Index; /* Current color index */ GLboolean EdgeFlag; /* Current edge flag */ - GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ - /* These values are always valid. + /* These values are always valid. BTW, note how similar this set of + * attributes is to the SWvertex datatype in the software rasterizer... */ GLfloat RasterPos[4]; /* Current raster position */ GLfloat RasterDistance; /* Current raster distance */ GLfloat RasterColor[4]; /* Current raster color */ GLfloat RasterSecondaryColor[4]; /* Current rast 2ndary color */ - GLuint RasterIndex; /* Current raster index */ - GLfloat *RasterTexCoord; /* Current raster texcoord*/ - GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; - GLfloat RasterFogCoord; - GLboolean RasterPosValid; /* Raster po valid flag */ + GLuint RasterIndex; /* Current raster index */ + GLfloat RasterTexCoords[MAX_TEXTURE_UNITS][4];/* Current raster texcoords */ + GLboolean RasterPosValid; /* Raster pos valid flag */ }; @@ -332,7 +378,7 @@ struct gl_enable_attrib { GLboolean AlphaTest; GLboolean AutoNormal; GLboolean Blend; - GLboolean ClipPlane[MAX_CLIP_PLANES]; + GLuint ClipPlanes; GLboolean ColorMaterial; GLboolean Convolution1D; GLboolean Convolution2D; @@ -357,6 +403,7 @@ struct gl_enable_attrib { GLboolean Map1TextureCoord4; GLboolean Map1Vertex3; GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ GLboolean Map2Color4; GLboolean Map2Index; GLboolean Map2Normal; @@ -366,6 +413,7 @@ struct gl_enable_attrib { GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ GLboolean MinMax; GLboolean Normalize; GLboolean PixelTexture; @@ -378,14 +426,18 @@ struct gl_enable_attrib { GLboolean RescaleNormals; GLboolean Scissor; GLboolean Stencil; - GLboolean MultisampleEnabled; /* GL_ARB_multisample */ - GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ - GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ - GLboolean SampleCoverage; /* GL_ARB_multisample */ - GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ + GLboolean MultisampleEnabled; /* GL_ARB_multisample */ + GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */ + GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ + GLboolean SampleCoverage; /* GL_ARB_multisample */ + GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ GLuint Texture[MAX_TEXTURE_UNITS]; GLuint TexGen[MAX_TEXTURE_UNITS]; + GLboolean VertexProgram; /* GL_NV_vertex_program */ + GLboolean VertexProgramPointSize; /* GL_NV_vertex_program */ + GLboolean VertexProgramTwoSide; /* GL_NV_vertex_program */ + GLboolean PointSprite; /* GL_NV_point_sprite */ }; @@ -400,6 +452,7 @@ struct gl_eval_attrib { GLboolean Map1TextureCoord4; GLboolean Map1Vertex3; GLboolean Map1Vertex4; + GLboolean Map1Attrib[16]; /* GL_NV_vertex_program */ GLboolean Map2Color4; GLboolean Map2Index; GLboolean Map2Normal; @@ -409,6 +462,7 @@ struct gl_eval_attrib { GLboolean Map2TextureCoord4; GLboolean Map2Vertex3; GLboolean Map2Vertex4; + GLboolean Map2Attrib[16]; /* GL_NV_vertex_program */ GLboolean AutoNormal; /* Map Grid endpoints and divisions and calculated du values */ GLint MapGrid1un; @@ -474,6 +528,11 @@ struct gl_convolution_attrib { }; +#define LIGHT_SPOT 0x1 +#define LIGHT_LOCAL_VIEWER 0x2 +#define LIGHT_POSITIONAL 0x4 +#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) + struct gl_light_attrib { struct gl_light Light[MAX_LIGHTS]; /* Array of lights */ struct gl_lightmodel Model; /* Lighting model */ @@ -493,17 +552,11 @@ struct gl_light_attrib { /* Derived for optimizations: */ GLboolean _NeedVertices; /* Use fast shader? */ - GLuint _Flags; /* LIGHT_* flags, see below */ + GLuint _Flags; /* LIGHT_* flags, see above */ GLfloat _BaseColor[2][3]; }; -#define LIGHT_SPOT 0x1 -#define LIGHT_LOCAL_VIEWER 0x2 -#define LIGHT_POSITIONAL 0x4 - -#define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) - struct gl_line_attrib { GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */ GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */ @@ -518,6 +571,7 @@ struct gl_list_attrib { GLuint ListBase; }; + struct gl_list_opcode { GLuint size; void (*execute)( GLcontext *ctx, void *data ); @@ -545,7 +599,9 @@ struct gl_multisample_attrib { struct gl_pixel_attrib { GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ - GLenum DriverReadBuffer; /* Driver's current source buffer */ + GLubyte _ReadSrcMask; /* Not really a mask, but like _DrawDestMask */ + /* May be: FRONT_LEFT_BIT, BACK_LEFT_BIT, */ + /* FRONT_RIGHT_BIT or BACK_RIGHT_BIT. */ GLfloat RedBias, RedScale; GLfloat GreenBias, GreenScale; GLfloat BlueBias, BlueScale; @@ -555,6 +611,7 @@ struct gl_pixel_attrib { GLboolean MapColorFlag; GLboolean MapStencilFlag; GLfloat ZoomX, ZoomY; + /* XXX move these out of gl_pixel_attrib */ GLint MapStoSsize; /* Size of each pixel map */ GLint MapItoIsize; GLint MapItoRsize; @@ -614,13 +671,15 @@ struct gl_pixel_attrib { struct gl_point_attrib { GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */ - GLboolean SpriteMode; /* GL_MESA_sprite_point extension */ GLfloat Size; /* User-specified point size */ GLfloat _Size; /* Size clamped to Const.Min/MaxPointSize */ GLfloat Params[3]; /* GL_EXT_point_parameters */ GLfloat MinSize, MaxSize; /* GL_EXT_point_parameters */ GLfloat Threshold; /* GL_EXT_point_parameters */ GLboolean _Attenuated; /* True if Params != [1, 0, 0] */ + GLboolean PointSprite; /* GL_NV_point_sprite */ + GLboolean CoordReplace[MAX_TEXTURE_UNITS]; /* GL_NV_point_sprite */ + GLenum SpriteRMode; /* GL_NV_point_sprite */ }; @@ -628,18 +687,16 @@ struct gl_polygon_attrib { GLenum FrontFace; /* Either GL_CW or GL_CCW */ GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */ GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */ - GLboolean _FrontBit; /* */ + GLboolean _FrontBit; /* 0=GL_CCW, 1=GL_CW */ GLboolean CullFlag; /* Culling on/off flag */ GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */ GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */ GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */ GLfloat OffsetFactor; /* Polygon offset factor, from user */ GLfloat OffsetUnits; /* Polygon offset units, from user */ - GLfloat OffsetMRD; /* = OffsetUnits * visual->MRD */ GLboolean OffsetPoint; /* Offset in GL_POINT mode */ GLboolean OffsetLine; /* Offset in GL_LINE mode */ GLboolean OffsetFill; /* Offset in GL_FILL mode */ - GLboolean _OffsetAny; }; @@ -652,14 +709,16 @@ struct gl_scissor_attrib { struct gl_stencil_attrib { GLboolean Enabled; /* Enabled flag */ - GLenum Function; /* Stencil function */ - GLenum FailFunc; /* Fail function */ - GLenum ZPassFunc; /* Depth buffer pass function */ - GLenum ZFailFunc; /* Depth buffer fail function */ - GLstencil Ref; /* Reference value */ - GLstencil ValueMask; /* Value mask */ + GLboolean TestTwoSide; /* GL_EXT_stencil_two_side */ + GLubyte ActiveFace; /* GL_EXT_stencil_two_side (0 or 1) */ + GLenum Function[2]; /* Stencil function */ + GLenum FailFunc[2]; /* Fail function */ + GLenum ZPassFunc[2]; /* Depth buffer pass function */ + GLenum ZFailFunc[2]; /* Depth buffer fail function */ + GLstencil Ref[2]; /* Reference value */ + GLstencil ValueMask[2]; /* Value mask */ + GLstencil WriteMask[2]; /* Write mask */ GLstencil Clear; /* Clear value */ - GLstencil WriteMask; /* Write mask */ }; @@ -669,54 +728,17 @@ struct gl_stencil_attrib { #define R_BIT 4 #define Q_BIT 8 -#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE, and RECT */ - -/* Texture Enabled flags */ -#define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */ -#define TEXTURE0_2D 0x2 -#define TEXTURE0_3D 0x4 -#define TEXTURE0_CUBE 0x8 -#define TEXTURE0_RECT 0x10 -#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE | TEXTURE0_RECT) - -#define TEXTURE1_1D (TEXTURE0_1D << 5) /* Texture unit 1 */ -#define TEXTURE1_2D (TEXTURE0_2D << 5) -#define TEXTURE1_3D (TEXTURE0_3D << 5) -#define TEXTURE1_CUBE (TEXTURE0_CUBE << 5) -#define TEXTURE1_RECT (TEXTURE0_RECT << 5) -#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE | TEXTURE1_RECT) - -#define TEXTURE2_1D (TEXTURE0_1D << 10) /* Texture unit 2 */ -#define TEXTURE2_2D (TEXTURE0_2D << 10) -#define TEXTURE2_3D (TEXTURE0_3D << 10) -#define TEXTURE2_CUBE (TEXTURE0_CUBE << 10) -#define TEXTURE2_RECT (TEXTURE0_RECT << 10) -#define TEXTURE2_ANY (TEXTURE2_1D | TEXTURE2_2D | TEXTURE2_3D | TEXTURE2_CUBE | TEXTURE2_RECT) - -#define TEXTURE3_1D (TEXTURE0_1D << 15) /* Texture unit 3 */ -#define TEXTURE3_2D (TEXTURE0_2D << 15) -#define TEXTURE3_3D (TEXTURE0_3D << 15) -#define TEXTURE3_CUBE (TEXTURE0_CUBE << 15) -#define TEXTURE3_RECT (TEXTURE0_RECT << 15) -#define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE | TEXTURE3_RECT) - -#define TEXTURE4_1D (TEXTURE0_1D << 20) /* Texture unit 4 */ -#define TEXTURE4_2D (TEXTURE0_2D << 20) -#define TEXTURE4_3D (TEXTURE0_3D << 20) -#define TEXTURE4_CUBE (TEXTURE0_CUBE << 20) -#define TEXTURE4_RECT (TEXTURE0_RECT << 20) -#define TEXTURE4_ANY (TEXTURE4_1D | TEXTURE4_2D | TEXTURE4_3D | TEXTURE4_CUBE | TEXTURE4_TECT) - -#define TEXTURE5_1D (TEXTURE0_1D << 25) /* Texture unit 5 */ -#define TEXTURE5_2D (TEXTURE0_2D << 25) -#define TEXTURE5_3D (TEXTURE0_3D << 25) -#define TEXTURE5_CUBE (TEXTURE0_CUBE << 25) -#define TEXTURE5_RECT (TEXTURE0_CUBE << 25) -#define TEXTURE5_ANY (TEXTURE5_1D | TEXTURE5_2D | TEXTURE5_3D | TEXTURE5_CUBE | TEXTURE5_RECT) - - -/* Bitmap versions of the GL_ constants. - */ +/* Texture.Unit[]._ReallyEnabled flags: */ +#define TEXTURE_1D_BIT 0x01 +#define TEXTURE_2D_BIT 0x02 +#define TEXTURE_3D_BIT 0x04 +#define TEXTURE_CUBE_BIT 0x08 +#define TEXTURE_RECT_BIT 0x10 + +#define NUM_TEXTURE_TARGETS 5 /* 1D, 2D, 3D, CUBE and RECT */ + + +/* Bitmap versions of the GL_ constants. */ #define TEXGEN_SPHERE_MAP 0x1 #define TEXGEN_OBJ_LINEAR 0x2 #define TEXGEN_EYE_LINEAR 0x4 @@ -733,8 +755,7 @@ struct gl_stencil_attrib { -/* A selection of state flags to make driver and module's lives easier. - */ +/* A selection of state flags to make driver and module's lives easier. */ #define ENABLE_TEXGEN0 0x1 #define ENABLE_TEXGEN1 0x2 #define ENABLE_TEXGEN2 0x4 @@ -773,35 +794,36 @@ struct gl_texture_format { * GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA, * GL_COLOR_INDEX or GL_DEPTH_COMPONENT. */ - GLenum Type; /* Internal type as GL enum value */ - GLubyte RedBits; /* Bits per texel component */ - GLubyte GreenBits; - GLubyte BlueBits; + GLubyte GreenBits; /* These are just rough approximations for */ + GLubyte BlueBits; /* compressed texture formats. */ GLubyte AlphaBits; GLubyte LuminanceBits; GLubyte IntensityBits; GLubyte IndexBits; GLubyte DepthBits; - GLint TexelBytes; + GLint TexelBytes; /* Bytes per texel (0 for compressed formats */ FetchTexelFunc FetchTexel1D; /* Texel fetch function pointers */ FetchTexelFunc FetchTexel2D; FetchTexelFunc FetchTexel3D; }; + /* Texture image record */ struct gl_texture_image { GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_RGB, GL_RGBA, * GL_COLOR_INDEX or GL_DEPTH_COMPONENT only. + * Used for choosing TexEnv arithmetic. */ GLint IntFormat; /* Internal format as given by the user */ GLuint Border; /* 0 or 1 */ GLuint Width; /* = 2^WidthLog2 + 2*Border */ GLuint Height; /* = 2^HeightLog2 + 2*Border */ GLuint Depth; /* = 2^DepthLog2 + 2*Border */ + GLuint RowStride; /* == Width unless IsClientData and padded */ GLuint Width2; /* = Width - 2*Border */ GLuint Height2; /* = Height - 2*Border */ GLuint Depth2; /* = Depth - 2*Border */ @@ -813,6 +835,8 @@ struct gl_texture_image { GLfloat HeightScale; /* used for mipmap lod computation */ GLfloat DepthScale; /* used for mipmap lod computation */ GLvoid *Data; /* Image data, accessed via FetchTexel() */ + GLboolean IsClientData; /* Data owned by client? */ + const struct gl_texture_format *TexFormat; @@ -833,7 +857,8 @@ struct gl_texture_object { GLuint Name; /* an unsigned integer */ GLenum Target; /* GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ GLfloat Priority; /* in [0,1] */ - GLchan BorderColor[4]; + GLfloat BorderColor[4]; /* unclamped */ + GLchan _BorderChan[4]; /* clamped, as GLchan */ GLenum WrapS; /* Wrap modes are: GL_CLAMP, REPEAT */ GLenum WrapT; /* GL_CLAMP_TO_EDGE, and */ GLenum WrapR; /* GL_CLAMP_TO_BORDER_ARB */ @@ -846,7 +871,10 @@ struct gl_texture_object { GLfloat MaxAnisotropy; /* GL_EXT_texture_filter_anisotropic */ GLboolean CompareFlag; /* GL_SGIX_shadow */ GLenum CompareOperator; /* GL_SGIX_shadow */ - GLchan ShadowAmbient; /* GL_SGIX_shadow_ambient */ + GLfloat ShadowAmbient; + GLenum CompareMode; /* GL_ARB_shadow */ + GLenum CompareFunc; /* GL_ARB_shadow */ + GLenum DepthMode; /* GL_ARB_depth_texture */ GLint _MaxLevel; /* actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */ GLboolean GenerateMipmap; /* GL_SGIS_generate_mipmap */ @@ -872,13 +900,10 @@ struct gl_texture_object { }; - -/* - * Texture units are new with the multitexture extension. - */ +/* Texture unit record */ struct gl_texture_unit { - GLuint Enabled; /* bitmask of TEXTURE0_1D, _2D, _3D, _CUBE, _RECT */ - GLuint _ReallyEnabled; /* 0 or one of TEXTURE0_1D, _2D, _3D, _CUBE, _RECT */ + GLuint Enabled; /* bitmask of TEXTURE_*_BIT flags */ + GLuint _ReallyEnabled; /* 0 or exactly one of TEXTURE_*_BIT flags */ GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND, etc. */ GLfloat EnvColor[4]; @@ -923,20 +948,17 @@ struct gl_texture_unit { struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ struct gl_texture_object Saved2D; struct gl_texture_object Saved3D; - struct gl_texture_object SavedCubeMap; /* GL_ARB_texture_cube_map */ - struct gl_texture_object SavedRect; /* GL_NV_texture_rectangle */ + struct gl_texture_object SavedCubeMap; + struct gl_texture_object SavedRect; }; +/* The texture attribute group */ struct gl_texture_attrib { /* multitexture */ GLuint CurrentUnit; /* Active texture unit */ - GLuint _ReallyEnabled; /* enables for all texture units: */ - /* = (Unit[0]._ReallyEnabled << 0) | */ - /* (Unit[1]._ReallyEnabled << 5) | */ - /* (Unit[2]._ReallyEnabled << 10) | etc... */ - + GLuint _EnabledUnits; /* one bit set for each really-enabled unit */ GLuint _GenFlags; /* for texgen */ GLuint _TexGenEnabled; GLuint _TexMatEnabled; @@ -946,8 +968,8 @@ struct gl_texture_attrib { struct gl_texture_object *Proxy1D; struct gl_texture_object *Proxy2D; struct gl_texture_object *Proxy3D; - struct gl_texture_object *ProxyCubeMap; /* GL_ARB_texture_cube_map */ - struct gl_texture_object *ProxyRect; /* GL_NV_texture_rectangle */ + struct gl_texture_object *ProxyCubeMap; + struct gl_texture_object *ProxyRect; /* GL_EXT_shared_texture_palette */ GLboolean SharedPalette; @@ -959,8 +981,7 @@ struct gl_transform_attrib { GLenum MatrixMode; /* Matrix mode */ GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; GLfloat _ClipUserPlane[MAX_CLIP_PLANES][4]; /* derived */ - GLboolean ClipEnabled[MAX_CLIP_PLANES]; - GLubyte _AnyClip; /* How many ClipEnabled? */ + GLuint ClipPlanesEnabled; /* on/off bitmask */ GLboolean Normalize; /* Normalize all normals? */ GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ @@ -995,6 +1016,8 @@ struct gl_pixelstore_attrib { GLint SkipImages; /* for GL_EXT_texture3D */ GLboolean SwapBytes; GLboolean LsbFirst; + GLboolean ClientStorage; /* GL_APPLE_client_storage */ + GLboolean Invert; /* GL_MESA_pack_invert */ }; @@ -1011,7 +1034,7 @@ struct gl_client_array { GLsizei StrideB; /* actual stride in bytes */ void *Ptr; GLuint Flags; - GLboolean Enabled; + GLuint Enabled; /* one of the _NEW_ARRAY_ bits */ }; @@ -1025,6 +1048,8 @@ struct gl_array_attrib { struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; struct gl_client_array EdgeFlag; + struct gl_client_array VertexAttrib[16]; /* GL_NV_vertex_program */ + GLint TexCoordInterleaveFactor; GLint ActiveTexture; /* Client Active Texture */ GLuint LockFirst; @@ -1092,6 +1117,7 @@ struct gl_evaluators { struct gl_1d_map Map1Texture2; struct gl_1d_map Map1Texture3; struct gl_1d_map Map1Texture4; + struct gl_1d_map Map1Attrib[16]; /* GL_NV_vertex_program */ /* 2-D maps */ struct gl_2d_map Map2Vertex3; @@ -1103,10 +1129,131 @@ struct gl_evaluators { struct gl_2d_map Map2Texture2; struct gl_2d_map Map2Texture3; struct gl_2d_map Map2Texture4; + struct gl_2d_map Map2Attrib[16]; /* GL_NV_vertex_program */ }; /* + * Vertex program tokens and datatypes + */ + +#define VP_MAX_INSTRUCTIONS 128 + +#define VP_NUM_INPUT_REGS VERT_ATTRIB_MAX +#define VP_NUM_OUTPUT_REGS 15 +#define VP_NUM_TEMP_REGS 12 +#define VP_NUM_PROG_REGS 96 + +#define VP_NUM_TOTAL_REGISTERS (VP_NUM_INPUT_REGS + VP_NUM_OUTPUT_REGS + VP_NUM_TEMP_REGS + VP_NUM_PROG_REGS) + +/* Location of register sets within the whole register file */ +#define VP_INPUT_REG_START 0 +#define VP_INPUT_REG_END (VP_INPUT_REG_START + VP_NUM_INPUT_REGS - 1) +#define VP_OUTPUT_REG_START (VP_INPUT_REG_END + 1) +#define VP_OUTPUT_REG_END (VP_OUTPUT_REG_START + VP_NUM_OUTPUT_REGS - 1) +#define VP_TEMP_REG_START (VP_OUTPUT_REG_END + 1) +#define VP_TEMP_REG_END (VP_TEMP_REG_START + VP_NUM_TEMP_REGS - 1) +#define VP_PROG_REG_START (VP_TEMP_REG_END + 1) +#define VP_PROG_REG_END (VP_PROG_REG_START + VP_NUM_PROG_REGS - 1) + + +/* Machine state (i.e. the register file) */ +struct vp_machine +{ + GLfloat Registers[VP_NUM_TOTAL_REGISTERS][4]; + GLint AddressReg; /* might someday be a 4-vector */ +}; + + +/* Vertex program opcodes */ +enum vp_opcode +{ + MOV, + LIT, + RCP, + RSQ, + EXP, + LOG, + MUL, + ADD, + DP3, + DP4, + DST, + MIN, + MAX, + SLT, + SGE, + MAD, + ARL, + DPH, + RCC, + SUB, + ABS, + END +}; + + +/* Instruction source register */ +struct vp_src_register +{ + GLint Register; /* or the offset from the address register */ + GLuint Swizzle[4]; + GLboolean Negate; + GLboolean RelAddr; +}; + + +/* Instruction destination register */ +struct vp_dst_register +{ + GLint Register; + GLboolean WriteMask[4]; +}; + + +/* Vertex program instruction */ +struct vp_instruction +{ + enum vp_opcode Opcode; + struct vp_src_register SrcReg[3]; + struct vp_dst_register DstReg; +}; + + +/* The actual vertex program, stored in the hash table */ +struct vp_program +{ + GLubyte *String; /* Original user code */ + struct vp_instruction *Instructions; /* Compiled instructions */ + GLenum Target; /* GL_VERTEX_PROGRAM_NV or GL_VERTEX_STATE_PROGRAM_NV */ + GLint RefCount; /* Since programs can be shared among contexts */ + GLboolean IsPositionInvariant; /* GL_NV_vertex_program1_1 */ + GLboolean Resident; + GLuint InputsRead; /* Bitmask of which input regs are read */ + GLuint OutputsWritten; /* Bitmask of which output regs are written to */ +}; + + +/* + * State vars for GL_NV_vertex_program + */ +struct vertex_program_state +{ + GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ + GLboolean PointSizeEnabled; /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + GLboolean TwoSideEnabled; /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + GLuint CurrentID; /* currently bound program's ID */ + GLint ErrorPos; /* GL_PROGRAM_ERROR_POSITION_NV */ + struct vp_program *Current; /* ptr to currently bound program */ + struct vp_machine Machine; /* machine state */ + + GLenum TrackMatrix[VP_NUM_PROG_REGS / 4]; + GLenum TrackMatrixTransform[VP_NUM_PROG_REGS / 4]; +}; + + + +/* * State which can be shared by multiple contexts: */ struct gl_shared_state { @@ -1123,6 +1270,9 @@ struct gl_shared_state { struct gl_texture_object *DefaultCubeMap; struct gl_texture_object *DefaultRect; + /* GL_NV_vertex_program */ + struct _mesa_HashTable *VertexPrograms; + void *DriverData; /* Device driver shared state */ }; @@ -1153,11 +1303,10 @@ struct gl_frame_buffer { GLaccum *Accum; /* array [4*Width*Height] of GLaccum values */ /* Software alpha planes */ - GLchan *FrontLeftAlpha; /* array [Width*Height] of GLubyte */ - GLchan *BackLeftAlpha; /* array [Width*Height] of GLubyte */ - GLchan *FrontRightAlpha; /* array [Width*Height] of GLubyte */ - GLchan *BackRightAlpha; /* array [Width*Height] of GLubyte */ - GLchan *Alpha; /* Points to current alpha buffer */ + GLvoid *FrontLeftAlpha; /* array [Width*Height] of GLubyte */ + GLvoid *BackLeftAlpha; /* array [Width*Height] of GLubyte */ + GLvoid *FrontRightAlpha; /* array [Width*Height] of GLubyte */ + GLvoid *BackRightAlpha; /* array [Width*Height] of GLubyte */ /* Drawing bounds: intersection of window size and scissor box */ GLint _Xmin, _Ymin; /* inclusive */ @@ -1189,8 +1338,6 @@ struct gl_constants { GLuint MaxColorTableSize; GLuint MaxConvolutionWidth; GLuint MaxConvolutionHeight; - GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */ - GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS]; GLuint MaxClipPlanes; GLuint MaxLights; }; @@ -1206,15 +1353,21 @@ struct gl_extensions { /* Flags to quickly test if certain extensions are available. * Not every extension needs to have such a flag, but it's encouraged. */ + GLboolean ARB_depth_texture; GLboolean ARB_imaging; GLboolean ARB_multisample; GLboolean ARB_multitexture; + GLboolean ARB_shadow; GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_compression; GLboolean ARB_texture_cube_map; GLboolean ARB_texture_env_combine; + GLboolean ARB_texture_env_crossbar; GLboolean ARB_texture_env_dot3; GLboolean ARB_texture_mirrored_repeat; + GLboolean ARB_window_pos; + GLboolean ATI_texture_mirror_once; + GLboolean ATI_texture_env_combine3; GLboolean EXT_blend_color; GLboolean EXT_blend_func_separate; GLboolean EXT_blend_logic_op; @@ -1225,14 +1378,17 @@ struct gl_extensions { GLboolean EXT_compiled_vertex_array; GLboolean EXT_fog_coord; GLboolean EXT_histogram; + GLboolean EXT_multi_draw_arrays; GLboolean EXT_packed_pixels; GLboolean EXT_paletted_texture; GLboolean EXT_point_parameters; GLboolean EXT_polygon_offset; GLboolean EXT_rescale_normal; + GLboolean EXT_shadow_funcs; GLboolean EXT_secondary_color; GLboolean EXT_shared_texture_palette; GLboolean EXT_stencil_wrap; + GLboolean EXT_stencil_two_side; GLboolean EXT_texture3D; GLboolean EXT_texture_compression_s3tc; GLboolean EXT_texture_env_add; @@ -1245,12 +1401,16 @@ struct gl_extensions { GLboolean HP_occlusion_test; GLboolean IBM_rasterpos_clip; GLboolean INGR_blend_func_separate; + GLboolean MESA_pack_invert; GLboolean MESA_window_pos; GLboolean MESA_resize_buffers; - GLboolean MESA_sprite_point; + GLboolean MESA_ycbcr_texture; GLboolean NV_blend_square; - GLboolean NV_texgen_reflection; + GLboolean NV_point_sprite; GLboolean NV_texture_rectangle; + GLboolean NV_texgen_reflection; + GLboolean NV_vertex_program; + GLboolean NV_vertex_program1_1; GLboolean SGI_color_matrix; GLboolean SGI_color_table; GLboolean SGIS_generate_mipmap; @@ -1259,11 +1419,24 @@ struct gl_extensions { GLboolean SGIX_depth_texture; GLboolean SGIX_pixel_texture; GLboolean SGIX_shadow; - GLboolean SGIX_shadow_ambient; - GLboolean _3DFX_texture_compression_FXT1; + GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ + GLboolean TDFX_texture_compression_FXT1; + GLboolean APPLE_client_storage; }; +/* + * A stack of matrices (projection, modelview, color, texture, etc). + */ +struct matrix_stack +{ + GLmatrix *Top; /* points into Stack */ + GLmatrix *Stack; /* array [MaxDepth] of GLmatrix */ + GLuint Depth; /* 0 <= Depth < MaxDepth */ + GLuint MaxDepth; /* size of Stack[] array */ + GLuint DirtyFlag; /* _NEW_MODELVIEW or _NEW_PROJECTION, for example */ +}; + /* * Bits for image transfer operations (ctx->ImageTransferState). @@ -1324,32 +1497,40 @@ struct gl_extensions { #define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */ #define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */ #define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */ +#define _NEW_TRACK_MATRIX 0x4000000 /* ctx->VertexProgram */ +#define _NEW_PROGRAM 0x8000000 /* ctx->VertexProgram */ #define _NEW_ALL ~0 /* Bits to track array state changes (also used to summarize array enabled) */ -#define _NEW_ARRAY_VERTEX 0x1 -#define _NEW_ARRAY_COLOR 0x2 -#define _NEW_ARRAY_NORMAL 0x4 -#define _NEW_ARRAY_INDEX 0x8 -#define _NEW_ARRAY_EDGEFLAG 0x10 -#define _NEW_ARRAY_SECONDARYCOLOR 0x20 -#define _NEW_ARRAY_FOGCOORD 0x40 -#define _NEW_ARRAY_TEXCOORD_0 0x80 -#define _NEW_ARRAY_TEXCOORD_1 0x100 -#define _NEW_ARRAY_TEXCOORD_2 0x200 -#define _NEW_ARRAY_TEXCOORD_3 0x400 -#define _NEW_ARRAY_TEXCOORD_4 0x800 -#define _NEW_ARRAY_TEXCOORD_5 0x1000 -#define _NEW_ARRAY_TEXCOORD_6 0x2000 -#define _NEW_ARRAY_TEXCOORD_7 0x4000 -#define _NEW_ARRAY_ALL 0x7fff +#define _NEW_ARRAY_VERTEX VERT_BIT_POS +#define _NEW_ARRAY_WEIGHT VERT_BIT_WEIGHT +#define _NEW_ARRAY_NORMAL VERT_BIT_NORMAL +#define _NEW_ARRAY_COLOR0 VERT_BIT_COLOR0 +#define _NEW_ARRAY_COLOR1 VERT_BIT_COLOR1 +#define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG +#define _NEW_ARRAY_INDEX VERT_BIT_SIX +#define _NEW_ARRAY_EDGEFLAG VERT_BIT_SEVEN +#define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0 +#define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1 +#define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2 +#define _NEW_ARRAY_TEXCOORD_3 VERT_BIT_TEX3 +#define _NEW_ARRAY_TEXCOORD_4 VERT_BIT_TEX4 +#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5 +#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6 +#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7 +#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */ +#define _NEW_ARRAY_ALL 0xffffffff + #define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0 << (i)) +#define _NEW_ARRAY_ATTRIB(i) (_NEW_ARRAY_ATTRIB_0 << (i)) + /* A bunch of flags that we think might be useful to drivers. + * Set in the ctx->_TriangleCaps bitfield. */ #define DD_FLATSHADE 0x1 #define DD_SEPARATE_SPECULAR 0x2 @@ -1366,6 +1547,7 @@ struct gl_extensions { #define DD_POINT_SIZE 0x1000 #define DD_POINT_ATTEN 0x2000 + /* Define the state changes under which each of these bits might change */ #define _DD_NEW_FLATSHADE _NEW_LIGHT @@ -1394,9 +1576,11 @@ struct gl_extensions { #define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL | _NEW_COLOR_MATRIX) +/* Bits for ctx->_NeedNormals */ #define NEED_NORMALS_TEXGEN 0x1 #define NEED_NORMALS_LIGHT 0x2 +/* Bits for ctx->_NeedEyeCoords */ #define NEED_EYE_TEXGEN 0x1 #define NEED_EYE_LIGHT 0x2 #define NEED_EYE_LIGHT_MODELVIEW 0x4 @@ -1433,15 +1617,18 @@ struct gl_tnl_module { }; -/* - * The library context: +/** + * This is the central context data structure for Mesa. Almost all + * OpenGL state is contained in this structure. + * Think of this as a base class from which device drivers will derive + * sub classes. */ struct __GLcontextRec { - /* - ** Os related interfaces; these *must* be the first members of this - ** structure, because they are exposed to the outside world (i.e. GLX - ** extension). - */ + /** + * OS related interfaces; these *must* be the first members of this + * structure, because they are exposed to the outside world (i.e. GLX + * extension). + */ __GLimports imports; __GLexports exports; @@ -1449,49 +1636,39 @@ struct __GLcontextRec { struct gl_shared_state *Shared; /* API function pointer tables */ - struct _glapi_table *Save; /* Display list save funcs */ - struct _glapi_table *Exec; /* Execute funcs */ - struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */ + struct _glapi_table *Save; /**< Display list save funcs */ + struct _glapi_table *Exec; /**< Execute funcs */ + struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ - GLboolean ExecPrefersFloat; /* What preference for color conversion? */ + GLboolean ExecPrefersFloat; /**< What preference for color conversion? */ GLboolean SavePrefersFloat; GLvisual Visual; - GLframebuffer *DrawBuffer; /* buffer for writing */ - GLframebuffer *ReadBuffer; /* buffer for reading */ + GLframebuffer *DrawBuffer; /**< buffer for writing */ + GLframebuffer *ReadBuffer; /**< buffer for reading */ - /* Driver function pointer table */ + /** + * Device driver function pointer table + */ struct dd_function_table Driver; - void *DriverCtx; /* Points to device driver context/state */ - void *DriverMgrCtx; /* Points to device driver manager (optional)*/ + void *DriverCtx; /**< Points to device driver context/state */ + void *DriverMgrCtx; /**< Points to device driver manager (optional)*/ /* Core/Driver constants */ struct gl_constants Const; - /* Modelview matrix and stack */ - GLmatrix ModelView; /* current matrix, not stored on stack */ - GLuint ModelViewStackDepth; - GLmatrix ModelViewStack[MAX_MODELVIEW_STACK_DEPTH - 1]; - - /* Projection matrix and stack */ - GLmatrix ProjectionMatrix; /* current matrix, not stored on stack */ - GLuint ProjectionStackDepth; - GLmatrix ProjectionStack[MAX_PROJECTION_STACK_DEPTH - 1]; + /* The various 4x4 matrix stacks */ + struct matrix_stack ModelviewMatrixStack; + struct matrix_stack ProjectionMatrixStack; + struct matrix_stack ColorMatrixStack; + struct matrix_stack TextureMatrixStack[MAX_TEXTURE_UNITS]; + struct matrix_stack ProgramMatrixStack[MAX_PROGRAM_MATRICES]; + struct matrix_stack *CurrentStack; /* Points to one of the above stacks */ /* Combined modelview and projection matrix */ GLmatrix _ModelProjectMatrix; - /* Texture matrix and stack */ - GLmatrix TextureMatrix[MAX_TEXTURE_UNITS]; - GLuint TextureStackDepth[MAX_TEXTURE_UNITS]; - GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH - 1]; - - /* Color matrix and stack */ - GLmatrix ColorMatrix; - GLuint ColorStackDepth; - GLmatrix ColorStack[MAX_COLOR_STACK_DEPTH - 1]; - /* Display lists */ GLuint CallDepth; /* Current recursion calling depth */ GLboolean ExecuteFlag; /* Execute GL commands? */ @@ -1557,6 +1734,8 @@ struct __GLcontextRec { struct gl_color_table PostColorMatrixColorTable; struct gl_color_table ProxyPostColorMatrixColorTable; + struct vertex_program_state VertexProgram; /* GL_NV_vertex_program */ + GLenum ErrorValue; /* Last error code */ GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLuint NewState; /* bitwise-or of _NEW_* flags */ @@ -1569,28 +1748,32 @@ struct __GLcontextRec { GLuint _NeedEyeCoords; GLuint _NeedNormals; /* Are vertex normal vectors needed? */ - struct gl_shine_tab *_ShineTable[2]; /* Active shine tables */ - struct gl_shine_tab *_ShineTabList; /* Mru list of inactive shine tables */ + struct gl_shine_tab *_ShineTable[2]; /* Active shine tables */ + struct gl_shine_tab *_ShineTabList; /* Mru list of inactive shine tables */ struct gl_list_extensions listext; /* driver dlist extensions */ - GLboolean OcclusionResult; /* GL_HP_occlusion_test */ - GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */ + GLboolean OcclusionResult; /**< for GL_HP_occlusion_test */ + GLboolean OcclusionResultSaved; /**< for GL_HP_occlusion_test */ + GLuint _Facing; /* This is a hack for 2-sided stencil test. We don't */ + /* have a better way to communicate this value from */ + /* swrast_setup to swrast. */ + /* Z buffer stuff */ - GLuint DepthMax; /* Max depth buffer value */ - GLfloat DepthMaxF; /* Float max depth buffer value */ - GLfloat MRD; /* minimum resolvable difference in Z values */ + GLuint DepthMax; /**< Max depth buffer value */ + GLfloat DepthMaxF; /**< Float max depth buffer value */ + GLfloat MRD; /**< minimum resolvable difference in Z values */ - /* Should 3Dfx Glide driver catch signals? */ + /** Should 3Dfx Glide driver catch signals? */ GLboolean CatchSignals; - /* For debugging/development only */ + /** For debugging/development only */ GLboolean NoRaster; GLboolean FirstTimeCurrent; - /* Dither disable via MESA_NO_DITHER env var */ + /** Dither disable via MESA_NO_DITHER env var */ GLboolean NoDither; GLboolean Rendering; @@ -1660,16 +1843,13 @@ enum _debug { #define Elements(x) sizeof(x)/sizeof(*(x)) -#ifndef __GNUC__ -#define __FUNCTION__ "some function" -#endif /* Eventually let the driver specify what statechanges require a flush: */ #define FLUSH_VERTICES(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ - fprintf(stderr, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ + _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ ctx->NewState |= newstate; \ @@ -1678,7 +1858,7 @@ do { \ #define FLUSH_CURRENT(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ - fprintf(stderr, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ + _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ ctx->NewState |= newstate; \ diff --git a/xc/extras/Mesa/src/pixel.c b/xc/extras/Mesa/src/pixel.c index f6e3322c4..af4aeb077 100644 --- a/xc/extras/Mesa/src/pixel.c +++ b/xc/extras/Mesa/src/pixel.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,19 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" #include "pixel.h" #include "mtypes.h" -#endif - /**********************************************************************/ @@ -145,6 +139,17 @@ _mesa_PixelStorei( GLenum pname, GLint param ) FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.Alignment = param; break; + case GL_PACK_INVERT_MESA: + if (!ctx->Extensions.MESA_pack_invert) { + _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" ); + return; + } + if (ctx->Pack.Invert == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.Invert = param; + break; + case GL_UNPACK_SWAP_BYTES: if (param == (GLint)ctx->Unpack.SwapBytes) return; @@ -222,6 +227,12 @@ _mesa_PixelStorei( GLenum pname, GLint param ) FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.Alignment = param; break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + if (param == (GLint)ctx->Unpack.ClientStorage) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE; + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); return; @@ -851,7 +862,7 @@ _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; - const GLfloat *m = ctx->ColorMatrix.m; + const GLfloat *m = ctx->ColorMatrixStack.Top->m; GLuint i; for (i = 0; i < n; i++) { const GLfloat r = rgba[i][RCOMP]; diff --git a/xc/extras/Mesa/src/points.c b/xc/extras/Mesa/src/points.c index 12ca20689..00941e6f2 100644 --- a/xc/extras/Mesa/src/points.c +++ b/xc/extras/Mesa/src/points.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,9 +23,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "macros.h" @@ -33,7 +30,6 @@ #include "points.h" #include "texstate.h" #include "mtypes.h" -#endif @@ -68,6 +64,32 @@ _mesa_PointSize( GLfloat size ) +/* + * Added by GL_NV_point_sprite + */ +void +_mesa_PointParameteriNV( GLenum pname, GLint param ) +{ + const GLfloat value = (GLfloat) param; + _mesa_PointParameterfvEXT(pname, &value); +} + + +/* + * Added by GL_NV_point_sprite + */ +void +_mesa_PointParameterivNV( GLenum pname, const GLint *params ) +{ + const GLfloat value = (GLfloat) params[0]; + _mesa_PointParameterfvEXT(pname, &value); +} + + + +/* + * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. + */ void _mesa_PointParameterfEXT( GLenum pname, GLfloat param) { @@ -75,6 +97,10 @@ _mesa_PointParameterfEXT( GLenum pname, GLfloat param) } + +/* + * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. + */ void _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) { @@ -83,7 +109,7 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) switch (pname) { case GL_DISTANCE_ATTENUATION_EXT: - { + if (ctx->Extensions.EXT_point_parameters) { const GLboolean tmp = ctx->Point._Attenuated; if (TEST_EQ_3V(ctx->Point.Params, params)) return; @@ -104,39 +130,88 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN; } } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } break; case GL_POINT_SIZE_MIN_EXT: - if (*params < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" ); + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.MinSize == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.MinSize = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); return; } - if (ctx->Point.MinSize == *params) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.MinSize = *params; break; case GL_POINT_SIZE_MAX_EXT: - if (*params < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" ); + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.MaxSize == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.MaxSize = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); return; } - if (ctx->Point.MaxSize == *params) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.MaxSize = *params; break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - if (*params < 0.0F) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" ); + if (ctx->Extensions.EXT_point_parameters) { + if (params[0] < 0.0F) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)" ); + return; + } + if (ctx->Point.Threshold == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.Threshold = params[0]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); + return; + } + break; + case GL_POINT_SPRITE_R_MODE_NV: + if (ctx->Extensions.NV_point_sprite) { + GLenum value = (GLenum) params[0]; + if (value != GL_ZERO && value != GL_S && value != GL_R) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glPointParameterf[v]{EXT,ARB}(param)"); + return; + } + if (ctx->Point.SpriteRMode == value) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteRMode = value; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)"); return; } - if (ctx->Point.Threshold == *params) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.Threshold = *params; break; default: - _mesa_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" ); + _mesa_error( ctx, GL_INVALID_ENUM, + "glPointParameterf[v]{EXT,ARB}(pname)" ); return; } diff --git a/xc/extras/Mesa/src/points.h b/xc/extras/Mesa/src/points.h index 36e1071c2..da57fba7a 100644 --- a/xc/extras/Mesa/src/points.h +++ b/xc/extras/Mesa/src/points.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,9 +24,6 @@ */ - - - #ifndef POINTS_H #define POINTS_H @@ -37,14 +34,17 @@ extern void _mesa_PointSize( GLfloat size ); +extern void +_mesa_PointParameteriNV( GLenum pname, GLint param ); extern void -_mesa_PointParameterfEXT( GLenum pname, GLfloat param); +_mesa_PointParameterivNV( GLenum pname, const GLint *params ); +extern void +_mesa_PointParameterfEXT( GLenum pname, GLfloat param ); extern void _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params ); - #endif diff --git a/xc/extras/Mesa/src/polygon.c b/xc/extras/Mesa/src/polygon.c index d1be6fa66..dd4f44ec3 100644 --- a/xc/extras/Mesa/src/polygon.c +++ b/xc/extras/Mesa/src/polygon.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,19 +24,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "image.h" #include "enums.h" #include "macros.h" -#include "mem.h" #include "polygon.h" #include "mtypes.h" -#endif - void @@ -46,7 +41,7 @@ _mesa_CullFace( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glCullFace %s\n", _mesa_lookup_enum_by_nr(mode)); if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) { _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" ); @@ -72,7 +67,7 @@ _mesa_FrontFace( GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); if (mode!=GL_CW && mode!=GL_CCW) { _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" ); @@ -100,9 +95,9 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPolygonMode %s %s\n", - _mesa_lookup_enum_by_nr(face), - _mesa_lookup_enum_by_nr(mode)); + _mesa_debug(ctx, "glPolygonMode %s %s\n", + _mesa_lookup_enum_by_nr(face), + _mesa_lookup_enum_by_nr(mode)); if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) { _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" ); @@ -153,7 +148,7 @@ _mesa_PolygonStipple( const GLubyte *pattern ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPolygonStipple\n"); + _mesa_debug(ctx, "glPolygonStipple\n"); FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); @@ -171,7 +166,7 @@ _mesa_GetPolygonStipple( GLubyte *dest ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glGetPolygonStipple\n"); + _mesa_debug(ctx, "glGetPolygonStipple\n"); _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack); } @@ -185,7 +180,7 @@ _mesa_PolygonOffset( GLfloat factor, GLfloat units ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPolygonOffset %f %f\n", factor, units); + _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); if (ctx->Polygon.OffsetFactor == factor && ctx->Polygon.OffsetUnits == units) @@ -194,7 +189,6 @@ _mesa_PolygonOffset( GLfloat factor, GLfloat units ) FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; - ctx->Polygon.OffsetMRD = units * ctx->MRD; if (ctx->Driver.PolygonOffset) ctx->Driver.PolygonOffset( ctx, factor, units ); diff --git a/xc/extras/Mesa/src/rastpos.c b/xc/extras/Mesa/src/rastpos.c index 7813506e2..606e80d92 100644 --- a/xc/extras/Mesa/src/rastpos.c +++ b/xc/extras/Mesa/src/rastpos.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,9 +24,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "clip.h" #include "colormac.h" @@ -42,7 +39,6 @@ #include "math/m_matrix.h" #include "math/m_xform.h" -#endif /* @@ -91,7 +87,7 @@ userclip_point( GLcontext* ctx, const GLfloat v[] ) GLuint p; for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { - if (ctx->Transform.ClipEnabled[p]) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] + v[1] * ctx->Transform._ClipUserPlane[p][1] + v[2] * ctx->Transform._ClipUserPlane[p][2] @@ -285,15 +281,15 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) _mesa_update_state( ctx ); ASSIGN_4V( v, x, y, z, w ); - TRANSFORM_POINT( eye, ctx->ModelView.m, v ); + TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, v ); /* raster color */ if (ctx->Light.Enabled) { GLfloat *norm, eyenorm[3]; - GLfloat *objnorm = ctx->Current.Normal; + GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; if (ctx->_NeedEyeCoords) { - GLfloat *inv = ctx->ModelView.inv; + GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv; TRANSFORM_NORMAL( eyenorm, objnorm, inv ); norm = eyenorm; } @@ -310,9 +306,10 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) else { /* use current color or index */ if (ctx->Visual.rgbMode) { - COPY_4FV(ctx->Current.RasterColor, ctx->Current.Color); + COPY_4FV(ctx->Current.RasterColor, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); COPY_4FV(ctx->Current.RasterSecondaryColor, - ctx->Current.SecondaryColor); + ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); } else { ctx->Current.RasterIndex = ctx->Current.Index; @@ -320,11 +317,14 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) } /* compute raster distance */ - ctx->Current.RasterDistance = (GLfloat) + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + else + ctx->Current.RasterDistance = (GLfloat) GL_SQRT( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); /* apply projection matrix: clip = Proj * eye */ - TRANSFORM_POINT( clip, ctx->ProjectionMatrix.m, eye ); + TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye ); /* clip to view volume */ if (ctx->Transform.RasterPositionUnclipped) { @@ -339,8 +339,7 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) } /* clip to user clipping planes */ - if (ctx->Transform._AnyClip && - userclip_point(ctx, clip) == 0) { + if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) { ctx->Current.RasterPosValid = GL_FALSE; return; } @@ -361,13 +360,11 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) ctx->Current.RasterPos[3] = clip[3]; ctx->Current.RasterPosValid = GL_TRUE; - ctx->Current.RasterFogCoord = ctx->Current.FogCoord; - { GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { - COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], - ctx->Current.Texcoord[texSet] ); + COPY_4FV( ctx->Current.RasterTexCoords[texSet], + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } } @@ -378,7 +375,6 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) } - void _mesa_RasterPos2d(GLdouble x, GLdouble y) { @@ -527,41 +523,53 @@ _mesa_RasterPos4sv(const GLshort *v) } - /**********************************************************************/ -/*** GL_MESA_window_pos ***/ +/*** GL_ARB_window_pos / GL_MESA_window_pos ***/ /**********************************************************************/ - -/* - * This is a MESA extension function. Pretty much just like glRasterPos - * except we don't apply the modelview or projection matrices; specify a - * window coordinate directly. - * Caller: context->API.WindowPos4fMESA pointer. - */ -void -_mesa_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +static void +window_pos3f(GLfloat x, GLfloat y, GLfloat z) { GET_CURRENT_CONTEXT(ctx); + GLfloat z2; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); FLUSH_CURRENT(ctx, 0); + z2 = CLAMP(z, 0.0F, 1.0F) * (ctx->Viewport.Far - ctx->Viewport.Near) + + ctx->Viewport.Near; + /* set raster position */ ctx->Current.RasterPos[0] = x; ctx->Current.RasterPos[1] = y; - ctx->Current.RasterPos[2] = CLAMP( z, 0.0F, 1.0F ); - ctx->Current.RasterPos[3] = w; + ctx->Current.RasterPos[2] = z2; + ctx->Current.RasterPos[3] = 1.0F; ctx->Current.RasterPosValid = GL_TRUE; - ctx->Current.RasterDistance = 0.0F; - ctx->Current.RasterFogCoord = 0.0F; + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) + ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; + else + ctx->Current.RasterDistance = 0.0; /* raster color = current color or index */ if (ctx->Visual.rgbMode) { - ctx->Current.RasterColor[0] = (ctx->Current.Color[0]); - ctx->Current.RasterColor[1] = (ctx->Current.Color[1]); - ctx->Current.RasterColor[2] = (ctx->Current.Color[2]); - ctx->Current.RasterColor[3] = (ctx->Current.Color[3]); + ctx->Current.RasterColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F); + ctx->Current.RasterColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F); + ctx->Current.RasterColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F); + ctx->Current.RasterColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[0] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[1] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[2] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F); + ctx->Current.RasterSecondaryColor[3] + = CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F); } else { ctx->Current.RasterIndex = ctx->Current.Index; @@ -571,8 +579,8 @@ _mesa_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GLuint texSet; for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { - COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], - ctx->Current.Texcoord[texSet] ); + COPY_4FV( ctx->Current.RasterTexCoords[texSet], + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texSet] ); } } @@ -582,146 +590,160 @@ _mesa_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) } +/* This is just to support the GL_MESA_window_pos version */ +static void +window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GET_CURRENT_CONTEXT(ctx); + window_pos3f(x, y, z); + ctx->Current.RasterPos[3] = w; +} void _mesa_WindowPos2dMESA(GLdouble x, GLdouble y) { - _mesa_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } void _mesa_WindowPos2fMESA(GLfloat x, GLfloat y) { - _mesa_WindowPos4fMESA(x, y, 0.0F, 1.0F); + window_pos4f(x, y, 0.0F, 1.0F); } void _mesa_WindowPos2iMESA(GLint x, GLint y) { - _mesa_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); + window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } void _mesa_WindowPos2sMESA(GLshort x, GLshort y) { - _mesa_WindowPos4fMESA(x, y, 0.0F, 1.0F); + window_pos4f(x, y, 0.0F, 1.0F); } void _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) { - _mesa_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } void _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) { - _mesa_WindowPos4fMESA(x, y, z, 1.0F); + window_pos4f(x, y, z, 1.0F); } void _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) { - _mesa_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } void _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) { - _mesa_WindowPos4fMESA(x, y, z, 1.0F); + window_pos4f(x, y, z, 1.0F); } void _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - _mesa_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +void +_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + window_pos4f(x, y, z, w); } void _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) { - _mesa_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); + window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } void _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) { - _mesa_WindowPos4fMESA(x, y, z, w); + window_pos4f(x, y, z, w); } void _mesa_WindowPos2dvMESA(const GLdouble *v) { - _mesa_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } void _mesa_WindowPos2fvMESA(const GLfloat *v) { - _mesa_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); + window_pos4f(v[0], v[1], 0.0F, 1.0F); } void _mesa_WindowPos2ivMESA(const GLint *v) { - _mesa_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); + window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } void _mesa_WindowPos2svMESA(const GLshort *v) { - _mesa_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); + window_pos4f(v[0], v[1], 0.0F, 1.0F); } void _mesa_WindowPos3dvMESA(const GLdouble *v) { - _mesa_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } void _mesa_WindowPos3fvMESA(const GLfloat *v) { - _mesa_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); + window_pos4f(v[0], v[1], v[2], 1.0); } void _mesa_WindowPos3ivMESA(const GLint *v) { - _mesa_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } void _mesa_WindowPos3svMESA(const GLshort *v) { - _mesa_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); + window_pos4f(v[0], v[1], v[2], 1.0F); } void _mesa_WindowPos4dvMESA(const GLdouble *v) { - _mesa_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } void _mesa_WindowPos4fvMESA(const GLfloat *v) { - _mesa_WindowPos4fMESA(v[0], v[1], v[2], v[3]); + window_pos4f(v[0], v[1], v[2], v[3]); } void _mesa_WindowPos4ivMESA(const GLint *v) { - _mesa_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], + window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } void _mesa_WindowPos4svMESA(const GLshort *v) { - _mesa_WindowPos4fMESA(v[0], v[1], v[2], v[3]); + window_pos4f(v[0], v[1], v[2], v[3]); } diff --git a/xc/extras/Mesa/src/rastpos.h b/xc/extras/Mesa/src/rastpos.h index e3fc1ee20..3d18cb91c 100644 --- a/xc/extras/Mesa/src/rastpos.h +++ b/xc/extras/Mesa/src/rastpos.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c index 9ea5e118c..dc3409ed5 100644 --- a/xc/extras/Mesa/src/state.c +++ b/xc/extras/Mesa/src/state.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -30,9 +30,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "accum.h" #include "api_loopback.h" @@ -68,17 +65,19 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#if FEATURE_NV_vertex_program +#include "vpstate.h" +#endif #include "math/m_matrix.h" #include "math/m_xform.h" -#endif static int generic_noop(void) { #ifdef DEBUG - _mesa_problem(NULL, "undefined function dispatch"); + _mesa_problem(NULL, "User called no-op dispatch function"); #endif return 0; } @@ -294,6 +293,7 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) /* 1.1 */ exec->AreTexturesResident = _mesa_AreTexturesResident; + exec->AreTexturesResidentEXT = _mesa_AreTexturesResident; exec->BindTexture = _mesa_BindTexture; exec->ColorPointer = _mesa_ColorPointer; exec->CopyTexImage1D = _mesa_CopyTexImage1D; @@ -305,10 +305,12 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->EdgeFlagPointer = _mesa_EdgeFlagPointer; exec->EnableClientState = _mesa_EnableClientState; exec->GenTextures = _mesa_GenTextures; + exec->GenTexturesEXT = _mesa_GenTextures; exec->GetPointerv = _mesa_GetPointerv; exec->IndexPointer = _mesa_IndexPointer; exec->InterleavedArrays = _mesa_InterleavedArrays; exec->IsTexture = _mesa_IsTexture; + exec->IsTextureEXT = _mesa_IsTexture; exec->NormalPointer = _mesa_NormalPointer; exec->PopClientAttrib = _mesa_PopClientAttrib; exec->PrioritizeTextures = _mesa_PrioritizeTextures; @@ -341,18 +343,31 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D; exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D; exec->GetColorTable = _mesa_GetColorTable; + exec->GetColorTableEXT = _mesa_GetColorTable; exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv; + exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv; + exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; exec->GetConvolutionFilter = _mesa_GetConvolutionFilter; + exec->GetConvolutionFilterEXT = _mesa_GetConvolutionFilter; exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv; + exec->GetConvolutionParameterfvEXT = _mesa_GetConvolutionParameterfv; exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv; + exec->GetConvolutionParameterivEXT = _mesa_GetConvolutionParameteriv; exec->GetHistogram = _mesa_GetHistogram; + exec->GetHistogramEXT = _mesa_GetHistogram; exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv; + exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv; exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv; + exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv; exec->GetMinmax = _mesa_GetMinmax; + exec->GetMinmaxEXT = _mesa_GetMinmax; exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv; + exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv; exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv; + exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv; exec->GetSeparableFilter = _mesa_GetSeparableFilter; + exec->GetSeparableFilterEXT = _mesa_GetSeparableFilter; exec->Histogram = _mesa_Histogram; exec->Minmax = _mesa_Minmax; exec->ResetHistogram = _mesa_ResetHistogram; @@ -423,6 +438,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->LockArraysEXT = _mesa_LockArraysEXT; exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; + /* 148. GL_EXT_multi_draw_arrays */ + exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT; + exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT; + /* 173. GL_INGR_blend_func_separate */ exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; @@ -455,6 +474,42 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; + /* 233. GL_NV_vertex_program */ +#if FEATURE_NV_vertex_program + exec->BindProgramNV = _mesa_BindProgramNV; + exec->DeleteProgramsNV = _mesa_DeleteProgramsNV; + exec->ExecuteProgramNV = _mesa_ExecuteProgramNV; + exec->GenProgramsNV = _mesa_GenProgramsNV; + exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV; + exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV; + exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV; + exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV; + exec->GetProgramivNV = _mesa_GetProgramivNV; + exec->GetProgramStringNV = _mesa_GetProgramStringNV; + exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV; + exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV; + exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV; + exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV; + exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV; + exec->IsProgramNV = _mesa_IsProgramNV; + exec->LoadProgramNV = _mesa_LoadProgramNV; + exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV; + exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV; + exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV; + exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV; + exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV; + exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV; + exec->TrackMatrixNV = _mesa_TrackMatrixNV; + exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV; +#endif + + /* 262. GL_NV_point_sprite */ + exec->PointParameteriNV = _mesa_PointParameteriNV; + exec->PointParameterivNV = _mesa_PointParameterivNV; + + /* 268. GL_EXT_stencil_two_side */ + exec->ActiveStencilFaceEXT = _mesa_ActiveStencilFaceEXT; + /* ARB 1. GL_ARB_multitexture */ exec->ActiveTextureARB = _mesa_ActiveTextureARB; exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB; @@ -477,6 +532,8 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB; exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; + /* ARB 14. GL_ARB_point_parameters */ + /* reuse EXT_point_parameters functions */ } @@ -486,6 +543,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) /**********************************************************************/ +/* + * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET + * in ctx->_TriangleCaps if needed. + */ static void update_polygon( GLcontext *ctx ) { @@ -495,36 +556,32 @@ update_polygon( GLcontext *ctx ) ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; /* Any Polygon offsets enabled? */ - ctx->Polygon._OffsetAny = GL_FALSE; - ctx->_TriangleCaps &= ~DD_TRI_OFFSET; - if (ctx->Polygon.OffsetPoint || ctx->Polygon.OffsetLine || ctx->Polygon.OffsetFill) { ctx->_TriangleCaps |= DD_TRI_OFFSET; - ctx->Polygon._OffsetAny = GL_TRUE; } } static void calculate_model_project_matrix( GLcontext *ctx ) { - _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, - &ctx->ProjectionMatrix, - &ctx->ModelView ); + _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix, + ctx->ProjectionMatrixStack.Top, + ctx->ModelviewMatrixStack.Top ); - _math_matrix_analyse( &ctx->_ModelProjectMatrix ); + _math_matrix_analyse( &ctx->_ModelProjectMatrix ); } static void update_modelview_scale( GLcontext *ctx ) { ctx->_ModelViewInvScale = 1.0F; - if (ctx->ModelView.flags & (MAT_FLAG_UNIFORM_SCALE | + if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_UNIFORM_SCALE | MAT_FLAG_GENERAL_SCALE | MAT_FLAG_GENERAL_3D | MAT_FLAG_GENERAL) ) { - const GLfloat *m = ctx->ModelView.inv; + const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv; GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10]; if (f < 1e-12) f = 1.0; if (ctx->_NeedEyeCoords) @@ -594,23 +651,23 @@ update_drawbuffer( GLcontext *ctx ) /* NOTE: This routine references Tranform attribute values to compute * userclip positions in clip space, but is only called on * _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values - * uptodate across changes to the Transform attributes. + * up to date across changes to the Transform attributes. */ static void update_projection( GLcontext *ctx ) { - _math_matrix_analyse( &ctx->ProjectionMatrix ); + _math_matrix_analyse( ctx->ProjectionMatrixStack.Top ); /* Recompute clip plane positions in clipspace. This is also done * in _mesa_ClipPlane(). */ - if (ctx->Transform._AnyClip) { + if (ctx->Transform.ClipPlanesEnabled) { GLuint p; for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { - if (ctx->Transform.ClipEnabled[p]) { + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { _mesa_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], - ctx->ProjectionMatrix.inv ); + ctx->ProjectionMatrixStack.Top->inv ); } } } @@ -660,7 +717,7 @@ update_image_transfer_state(GLcontext *ctx) if (ctx->Pixel.PostConvolutionColorTableEnabled) mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT; - if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY || ctx->Pixel.PostColorMatrixScale[0] != 1.0F || ctx->Pixel.PostColorMatrixBias[0] != 0.0F || ctx->Pixel.PostColorMatrixScale[1] != 1.0F || @@ -702,15 +759,15 @@ update_texture_matrices( GLcontext *ctx ) ctx->Texture._TexMatEnabled = 0; for (i=0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->TextureMatrix[i].flags & MAT_DIRTY) { - _math_matrix_analyse( &ctx->TextureMatrix[i] ); + if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) { + _math_matrix_analyse( ctx->TextureMatrixStack[i].Top ); if (ctx->Texture.Unit[i]._ReallyEnabled && - ctx->TextureMatrix[i].type != MATRIX_IDENTITY) + ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); if (ctx->Driver.TextureMatrix) - ctx->Driver.TextureMatrix( ctx, i, &ctx->TextureMatrix[i] ); + ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top); } } } @@ -727,9 +784,9 @@ update_texture_matrices( GLcontext *ctx ) static void update_texture_state( GLcontext *ctx ) { - GLuint i; + GLuint unit; - ctx->Texture._ReallyEnabled = 0; + ctx->Texture._EnabledUnits = 0; ctx->Texture._GenFlags = 0; ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN; ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN; @@ -738,8 +795,8 @@ update_texture_state( GLcontext *ctx ) /* Update texture unit state. */ - for (i=0; i < ctx->Const.MaxTextureUnits; i++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; texUnit->_ReallyEnabled = 0; texUnit->_GenFlags = 0; @@ -747,60 +804,60 @@ update_texture_state( GLcontext *ctx ) if (!texUnit->Enabled) continue; - /* Find the texture of highest dimensionality that is enabled - * and complete. We'll use it for texturing. + /* Look for the highest-priority texture target that's enabled and + * complete. That's the one we'll use for texturing. */ - if (texUnit->Enabled & TEXTURE0_CUBE) { + if (texUnit->Enabled & TEXTURE_CUBE_BIT) { struct gl_texture_object *texObj = texUnit->CurrentCubeMap; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { - texUnit->_ReallyEnabled = TEXTURE0_CUBE; + texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT; texUnit->_Current = texObj; } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_3D)) { + if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) { struct gl_texture_object *texObj = texUnit->Current3D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { - texUnit->_ReallyEnabled = TEXTURE0_3D; + texUnit->_ReallyEnabled = TEXTURE_3D_BIT; texUnit->_Current = texObj; } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_RECT)) { + if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) { struct gl_texture_object *texObj = texUnit->CurrentRect; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { - texUnit->_ReallyEnabled = TEXTURE0_RECT; + texUnit->_ReallyEnabled = TEXTURE_RECT_BIT; texUnit->_Current = texObj; } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_2D)) { + if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) { struct gl_texture_object *texObj = texUnit->Current2D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { - texUnit->_ReallyEnabled = TEXTURE0_2D; + texUnit->_ReallyEnabled = TEXTURE_2D_BIT; texUnit->_Current = texObj; } } - if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE0_1D)) { + if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) { struct gl_texture_object *texObj = texUnit->Current1D; if (!texObj->Complete) { _mesa_test_texobj_completeness(ctx, texObj); } if (texObj->Complete) { - texUnit->_ReallyEnabled = TEXTURE0_1D; + texUnit->_ReallyEnabled = TEXTURE_1D_BIT; texUnit->_Current = texObj; } } @@ -810,10 +867,8 @@ update_texture_state( GLcontext *ctx ) continue; } - { - GLuint flag = texUnit->_ReallyEnabled << (i * NUM_TEXTURE_TARGETS); - ctx->Texture._ReallyEnabled |= flag; - } + if (texUnit->_ReallyEnabled) + ctx->Texture._EnabledUnits |= (1 << unit); if (texUnit->TexGenEnabled) { if (texUnit->TexGenEnabled & S_BIT) { @@ -829,12 +884,12 @@ update_texture_state( GLcontext *ctx ) texUnit->_GenFlags |= texUnit->_GenBitR; } - ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(i); + ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit); ctx->Texture._GenFlags |= texUnit->_GenFlags; } - if (ctx->TextureMatrix[i].type != MATRIX_IDENTITY) - ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i); + if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY) + ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit); } if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) { @@ -848,6 +903,7 @@ update_texture_state( GLcontext *ctx ) } + /* * If ctx->NewState is non-zero then this function MUST be called before * rendering any primitive. Basically, function pointers and miscellaneous @@ -874,7 +930,7 @@ void _mesa_update_state( GLcontext *ctx ) _mesa_print_state("_mesa_update_state", new_state); if (new_state & _NEW_MODELVIEW) - _math_matrix_analyse( &ctx->ModelView ); + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); if (new_state & _NEW_PROJECTION) update_projection( ctx ); @@ -883,7 +939,7 @@ void _mesa_update_state( GLcontext *ctx ) update_texture_matrices( ctx ); if (new_state & _NEW_COLOR_MATRIX) - _math_matrix_analyse( &ctx->ColorMatrix ); + _math_matrix_analyse( ctx->ColorMatrixStack.Top ); /* References ColorMatrix.type (derived above). */ @@ -912,17 +968,29 @@ void _mesa_update_state( GLcontext *ctx ) if (new_state & (_NEW_MODELVIEW|_NEW_LIGHT)) { ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT_MODELVIEW; if (ctx->Light.Enabled && - !TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING)) + !TEST_MAT_FLAGS( ctx->ModelviewMatrixStack.Top, MAT_FLAGS_LENGTH_PRESERVING)) ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW; } + +#if 0 + /* XXX this is a bit of a hack. We should be checking elsewhere if + * vertex program mode is enabled. We set _NeedEyeCoords to zero to + * ensure that the combined modelview/projection matrix is computed + * in calculate_model_project_matrix(). + */ + if (ctx->VertexProgram.Enabled) + ctx->_NeedEyeCoords = 0; + /* KW: it's now always computed. + */ +#endif + /* Keep ModelviewProject uptodate always to allow tnl * implementations that go model->clip even when eye is required. */ if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) calculate_model_project_matrix(ctx); - /* ctx->_NeedEyeCoords is now uptodate. * * If the truth value of this variable has changed, update for the @@ -956,7 +1024,6 @@ void _mesa_update_state( GLcontext *ctx ) ASSERT(ctx->Driver.GetString); ASSERT(ctx->Driver.UpdateState); ASSERT(ctx->Driver.Clear); - ASSERT(ctx->Driver.SetDrawBuffer); ASSERT(ctx->Driver.GetBufferSize); if (ctx->Visual.accumRedBits > 0) { ASSERT(ctx->Driver.Accum); @@ -978,9 +1045,6 @@ void _mesa_update_state( GLcontext *ctx ) ASSERT(ctx->Driver.CopyTexSubImage2D); ASSERT(ctx->Driver.CopyTexSubImage3D); if (ctx->Extensions.ARB_texture_compression) { - ASSERT(ctx->Driver.BaseCompressedTexFormat); - ASSERT(ctx->Driver.CompressedTextureSize); - ASSERT(ctx->Driver.GetCompressedTexImage); #if 0 /* HW drivers need these, but not SW rasterizers */ ASSERT(ctx->Driver.CompressedTexImage1D); ASSERT(ctx->Driver.CompressedTexImage2D); diff --git a/xc/extras/Mesa/src/stencil.c b/xc/extras/Mesa/src/stencil.c index f633220d2..b38a620e5 100644 --- a/xc/extras/Mesa/src/stencil.c +++ b/xc/extras/Mesa/src/stencil.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,20 +24,14 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" +#include "imports.h" #include "context.h" #include "depth.h" #include "macros.h" -#include "mem.h" #include "stencil.h" #include "mtypes.h" #include "enable.h" -#endif - - void @@ -63,6 +57,7 @@ void _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); + const GLint face = ctx->Stencil.ActiveFace; GLint maxref; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -84,18 +79,18 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) maxref = (1 << STENCIL_BITS) - 1; ref = (GLstencil) CLAMP( ref, 0, maxref ); - if (ctx->Stencil.Function == func && - ctx->Stencil.ValueMask == (GLstencil) mask && - ctx->Stencil.Ref == ref) + if (ctx->Stencil.Function[face] == func && + ctx->Stencil.ValueMask[face] == (GLstencil) mask && + ctx->Stencil.Ref[face] == ref) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.Function = func; - ctx->Stencil.Ref = ref; - ctx->Stencil.ValueMask = (GLstencil) mask; + ctx->Stencil.Function[face] = func; + ctx->Stencil.Ref[face] = ref; + ctx->Stencil.ValueMask[face] = (GLstencil) mask; if (ctx->Driver.StencilFunc) { - (*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask ); + (*ctx->Driver.StencilFunc)( ctx, func, ref, mask ); } } @@ -105,13 +100,14 @@ void _mesa_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); + const GLint face = ctx->Stencil.ActiveFace; ASSERT_OUTSIDE_BEGIN_END(ctx); - if (ctx->Stencil.WriteMask == (GLstencil) mask) - return; + if (ctx->Stencil.WriteMask[face] == (GLstencil) mask) + return; FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.WriteMask = (GLstencil) mask; + ctx->Stencil.WriteMask[face] = (GLstencil) mask; if (ctx->Driver.StencilMask) { (*ctx->Driver.StencilMask)( ctx, mask ); @@ -124,6 +120,7 @@ void _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); + const GLint face = ctx->Stencil.ActiveFace; ASSERT_OUTSIDE_BEGIN_END(ctx); switch (fail) { @@ -181,17 +178,36 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) return; } - if (ctx->Stencil.ZFailFunc == zfail && - ctx->Stencil.ZPassFunc == zpass && - ctx->Stencil.FailFunc == fail) + if (ctx->Stencil.ZFailFunc[face] == zfail && + ctx->Stencil.ZPassFunc[face] == zpass && + ctx->Stencil.FailFunc[face] == fail) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.ZFailFunc = zfail; - ctx->Stencil.ZPassFunc = zpass; - ctx->Stencil.FailFunc = fail; + ctx->Stencil.ZFailFunc[face] = zfail; + ctx->Stencil.ZPassFunc[face] = zpass; + ctx->Stencil.FailFunc[face] = fail; if (ctx->Driver.StencilOp) { (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass); } } + + +/* GL_EXT_stencil_two_side */ +void +_mesa_ActiveStencilFaceEXT(GLenum face) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (face == GL_FRONT || face == GL_BACK) { + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ActiveFace = (face == GL_FRONT) ? 0 : 1; + } + + if (ctx->Driver.ActiveStencilFace) { + (*ctx->Driver.ActiveStencilFace)( ctx, (GLuint) ctx->Stencil.ActiveFace ); + } +} + diff --git a/xc/extras/Mesa/src/stencil.h b/xc/extras/Mesa/src/stencil.h index 7c96e8b9e..bb20884b8 100644 --- a/xc/extras/Mesa/src/stencil.h +++ b/xc/extras/Mesa/src/stencil.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -47,5 +47,8 @@ extern void _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ); +extern void +_mesa_ActiveStencilFaceEXT(GLenum face); + #endif diff --git a/xc/extras/Mesa/src/swrast/s_aaline.c b/xc/extras/Mesa/src/swrast/s_aaline.c index 08bcaac63..cef87b2c1 100644 --- a/xc/extras/Mesa/src/swrast/s_aaline.c +++ b/xc/extras/Mesa/src/swrast/s_aaline.c @@ -1,10 +1,9 @@ -/* $Id: s_aaline.c,v 1.1.1.1 2002/10/22 13:06:56 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -27,8 +26,8 @@ #include "glheader.h" #include "swrast/s_aaline.h" -#include "swrast/s_pb.h" #include "swrast/s_context.h" +#include "swrast/s_span.h" #include "swrast/swrast.h" #include "mtypes.h" #include "mmath.h" @@ -75,6 +74,8 @@ struct LineInfo GLfloat vPlane[MAX_TEXTURE_UNITS][4]; GLfloat lambda[MAX_TEXTURE_UNITS]; GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; + + struct sw_span span; }; @@ -326,8 +327,9 @@ compute_coveragef(const struct LineInfo *info, -typedef void (*plot_func)(GLcontext *ctx, const struct LineInfo *line, - struct pixel_buffer *pb, int ix, int iy); +typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line, + int ix, int iy); + /* @@ -337,7 +339,6 @@ static void segment(GLcontext *ctx, struct LineInfo *line, plot_func plot, - struct pixel_buffer *pb, GLfloat t0, GLfloat t1) { const GLfloat absDx = (line->dx < 0.0F) ? -line->dx : line->dx; @@ -407,7 +408,7 @@ segment(GLcontext *ctx, GLint iy; /* scan across the line, bottom-to-top */ for (iy = iyBot; iy < iyTop; iy++) { - (*plot)(ctx, line, pb, ix, iy); + (*plot)(ctx, line, ix, iy); } yBot += dydx; yTop += dydx; @@ -453,7 +454,7 @@ segment(GLcontext *ctx, GLint ix; /* scan across the line, left-to-right */ for (ix = ixLeft; ix < ixRight; ix++) { - (*plot)(ctx, line, pb, ix, iy); + (*plot)(ctx, line, ix, iy); } xLeft += dxdy; xRight += dxdy; @@ -486,6 +487,7 @@ segment(GLcontext *ctx, #define NAME(x) aa_multitex_rgba_##x #define DO_Z +#define DO_FOG #define DO_RGBA #define DO_MULTITEX #include "s_aalinetemp.h" @@ -493,6 +495,7 @@ segment(GLcontext *ctx, #define NAME(x) aa_multitex_spec_##x #define DO_Z +#define DO_FOG #define DO_RGBA #define DO_MULTITEX #define DO_SPEC @@ -509,8 +512,8 @@ _swrast_choose_aa_line_function(GLcontext *ctx) if (ctx->Visual.rgbMode) { /* RGBA */ - if (ctx->Texture._ReallyEnabled) { - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { + if (ctx->Texture._EnabledUnits != 0) { + if (ctx->Texture._EnabledUnits > 1) { /* Multitextured! */ if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR || ctx->Fog.ColorSumEnabled) diff --git a/xc/extras/Mesa/src/swrast/s_aalinetemp.h b/xc/extras/Mesa/src/swrast/s_aalinetemp.h index bd675f365..4dc2691a1 100644 --- a/xc/extras/Mesa/src/swrast/s_aalinetemp.h +++ b/xc/extras/Mesa/src/swrast/s_aalinetemp.h @@ -1,10 +1,9 @@ -/* $Id: s_aalinetemp.h,v 1.1.1.1 2002/10/22 13:06:52 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -34,107 +33,81 @@ * Function to render each fragment in the AA line. */ static void -NAME(plot)(GLcontext *ctx, const struct LineInfo *line, - struct pixel_buffer *pb, int ix, int iy) +NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) { const GLfloat fx = (GLfloat) ix; const GLfloat fy = (GLfloat) iy; const GLfloat coverage = compute_coveragef(line, ix, iy); - GLdepth z; - GLfloat fog; -#ifdef DO_RGBA - GLchan red, green, blue, alpha; -#else - GLint index; -#endif - GLchan specRed, specGreen, specBlue; - GLfloat tex[MAX_TEXTURE_UNITS][4], lambda[MAX_TEXTURE_UNITS]; + const GLuint i = line->span.end; if (coverage == 0.0) return; + line->span.end++; + line->span.array->coverage[i] = coverage; + line->span.array->x[i] = ix; + line->span.array->y[i] = iy; + /* * Compute Z, color, texture coords, fog for the fragment by * solving the plane equations at (ix,iy). */ #ifdef DO_Z - z = (GLdepth) solve_plane(fx, fy, line->zPlane); -#else - z = 0.0; + line->span.array->z[i] = (GLdepth) solve_plane(fx, fy, line->zPlane); #endif #ifdef DO_FOG - fog = solve_plane(fx, fy, line->fPlane); -#else - fog = 0.0; + line->span.array->fog[i] = solve_plane(fx, fy, line->fPlane); #endif #ifdef DO_RGBA - red = solve_plane_chan(fx, fy, line->rPlane); - green = solve_plane_chan(fx, fy, line->gPlane); - blue = solve_plane_chan(fx, fy, line->bPlane); - alpha = solve_plane_chan(fx, fy, line->aPlane); + line->span.array->rgba[i][RCOMP] = solve_plane_chan(fx, fy, line->rPlane); + line->span.array->rgba[i][GCOMP] = solve_plane_chan(fx, fy, line->gPlane); + line->span.array->rgba[i][BCOMP] = solve_plane_chan(fx, fy, line->bPlane); + line->span.array->rgba[i][ACOMP] = solve_plane_chan(fx, fy, line->aPlane); #endif #ifdef DO_INDEX - index = (GLint) solve_plane(fx, fy, line->iPlane); + line->span.array->index[i] = (GLint) solve_plane(fx, fy, line->iPlane); #endif #ifdef DO_SPEC - specRed = solve_plane_chan(fx, fy, line->srPlane); - specGreen = solve_plane_chan(fx, fy, line->sgPlane); - specBlue = solve_plane_chan(fx, fy, line->sbPlane); -#else - (void) specRed; - (void) specGreen; - (void) specBlue; + line->span.array->spec[i][RCOMP] = solve_plane_chan(fx, fy, line->srPlane); + line->span.array->spec[i][GCOMP] = solve_plane_chan(fx, fy, line->sgPlane); + line->span.array->spec[i][BCOMP] = solve_plane_chan(fx, fy, line->sbPlane); #endif #ifdef DO_TEX { - GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[0]); - tex[0][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ; - tex[0][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ; - tex[0][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ; - lambda[0] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ, - line->texWidth[0], line->texHeight[0]); + const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[0]); + line->span.array->texcoords[0][i][0] = solve_plane(fx, fy, line->sPlane[0]) * invQ; + line->span.array->texcoords[0][i][1] = solve_plane(fx, fy, line->tPlane[0]) * invQ; + line->span.array->texcoords[0][i][2] = solve_plane(fx, fy, line->uPlane[0]) * invQ; + line->span.array->lambda[0][i] = compute_lambda(line->sPlane[0], line->tPlane[0], invQ, + line->texWidth[0], line->texHeight[0]); } #elif defined(DO_MULTITEX) { GLuint unit; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { - GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[unit]); - tex[unit][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ; - tex[unit][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ; - tex[unit][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ; - lambda[unit] = compute_lambda(line->sPlane[unit], - line->tPlane[unit], invQ, - line->texWidth[unit], line->texHeight[unit]); + const GLfloat invQ = solve_plane_recip(fx, fy, line->vPlane[unit]); + line->span.array->texcoords[unit][i][0] = solve_plane(fx, fy, line->sPlane[unit]) * invQ; + line->span.array->texcoords[unit][i][1] = solve_plane(fx, fy, line->tPlane[unit]) * invQ; + line->span.array->texcoords[unit][i][2] = solve_plane(fx, fy, line->uPlane[unit]) * invQ; + line->span.array->lambda[unit][i] = compute_lambda(line->sPlane[unit], + line->tPlane[unit], invQ, + line->texWidth[unit], line->texHeight[unit]); } } } -#else - (void) tex[0][0]; - (void) lambda[0]; #endif - - PB_COVERAGE(pb, coverage); - -#if defined(DO_MULTITEX) -#if defined(DO_SPEC) - PB_WRITE_MULTITEX_SPEC_PIXEL(pb, ix, iy, z, fog, red, green, blue, alpha, - specRed, specGreen, specBlue, tex); -#else - PB_WRITE_MULTITEX_PIXEL(pb, ix, iy, z, fog, red, green, blue, alpha, tex); -#endif -#elif defined(DO_TEX) - PB_WRITE_TEX_PIXEL(pb, ix, iy, z, fog, red, green, blue, alpha, - tex[0][0], tex[0][1], tex[0][2]); + if (line->span.end == MAX_WIDTH) { +#if defined(DO_TEX) || defined(DO_MULTITEX) + _mesa_write_texture_span(ctx, &(line->span)); #elif defined(DO_RGBA) - PB_WRITE_RGBA_PIXEL(pb, ix, iy, z, fog, red, green, blue, alpha); -#elif defined(DO_INDEX) - PB_WRITE_CI_PIXEL(pb, ix, iy, z, fog, index); + _mesa_write_rgba_span(ctx, &(line->span)); +#else + _mesa_write_index_span(ctx, &(line->span)); #endif - - pb->haveCoverage = GL_TRUE; - PB_CHECK_FLUSH(ctx, pb); + line->span.end = 0; /* reset counter */ + } } @@ -146,7 +119,6 @@ static void NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - struct pixel_buffer *pb = SWRAST_CONTEXT(ctx)->PB; GLfloat tStart, tEnd; /* segment start, end along line length */ GLboolean inSegment; GLint iLen, i; @@ -165,18 +137,23 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) return; + INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE); + line.xAdj = line.dx / line.len * line.halfWidth; line.yAdj = line.dy / line.len * line.halfWidth; #ifdef DO_Z + line.span.arrayMask |= SPAN_Z; compute_plane(line.x0, line.y0, line.x1, line.y1, v0->win[2], v1->win[2], line.zPlane); #endif #ifdef DO_FOG + line.span.arrayMask |= SPAN_FOG; compute_plane(line.x0, line.y0, line.x1, line.y1, v0->fog, v1->fog, line.fPlane); #endif #ifdef DO_RGBA + line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->color[RCOMP], v1->color[RCOMP], line.rPlane); @@ -195,6 +172,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) } #endif #ifdef DO_SPEC + line.span.arrayMask |= SPAN_SPEC; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, v0->specular[RCOMP], v1->specular[RCOMP], line.srPlane); @@ -210,6 +188,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) } #endif #ifdef DO_INDEX + line.span.arrayMask |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { compute_plane(line.x0, line.y0, line.x1, line.y1, (GLfloat) v0->index, (GLfloat) v1->index, line.iPlane); @@ -232,6 +211,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) const GLfloat r1 = v1->texcoord[0][2] * invW0; const GLfloat q0 = v0->texcoord[0][3] * invW0; const GLfloat q1 = v1->texcoord[0][3] * invW0; + line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); compute_plane(line.x0, line.y0, line.x1, line.y1, s0, s1, line.sPlane[0]); compute_plane(line.x0, line.y0, line.x1, line.y1, t0, t1, line.tPlane[0]); compute_plane(line.x0, line.y0, line.x1, line.y1, r0, r1, line.uPlane[0]); @@ -242,6 +222,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) #elif defined(DO_MULTITEX) { GLuint u; + line.span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; @@ -291,7 +272,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) /* stipple bit is off */ if (inSegment && (tEnd > tStart)) { /* draw the segment */ - segment(ctx, &line, NAME(plot), pb, tStart, tEnd); + segment(ctx, &line, NAME(plot), tStart, tEnd); inSegment = GL_FALSE; } else { @@ -303,13 +284,21 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) if (inSegment) { /* draw the final segment of the line */ - segment(ctx, &line, NAME(plot), pb, tStart, 1.0F); + segment(ctx, &line, NAME(plot), tStart, 1.0F); } } else { /* non-stippled */ - segment(ctx, &line, NAME(plot), pb, 0.0, 1.0); + segment(ctx, &line, NAME(plot), 0.0, 1.0); } + +#if defined(DO_TEX) || defined(DO_MULTITEX) + _mesa_write_texture_span(ctx, &(line.span)); +#elif defined(DO_RGBA) + _mesa_write_rgba_span(ctx, &(line.span)); +#else + _mesa_write_index_span(ctx, &(line.span)); +#endif } diff --git a/xc/extras/Mesa/src/swrast/s_aatriangle.c b/xc/extras/Mesa/src/swrast/s_aatriangle.c index e58e93b7e..6a8c38ea3 100644 --- a/xc/extras/Mesa/src/swrast/s_aatriangle.c +++ b/xc/extras/Mesa/src/swrast/s_aatriangle.c @@ -1,10 +1,9 @@ -/* $Id: s_aatriangle.c,v 1.1.1.1 2002/10/22 13:06:45 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.1 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -30,7 +29,9 @@ */ -#include "mem.h" +#include "glheader.h" +#include "macros.h" +#include "imports.h" #include "mmath.h" #include "s_aatriangle.h" #include "s_context.h" @@ -40,6 +41,7 @@ /* * Compute coefficients of a plane using the X,Y coords of the v0, v1, v2 * vertices and the given Z values. + * A point (x,y,z) lies on plane iff a*x+b*y+c*z+d = 0. */ static INLINE void compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], @@ -53,9 +55,15 @@ compute_plane(const GLfloat v0[], const GLfloat v1[], const GLfloat v2[], const GLfloat qy = v2[1] - v0[1]; const GLfloat qz = z2 - z0; + /* Crossproduct "(a,b,c):= dv1 x dv2" is orthogonal to plane. */ const GLfloat a = py * qz - pz * qy; const GLfloat b = pz * qx - px * qz; const GLfloat c = px * qy - py * qx; + /* Point on the plane = "r*(a,b,c) + w", with fixed "r" depending + on the distance of plane from origin and arbitrary "w" parallel + to the plane. */ + /* The scalar product "(r*(a,b,c)+w)*(a,b,c)" is "r*(a^2+b^2+c^2)", + which is equal to "-d" below. */ const GLfloat d = -(a * v0[0] + b * v0[1] + c * z0); plane[0] = a; @@ -93,8 +101,8 @@ do { \ static INLINE GLfloat solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4]) { - const GLfloat z = (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; - return z; + ASSERT(plane[2] != 0.0F); + return (plane[3] + plane[0] * x + plane[1] * y) / -plane[2]; } @@ -116,7 +124,6 @@ solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4]) } - /* * Solve plane and return clamped GLchan value. */ @@ -193,7 +200,7 @@ compute_coveragef(const GLfloat v0[3], const GLfloat v1[3], #ifdef DEBUG { const GLfloat area = dx0 * dy1 - dx1 * dy0; - assert(area >= 0.0); + ASSERT(area >= 0.0); } #endif @@ -276,7 +283,7 @@ compute_coveragei(const GLfloat v0[3], const GLfloat v1[3], #ifdef DEBUG { const GLfloat area = dx0 * dy1 - dx1 * dy0; - assert(area >= 0.0); + ASSERT(area >= 0.0); } #endif @@ -344,23 +351,36 @@ index_aa_tri(GLcontext *ctx, /* * Compute mipmap level of detail. + * XXX we should really include the R coordinate in this computation + * in order to do 3-D texture mipmapping. */ static INLINE GLfloat compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], - GLfloat invQ, GLfloat width, GLfloat height) + const GLfloat qPlane[4], GLfloat cx, GLfloat cy, + GLfloat invQ, GLfloat texWidth, GLfloat texHeight) { - GLfloat dudx = sPlane[0] / sPlane[2] * invQ * width; - GLfloat dudy = sPlane[1] / sPlane[2] * invQ * width; - GLfloat dvdx = tPlane[0] / tPlane[2] * invQ * height; - GLfloat dvdy = tPlane[1] / tPlane[2] * invQ * height; - GLfloat r1 = dudx * dudx + dudy * dudy; - GLfloat r2 = dvdx * dvdx + dvdy * dvdy; - GLfloat rho2 = r1 + r2; - /* return log base 2 of rho */ - if (rho2 == 0.0F) - return 0.0; - else - return (GLfloat) (log(rho2) * 1.442695 * 0.5); /* 1.442695 = 1/log(2) */ + const GLfloat s = solve_plane(cx, cy, sPlane); + const GLfloat t = solve_plane(cx, cy, tPlane); + const GLfloat invQ_x1 = solve_plane_recip(cx+1.0F, cy, qPlane); + const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0F, qPlane); + const GLfloat s_x1 = s - sPlane[0] / sPlane[2]; + const GLfloat s_y1 = s - sPlane[1] / sPlane[2]; + const GLfloat t_x1 = t - tPlane[0] / tPlane[2]; + const GLfloat t_y1 = t - tPlane[1] / tPlane[2]; + GLfloat dsdx = s_x1 * invQ_x1 - s * invQ; + GLfloat dsdy = s_y1 * invQ_y1 - s * invQ; + GLfloat dtdx = t_x1 * invQ_x1 - t * invQ; + GLfloat dtdy = t_y1 * invQ_y1 - t * invQ; + GLfloat maxU, maxV, rho, lambda; + dsdx = FABSF(dsdx); + dsdy = FABSF(dsdy); + dtdx = FABSF(dtdx); + dtdy = FABSF(dtdy); + maxU = MAX2(dsdx, dsdy) * texWidth; + maxV = MAX2(dtdx, dtdy) * texHeight; + rho = MAX2(maxU, maxV); + lambda = LOG2(rho); + return lambda; } @@ -430,9 +450,9 @@ _mesa_set_aa_triangle_function(GLcontext *ctx) { ASSERT(ctx->Polygon.SmoothFlag); - if (ctx->Texture._ReallyEnabled) { + if (ctx->Texture._EnabledUnits != 0) { if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { + if (ctx->Texture._EnabledUnits > 1) { SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri; } else { @@ -440,7 +460,7 @@ _mesa_set_aa_triangle_function(GLcontext *ctx) } } else { - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { + if (ctx->Texture._EnabledUnits > 1) { SWRAST_CONTEXT(ctx)->Triangle = multitex_aa_tri; } else { diff --git a/xc/extras/Mesa/src/swrast/s_aatritemp.h b/xc/extras/Mesa/src/swrast/s_aatritemp.h index 0b2e073de..abe99ecf4 100644 --- a/xc/extras/Mesa/src/swrast/s_aatritemp.h +++ b/xc/extras/Mesa/src/swrast/s_aatritemp.h @@ -1,10 +1,9 @@ -/* $Id: s_aatritemp.h,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -52,64 +51,40 @@ GLfloat yMin, yMax; GLboolean ltor; GLfloat majDx, majDy; /* major (i.e. long) edge dx and dy */ - + + struct sw_span span; + #ifdef DO_Z GLfloat zPlane[4]; - GLdepth z[MAX_WIDTH]; #endif #ifdef DO_FOG GLfloat fogPlane[4]; - GLfloat fog[MAX_WIDTH]; #else GLfloat *fog = NULL; #endif #ifdef DO_RGBA GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; - DEFMARRAY(GLchan, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ #endif #ifdef DO_INDEX GLfloat iPlane[4]; - GLuint index[MAX_WIDTH]; - GLint icoverageSpan[MAX_WIDTH]; -#else - GLfloat coverageSpan[MAX_WIDTH]; #endif #ifdef DO_SPEC GLfloat srPlane[4], sgPlane[4], sbPlane[4]; - DEFMARRAY(GLchan, spec, MAX_WIDTH, 4); #endif #ifdef DO_TEX GLfloat sPlane[4], tPlane[4], uPlane[4], vPlane[4]; GLfloat texWidth, texHeight; - DEFARRAY(GLfloat, s, MAX_WIDTH); /* mac 32k limitation */ - DEFARRAY(GLfloat, t, MAX_WIDTH); - DEFARRAY(GLfloat, u, MAX_WIDTH); - DEFARRAY(GLfloat, lambda, MAX_WIDTH); #elif defined(DO_MULTITEX) - GLfloat sPlane[MAX_TEXTURE_UNITS][4]; - GLfloat tPlane[MAX_TEXTURE_UNITS][4]; - GLfloat uPlane[MAX_TEXTURE_UNITS][4]; - GLfloat vPlane[MAX_TEXTURE_UNITS][4]; + GLfloat sPlane[MAX_TEXTURE_UNITS][4]; /* texture S */ + GLfloat tPlane[MAX_TEXTURE_UNITS][4]; /* texture T */ + GLfloat uPlane[MAX_TEXTURE_UNITS][4]; /* texture R */ + GLfloat vPlane[MAX_TEXTURE_UNITS][4]; /* texture Q */ GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; - DEFMARRAY(GLfloat, s, MAX_TEXTURE_UNITS, MAX_WIDTH); /* mac 32k limit */ - DEFMARRAY(GLfloat, t, MAX_TEXTURE_UNITS, MAX_WIDTH); - DEFMARRAY(GLfloat, u, MAX_TEXTURE_UNITS, MAX_WIDTH); - DEFMARRAY(GLfloat, lambda, MAX_TEXTURE_UNITS, MAX_WIDTH); #endif GLfloat bf = SWRAST_CONTEXT(ctx)->_backface_sign; - -#ifdef DO_RGBA - CHECKARRAY(rgba, return); /* mac 32k limitation */ -#endif -#ifdef DO_SPEC - CHECKARRAY(spec, return); -#endif -#if defined(DO_TEX) || defined(DO_MULTITEX) - CHECKARRAY(s, return); - CHECKARRAY(t, return); - CHECKARRAY(u, return); - CHECKARRAY(lambda, return); -#endif + + + INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE); /* determine bottom to top order of vertices */ { @@ -164,9 +139,11 @@ */ #ifdef DO_Z compute_plane(p0, p1, p2, p0[2], p1[2], p2[2], zPlane); + span.arrayMask |= SPAN_Z; #endif #ifdef DO_FOG compute_plane(p0, p1, p2, v0->fog, v1->fog, v2->fog, fogPlane); + span.arrayMask |= SPAN_FOG; #endif #ifdef DO_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { @@ -181,6 +158,7 @@ constant_plane(v2->color[BCOMP], bPlane); constant_plane(v2->color[ACOMP], aPlane); } + span.arrayMask |= SPAN_RGBA; #endif #ifdef DO_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { @@ -190,6 +168,7 @@ else { constant_plane((GLfloat) v2->index, iPlane); } + span.arrayMask |= SPAN_INDEX; #endif #ifdef DO_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { @@ -202,6 +181,7 @@ constant_plane(v2->specular[GCOMP], sgPlane); constant_plane(v2->specular[BCOMP], sbPlane); } + span.arrayMask |= SPAN_SPEC; #endif #ifdef DO_TEX { @@ -229,6 +209,7 @@ texWidth = (GLfloat) texImage->Width; texHeight = (GLfloat) texImage->Height; } + span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); #elif defined(DO_MULTITEX) { GLuint u; @@ -260,6 +241,7 @@ } } } + span.arrayMask |= (SPAN_TEXTURE | SPAN_LAMBDA); #endif /* Begin bottom-to-top scan over the triangle. @@ -284,8 +266,9 @@ GLint iy; for (iy = iyMin; iy < iyMax; iy++, x += dxdy) { GLint ix, startX = (GLint) (x - xAdj); - GLuint count, n; + GLuint count; GLfloat coverage = 0.0F; + /* skip over fragments with zero coverage */ while (startX < MAX_WIDTH) { coverage = compute_coveragef(pMin, pMid, pMax, startX, iy); @@ -300,39 +283,41 @@ while (coverage > 0.0F) { /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; + struct span_arrays *array = span.array; #ifdef DO_INDEX - icoverageSpan[count] = compute_coveragei(pMin, pMid, pMax, ix, iy); + array->coverage[count] = (GLfloat) compute_coveragei(pMin, pMid, pMax, ix, iy); #else - coverageSpan[count] = coverage; + array->coverage[count] = coverage; #endif #ifdef DO_Z - z[count] = (GLdepth) solve_plane(cx, cy, zPlane); + array->z[count] = (GLdepth) solve_plane(cx, cy, zPlane); #endif #ifdef DO_FOG - fog[count] = solve_plane(cx, cy, fogPlane); + array->fog[count] = solve_plane(cx, cy, fogPlane); #endif #ifdef DO_RGBA - rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane); - rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane); - rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane); - rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane); + array->rgba[count][RCOMP] = solve_plane_chan(cx, cy, rPlane); + array->rgba[count][GCOMP] = solve_plane_chan(cx, cy, gPlane); + array->rgba[count][BCOMP] = solve_plane_chan(cx, cy, bPlane); + array->rgba[count][ACOMP] = solve_plane_chan(cx, cy, aPlane); #endif #ifdef DO_INDEX - index[count] = (GLint) solve_plane(cx, cy, iPlane); + array->index[count] = (GLint) solve_plane(cx, cy, iPlane); #endif #ifdef DO_SPEC - spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane); - spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane); - spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane); + array->spec[count][RCOMP] = solve_plane_chan(cx, cy, srPlane); + array->spec[count][GCOMP] = solve_plane_chan(cx, cy, sgPlane); + array->spec[count][BCOMP] = solve_plane_chan(cx, cy, sbPlane); #endif #ifdef DO_TEX { const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); - s[count] = solve_plane(cx, cy, sPlane) * invQ; - t[count] = solve_plane(cx, cy, tPlane) * invQ; - u[count] = solve_plane(cx, cy, uPlane) * invQ; - lambda[count] = compute_lambda(sPlane, tPlane, invQ, - texWidth, texHeight); + array->texcoords[0][count][0] = solve_plane(cx, cy, sPlane) * invQ; + array->texcoords[0][count][1] = solve_plane(cx, cy, tPlane) * invQ; + array->texcoords[0][count][2] = solve_plane(cx, cy, uPlane) * invQ; + array->lambda[0][count] = compute_lambda(sPlane, tPlane, vPlane, + cx, cy, invQ, + texWidth, texHeight); } #elif defined(DO_MULTITEX) { @@ -340,11 +325,12 @@ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); - s[unit][count] = solve_plane(cx, cy, sPlane[unit]) * invQ; - t[unit][count] = solve_plane(cx, cy, tPlane[unit]) * invQ; - u[unit][count] = solve_plane(cx, cy, uPlane[unit]) * invQ; - lambda[unit][count] = compute_lambda(sPlane[unit], - tPlane[unit], invQ, texWidth[unit], texHeight[unit]); + array->texcoords[unit][count][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; + array->texcoords[unit][count][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; + array->texcoords[unit][count][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; + array->lambda[unit][count] = compute_lambda(sPlane[unit], + tPlane[unit], vPlane[unit], cx, cy, invQ, + texWidth[unit], texHeight[unit]); } } } @@ -353,46 +339,20 @@ count++; coverage = compute_coveragef(pMin, pMid, pMax, ix, iy); } - + if (ix <= startX) continue; - - n = (GLuint) ix - (GLuint) startX; - -#ifdef DO_MULTITEX -# ifdef DO_SPEC - _mesa_write_multitexture_span(ctx, n, startX, iy, z, fog, - (const GLfloat (*)[MAX_WIDTH]) s, - (const GLfloat (*)[MAX_WIDTH]) t, - (const GLfloat (*)[MAX_WIDTH]) u, - (GLfloat (*)[MAX_WIDTH]) lambda, - rgba, (const GLchan (*)[4]) spec, - coverageSpan, GL_POLYGON); -# else - _mesa_write_multitexture_span(ctx, n, startX, iy, z, fog, - (const GLfloat (*)[MAX_WIDTH]) s, - (const GLfloat (*)[MAX_WIDTH]) t, - (const GLfloat (*)[MAX_WIDTH]) u, - lambda, rgba, NULL, coverageSpan, - GL_POLYGON); -# endif -#elif defined(DO_TEX) -# ifdef DO_SPEC - _mesa_write_texture_span(ctx, n, startX, iy, z, fog, - s, t, u, lambda, rgba, - (const GLchan (*)[4]) spec, - coverageSpan, GL_POLYGON); -# else - _mesa_write_texture_span(ctx, n, startX, iy, z, fog, - s, t, u, lambda, - rgba, NULL, coverageSpan, GL_POLYGON); -# endif + + span.x = startX; + span.y = iy; + span.end = (GLuint) ix - (GLuint) startX; + ASSERT(span.interpMask == 0); +#if defined(DO_MULTITEX) || defined(DO_TEX) + _mesa_write_texture_span(ctx, &span); #elif defined(DO_RGBA) - _mesa_write_rgba_span(ctx, n, startX, iy, z, fog, rgba, - coverageSpan, GL_POLYGON); + _mesa_write_rgba_span(ctx, &span); #elif defined(DO_INDEX) - _mesa_write_index_span(ctx, n, startX, iy, z, fog, index, - icoverageSpan, GL_POLYGON); + _mesa_write_index_span(ctx, &span); #endif } } @@ -409,7 +369,7 @@ GLint ix, left, startX = (GLint) (x + xAdj); GLuint count, n; GLfloat coverage = 0.0F; - + /* make sure we're not past the window edge */ if (startX >= ctx->DrawBuffer->_Xmax) { startX = ctx->DrawBuffer->_Xmax - 1; @@ -422,46 +382,47 @@ break; startX--; } - + /* enter interior of triangle */ ix = startX; count = 0; while (coverage > 0.0F) { /* (cx,cy) = center of fragment */ const GLfloat cx = ix + 0.5F, cy = iy + 0.5F; + struct span_arrays *array = span.array; #ifdef DO_INDEX - icoverageSpan[ix] = compute_coveragei(pMin, pMid, pMax, ix, iy); + array->coverage[ix] = (GLfloat) compute_coveragei(pMin, pMax, pMid, ix, iy); #else - coverageSpan[ix] = coverage; + array->coverage[ix] = coverage; #endif #ifdef DO_Z - z[ix] = (GLdepth) solve_plane(cx, cy, zPlane); + array->z[ix] = (GLdepth) solve_plane(cx, cy, zPlane); #endif #ifdef DO_FOG - fog[ix] = solve_plane(cx, cy, fogPlane); + array->fog[ix] = solve_plane(cx, cy, fogPlane); #endif #ifdef DO_RGBA - rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane); - rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane); - rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane); - rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane); + array->rgba[ix][RCOMP] = solve_plane_chan(cx, cy, rPlane); + array->rgba[ix][GCOMP] = solve_plane_chan(cx, cy, gPlane); + array->rgba[ix][BCOMP] = solve_plane_chan(cx, cy, bPlane); + array->rgba[ix][ACOMP] = solve_plane_chan(cx, cy, aPlane); #endif #ifdef DO_INDEX - index[ix] = (GLint) solve_plane(cx, cy, iPlane); + array->index[ix] = (GLint) solve_plane(cx, cy, iPlane); #endif #ifdef DO_SPEC - spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane); - spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane); - spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane); + array->spec[ix][RCOMP] = solve_plane_chan(cx, cy, srPlane); + array->spec[ix][GCOMP] = solve_plane_chan(cx, cy, sgPlane); + array->spec[ix][BCOMP] = solve_plane_chan(cx, cy, sbPlane); #endif #ifdef DO_TEX { const GLfloat invQ = solve_plane_recip(cx, cy, vPlane); - s[ix] = solve_plane(cx, cy, sPlane) * invQ; - t[ix] = solve_plane(cx, cy, tPlane) * invQ; - u[ix] = solve_plane(cx, cy, uPlane) * invQ; - lambda[ix] = compute_lambda(sPlane, tPlane, invQ, - texWidth, texHeight); + array->texcoords[0][ix][0] = solve_plane(cx, cy, sPlane) * invQ; + array->texcoords[0][ix][1] = solve_plane(cx, cy, tPlane) * invQ; + array->texcoords[0][ix][2] = solve_plane(cx, cy, uPlane) * invQ; + array->lambda[0][ix] = compute_lambda(sPlane, tPlane, vPlane, + cx, cy, invQ, texWidth, texHeight); } #elif defined(DO_MULTITEX) { @@ -469,11 +430,15 @@ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLfloat invQ = solve_plane_recip(cx, cy, vPlane[unit]); - s[unit][ix] = solve_plane(cx, cy, sPlane[unit]) * invQ; - t[unit][ix] = solve_plane(cx, cy, tPlane[unit]) * invQ; - u[unit][ix] = solve_plane(cx, cy, uPlane[unit]) * invQ; - lambda[unit][ix] = compute_lambda(sPlane[unit], - tPlane[unit], invQ, texWidth[unit], texHeight[unit]); + array->texcoords[unit][ix][0] = solve_plane(cx, cy, sPlane[unit]) * invQ; + array->texcoords[unit][ix][1] = solve_plane(cx, cy, tPlane[unit]) * invQ; + array->texcoords[unit][ix][2] = solve_plane(cx, cy, uPlane[unit]) * invQ; + array->lambda[unit][ix] = compute_lambda(sPlane[unit], + tPlane[unit], + vPlane[unit], + cx, cy, invQ, + texWidth[unit], + texHeight[unit]); } } } @@ -482,83 +447,76 @@ count++; coverage = compute_coveragef(pMin, pMax, pMid, ix, iy); } - + if (startX <= ix) continue; n = (GLuint) startX - (GLuint) ix; left = ix + 1; + + /* shift all values to the left */ + /* XXX this is temporary */ + { + struct span_arrays *array = span.array; + GLint j; + for (j = 0; j < (GLint) n; j++) { +#ifdef DO_RGBA + COPY_4V(array->rgba[j], array->rgba[j + left]); +#endif +#ifdef DO_SPEC + COPY_4V(array->spec[j], array->spec[j + left]); +#endif +#ifdef DO_INDEX + array->index[j] = array->index[j + left]; +#endif +#ifdef DO_Z + array->z[j] = array->z[j + left]; +#endif +#ifdef DO_FOG + array->fog[j] = array->fog[j + left]; +#endif +#ifdef DO_TEX + COPY_4V(array->texcoords[0][j], array->texcoords[0][j + left]); +#endif +#if defined(DO_MULTITEX) || defined(DO_TEX) + array->lambda[0][j] = array->lambda[0][j + left]; +#endif + array->coverage[j] = array->coverage[j + left]; + } + } #ifdef DO_MULTITEX + /* shift texcoords */ { + struct span_arrays *array = span.array; GLuint unit; for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { if (ctx->Texture.Unit[unit]._ReallyEnabled) { GLint j; for (j = 0; j < (GLint) n; j++) { - s[unit][j] = s[unit][j + left]; - t[unit][j] = t[unit][j + left]; - u[unit][j] = u[unit][j + left]; - lambda[unit][j] = lambda[unit][j + left]; + array->texcoords[unit][j][0] = array->texcoords[unit][j + left][0]; + array->texcoords[unit][j][1] = array->texcoords[unit][j + left][1]; + array->texcoords[unit][j][2] = array->texcoords[unit][j + left][2]; + array->lambda[unit][j] = array->lambda[unit][j + left]; } } } } -# ifdef DO_SPEC - _mesa_write_multitexture_span(ctx, n, left, iy, z + left, fog + left, - (const GLfloat (*)[MAX_WIDTH]) s, - (const GLfloat (*)[MAX_WIDTH]) t, - (const GLfloat (*)[MAX_WIDTH]) u, - lambda, rgba + left, - (const GLchan (*)[4]) (spec + left), - coverageSpan + left, - GL_POLYGON); -# else - _mesa_write_multitexture_span(ctx, n, left, iy, z + left, fog + left, - (const GLfloat (*)[MAX_WIDTH]) s, - (const GLfloat (*)[MAX_WIDTH]) t, - (const GLfloat (*)[MAX_WIDTH]) u, - lambda, - rgba + left, NULL, coverageSpan + left, - GL_POLYGON); -# endif -#elif defined(DO_TEX) -# ifdef DO_SPEC - _mesa_write_texture_span(ctx, n, left, iy, z + left, fog + left, - s + left, t + left, u + left, - lambda + left, rgba + left, - (const GLchan (*)[4]) (spec + left), - coverageSpan + left, - GL_POLYGON); -# else - _mesa_write_texture_span(ctx, n, left, iy, z + left, fog + left, - s + left, t + left, - u + left, lambda + left, - rgba + left, NULL, - coverageSpan + left, GL_POLYGON); -# endif +#endif + + span.x = left; + span.y = iy; + span.end = n; + ASSERT(span.interpMask == 0); +#if defined(DO_MULTITEX) || defined(DO_TEX) + _mesa_write_texture_span(ctx, &span); #elif defined(DO_RGBA) - _mesa_write_rgba_span(ctx, n, left, iy, z + left, fog + left, - rgba + left, coverageSpan + left, GL_POLYGON); + _mesa_write_rgba_span(ctx, &span); #elif defined(DO_INDEX) - _mesa_write_index_span(ctx, n, left, iy, z + left, fog + left, - index + left, icoverageSpan + left, GL_POLYGON); + _mesa_write_index_span(ctx, &span); #endif } } - -#ifdef DO_RGBA - UNDEFARRAY(rgba); /* mac 32k limitation */ -#endif -#ifdef DO_SPEC - UNDEFARRAY(spec); -#endif -#if defined(DO_TEX) || defined(DO_MULTITEX) - UNDEFARRAY(s); - UNDEFARRAY(t); - UNDEFARRAY(u); - UNDEFARRAY(lambda); -#endif } diff --git a/xc/extras/Mesa/src/swrast/s_accum.c b/xc/extras/Mesa/src/swrast/s_accum.c index b93f8379e..16eca43d5 100644 --- a/xc/extras/Mesa/src/swrast/s_accum.c +++ b/xc/extras/Mesa/src/swrast/s_accum.c @@ -1,8 +1,7 @@ -/* $Id: s_accum.c,v 1.1.1.1 2002/10/22 13:06:55 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -29,7 +28,7 @@ #include "context.h" #include "macros.h" #include "mmath.h" -#include "mem.h" +#include "imports.h" #include "s_accum.h" #include "s_alphabuf.h" @@ -62,10 +61,11 @@ */ -#if CHAN_BITS == 8 +#if CHAN_BITS == 8 && ACCUM_BITS < 32 #define USE_OPTIMIZED_ACCUM /* enable the optimization */ #endif + void _mesa_alloc_accum_buffer( GLframebuffer *buffer ) { @@ -194,7 +194,8 @@ _mesa_clear_accum_buffer( GLcontext *ctx ) ctx->Accum.ClearColor[2]==0.0 && ctx->Accum.ClearColor[3]==0.0) { /* Black */ - BZERO( ctx->DrawBuffer->Accum, buffersize * 4 * sizeof(GLaccum) ); + _mesa_bzero( ctx->DrawBuffer->Accum, + buffersize * 4 * sizeof(GLaccum) ); } else { /* Not black */ @@ -242,6 +243,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, GLchan rgba[MAX_WIDTH][4]; const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); + if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); @@ -304,8 +306,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, if (value == 0.0F) return; - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); + _swrast_use_read_buffer(ctx); /* May have to leave optimized accum buffer mode */ if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0) @@ -357,14 +358,13 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, } } /* restore read buffer = draw buffer (the default) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); + _swrast_use_draw_buffer(ctx); + RENDER_FINISH(swrast,ctx); break; case GL_LOAD: - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); + _swrast_use_read_buffer(ctx); /* This is a change to go into optimized accum buffer mode */ if (value > 0.0 && value <= 1.0) { @@ -431,8 +431,8 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, } /* restore read buffer = draw buffer (the default) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); + _swrast_use_draw_buffer(ctx); + RENDER_FINISH(swrast,ctx); break; @@ -472,7 +472,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, rgba[i][ACOMP] = multTable[acc[i4+3]]; } if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba ); + _mesa_mask_rgba_array( ctx, width, xpos, ypos, rgba ); } (*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, (const GLchan (*)[4])rgba, NULL ); @@ -507,7 +507,7 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLfloat value, rgba[i][ACOMP] = CLAMP( a, 0, CHAN_MAX ); } if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba ); + _mesa_mask_rgba_array( ctx, width, xpos, ypos, rgba ); } (*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos, (const GLchan (*)[4])rgba, NULL ); diff --git a/xc/extras/Mesa/src/swrast/s_alpha.c b/xc/extras/Mesa/src/swrast/s_alpha.c index 0d6353ec0..22ccff6dc 100644 --- a/xc/extras/Mesa/src/swrast/s_alpha.c +++ b/xc/extras/Mesa/src/swrast/s_alpha.c @@ -1,10 +1,9 @@ -/* $Id: s_alpha.c,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,6 +23,10 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * \file swrast/s_alpha.c + * \brief Functions to apply alpha test. + */ #include "glheader.h" #include "context.h" @@ -32,67 +35,191 @@ #include "mmath.h" #include "s_alpha.h" +#include "s_context.h" - - - -/* - * Apply the alpha test to a span of pixels. - * In: rgba - array of pixels - * In/Out: mask - current pixel mask. Pixels which fail the alpha test - * will set the corresponding mask flag to 0. - * Return: 0 = all pixels in the span failed the alpha test. - * 1 = one or more pixels passed the alpha test. +/** + * \fn GLint _mesa_alpha_test( const GLcontext *ctx, struct sw_span *span ) + * \brief Apply the alpha test to a span of pixels. + * \return + * - "0" = all pixels in the span failed the alpha test. + * - "1" = one or more pixels passed the alpha test. */ GLint -_mesa_alpha_test( const GLcontext *ctx, - GLuint n, CONST GLchan rgba[][4], GLubyte mask[] ) +_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span ) { + const GLchan (*rgba)[4] = (const GLchan (*)[4]) span->array->rgba; + GLchan ref; + const GLuint n = span->end; + GLubyte *mask = span->array->mask; GLuint i; - GLchan ref = ctx->Color.AlphaRef; - /* switch cases ordered from most frequent to less frequent */ - switch (ctx->Color.AlphaFunc) { - case GL_LESS: - for (i=0;i<n;i++) { - mask[i] &= (rgba[i][ACOMP] < ref); - } - return 1; - case GL_LEQUAL: - for (i=0;i<n;i++) - mask[i] &= (rgba[i][ACOMP] <= ref); - return 1; - case GL_GEQUAL: - for (i=0;i<n;i++) { - mask[i] &= (rgba[i][ACOMP] >= ref); - } - return 1; - case GL_GREATER: - for (i=0;i<n;i++) { - mask[i] &= (rgba[i][ACOMP] > ref); - } - return 1; - case GL_NOTEQUAL: - for (i=0;i<n;i++) { - mask[i] &= (rgba[i][ACOMP] != ref); - } - return 1; - case GL_EQUAL: - for (i=0;i<n;i++) { - mask[i] &= (rgba[i][ACOMP] == ref); - } - return 1; - case GL_ALWAYS: - /* do nothing */ - return 1; - case GL_NEVER: - /* caller should check for zero! */ - return 0; - default: - _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); - return 0; + CLAMPED_FLOAT_TO_CHAN(ref, ctx->Color.AlphaRef); + + if (span->arrayMask & SPAN_RGBA) { + /* Use the array values */ + switch (ctx->Color.AlphaFunc) { + case GL_LESS: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] < ref); + break; + case GL_LEQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] <= ref); + break; + case GL_GEQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] >= ref); + break; + case GL_GREATER: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] > ref); + break; + case GL_NOTEQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] != ref); + break; + case GL_EQUAL: + for (i = 0; i < n; i++) + mask[i] &= (rgba[i][ACOMP] == ref); + break; + case GL_ALWAYS: + /* do nothing */ + return 1; + case GL_NEVER: + /* caller should check for zero! */ + span->writeAll = GL_FALSE; + return 0; + default: + _mesa_problem( ctx, "Invalid alpha test in _mesa_alpha_test" ); + return 0; + } } - /* Never get here */ - /*return 1;*/ + else { + /* Use the interpolation values */ +#if CHAN_TYPE == GL_FLOAT + const GLfloat alphaStep = span->alphaStep; + GLfloat alpha = span->alpha; + ASSERT(span->interpMask & SPAN_RGBA); + switch (ctx->Color.AlphaFunc) { + case GL_LESS: + for (i = 0; i < n; i++) { + mask[i] &= (alpha < ref); + alpha += alphaStep; + } + break; + case GL_LEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha <= ref); + alpha += alphaStep; + } + break; + case GL_GEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha >= ref); + alpha += alphaStep; + } + break; + case GL_GREATER: + for (i = 0; i < n; i++) { + mask[i] &= (alpha > ref); + alpha += alphaStep; + } + break; + case GL_NOTEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha != ref); + alpha += alphaStep; + } + break; + case GL_EQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (alpha == ref); + alpha += alphaStep; + } + break; + case GL_ALWAYS: + /* do nothing */ + return 1; + case GL_NEVER: + /* caller should check for zero! */ + span->writeAll = GL_FALSE; + return 0; + default: + _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); + return 0; + } +#else + /* 8 or 16-bit channel interpolation */ + const GLfixed alphaStep = span->alphaStep; + GLfixed alpha = span->alpha; + ASSERT(span->interpMask & SPAN_RGBA); + switch (ctx->Color.AlphaFunc) { + case GL_LESS: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) < ref); + alpha += alphaStep; + } + break; + case GL_LEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) <= ref); + alpha += alphaStep; + } + break; + case GL_GEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) >= ref); + alpha += alphaStep; + } + break; + case GL_GREATER: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) > ref); + alpha += alphaStep; + } + break; + case GL_NOTEQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) != ref); + alpha += alphaStep; + } + break; + case GL_EQUAL: + for (i = 0; i < n; i++) { + mask[i] &= (FixedToChan(alpha) == ref); + alpha += alphaStep; + } + break; + case GL_ALWAYS: + /* do nothing */ + return 1; + case GL_NEVER: + /* caller should check for zero! */ + span->writeAll = GL_FALSE; + return 0; + default: + _mesa_problem( ctx, "Invalid alpha test in gl_alpha_test" ); + return 0; + } +#endif /* CHAN_TYPE */ + } + +#if 0 + /* XXXX This causes conformance failures!!!! */ + while ((span->start <= span->end) && + (mask[span->start] == 0)) + span->start ++; + + while ((span->end >= span->start) && + (mask[span->end] == 0)) + span->end --; +#endif + + span->writeAll = GL_FALSE; + + if (span->start >= span->end) + return 0; + else + return 1; } diff --git a/xc/extras/Mesa/src/swrast/s_alpha.h b/xc/extras/Mesa/src/swrast/s_alpha.h index 63e872c08..86a7d0654 100644 --- a/xc/extras/Mesa/src/swrast/s_alpha.h +++ b/xc/extras/Mesa/src/swrast/s_alpha.h @@ -1,10 +1,9 @@ -/* $Id: s_alpha.h,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -34,9 +33,7 @@ extern GLint -_mesa_alpha_test( const GLcontext *ctx, GLuint n, - CONST GLchan rgba[][4], GLubyte mask[] ); - +_mesa_alpha_test( const GLcontext *ctx, struct sw_span *span ); #endif diff --git a/xc/extras/Mesa/src/swrast/s_alphabuf.c b/xc/extras/Mesa/src/swrast/s_alphabuf.c index ee1c15933..e677fb7d6 100644 --- a/xc/extras/Mesa/src/swrast/s_alphabuf.c +++ b/xc/extras/Mesa/src/swrast/s_alphabuf.c @@ -1,8 +1,7 @@ -/* $Id: s_alphabuf.c,v 1.1.1.1 2002/10/22 13:06:44 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 5.0.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -32,26 +31,20 @@ #include "glheader.h" +#include "colormac.h" #include "context.h" -#include "mem.h" +#include "imports.h" +#include "s_context.h" #include "s_alphabuf.h" -#define ALPHA_DRAW_ADDR(X,Y) \ - (ctx->DrawBuffer->Alpha + (Y) * ctx->DrawBuffer->Width + (X)) - -#define ALPHA_READ_ADDR(X,Y) \ - (ctx->ReadBuffer->Alpha + (Y) * ctx->ReadBuffer->Width + (X)) - - /* * Allocate a new front and back alpha buffer. */ void _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) { - GET_CURRENT_CONTEXT(ctx); const GLint bytes = buffer->Width * buffer->Height * sizeof(GLchan); ASSERT(buffer->UseSoftwareAlphaBuffers); @@ -59,7 +52,7 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) if (buffer->FrontLeftAlpha) { MESA_PBUFFER_FREE( buffer->FrontLeftAlpha ); } - buffer->FrontLeftAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes ); + buffer->FrontLeftAlpha = MESA_PBUFFER_ALLOC( bytes ); if (!buffer->FrontLeftAlpha) { /* out of memory */ _mesa_error( NULL, GL_OUT_OF_MEMORY, @@ -70,7 +63,7 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) if (buffer->BackLeftAlpha) { MESA_PBUFFER_FREE( buffer->BackLeftAlpha ); } - buffer->BackLeftAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes ); + buffer->BackLeftAlpha = MESA_PBUFFER_ALLOC( bytes ); if (!buffer->BackLeftAlpha) { /* out of memory */ _mesa_error( NULL, GL_OUT_OF_MEMORY, @@ -82,7 +75,7 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) if (buffer->FrontRightAlpha) { MESA_PBUFFER_FREE( buffer->FrontRightAlpha ); } - buffer->FrontRightAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes ); + buffer->FrontRightAlpha = MESA_PBUFFER_ALLOC( bytes ); if (!buffer->FrontRightAlpha) { /* out of memory */ _mesa_error( NULL, GL_OUT_OF_MEMORY, @@ -93,7 +86,7 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) if (buffer->BackRightAlpha) { MESA_PBUFFER_FREE( buffer->BackRightAlpha ); } - buffer->BackRightAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes ); + buffer->BackRightAlpha = MESA_PBUFFER_ALLOC( bytes ); if (!buffer->BackRightAlpha) { /* out of memory */ _mesa_error( NULL, GL_OUT_OF_MEMORY, @@ -101,17 +94,6 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) } } } - - if (ctx) { - if (ctx->Color.DriverDrawBuffer == GL_FRONT_LEFT) - buffer->Alpha = buffer->FrontLeftAlpha; - else if (ctx->Color.DriverDrawBuffer == GL_BACK_LEFT) - buffer->Alpha = buffer->BackLeftAlpha; - else if (ctx->Color.DriverDrawBuffer == GL_FRONT_RIGHT) - buffer->Alpha = buffer->FrontRightAlpha; - else if (ctx->Color.DriverDrawBuffer == GL_BACK_RIGHT) - buffer->Alpha = buffer->BackRightAlpha; - } } @@ -121,27 +103,29 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) void _mesa_clear_alpha_buffers( GLcontext *ctx ) { - const GLchan aclear = ctx->Color.ClearColor[3]; + GLchan aclear; GLuint bufferBit; + CLAMPED_FLOAT_TO_CHAN(aclear, ctx->Color.ClearColor[3]); + ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); ASSERT(ctx->Color.ColorMask[ACOMP]); /* loop over four possible alpha buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color.DrawDestMask) { + if (bufferBit & ctx->Color._DrawDestMask) { GLchan *buffer; if (bufferBit == FRONT_LEFT_BIT) { - buffer = ctx->DrawBuffer->FrontLeftAlpha; + buffer = (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; } else if (bufferBit == FRONT_RIGHT_BIT) { - buffer = ctx->DrawBuffer->FrontRightAlpha; + buffer = (GLchan *) ctx->DrawBuffer->FrontRightAlpha; } else if (bufferBit == BACK_LEFT_BIT) { - buffer = ctx->DrawBuffer->BackLeftAlpha; + buffer = (GLchan *) ctx->DrawBuffer->BackLeftAlpha; } else { - buffer = ctx->DrawBuffer->BackRightAlpha; + buffer = (GLchan *) ctx->DrawBuffer->BackRightAlpha; } if (ctx->Scissor.Enabled) { @@ -187,13 +171,41 @@ _mesa_clear_alpha_buffers( GLcontext *ctx ) +static INLINE +GLchan *get_alpha_buffer( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + switch (swrast->CurrentBuffer) { + case FRONT_LEFT_BIT: + return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; + break; + case BACK_LEFT_BIT: + return (GLchan *) ctx->DrawBuffer->BackLeftAlpha; + break; + case FRONT_RIGHT_BIT: + return (GLchan *) ctx->DrawBuffer->FrontRightAlpha; + break; + case BACK_RIGHT_BIT: + return (GLchan *) ctx->DrawBuffer->BackRightAlpha; + break; + default: + _mesa_problem(ctx, "Bad CurrentBuffer in get_alpha_buffer()"); + return (GLchan *) ctx->DrawBuffer->FrontLeftAlpha; + } +} + + void _mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, CONST GLchan rgba[][4], const GLubyte mask[] ) { - GLchan *aptr = ALPHA_DRAW_ADDR( x, y ); + GLchan *buffer, *aptr; GLuint i; + buffer = get_alpha_buffer(ctx); + aptr = buffer + y * ctx->DrawBuffer->Width + x; + if (mask) { for (i=0;i<n;i++) { if (mask[i]) { @@ -214,9 +226,12 @@ void _mesa_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan alpha, const GLubyte mask[] ) { - GLchan *aptr = ALPHA_DRAW_ADDR( x, y ); + GLchan *buffer, *aptr; GLuint i; + buffer = get_alpha_buffer(ctx); + aptr = buffer + y * ctx->DrawBuffer->Width + x; + if (mask) { for (i=0;i<n;i++) { if (mask[i]) { @@ -238,19 +253,22 @@ _mesa_write_alpha_pixels( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLchan rgba[][4], const GLubyte mask[] ) { + GLchan *buffer; GLuint i; + buffer = get_alpha_buffer(ctx); + if (mask) { for (i=0;i<n;i++) { if (mask[i]) { - GLchan *aptr = ALPHA_DRAW_ADDR( x[i], y[i] ); + GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; *aptr = rgba[i][ACOMP]; } } } else { for (i=0;i<n;i++) { - GLchan *aptr = ALPHA_DRAW_ADDR( x[i], y[i] ); + GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; *aptr = rgba[i][ACOMP]; } } @@ -262,19 +280,22 @@ _mesa_write_mono_alpha_pixels( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLchan alpha, const GLubyte mask[] ) { + GLchan *buffer; GLuint i; + buffer = get_alpha_buffer(ctx); + if (mask) { for (i=0;i<n;i++) { if (mask[i]) { - GLchan *aptr = ALPHA_DRAW_ADDR( x[i], y[i] ); + GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; *aptr = alpha; } } } else { for (i=0;i<n;i++) { - GLchan *aptr = ALPHA_DRAW_ADDR( x[i], y[i] ); + GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; *aptr = alpha; } } @@ -286,11 +307,14 @@ void _mesa_read_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { - GLchan *aptr = ALPHA_READ_ADDR( x, y ); + const GLchan *buffer, *aptr; GLuint i; - for (i=0;i<n;i++) { + + buffer = get_alpha_buffer(ctx); + aptr = buffer + y * ctx->DrawBuffer->Width + x; + + for (i = 0; i < n; i++) rgba[i][ACOMP] = *aptr++; - } } @@ -299,10 +323,14 @@ _mesa_read_alpha_pixels( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLchan rgba[][4], const GLubyte mask[] ) { + const GLchan *buffer; GLuint i; - for (i=0;i<n;i++) { + + buffer = get_alpha_buffer(ctx); + + for (i = 0; i < n; i++) { if (mask[i]) { - GLchan *aptr = ALPHA_READ_ADDR( x[i], y[i] ); + const GLchan *aptr = buffer + y[i] * ctx->DrawBuffer->Width + x[i]; rgba[i][ACOMP] = *aptr; } } diff --git a/xc/extras/Mesa/src/swrast/s_bitmap.c b/xc/extras/Mesa/src/swrast/s_bitmap.c index 2cb088369..bc6c103a9 100644 --- a/xc/extras/Mesa/src/swrast/s_bitmap.c +++ b/xc/extras/Mesa/src/swrast/s_bitmap.c @@ -1,10 +1,9 @@ -/* $Id: s_bitmap.c,v 1.1.1.1 2002/10/22 13:06:54 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,15 +23,20 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * \file swrast/s_bitmap.c + * \brief glBitmap rendering. + * \author Brian Paul + */ #include "glheader.h" #include "image.h" #include "macros.h" +#include "mmath.h" #include "pixel.h" #include "s_context.h" -#include "s_fog.h" -#include "s_pb.h" +#include "s_span.h" @@ -46,10 +50,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, const GLubyte *bitmap ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - struct pixel_buffer *PB = swrast->PB; GLint row, col; - GLdepth fragZ; - GLfloat fog; + GLuint count = 0; + struct sw_span span; ASSERT(ctx->RenderMode == GL_RENDER); ASSERT(bitmap); @@ -59,32 +62,146 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, if (SWRAST_CONTEXT(ctx)->NewState) _swrast_validate_derived( ctx ); - /* Set bitmap drawing color */ + INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY); + if (ctx->Visual.rgbMode) { - GLint r, g, b, a; - r = (GLint) (ctx->Current.RasterColor[0] * CHAN_MAXF); - g = (GLint) (ctx->Current.RasterColor[1] * CHAN_MAXF); - b = (GLint) (ctx->Current.RasterColor[2] * CHAN_MAXF); - a = (GLint) (ctx->Current.RasterColor[3] * CHAN_MAXF); - PB_SET_COLOR( PB, r, g, b, a ); + span.interpMask |= SPAN_RGBA; + span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); + span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); + span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); + span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); + span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; } else { - PB_SET_INDEX( PB, ctx->Current.RasterIndex ); + span.interpMask |= SPAN_INDEX; + span.index = ChanToFixed(ctx->Current.RasterIndex); + span.indexStep = 0; + } + + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledUnits) + _mesa_span_default_texcoords(ctx, &span); + + for (row = 0; row < height; row++, span.y++) { + const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, + bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); + + if (unpack->LsbFirst) { + /* Lsb first */ + GLubyte mask = 1U << (unpack->SkipPixels & 0x7); + for (col = 0; col < width; col++) { + if (*src & mask) { + span.array->x[count] = px + col; + span.array->y[count] = py + row; + count++; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + + /* get ready for next row */ + if (mask != 1) + src++; + } + else { + /* Msb first */ + GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); + for (col = 0; col < width; col++) { + if (*src & mask) { + span.array->x[count] = px + col; + span.array->y[count] = py + row; + count++; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + + /* get ready for next row */ + if (mask != 128) + src++; + } + + if (count + width >= MAX_WIDTH || row + 1 == height) { + /* flush the span */ + span.end = count; + if (ctx->Visual.rgbMode) + _mesa_write_rgba_span(ctx, &span); + else + _mesa_write_index_span(ctx, &span); + span.end = 0; + count = 0; + } } - fragZ = (GLdepth) ( ctx->Current.RasterPos[2] * ctx->DepthMaxF); + RENDER_FINISH(swrast,ctx); +} + + +#if 0 +/* + * XXX this is another way to implement Bitmap. Use horizontal runs of + * fragments, initializing the mask array to indicate which fragmens to + * draw or skip. + */ +void +_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLint row, col; + struct sw_span span; + + ASSERT(ctx->RenderMode == GL_RENDER); + ASSERT(bitmap); + + RENDER_START(swrast,ctx); - if (ctx->Fog.Enabled) { - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.FogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + if (SWRAST_CONTEXT(ctx)->NewState) + _swrast_validate_derived( ctx ); + + INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK); + + /*span.arrayMask |= SPAN_MASK;*/ /* we'll init span.mask[] */ + span.x = px; + span.y = py; + /*span.end = width;*/ + if (ctx->Visual.rgbMode) { + span.interpMask |= SPAN_RGBA; + span.red = FloatToFixed(ctx->Current.RasterColor[0] * CHAN_MAXF); + span.green = FloatToFixed(ctx->Current.RasterColor[1] * CHAN_MAXF); + span.blue = FloatToFixed(ctx->Current.RasterColor[2] * CHAN_MAXF); + span.alpha = FloatToFixed(ctx->Current.RasterColor[3] * CHAN_MAXF); + span.redStep = span.greenStep = span.blueStep = span.alphaStep = 0; } else { - fog = 0.0; + span.interpMask |= SPAN_INDEX; + span.index = ChanToFixed(ctx->Current.RasterIndex); + span.indexStep = 0; } - for (row=0; row<height; row++) { + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledUnits) + _mesa_span_default_texcoords(ctx, &span); + + for (row=0; row<height; row++, span.y++) { const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); @@ -92,9 +209,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, /* Lsb first */ GLubyte mask = 1U << (unpack->SkipPixels & 0x7); for (col=0; col<width; col++) { - if (*src & mask) { - PB_WRITE_PIXEL( PB, px+col, py+row, fragZ, fog ); - } + span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; if (mask == 128U) { src++; mask = 1U; @@ -104,7 +219,10 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, } } - PB_CHECK_FLUSH( ctx, PB ); + if (ctx->Visual.rgbMode) + _mesa_write_rgba_span(ctx, &span); + else + _mesa_write_index_span(ctx, &span); /* get ready for next row */ if (mask != 1) @@ -114,9 +232,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, /* Msb first */ GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); for (col=0; col<width; col++) { - if (*src & mask) { - PB_WRITE_PIXEL( PB, px+col, py+row, fragZ, fog ); - } + span.array->mask[col] = (*src & mask) ? GL_TRUE : GL_FALSE; if (mask == 1U) { src++; mask = 128U; @@ -126,7 +242,10 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, } } - PB_CHECK_FLUSH( ctx, PB ); + if (ctx->Visual.rgbMode) + _mesa_write_rgba_span(ctx, &span); + else + _mesa_write_index_span(ctx, &span); /* get ready for next row */ if (mask != 128) @@ -134,7 +253,6 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, } } - _mesa_flush_pb(ctx); - RENDER_FINISH(swrast,ctx); } +#endif diff --git a/xc/extras/Mesa/src/swrast/s_blend.c b/xc/extras/Mesa/src/swrast/s_blend.c index ad6764f16..acd454811 100644 --- a/xc/extras/Mesa/src/swrast/s_blend.c +++ b/xc/extras/Mesa/src/swrast/s_blend.c @@ -1,8 +1,7 @@ -/* $Id: s_blend.c,v 1.1.1.1 2002/10/22 13:06:41 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -25,14 +24,15 @@ */ + #include "glheader.h" #include "context.h" +#include "colormac.h" #include "macros.h" #include "s_alphabuf.h" #include "s_blend.h" #include "s_context.h" -#include "s_pb.h" #include "s_span.h" @@ -60,10 +60,7 @@ blend_noop( GLcontext *ctx, GLuint n, const GLubyte mask[], for (i = 0; i < n; i++) { if (mask[i]) { - rgba[i][RCOMP] = dest[i][RCOMP]; - rgba[i][GCOMP] = dest[i][GCOMP]; - rgba[i][BCOMP] = dest[i][BCOMP]; - rgba[i][ACOMP] = dest[i][ACOMP]; + COPY_CHAN4( rgba[i], dest[i] ); } } } @@ -102,7 +99,7 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], for (i=0;i<n;i++) { if (mask[i]) { - const GLint t = rgba[i][ACOMP]; /* t in [0, CHAN_MAX] */ + const GLchan t = rgba[i][ACOMP]; /* t in [0, CHAN_MAX] */ if (t == 0) { /* 0% alpha */ rgba[i][RCOMP] = dest[i][RCOMP]; @@ -132,27 +129,31 @@ blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], #if CHAN_BITS == 8 /* This satisfies Glean and should be reasonably fast */ /* Contributed by Nathan Hand */ +#if 0 #define DIV255(X) (((X) << 8) + (X) + 256) >> 16 - const GLint s = CHAN_MAX - t; - const GLint r = DIV255(rgba[i][RCOMP] * t + dest[i][RCOMP] * s); - const GLint g = DIV255(rgba[i][GCOMP] * t + dest[i][GCOMP] * s); - const GLint b = DIV255(rgba[i][BCOMP] * t + dest[i][BCOMP] * s); - const GLint a = DIV255(rgba[i][ACOMP] * t + dest[i][ACOMP] * s); +#else + GLint temp; +#define DIV255(X) (temp = (X), ((temp << 8) + temp + 256) >> 16) +#endif + const GLint r = DIV255((rgba[i][RCOMP] - dest[i][RCOMP]) * t) + dest[i][RCOMP]; + const GLint g = DIV255((rgba[i][GCOMP] - dest[i][GCOMP]) * t) + dest[i][GCOMP]; + const GLint b = DIV255((rgba[i][BCOMP] - dest[i][BCOMP]) * t) + dest[i][BCOMP]; + const GLint a = DIV255((rgba[i][ACOMP] - dest[i][ACOMP]) * t) + dest[i][ACOMP]; + #undef DIV255 #elif CHAN_BITS == 16 const GLfloat tt = (GLfloat) t / CHAN_MAXF; - const GLfloat s = 1.0 - tt; - const GLint r = (GLint) (rgba[i][RCOMP] * tt + dest[i][RCOMP] * s); - const GLint g = (GLint) (rgba[i][GCOMP] * tt + dest[i][GCOMP] * s); - const GLint b = (GLint) (rgba[i][BCOMP] * tt + dest[i][BCOMP] * s); - const GLint a = (GLint) (rgba[i][ACOMP] * tt + dest[i][ACOMP] * s); + const GLint r = (GLint) ((rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]); + const GLint g = (GLint) ((rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]); + const GLint b = (GLint) ((rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]); + const GLint a = (GLint) ((rgba[i][ACOMP] - dest[i][ACOMP]) * tt + dest[i][ACOMP]); #else /* CHAN_BITS == 32 */ const GLfloat tt = (GLfloat) t / CHAN_MAXF; - const GLfloat s = 1.0 - tt; - const GLfloat r = rgba[i][RCOMP] * tt + dest[i][RCOMP] * s; - const GLfloat g = rgba[i][GCOMP] * tt + dest[i][GCOMP] * s; - const GLfloat b = rgba[i][BCOMP] * tt + dest[i][BCOMP] * s; - const GLfloat a = rgba[i][ACOMP] * tt + dest[i][ACOMP] * s; + const GLfloat r = (rgba[i][RCOMP] - dest[i][RCOMP]) * tt + dest[i][RCOMP]; + const GLfloat g = (rgba[i][GCOMP] - dest[i][GCOMP]) * tt + dest[i][GCOMP]; + const GLfloat b = (rgba[i][BCOMP] - dest[i][BCOMP]) * tt + dest[i][BCOMP]; + const GLfloat a = CLAMP( rgba[i][ACOMP], 0.0F, CHAN_MAXF ) * t + + CLAMP( dest[i][ACOMP], 0.0F, CHAN_MAXF ) * (1.0F - t); #endif #endif ASSERT(r <= CHAN_MAX); @@ -186,20 +187,22 @@ blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[], for (i=0;i<n;i++) { if (mask[i]) { #if CHAN_TYPE == GL_FLOAT - GLfloat r = rgba[i][RCOMP] + dest[i][RCOMP]; - GLfloat g = rgba[i][GCOMP] + dest[i][GCOMP]; - GLfloat b = rgba[i][BCOMP] + dest[i][BCOMP]; - GLfloat a = rgba[i][ACOMP] + dest[i][ACOMP]; + /* don't RGB clamp to max */ + GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, CHAN_MAXF) + dest[i][ACOMP]; + rgba[i][RCOMP] += dest[i][RCOMP]; + rgba[i][GCOMP] += dest[i][GCOMP]; + rgba[i][BCOMP] += dest[i][BCOMP]; + rgba[i][ACOMP] = (GLchan) MIN2( a, CHAN_MAXF ); #else GLint r = rgba[i][RCOMP] + dest[i][RCOMP]; GLint g = rgba[i][GCOMP] + dest[i][GCOMP]; GLint b = rgba[i][BCOMP] + dest[i][BCOMP]; GLint a = rgba[i][ACOMP] + dest[i][ACOMP]; -#endif rgba[i][RCOMP] = (GLchan) MIN2( r, CHAN_MAX ); rgba[i][GCOMP] = (GLchan) MIN2( g, CHAN_MAX ); rgba[i][BCOMP] = (GLchan) MIN2( b, CHAN_MAX ); rgba[i][ACOMP] = (GLchan) MIN2( a, CHAN_MAX ); +#endif } } } @@ -222,7 +225,12 @@ blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[], rgba[i][RCOMP] = (GLchan) MIN2( rgba[i][RCOMP], dest[i][RCOMP] ); rgba[i][GCOMP] = (GLchan) MIN2( rgba[i][GCOMP], dest[i][GCOMP] ); rgba[i][BCOMP] = (GLchan) MIN2( rgba[i][BCOMP], dest[i][BCOMP] ); +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = (GLchan) MIN2(CLAMP(rgba[i][ACOMP], 0.0F, CHAN_MAXF), + dest[i][ACOMP]); +#else rgba[i][ACOMP] = (GLchan) MIN2( rgba[i][ACOMP], dest[i][ACOMP] ); +#endif } } } @@ -245,7 +253,12 @@ blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[], rgba[i][RCOMP] = (GLchan) MAX2( rgba[i][RCOMP], dest[i][RCOMP] ); rgba[i][GCOMP] = (GLchan) MAX2( rgba[i][GCOMP], dest[i][GCOMP] ); rgba[i][BCOMP] = (GLchan) MAX2( rgba[i][BCOMP], dest[i][BCOMP] ); +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = (GLchan) MAX2(CLAMP(rgba[i][ACOMP], 0.0F, CHAN_MAXF), + dest[i][ACOMP]); +#else rgba[i][ACOMP] = (GLchan) MAX2( rgba[i][ACOMP], dest[i][ACOMP] ); +#endif } } } @@ -269,11 +282,20 @@ blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[], rgba[i][GCOMP] = rgba[i][GCOMP] * dest[i][GCOMP]; rgba[i][BCOMP] = rgba[i][BCOMP] * dest[i][BCOMP]; rgba[i][ACOMP] = rgba[i][ACOMP] * dest[i][ACOMP]; +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + GLint r = (rgba[i][RCOMP] * dest[i][RCOMP] + 65535) >> 16; + GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 65535) >> 16; + GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 65535) >> 16; + GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 65535) >> 16; + rgba[i][RCOMP] = (GLchan) r; + rgba[i][GCOMP] = (GLchan) g; + rgba[i][BCOMP] = (GLchan) b; + rgba[i][ACOMP] = (GLchan) a; #else - GLint r = (rgba[i][RCOMP] * dest[i][RCOMP]) >> 8; - GLint g = (rgba[i][GCOMP] * dest[i][GCOMP]) >> 8; - GLint b = (rgba[i][BCOMP] * dest[i][BCOMP]) >> 8; - GLint a = (rgba[i][ACOMP] * dest[i][ACOMP]) >> 8; + GLint r = (rgba[i][RCOMP] * dest[i][RCOMP] + 255) >> 8; + GLint g = (rgba[i][GCOMP] * dest[i][GCOMP] + 255) >> 8; + GLint b = (rgba[i][BCOMP] * dest[i][BCOMP] + 255) >> 8; + GLint a = (rgba[i][ACOMP] * dest[i][ACOMP] + 255) >> 8; rgba[i][RCOMP] = (GLchan) r; rgba[i][GCOMP] = (GLchan) g; rgba[i][BCOMP] = (GLchan) b; @@ -296,10 +318,10 @@ static void _BLENDAPI blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], GLchan rgba[][4], CONST GLchan dest[][4] ) { - GLfloat rscale = 1.0F / CHAN_MAXF; - GLfloat gscale = 1.0F / CHAN_MAXF; - GLfloat bscale = 1.0F / CHAN_MAXF; - GLfloat ascale = 1.0F / CHAN_MAXF; + const GLfloat rscale = 1.0F / CHAN_MAXF; + const GLfloat gscale = 1.0F / CHAN_MAXF; + const GLfloat bscale = 1.0F / CHAN_MAXF; + const GLfloat ascale = 1.0F / CHAN_MAXF; GLuint i; for (i=0;i<n;i++) { @@ -313,19 +335,33 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], #endif GLfloat sR, sG, sB, sA; /* Source scaling */ GLfloat dR, dG, dB, dA; /* Dest scaling */ - GLfloat r, g, b, a; + GLfloat r, g, b, a; /* result color */ - /* Source Color */ + /* Incoming/source Color */ Rs = rgba[i][RCOMP]; Gs = rgba[i][GCOMP]; Bs = rgba[i][BCOMP]; As = rgba[i][ACOMP]; +#if CHAN_TYPE == GL_FLOAT + /* clamp */ + Rs = MIN2(Rs, CHAN_MAXF); + Gs = MIN2(Gs, CHAN_MAXF); + Bs = MIN2(Bs, CHAN_MAXF); + As = MIN2(As, CHAN_MAXF); +#endif - /* Frame buffer color */ + /* Frame buffer/dest color */ Rd = dest[i][RCOMP]; Gd = dest[i][GCOMP]; Bd = dest[i][BCOMP]; Ad = dest[i][ACOMP]; +#if CHAN_TYPE == GL_FLOAT + /* clamp */ + Rd = MIN2(Rd, CHAN_MAXF); + Gd = MIN2(Gd, CHAN_MAXF); + Bd = MIN2(Bd, CHAN_MAXF); + Ad = MIN2(Ad, CHAN_MAXF); +#endif /* Source RGB factor */ switch (ctx->Color.BlendSrcRGB) { @@ -349,7 +385,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], sR = sG = sB = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: - sR = sG = sB = (GLfloat) 1.0F - (GLfloat) As * ascale; + sR = sG = sB = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: sR = sG = sB = (GLfloat) Ad * ascale; @@ -415,7 +451,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], sA = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: - sA = (GLfloat) 1.0F - (GLfloat) As * ascale; + sA = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: sA =(GLfloat) Ad * ascale; @@ -472,7 +508,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], dR = dG = dB = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: - dR = dG = dB = (GLfloat) 1.0F - (GLfloat) As * ascale; + dR = dG = dB = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: dR = dG = dB = (GLfloat) Ad * ascale; @@ -530,7 +566,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], dA = (GLfloat) As * ascale; break; case GL_ONE_MINUS_SRC_ALPHA: - dA = (GLfloat) 1.0F - (GLfloat) As * ascale; + dA = 1.0F - (GLfloat) As * ascale; break; case GL_DST_ALPHA: dA = (GLfloat) Ad * ascale; @@ -560,7 +596,7 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], /* this should never happen */ dA = 0.0F; _mesa_problem(ctx, "Bad blend dest A factor in do_blend"); - return; + return; } /* Due to round-off problems we have to clamp against zero. */ @@ -610,9 +646,9 @@ blend_general( GLcontext *ctx, GLuint n, const GLubyte mask[], } /* final clamping */ - rgba[i][RCOMP] = CLAMP( r, 0.0F, CHAN_MAXF ); - rgba[i][GCOMP] = CLAMP( g, 0.0F, CHAN_MAXF ); - rgba[i][BCOMP] = CLAMP( b, 0.0F, CHAN_MAXF ); + rgba[i][RCOMP] = MAX2( r, 0.0F ); + rgba[i][GCOMP] = MAX2( g, 0.0F ); + rgba[i][BCOMP] = MAX2( b, 0.0F ); rgba[i][ACOMP] = CLAMP( a, 0.0F, CHAN_MAXF ); #else if (ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { @@ -669,30 +705,54 @@ void _swrast_choose_blend_func( GLcontext *ctx ) SWRAST_CONTEXT(ctx)->BlendFunc = blend_general; } else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_SRC_ALPHA - && dstRGB==GL_ONE_MINUS_SRC_ALPHA) { + && dstRGB==GL_ONE_MINUS_SRC_ALPHA) { #if defined(USE_MMX_ASM) if ( cpu_has_mmx ) { - SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_transparency; + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_transparency; } else #endif SWRAST_CONTEXT(ctx)->BlendFunc = blend_transparency; } else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_ONE && dstRGB==GL_ONE) { - SWRAST_CONTEXT(ctx)->BlendFunc = blend_add; +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_add; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_add; } else if (((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_REVERSE_SUBTRACT_EXT) && (srcRGB==GL_ZERO && dstRGB==GL_SRC_COLOR)) || ((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_SUBTRACT_EXT) && (srcRGB==GL_DST_COLOR && dstRGB==GL_ZERO))) { - SWRAST_CONTEXT(ctx)->BlendFunc = blend_modulate; +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_modulate; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_modulate; } else if (eq==GL_MIN_EXT) { - SWRAST_CONTEXT(ctx)->BlendFunc = blend_min; +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_min; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_min; } else if (eq==GL_MAX_EXT) { - SWRAST_CONTEXT(ctx)->BlendFunc = blend_max; +#if defined(USE_MMX_ASM) + if ( cpu_has_mmx ) { + SWRAST_CONTEXT(ctx)->BlendFunc = _mesa_mmx_blend_max; + } + else +#endif + SWRAST_CONTEXT(ctx)->BlendFunc = blend_max; } else if (eq==GL_FUNC_ADD_EXT && srcRGB == GL_ZERO && dstRGB == GL_ONE) { SWRAST_CONTEXT(ctx)->BlendFunc = blend_noop; @@ -709,58 +769,38 @@ void _swrast_choose_blend_func( GLcontext *ctx ) /* * Apply the blending operator to a span of pixels. - * Input: n - number of pixels in span - * x, y - location of leftmost pixel in span in window coords. - * mask - boolean mask indicating which pixels to blend. - * In/Out: rgba - pixel values + * We can handle horizontal runs of pixels (spans) or arrays of x/y + * pixel coordinates. */ void -_mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLchan rgba[][4], const GLubyte mask[] ) +_mesa_blend_span( GLcontext *ctx, const struct sw_span *span, + GLchan rgba[][4] ) { - GLchan dest[MAX_WIDTH][4]; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLchan framebuffer[MAX_WIDTH][4]; - /* Check if device driver can do the work */ - if (ctx->Color.BlendEquation==GL_LOGIC_OP && - !ctx->Color.ColorLogicOpEnabled) { - return; - } + ASSERT(span->end <= MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_RGBA); + ASSERT(!ctx->Color.ColorLogicOpEnabled); /* Read span of current frame buffer pixels */ - _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); - - SWRAST_CONTEXT(ctx)->BlendFunc( ctx, n, mask, rgba, - (const GLchan (*)[4]) dest ); -} - - - -/* - * Apply the blending operator to an array of pixels. - * Input: n - number of pixels in span - * x, y - array of pixel locations - * mask - boolean mask indicating which pixels to blend. - * In/Out: rgba - pixel values - */ -void -_mesa_blend_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLchan rgba[][4], const GLubyte mask[] ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLchan dest[PB_SIZE][4]; - - /* Check if device driver can do the work */ - if (ctx->Color.BlendEquation==GL_LOGIC_OP && - !ctx->Color.ColorLogicOpEnabled) { - return; + if (span->arrayMask & SPAN_XY) { + /* array of x/y pixel coords */ + (*swrast->Driver.ReadRGBAPixels)( ctx, span->end, + span->array->x, span->array->y, + framebuffer, span->array->mask ); + if (swrast->_RasterMask & ALPHABUF_BIT) { + _mesa_read_alpha_pixels( ctx, span->end, + span->array->x, span->array->y, + framebuffer, span->array->mask ); + } } - - /* Read pixels from current color buffer */ - (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); + else { + /* horizontal run of pixels */ + _mesa_read_rgba_span( ctx, ctx->DrawBuffer, span->end, + span->x, span->y, framebuffer ); } - swrast->BlendFunc( ctx, n, mask, rgba, (const GLchan (*)[4])dest ); + SWRAST_CONTEXT(ctx)->BlendFunc( ctx, span->end, span->array->mask, rgba, + (const GLchan (*)[4]) framebuffer ); } diff --git a/xc/extras/Mesa/src/swrast/s_blend.h b/xc/extras/Mesa/src/swrast/s_blend.h index 1882b18e2..c9357748d 100644 --- a/xc/extras/Mesa/src/swrast/s_blend.h +++ b/xc/extras/Mesa/src/swrast/s_blend.h @@ -1,10 +1,9 @@ -/* $Id: s_blend.h,v 1.1.1.1 2002/10/22 13:06:41 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -35,16 +34,11 @@ extern void -_mesa_blend_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLchan rgba[][4], const GLubyte mask[] ); +_mesa_blend_span( GLcontext *ctx, const struct sw_span *span, + GLchan rgba[][4] ); extern void -_mesa_blend_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLchan rgba[][4], const GLubyte mask[] ); - -extern void _swrast_choose_blend_func( GLcontext *ctx ); diff --git a/xc/extras/Mesa/src/swrast/s_buffers.c b/xc/extras/Mesa/src/swrast/s_buffers.c index 59524ba09..18d11891c 100644 --- a/xc/extras/Mesa/src/swrast/s_buffers.c +++ b/xc/extras/Mesa/src/swrast/s_buffers.c @@ -1,10 +1,9 @@ -/* $Id: s_buffers.c,v 1.1.1.1 2002/10/22 13:06:40 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -26,8 +25,9 @@ #include "glheader.h" +#include "colormac.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "s_accum.h" #include "s_alphabuf.h" @@ -53,21 +53,19 @@ clear_color_buffer_with_masking( GLcontext *ctx ) if (ctx->Visual.rgbMode) { /* RGBA mode */ - const GLchan r = ctx->Color.ClearColor[0]; - const GLchan g = ctx->Color.ClearColor[1]; - const GLchan b = ctx->Color.ClearColor[2]; - const GLchan a = ctx->Color.ClearColor[3]; + GLchan clearColor[4]; GLint i; + CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]); + CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]); for (i = 0; i < height; i++) { GLchan rgba[MAX_WIDTH][4]; GLint j; for (j = 0; j < width; j++) { - rgba[j][RCOMP] = r; - rgba[j][GCOMP] = g; - rgba[j][BCOMP] = b; - rgba[j][ACOMP] = a; + COPY_CHAN4(rgba[j], clearColor); } - _mesa_mask_rgba_span( ctx, width, x, y + i, rgba ); + _mesa_mask_rgba_array( ctx, width, x, y + i, rgba ); (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i, (CONST GLchan (*)[4]) rgba, NULL ); } @@ -82,7 +80,7 @@ clear_color_buffer_with_masking( GLcontext *ctx ) for (j=0;j<width;j++) { span[j] = ctx->Color.ClearIndex; } - _mesa_mask_index_span( ctx, width, x, y + i, span ); + _mesa_mask_index_array( ctx, width, x, y + i, span ); (*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask ); } } @@ -104,20 +102,19 @@ clear_color_buffer(GLcontext *ctx) if (ctx->Visual.rgbMode) { /* RGBA mode */ - const GLchan r = ctx->Color.ClearColor[0]; - const GLchan g = ctx->Color.ClearColor[1]; - const GLchan b = ctx->Color.ClearColor[2]; - const GLchan a = ctx->Color.ClearColor[3]; + GLchan clearColor[4]; GLchan span[MAX_WIDTH][4]; GLint i; + CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]); + CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]); + CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]); + CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]); + ASSERT(*((GLuint *) &ctx->Color.ColorMask) == 0xffffffff); for (i = 0; i < width; i++) { - span[i][RCOMP] = r; - span[i][GCOMP] = g; - span[i][BCOMP] = b; - span[i][ACOMP] = a; + COPY_CHAN4(span[i], clearColor); } for (i = 0; i < height; i++) { (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i, @@ -167,23 +164,8 @@ clear_color_buffers(GLcontext *ctx) /* loop over four possible dest color buffers */ for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color.DrawDestMask) { - if (bufferBit == FRONT_LEFT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); - (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT); - } - else if (bufferBit == FRONT_RIGHT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); - (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT); - } - else if (bufferBit == BACK_LEFT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); - (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT); - } - else { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); - (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT); - } + if (bufferBit & ctx->Color._DrawDestMask) { + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); if (colorMask != 0xffffffff) { clear_color_buffer_with_masking(ctx); @@ -194,9 +176,8 @@ clear_color_buffers(GLcontext *ctx) } } - /* restore default read/draw buffers */ - (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer ); - (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer ); + /* restore default read/draw buffer */ + _swrast_use_draw_buffer(ctx); } @@ -224,7 +205,7 @@ _swrast_Clear( GLcontext *ctx, GLbitfield mask, /* do software clearing here */ if (mask) { - if (mask & ctx->Color.DrawDestMask) clear_color_buffers(ctx); + if (mask & ctx->Color._DrawDestMask) clear_color_buffers(ctx); if (mask & GL_DEPTH_BUFFER_BIT) _mesa_clear_depth_buffer(ctx); if (mask & GL_ACCUM_BUFFER_BIT) _mesa_clear_accum_buffer(ctx); if (mask & GL_STENCIL_BUFFER_BIT) _mesa_clear_stencil_buffer(ctx); @@ -258,3 +239,66 @@ _swrast_alloc_buffers( GLframebuffer *buffer ) _mesa_alloc_alpha_buffers( buffer ); } } + + +/* + * Fallback for ctx->Driver.DrawBuffer() + */ +void +_swrast_DrawBuffer( GLcontext *ctx, GLenum mode ) +{ + _swrast_use_draw_buffer(ctx); +} + + +/* + * Setup things so that we read/write spans from the user-designated + * read buffer (set via glReadPixels). We usually just have to call + * this for glReadPixels, glCopyPixels, etc. + */ +void +_swrast_use_read_buffer( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* Do this so the software-emulated alpha plane span functions work! */ + swrast->CurrentBuffer = ctx->Pixel._ReadSrcMask; + /* Tell the device driver where to read/write spans */ + (*swrast->Driver.SetBuffer)( ctx, ctx->ReadBuffer, swrast->CurrentBuffer ); +} + + +/* + * Setup things so that we read/write spans from the default draw buffer. + * This is the usual mode that Mesa's software rasterizer operates in. + */ +void +_swrast_use_draw_buffer( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + + /* The user can specify rendering to zero, one, two, or four color + * buffers simultaneously with glDrawBuffer()! + * We don't expect the span/point/line/triangle functions to deal with + * that mess so we'll iterate over the multiple buffers as needed. + * But usually we only render to one color buffer at a time. + * We set ctx->Color._DriverDrawBuffer to that buffer and tell the + * device driver to use that buffer. + * Look in s_span.c's multi_write_rgba_span() function to see how + * we loop over multiple color buffers when needed. + */ + + if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT) + swrast->CurrentBuffer = FRONT_LEFT_BIT; + else if (ctx->Color._DrawDestMask & BACK_LEFT_BIT) + swrast->CurrentBuffer = BACK_LEFT_BIT; + else if (ctx->Color._DrawDestMask & FRONT_RIGHT_BIT) + swrast->CurrentBuffer = FRONT_RIGHT_BIT; + else if (ctx->Color._DrawDestMask & BACK_RIGHT_BIT) + swrast->CurrentBuffer = BACK_RIGHT_BIT; + else + /* glDrawBuffer(GL_NONE) */ + swrast->CurrentBuffer = FRONT_LEFT_BIT; /* we always have this buffer */ + + (*swrast->Driver.SetBuffer)( ctx, ctx->DrawBuffer, swrast->CurrentBuffer ); +} diff --git a/xc/extras/Mesa/src/swrast/s_context.c b/xc/extras/Mesa/src/swrast/s_context.c index 042797d08..16acc154a 100644 --- a/xc/extras/Mesa/src/swrast/s_context.c +++ b/xc/extras/Mesa/src/swrast/s_context.c @@ -1,8 +1,7 @@ -/* $Id: s_context.c,v 1.1.1.1 2002/10/22 13:06:44 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,25 +23,24 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" +#include "context.h" #include "mtypes.h" -#include "mem.h" +#include "imports.h" -#include "s_pb.h" -#include "s_points.h" -#include "s_lines.h" -#include "s_triangle.h" +#include "swrast.h" #include "s_blend.h" #include "s_context.h" +#include "s_lines.h" +#include "s_points.h" +#include "s_span.h" +#include "s_triangle.h" #include "s_texture.h" - - - /* * Recompute the value of swrast->_RasterMask, etc. according to * the current context. @@ -56,13 +54,13 @@ _swrast_update_rasterflags( GLcontext *ctx ) if (ctx->Color.BlendEnabled) RasterMask |= BLEND_BIT; if (ctx->Depth.Test) RasterMask |= DEPTH_BIT; if (ctx->Fog.Enabled) RasterMask |= FOG_BIT; - if (ctx->Scissor.Enabled) RasterMask |= SCISSOR_BIT; + if (ctx->Scissor.Enabled) RasterMask |= CLIP_BIT; if (ctx->Stencil.Enabled) RasterMask |= STENCIL_BIT; if (ctx->Visual.rgbMode) { const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); if (colorMask != 0xffffffff) RasterMask |= MASKING_BIT; if (ctx->Color.ColorLogicOpEnabled) RasterMask |= LOGIC_OP_BIT; - if (ctx->Texture._ReallyEnabled) RasterMask |= TEXTURE_BIT; + if (ctx->Texture._EnabledUnits) RasterMask |= TEXTURE_BIT; } else { if (ctx->Color.IndexMask != 0xffffffff) RasterMask |= MASKING_BIT; @@ -78,7 +76,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width || ctx->Viewport.Y < 0 || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) { - RasterMask |= WINCLIP_BIT; + RasterMask |= CLIP_BIT; } if (ctx->Depth.OcclusionTest) @@ -89,8 +87,11 @@ _swrast_update_rasterflags( GLcontext *ctx ) * MULTI_DRAW_BIT flag. Also set it if we're drawing to no * buffers or the RGBA or CI mask disables all writes. */ - if (ctx->Color.DrawBuffer == GL_FRONT_AND_BACK || - ctx->Color.DrawBuffer == GL_NONE) { + if (ctx->Color._DrawDestMask != FRONT_LEFT_BIT && + ctx->Color._DrawDestMask != BACK_LEFT_BIT && + ctx->Color._DrawDestMask != FRONT_RIGHT_BIT && + ctx->Color._DrawDestMask != BACK_RIGHT_BIT) { + /* more than one color buffer designated for writing (or zero buffers) */ RasterMask |= MULTI_DRAW_BIT; } else if (ctx->Visual.rgbMode && *((GLuint *) ctx->Color.ColorMask) == 0) { @@ -143,6 +144,26 @@ _swrast_update_hint( GLcontext *ctx ) swrast->AllowPixelFog)); } + +/* + * Update the swrast->_AnyTextureCombine flag. + */ +static void +_swrast_update_texture_env( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint i; + swrast->_AnyTextureCombine = GL_FALSE; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + if (ctx->Texture.Unit[i].EnvMode == GL_COMBINE_EXT || + ctx->Texture.Unit[i].EnvMode == GL_COMBINE4_NV) { + swrast->_AnyTextureCombine = GL_TRUE; + return; + } + } +} + + #define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \ _NEW_TEXTURE | \ _NEW_HINT | \ @@ -181,6 +202,8 @@ _swrast_update_hint( GLcontext *ctx ) #define _SWRAST_NEW_TEXTURE_SAMPLE_FUNC _NEW_TEXTURE +#define _SWRAST_NEW_TEXTURE_ENV_MODE _NEW_TEXTURE + #define _SWRAST_NEW_BLEND_FUNC _NEW_COLOR @@ -200,7 +223,7 @@ _swrast_validate_triangle( GLcontext *ctx, swrast->choose_triangle( ctx ); if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && - !ctx->Texture._ReallyEnabled) { + ctx->Texture._EnabledUnits == 0) { swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; } @@ -217,7 +240,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) swrast->choose_line( ctx ); if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && - !ctx->Texture._ReallyEnabled) { + ctx->Texture._EnabledUnits == 0) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -235,7 +258,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) swrast->choose_point( ctx ); if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && - !ctx->Texture._ReallyEnabled) { + ctx->Texture._EnabledUnits == 0) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } @@ -261,17 +284,15 @@ _swrast_validate_blend_func( GLcontext *ctx, GLuint n, static void _swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLuint n, GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); _swrast_validate_derived( ctx ); _swrast_choose_texture_sample_func( ctx, texUnit, tObj ); - swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, s, t, u, + swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords, lambda, rgba ); } @@ -315,7 +336,6 @@ _swrast_invalidate_state( GLcontext *ctx, GLuint new_state ) for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) swrast->TextureSample[i] = _swrast_validate_texture_sample; - if (ctx->Visual.rgbMode) { ASSERT(swrast->Driver.WriteRGBASpan); ASSERT(swrast->Driver.WriteRGBSpan); @@ -334,18 +354,15 @@ _swrast_invalidate_state( GLcontext *ctx, GLuint new_state ) ASSERT(swrast->Driver.ReadCI32Span); ASSERT(swrast->Driver.ReadCI32Pixels); } - } - void _swrast_validate_derived( GLcontext *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (swrast->NewState) - { + if (swrast->NewState) { if (swrast->NewState & _SWRAST_NEW_RASTERMASK) _swrast_update_rasterflags( ctx ); @@ -355,6 +372,9 @@ _swrast_validate_derived( GLcontext *ctx ) if (swrast->NewState & _NEW_HINT) _swrast_update_hint( ctx ); + if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE) + _swrast_update_texture_env( ctx ); + swrast->NewState = 0; swrast->StateChanges = 0; swrast->InvalidateState = _swrast_invalidate_state; @@ -371,7 +391,7 @@ _swrast_Quad( GLcontext *ctx, const SWvertex *v2, const SWvertex *v3 ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_Quad\n"); + _mesa_debug(ctx, "_swrast_Quad\n"); _swrast_print_vertex( ctx, v0 ); _swrast_print_vertex( ctx, v1 ); _swrast_print_vertex( ctx, v2 ); @@ -386,7 +406,7 @@ _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_Triangle\n"); + _mesa_debug(ctx, "_swrast_Triangle\n"); _swrast_print_vertex( ctx, v0 ); _swrast_print_vertex( ctx, v1 ); _swrast_print_vertex( ctx, v2 ); @@ -398,7 +418,7 @@ void _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_Line\n"); + _mesa_debug(ctx, "_swrast_Line\n"); _swrast_print_vertex( ctx, v0 ); _swrast_print_vertex( ctx, v1 ); } @@ -409,7 +429,7 @@ void _swrast_Point( GLcontext *ctx, const SWvertex *v0 ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_Point\n"); + _mesa_debug(ctx, "_swrast_Point\n"); _swrast_print_vertex( ctx, v0 ); } SWRAST_CONTEXT(ctx)->Point( ctx, v0 ); @@ -419,7 +439,7 @@ void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_InvalidateState\n"); + _mesa_debug(ctx, "_swrast_InvalidateState\n"); } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state ); } @@ -428,7 +448,7 @@ void _swrast_ResetLineStipple( GLcontext *ctx ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_ResetLineStipple\n"); + _mesa_debug(ctx, "_swrast_ResetLineStipple\n"); } SWRAST_CONTEXT(ctx)->StippleCounter = 0; } @@ -437,7 +457,7 @@ void _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_allow_vertex_fog %d\n", value); + _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value); } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); SWRAST_CONTEXT(ctx)->AllowVertexFog = value; @@ -447,7 +467,7 @@ void _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ) { if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_allow_pixel_fog %d\n", value); + _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value); } SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT ); SWRAST_CONTEXT(ctx)->AllowPixelFog = value; @@ -461,18 +481,12 @@ _swrast_CreateContext( GLcontext *ctx ) SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext)); if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_CreateContext\n"); + _mesa_debug(ctx, "_swrast_CreateContext\n"); } if (!swrast) return GL_FALSE; - swrast->PB = _mesa_alloc_pb(); - if (!swrast->PB) { - FREE(swrast); - return GL_FALSE; - } - swrast->NewState = ~0; swrast->choose_point = _swrast_choose_point; @@ -492,15 +506,44 @@ _swrast_CreateContext( GLcontext *ctx ) swrast->AllowVertexFog = GL_TRUE; swrast->AllowPixelFog = GL_TRUE; + if (ctx->Visual.doubleBufferMode) + swrast->CurrentBuffer = BACK_LEFT_BIT; + else + swrast->CurrentBuffer = FRONT_LEFT_BIT; + /* Optimized Accum buffer */ swrast->_IntegerAccumMode = GL_TRUE; swrast->_IntegerAccumScaler = 0.0; - for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) swrast->TextureSample[i] = _swrast_validate_texture_sample; + swrast->SpanArrays = MALLOC_STRUCT(span_arrays); + if (!swrast->SpanArrays) { + FREE(swrast); + return GL_FALSE; + } + + /* init point span buffer */ + swrast->PointSpan.primitive = GL_POINT; + swrast->PointSpan.start = 0; + swrast->PointSpan.end = 0; + swrast->PointSpan.facing = 0; + swrast->PointSpan.array = swrast->SpanArrays; + + assert(ctx->Const.MaxTextureUnits > 0); + assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_UNITS); + + swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureUnits * + MAX_WIDTH * 4 * sizeof(GLchan)); + if (!swrast->TexelBuffer) { + FREE(swrast->SpanArrays); + FREE(swrast); + return GL_FALSE; + } + ctx->swrast_context = swrast; + return GL_TRUE; } @@ -510,10 +553,11 @@ _swrast_DestroyContext( GLcontext *ctx ) SWcontext *swrast = SWRAST_CONTEXT(ctx); if (SWRAST_DEBUG) { - fprintf(stderr, "_swrast_DestroyContext\n"); + _mesa_debug(ctx, "_swrast_DestroyContext\n"); } - FREE( swrast->PB ); + FREE( swrast->SpanArrays ); + FREE( swrast->TexelBuffer ); FREE( swrast ); ctx->swrast_context = 0; @@ -527,6 +571,56 @@ _swrast_GetDeviceDriverReference( GLcontext *ctx ) return &swrast->Driver; } +void +_swrast_flush( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + /* flush any pending fragments from rendering points */ + if (swrast->PointSpan.end > 0) { + if (ctx->Visual.rgbMode) { + if (ctx->Texture._EnabledUnits) + _mesa_write_texture_span(ctx, &(swrast->PointSpan)); + else + _mesa_write_rgba_span(ctx, &(swrast->PointSpan)); + } + else { + _mesa_write_index_span(ctx, &(swrast->PointSpan)); + } + swrast->PointSpan.end = 0; + } +} + +void +_swrast_render_primitive( GLcontext *ctx, GLenum prim ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) { + _swrast_flush(ctx); + } + swrast->Primitive = prim; +} + + +void +_swrast_render_start( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Driver.SpanRenderStart) + swrast->Driver.SpanRenderStart( ctx ); + swrast->PointSpan.end = 0; +} + +void +_swrast_render_finish( GLcontext *ctx ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + if (swrast->Driver.SpanRenderFinish) + swrast->Driver.SpanRenderFinish( ctx ); + + _swrast_flush(ctx); +} + + #define SWRAST_DEBUG_VERTICES 0 void @@ -535,29 +629,31 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) GLuint i; if (SWRAST_DEBUG_VERTICES) { - fprintf(stderr, "win %f %f %f %f\n", - v->win[0], v->win[1], v->win[2], v->win[3]); + _mesa_debug(ctx, "win %f %f %f %f\n", + v->win[0], v->win[1], v->win[2], v->win[3]); for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture.Unit[i]._ReallyEnabled) - fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i, - v->texcoord[i][0], v->texcoord[i][1], - v->texcoord[i][2], v->texcoord[i][3]); + _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, + v->texcoord[i][0], v->texcoord[i][1], + v->texcoord[i][2], v->texcoord[i][3]); #if CHAN_TYPE == GL_FLOAT - fprintf(stderr, "color %f %f %f %f\n", - v->color[0], v->color[1], v->color[2], v->color[3]); - fprintf(stderr, "spec %f %f %f %f\n", - v->specular[0], v->specular[1], v->specular[2], v->specular[3]); + _mesa_debug(ctx, "color %f %f %f %f\n", + v->color[0], v->color[1], v->color[2], v->color[3]); + _mesa_debug(ctx, "spec %f %f %f %f\n", + v->specular[0], v->specular[1], + v->specular[2], v->specular[3]); #else - fprintf(stderr, "color %d %d %d %d\n", - v->color[0], v->color[1], v->color[2], v->color[3]); - fprintf(stderr, "spec %d %d %d %d\n", - v->specular[0], v->specular[1], v->specular[2], v->specular[3]); + _mesa_debug(ctx, "color %d %d %d %d\n", + v->color[0], v->color[1], v->color[2], v->color[3]); + _mesa_debug(ctx, "spec %d %d %d %d\n", + v->specular[0], v->specular[1], + v->specular[2], v->specular[3]); #endif - fprintf(stderr, "fog %f\n", v->fog); - fprintf(stderr, "index %d\n", v->index); - fprintf(stderr, "pointsize %f\n", v->pointSize); - fprintf(stderr, "\n"); + _mesa_debug(ctx, "fog %f\n", v->fog); + _mesa_debug(ctx, "index %d\n", v->index); + _mesa_debug(ctx, "pointsize %f\n", v->pointSize); + _mesa_debug(ctx, "\n"); } } diff --git a/xc/extras/Mesa/src/swrast/s_context.h b/xc/extras/Mesa/src/swrast/s_context.h index 79081b809..75b72f3a2 100644 --- a/xc/extras/Mesa/src/swrast/s_context.h +++ b/xc/extras/Mesa/src/swrast/s_context.h @@ -1,10 +1,9 @@ -/* $Id: s_context.h,v 1.1.1.1 2002/10/22 13:06:45 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + */ + +/** + * \file swrast/s_context.h + * \brief fill in description + * \author Keith Whitwell <keith@tungstengraphics.com> */ #ifndef S_CONTEXT_H @@ -38,10 +43,8 @@ */ typedef void (*TextureSampleFunc)( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ); + GLuint n, GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ); @@ -66,25 +69,25 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, const SWvertex *, const SWvertex *); - -/* - * Bitmasks to indicate which rasterization options are enabled (RasterMask) +/** \defgroup Bitmasks + * Bitmasks to indicate which rasterization options are enabled + * (RasterMask) */ -#define ALPHATEST_BIT 0x001 /* Alpha-test pixels */ -#define BLEND_BIT 0x002 /* Blend pixels */ -#define DEPTH_BIT 0x004 /* Depth-test pixels */ -#define FOG_BIT 0x008 /* Fog pixels */ -#define LOGIC_OP_BIT 0x010 /* Apply logic op in software */ -#define SCISSOR_BIT 0x020 /* Scissor pixels */ -#define STENCIL_BIT 0x040 /* Stencil pixels */ -#define MASKING_BIT 0x080 /* Do glColorMask or glIndexMask */ -#define ALPHABUF_BIT 0x100 /* Using software alpha buffer */ -#define WINCLIP_BIT 0x200 /* Clip pixels/primitives to window */ -#define MULTI_DRAW_BIT 0x400 /* Write to more than one color- */ - /* buffer or no buffers. */ -#define OCCLUSION_BIT 0x800 /* GL_HP_occlusion_test enabled */ -#define TEXTURE_BIT 0x1000 /* Texturing really enabled */ - +/*@{*/ +#define ALPHATEST_BIT 0x001 /**< Alpha-test pixels */ +#define BLEND_BIT 0x002 /**< Blend pixels */ +#define DEPTH_BIT 0x004 /**< Depth-test pixels */ +#define FOG_BIT 0x008 /**< Fog pixels */ +#define LOGIC_OP_BIT 0x010 /**< Apply logic op in software */ +#define CLIP_BIT 0x020 /**< Scissor or window clip pixels */ +#define STENCIL_BIT 0x040 /**< Stencil pixels */ +#define MASKING_BIT 0x080 /**< Do glColorMask or glIndexMask */ +#define ALPHABUF_BIT 0x100 /**< Using software alpha buffer */ +#define MULTI_DRAW_BIT 0x400 /**< Write to more than one color- */ + /**< buffer or no buffers. */ +#define OCCLUSION_BIT 0x800 /**< GL_HP_occlusion_test enabled */ +#define TEXTURE_BIT 0x1000 /**< Texturing really enabled */ +/*@}*/ #define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \ _NEW_SCISSOR| \ @@ -97,43 +100,49 @@ typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *, _NEW_DEPTH) - +/** + * \struct SWcontext + * \brief SWContext? + */ typedef struct { - /* Driver interface: + /** Driver interface: */ struct swrast_device_driver Driver; - /* Configuration mechanisms to make software rasterizer match + /** Configuration mechanisms to make software rasterizer match * characteristics of the hardware rasterizer (if present): */ GLboolean AllowVertexFog; GLboolean AllowPixelFog; - /* Derived values, invalidated on statechanges, updated from + /** Derived values, invalidated on statechanges, updated from * _swrast_validate_derived(): */ GLuint _RasterMask; GLfloat _MinMagThresh[MAX_TEXTURE_UNITS]; GLfloat _backface_sign; GLboolean _PreferPixelFog; + GLboolean _AnyTextureCombine; /* Accum buffer temporaries. */ - GLboolean _IntegerAccumMode; /* Storing unscaled integers? */ - GLfloat _IntegerAccumScaler; /* Implicit scale factor */ + GLboolean _IntegerAccumMode; /**< Storing unscaled integers? */ + GLfloat _IntegerAccumScaler; /**< Implicit scale factor */ /* Working values: */ - struct pixel_buffer* PB; - GLuint StippleCounter; /* Line stipple counter */ + GLuint StippleCounter; /**< Line stipple counter */ GLuint NewState; GLuint StateChanges; + GLenum Primitive; /* current primitive being drawn (ala glBegin) */ + GLuint CurrentBuffer; /* exactly one of FRONT_LEFT_BIT, BACK_LEFT_BIT, etc*/ - /* Mechanism to allow driver (like X11) to register further + /** Mechanism to allow driver (like X11) to register further * software rasterization routines. */ + /*@{*/ void (*choose_point)( GLcontext * ); void (*choose_line)( GLcontext * ); void (*choose_triangle)( GLcontext * ); @@ -141,29 +150,50 @@ typedef struct GLuint invalidate_point; GLuint invalidate_line; GLuint invalidate_triangle; + /*@}*/ - - /* Function pointers for dispatch behind public entrypoints. - */ + /** Function pointers for dispatch behind public entrypoints. */ + /*@{*/ void (*InvalidateState)( GLcontext *ctx, GLuint new_state ); swrast_point_func Point; swrast_line_func Line; swrast_tri_func Triangle; + /*@}*/ - /* Placeholders for when separate specular (or secondary color) is + /** + * Placeholders for when separate specular (or secondary color) is * enabled but texturing is not. */ + /*@{*/ swrast_point_func SpecPoint; swrast_line_func SpecLine; swrast_tri_func SpecTriangle; + /*@}*/ + /** + * Typically, we'll allocate a sw_span structure as a local variable + * and set its 'array' pointer to point to this object. The reason is + * this object is big and causes problems when allocated on the stack + * on some systems. + */ + struct span_arrays *SpanArrays; - /* Internal hooks, kept uptodate by the same mechanism as above. + /** + * Used to buffer N GL_POINTS, instead of rendering one by one. + */ + struct sw_span PointSpan; + + /** Internal hooks, kept uptodate by the same mechanism as above. */ blend_func BlendFunc; TextureSampleFunc TextureSample[MAX_TEXTURE_UNITS]; + /** Buffer for saving the sampled texture colors. + * Needed for GL_ARB_texture_env_crossbar implementation. + */ + GLchan *TexelBuffer; + } SWcontext; diff --git a/xc/extras/Mesa/src/swrast/s_copypix.c b/xc/extras/Mesa/src/swrast/s_copypix.c index 10c66ef89..eab359090 100644 --- a/xc/extras/Mesa/src/swrast/s_copypix.c +++ b/xc/extras/Mesa/src/swrast/s_copypix.c @@ -1,8 +1,7 @@ -/* $Id: s_copypix.c,v 1.1.1.1 2002/10/22 13:06:52 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -31,13 +30,12 @@ #include "convolve.h" #include "feedback.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "pixel.h" #include "s_context.h" #include "s_depth.h" -#include "s_fog.h" #include "s_histogram.h" #include "s_pixeltex.h" #include "s_span.h" @@ -67,6 +65,9 @@ regions_overlap(GLint srcx, GLint srcy, else if (srcy < dsty) { /* this is OK */ return GL_FALSE; } + else if (srcy > dsty + height) { + return GL_FALSE; + } else { return GL_TRUE; } @@ -98,32 +99,21 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLdepth zspan[MAX_WIDTH]; - GLfloat fogSpan[MAX_WIDTH]; GLboolean quick_draw; GLint row; GLboolean changeBuffer; - GLchan *saveReadAlpha; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; const GLuint transferOps = ctx->_ImageTransferState; GLfloat *dest, *tmpImage, *convImage; + struct sw_span span; - if (ctx->Depth.Test || ctx->Fog.Enabled) { - /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); - GLfloat fog; - GLint i; + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); - for (i = 0; i < width; i++) { - zspan[i] = z; - fogSpan[i] = fog; - } - } if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom @@ -136,7 +126,6 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } /* If read and draw buffer are different we must do buffer switching */ - saveReadAlpha = ctx->ReadBuffer->Alpha; changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer || ctx->DrawBuffer != ctx->ReadBuffer; @@ -157,16 +146,8 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, dest = tmpImage; if (changeBuffer) { - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT) - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha; - else if (ctx->Pixel.DriverReadBuffer == GL_BACK_LEFT) - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackLeftAlpha; - else if (ctx->Pixel.DriverReadBuffer == GL_FRONT_RIGHT) - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontRightAlpha; - else - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackRightAlpha; + /* choose the read buffer */ + _swrast_use_read_buffer(ctx); } /* read source image */ @@ -184,11 +165,9 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } } - /* read from the draw buffer again (in case of blending) */ if (changeBuffer) { - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); - ctx->ReadBuffer->Alpha = saveReadAlpha; + /* restore default src/dst buffer */ + _swrast_use_draw_buffer(ctx); } /* do image transfer ops up until convolution */ @@ -251,7 +230,6 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, for (row = 0; row < height; row++) { const GLfloat *src = convImage + row * width * 4; - GLchan rgba[MAX_WIDTH][4]; GLint i, dy; /* clamp to [0,1] and convert float back to chan */ @@ -260,27 +238,15 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint g = (GLint) (src[i * 4 + GCOMP] * CHAN_MAXF); GLint b = (GLint) (src[i * 4 + BCOMP] * CHAN_MAXF); GLint a = (GLint) (src[i * 4 + ACOMP] * CHAN_MAXF); - rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); - rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); - rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); - rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); - } - - if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { - GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; - GLchan primary_rgba[MAX_WIDTH][4]; - GLuint unit; - /* XXX not sure how multitexture is supposed to work here */ - - MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); - - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, - s, t, r, q); - _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL, - (CONST GLchan (*)[4]) primary_rgba, - rgba); - } + span.array->rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + span.array->rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + span.array->rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); + span.array->rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); + } + + if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { + span.end = width; + _swrast_pixel_texture(ctx, &span); } /* write row to framebuffer */ @@ -288,15 +254,21 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, dy = desty + row; if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy, - (const GLchan (*)[4])rgba, NULL ); + (const GLchan (*)[4])span.array->rgba, NULL ); } else if (zoom) { - _mesa_write_zoomed_rgba_span( ctx, width, destx, dy, zspan, fogSpan, - (const GLchan (*)[4])rgba, desty); + span.x = destx; + span.y = dy; + span.end = width; + _mesa_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4])span.array->rgba, + desty); } else { - _mesa_write_rgba_span( ctx, width, destx, dy, zspan, fogSpan, rgba, - NULL, GL_BITMAP ); + span.x = destx; + span.y = dy; + span.end = width; + _mesa_write_rgba_span(ctx, &span); } } @@ -312,18 +284,16 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLdepth zspan[MAX_WIDTH]; - GLfloat fogSpan[MAX_WIDTH]; - GLchan rgba[MAX_WIDTH][4]; GLchan *tmpImage,*p; GLboolean quick_draw; - GLint sy, dy, stepy; - GLint i, j; + GLint sy, dy, stepy, j; GLboolean changeBuffer; - GLchan *saveReadAlpha; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; const GLuint transferOps = ctx->_ImageTransferState; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) { copy_conv_rgba_pixels(ctx, srcx, srcy, width, height, destx, desty); @@ -347,21 +317,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - if (ctx->Depth.Test || ctx->Fog.Enabled) { - /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); - GLfloat fog; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - - for (i=0;i<width;i++) { - zspan[i] = z; - fogSpan[i] = fog; - } - } + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom @@ -374,13 +333,9 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } /* If read and draw buffer are different we must do buffer switching */ - saveReadAlpha = ctx->ReadBuffer->Alpha; changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer || ctx->DrawBuffer != ctx->ReadBuffer; - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - if (overlapping) { GLint ssy = sy; tmpImage = (GLchan *) MALLOC(width * height * sizeof(GLchan) * 4); @@ -388,25 +343,22 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); return; } + /* setup source */ + if (changeBuffer) + _swrast_use_read_buffer(ctx); + /* read the source image */ p = tmpImage; - if (changeBuffer) { - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT) - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha; - else if (ctx->Pixel.DriverReadBuffer == GL_BACK_LEFT) - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackLeftAlpha; - else if (ctx->Pixel.DriverReadBuffer == GL_FRONT_RIGHT) - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontRightAlpha; - else - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackRightAlpha; - } for (j = 0; j < height; j++, ssy += stepy) { _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, ssy, (GLchan (*)[4]) p ); p += width * 4; } p = tmpImage; + /* restore dest */ + if (changeBuffer) { + _swrast_use_draw_buffer(ctx); + changeBuffer = GL_FALSE; + } } else { tmpImage = NULL; /* silence compiler warnings */ @@ -417,35 +369,17 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, /* Get source pixels */ if (overlapping) { /* get from buffered image */ - MEMCPY(rgba, p, width * sizeof(GLchan) * 4); + MEMCPY(span.array->rgba, p, width * sizeof(GLchan) * 4); p += width * 4; } else { /* get from framebuffer */ - if (changeBuffer) { - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT) { - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha; - } - else if (ctx->Pixel.DriverReadBuffer == GL_BACK_LEFT) { - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackLeftAlpha; - } - else if (ctx->Pixel.DriverReadBuffer == GL_FRONT_RIGHT) { - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontRightAlpha; - } - else { - ctx->ReadBuffer->Alpha = ctx->ReadBuffer->BackRightAlpha; - } - } - _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, rgba ); - } - - if (changeBuffer) { - /* read from the draw buffer again (in case of blending) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); - ctx->ReadBuffer->Alpha = saveReadAlpha; + if (changeBuffer) + _swrast_use_read_buffer(ctx); + _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, srcx, sy, + span.array->rgba ); + if (changeBuffer) + _swrast_use_draw_buffer(ctx); } if (transferOps) { @@ -456,10 +390,10 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, /* convert chan to float */ for (k = 0; k < width; k++) { - rgbaFloat[k][RCOMP] = (GLfloat) rgba[k][RCOMP] * scale; - rgbaFloat[k][GCOMP] = (GLfloat) rgba[k][GCOMP] * scale; - rgbaFloat[k][BCOMP] = (GLfloat) rgba[k][BCOMP] * scale; - rgbaFloat[k][ACOMP] = (GLfloat) rgba[k][ACOMP] * scale; + rgbaFloat[k][RCOMP] = (GLfloat) span.array->rgba[k][RCOMP] * scale; + rgbaFloat[k][GCOMP] = (GLfloat) span.array->rgba[k][GCOMP] * scale; + rgbaFloat[k][BCOMP] = (GLfloat) span.array->rgba[k][BCOMP] * scale; + rgbaFloat[k][ACOMP] = (GLfloat) span.array->rgba[k][ACOMP] * scale; } /* scale & bias */ if (transferOps & IMAGE_SCALE_BIAS_BIT) { @@ -479,7 +413,8 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, } /* convolution */ if (transferOps & IMAGE_CONVOLUTION_BIT) { - /* XXX to do */ + _mesa_problem(ctx, "Convolution should not be enabled in copy_rgba_pixels()"); + return; } /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */ if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) { @@ -519,61 +454,39 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint g = (GLint) (rgbaFloat[k][GCOMP] * CHAN_MAXF); GLint b = (GLint) (rgbaFloat[k][BCOMP] * CHAN_MAXF); GLint a = (GLint) (rgbaFloat[k][ACOMP] * CHAN_MAXF); - rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); - rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); - rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); - rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); + span.array->rgba[k][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + span.array->rgba[k][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + span.array->rgba[k][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); + span.array->rgba[k][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); } UNDEFARRAY(rgbaFloat); /* mac 32k limitation */ } - if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { - GLuint unit; - GLchan primary_rgba[MAX_WIDTH][4]; - DEFARRAY(GLfloat, s, MAX_WIDTH); /* mac 32k limitation */ - DEFARRAY(GLfloat, t, MAX_WIDTH); /* mac 32k limitation */ - DEFARRAY(GLfloat, r, MAX_WIDTH); /* mac 32k limitation */ - DEFARRAY(GLfloat, q, MAX_WIDTH); /* mac 32k limitation */ - CHECKARRAY(s, return); /* mac 32k limitation */ - CHECKARRAY(t, return); - CHECKARRAY(r, return); - CHECKARRAY(q, return); - - /* XXX not sure how multitexture is supposed to work here */ - MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); - - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, - s, t, r, q); - _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL, - (CONST GLchan (*)[4]) primary_rgba, - rgba); - } - - UNDEFARRAY(s); /* mac 32k limitation */ - UNDEFARRAY(t); - UNDEFARRAY(r); - UNDEFARRAY(q); + if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { + span.end = width; + _swrast_pixel_texture(ctx, &span); } if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) { (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy, - (const GLchan (*)[4])rgba, NULL ); + (const GLchan (*)[4])span.array->rgba, NULL ); } else if (zoom) { - _mesa_write_zoomed_rgba_span( ctx, width, destx, dy, zspan, fogSpan, - (const GLchan (*)[4])rgba, desty); + span.x = destx; + span.y = dy; + span.end = width; + _mesa_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, + desty); } else { - _mesa_write_rgba_span( ctx, width, destx, dy, zspan, fogSpan, rgba, - NULL, GL_BITMAP ); + span.x = destx; + span.y = dy; + span.end = width; + _mesa_write_rgba_span(ctx, &span); } } - /* Restore pixel source to be the draw buffer (for blending, etc) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); - if (overlapping) FREE(tmpImage); } @@ -583,16 +496,16 @@ static void copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty ) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLdepth zspan[MAX_WIDTH]; - GLfloat fogSpan[MAX_WIDTH]; GLuint *tmpImage,*p; GLint sy, dy, stepy; - GLint i, j; + GLint j; GLboolean changeBuffer; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; GLint overlapping; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX); /* Determine if copy should be bottom-to-top or top-to-bottom */ if (srcy<desty) { @@ -611,29 +524,15 @@ static void copy_ci_pixels( GLcontext *ctx, overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - if (ctx->Depth.Test || ctx->Fog.Enabled) { - /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMax); - GLfloat fog; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - - for (i=0;i<width;i++) { - zspan[i] = z; - fogSpan[i] = fog; - } - } + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); /* If read and draw buffer are different we must do buffer switching */ changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer || ctx->DrawBuffer != ctx->ReadBuffer; - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - if (overlapping) { GLint ssy = sy; tmpImage = (GLuint *) MALLOC(width * height * sizeof(GLuint)); @@ -641,16 +540,21 @@ static void copy_ci_pixels( GLcontext *ctx, _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); return; } + /* setup source */ + if (changeBuffer) + _swrast_use_read_buffer(ctx); + /* read the image */ p = tmpImage; - if (changeBuffer) { - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - } for (j = 0; j < height; j++, ssy += stepy) { _mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, ssy, p ); p += width; } p = tmpImage; + /* restore to draw buffer */ + if (changeBuffer) { + _swrast_use_draw_buffer(ctx); + changeBuffer = GL_FALSE; + } } else { tmpImage = NULL; /* silence compiler warning */ @@ -658,46 +562,35 @@ static void copy_ci_pixels( GLcontext *ctx, } for (j = 0; j < height; j++, sy += stepy, dy += stepy) { - GLuint indexes[MAX_WIDTH]; if (overlapping) { - MEMCPY(indexes, p, width * sizeof(GLuint)); + MEMCPY(span.array->index, p, width * sizeof(GLuint)); p += width; } else { - if (changeBuffer) { - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); - } - _mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy, indexes ); - } - - if (changeBuffer) { - /* set read buffer back to draw buffer (in case of logicops) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); + if (changeBuffer) + _swrast_use_read_buffer(ctx); + _mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy, + span.array->index ); + if (changeBuffer) + _swrast_use_draw_buffer(ctx); } if (shift_or_offset) { - _mesa_shift_and_offset_ci( ctx, width, indexes ); + _mesa_shift_and_offset_ci( ctx, width, span.array->index ); } if (ctx->Pixel.MapColorFlag) { - _mesa_map_ci( ctx, width, indexes ); + _mesa_map_ci( ctx, width, span.array->index ); } - if (zoom) { - _mesa_write_zoomed_index_span(ctx, width, destx, dy, zspan, fogSpan, - indexes, desty ); - } - else { - _mesa_write_index_span(ctx, width, destx, dy, zspan, fogSpan, indexes, - NULL, GL_BITMAP); - } + span.x = destx; + span.y = dy; + span.end = width; + if (zoom) + _mesa_write_zoomed_index_span(ctx, &span, desty); + else + _mesa_write_index_span(ctx, &span); } - /* Restore pixel source to be the draw buffer (for blending, etc) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); - if (overlapping) FREE(tmpImage); } @@ -712,20 +605,17 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, GLint destx, GLint desty ) { GLfloat depth[MAX_WIDTH]; - GLdepth zspan[MAX_WIDTH]; - GLfloat fogSpan[MAX_WIDTH]; GLfloat *p, *tmpImage; - GLuint indexes[MAX_WIDTH]; GLint sy, dy, stepy; GLint i, j; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; - DEFMARRAY(GLchan, rgba, MAX_WIDTH, 4); /* mac 32k limitation */ - CHECKARRAY(rgba, return); /* mac 32k limitation */ + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z); if (!ctx->Visual.depthBits) { _mesa_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); - UNDEFARRAY(rgba); /* mac 32k limitation */ return; } @@ -746,39 +636,15 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, overlapping = regions_overlap(srcx, srcy, destx, desty, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY); - /* setup colors or indexes */ - if (ctx->Visual.rgbMode) { - GLuint *rgba32 = (GLuint *) rgba; - GLuint color = *(GLuint*)( ctx->Current.Color ); - for (i = 0; i < width; i++) { - rgba32[i] = color; - } - } - else { - for (i = 0; i < width; i++) { - indexes[i] = ctx->Current.Index; - } - } - - if (ctx->Fog.Enabled) { - GLfloat fog; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - - for (i = 0; i < width; i++) { - fogSpan[i] = fog; - } - } + _mesa_span_default_color(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); if (overlapping) { GLint ssy = sy; tmpImage = (GLfloat *) MALLOC(width * height * sizeof(GLfloat)); if (!tmpImage) { _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" ); - UNDEFARRAY(rgba); /* mac 32k limitation */ return; } p = tmpImage; @@ -804,33 +670,28 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, for (i = 0; i < width; i++) { GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; - zspan[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax); + span.array->z[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->DepthMax); } + span.x = destx; + span.y = dy; + span.end = width; if (ctx->Visual.rgbMode) { - if (zoom) { - _mesa_write_zoomed_rgba_span( ctx, width, destx, dy, zspan, - fogSpan, (const GLchan (*)[4])rgba, desty ); - } - else { - _mesa_write_rgba_span( ctx, width, destx, dy, zspan, fogSpan, - (GLchan (*)[4])rgba, NULL, GL_BITMAP); - } + if (zoom) + _mesa_write_zoomed_rgba_span( ctx, &span, + (const GLchan (*)[4])span.array->rgba, + desty ); + else + _mesa_write_rgba_span(ctx, &span); } else { - if (zoom) { - _mesa_write_zoomed_index_span( ctx, width, destx, dy, - zspan, fogSpan, indexes, desty ); - } - else { - _mesa_write_index_span( ctx, width, destx, dy, - zspan, fogSpan, indexes, NULL, GL_BITMAP ); - } + if (zoom) + _mesa_write_zoomed_index_span( ctx, &span, desty ); + else + _mesa_write_index_span(ctx, &span); } } - UNDEFARRAY(rgba); /* mac 32k limitation */ - if (overlapping) FREE(tmpImage); } diff --git a/xc/extras/Mesa/src/swrast/s_depth.c b/xc/extras/Mesa/src/swrast/s_depth.c index 76ef0d9cb..d3279d634 100644 --- a/xc/extras/Mesa/src/swrast/s_depth.c +++ b/xc/extras/Mesa/src/swrast/s_depth.c @@ -1,8 +1,7 @@ -/* $Id: s_depth.c,v 1.1.1.1 2002/10/22 13:06:45 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -28,25 +27,24 @@ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "s_depth.h" #include "s_context.h" -#include "s_pb.h" - - -/* +/** * Return address of depth buffer value for given window coord. */ GLvoid * _mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y) { if (ctx->Visual.depthBits <= 16) - return (GLushort *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x; + return (GLushort *) ctx->DrawBuffer->DepthBuffer + + ctx->DrawBuffer->Width * y + x; else - return (GLuint *) ctx->DrawBuffer->DepthBuffer + ctx->DrawBuffer->Width * y + x; + return (GLuint *) ctx->DrawBuffer->DepthBuffer + + ctx->DrawBuffer->Width * y + x; } @@ -73,7 +71,7 @@ _mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y) * Return: number of fragments which pass the test. */ static GLuint -depth_test_span16( GLcontext *ctx, GLuint n, GLint x, GLint y, +depth_test_span16( GLcontext *ctx, GLuint n, GLushort zbuffer[], const GLdepth z[], GLubyte mask[] ) { GLuint passed = 0; @@ -291,7 +289,7 @@ depth_test_span16( GLcontext *ctx, GLuint n, GLint x, GLint y, } break; case GL_NEVER: - BZERO(mask, n * sizeof(GLubyte)); + _mesa_bzero(mask, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in depth_test_span16"); @@ -302,7 +300,7 @@ depth_test_span16( GLcontext *ctx, GLuint n, GLint x, GLint y, static GLuint -depth_test_span32( GLcontext *ctx, GLuint n, GLint x, GLint y, +depth_test_span32( GLcontext *ctx, GLuint n, GLuint zbuffer[], const GLdepth z[], GLubyte mask[] ) { GLuint passed = 0; @@ -520,7 +518,7 @@ depth_test_span32( GLcontext *ctx, GLuint n, GLint x, GLint y, } break; case GL_NEVER: - BZERO(mask, n * sizeof(GLubyte)); + _mesa_bzero(mask, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in depth_test_span32"); @@ -534,33 +532,59 @@ depth_test_span32( GLcontext *ctx, GLuint n, GLint x, GLint y, /* * Apply depth test to span of fragments. Hardware or software z buffer. */ -GLuint -_mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLubyte mask[] ) +static GLuint +depth_test_span( GLcontext *ctx, struct sw_span *span) { + const GLint x = span->x; + const GLint y = span->y; + const GLuint n = span->end; SWcontext *swrast = SWRAST_CONTEXT(ctx); + + ASSERT((span->arrayMask & SPAN_XY) == 0); + ASSERT(span->arrayMask & SPAN_Z); + if (swrast->Driver.ReadDepthSpan) { /* hardware-based depth buffer */ GLdepth zbuffer[MAX_WIDTH]; GLuint passed; (*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer); - passed = depth_test_span32(ctx, n, x, y, zbuffer, z, mask); - assert(swrast->Driver.WriteDepthSpan); - (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, mask); + passed = depth_test_span32(ctx, n, zbuffer, span->array->z, + span->array->mask); + ASSERT(swrast->Driver.WriteDepthSpan); + (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, + span->array->mask); + if (passed < n) + span->writeAll = GL_FALSE; return passed; } else { + GLuint passed; /* software depth buffer */ if (ctx->Visual.depthBits <= 16) { GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y); - GLuint passed = depth_test_span16(ctx, n, x, y, zptr, z, mask); - return passed; + passed = depth_test_span16(ctx, n, zptr, span->array->z, span->array->mask); } else { GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, x, y); - GLuint passed = depth_test_span32(ctx, n, x, y, zptr, z, mask); - return passed; + passed = depth_test_span32(ctx, n, zptr, span->array->z, span->array->mask); } +#if 1 + if (passed < span->end) { + span->writeAll = GL_FALSE; + } +#else + /* this causes a glDrawPixels(GL_DEPTH_COMPONENT) conformance failure */ + if (passed < span->end) { + span->writeAll = GL_FALSE; + if (passed == 0) { + span->end = 0; + return 0; + } + while (span->end > 0 && span->mask[span->end - 1] == 0) + span->end --; + } +#endif + return passed; } } @@ -804,7 +828,7 @@ software_depth_test_pixels16( GLcontext *ctx, GLuint n, break; case GL_NEVER: /* depth test never passes */ - BZERO(mask, n * sizeof(GLubyte)); + _mesa_bzero(mask, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in software_depth_test_pixels"); @@ -1050,7 +1074,7 @@ software_depth_test_pixels32( GLcontext *ctx, GLuint n, break; case GL_NEVER: /* depth test never passes */ - BZERO(mask, n * sizeof(GLubyte)); + _mesa_bzero(mask, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in software_depth_test_pixels"); @@ -1284,7 +1308,7 @@ hardware_depth_test_pixels( GLcontext *ctx, GLuint n, GLdepth zbuffer[], break; case GL_NEVER: /* depth test never passes */ - BZERO(mask, n * sizeof(GLubyte)); + _mesa_bzero(mask, n * sizeof(GLubyte)); break; default: _mesa_problem(ctx, "Bad depth func in hardware_depth_test_pixels"); @@ -1293,15 +1317,19 @@ hardware_depth_test_pixels( GLcontext *ctx, GLuint n, GLdepth zbuffer[], -void -_mesa_depth_test_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth z[], GLubyte mask[] ) +static GLuint +depth_test_pixels( GLcontext *ctx, struct sw_span *span ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint n = span->end; + const GLint *x = span->array->x; + const GLint *y = span->array->y; + const GLdepth *z = span->array->z; + GLubyte *mask = span->array->mask; + if (swrast->Driver.ReadDepthPixels) { /* read depth values from hardware Z buffer */ - GLdepth zbuffer[PB_SIZE]; + GLdepth zbuffer[MAX_WIDTH]; (*swrast->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer); hardware_depth_test_pixels( ctx, n, zbuffer, z, mask ); @@ -1317,9 +1345,22 @@ _mesa_depth_test_pixels( GLcontext *ctx, else software_depth_test_pixels32(ctx, n, x, y, z, mask); } + return n; /* not really correct, but OK */ } +/** + * Apply depth (Z) buffer testing to the span. + * \return approx number of pixels that passed (only zero is reliable) + */ +GLuint +_mesa_depth_test_span( GLcontext *ctx, struct sw_span *span) +{ + if (span->arrayMask & SPAN_XY) + return depth_test_pixels(ctx, span); + else + return depth_test_span(ctx, span); +} @@ -1328,7 +1369,7 @@ _mesa_depth_test_pixels( GLcontext *ctx, /**********************************************************************/ -/* +/** * Read a span of depth values from the depth buffer. * This function does clipping before calling the device driver function. */ @@ -1339,7 +1380,7 @@ _mesa_read_depth_span( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || - x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { + x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { /* span is completely outside framebuffer */ GLint i; for (i = 0; i < n; i++) @@ -1390,7 +1431,7 @@ _mesa_read_depth_span( GLcontext *ctx, } else { /* no depth buffer */ - BZERO(depth, n * sizeof(GLfloat)); + _mesa_bzero(depth, n * sizeof(GLfloat)); } } @@ -1398,7 +1439,7 @@ _mesa_read_depth_span( GLcontext *ctx, -/* +/** * Return a span of depth values from the depth buffer as floats in [0,1]. * This is used for both hardware and software depth buffers. * Input: n - how many pixels @@ -1413,7 +1454,7 @@ _mesa_read_depth_span_float( GLcontext *ctx, const GLfloat scale = 1.0F / ctx->DepthMaxF; if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || - x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { + x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { /* span is completely outside framebuffer */ GLint i; for (i = 0; i < n; i++) @@ -1469,7 +1510,7 @@ _mesa_read_depth_span_float( GLcontext *ctx, } else { /* no depth buffer */ - BZERO(depth, n * sizeof(GLfloat)); + _mesa_bzero(depth, n * sizeof(GLfloat)); } } @@ -1481,9 +1522,10 @@ _mesa_read_depth_span_float( GLcontext *ctx, -/* +/** * Allocate a new depth buffer. If there's already a depth buffer allocated * it will be free()'d. The new depth buffer will be uniniitalized. + * This function is only called through Driver.alloc_depth_buffer. */ void _mesa_alloc_depth_buffer( GLframebuffer *buffer ) @@ -1504,7 +1546,8 @@ _mesa_alloc_depth_buffer( GLframebuffer *buffer ) else bytesPerValue = sizeof(GLuint); - buffer->DepthBuffer = MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height * bytesPerValue); + buffer->DepthBuffer = MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height + * bytesPerValue); if (!buffer->DepthBuffer) { /* out of memory */ @@ -1518,9 +1561,7 @@ _mesa_alloc_depth_buffer( GLframebuffer *buffer ) } - - -/* +/** * Clear the depth buffer. If the depth buffer doesn't exist yet we'll * allocate it now. * This function is only called through Driver.clear_depth_buffer. @@ -1578,7 +1619,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->DepthMax); if ((clearValue & 0xff) == (clearValue >> 8)) { if (clearValue == 0) { - BZERO(ctx->DrawBuffer->DepthBuffer, + _mesa_bzero(ctx->DrawBuffer->DepthBuffer, 2*ctx->DrawBuffer->Width*ctx->DrawBuffer->Height); } else { @@ -1612,7 +1653,7 @@ _mesa_clear_depth_buffer( GLcontext *ctx ) /* >16 bit depth buffer */ const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->DepthMax); if (clearValue == 0) { - BZERO(ctx->DrawBuffer->DepthBuffer, + _mesa_bzero(ctx->DrawBuffer->DepthBuffer, ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint)); } else { diff --git a/xc/extras/Mesa/src/swrast/s_depth.h b/xc/extras/Mesa/src/swrast/s_depth.h index 9f04d727b..f1bd65e3a 100644 --- a/xc/extras/Mesa/src/swrast/s_depth.h +++ b/xc/extras/Mesa/src/swrast/s_depth.h @@ -1,8 +1,7 @@ -/* $Id: s_depth.h,v 1.1.1.1 2002/10/22 13:06:46 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -37,14 +36,10 @@ extern GLvoid * _mesa_zbuffer_address(GLcontext *ctx, GLint x, GLint y); + extern GLuint -_mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLubyte mask[] ); +_mesa_depth_test_span( GLcontext *ctx, struct sw_span *span); -extern void -_mesa_depth_test_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth z[], GLubyte mask[] ); extern void diff --git a/xc/extras/Mesa/src/swrast/s_drawpix.c b/xc/extras/Mesa/src/swrast/s_drawpix.c index 7f5ed8077..3bcee0fc6 100644 --- a/xc/extras/Mesa/src/swrast/s_drawpix.c +++ b/xc/extras/Mesa/src/swrast/s_drawpix.c @@ -1,8 +1,7 @@ -/* $Id: s_drawpix.c,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -31,13 +30,12 @@ #include "convolve.h" #include "image.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "pixel.h" #include "s_context.h" #include "s_drawpix.h" -#include "s_fog.h" #include "s_pixeltex.h" #include "s_span.h" #include "s_stencil.h" @@ -103,15 +101,23 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_pixelstore_attrib *unpack = &ctx->Unpack; - GLchan rgb[MAX_WIDTH][3]; - GLchan rgba[MAX_WIDTH][4]; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (!ctx->Current.RasterPosValid) { return GL_TRUE; /* no-op */ } - if ((SWRAST_CONTEXT(ctx)->_RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0 - && ctx->Texture._ReallyEnabled == 0 + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledUnits) + _mesa_span_default_texcoords(ctx, &span); + + if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0 + && ctx->Texture._EnabledUnits == 0 && unpack->Alignment == 1 && !unpack->SwapBytes && !unpack->LsbFirst) { @@ -232,8 +238,11 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, /* with zooming */ GLint row; for (row=0; row<drawHeight; row++) { - _mesa_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, - zSpan, 0, (CONST GLchan (*)[4]) src, zoomY0); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _mesa_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) src, zoomY0); src += rowLength * 4; destY++; } @@ -269,8 +278,11 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, /* with zooming */ GLint row; for (row=0; row<drawHeight; row++) { - _mesa_write_zoomed_rgb_span(ctx, drawWidth, destX, destY, - zSpan, 0, (CONST GLchan (*)[3]) src, zoomY0); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _mesa_write_zoomed_rgb_span(ctx, &span, + (CONST GLchan (*)[3]) src, zoomY0); src += rowLength * 3; destY++; } @@ -290,12 +302,12 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, for (row=0; row<drawHeight; row++) { GLint i; for (i=0;i<drawWidth;i++) { - rgb[i][0] = src[i]; - rgb[i][1] = src[i]; - rgb[i][2] = src[i]; + span.array->rgb[i][0] = src[i]; + span.array->rgb[i][1] = src[i]; + span.array->rgb[i][2] = src[i]; } (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY, - (CONST GLchan (*)[3]) rgb, NULL); + (CONST GLchan (*)[3]) span.array->rgb, NULL); src += rowLength; destY++; } @@ -307,13 +319,13 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, for (row=0; row<drawHeight; row++) { GLint i; for (i=0;i<drawWidth;i++) { - rgb[i][0] = src[i]; - rgb[i][1] = src[i]; - rgb[i][2] = src[i]; + span.array->rgb[i][0] = src[i]; + span.array->rgb[i][1] = src[i]; + span.array->rgb[i][2] = src[i]; } destY--; (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY, - (CONST GLchan (*)[3]) rgb, NULL); + (CONST GLchan (*)[3]) span.array->rgb, NULL); src += rowLength; } } @@ -324,12 +336,15 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, for (row=0; row<drawHeight; row++) { GLint i; for (i=0;i<drawWidth;i++) { - rgb[i][0] = src[i]; - rgb[i][1] = src[i]; - rgb[i][2] = src[i]; + span.array->rgb[i][0] = src[i]; + span.array->rgb[i][1] = src[i]; + span.array->rgb[i][2] = src[i]; } - _mesa_write_zoomed_rgb_span(ctx, drawWidth, destX, destY, - zSpan, 0, (CONST GLchan (*)[3]) rgb, zoomY0); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _mesa_write_zoomed_rgb_span(ctx, &span, + (CONST GLchan (*)[3]) span.array->rgb, zoomY0); src += rowLength; destY++; } @@ -350,13 +365,13 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint i; GLchan *ptr = src; for (i=0;i<drawWidth;i++) { - rgba[i][0] = *ptr; - rgba[i][1] = *ptr; - rgba[i][2] = *ptr++; - rgba[i][3] = *ptr++; + span.array->rgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; } (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, - (CONST GLchan (*)[4]) rgba, NULL); + (CONST GLchan (*)[4]) span.array->rgba, NULL); src += rowLength*2; destY++; } @@ -369,14 +384,14 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint i; GLchan *ptr = src; for (i=0;i<drawWidth;i++) { - rgba[i][0] = *ptr; - rgba[i][1] = *ptr; - rgba[i][2] = *ptr++; - rgba[i][3] = *ptr++; + span.array->rgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; } destY--; (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, - (CONST GLchan (*)[4]) rgba, NULL); + (CONST GLchan (*)[4]) span.array->rgba, NULL); src += rowLength*2; } } @@ -388,13 +403,16 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLchan *ptr = src; GLint i; for (i=0;i<drawWidth;i++) { - rgba[i][0] = *ptr; - rgba[i][1] = *ptr; - rgba[i][2] = *ptr++; - rgba[i][3] = *ptr++; + span.array->rgba[i][0] = *ptr; + span.array->rgba[i][1] = *ptr; + span.array->rgba[i][2] = *ptr++; + span.array->rgba[i][3] = *ptr++; } - _mesa_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, - zSpan, 0, (CONST GLchan (*)[4]) rgba, zoomY0); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _mesa_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, zoomY0); src += rowLength*2; destY++; } @@ -411,10 +429,9 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { ASSERT(drawWidth < MAX_WIDTH); - _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, - (const GLchan (*)[4]) rgba, - NULL); + (const GLchan (*)[4]) span.array->rgba, NULL); src += rowLength; destY++; } @@ -425,11 +442,10 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { ASSERT(drawWidth < MAX_WIDTH); - _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); destY--; (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, - (CONST GLchan (*)[4]) rgba, - NULL); + (CONST GLchan (*)[4]) span.array->rgba, NULL); src += rowLength; } return GL_TRUE; @@ -439,9 +455,12 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { ASSERT(drawWidth < MAX_WIDTH); - _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); - _mesa_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, - zSpan, 0, (CONST GLchan (*)[4]) rgba, zoomY0); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, span.array->rgba); + span.x = destX; + span.y = destY; + span.end = drawWidth; + _mesa_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, zoomY0); src += rowLength; destY++; } @@ -489,47 +508,33 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, { const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; const GLint desty = y; - GLint row, drawWidth; - GLdepth zspan[MAX_WIDTH]; - GLfloat fogSpan[MAX_WIDTH]; + GLint row, drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; + struct sw_span span; - drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; - - /* Fragment depth values */ - if (ctx->Depth.Test || ctx->Fog.Enabled) { - GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF); - GLfloat fog; - GLint i; + INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_INDEX); - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - - for (i = 0; i < drawWidth; i++) { - zspan[i] = zval; - fogSpan[i] = fog; - } - } + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); /* * General solution */ for (row = 0; row < height; row++, y++) { - GLuint indexes[MAX_WIDTH]; const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); - _mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes, + _mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, + span.array->index, type, source, &ctx->Unpack, ctx->_ImageTransferState); - if (zoom) { - _mesa_write_zoomed_index_span(ctx, drawWidth, x, y, zspan, fogSpan, - indexes, desty); - } - else { - _mesa_write_index_span(ctx, drawWidth, x, y, zspan, fogSpan, indexes, - NULL, GL_BITMAP); - } + span.x = x; + span.y = y; + span.end = drawWidth; + if (zoom) + _mesa_write_zoomed_index_span(ctx, &span, desty); + else + _mesa_write_index_span(ctx, &span); } } @@ -594,7 +599,6 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, } - /* * Do a glDrawPixels of depth values. */ @@ -606,9 +610,10 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, const GLboolean bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; const GLint desty = y; - GLchan rgba[MAX_WIDTH][4]; - GLuint ispan[MAX_WIDTH]; GLint drawWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, drawWidth, 0, SPAN_Z); if (type != GL_BYTE && type != GL_UNSIGNED_BYTE @@ -621,62 +626,53 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, return; } - /* Colors or indexes */ - if (ctx->Visual.rgbMode) { - GLint i; - GLint r, g, b, a; - UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); - UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]); - UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]); - UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]); - for (i = 0; i < drawWidth; i++) { - rgba[i][RCOMP] = r; - rgba[i][GCOMP] = g; - rgba[i][BCOMP] = b; - rgba[i][ACOMP] = a; - } - } - else { - GLint i; - for (i = 0; i < drawWidth; i++) { - ispan[i] = ctx->Current.RasterIndex; - } - } + _mesa_span_default_color(ctx, &span); + + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledUnits) + _mesa_span_default_texcoords(ctx, &span); if (type==GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16 && !bias_or_scale && !zoom && ctx->Visual.rgbMode) { /* Special case: directly write 16-bit depth values */ GLint row; - for (row = 0; row < height; row++, y++) { - GLdepth zspan[MAX_WIDTH]; + span.x = x; + span.y = y; + span.end = drawWidth; + for (row = 0; row < height; row++, span.y++) { const GLushort *zptr = (const GLushort *) _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); GLint i; - for (i = 0; i < width; i++) - zspan[i] = zptr[i]; - _mesa_write_rgba_span(ctx, width, x, y, zspan, 0, rgba, - NULL, GL_BITMAP); + for (i = 0; i < drawWidth; i++) + span.array->z[i] = zptr[i]; + _mesa_write_rgba_span(ctx, &span); } } else if (type==GL_UNSIGNED_INT && ctx->Visual.depthBits == 32 && !bias_or_scale && !zoom && ctx->Visual.rgbMode) { /* Special case: directly write 32-bit depth values */ GLint row; - for (row = 0; row < height; row++, y++) { + span.x = x; + span.y = y; + span.end = drawWidth; + for (row = 0; row < height; row++, span.y++) { const GLuint *zptr = (const GLuint *) _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); - _mesa_write_rgba_span(ctx, width, x, y, zptr, 0, rgba, - NULL, GL_BITMAP); + MEMCPY(span.array->z, zptr, drawWidth * sizeof(GLdepth)); + _mesa_write_rgba_span(ctx, &span); } } else { /* General case */ GLint row; - for (row = 0; row < height; row++, y++) { + span.x = x; + span.y = y; + span.end = drawWidth; + for (row = 0; row < height; row++, span.y++) { GLfloat fspan[MAX_WIDTH]; - GLdepth zspan[MAX_WIDTH]; const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); _mesa_unpack_depth_span( ctx, drawWidth, fspan, type, src, @@ -686,31 +682,23 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, const GLfloat zs = ctx->DepthMaxF; GLint i; for (i = 0; i < drawWidth; i++) { - zspan[i] = (GLdepth) (fspan[i] * zs + 0.5F); + span.array->z[i] = (GLdepth) (fspan[i] * zs + 0.5F); } } - if (ctx->Visual.rgbMode) { if (zoom) { - _mesa_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0, - (const GLchan (*)[4]) rgba, desty); - } - else { - _mesa_write_rgba_span(ctx, width, x, y, zspan, 0, - rgba, NULL, GL_BITMAP); + _mesa_write_zoomed_rgba_span(ctx, &span, + (const GLchan (*)[4]) span.array->rgba, desty); } + else + _mesa_write_rgba_span(ctx, &span); } else { - if (zoom) { - _mesa_write_zoomed_index_span(ctx, width, x, y, zspan, 0, - ispan, GL_BITMAP); - } - else { - _mesa_write_index_span(ctx, width, x, y, zspan, 0, - ispan, NULL, GL_BITMAP); - } + if (zoom) + _mesa_write_zoomed_index_span(ctx, &span, desty); + else + _mesa_write_index_span(ctx, &span); } - } } } @@ -728,11 +716,12 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, const struct gl_pixelstore_attrib *unpack = &ctx->Unpack; const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; const GLint desty = y; - GLdepth zspan[MAX_WIDTH]; - GLfloat fogSpan[MAX_WIDTH]; GLboolean quickDraw; GLfloat *convImage = NULL; GLuint transferOps = ctx->_ImageTransferState; + struct sw_span span; + + INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA); if (!_mesa_is_legal_format_and_type(format, type)) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawPixels(format or type)"); @@ -743,24 +732,12 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, if (fast_draw_pixels(ctx, x, y, width, height, format, type, pixels)) return; - /* Fragment depth values */ - if (ctx->Depth.Test || ctx->Fog.Enabled) { - /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->DepthMaxF); - GLfloat fog; - GLint i; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterFogCoord); - else - fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); - - for (i=0;i<width;i++) { - zspan[i] = z; - fogSpan[i] = fog; - } - } - + if (ctx->Depth.Test) + _mesa_span_default_z(ctx, &span); + if (ctx->Fog.Enabled) + _mesa_span_default_fog(ctx, &span); + if (ctx->Texture._EnabledUnits) + _mesa_span_default_texcoords(ctx, &span); if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0 && x + width <= (GLint) ctx->DrawBuffer->Width @@ -827,61 +804,44 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, * General solution */ { - GLchan rgba[MAX_WIDTH][4]; GLint row; if (width > MAX_WIDTH) width = MAX_WIDTH; + for (row = 0; row < height; row++, y++) { const GLvoid *source = _mesa_image_address(unpack, pixels, width, height, format, type, 0, row, 0); - _mesa_unpack_chan_color_span(ctx, width, GL_RGBA, (GLchan *) rgba, + + _mesa_unpack_chan_color_span(ctx, width, GL_RGBA, + (GLchan *) span.array->rgba, format, type, source, unpack, transferOps); + if ((ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) || (ctx->Pixel.HistogramEnabled && ctx->Histogram.Sink)) continue; - if (ctx->Texture._ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { - GLchan primary_rgba[MAX_WIDTH][4]; - GLuint unit; - DEFARRAY(GLfloat, s, MAX_WIDTH); /* mac 32k limitation */ - DEFARRAY(GLfloat, t, MAX_WIDTH); - DEFARRAY(GLfloat, r, MAX_WIDTH); - DEFARRAY(GLfloat, q, MAX_WIDTH); - CHECKARRAY(s, return); /* mac 32k limitation */ - CHECKARRAY(t, return); - CHECKARRAY(r, return); - CHECKARRAY(q, return); - - /* XXX not sure how multitexture is supposed to work here */ - MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); - - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, - s, t, r, q); - _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL, - (CONST GLchan (*)[4]) primary_rgba, - rgba); - } - } - UNDEFARRAY(s); /* mac 32k limitation */ - UNDEFARRAY(t); - UNDEFARRAY(r); - UNDEFARRAY(q); + if (ctx->Pixel.PixelTextureEnabled && ctx->Texture._EnabledUnits) { + span.end = width; + _swrast_pixel_texture(ctx, &span); } if (quickDraw) { (*swrast->Driver.WriteRGBASpan)(ctx, width, x, y, - (CONST GLchan (*)[4]) rgba, NULL); + (CONST GLchan (*)[4]) span.array->rgba, NULL); } else if (zoom) { - _mesa_write_zoomed_rgba_span(ctx, width, x, y, zspan, fogSpan, - (CONST GLchan (*)[4]) rgba, desty); + span.x = x; + span.y = y; + span.end = width; + _mesa_write_zoomed_rgba_span(ctx, &span, + (CONST GLchan (*)[4]) span.array->rgba, desty); } else { - _mesa_write_rgba_span(ctx, (GLuint) width, x, y, zspan, fogSpan, - rgba, NULL, GL_BITMAP); + span.x = x; + span.y = y; + span.end = width; + _mesa_write_rgba_span(ctx, &span); } } } @@ -907,7 +867,6 @@ _swrast_DrawPixels( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); (void) unpack; - if (swrast->NewState) _swrast_validate_derived( ctx ); @@ -945,3 +904,55 @@ _swrast_DrawPixels( GLcontext *ctx, RENDER_FINISH(swrast,ctx); } + + + +#if 0 /* experimental */ +/* + * Execute glDrawDepthPixelsMESA(). + */ +void +_swrast_DrawDepthPixelsMESA( GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum colorFormat, GLenum colorType, + const GLvoid *colors, + GLenum depthType, const GLvoid *depths, + const struct gl_pixelstore_attrib *unpack ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + (void) unpack; + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + RENDER_START(swrast,ctx); + + switch (colorFormat) { + case GL_COLOR_INDEX: + if (ctx->Visual.rgbMode) + draw_rgba_pixels(ctx, x,y, width, height, colorFormat, colorType, colors); + else + draw_index_pixels(ctx, x, y, width, height, colorType, colors); + break; + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_RGB: + case GL_BGR: + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + draw_rgba_pixels(ctx, x, y, width, height, colorFormat, colorType, colors); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, + "glDrawDepthPixelsMESA(colorFormat)" ); + } + + RENDER_FINISH(swrast,ctx); +} +#endif diff --git a/xc/extras/Mesa/src/swrast/s_fog.c b/xc/extras/Mesa/src/swrast/s_fog.c index b7e880528..2e2390c08 100644 --- a/xc/extras/Mesa/src/swrast/s_fog.c +++ b/xc/extras/Mesa/src/swrast/s_fog.c @@ -1,8 +1,7 @@ -/* $Id: s_fog.c,v 1.1.1.1 2002/10/22 13:06:41 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -33,12 +32,12 @@ #include "s_context.h" #include "s_fog.h" -#include "s_pb.h" +#include "s_span.h" -/* +/** * Used to convert current raster distance to a fog factor in [0,1]. */ GLfloat @@ -63,67 +62,14 @@ _mesa_z_to_fogfactor(GLcontext *ctx, GLfloat z) f = (GLfloat) exp(-(d * d * z * z)); return f; default: - _mesa_problem(ctx, "Bad fog mode in make_fog_coord"); + _mesa_problem(ctx, "Bad fog mode in _mesa_z_to_fogfactor"); return 0.0; } } -/* - * Apply fog to an array of RGBA pixels. - * Input: n - number of pixels - * fog - array of fog factors in [0,1] - * red, green, blue, alpha - pixel colors - * Output: red, green, blue, alpha - fogged pixel colors - */ -void -_mesa_fog_rgba_pixels( const GLcontext *ctx, - GLuint n, - const GLfloat fog[], - GLchan rgba[][4] ) -{ - GLuint i; - GLchan rFog, gFog, bFog; - - UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); - UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); - - for (i = 0; i < n; i++) { - const GLfloat f = fog[i]; - const GLfloat g = 1.0F - f; - rgba[i][RCOMP] = (GLchan) (f * rgba[i][RCOMP] + g * rFog); - rgba[i][GCOMP] = (GLchan) (f * rgba[i][GCOMP] + g * gFog); - rgba[i][BCOMP] = (GLchan) (f * rgba[i][BCOMP] + g * bFog); - } -} - - - -/* - * Apply fog to an array of color index pixels. - * Input: n - number of pixels - * fog - array of fog factors in [0,1] - * index - pixel color indexes - * Output: index - fogged pixel color indexes - */ -void -_mesa_fog_ci_pixels( const GLcontext *ctx, - GLuint n, const GLfloat fog[], GLuint index[] ) -{ - GLuint idx = (GLuint) ctx->Fog.Index; - GLuint i; - - for (i = 0; i < n; i++) { - const GLfloat f = CLAMP(fog[i], 0.0F, 1.0F); - index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx); - } -} - - - -/* +/** * Calculate fog factors (in [0,1]) from window z values * Input: n - number of pixels * z - array of integer depth values @@ -138,9 +84,10 @@ compute_fog_factors_from_z( const GLcontext *ctx, const GLdepth z[], GLfloat fogFact[] ) { - const GLboolean ortho = (ctx->ProjectionMatrix.m[15] != 0.0F); - const GLfloat p10 = ctx->ProjectionMatrix.m[10]; - const GLfloat p14 = ctx->ProjectionMatrix.m[14]; + const GLfloat *proj = ctx->ProjectionMatrixStack.Top->m; + const GLboolean ortho = (proj[15] != 0.0F); + const GLfloat p10 = proj[10]; + const GLfloat p14 = proj[14]; const GLfloat tz = ctx->Viewport._WindowMap.m[MAT_TZ]; GLfloat szInv; GLuint i; @@ -267,37 +214,101 @@ compute_fog_factors_from_z( const GLcontext *ctx, } -/* - * Apply fog to an array of RGBA pixels. - * Input: n - number of pixels - * z - array of integer depth values - * red, green, blue, alpha - pixel colors - * Output: red, green, blue, alpha - fogged pixel colors + +/** + * Apply fog to a span of RGBA pixels. + * The fog factors are either in the span->array->fog or stored as base/step. + * These are fog _factors_, not fog coords. Fog coords were converted to + * fog factors per vertex. */ void -_mesa_depth_fog_rgba_pixels( const GLcontext *ctx, - GLuint n, const GLdepth z[], GLchan rgba[][4] ) +_mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ) { - GLfloat fogFact[PB_SIZE]; - ASSERT(n <= PB_SIZE); - compute_fog_factors_from_z( ctx, n, z, fogFact ); - _mesa_fog_rgba_pixels( ctx, n, fogFact, rgba ); + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint n = span->end; + GLchan (*rgba)[4] = (GLchan (*)[4]) span->array->rgba; + GLchan rFog, gFog, bFog; + + ASSERT(ctx->Fog.Enabled); + ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); + ASSERT(span->arrayMask & SPAN_RGBA); + + UNCLAMPED_FLOAT_TO_CHAN(rFog, ctx->Fog.Color[RCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(gFog, ctx->Fog.Color[GCOMP]); + UNCLAMPED_FLOAT_TO_CHAN(bFog, ctx->Fog.Color[BCOMP]); + + if (swrast->_PreferPixelFog) { + /* compute fog factor from each fragment's Z value */ + if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0) + _mesa_span_interpolate_z(ctx, span); + compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog); + span->arrayMask |= SPAN_FOG; + } + + if (span->arrayMask & SPAN_FOG) { + /* use fog array in span */ + GLuint i; + for (i = 0; i < n; i++) { + const GLfloat fog = span->array->fog[i]; + const GLfloat oneMinusFog = 1.0F - fog; + rgba[i][RCOMP] = (GLchan) (fog * rgba[i][RCOMP] + oneMinusFog * rFog); + rgba[i][GCOMP] = (GLchan) (fog * rgba[i][GCOMP] + oneMinusFog * gFog); + rgba[i][BCOMP] = (GLchan) (fog * rgba[i][BCOMP] + oneMinusFog * bFog); + } + } + else { + /* interpolate fog factors */ + GLfloat fog = span->fog, dFog = span->fogStep; + GLuint i; + for (i = 0; i < n; i++) { + const GLfloat oneMinusFog = 1.0F - fog; + rgba[i][RCOMP] = (GLchan) (fog * rgba[i][RCOMP] + oneMinusFog * rFog); + rgba[i][GCOMP] = (GLchan) (fog * rgba[i][GCOMP] + oneMinusFog * gFog); + rgba[i][BCOMP] = (GLchan) (fog * rgba[i][BCOMP] + oneMinusFog * bFog); + fog += dFog; + } + } } -/* - * Apply fog to an array of color index pixels. - * Input: n - number of pixels - * z - array of integer depth values - * index - pixel color indexes - * Output: index - fogged pixel color indexes +/** + * As above, but color index mode. */ void -_mesa_depth_fog_ci_pixels( const GLcontext *ctx, - GLuint n, const GLdepth z[], GLuint index[] ) +_mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span ) { - GLfloat fogFact[PB_SIZE]; - ASSERT(n <= PB_SIZE); - compute_fog_factors_from_z( ctx, n, z, fogFact ); - _mesa_fog_ci_pixels( ctx, n, fogFact, index ); + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint n = span->end; + GLuint *index = span->array->index; + + ASSERT(ctx->Fog.Enabled); + ASSERT(span->arrayMask & SPAN_INDEX); + ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); + + if (swrast->_PreferPixelFog) { + /* compute fog factor from each fragment's Z value */ + if ((span->interpMask & SPAN_Z) && (span->arrayMask & SPAN_Z) == 0) + _mesa_span_interpolate_z(ctx, span); + compute_fog_factors_from_z(ctx, n, span->array->z, span->array->fog); + span->arrayMask |= SPAN_FOG; + } + + if (span->arrayMask & SPAN_FOG) { + const GLuint idx = (GLuint) ctx->Fog.Index; + GLuint i; + for (i = 0; i < n; i++) { + const GLfloat f = CLAMP(span->array->fog[i], 0.0F, 1.0F); + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx); + } + } + else { + GLfloat fog = span->fog, dFog = span->fogStep; + const GLuint idx = (GLuint) ctx->Fog.Index; + GLuint i; + for (i = 0; i < n; i++) { + const GLfloat f = CLAMP(fog, 0.0F, 1.0F); + index[i] = (GLuint) ((GLfloat) index[i] + (1.0F - f) * idx); + fog += dFog; + } + } } diff --git a/xc/extras/Mesa/src/swrast/s_fog.h b/xc/extras/Mesa/src/swrast/s_fog.h index a3c35759c..6e23647d1 100644 --- a/xc/extras/Mesa/src/swrast/s_fog.h +++ b/xc/extras/Mesa/src/swrast/s_fog.h @@ -1,10 +1,9 @@ -/* $Id: s_fog.h,v 1.1.1.1 2002/10/22 13:06:41 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -36,29 +35,11 @@ extern GLfloat _mesa_z_to_fogfactor(GLcontext *ctx, GLfloat z); - -extern void -_mesa_fog_rgba_pixels( const GLcontext *ctx, - GLuint n, const GLfloat fog[], - GLchan rgba[][4] ); - -extern void -_mesa_fog_ci_pixels( const GLcontext *ctx, - GLuint n, const GLfloat fog[], GLuint indx[] ); - -extern void -_mesa_win_fog_coords_from_z( const GLcontext *ctx, - GLuint n, - const GLdepth z[], - GLfloat fogcoord[] ); - extern void -_mesa_depth_fog_rgba_pixels( const GLcontext *ctx, - GLuint n, const GLdepth z[], GLchan rgba[][4] ); +_mesa_fog_rgba_span( const GLcontext *ctx, struct sw_span *span ); extern void -_mesa_depth_fog_ci_pixels( const GLcontext *ctx, - GLuint n, const GLdepth z[], GLuint index[] ); +_mesa_fog_ci_span( const GLcontext *ctx, struct sw_span *span ); #endif diff --git a/xc/extras/Mesa/src/swrast/s_imaging.c b/xc/extras/Mesa/src/swrast/s_imaging.c index 495ef3197..4b5438f88 100644 --- a/xc/extras/Mesa/src/swrast/s_imaging.c +++ b/xc/extras/Mesa/src/swrast/s_imaging.c @@ -1,8 +1,7 @@ -/* $Id: s_imaging.c,v 1.1.1.1 2002/10/22 13:06:48 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -37,12 +36,10 @@ _swrast_CopyColorTable( GLcontext *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan data[MAX_WIDTH][4]; /* Select buffer to read from */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); + _swrast_use_read_buffer(ctx); if (width > MAX_WIDTH) width = MAX_WIDTH; @@ -51,8 +48,7 @@ _swrast_CopyColorTable( GLcontext *ctx, _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); /* Restore reading from draw buffer (the default) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); + _swrast_use_draw_buffer(ctx); glColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data); } @@ -61,12 +57,10 @@ void _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan data[MAX_WIDTH][4]; /* Select buffer to read from */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); + _swrast_use_read_buffer(ctx); if (width > MAX_WIDTH) width = MAX_WIDTH; @@ -75,8 +69,7 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); /* Restore reading from draw buffer (the default) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); + _swrast_use_draw_buffer(ctx); glColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data); } @@ -90,6 +83,9 @@ _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + RENDER_START( swrast, ctx ); /* read the data from framebuffer */ @@ -98,6 +94,9 @@ _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, RENDER_FINISH( swrast, ctx ); + /* Restore reading from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + /* store as convolution filter */ glConvolutionFilter1D(target, internalFormat, width, GL_RGBA, CHAN_TYPE, rgba); @@ -114,6 +113,9 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; GLint i; + /* Select buffer to read from */ + _swrast_use_read_buffer(ctx); + RENDER_START(swrast,ctx); /* read pixels from framebuffer */ @@ -124,6 +126,9 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, RENDER_FINISH(swrast,ctx); + /* Restore reading from draw buffer (the default) */ + _swrast_use_draw_buffer(ctx); + /* * HACK: save & restore context state so we can store this as a * convolution filter via the GL api. Doesn't call any callbacks diff --git a/xc/extras/Mesa/src/swrast/s_lines.c b/xc/extras/Mesa/src/swrast/s_lines.c index ec8c343e3..eabfdcce0 100644 --- a/xc/extras/Mesa/src/swrast/s_lines.c +++ b/xc/extras/Mesa/src/swrast/s_lines.c @@ -1,10 +1,9 @@ -/* $Id: s_lines.c,v 1.1.1.1 2002/10/22 13:06:48 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -30,334 +29,294 @@ #include "macros.h" #include "mmath.h" #include "s_aaline.h" -#include "s_pb.h" #include "s_context.h" #include "s_depth.h" -#include "s_lines.h" #include "s_feedback.h" +#include "s_lines.h" +#include "s_span.h" +/* + * Init the mask[] array to implement a line stipple. + */ +static void +compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint i; -/**********************************************************************/ -/***** Rasterization *****/ -/**********************************************************************/ + for (i = 0; i < len; i++) { + GLuint bit = (swrast->StippleCounter / ctx->Line.StippleFactor) & 0xf; + if ((1 << bit) & ctx->Line.StipplePattern) { + mask[i] = GL_TRUE; + } + else { + mask[i] = GL_FALSE; + } + swrast->StippleCounter++; + } +} /* - * There are 4 pairs (RGBA, CI) of line drawing functions: - * 1. simple: width=1 and no special rasterization functions (fastest) - * 2. flat: width=1, non-stippled, flat-shaded, any raster operations - * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations - * 4. general: any other kind of line (slowest) + * To draw a wide line we can simply redraw the span N times, side by side. */ - - -/* Flat, color index line */ -static void flat_ci_line( GLcontext *ctx, - const SWvertex *vert0, - const SWvertex *vert1 ) +static void +draw_wide_line( GLcontext *ctx, struct sw_span *span, GLboolean xMajor ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; + GLint width, start; - PB_SET_INDEX( PB, vert0->index ); + ASSERT(span->end < MAX_WIDTH); -#define INTERP_XY 1 -#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0); + width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); -#include "s_linetemp.h" - - _mesa_flush_pb(ctx); + if (width & 1) + start = width / 2; + else + start = width / 2 - 1; + + if (xMajor) { + GLint *y = span->array->y; + GLuint i; + GLint w; + for (w = 0; w < width; w++) { + if (w == 0) { + for (i = 0; i < span->end; i++) + y[i] -= start; + } + else { + for (i = 0; i < span->end; i++) + y[i]++; + } + if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE) + _mesa_write_texture_span(ctx, span); + else if ((span->interpMask | span->arrayMask) & SPAN_RGBA) + _mesa_write_rgba_span(ctx, span); + else + _mesa_write_index_span(ctx, span); + } + } + else { + GLint *x = span->array->x; + GLuint i; + GLint w; + for (w = 0; w < width; w++) { + if (w == 0) { + for (i = 0; i < span->end; i++) + x[i] -= start; + } + else { + for (i = 0; i < span->end; i++) + x[i]++; + } + if ((span->interpMask | span->arrayMask) & SPAN_TEXTURE) + _mesa_write_texture_span(ctx, span); + else if ((span->interpMask | span->arrayMask) & SPAN_RGBA) + _mesa_write_rgba_span(ctx, span); + else + _mesa_write_index_span(ctx, span); + } + } } -/* Flat, color index line with Z interpolation/testing */ -static void flat_ci_z_line( GLcontext *ctx, - const SWvertex *vert0, - const SWvertex *vert1 ) +/**********************************************************************/ +/***** Rasterization *****/ +/**********************************************************************/ + + +/* Flat, color index line */ +static void flat_ci_line( GLcontext *ctx, + const SWvertex *vert0, + const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - PB_SET_INDEX( PB, vert0->index ); + GLint *x, *y; + struct sw_span span; + + ASSERT(ctx->Light.ShadeModel == GL_FLAT); + ASSERT(!ctx->Line.StippleFlag); + ASSERT(ctx->Line.Width == 1.0F); + + INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, SPAN_XY); + span.index = IntToFixed(vert1->index); + span.indexStep = 0; + x = span.array->x; + y = span.array->y; #define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); +#define PLOT(X,Y) \ + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + span.end++; \ + } #include "s_linetemp.h" - _mesa_flush_pb(ctx); + _mesa_write_index_span(ctx, &span); } - /* Flat-shaded, RGBA line */ static void flat_rgba_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - const GLchan *color = vert1->color; - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] ); + struct sw_span span; + GLint *x, *y; + + ASSERT(ctx->Light.ShadeModel == GL_FLAT); + ASSERT(!ctx->Line.StippleFlag); + ASSERT(ctx->Line.Width == 1.0F); + + INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, SPAN_XY); + span.red = ChanToFixed(vert1->color[0]); + span.green = ChanToFixed(vert1->color[1]); + span.blue = ChanToFixed(vert1->color[2]); + span.alpha = ChanToFixed(vert1->color[3]); + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; + span.alphaStep = 0; + x = span.array->x; + y = span.array->y; #define INTERP_XY 1 -#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, 0, 0); - -#include "s_linetemp.h" - - _mesa_flush_pb(ctx); -} - - - -/* Flat-shaded, RGBA line with Z interpolation/testing */ -static void flat_rgba_z_line( GLcontext *ctx, - const SWvertex *vert0, - const SWvertex *vert1 ) -{ - const GLchan *color = vert1->color; - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] ); - -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); +#define PLOT(X,Y) \ + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + span.end++; \ + } #include "s_linetemp.h" - _mesa_flush_pb(ctx); + _mesa_write_rgba_span(ctx, &span); } - /* Smooth shaded, color index line */ static void smooth_ci_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLuint *pbi = PB->index; + struct sw_span span; + GLint *x, *y; + GLuint *index; - PB->mono = GL_FALSE; + ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); + ASSERT(!ctx->Line.StippleFlag); + ASSERT(ctx->Line.Width == 1.0F); -#define INTERP_XY 1 -#define INTERP_INDEX 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbi[count] = I; \ - count++; - -#include "s_linetemp.h" - - PB->count = count; - _mesa_flush_pb(ctx); -} - - - -/* Smooth shaded, color index line with Z interpolation/testing */ -static void smooth_ci_z_line( GLcontext *ctx, - const SWvertex *vert0, - const SWvertex *vert1 ) -{ - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLuint *pbi = PB->index; - - PB->mono = GL_FALSE; + INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_INDEX); + x = span.array->x; + y = span.array->y; + index = span.array->index; #define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 #define INTERP_INDEX 1 - #define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbi[count] = I; \ - count++; + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + index[span.end] = I; \ + span.end++; \ + } #include "s_linetemp.h" - PB->count = count; - _mesa_flush_pb(ctx); + _mesa_write_index_span(ctx, &span); } - /* Smooth-shaded, RGBA line */ static void smooth_rgba_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLchan (*pbrgba)[4] = PB->rgba; - - PB->mono = GL_FALSE; - -#define INTERP_XY 1 -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - count++; - -#include "s_linetemp.h" - - PB->count = count; - _mesa_flush_pb(ctx); -} - - - -/* Smooth-shaded, RGBA line with Z interpolation/testing */ -static void smooth_rgba_z_line( GLcontext *ctx, - const SWvertex *vert0, - const SWvertex *vert1 ) -{ - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLchan (*pbrgba)[4] = PB->rgba; + struct sw_span span; + GLint *x, *y; + GLchan (*rgba)[4]; + ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); + ASSERT(!ctx->Line.StippleFlag); + ASSERT(ctx->Line.Width == 1.0F); - PB->mono = GL_FALSE; + INIT_SPAN(span, GL_LINE, 0, 0, SPAN_XY | SPAN_RGBA); + x = span.array->x; + y = span.array->y; + rgba = span.array->rgba; #define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 - #define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - count++; + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + rgba[span.end][RCOMP] = FixedToInt(r0); \ + rgba[span.end][GCOMP] = FixedToInt(g0); \ + rgba[span.end][BCOMP] = FixedToInt(b0); \ + rgba[span.end][ACOMP] = FixedToInt(a0); \ + span.end++; \ + } #include "s_linetemp.h" - PB->count = count; - _mesa_flush_pb(ctx); + _mesa_write_rgba_span(ctx, &span); } -#define CHECK_FULL(count) \ - if (count >= PB_SIZE-MAX_WIDTH) { \ - PB->count = count; \ - _mesa_flush_pb(ctx); \ - count = PB->count; \ - } - - - /* Smooth shaded, color index, any width, maybe stippled */ static void general_smooth_ci_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLuint *pbi = PB->index; - - PB->mono = GL_FALSE; - - if (ctx->Line.StippleFlag) { - /* stippled */ + GLboolean xMajor = GL_FALSE; + struct sw_span span; + GLint *x, *y; + GLdepth *z; + GLfloat *fog; + GLuint *index; + + ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); + + INIT_SPAN(span, GL_LINE, 0, 0, + SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_INDEX); + x = span.array->x; + y = span.array->y; + z = span.array->z; + fog = span.array->fog; + index = span.array->index; + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_INDEX 1 -#define WIDE 1 -#define STIPPLE 1 #define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbi[count] = I; \ - count++; \ - CHECK_FULL(count); -#include "s_linetemp.h" + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + z[span.end] = Z; \ + fog[span.end] = fog0; \ + index[span.end] = I; \ + span.end++; \ } - else { - /* unstippled */ - if (ctx->Line.Width==2.0F) { - /* special case: unstippled and width=2 */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_INDEX 1 -#define XMAJOR_PLOT(X,Y) \ - pbx[count] = X; pbx[count+1] = X; \ - pby[count] = Y; pby[count+1] = Y+1; \ - pbz[count] = Z; pbz[count+1] = Z; \ - pbfog[count] = fog0; pbfog[count+1] = fog0; \ - pbi[count] = I; pbi[count+1] = I; \ - count += 2; \ - CHECK_FULL(count); -#define YMAJOR_PLOT(X,Y) \ - pbx[count] = X; pbx[count+1] = X+1; \ - pby[count] = Y; pby[count+1] = Y; \ - pbz[count] = Z; pbz[count+1] = Z; \ - pbfog[count] = fog0; pbfog[count+1] = fog0; \ - pbi[count] = I; pbi[count+1] = I; \ - count += 2; \ - CHECK_FULL(count); -#include "s_linetemp.h" - } - else { - /* unstippled, any width */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_INDEX 1 -#define WIDE 1 -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbi[count] = I; \ - pbfog[count] = fog0; \ - count++; \ - CHECK_FULL(count); #include "s_linetemp.h" - } + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_index_span(ctx, &span); + } } @@ -366,73 +325,48 @@ static void general_flat_ci_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - PB_SET_INDEX( PB, vert0->index ); - count = PB->count; - - if (ctx->Line.StippleFlag) { - /* stippled, any width */ + GLboolean xMajor = GL_FALSE; + struct sw_span span; + GLint *x, *y; + GLdepth *z; + GLfloat *fog; + + ASSERT(ctx->Light.ShadeModel == GL_FLAT); + + INIT_SPAN(span, GL_LINE, 0, SPAN_INDEX, + SPAN_XY | SPAN_Z | SPAN_FOG); + span.index = IntToFixed(vert1->index); + span.indexStep = 0; + x = span.array->x; + y = span.array->y; + z = span.array->z; + fog = span.array->fog; + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 -#define WIDE 1 -#define STIPPLE 1 #define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - count++; \ - CHECK_FULL(count); -#include "s_linetemp.h" + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + z[span.end] = Z; \ + fog[span.end] = fog0; \ + span.end++; \ } - else { - /* unstippled */ - if (ctx->Line.Width==2.0F) { - /* special case: unstippled and width=2 */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define XMAJOR_PLOT(X,Y) \ - pbx[count] = X; pbx[count+1] = X; \ - pby[count] = Y; pby[count+1] = Y+1; \ - pbz[count] = Z; pbz[count+1] = Z; \ - pbfog[count] = fog0; pbfog[count+1] = fog0; \ - count += 2; \ - CHECK_FULL(count); -#define YMAJOR_PLOT(X,Y) \ - pbx[count] = X; pbx[count+1] = X+1; \ - pby[count] = Y; pby[count+1] = Y; \ - pbz[count] = Z; pbz[count+1] = Z; \ - pbfog[count] = fog0; pbfog[count+1] = fog0; \ - count += 2; \ - CHECK_FULL(count); #include "s_linetemp.h" - } - else { - /* unstippled, any width */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define WIDE 1 -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - count++; \ - CHECK_FULL(count); -#include "s_linetemp.h" - } + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_index_span(ctx, &span); + } } @@ -441,104 +375,54 @@ static void general_smooth_rgba_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLchan (*pbrgba)[4] = PB->rgba; - - PB->mono = GL_FALSE; - - if (ctx->Line.StippleFlag) { - /* stippled */ + GLboolean xMajor = GL_FALSE; + struct sw_span span; + GLint *x, *y; + GLdepth *z; + GLchan (*rgba)[4]; + GLfloat *fog; + + ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); + + INIT_SPAN(span, GL_LINE, 0, 0, + SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA); + x = span.array->x; + y = span.array->y; + z = span.array->z; + rgba = span.array->rgba; + fog = span.array->fog; + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 -#define WIDE 1 -#define STIPPLE 1 #define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - count++; \ - CHECK_FULL(count); -#include "s_linetemp.h" + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + z[span.end] = Z; \ + rgba[span.end][RCOMP] = FixedToInt(r0); \ + rgba[span.end][GCOMP] = FixedToInt(g0); \ + rgba[span.end][BCOMP] = FixedToInt(b0); \ + rgba[span.end][ACOMP] = FixedToInt(a0); \ + fog[span.end] = fog0; \ + span.end++; \ } - else { - /* unstippled */ - if (ctx->Line.Width==2.0F) { - /* special case: unstippled and width=2 */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define XMAJOR_PLOT(X,Y) \ - pbx[count] = X; pbx[count+1] = X; \ - pby[count] = Y; pby[count+1] = Y+1; \ - pbz[count] = Z; pbz[count+1] = Z; \ - pbfog[count] = fog0; pbfog[count+1] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - pbrgba[count+1][RCOMP] = FixedToInt(r0); \ - pbrgba[count+1][GCOMP] = FixedToInt(g0); \ - pbrgba[count+1][BCOMP] = FixedToInt(b0); \ - pbrgba[count+1][ACOMP] = FixedToInt(a0); \ - count += 2; \ - CHECK_FULL(count); -#define YMAJOR_PLOT(X,Y) \ - pbx[count] = X; pbx[count+1] = X+1; \ - pby[count] = Y; pby[count+1] = Y; \ - pbz[count] = Z; pbz[count+1] = Z; \ - pbfog[count] = fog0; pbfog[count+1] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - pbrgba[count+1][RCOMP] = FixedToInt(r0); \ - pbrgba[count+1][GCOMP] = FixedToInt(g0); \ - pbrgba[count+1][BCOMP] = FixedToInt(b0); \ - pbrgba[count+1][ACOMP] = FixedToInt(a0); \ - count += 2; \ - CHECK_FULL(count); -#include "s_linetemp.h" - } - else { - /* unstippled, any width */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define WIDE 1 -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - count++; \ - CHECK_FULL(count); #include "s_linetemp.h" - } + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_rgba_span(ctx, &span); + } } @@ -546,52 +430,54 @@ static void general_flat_rgba_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - const GLchan *color = vert1->color; - GLuint count; - PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] ); - - if (ctx->Line.StippleFlag) { - /* stippled */ + GLboolean xMajor = GL_FALSE; + struct sw_span span; + GLint *x, *y; + GLdepth *z; + GLfloat *fog; + + ASSERT(ctx->Light.ShadeModel == GL_FLAT); + + INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA, + SPAN_XY | SPAN_Z | SPAN_FOG); + span.red = ChanToFixed(vert1->color[0]); + span.green = ChanToFixed(vert1->color[1]); + span.blue = ChanToFixed(vert1->color[2]); + span.alpha = ChanToFixed(vert1->color[3]); + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; + span.alphaStep = 0; + x = span.array->x; + y = span.array->y; + z = span.array->z; + fog = span.array->fog; + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 -#define WIDE 1 -#define STIPPLE 1 -#define PLOT(X,Y) \ - PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \ - count = PB->count; \ - CHECK_FULL(count); -#include "s_linetemp.h" +#define PLOT(X,Y) \ + { \ + x[span.end] = X; \ + y[span.end] = Y; \ + z[span.end] = Z; \ + fog[span.end] = fog0; \ + span.end++; \ } - else { - /* unstippled */ - if (ctx->Line.Width==2.0F) { - /* special case: unstippled and width=2 */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define XMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \ - PB_WRITE_PIXEL(PB, X, Y+1, Z, fog0); -#define YMAJOR_PLOT(X,Y) PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \ - PB_WRITE_PIXEL(PB, X+1, Y, Z, fog0); #include "s_linetemp.h" - } - else { - /* unstippled, any width */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define WIDE 1 -#define PLOT(X,Y) \ - PB_WRITE_PIXEL(PB, X, Y, Z, fog0); \ - count = PB->count; \ - CHECK_FULL(count); -#include "s_linetemp.h" - } + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_rgba_span(ctx, &span); + } } @@ -600,65 +486,58 @@ static void flat_textured_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLfloat *pbs = PB->s[0]; - GLfloat *pbt = PB->t[0]; - GLfloat *pbu = PB->u[0]; - GLchan *color = (GLchan*) vert1->color; - PB_SET_COLOR( PB, color[0], color[1], color[2], color[3] ); - count = PB->count; - - if (ctx->Line.StippleFlag) { - /* stippled */ + GLboolean xMajor = GL_FALSE; + struct sw_span span; + + ASSERT(ctx->Light.ShadeModel == GL_FLAT); + + INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC, + SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); + span.red = ChanToFixed(vert1->color[0]); + span.green = ChanToFixed(vert1->color[1]); + span.blue = ChanToFixed(vert1->color[2]); + span.alpha = ChanToFixed(vert1->color[3]); + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; + span.alphaStep = 0; + span.specRed = ChanToFixed(vert1->specular[0]); + span.specGreen = ChanToFixed(vert1->specular[1]); + span.specBlue = ChanToFixed(vert1->specular[2]); + span.specRedStep = 0; + span.specGreenStep = 0; + span.specBlueStep = 0; + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_TEX 1 -#define WIDE 1 -#define STIPPLE 1 -#define PLOT(X,Y) \ - { \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbs[count] = fragTexcoord[0];\ - pbt[count] = fragTexcoord[1];\ - pbu[count] = fragTexcoord[2];\ - count++; \ - CHECK_FULL(count); \ - } -#include "s_linetemp.h" +#define PLOT(X,Y) \ + { \ + span.array->x[span.end] = X; \ + span.array->y[span.end] = Y; \ + span.array->z[span.end] = Z; \ + span.array->fog[span.end] = fog0; \ + span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \ + span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \ + span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \ + span.array->lambda[0][span.end] = 0.0; \ + span.end++; \ } - else { - /* unstippled */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_TEX 1 -#define WIDE 1 -#define PLOT(X,Y) \ - { \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbs[count] = fragTexcoord[0];\ - pbt[count] = fragTexcoord[1];\ - pbu[count] = fragTexcoord[2];\ - count++; \ - CHECK_FULL(count); \ - } #include "s_linetemp.h" + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_texture_span(ctx, &span); + } } @@ -668,77 +547,50 @@ static void smooth_textured_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLfloat *pbs = PB->s[0]; - GLfloat *pbt = PB->t[0]; - GLfloat *pbu = PB->u[0]; - GLchan (*pbrgba)[4] = PB->rgba; - - PB->mono = GL_FALSE; + GLboolean xMajor = GL_FALSE; + struct sw_span span; - if (ctx->Line.StippleFlag) { - /* stippled */ + ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); + + INIT_SPAN(span, GL_LINE, 0, 0, + SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_TEXTURE | SPAN_LAMBDA); + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 #define INTERP_TEX 1 -#define WIDE 1 -#define STIPPLE 1 -#define PLOT(X,Y) \ - { \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbs[count] = fragTexcoord[0]; \ - pbt[count] = fragTexcoord[1]; \ - pbu[count] = fragTexcoord[2]; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - count++; \ - CHECK_FULL(count); \ - } -#include "s_linetemp.h" +#define PLOT(X,Y) \ + { \ + span.array->x[span.end] = X; \ + span.array->y[span.end] = Y; \ + span.array->z[span.end] = Z; \ + span.array->fog[span.end] = fog0; \ + span.array->rgba[span.end][RCOMP] = FixedToInt(r0); \ + span.array->rgba[span.end][GCOMP] = FixedToInt(g0); \ + span.array->rgba[span.end][BCOMP] = FixedToInt(b0); \ + span.array->rgba[span.end][ACOMP] = FixedToInt(a0); \ + span.array->texcoords[0][span.end][0] = fragTexcoord[0]; \ + span.array->texcoords[0][span.end][1] = fragTexcoord[1]; \ + span.array->texcoords[0][span.end][2] = fragTexcoord[2]; \ + span.array->lambda[0][span.end] = 0.0; \ + span.end++; \ } - else { - /* unstippled */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define INTERP_TEX 1 -#define WIDE 1 -#define PLOT(X,Y) \ - { \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbs[count] = fragTexcoord[0]; \ - pbt[count] = fragTexcoord[1]; \ - pbu[count] = fragTexcoord[2]; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - count++; \ - CHECK_FULL(count); \ - } #include "s_linetemp.h" + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_texture_span(ctx, &span); + } } @@ -749,20 +601,16 @@ static void smooth_multitextured_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLchan (*pbrgba)[4] = PB->rgba; - GLchan (*pbspec)[3] = PB->spec; - - PB->mono = GL_FALSE; - PB->haveSpec = GL_TRUE; + GLboolean xMajor = GL_FALSE; + struct sw_span span; + GLuint u; - if (ctx->Line.StippleFlag) { - /* stippled */ + ASSERT(ctx->Light.ShadeModel == GL_SMOOTH); + + INIT_SPAN(span, GL_LINE, 0, 0, + SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_RGBA | SPAN_SPEC | SPAN_TEXTURE | SPAN_LAMBDA); + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 @@ -770,73 +618,42 @@ static void smooth_multitextured_line( GLcontext *ctx, #define INTERP_SPEC 1 #define INTERP_ALPHA 1 #define INTERP_MULTITEX 1 -#define WIDE 1 -#define STIPPLE 1 -#define PLOT(X,Y) \ - { \ - GLuint u; \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - pbspec[count][RCOMP] = FixedToInt(sr0); \ - pbspec[count][GCOMP] = FixedToInt(sg0); \ - pbspec[count][BCOMP] = FixedToInt(sb0); \ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ - if (ctx->Texture.Unit[u]._ReallyEnabled) { \ - PB->s[u][count] = fragTexcoord[u][0]; \ - PB->t[u][count] = fragTexcoord[u][1]; \ - PB->u[u][count] = fragTexcoord[u][2]; \ - } \ - } \ - count++; \ - CHECK_FULL(count); \ - } -#include "s_linetemp.h" +#define PLOT(X,Y) \ + { \ + span.array->x[span.end] = X; \ + span.array->y[span.end] = Y; \ + span.array->z[span.end] = Z; \ + span.array->fog[span.end] = fog0; \ + span.array->rgba[span.end][RCOMP] = FixedToInt(r0); \ + span.array->rgba[span.end][GCOMP] = FixedToInt(g0); \ + span.array->rgba[span.end][BCOMP] = FixedToInt(b0); \ + span.array->rgba[span.end][ACOMP] = FixedToInt(a0); \ + span.array->spec[span.end][RCOMP] = FixedToInt(sr0); \ + span.array->spec[span.end][GCOMP] = FixedToInt(sg0); \ + span.array->spec[span.end][BCOMP] = FixedToInt(sb0); \ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ + if (ctx->Texture.Unit[u]._ReallyEnabled) { \ + span.array->texcoords[u][span.end][0] = fragTexcoord[u][0]; \ + span.array->texcoords[u][span.end][1] = fragTexcoord[u][1]; \ + span.array->texcoords[u][span.end][2] = fragTexcoord[u][2]; \ + span.array->lambda[u][span.end] = 0.0; \ + } \ + } \ + span.end++; \ } - else { - /* unstippled */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_RGB 1 -#define INTERP_SPEC 1 -#define INTERP_ALPHA 1 -#define INTERP_MULTITEX 1 -#define WIDE 1 -#define PLOT(X,Y) \ - { \ - GLuint u; \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = FixedToInt(r0); \ - pbrgba[count][GCOMP] = FixedToInt(g0); \ - pbrgba[count][BCOMP] = FixedToInt(b0); \ - pbrgba[count][ACOMP] = FixedToInt(a0); \ - pbspec[count][RCOMP] = FixedToInt(sr0); \ - pbspec[count][GCOMP] = FixedToInt(sg0); \ - pbspec[count][BCOMP] = FixedToInt(sb0); \ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ - if (ctx->Texture.Unit[u]._ReallyEnabled) { \ - PB->s[u][count] = fragTexcoord[u][0]; \ - PB->t[u][count] = fragTexcoord[u][1]; \ - PB->u[u][count] = fragTexcoord[u][2]; \ - } \ - } \ - count++; \ - CHECK_FULL(count); \ - } #include "s_linetemp.h" + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_texture_span(ctx, &span); + } } @@ -847,94 +664,63 @@ static void flat_multitextured_line( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 ) { - struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB; - GLint count = PB->count; - GLint *pbx = PB->x; - GLint *pby = PB->y; - GLdepth *pbz = PB->z; - GLfloat *pbfog = PB->fog; - GLchan (*pbrgba)[4] = PB->rgba; - GLchan (*pbspec)[3] = PB->spec; - GLchan *color = (GLchan*) vert1->color; - GLchan sRed = vert1->specular[0]; - GLchan sGreen = vert1->specular[1]; - GLchan sBlue = vert1->specular[2]; - - PB->mono = GL_FALSE; - PB->haveSpec = GL_TRUE; - - if (ctx->Line.StippleFlag) { - /* stippled */ + GLboolean xMajor = GL_FALSE; + struct sw_span span; + GLuint u; + + ASSERT(ctx->Light.ShadeModel == GL_FLAT); + + INIT_SPAN(span, GL_LINE, 0, SPAN_RGBA | SPAN_SPEC, + SPAN_XY | SPAN_Z | SPAN_FOG | SPAN_TEXTURE | SPAN_LAMBDA); + span.red = ChanToFixed(vert1->color[0]); + span.green = ChanToFixed(vert1->color[1]); + span.blue = ChanToFixed(vert1->color[2]); + span.alpha = ChanToFixed(vert1->color[3]); + span.redStep = 0; + span.greenStep = 0; + span.blueStep = 0; + span.alphaStep = 0; + span.specRed = ChanToFixed(vert1->specular[0]); + span.specGreen = ChanToFixed(vert1->specular[1]); + span.specBlue = ChanToFixed(vert1->specular[2]); + span.specRedStep = 0; + span.specGreenStep = 0; + span.specBlueStep = 0; + +#define SET_XMAJOR 1 #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_FOG 1 -#define INTERP_ALPHA 1 #define INTERP_MULTITEX 1 -#define WIDE 1 -#define STIPPLE 1 -#define PLOT(X,Y) \ - { \ - GLuint u; \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = color[0]; \ - pbrgba[count][GCOMP] = color[1]; \ - pbrgba[count][BCOMP] = color[2]; \ - pbrgba[count][ACOMP] = color[3]; \ - pbspec[count][RCOMP] = sRed; \ - pbspec[count][GCOMP] = sGreen; \ - pbspec[count][BCOMP] = sBlue; \ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ - if (ctx->Texture.Unit[u]._ReallyEnabled) { \ - PB->s[u][count] = fragTexcoord[u][0]; \ - PB->t[u][count] = fragTexcoord[u][1]; \ - PB->u[u][count] = fragTexcoord[u][2]; \ - } \ - } \ - count++; \ - CHECK_FULL(count); \ - } -#include "s_linetemp.h" +#define PLOT(X,Y) \ + { \ + span.array->x[span.end] = X; \ + span.array->y[span.end] = Y; \ + span.array->z[span.end] = Z; \ + span.array->fog[span.end] = fog0; \ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ + if (ctx->Texture.Unit[u]._ReallyEnabled) { \ + span.array->texcoords[u][span.end][0] = fragTexcoord[u][0]; \ + span.array->texcoords[u][span.end][1] = fragTexcoord[u][1]; \ + span.array->texcoords[u][span.end][2] = fragTexcoord[u][2]; \ + span.array->lambda[u][span.end] = 0.0; \ + } \ + } \ + span.end++; \ } - else { - /* unstippled */ -#define INTERP_XY 1 -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define INTERP_ALPHA 1 -#define INTERP_MULTITEX 1 -#define WIDE 1 -#define PLOT(X,Y) \ - { \ - GLuint u; \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - pbfog[count] = fog0; \ - pbrgba[count][RCOMP] = color[0]; \ - pbrgba[count][GCOMP] = color[1]; \ - pbrgba[count][BCOMP] = color[2]; \ - pbrgba[count][ACOMP] = color[3]; \ - pbspec[count][RCOMP] = sRed; \ - pbspec[count][GCOMP] = sGreen; \ - pbspec[count][BCOMP] = sBlue; \ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ - if (ctx->Texture.Unit[u]._ReallyEnabled) { \ - PB->s[u][count] = fragTexcoord[u][0]; \ - PB->t[u][count] = fragTexcoord[u][1]; \ - PB->u[u][count] = fragTexcoord[u][2]; \ - } \ - } \ - count++; \ - CHECK_FULL(count); \ - } #include "s_linetemp.h" + + if (ctx->Line.StippleFlag) { + span.arrayMask |= SPAN_MASK; + compute_stipple_mask(ctx, span.end, span.array->mask); } - PB->count = count; - _mesa_flush_pb(ctx); + if (ctx->Line.Width > 1.0) { + draw_wide_line(ctx, &span, xMajor); + } + else { + _mesa_write_texture_span(ctx, &span); + } } @@ -963,41 +749,33 @@ _mesa_print_line_function(GLcontext *ctx) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - printf("Line Func == "); + _mesa_printf("Line Func == "); if (swrast->Line == flat_ci_line) - printf("flat_ci_line\n"); - else if (swrast->Line == flat_ci_z_line) - printf("flat_ci_z_line\n"); + _mesa_printf("flat_ci_line\n"); else if (swrast->Line == flat_rgba_line) - printf("flat_rgba_line\n"); - else if (swrast->Line == flat_rgba_z_line) - printf("flat_rgba_z_line\n"); + _mesa_printf("flat_rgba_line\n"); else if (swrast->Line == smooth_ci_line) - printf("smooth_ci_line\n"); - else if (swrast->Line == smooth_ci_z_line) - printf("smooth_ci_z_line\n"); + _mesa_printf("smooth_ci_line\n"); else if (swrast->Line == smooth_rgba_line) - printf("smooth_rgba_line\n"); - else if (swrast->Line == smooth_rgba_z_line) - printf("smooth_rgba_z_line\n"); + _mesa_printf("smooth_rgba_line\n"); else if (swrast->Line == general_smooth_ci_line) - printf("general_smooth_ci_line\n"); + _mesa_printf("general_smooth_ci_line\n"); else if (swrast->Line == general_flat_ci_line) - printf("general_flat_ci_line\n"); + _mesa_printf("general_flat_ci_line\n"); else if (swrast->Line == general_smooth_rgba_line) - printf("general_smooth_rgba_line\n"); + _mesa_printf("general_smooth_rgba_line\n"); else if (swrast->Line == general_flat_rgba_line) - printf("general_flat_rgba_line\n"); + _mesa_printf("general_flat_rgba_line\n"); else if (swrast->Line == flat_textured_line) - printf("flat_textured_line\n"); + _mesa_printf("flat_textured_line\n"); else if (swrast->Line == smooth_textured_line) - printf("smooth_textured_line\n"); + _mesa_printf("smooth_textured_line\n"); else if (swrast->Line == smooth_multitextured_line) - printf("smooth_multitextured_line\n"); + _mesa_printf("smooth_multitextured_line\n"); else if (swrast->Line == flat_multitextured_line) - printf("flat_multitextured_line\n"); + _mesa_printf("flat_multitextured_line\n"); else - printf("Driver func %p\n", (void *) swrast->Line); + _mesa_printf("Driver func %p\n", (void *) swrast->Line); } #endif @@ -1011,7 +789,7 @@ static const char *lineFuncName = NULL; #define USE(lineFunc) \ do { \ lineFuncName = #lineFunc; \ - /*printf("%s\n", lineFuncName);*/ \ + /*_mesa_printf("%s\n", lineFuncName);*/ \ swrast->Line = lineFunc; \ } while (0) @@ -1036,23 +814,23 @@ _swrast_choose_line( GLcontext *ctx ) SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLboolean rgbmode = ctx->Visual.rgbMode; - if (ctx->RenderMode==GL_RENDER) { + if (ctx->RenderMode == GL_RENDER) { if (ctx->Line.SmoothFlag) { /* antialiased lines */ _swrast_choose_aa_line_function(ctx); ASSERT(swrast->Triangle); } - else if (ctx->Texture._ReallyEnabled) { - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY || + else if (ctx->Texture._EnabledUnits) { + if (ctx->Texture._EnabledUnits > 1 || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)) { /* multi-texture and/or separate specular color */ - if (ctx->Light.ShadeModel==GL_SMOOTH) + if (ctx->Light.ShadeModel == GL_SMOOTH) USE(smooth_multitextured_line); else USE(flat_multitextured_line); } else { - if (ctx->Light.ShadeModel==GL_SMOOTH) { + if (ctx->Light.ShadeModel == GL_SMOOTH) { USE(smooth_textured_line); } else { @@ -1060,28 +838,14 @@ _swrast_choose_line( GLcontext *ctx ) } } } - else if (ctx->Line.Width!=1.0 || ctx->Line.StippleFlag) { - if (ctx->Light.ShadeModel==GL_SMOOTH) { - if (rgbmode) - USE(general_smooth_rgba_line); - else - USE(general_smooth_ci_line); - } - else { - if (rgbmode) - USE(general_flat_rgba_line); - else - USE(general_flat_ci_line); - } - } else { - if (ctx->Light.ShadeModel==GL_SMOOTH) { - /* Width==1, non-stippled, smooth-shaded */ - if (ctx->Depth.Test || ctx->Fog.Enabled) { + if (ctx->Light.ShadeModel == GL_SMOOTH) { + if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0 + || ctx->Line.StippleFlag) { if (rgbmode) - USE(smooth_rgba_z_line); + USE(general_smooth_rgba_line); else - USE(smooth_ci_z_line); + USE(general_smooth_ci_line); } else { if (rgbmode) @@ -1091,12 +855,12 @@ _swrast_choose_line( GLcontext *ctx ) } } else { - /* Width==1, non-stippled, flat-shaded */ - if (ctx->Depth.Test || ctx->Fog.Enabled) { + if (ctx->Depth.Test || ctx->Fog.Enabled || ctx->Line.Width != 1.0 + || ctx->Line.StippleFlag) { if (rgbmode) - USE(flat_rgba_z_line); + USE(general_flat_rgba_line); else - USE(flat_ci_z_line); + USE(general_flat_ci_line); } else { if (rgbmode) @@ -1107,11 +871,11 @@ _swrast_choose_line( GLcontext *ctx ) } } } - else if (ctx->RenderMode==GL_FEEDBACK) { + else if (ctx->RenderMode == GL_FEEDBACK) { USE(_mesa_feedback_line); } else { - /* GL_SELECT mode */ + ASSERT(ctx->RenderMode == GL_SELECT); USE(_mesa_select_line); } diff --git a/xc/extras/Mesa/src/swrast/s_linetemp.h b/xc/extras/Mesa/src/swrast/s_linetemp.h index c5e7984c5..9c7541315 100644 --- a/xc/extras/Mesa/src/swrast/s_linetemp.h +++ b/xc/extras/Mesa/src/swrast/s_linetemp.h @@ -1,8 +1,7 @@ -/* $Id: s_linetemp.h,v 1.1.1.1 2002/10/22 13:06:55 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -56,11 +55,7 @@ * Optionally, one may provide one-time setup code * SETUP_CODE - code which is to be executed once per line * - * To enable line stippling define STIPPLE = 1 - * To enable wide lines define WIDE = 1 - * - * To actually "plot" each pixel either the PLOT macro or - * (XMAJOR_PLOT and YMAJOR_PLOT macros) must be defined... + * To actually "plot" each pixel the PLOT macro must be defined... * PLOT(X,Y) - code to plot a pixel. Example: * if (Z < *zPtr) { * *zPtr = Z; @@ -140,16 +135,6 @@ PIXEL_TYPE *pixelPtr; GLint pixelXstep, pixelYstep; #endif -#ifdef STIPPLE - SWcontext *swrast = SWRAST_CONTEXT(ctx); -#endif -#ifdef WIDE - /* for wide lines, draw all X in [x+min, x+max] or Y in [y+min, y+max] */ - GLint width, min, max; - width = (GLint) CLAMP( ctx->Line.Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH ); - min = (width-1) / -2; - max = min + width - 1; -#endif #ifdef INTERP_TEX { tex[0] = invw0 * vert0->texcoord[0][0]; @@ -188,6 +173,19 @@ return; } + /* + printf("%s():\n", __FUNCTION__); + printf(" (%f, %f, %f) -> (%f, %f, %f)\n", + vert0->win[0], vert0->win[1], vert0->win[2], + vert1->win[0], vert1->win[1], vert1->win[2]); + printf(" (%d, %d, %d) -> (%d, %d, %d)\n", + vert0->color[0], vert0->color[1], vert0->color[2], + vert1->color[0], vert1->color[1], vert1->color[2]); + printf(" (%d, %d, %d) -> (%d, %d, %d)\n", + vert0->specular[0], vert0->specular[1], vert0->specular[2], + vert1->specular[0], vert1->specular[1], vert1->specular[2]); + */ + /* * Despite being clipped to the view volume, the line's window coordinates * may just lie outside the window bounds. That is, if the legal window @@ -231,8 +229,8 @@ zPtr = (DEPTH_TYPE *) _mesa_zbuffer_address(ctx, x0, y0); # endif if (depthBits <= 16) { - z0 = FloatToFixed(vert0->win[2]); - z1 = FloatToFixed(vert1->win[2]); + z0 = FloatToFixed(vert0->win[2]) + FIXED_HALF; + z1 = FloatToFixed(vert1->win[2]) + FIXED_HALF; } else { z0 = (int) vert0->win[2]; @@ -301,6 +299,9 @@ GLint errorInc = dy+dy; GLint error = errorInc-dx; GLint errorDec = error-dx; +#ifdef SET_XMAJOR + xMajor = GL_TRUE; +#endif #ifdef INTERP_Z dz = (z1-z0) / dx; #endif @@ -348,11 +349,6 @@ #endif for (i=0;i<dx;i++) { -#ifdef STIPPLE - GLushort m; - m = 1 << ((swrast->StippleCounter/ctx->Line.StippleFactor) & 0xf); - if (ctx->Line.StipplePattern & m) { -#endif #ifdef INTERP_Z GLdepth Z = FixedToDepth(z0); #endif @@ -382,26 +378,9 @@ } } #endif -#ifdef WIDE - { - GLint yy; - GLint ymin = y0 + min; - GLint ymax = y0 + max; - for (yy=ymin;yy<=ymax;yy++) { - PLOT( x0, yy ); - } - } -#else -# ifdef XMAJOR_PLOT - XMAJOR_PLOT( x0, y0 ); -# else + PLOT( x0, y0 ); -# endif -#endif /*WIDE*/ -#ifdef STIPPLE - } - swrast->StippleCounter++; -#endif + #ifdef INTERP_XY x0 += xstep; #endif @@ -523,11 +502,6 @@ #endif for (i=0;i<dy;i++) { -#ifdef STIPPLE - GLushort m; - m = 1 << ((swrast->StippleCounter/ctx->Line.StippleFactor) & 0xf); - if (ctx->Line.StipplePattern & m) { -#endif #ifdef INTERP_Z GLdepth Z = FixedToDepth(z0); #endif @@ -557,26 +531,9 @@ } } #endif -#ifdef WIDE - { - GLint xx; - GLint xmin = x0 + min; - GLint xmax = x0 + max; - for (xx=xmin;xx<=xmax;xx++) { - PLOT( xx, y0 ); - } - } -#else -# ifdef YMAJOR_PLOT - YMAJOR_PLOT( x0, y0 ); -# else + PLOT( x0, y0 ); -# endif -#endif /*WIDE*/ -#ifdef STIPPLE - } - swrast->StippleCounter++; -#endif + #ifdef INTERP_XY y0 += ystep; #endif @@ -663,9 +620,6 @@ #undef BYTES_PER_ROW #undef SETUP_CODE #undef PLOT -#undef XMAJOR_PLOT -#undef YMAJOR_PLOT #undef CLIP_HACK -#undef STIPPLE -#undef WIDE #undef FixedToDepth +#undef SET_XMAJOR diff --git a/xc/extras/Mesa/src/swrast/s_logic.c b/xc/extras/Mesa/src/swrast/s_logic.c index 3521418bf..4f5b3b387 100644 --- a/xc/extras/Mesa/src/swrast/s_logic.c +++ b/xc/extras/Mesa/src/swrast/s_logic.c @@ -1,10 +1,9 @@ -/* $Id: s_logic.c,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -27,12 +26,12 @@ #include "glheader.h" #include "context.h" +#include "imports.h" #include "macros.h" #include "s_alphabuf.h" #include "s_context.h" #include "s_logic.h" -#include "s_pb.h" #include "s_span.h" @@ -40,9 +39,9 @@ /* * Apply logic op to array of CI pixels. */ -static void index_logicop( GLcontext *ctx, GLuint n, - GLuint index[], const GLuint dest[], - const GLubyte mask[] ) +static void +index_logicop( GLcontext *ctx, GLuint n, GLuint index[], const GLuint dest[], + const GLubyte mask[] ) { GLuint i; switch (ctx->Color.LogicOp) { @@ -166,32 +165,25 @@ static void index_logicop( GLcontext *ctx, GLuint n, * used if the device driver can't do logic ops. */ void -_mesa_logicop_ci_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLuint index[], const GLubyte mask[] ) +_mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span, + GLuint index[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint dest[MAX_WIDTH]; - /* Read dest values from frame buffer */ - (*swrast->Driver.ReadCI32Span)( ctx, n, x, y, dest ); - index_logicop( ctx, n, index, dest, mask ); -} + ASSERT(span->end < MAX_WIDTH); - -/* - * Apply the current logic operator to an array of CI pixels. This is only - * used if the device driver can't do logic ops. - */ -void -_mesa_logicop_ci_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLuint dest[PB_SIZE]; /* Read dest values from frame buffer */ - (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, dest, mask ); - index_logicop( ctx, n, index, dest, mask ); + if (span->arrayMask & SPAN_XY) { + (*swrast->Driver.ReadCI32Pixels)( ctx, span->end, + span->array->x, span->array->y, + dest, span->array->mask ); + } + else { + (*swrast->Driver.ReadCI32Span)( ctx, span->end, span->x, span->y, dest ); + } + + index_logicop( ctx, span->end, index, dest, span->array->mask ); } @@ -207,9 +199,9 @@ _mesa_logicop_ci_pixels( GLcontext *ctx, * Note: Since the R, G, B, and A channels are all treated the same we * process them as 4-byte GLuints instead of four GLubytes. */ -static void rgba_logicop_ui( const GLcontext *ctx, GLuint n, - const GLubyte mask[], - GLuint src[], const GLuint dest[] ) +static void +rgba_logicop_ui( const GLcontext *ctx, GLuint n, const GLubyte mask[], + GLuint src[], const GLuint dest[] ) { GLuint i; switch (ctx->Color.LogicOp) { @@ -332,9 +324,9 @@ static void rgba_logicop_ui( const GLcontext *ctx, GLuint n, * As above, but operate on GLchan values * Note: need to pass n = numPixels * 4. */ -static void rgba_logicop_chan( const GLcontext *ctx, GLuint n, - const GLubyte mask[], - GLchan srcPtr[], const GLchan destPtr[] ) +static void +rgba_logicop_chan( const GLcontext *ctx, GLuint n, const GLubyte mask[], + GLchan srcPtr[], const GLchan destPtr[] ) { #if CHAN_TYPE == GL_FLOAT GLuint *src = (GLuint *) srcPtr; @@ -466,46 +458,40 @@ static void rgba_logicop_chan( const GLcontext *ctx, GLuint n, /* * Apply the current logic operator to a span of RGBA pixels. - * This is only used if the device driver can't do logic ops. + * We can handle horizontal runs of pixels (spans) or arrays of x/y + * pixel coordinates. */ void -_mesa_logicop_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, - GLchan rgba[][4], const GLubyte mask[] ) +_mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span, + GLchan rgba[][4] ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan dest[MAX_WIDTH][4]; - _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); - if (sizeof(GLchan) * 4 == sizeof(GLuint)) { - rgba_logicop_ui(ctx, n, mask, (GLuint *) rgba, (const GLuint *) dest); + + ASSERT(span->end < MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_RGBA); + + if (span->arrayMask & SPAN_XY) { + (*swrast->Driver.ReadRGBAPixels)(ctx, span->end, + span->array->x, span->array->y, + dest, span->array->mask); + if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { + _mesa_read_alpha_pixels(ctx, span->end, + span->array->x, span->array->y, + dest, span->array->mask); + } } else { - rgba_logicop_chan(ctx, 4 * n, mask, - (GLchan *) rgba, (const GLchan *) dest); + _mesa_read_rgba_span(ctx, ctx->DrawBuffer, span->end, + span->x, span->y, dest); } -} - - -/* - * Apply the current logic operator to an array of RGBA pixels. - * This is only used if the device driver can't do logic ops. - */ -void -_mesa_logicop_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLchan rgba[][4], const GLubyte mask[] ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLchan dest[PB_SIZE][4]; - (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); - if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { - _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); - } if (sizeof(GLchan) * 4 == sizeof(GLuint)) { - rgba_logicop_ui(ctx, n, mask, (GLuint *) rgba, (const GLuint *) dest); + rgba_logicop_ui(ctx, span->end, span->array->mask, + (GLuint *) rgba, (const GLuint *) dest); } else { - rgba_logicop_chan(ctx, 4 * n, mask, + rgba_logicop_chan(ctx, 4 * span->end, span->array->mask, (GLchan *) rgba, (const GLchan *) dest); } } diff --git a/xc/extras/Mesa/src/swrast/s_logic.h b/xc/extras/Mesa/src/swrast/s_logic.h index 8ac68f830..820451d9b 100644 --- a/xc/extras/Mesa/src/swrast/s_logic.h +++ b/xc/extras/Mesa/src/swrast/s_logic.h @@ -1,10 +1,9 @@ -/* $Id: s_logic.h,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -34,26 +33,13 @@ extern void -_mesa_logicop_ci_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLuint index[], - const GLubyte mask[] ); +_mesa_logicop_ci_span( GLcontext *ctx, const struct sw_span *span, + GLuint index[] ); extern void -_mesa_logicop_ci_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ); - - -extern void -_mesa_logicop_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLchan rgba[][4], const GLubyte mask[] ); - - -extern void -_mesa_logicop_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLchan rgba[][4], const GLubyte mask[] ); +_mesa_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span, + GLchan rgba[][4] ); #endif diff --git a/xc/extras/Mesa/src/swrast/s_masking.c b/xc/extras/Mesa/src/swrast/s_masking.c index d4d57140d..74e1fb5bc 100644 --- a/xc/extras/Mesa/src/swrast/s_masking.c +++ b/xc/extras/Mesa/src/swrast/s_masking.c @@ -1,10 +1,9 @@ -/* $Id: s_masking.c,v 1.1.1.1 2002/10/22 13:06:44 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -37,62 +36,70 @@ #include "s_alphabuf.h" #include "s_context.h" #include "s_masking.h" -#include "s_pb.h" #include "s_span.h" -/* - * Apply glColorMask to a span of RGBA pixels. - */ + void -_mesa_mask_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLchan rgba[][4] ) +_mesa_mask_rgba_span( GLcontext *ctx, const struct sw_span *span, + GLchan rgba[][4] ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan dest[MAX_WIDTH][4]; - GLuint i; - #if CHAN_BITS == 8 - GLuint srcMask = *((GLuint*)ctx->Color.ColorMask); GLuint dstMask = ~srcMask; GLuint *rgba32 = (GLuint *) rgba; GLuint *dest32 = (GLuint *) dest; +#else + const GLboolean rMask = ctx->Color.ColorMask[RCOMP]; + const GLboolean gMask = ctx->Color.ColorMask[GCOMP]; + const GLboolean bMask = ctx->Color.ColorMask[BCOMP]; + const GLboolean aMask = ctx->Color.ColorMask[ACOMP]; +#endif + const GLuint n = span->end; + GLuint i; - _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); + ASSERT(n < MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_RGBA); + + if (span->arrayMask & SPAN_XY) { + (*swrast->Driver.ReadRGBAPixels)(ctx, n, span->array->x, span->array->y, + dest, span->array->mask); + if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { + _mesa_read_alpha_pixels(ctx, n, span->array->x, span->array->y, + dest, span->array->mask); + } + } + else { + _mesa_read_rgba_span(ctx, ctx->DrawBuffer, n, span->x, span->y, dest); + } + +#if CHAN_BITS == 8 for (i = 0; i < n; i++) { rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); } - #else - - const GLint rMask = ctx->Color.ColorMask[RCOMP]; - const GLint gMask = ctx->Color.ColorMask[GCOMP]; - const GLint bMask = ctx->Color.ColorMask[BCOMP]; - const GLint aMask = ctx->Color.ColorMask[ACOMP]; - - _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); for (i = 0; i < n; i++) { if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP]; if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP]; } - #endif } + /* - * Apply glColorMask to an array of RGBA pixels. + * Apply glColorMask to a span of RGBA pixels. */ void -_mesa_mask_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLchan rgba[][4], const GLubyte mask[] ) +_mesa_mask_rgba_array( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLchan dest[PB_SIZE][4]; + GLchan dest[MAX_WIDTH][4]; GLuint i; #if CHAN_BITS == 8 @@ -102,12 +109,8 @@ _mesa_mask_rgba_pixels( GLcontext *ctx, GLuint *rgba32 = (GLuint *) rgba; GLuint *dest32 = (GLuint *) dest; - (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); - if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { - _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); - } - - for (i=0; i<n; i++) { + _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); + for (i = 0; i < n; i++) { rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask); } @@ -118,11 +121,7 @@ _mesa_mask_rgba_pixels( GLcontext *ctx, const GLint bMask = ctx->Color.ColorMask[BCOMP]; const GLint aMask = ctx->Color.ColorMask[ACOMP]; - (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); - if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { - _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); - } - + _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); for (i = 0; i < n; i++) { if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP]; if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP]; @@ -135,43 +134,53 @@ _mesa_mask_rgba_pixels( GLcontext *ctx, -/* - * Apply glIndexMask to a span of CI pixels. - */ void -_mesa_mask_index_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLuint index[] ) +_mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span, + GLuint index[] ) { - GLuint i; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint msrc = ctx->Color.IndexMask; + const GLuint mdest = ~msrc; GLuint fbindexes[MAX_WIDTH]; - GLuint msrc, mdest; + GLuint i; - _mesa_read_index_span( ctx, ctx->DrawBuffer, n, x, y, fbindexes ); + ASSERT(span->arrayMask & SPAN_INDEX); + ASSERT(span->end < MAX_WIDTH); - msrc = ctx->Color.IndexMask; - mdest = ~msrc; + if (span->arrayMask & SPAN_XY) { - for (i=0;i<n;i++) { - index[i] = (index[i] & msrc) | (fbindexes[i] & mdest); + (*swrast->Driver.ReadCI32Pixels)(ctx, span->end, span->array->x, + span->array->y, fbindexes, + span->array->mask); + + for (i = 0; i < span->end; i++) { + index[i] = (index[i] & msrc) | (fbindexes[i] & mdest); + } + } + else { + _mesa_read_index_span(ctx, ctx->DrawBuffer, span->end, span->x, span->y, + fbindexes ); + + for (i = 0; i < span->end; i++) { + index[i] = (index[i] & msrc) | (fbindexes[i] & mdest); + } } } /* - * Apply glIndexMask to an array of CI pixels. + * Apply glIndexMask to a span of CI pixels. */ void -_mesa_mask_index_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ) +_mesa_mask_index_array( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[] ) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); GLuint i; - GLuint fbindexes[PB_SIZE]; + GLuint fbindexes[MAX_WIDTH]; GLuint msrc, mdest; - (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, fbindexes, mask ); + _mesa_read_index_span( ctx, ctx->DrawBuffer, n, x, y, fbindexes ); msrc = ctx->Color.IndexMask; mdest = ~msrc; diff --git a/xc/extras/Mesa/src/swrast/s_masking.h b/xc/extras/Mesa/src/swrast/s_masking.h index f79acf413..8b5c86366 100644 --- a/xc/extras/Mesa/src/swrast/s_masking.h +++ b/xc/extras/Mesa/src/swrast/s_masking.h @@ -1,10 +1,9 @@ -/* $Id: s_masking.h,v 1.1.1.1 2002/10/22 13:06:44 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -37,39 +36,26 @@ * Implement glColorMask for a span of RGBA pixels. */ extern void -_mesa_mask_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, +_mesa_mask_rgba_span( GLcontext *ctx, const struct sw_span *span, GLchan rgba[][4] ); - -/* - * Implement glColorMask for an array of RGBA pixels. - */ extern void -_mesa_mask_rgba_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLchan rgba[][4], const GLubyte mask[] ); - +_mesa_mask_rgba_array( GLcontext *ctx, GLuint n, GLint x, GLint y, + GLchan rgba[][4] ); /* * Implement glIndexMask for a span of CI pixels. */ extern void -_mesa_mask_index_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLuint index[] ); +_mesa_mask_index_span( GLcontext *ctx, const struct sw_span *span, + GLuint index[] ); - -/* - * Implement glIndexMask for an array of CI pixels. - */ extern void -_mesa_mask_index_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLuint index[], const GLubyte mask[] ); - +_mesa_mask_index_array( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[] ); #endif diff --git a/xc/extras/Mesa/src/swrast/s_pb.c b/xc/extras/Mesa/src/swrast/s_pb.c deleted file mode 100644 index a0da3a6b3..000000000 --- a/xc/extras/Mesa/src/swrast/s_pb.c +++ /dev/null @@ -1,517 +0,0 @@ -/* $Id: s_pb.c,v 1.1.1.1 2002/10/22 13:06:53 alanh Exp $ */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - - - -/* - * Pixel buffer: - * - * As fragments are produced (by point, line, and bitmap drawing) they - * are accumlated in a buffer. When the buffer is full or has to be - * flushed (glEnd), we apply all enabled rasterization functions to the - * pixels and write the results to the display buffer. The goal is to - * maximize the number of pixels processed inside loops and to minimize - * the number of function calls. - */ - - -#include "glheader.h" -#include "macros.h" -#include "mem.h" - -#include "s_alpha.h" -#include "s_alphabuf.h" -#include "s_blend.h" -#include "s_context.h" -#include "s_depth.h" -#include "s_fog.h" -#include "s_logic.h" -#include "s_masking.h" -#include "s_pb.h" -#include "s_scissor.h" -#include "s_stencil.h" -#include "s_texture.h" - - - -/* - * Allocate and initialize a new pixel buffer structure. - */ -struct pixel_buffer *_mesa_alloc_pb(void) -{ - struct pixel_buffer *pb; - pb = CALLOC_STRUCT(pixel_buffer); - if (pb) { - int i, j; - /* set non-zero fields */ - pb->mono = GL_TRUE; - - /* Set all lambda values to 0.0 since we don't do mipmapping for - * points or lines and want to use the level 0 texture image. - */ - for (j=0;j<MAX_TEXTURE_UNITS;j++) { - for (i=0; i<PB_SIZE; i++) { - pb->lambda[j][i] = 0.0; - } - } - } - return pb; -} - - - -/* - * Draw to more than one color buffer (or none). - */ -static void multi_write_index_pixels( GLcontext *ctx, GLuint n, - const GLint x[], const GLint y[], - const GLuint indexes[], - const GLubyte mask[] ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLuint bufferBit; - - if (ctx->Color.DrawBuffer == GL_NONE) - return; - - /* loop over four possible dest color buffers */ - for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color.DrawDestMask) { - GLuint indexTmp[PB_SIZE]; - ASSERT(n < PB_SIZE); - - if (bufferBit == FRONT_LEFT_BIT) - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); - else if (bufferBit == FRONT_RIGHT_BIT) - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); - else if (bufferBit == BACK_LEFT_BIT) - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); - else - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); - - /* make copy of incoming indexes */ - MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); - if (ctx->Color.IndexLogicOpEnabled) { - _mesa_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); - } - if (ctx->Color.IndexMask != 0xffffffff) { - _mesa_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); - } - (*swrast->Driver.WriteCI32Pixels)( ctx, n, x, y, indexTmp, mask ); - } - } - - /* restore default dest buffer */ - (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer); -} - - - -/* - * Draw to more than one RGBA color buffer (or none). - */ -static void multi_write_rgba_pixels( GLcontext *ctx, GLuint n, - const GLint x[], const GLint y[], - CONST GLchan rgba[][4], - const GLubyte mask[] ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLuint bufferBit; - - if (ctx->Color.DrawBuffer == GL_NONE) - return; - - /* loop over four possible dest color buffers */ - for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color.DrawDestMask) { - GLchan rgbaTmp[PB_SIZE][4]; - ASSERT(n < PB_SIZE); - - if (bufferBit == FRONT_LEFT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontLeftAlpha; - } - else if (bufferBit == FRONT_RIGHT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontRightAlpha; - } - else if (bufferBit == BACK_LEFT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackLeftAlpha; - } - else { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackRightAlpha; - } - - /* make copy of incoming colors */ - MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLchan) ); - - if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); - } - else if (ctx->Color.BlendEnabled) { - _mesa_blend_pixels( ctx, n, x, y, rgbaTmp, mask ); - } - if (*((GLuint *) &ctx->Color.ColorMask) != 0xffffffff) { - _mesa_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); - } - - (*swrast->Driver.WriteRGBAPixels)( ctx, n, x, y, - (const GLchan (*)[4])rgbaTmp, mask ); - if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_pixels( ctx, n, x, y, - (const GLchan (*)[4])rgbaTmp, mask ); - } - } - } - - /* restore default dest buffer */ - (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer); -} - - - -/* - * Add specular color to primary color. This is used only when - * GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR. - */ -static void add_colors( GLuint n, GLchan rgba[][4], CONST GLchan spec[][3] ) -{ - GLuint i; - for (i=0; i<n; i++) { - GLint r = rgba[i][RCOMP] + spec[i][RCOMP]; - GLint g = rgba[i][GCOMP] + spec[i][GCOMP]; - GLint b = rgba[i][BCOMP] + spec[i][BCOMP]; - rgba[i][RCOMP] = MIN2(r, CHAN_MAX); - rgba[i][GCOMP] = MIN2(g, CHAN_MAX); - rgba[i][BCOMP] = MIN2(b, CHAN_MAX); - } -} - - - -/* - * When the pixel buffer is full, or needs to be flushed, call this - * function. All the pixels in the pixel buffer will be subjected - * to texturing, scissoring, stippling, alpha testing, stenciling, - * depth testing, blending, and finally written to the frame buffer. - */ -void _mesa_flush_pb( GLcontext *ctx ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLuint RasterMask = swrast->_RasterMask; - - /* Pixel colors may be changed if any of these raster ops enabled */ - const GLuint modBits = FOG_BIT | TEXTURE_BIT | BLEND_BIT | - MASKING_BIT | LOGIC_OP_BIT; - struct pixel_buffer *PB = swrast->PB; - GLubyte mask[PB_SIZE]; - - if (PB->count == 0) - goto CleanUp; - - /* initialize mask array and clip pixels simultaneously */ - { - const GLint xmin = ctx->DrawBuffer->_Xmin; - const GLint xmax = ctx->DrawBuffer->_Xmax; - const GLint ymin = ctx->DrawBuffer->_Ymin; - const GLint ymax = ctx->DrawBuffer->_Ymax; - const GLuint n = PB->count; - GLint *x = PB->x; - GLint *y = PB->y; - GLuint i; - for (i = 0; i < n; i++) { - mask[i] = (x[i] >= xmin) & (x[i] < xmax) & (y[i] >= ymin) & (y[i] < ymax); - } - } - - if (ctx->Visual.rgbMode) { - /* - * RGBA COLOR PIXELS - */ - - /* If each pixel can be of a different color... */ - if ((RasterMask & modBits) || !PB->mono) { - - if (PB->mono) { - /* copy mono color into rgba array */ - GLuint i; - for (i = 0; i < PB->count; i++) { - COPY_CHAN4(PB->rgba[i], PB->currentColor); - } - } - - if (ctx->Texture._ReallyEnabled) { - GLchan primary_rgba[PB_SIZE][4]; - GLuint texUnit; - - /* must make a copy of primary colors since they may be modified */ - MEMCPY(primary_rgba, PB->rgba, 4 * PB->count * sizeof(GLchan)); - - for (texUnit = 0; texUnit < ctx->Const.MaxTextureUnits; texUnit++){ - _swrast_texture_fragments( ctx, texUnit, PB->count, - PB->s[texUnit], PB->t[texUnit], - PB->u[texUnit], PB->lambda[texUnit], - (CONST GLchan (*)[4]) primary_rgba, - PB->rgba ); - } - } - - if ((ctx->Fog.ColorSumEnabled || - (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR - && ctx->Light.Enabled)) && PB->haveSpec) { - /* add specular color to primary color */ - add_colors( PB->count, PB->rgba, (const GLchan (*)[3]) PB->spec ); - } - - if (ctx->Fog.Enabled) { - if (swrast->_PreferPixelFog) - _mesa_depth_fog_rgba_pixels( ctx, PB->count, PB->z, PB->rgba ); - else - _mesa_fog_rgba_pixels( ctx, PB->count, PB->fog, PB->rgba ); - } - - /* Antialias coverage application */ - if (PB->haveCoverage) { - const GLuint n = PB->count; - GLuint i; - for (i = 0; i < n; i++) { - PB->rgba[i][ACOMP] = (GLchan) (PB->rgba[i][ACOMP] * PB->coverage[i]); - } - } - - /* Scissoring already done above */ - - if (ctx->Color.AlphaEnabled) { - if (_mesa_alpha_test( ctx, PB->count, - (const GLchan (*)[4]) PB->rgba, mask )==0) { - goto CleanUp; - } - } - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, - PB->x, PB->y, PB->z, mask) == 0) { - goto CleanUp; - } - } - else if (ctx->Depth.Test) { - /* regular depth testing */ - _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); - } - - - if (RasterMask & MULTI_DRAW_BIT) { - multi_write_rgba_pixels( ctx, PB->count, PB->x, PB->y, - (const GLchan (*)[4])PB->rgba, mask ); - } - else { - /* normal case: write to exactly one buffer */ - const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); - - if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_pixels( ctx, PB->count, PB->x, PB->y, - PB->rgba, mask); - } - else if (ctx->Color.BlendEnabled) { - _mesa_blend_pixels( ctx, PB->count, PB->x, PB->y, PB->rgba, mask); - } - if (colorMask == 0x0) { - goto CleanUp; - } - else if (colorMask != 0xffffffff) { - _mesa_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); - } - - (*swrast->Driver.WriteRGBAPixels)( ctx, PB->count, PB->x, PB->y, - (const GLchan (*)[4]) PB->rgba, - mask ); - if (RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, - (const GLchan (*)[4]) PB->rgba, mask ); - } - } - } - else { - /* Same color for all pixels */ - - /* Scissoring already done above */ - - if (ctx->Color.AlphaEnabled) { - if (_mesa_alpha_test( ctx, PB->count, - (const GLchan (*)[4]) PB->rgba, mask )==0) { - goto CleanUp; - } - } - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, - PB->x, PB->y, PB->z, mask) == 0) { - goto CleanUp; - } - } - else if (ctx->Depth.Test) { - /* regular depth testing */ - _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); - } - - if (ctx->Color.DrawBuffer == GL_NONE) { - goto CleanUp; - } - - if (RasterMask & MULTI_DRAW_BIT) { - if (PB->mono) { - /* copy mono color into rgba array */ - GLuint i; - for (i = 0; i < PB->count; i++) { - COPY_CHAN4(PB->rgba[i], PB->currentColor); - } - } - multi_write_rgba_pixels( ctx, PB->count, PB->x, PB->y, - (const GLchan (*)[4]) PB->rgba, mask ); - } - else { - /* normal case: write to exactly one buffer */ - (*swrast->Driver.WriteMonoRGBAPixels)( ctx, PB->count, PB->x, PB->y, - PB->currentColor, mask ); - if (RasterMask & ALPHABUF_BIT) { - _mesa_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, - PB->currentColor[ACOMP], mask ); - } - } - /*** ALL DONE ***/ - } - } - else { - /* - * COLOR INDEX PIXELS - */ - - /* If we may be writting pixels with different indexes... */ - if ((RasterMask & modBits) || !PB->mono) { - - if (PB->mono) { - GLuint i; - for (i = 0; i < PB->count; i++) { - PB->index[i] = PB->currentIndex; - } - } - if (ctx->Fog.Enabled) { - if (swrast->_PreferPixelFog) - _mesa_depth_fog_ci_pixels( ctx, PB->count, PB->z, PB->index ); - else - _mesa_fog_ci_pixels( ctx, PB->count, PB->fog, PB->index ); - } - - /* Antialias coverage application */ - if (PB->haveCoverage) { - const GLuint n = PB->count; - GLuint i; - for (i = 0; i < n; i++) { - GLint frac = (GLint) (15.0 * PB->coverage[i]); - PB->index[i] = (PB->index[i] & ~0xf) | frac; - } - } - - /* Scissoring already done above */ - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, - PB->x, PB->y, PB->z, mask) == 0) { - goto CleanUp; - } - } - else if (ctx->Depth.Test) { - /* regular depth testing */ - _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); - } - if (RasterMask & MULTI_DRAW_BIT) { - multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); - } - else { - /* normal case: write to exactly one buffer */ - - if (ctx->Color.IndexLogicOpEnabled) { - _mesa_logicop_ci_pixels(ctx, PB->count, PB->x, PB->y, - PB->index, mask); - } - if (ctx->Color.IndexMask != 0xffffffff) { - _mesa_mask_index_pixels(ctx, PB->count, PB->x, PB->y, - PB->index, mask); - } - (*swrast->Driver.WriteCI32Pixels)( ctx, PB->count, PB->x, PB->y, - PB->index, mask ); - } - - /*** ALL DONE ***/ - } - else { - /* Same color index for all pixels */ - - /* Scissoring already done above */ - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, - PB->x, PB->y, PB->z, mask) == 0) { - goto CleanUp; - } - } - else if (ctx->Depth.Test) { - /* regular depth testing */ - _mesa_depth_test_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask); - } - - if (RasterMask & MULTI_DRAW_BIT) { - multi_write_index_pixels(ctx, PB->count, PB->x, PB->y, - PB->index, mask); - } - else { - /* normal case: write to exactly one buffer */ - (*swrast->Driver.WriteMonoCIPixels)(ctx, PB->count, PB->x, PB->y, - PB->currentIndex, mask); - } - } - } - -CleanUp: - PB->count = 0; - PB->mono = GL_TRUE; - PB->haveSpec = GL_FALSE; - PB->haveCoverage = GL_FALSE; -} - - -void -_swrast_flush( GLcontext *ctx ) -{ - if (SWRAST_CONTEXT(ctx)->PB->count > 0) - _mesa_flush_pb(ctx); -} diff --git a/xc/extras/Mesa/src/swrast/s_pb.h b/xc/extras/Mesa/src/swrast/s_pb.h deleted file mode 100644 index 72d2df353..000000000 --- a/xc/extras/Mesa/src/swrast/s_pb.h +++ /dev/null @@ -1,244 +0,0 @@ -/* $Id: s_pb.h,v 1.1.1.1 2002/10/22 13:06:53 alanh Exp $ */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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 PB_H -#define PB_H - - -#include "mtypes.h" -#include "swrast.h" -#include "colormac.h" - - -/* - * Pixel buffer size, must be larger than MAX_WIDTH. - */ -#define PB_SIZE (3*MAX_WIDTH) - - -struct pixel_buffer { - GLchan currentColor[4]; /* Current color, for subsequent pixels */ - GLuint currentIndex; /* Current index, for subsequent pixels */ - GLuint count; /* Number of pixels in buffer */ - GLboolean mono; /* Same color or index for all pixels? */ - GLboolean haveSpec; /* any specular colors? */ - GLboolean haveCoverage; /* apply AA coverage? */ - - GLint x[PB_SIZE]; /* X window coord in [0,MAX_WIDTH) */ - GLint y[PB_SIZE]; /* Y window coord in [0,MAX_HEIGHT) */ - GLdepth z[PB_SIZE]; /* Z window coord in [0,Visual.MaxDepth] */ - GLfloat fog[PB_SIZE]; /* Fog window coord in [0,1] */ - GLchan rgba[PB_SIZE][4]; /* Colors */ - GLchan spec[PB_SIZE][3]; /* Separate specular colors */ - GLuint index[PB_SIZE]; /* Color indexes */ - GLfloat coverage[PB_SIZE]; /* Antialiasing coverage in [0,1] */ - GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture S coordinates */ - GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture T coordinates */ - GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture R coordinates */ - GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture lambda values */ -}; - - - -/* - * Set the color used for all subsequent pixels in the buffer. - */ -#define PB_SET_COLOR( PB, R, G, B, A ) \ -do { \ - if ((PB)->count > 0) \ - (PB)->mono = GL_FALSE; \ - (PB)->currentColor[RCOMP] = (R); \ - (PB)->currentColor[GCOMP] = (G); \ - (PB)->currentColor[BCOMP] = (B); \ - (PB)->currentColor[ACOMP] = (A); \ -} while (0) - - -/* - * Set the color index used for all subsequent pixels in the buffer. - */ -#define PB_SET_INDEX( PB, I ) \ -do { \ - if ((PB)->count > 0) \ - (PB)->mono = GL_FALSE; \ - (PB)->currentIndex = (I); \ -} while (0) - - -/* - * "write" a pixel using current color or index - */ -#define PB_WRITE_PIXEL( PB, X, Y, Z, FOG ) \ -do { \ - GLuint count = (PB)->count; \ - (PB)->x[count] = X; \ - (PB)->y[count] = Y; \ - (PB)->z[count] = Z; \ - (PB)->fog[count] = FOG; \ - COPY_CHAN4((PB)->rgba[count], (PB)->currentColor); \ - (PB)->index[count] = (PB)->currentIndex; \ - (PB)->count++; \ -} while (0) - - -/* - * "write" an RGBA pixel - */ -#define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, FOG, R, G, B, A ) \ -do { \ - GLuint count = (PB)->count; \ - (PB)->x[count] = X; \ - (PB)->y[count] = Y; \ - (PB)->z[count] = Z; \ - (PB)->fog[count] = FOG; \ - (PB)->rgba[count][RCOMP] = R; \ - (PB)->rgba[count][GCOMP] = G; \ - (PB)->rgba[count][BCOMP] = B; \ - (PB)->rgba[count][ACOMP] = A; \ - (PB)->mono = GL_FALSE; \ - (PB)->count++; \ -} while (0) - - -/* - * "write" a color-index pixel - */ -#define PB_WRITE_CI_PIXEL( PB, X, Y, Z, FOG, I ) \ -do { \ - GLuint count = (PB)->count; \ - (PB)->x[count] = X; \ - (PB)->y[count] = Y; \ - (PB)->z[count] = Z; \ - (PB)->fog[count] = FOG; \ - (PB)->index[count] = I; \ - (PB)->mono = GL_FALSE; \ - (PB)->count++; \ -} while (0) - - - -/* - * "write" an RGBA pixel with texture coordinates - */ -#define PB_WRITE_TEX_PIXEL( PB, X, Y, Z, FOG, R, G, B, A, S, T, U ) \ -do { \ - GLuint count = (PB)->count; \ - (PB)->x[count] = X; \ - (PB)->y[count] = Y; \ - (PB)->z[count] = Z; \ - (PB)->fog[count] = FOG; \ - (PB)->rgba[count][RCOMP] = R; \ - (PB)->rgba[count][GCOMP] = G; \ - (PB)->rgba[count][BCOMP] = B; \ - (PB)->rgba[count][ACOMP] = A; \ - (PB)->s[0][count] = S; \ - (PB)->t[0][count] = T; \ - (PB)->u[0][count] = U; \ - (PB)->mono = GL_FALSE; \ - (PB)->count++; \ -} while (0) - - -/* - * "write" an RGBA pixel with multiple texture coordinates - */ -#define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, FOG, R, G, B, A, TEXCOORDS ) \ -do { \ - GLuint count = (PB)->count; \ - GLuint unit; \ - (PB)->x[count] = X; \ - (PB)->y[count] = Y; \ - (PB)->z[count] = Z; \ - (PB)->fog[count] = FOG; \ - (PB)->rgba[count][RCOMP] = R; \ - (PB)->rgba[count][GCOMP] = G; \ - (PB)->rgba[count][BCOMP] = B; \ - (PB)->rgba[count][ACOMP] = A; \ - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { \ - if (ctx->Texture.Unit[unit]._ReallyEnabled) { \ - (PB)->s[unit][count] = TEXCOORDS[unit][0]; \ - (PB)->t[unit][count] = TEXCOORDS[unit][1]; \ - (PB)->u[unit][count] = TEXCOORDS[unit][2]; \ - } \ - } \ - (PB)->mono = GL_FALSE; \ - (PB)->count++; \ -} while (0) - - -/* - * "write" an RGBA pixel with multiple texture coordinates and specular color - */ -#define PB_WRITE_MULTITEX_SPEC_PIXEL( PB, X, Y, Z, FOG, R, G, B, A, SR, SG, SB, TEXCOORDS )\ -do { \ - GLuint count = (PB)->count; \ - GLuint unit; \ - (PB)->haveSpec = GL_TRUE; \ - (PB)->x[count] = X; \ - (PB)->y[count] = Y; \ - (PB)->z[count] = Z; \ - (PB)->fog[count] = FOG; \ - (PB)->rgba[count][RCOMP] = R; \ - (PB)->rgba[count][GCOMP] = G; \ - (PB)->rgba[count][BCOMP] = B; \ - (PB)->rgba[count][ACOMP] = A; \ - (PB)->spec[count][RCOMP] = SR; \ - (PB)->spec[count][GCOMP] = SG; \ - (PB)->spec[count][BCOMP] = SB; \ - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { \ - if (ctx->Texture.Unit[unit]._ReallyEnabled) { \ - (PB)->s[unit][count] = TEXCOORDS[unit][0]; \ - (PB)->t[unit][count] = TEXCOORDS[unit][1]; \ - (PB)->u[unit][count] = TEXCOORDS[unit][2]; \ - } \ - } \ - (PB)->mono = GL_FALSE; \ - (PB)->count++; \ -} while (0) - - -#define PB_COVERAGE(PB, COVERAGE) \ - (PB)->coverage[(PB)->count] = COVERAGE; - - -/* - * Call this function at least every MAX_WIDTH pixels: - */ -#define PB_CHECK_FLUSH( CTX, PB ) \ -do { \ - if ((PB)->count >= PB_SIZE - MAX_WIDTH) { \ - _mesa_flush_pb( CTX ); \ - } \ -} while(0) - - -extern struct pixel_buffer *_mesa_alloc_pb(void); - -extern void _mesa_flush_pb( GLcontext *ctx ); - - -#endif diff --git a/xc/extras/Mesa/src/swrast/s_pixeltex.c b/xc/extras/Mesa/src/swrast/s_pixeltex.c index f52972ff7..776a38c91 100644 --- a/xc/extras/Mesa/src/swrast/s_pixeltex.c +++ b/xc/extras/Mesa/src/swrast/s_pixeltex.c @@ -1,10 +1,9 @@ -/* $Id: s_pixeltex.c,v 1.1.1.1 2002/10/22 13:06:56 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -35,47 +34,84 @@ #include "glheader.h" #include "colormac.h" +#include "imports.h" #include "s_context.h" #include "s_pixeltex.h" +#include "s_texture.h" /* * Convert RGBA values into strq texture coordinates. */ -void -_mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4], - GLfloat s[], GLfloat t[], GLfloat r[], GLfloat q[]) +static void +pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4], + GLfloat texcoord[][4]) { if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_COLOR) { GLuint i; for (i = 0; i < n; i++) { - s[i] = ctx->Current.RasterColor[RCOMP]; - t[i] = ctx->Current.RasterColor[GCOMP]; - r[i] = ctx->Current.RasterColor[BCOMP]; + texcoord[i][0] = ctx->Current.RasterColor[RCOMP]; + texcoord[i][1] = ctx->Current.RasterColor[GCOMP]; + texcoord[i][2] = ctx->Current.RasterColor[BCOMP]; } } else { GLuint i; ASSERT(ctx->Pixel.FragmentRgbSource == GL_PIXEL_GROUP_COLOR_SGIS); for (i = 0; i < n; i++) { - s[i] = CHAN_TO_FLOAT(rgba[i][RCOMP]); - t[i] = CHAN_TO_FLOAT(rgba[i][GCOMP]); - r[i] = CHAN_TO_FLOAT(rgba[i][BCOMP]); + texcoord[i][0] = CHAN_TO_FLOAT(rgba[i][RCOMP]); + texcoord[i][1] = CHAN_TO_FLOAT(rgba[i][GCOMP]); + texcoord[i][2] = CHAN_TO_FLOAT(rgba[i][BCOMP]); } } if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_COLOR) { GLuint i; for (i = 0; i < n; i++) { - q[i] = ctx->Current.RasterColor[ACOMP]; + texcoord[i][3] = ctx->Current.RasterColor[ACOMP]; } } else { GLuint i; ASSERT(ctx->Pixel.FragmentAlphaSource == GL_PIXEL_GROUP_COLOR_SGIS); for (i = 0; i < n; i++) { - q[i] = CHAN_TO_FLOAT(rgba[i][ACOMP]); + texcoord[i][3] = CHAN_TO_FLOAT(rgba[i][ACOMP]); + } + } +} + + + +/* + * Used by glDraw/CopyPixels: the incoming image colors are treated + * as texture coordinates. Use those coords to texture the image. + * This is for GL_SGIS_pixel_texture / GL_SGIX_pixel_texture. + */ +void +_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span) +{ + GLuint unit; + + ASSERT(!(span->arrayMask & SPAN_TEXTURE)); + span->arrayMask |= SPAN_TEXTURE; + + /* convert colors into texture coordinates */ + pixeltexgen( ctx, span->end, + (const GLchan (*)[4]) span->array->rgba, + span->array->texcoords[0] ); + + /* copy the new texture units for all enabled units */ + for (unit = 1; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + MEMCPY( span->array->texcoords[unit], span->array->texcoords[0], + span->end * 4 * sizeof(GLfloat) ); } } + + /* apply texture mapping */ + _swrast_texture_span( ctx, span ); + + /* this is a work-around to be fixed by initializing again span */ + span->arrayMask &= ~SPAN_TEXTURE; } diff --git a/xc/extras/Mesa/src/swrast/s_pixeltex.h b/xc/extras/Mesa/src/swrast/s_pixeltex.h index 7d1d8047c..6ef7a44df 100644 --- a/xc/extras/Mesa/src/swrast/s_pixeltex.h +++ b/xc/extras/Mesa/src/swrast/s_pixeltex.h @@ -1,10 +1,9 @@ -/* $Id: s_pixeltex.h,v 1.1.1.1 2002/10/22 13:06:56 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -31,9 +30,9 @@ #include "mtypes.h" #include "swrast.h" + extern void -_mesa_pixeltexgen(GLcontext *ctx, GLuint n, const GLchan rgba[][4], - GLfloat s[], GLfloat t[], GLfloat r[], GLfloat q[]); +_swrast_pixel_texture(GLcontext *ctx, struct sw_span *span); #endif diff --git a/xc/extras/Mesa/src/swrast/s_points.c b/xc/extras/Mesa/src/swrast/s_points.c index 75f4b7811..5ef41d9fb 100644 --- a/xc/extras/Mesa/src/swrast/s_points.c +++ b/xc/extras/Mesa/src/swrast/s_points.c @@ -1,10 +1,9 @@ -/* $Id: s_points.c,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -33,20 +32,19 @@ #include "texstate.h" #include "s_context.h" #include "s_feedback.h" -#include "s_pb.h" #include "s_points.h" #include "s_span.h" -#define INDEX 0x0 #define RGBA 0x1 -#define SMOOTH 0x2 -#define TEXTURE 0x4 -#define SPECULAR 0x8 -#define LARGE 0x10 -#define ATTENUATE 0x20 -#define SPRITE 0x40 +#define INDEX 0x2 +#define SMOOTH 0x4 +#define TEXTURE 0x8 +#define SPECULAR 0x10 +#define LARGE 0x20 +#define ATTENUATE 0x40 +#define SPRITE 0x80 /* @@ -148,12 +146,12 @@ /* * Sprite (textured point) */ -#define FLAGS (RGBA | TEXTURE | SPRITE) +#define FLAGS (RGBA | SPRITE) #define NAME sprite_point #include "s_pointtemp.h" -#define FLAGS (RGBA | ATTENUATE | TEXTURE | SPRITE) +#define FLAGS (RGBA | ATTENUATE | SPRITE) #define NAME atten_sprite_point #include "s_pointtemp.h" @@ -202,7 +200,8 @@ _swrast_choose_point( GLcontext *ctx ) GLboolean rgbMode = ctx->Visual.rgbMode; if (ctx->RenderMode==GL_RENDER) { - if (ctx->Point.SpriteMode) { + if (ctx->Point.PointSprite) { + /* GL_NV_point_sprite */ /* XXX this might not be good enough */ if (ctx->Point._Attenuated) USE(atten_sprite_point); @@ -212,10 +211,10 @@ _swrast_choose_point( GLcontext *ctx ) else if (ctx->Point.SmoothFlag) { /* Smooth points */ if (rgbMode) { - if (ctx->Point._Attenuated) { + if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { USE(atten_antialiased_rgba_point); } - else if (ctx->Texture._ReallyEnabled) { + else if (ctx->Texture._EnabledUnits) { USE(antialiased_tex_rgba_point); } else { @@ -226,9 +225,9 @@ _swrast_choose_point( GLcontext *ctx ) USE(antialiased_ci_point); } } - else if (ctx->Point._Attenuated) { + else if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) { if (rgbMode) { - if (ctx->Texture._ReallyEnabled) { + if (ctx->Texture._EnabledUnits) { if (ctx->Point.SmoothFlag) { USE(atten_antialiased_rgba_point); } @@ -245,7 +244,7 @@ _swrast_choose_point( GLcontext *ctx ) USE(atten_general_ci_point); } } - else if (ctx->Texture._ReallyEnabled && rgbMode) { + else if (ctx->Texture._EnabledUnits && rgbMode) { /* textured */ USE(textured_rgba_point); } diff --git a/xc/extras/Mesa/src/swrast/s_points.h b/xc/extras/Mesa/src/swrast/s_points.h index 0b2ec5ba6..40b442e95 100644 --- a/xc/extras/Mesa/src/swrast/s_points.h +++ b/xc/extras/Mesa/src/swrast/s_points.h @@ -1,4 +1,3 @@ -/* $Id: s_points.h,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -30,10 +29,10 @@ #include "mtypes.h" -void +extern void _swrast_choose_point( GLcontext *ctx ); -void +extern void _swrast_add_spec_terms_point( GLcontext *ctx, const SWvertex *v0 ); diff --git a/xc/extras/Mesa/src/swrast/s_pointtemp.h b/xc/extras/Mesa/src/swrast/s_pointtemp.h index efef56bc0..8f07fa25a 100644 --- a/xc/extras/Mesa/src/swrast/s_pointtemp.h +++ b/xc/extras/Mesa/src/swrast/s_pointtemp.h @@ -1,10 +1,9 @@ -/* $Id: s_pointtemp.h,v 1.1.1.1 2002/10/22 13:06:54 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -36,7 +35,7 @@ * SPECULAR = do separate specular color * LARGE = do points with diameter > 1 pixel * ATTENUATE = compute point size attenuation - * SPRITE = GL_MESA_sprite_point + * SPRITE = GL_NV_point_sprite * * Notes: LARGE and ATTENUATE are exclusive of each other. * TEXTURE requires RGBA @@ -53,7 +52,7 @@ * else if d > rmax2 then * fragment has 0% coverage * else - * fragement has % coverage = (d - rmin2) / (rmax2 - rmin2) + * fragment has % coverage = (d - rmin2) / (rmax2 - rmin2) */ @@ -61,49 +60,76 @@ static void NAME ( GLcontext *ctx, const SWvertex *vert ) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); - struct pixel_buffer *PB = swrast->PB; - - const GLint z = (GLint) (vert->win[2]); - +#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) + GLfloat size; +#endif +#if FLAGS & ATTENUATE + GLfloat alphaAtten; +#endif #if FLAGS & RGBA const GLchan red = vert->color[0]; const GLchan green = vert->color[1]; const GLchan blue = vert->color[2]; - GLchan alpha = vert->color[3]; + const GLchan alpha = vert->color[3]; +#endif #if FLAGS & SPECULAR - const GLchan sRed = vert->specular[0]; - const GLchan sGreen = vert->specular[1]; - const GLchan sBlue = vert->specular[2]; + const GLchan specRed = vert->specular[0]; + const GLchan specGreen = vert->specular[1]; + const GLchan specBlue = vert->specular[2]; #endif -#else - GLint index = vert->index; +#if FLAGS & INDEX + const GLuint colorIndex = vert->index; #endif -#if FLAGS & (ATTENUATE | LARGE | SMOOTH) - GLfloat size; -#endif -#if FLAGS & ATTENUATE - GLfloat alphaAtten; -#endif - #if FLAGS & TEXTURE GLfloat texcoord[MAX_TEXTURE_UNITS][4]; GLuint u; +#endif + SWcontext *swrast = SWRAST_CONTEXT(ctx); + struct sw_span *span = &(swrast->PointSpan); + + /* Cull primitives with malformed coordinates. + */ + { + float tmp = vert->win[0] + vert->win[1]; + if (IS_INF_OR_NAN(tmp)) + return; + } + + /* + * Span init + */ + span->interpMask = SPAN_FOG; + span->arrayMask = SPAN_XY | SPAN_Z; + span->fog = vert->fog; + span->fogStep = 0.0; +#if FLAGS & RGBA + span->arrayMask |= SPAN_RGBA; +#endif +#if FLAGS & SPECULAR + span->arrayMask |= SPAN_SPEC; +#endif +#if FLAGS & INDEX + span->arrayMask |= SPAN_INDEX; +#endif +#if FLAGS & TEXTURE + span->arrayMask |= SPAN_TEXTURE; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { - if (vert->texcoord[u][3] != 1.0 && vert->texcoord[u][3] != 0.0) { - texcoord[u][0] = vert->texcoord[u][0] / vert->texcoord[u][3]; - texcoord[u][1] = vert->texcoord[u][1] / vert->texcoord[u][3]; - texcoord[u][2] = vert->texcoord[u][2] / vert->texcoord[u][3]; - } - else { - texcoord[u][0] = vert->texcoord[u][0]; - texcoord[u][1] = vert->texcoord[u][1]; - texcoord[u][2] = vert->texcoord[u][2]; - } + const GLfloat q = vert->texcoord[u][3]; + const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q); + texcoord[u][0] = vert->texcoord[u][0] * invQ; + texcoord[u][1] = vert->texcoord[u][1] * invQ; + texcoord[u][2] = vert->texcoord[u][2] * invQ; + texcoord[u][3] = q; } } #endif +#if FLAGS & SMOOTH + span->arrayMask |= SPAN_COVERAGE; +#endif +#if FLAGS & SPRITE + span->arrayMask |= SPAN_TEXTURE; +#endif #if FLAGS & ATTENUATE if (vert->pointSize >= ctx->Point.Threshold) { @@ -115,78 +141,19 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) size = MAX2(ctx->Point.Threshold, ctx->Point.MinSize); alphaAtten = dsize * dsize; } -#elif FLAGS & (LARGE | SMOOTH) +#elif FLAGS & (LARGE | SMOOTH | SPRITE) size = ctx->Point._Size; #endif - /* Cull primitives with malformed coordinates. +#if FLAGS & (ATTENUATE | LARGE | SMOOTH | SPRITE) + /* + * Multi-pixel points */ - { - float tmp = vert->win[0] + vert->win[1]; - if (IS_INF_OR_NAN(tmp)) - return; - } - -#if FLAGS & SPRITE - { - SWcontext *swctx = SWRAST_CONTEXT(ctx); - const GLfloat radius = 0.5F * vert->pointSize; /* XXX threshold, alpha */ - SWvertex v0, v1, v2, v3; - GLuint unit; - - (void) red; - (void) green; - (void) blue; - (void) alpha; - (void) z; - - /* lower left corner */ - v0 = *vert; - v0.win[0] -= radius; - v0.win[1] -= radius; - - /* lower right corner */ - v1 = *vert; - v1.win[0] += radius; - v1.win[1] -= radius; - - /* upper right corner */ - v2 = *vert; - v2.win[0] += radius; - v2.win[1] += radius; - - /* upper left corner */ - v3 = *vert; - v3.win[0] -= radius; - v3.win[1] += radius; - - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { - v0.texcoord[unit][0] = 0.0; - v0.texcoord[unit][1] = 0.0; - v1.texcoord[unit][0] = 1.0; - v1.texcoord[unit][1] = 0.0; - v2.texcoord[unit][0] = 1.0; - v2.texcoord[unit][1] = 1.0; - v3.texcoord[unit][0] = 0.0; - v3.texcoord[unit][1] = 1.0; - } - } - - /* XXX if radius < threshold, attenuate alpha? */ - - /* XXX need to implement clipping!!! */ - - /* render */ - swctx->Triangle(ctx, &v0, &v1, &v2); - swctx->Triangle(ctx, &v0, &v2, &v3); - } - -#elif FLAGS & (LARGE | ATTENUATE | SMOOTH) - - { + {{ GLint x, y; const GLfloat radius = 0.5F * size; + const GLint z = (GLint) (vert->win[2] + 0.5F); + GLuint count; #if FLAGS & SMOOTH const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ const GLfloat rmax = radius + 0.7071F; @@ -218,109 +185,186 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) ymin = (GLint) vert->win[1] - iRadius + 1; ymax = ymin + iSize - 1; } +#endif /*SMOOTH*/ + + /* check if we need to flush */ + if (span->end + (xmax-xmin+1) * (ymax-ymin+1) >= MAX_WIDTH || + (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { +#if FLAGS & (TEXTURE | SPRITE) + if (ctx->Texture._EnabledUnits) + _mesa_write_texture_span(ctx, span); + else + _mesa_write_rgba_span(ctx, span); +#elif FLAGS & RGBA + _mesa_write_rgba_span(ctx, span); +#else + _mesa_write_index_span(ctx, span); #endif - (void) radius; + span->end = 0; + } + /* + * OK, generate fragments + */ + count = span->end; + (void) radius; for (y = ymin; y <= ymax; y++) { for (x = xmin; x <= xmax; x++) { -#if FLAGS & SMOOTH - /* compute coverage */ - const GLfloat dx = x - vert->win[0] + 0.5F; - const GLfloat dy = y - vert->win[1] + 0.5F; - const GLfloat dist2 = dx * dx + dy * dy; - if (dist2 < rmax2) { -#if FLAGS & RGBA - alpha = vert->color[3]; +#if FLAGS & (SPRITE | TEXTURE) + GLuint u; #endif - if (dist2 >= rmin2) { - /* compute partial coverage */ - PB_COVERAGE(PB, 1.0F - (dist2 - rmin2) * cscale); - } - else { - /* full coverage */ - PB_COVERAGE(PB, 1.0F); - } - -#endif /* SMOOTH */ -#if ((FLAGS & (ATTENUATE | RGBA)) == (ATTENUATE | RGBA)) - alpha = (GLchan) (alpha * alphaAtten); +#if FLAGS & RGBA + span->array->rgba[count][RCOMP] = red; + span->array->rgba[count][GCOMP] = green; + span->array->rgba[count][BCOMP] = blue; + span->array->rgba[count][ACOMP] = alpha; #endif - #if FLAGS & SPECULAR - PB_WRITE_MULTITEX_SPEC_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha, - sRed, sGreen, sBlue, - texcoord); -#elif FLAGS & TEXTURE - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { - PB_WRITE_MULTITEX_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha, - texcoord); - } - else if (ctx->Texture._ReallyEnabled) { - PB_WRITE_TEX_PIXEL(PB, x,y,z, vert->fog, - red, green, blue, alpha, - texcoord[0][0], - texcoord[0][1], - texcoord[0][2]); - } - else { - PB_WRITE_RGBA_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha); - } -#elif FLAGS & RGBA - PB_WRITE_RGBA_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha); -#else /* color index */ - PB_WRITE_CI_PIXEL(PB, x, y, z, vert->fog, index); + span->array->spec[count][RCOMP] = specRed; + span->array->spec[count][GCOMP] = specGreen; + span->array->spec[count][BCOMP] = specBlue; #endif -#if FLAGS & SMOOTH - } +#if FLAGS & INDEX + span->array->index[count] = colorIndex; +#endif +#if FLAGS & TEXTURE + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + COPY_4V(span->array->texcoords[u][count], texcoord[u]); + } + } #endif - } - } #if FLAGS & SMOOTH - PB->haveCoverage = GL_TRUE; + /* compute coverage */ + { + const GLfloat dx = x - vert->win[0] + 0.5F; + const GLfloat dy = y - vert->win[1] + 0.5F; + const GLfloat dist2 = dx * dx + dy * dy; + if (dist2 < rmax2) { + if (dist2 >= rmin2) { + /* compute partial coverage */ + span->array->coverage[count] = 1.0F - (dist2 - rmin2) * cscale; +#if FLAGS & INDEX + /* coverage in [0,15] */ + span->array->coverage[count] *= 15.0; #endif + } + else { + /* full coverage */ + span->array->coverage[count] = 1.0F; + } + + span->array->x[count] = x; + span->array->y[count] = y; + span->array->z[count] = z; + +#if (FLAGS & ATTENUATE) && (FLAGS & RGBA) + span->array->rgba[count][ACOMP] = (GLchan) (alpha * alphaAtten); +#elif FLAGS & RGBA + span->array->rgba[count][ACOMP] = alpha; +#endif /*ATTENUATE*/ + count++; + } /*if*/ + } - PB_CHECK_FLUSH(ctx,PB); - } +#else /*SMOOTH*/ -#else /* LARGE || ATTENUATE || SMOOTH*/ + /* not smooth (square points) */ + span->array->x[count] = x; + span->array->y[count] = y; + span->array->z[count] = z; - { - /* size == 1 */ - GLint x = (GLint) vert->win[0]; - GLint y = (GLint) vert->win[1]; -#if ((FLAGS & (SPECULAR | TEXTURE)) == (SPECULAR | TEXTURE)) - PB_WRITE_MULTITEX_SPEC_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha, - sRed, sGreen, sBlue, - texcoord); -#elif FLAGS & TEXTURE - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { - PB_WRITE_MULTITEX_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha, texcoord ); - } - else { - PB_WRITE_TEX_PIXEL(PB, x, y, z, vert->fog, - red, green, blue, alpha, - texcoord[0][0], texcoord[0][1], texcoord[0][2]); - } +#if FLAGS & SPRITE + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + if (ctx->Point.CoordReplace[u]) { + GLfloat s = 0.5F + (x + 0.5F - vert->win[0]) / size; + GLfloat t = 0.5F - (y + 0.5F - vert->win[1]) / size; + span->array->texcoords[u][count][0] = s; + span->array->texcoords[u][count][1] = t; + span->array->texcoords[u][count][3] = 1.0F; + if (ctx->Point.SpriteRMode == GL_ZERO) + span->array->texcoords[u][count][2] = 0.0F; + else if (ctx->Point.SpriteRMode == GL_S) + span->array->texcoords[u][count][2] = vert->texcoord[u][0]; + else /* GL_R */ + span->array->texcoords[u][count][2] = vert->texcoord[u][2]; + } + else { + COPY_4V(span->array->texcoords[u][count], vert->texcoord[u]); + } + } + } +#endif /*SPRITE*/ + + count++; /* square point */ + +#endif /*SMOOTH*/ + + } /*for x*/ + } /*for y*/ + span->end = count; + }} + +#else /* LARGE | ATTENUATE | SMOOTH | SPRITE */ + + /* + * Single-pixel points + */ + {{ + GLuint count; + + /* check if we need to flush */ + if (span->end >= MAX_WIDTH || + (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) { +#if FLAGS & (TEXTURE | SPRITE) + if (ctx->Texture._EnabledUnits) + _mesa_write_texture_span(ctx, span); + else + _mesa_write_rgba_span(ctx, span); #elif FLAGS & RGBA - /* rgba size 1 point */ - alpha = vert->color[3]; - PB_WRITE_RGBA_PIXEL(PB, x, y, z, vert->fog, red, green, blue, alpha); + _mesa_write_rgba_span(ctx, span); #else - /* color index size 1 point */ - PB_WRITE_CI_PIXEL(PB, x, y, z, vert->fog, index); + _mesa_write_index_span(ctx, span); #endif - } + span->end = 0; + } + + count = span->end; + +#if FLAGS & RGBA + span->array->rgba[count][RCOMP] = red; + span->array->rgba[count][GCOMP] = green; + span->array->rgba[count][BCOMP] = blue; + span->array->rgba[count][ACOMP] = alpha; +#endif +#if FLAGS & SPECULAR + span->array->spec[count][RCOMP] = specRed; + span->array->spec[count][GCOMP] = specGreen; + span->array->spec[count][BCOMP] = specBlue; +#endif +#if FLAGS & INDEX + span->array->index[count] = colorIndex; +#endif +#if FLAGS & TEXTURE + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + COPY_4V(span->array->texcoords[u][count], texcoord[u]); + } + } +#endif + + span->array->x[count] = (GLint) vert->win[0]; + span->array->y[count] = (GLint) vert->win[1]; + span->array->z[count] = (GLint) (vert->win[2] + 0.5F); + span->end = count + 1; + }} + #endif /* LARGE || ATTENUATE || SMOOTH */ - PB_CHECK_FLUSH(ctx, PB); + ASSERT(span->end <= MAX_WIDTH); } diff --git a/xc/extras/Mesa/src/swrast/s_readpix.c b/xc/extras/Mesa/src/swrast/s_readpix.c index 666baa286..672109982 100644 --- a/xc/extras/Mesa/src/swrast/s_readpix.c +++ b/xc/extras/Mesa/src/swrast/s_readpix.c @@ -1,8 +1,7 @@ -/* $Id: s_readpix.c,v 1.1.1.1 2002/10/22 13:06:56 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -32,7 +31,7 @@ #include "feedback.h" #include "image.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "pixel.h" #include "s_alphabuf.h" @@ -62,9 +61,7 @@ read_index_pixels( GLcontext *ctx, return; } - ASSERT(swrast->Driver.SetReadBuffer); - (*swrast->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer); + _swrast_use_read_buffer(ctx); readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width; @@ -82,8 +79,7 @@ read_index_pixels( GLcontext *ctx, &ctx->Pack, ctx->_ImageTransferState); } - (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer); + _swrast_use_draw_buffer(ctx); } @@ -282,8 +278,15 @@ read_fast_rgba_pixels( GLcontext *ctx, if (0) { #endif GLchan *dest = (GLchan *) pixels - + (skipRows * rowLength + skipPixels) * 4; + + (skipRows * rowLength + skipPixels) * 4; GLint row; + + if (packing->Invert) { + /* start at top and go down */ + dest += (readHeight - 1) * rowLength * 4; + rowLength = -rowLength; + } + for (row=0; row<readHeight; row++) { (*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, (GLchan (*)[4]) dest); @@ -318,13 +321,13 @@ read_rgba_pixels( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); GLint readWidth; - (*swrast->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer); + _swrast_use_read_buffer(ctx); /* Try optimized path first */ if (read_fast_rgba_pixels( ctx, x, y, width, height, format, type, pixels, packing )) { - (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer); + _swrast_use_draw_buffer(ctx); return; /* done! */ } @@ -470,7 +473,7 @@ read_rgba_pixels( GLcontext *ctx, } } - (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer); + _swrast_use_draw_buffer(ctx); } diff --git a/xc/extras/Mesa/src/swrast/s_scissor.c b/xc/extras/Mesa/src/swrast/s_scissor.c deleted file mode 100644 index 3558b91d0..000000000 --- a/xc/extras/Mesa/src/swrast/s_scissor.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $Id: s_scissor.c,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 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. - */ - - -#include "glheader.h" -#include "macros.h" -#include "mem.h" -#include "s_context.h" -#include "s_scissor.h" - - -/* - * Apply the scissor test to a span of pixels. - * Return: 0 = all pixels in the span are outside the scissor box. - * n = mask[n-1] is the last one to be visible - */ -GLuint -_mesa_scissor_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte mask[]) -{ - /* first check if whole span is outside the scissor box */ - if (y < ctx->DrawBuffer->_Ymin - || y >= ctx->DrawBuffer->_Ymax - || x > ctx->DrawBuffer->_Xmax - || x + (GLint) n - 1 < ctx->DrawBuffer->_Xmin) { - return 0; - } - else { - const GLint xMin = ctx->DrawBuffer->_Xmin; - const GLint xMax = ctx->DrawBuffer->_Xmax; - - if (x < xMin) - BZERO(mask, (xMin-x) * sizeof(GLubyte)); - - if (x + (GLint) n > xMax) { - BZERO(mask + xMax - x, (n - (xMax - x)) * sizeof(GLubyte)); - return (GLuint) (xMax - x); - } - - return n; - } -} diff --git a/xc/extras/Mesa/src/swrast/s_span.c b/xc/extras/Mesa/src/swrast/s_span.c index 375fe6a96..784279c7d 100644 --- a/xc/extras/Mesa/src/swrast/s_span.c +++ b/xc/extras/Mesa/src/swrast/s_span.c @@ -1,8 +1,7 @@ -/* $Id: s_span.c,v 1.1.1.1 2002/10/22 13:06:57 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.0.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -25,16 +24,19 @@ */ -/* - * pixel span rasterization: - * These functions implement the rasterization pipeline. +/** + * \file swrast/s_span.c + * \brief Span processing functions used by all rasterization functions. + * This is where all the per-fragment tests are performed + * \author Brian Paul */ - #include "glheader.h" #include "colormac.h" +#include "context.h" #include "macros.h" -#include "mem.h" +#include "mmath.h" +#include "imports.h" #include "s_alpha.h" #include "s_alphabuf.h" @@ -44,743 +46,1050 @@ #include "s_fog.h" #include "s_logic.h" #include "s_masking.h" -#include "s_scissor.h" #include "s_span.h" #include "s_stencil.h" #include "s_texture.h" +/** + * Init span's Z interpolation values to the RasterPos Z. + * Used during setup for glDraw/CopyPixels. + */ +void +_mesa_span_default_z( GLcontext *ctx, struct sw_span *span ) +{ + if (ctx->Visual.depthBits <= 16) + span->z = FloatToFixed(ctx->Current.RasterPos[2] * ctx->DepthMax + 0.5F); + else + span->z = (GLint) (ctx->Current.RasterPos[2] * ctx->DepthMax + 0.5F); + span->zStep = 0; + span->interpMask |= SPAN_Z; +} -/* - * Apply the current polygon stipple pattern to a span of pixels. + +/** + * Init span's fog interpolation values to the RasterPos fog. + * Used during setup for glDraw/CopyPixels. */ -static void -stipple_polygon_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLubyte mask[] ) +void +_mesa_span_default_fog( GLcontext *ctx, struct sw_span *span ) { - const GLuint highbit = 0x80000000; - GLuint i, m, stipple; + span->fog = _mesa_z_to_fogfactor(ctx, ctx->Current.RasterDistance); + span->fogStep = 0; + span->interpMask |= SPAN_FOG; +} - stipple = ctx->PolygonStipple[y % 32]; - m = highbit >> (GLuint) (x % 32); - for (i = 0; i < n; i++) { - if ((m & stipple) == 0) { - mask[i] = 0; - } - m = m >> 1; - if (m == 0) { - m = highbit; - } +/** + * Init span's color or index interpolation values to the RasterPos color. + * Used during setup for glDraw/CopyPixels. + */ +void +_mesa_span_default_color( GLcontext *ctx, struct sw_span *span ) +{ + if (ctx->Visual.rgbMode) { + GLchan r, g, b, a; + UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); + UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterColor[1]); + UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterColor[2]); + UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterColor[3]); +#if CHAN_TYPE == GL_FLOAT + span->red = r; + span->green = g; + span->blue = b; + span->alpha = a; +#else + span->red = IntToFixed(r); + span->green = IntToFixed(g); + span->blue = IntToFixed(b); + span->alpha = IntToFixed(a); +#endif + span->redStep = 0; + span->greenStep = 0; + span->blueStep = 0; + span->alphaStep = 0; + span->interpMask |= SPAN_RGBA; + } + else { + span->index = IntToFixed(ctx->Current.RasterIndex); + span->indexStep = 0; + span->interpMask |= SPAN_INDEX; } } - -/* - * Clip a pixel span to the current buffer/window boundaries. - * Return: 'n' such that pixel 'n', 'n+1' etc. are clipped, - * as a special case: - * 0 = all pixels clipped +/** + * Init span's texcoord interpolation values to the RasterPos texcoords. + * Used during setup for glDraw/CopyPixels. */ -static GLuint -clip_span( GLcontext *ctx, GLint n, GLint x, GLint y, GLubyte mask[] ) +void +_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span ) { - /* Clip to top and bottom */ - if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height) { - return 0; + GLuint i; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + COPY_4V(span->tex[i], ctx->Current.RasterTexCoords[i]); + ASSIGN_4V(span->texStepX[i], 0.0F, 0.0F, 0.0F, 0.0F); + ASSIGN_4V(span->texStepY[i], 0.0F, 0.0F, 0.0F, 0.0F); } + span->interpMask |= SPAN_TEXTURE; +} + + +/* Fill in the span.color.rgba array from the interpolation values */ +static void +interpolate_colors(GLcontext *ctx, struct sw_span *span) +{ + GLfixed r = span->red; + GLfixed g = span->green; + GLfixed b = span->blue; + GLfixed a = span->alpha; + const GLint dr = span->redStep; + const GLint dg = span->greenStep; + const GLint db = span->blueStep; + const GLint da = span->alphaStep; + const GLuint n = span->end; + GLchan (*rgba)[4] = span->array->rgba; + GLuint i; - /* Clip to the left */ - if (x < 0) { - if (x + n <= 0) { - /* completely off left side */ - return 0; + ASSERT((span->interpMask & SPAN_RGBA) && + !(span->arrayMask & SPAN_RGBA)); + + if (span->interpMask & SPAN_FLAT) { + /* constant color */ + GLchan color[4]; + color[RCOMP] = FixedToChan(r); + color[GCOMP] = FixedToChan(g); + color[BCOMP] = FixedToChan(b); + color[ACOMP] = FixedToChan(a); + for (i = 0; i < n; i++) { + COPY_CHAN4(span->array->rgba[i], color); } - else { - /* partially off left side */ - BZERO(mask, -x * sizeof(GLubyte)); + } + else { + /* interpolate */ + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = FixedToChan(r); + rgba[i][GCOMP] = FixedToChan(g); + rgba[i][BCOMP] = FixedToChan(b); + rgba[i][ACOMP] = FixedToChan(a); + r += dr; + g += dg; + b += db; + a += da; } } + span->arrayMask |= SPAN_RGBA; +} + - /* Clip to right */ - if (x + n > (GLint) ctx->DrawBuffer->Width) { - if (x >= (GLint) ctx->DrawBuffer->Width) { - /* completely off right side */ - return 0; +/* Fill in the span.color.index array from the interpolation values */ +static void +interpolate_indexes(GLcontext *ctx, struct sw_span *span) +{ + GLfixed index = span->index; + const GLint indexStep = span->indexStep; + const GLuint n = span->end; + GLuint *indexes = span->array->index; + GLuint i; + ASSERT((span->interpMask & SPAN_INDEX) && + !(span->arrayMask & SPAN_INDEX)); + + if ((span->interpMask & SPAN_FLAT) || (indexStep == 0)) { + /* constant color */ + index = FixedToInt(index); + for (i = 0; i < n; i++) { + indexes[i] = index; } - else { - /* partially off right side */ - return ctx->DrawBuffer->Width - x; + } + else { + /* interpolate */ + for (i = 0; i < n; i++) { + indexes[i] = FixedToInt(index); + index += indexStep; } } - - return n; + span->arrayMask |= SPAN_INDEX; } - -/* - * Draw to more than one color buffer (or none). - */ +/* Fill in the span.->array->spec array from the interpolation values */ static void -multi_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLuint indexes[], const GLubyte mask[] ) +interpolate_specular(GLcontext *ctx, struct sw_span *span) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLuint bufferBit; + if (span->interpMask & SPAN_FLAT) { + /* constant color */ + const GLchan r = FixedToChan(span->specRed); + const GLchan g = FixedToChan(span->specGreen); + const GLchan b = FixedToChan(span->specBlue); + GLuint i; + for (i = 0; i < span->end; i++) { + span->array->spec[i][RCOMP] = r; + span->array->spec[i][GCOMP] = g; + span->array->spec[i][BCOMP] = b; + } + } + else { + /* interpolate */ +#if CHAN_TYPE == GL_FLOAT + GLfloat r = span->specRed; + GLfloat g = span->specGreen; + GLfloat b = span->specBlue; +#else + GLfixed r = span->specRed; + GLfixed g = span->specGreen; + GLfixed b = span->specBlue; +#endif + GLuint i; + for (i = 0; i < span->end; i++) { + span->array->spec[i][RCOMP] = FixedToChan(r); + span->array->spec[i][GCOMP] = FixedToChan(g); + span->array->spec[i][BCOMP] = FixedToChan(b); + r += span->specRedStep; + g += span->specGreenStep; + b += span->specBlueStep; + } + } + span->arrayMask |= SPAN_SPEC; +} - if (ctx->Color.DrawBuffer == GL_NONE) - return; - /* loop over four possible dest color buffers */ - for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color.DrawDestMask) { - GLuint indexTmp[MAX_WIDTH]; - ASSERT(n < MAX_WIDTH); +/* Fill in the span.zArray array from the interpolation values */ +void +_mesa_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ) +{ + const GLuint n = span->end; + GLuint i; - if (bufferBit == FRONT_LEFT_BIT) - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); - else if (bufferBit == FRONT_RIGHT_BIT) - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); - else if (bufferBit == BACK_LEFT_BIT) - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); - else - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); + ASSERT((span->interpMask & SPAN_Z) && + !(span->arrayMask & SPAN_Z)); - /* make copy of incoming indexes */ - MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); - if (ctx->Color.IndexLogicOpEnabled) { - _mesa_logicop_ci_span( ctx, n, x, y, indexTmp, mask ); - } - if (ctx->Color.IndexMask == 0) { - break; - } - else if (ctx->Color.IndexMask != 0xffffffff) { - _mesa_mask_index_span( ctx, n, x, y, indexTmp ); - } - (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask ); + if (ctx->Visual.depthBits <= 16) { + GLfixed zval = span->z; + GLdepth *z = span->array->z; + for (i = 0; i < n; i++) { + z[i] = FixedToInt(zval); + zval += span->zStep; } } - - /* restore default dest buffer */ - (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer); + else { + /* Deep Z buffer, no fixed->int shift */ + GLfixed zval = span->z; + GLdepth *z = span->array->z; + for (i = 0; i < n; i++) { + z[i] = zval; + zval += span->zStep; + } + } + span->arrayMask |= SPAN_Z; } - /* - * Write a horizontal span of color index pixels to the frame buffer. - * Stenciling, Depth-testing, etc. are done as needed. - * Input: n - number of pixels in the span - * x, y - location of leftmost pixel in the span - * z - array of [n] z-values - * fog - array of fog factor values in [0,1] - * index - array of [n] color indexes - * primitive - either GL_POINT, GL_LINE, GL_POLYGON, or GL_BITMAP + * This the ideal solution, as given in the OpenGL spec. */ -void -_mesa_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - GLuint indexIn[], const GLint coverage[], - GLenum primitive ) +#if 0 +static GLfloat +compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, + GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, + GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) { - const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | LOGIC_OP_BIT; - GLubyte mask[MAX_WIDTH]; - GLuint indexBackup[MAX_WIDTH]; - GLuint *index; /* points to indexIn or indexBackup */ - SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ); + GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); + GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ); + GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ); + GLfloat x = sqrt(dudx * dudx + dvdx * dvdx); + GLfloat y = sqrt(dudy * dudy + dvdy * dvdy); + GLfloat rho = MAX2(x, y); + GLfloat lambda = LOG2(rho); + return lambda; +} +#endif - /* init mask to 1's (all pixels are to be written) */ - MEMSET(mask, 1, n); - if ((swrast->_RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { - if ((n = clip_span(ctx,n,x,y,mask)) == 0) { - return; - } - } +/* + * This is a faster approximation + */ +static GLfloat +compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, + GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, + GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) +{ + GLfloat dsdx2 = (s + dsdx) / (q + dqdx) - s * invQ; + GLfloat dtdx2 = (t + dtdx) / (q + dqdx) - t * invQ; + GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ; + GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ; + GLfloat maxU, maxV, rho, lambda; + dsdx2 = FABSF(dsdx2); + dsdy2 = FABSF(dsdy2); + dtdx2 = FABSF(dtdx2); + dtdy2 = FABSF(dtdy2); + maxU = MAX2(dsdx2, dsdy2) * texW; + maxV = MAX2(dtdx2, dtdy2) * texH; + rho = MAX2(maxU, maxV); + lambda = LOG2(rho); + return lambda; +} - if ((primitive==GL_BITMAP && (swrast->_RasterMask & modBits)) - || (swrast->_RasterMask & MULTI_DRAW_BIT)) { - /* Make copy of color indexes */ - MEMCPY( indexBackup, indexIn, n * sizeof(GLuint) ); - index = indexBackup; +/* + * Fill in the span.texcoords array from the interpolation values. + * XXX We could optimize here for the case when dq = 0. That would + * usually be the case when using an orthographic projection. + */ +static void +interpolate_texcoords(GLcontext *ctx, struct sw_span *span) +{ + ASSERT(span->interpMask & SPAN_TEXTURE); + ASSERT(!(span->arrayMask & SPAN_TEXTURE)); + + if (ctx->Texture._EnabledUnits > 1) { + /* multitexture */ + GLuint u; + span->arrayMask |= SPAN_TEXTURE; + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (ctx->Texture.Unit[u]._ReallyEnabled) { + const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current; + const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; + GLboolean needLambda = (obj->MinFilter != obj->MagFilter); + if (needLambda) { + GLfloat (*texcoord)[4] = span->array->texcoords[u]; + GLfloat *lambda = span->array->lambda[u]; + const GLfloat texW = (GLfloat) img->WidthScale; + const GLfloat texH = (GLfloat) img->HeightScale; + const GLfloat dsdx = span->texStepX[u][0]; + const GLfloat dsdy = span->texStepY[u][0]; + const GLfloat dtdx = span->texStepX[u][1]; + const GLfloat dtdy = span->texStepY[u][1]; + const GLfloat drdx = span->texStepX[u][2]; + const GLfloat dqdx = span->texStepX[u][3]; + const GLfloat dqdy = span->texStepY[u][3]; + GLfloat s = span->tex[u][0]; + GLfloat t = span->tex[u][1]; + GLfloat r = span->tex[u][2]; + GLfloat q = span->tex[u][3]; + GLuint i; + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy, + dqdx, dqdy, texW, texH, + s, t, q, invQ); + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + span->arrayMask |= SPAN_LAMBDA; + } + else { + GLfloat (*texcoord)[4] = span->array->texcoords[u]; + GLfloat *lambda = span->array->lambda[u]; + const GLfloat dsdx = span->texStepX[u][0]; + const GLfloat dtdx = span->texStepX[u][1]; + const GLfloat drdx = span->texStepX[u][2]; + const GLfloat dqdx = span->texStepX[u][3]; + GLfloat s = span->tex[u][0]; + GLfloat t = span->tex[u][1]; + GLfloat r = span->tex[u][2]; + GLfloat q = span->tex[u][3]; + GLuint i; + if (dqdx == 0.0) { + /* Ortho projection or polygon's parallel to window X axis */ + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + for (i = 0; i < span->end; i++) { + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + lambda[i] = 0.0; + s += dsdx; + t += dtdx; + r += drdx; + } + } + else { + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + lambda[i] = 0.0; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + } + } /* lambda */ + } /* if */ + } /* for */ } else { - index = indexIn; - } - - - /* Do the scissor test */ - if (ctx->Scissor.Enabled) { - if ((n = _mesa_scissor_span( ctx, n, x, y, mask )) == 0) { - return; + /* single texture */ + const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; + const struct gl_texture_image *img = obj->Image[obj->BaseLevel]; + GLboolean needLambda = (obj->MinFilter != obj->MagFilter); + span->arrayMask |= SPAN_TEXTURE; + if (needLambda) { + /* just texture unit 0, with lambda */ + GLfloat (*texcoord)[4] = span->array->texcoords[0]; + GLfloat *lambda = span->array->lambda[0]; + const GLfloat texW = (GLfloat) img->WidthScale; + const GLfloat texH = (GLfloat) img->HeightScale; + const GLfloat dsdx = span->texStepX[0][0]; + const GLfloat dsdy = span->texStepY[0][0]; + const GLfloat dtdx = span->texStepX[0][1]; + const GLfloat dtdy = span->texStepY[0][1]; + const GLfloat drdx = span->texStepX[0][2]; + const GLfloat dqdx = span->texStepX[0][3]; + const GLfloat dqdy = span->texStepY[0][3]; + GLfloat s = span->tex[0][0]; + GLfloat t = span->tex[0][1]; + GLfloat r = span->tex[0][2]; + GLfloat q = span->tex[0][3]; + GLuint i; + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + lambda[i] = compute_lambda(dsdx, dsdy, dtdx, dtdy, + dqdx, dqdy, texW, texH, + s, t, q, invQ); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + span->arrayMask |= SPAN_LAMBDA; } - } - - /* Polygon Stippling */ - if (ctx->Polygon.StippleFlag && primitive==GL_POLYGON) { - stipple_polygon_span( ctx, n, x, y, mask ); - } - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { - return; + else { + /* just texture 0, without lambda */ + GLfloat (*texcoord)[4] = span->array->texcoords[0]; + const GLfloat dsdx = span->texStepX[0][0]; + const GLfloat dtdx = span->texStepX[0][1]; + const GLfloat drdx = span->texStepX[0][2]; + const GLfloat dqdx = span->texStepX[0][3]; + GLfloat s = span->tex[0][0]; + GLfloat t = span->tex[0][1]; + GLfloat r = span->tex[0][2]; + GLfloat q = span->tex[0][3]; + GLuint i; + if (dqdx == 0.0) { + /* Ortho projection or polygon's parallel to window X axis */ + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + for (i = 0; i < span->end; i++) { + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + s += dsdx; + t += dtdx; + r += drdx; + } + } + else { + for (i = 0; i < span->end; i++) { + const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); + texcoord[i][0] = s * invQ; + texcoord[i][1] = t * invQ; + texcoord[i][2] = r * invQ; + s += dsdx; + t += dtdx; + r += drdx; + q += dqdx; + } + } } } - else if (ctx->Depth.Test) { - /* regular depth testing */ - if (_mesa_depth_test_span( ctx, n, x, y, z, mask ) == 0) - return; - } +} - /* if we get here, something passed the depth test */ - ctx->OcclusionResult = GL_TRUE; - /* Per-pixel fog */ - if (ctx->Fog.Enabled) { - if (fog && !swrast->_PreferPixelFog) - _mesa_fog_ci_pixels( ctx, n, fog, index ); - else - _mesa_depth_fog_ci_pixels( ctx, n, z, index ); - } +/** + * Apply the current polygon stipple pattern to a span of pixels. + */ +static void +stipple_polygon_span( GLcontext *ctx, struct sw_span *span ) +{ + const GLuint highbit = 0x80000000; + const GLuint stipple = ctx->PolygonStipple[span->y % 32]; + GLubyte *mask = span->array->mask; + GLuint i, m; - /* Antialias coverage application */ - if (coverage) { - GLuint i; - for (i = 0; i < n; i++) { - ASSERT(coverage[i] < 16); - index[i] = (index[i] & ~0xf) | coverage[i]; - } - } + ASSERT(ctx->Polygon.StippleFlag); + ASSERT((span->arrayMask & SPAN_XY) == 0); - if (swrast->_RasterMask & MULTI_DRAW_BIT) { - /* draw to zero or two or more buffers */ - multi_write_index_span( ctx, n, x, y, index, mask ); - } - else { - /* normal situation: draw to exactly one buffer */ - if (ctx->Color.IndexLogicOpEnabled) { - _mesa_logicop_ci_span( ctx, n, x, y, index, mask ); - } + m = highbit >> (GLuint) (span->x % 32); - if (ctx->Color.IndexMask == 0) { - return; + for (i = 0; i < span->end; i++) { + if ((m & stipple) == 0) { + mask[i] = 0; } - else if (ctx->Color.IndexMask != 0xffffffff) { - _mesa_mask_index_span( ctx, n, x, y, index ); + m = m >> 1; + if (m == 0) { + m = highbit; } - - /* write pixels */ - (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, index, mask ); } + span->writeAll = GL_FALSE; } - - -void -_mesa_write_monoindex_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - GLuint index, const GLint coverage[], - GLenum primitive ) +/** + * Clip a pixel span to the current buffer/window boundaries: + * DrawBuffer->_Xmin, _Xmax, _Ymin, _Ymax. This will accomplish + * window clipping and scissoring. + * Return: GL_TRUE some pixels still visible + * GL_FALSE nothing visible + */ +static GLuint +clip_span( GLcontext *ctx, struct sw_span *span ) { - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLubyte mask[MAX_WIDTH]; - GLuint i; - - /* init mask to 1's (all pixels are to be written) */ - MEMSET(mask, 1, n); - - if ((swrast->_RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { - if ((n = clip_span( ctx, n, x, y, mask)) == 0) { - return; + const GLint xmin = ctx->DrawBuffer->_Xmin; + const GLint xmax = ctx->DrawBuffer->_Xmax; + const GLint ymin = ctx->DrawBuffer->_Ymin; + const GLint ymax = ctx->DrawBuffer->_Ymax; + + if (span->arrayMask & SPAN_XY) { + /* arrays of x/y pixel coords */ + const GLint *x = span->array->x; + const GLint *y = span->array->y; + const GLint n = span->end; + GLubyte *mask = span->array->mask; + GLint i; + if (span->arrayMask & SPAN_MASK) { + /* note: using & intead of && to reduce branches */ + for (i = 0; i < n; i++) { + mask[i] &= (x[i] >= xmin) & (x[i] < xmax) + & (y[i] >= ymin) & (y[i] < ymax); + } + } + else { + /* note: using & intead of && to reduce branches */ + for (i = 0; i < n; i++) { + mask[i] = (x[i] >= xmin) & (x[i] < xmax) + & (y[i] >= ymin) & (y[i] < ymax); + } } + return GL_TRUE; /* some pixels visible */ } + else { + /* horizontal span of pixels */ + const GLint x = span->x; + const GLint y = span->y; + const GLint n = span->end; - /* Do the scissor test */ - if (ctx->Scissor.Enabled) { - if ((n = _mesa_scissor_span( ctx, n, x, y, mask )) == 0) { - return; + /* Trivial rejection tests */ + if (y < ymin || y >= ymax || x + n <= xmin || x >= xmax) { + span->end = 0; + return GL_FALSE; /* all pixels clipped */ } - } - /* Polygon Stippling */ - if (ctx->Polygon.StippleFlag && primitive==GL_POLYGON) { - stipple_polygon_span( ctx, n, x, y, mask ); - } + /* Clip to the left */ + if (x < xmin) { + ASSERT(x + n > xmin); + span->writeAll = GL_FALSE; + _mesa_bzero(span->array->mask, (xmin - x) * sizeof(GLubyte)); + } - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { - return; + /* Clip to right */ + if (x + n > xmax) { + ASSERT(x < xmax); + span->end = xmax - x; } + + return GL_TRUE; /* some pixels visible */ } - else if (ctx->Depth.Test) { - /* regular depth testing */ - if (_mesa_depth_test_span( ctx, n, x, y, z, mask ) == 0) - return; - } +} - /* if we get here, something passed the depth test */ - ctx->OcclusionResult = GL_TRUE; - if (ctx->Color.DrawBuffer == GL_NONE) { - /* write no pixels */ - return; - } - if (ctx->Fog.Enabled - || ctx->Color.IndexLogicOpEnabled - || ctx->Color.IndexMask != 0xffffffff - || coverage) { - /* different index per pixel */ - GLuint indexes[MAX_WIDTH]; - for (i = 0; i < n; i++) { - indexes[i] = index; - } +/** + * Draw to more than one color buffer (or none). + */ +static void +multi_write_index_span( GLcontext *ctx, struct sw_span *span ) +{ + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLuint bufferBit; - if (ctx->Fog.Enabled) { - if (fog && !swrast->_PreferPixelFog) - _mesa_fog_ci_pixels( ctx, n, fog, indexes ); - else - _mesa_depth_fog_ci_pixels( ctx, n, z, indexes ); - } + /* loop over four possible dest color buffers */ + for (bufferBit = 1; bufferBit <= 8; bufferBit <<= 1) { + if (bufferBit & ctx->Color._DrawDestMask) { + GLuint indexTmp[MAX_WIDTH]; + ASSERT(span->end < MAX_WIDTH); - /* Antialias coverage application */ - if (coverage) { - GLuint i; - for (i = 0; i < n; i++) { - ASSERT(coverage[i] < 16); - indexes[i] = (indexes[i] & ~0xf) | coverage[i]; - } - } + /* Set the current read/draw buffer */ + swrast->CurrentBuffer = bufferBit; + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); + + /* make copy of incoming indexes */ + MEMCPY( indexTmp, span->array->index, span->end * sizeof(GLuint) ); - if (swrast->_RasterMask & MULTI_DRAW_BIT) { - /* draw to zero or two or more buffers */ - multi_write_index_span( ctx, n, x, y, indexes, mask ); - } - else { - /* normal situation: draw to exactly one buffer */ if (ctx->Color.IndexLogicOpEnabled) { - _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask ); + _mesa_logicop_ci_span(ctx, span, indexTmp); } - if (ctx->Color.IndexMask == 0) { - return; + + if (ctx->Color.IndexMask != 0xffffffff) { + _mesa_mask_index_span(ctx, span, indexTmp); } - else if (ctx->Color.IndexMask != 0xffffffff) { - _mesa_mask_index_span( ctx, n, x, y, indexes ); + + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + (*swrast->Driver.WriteCI32Pixels)(ctx, span->end, + span->array->x, span->array->y, + indexTmp, span->array->mask); + } + else { + /* horizontal run of pixels */ + (*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y, + indexTmp, span->array->mask); } - (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask ); - } - } - else { - /* same color index for all pixels */ - ASSERT(!ctx->Color.IndexLogicOpEnabled); - ASSERT(ctx->Color.IndexMask == 0xffffffff); - if (swrast->_RasterMask & MULTI_DRAW_BIT) { - /* draw to zero or two or more buffers */ - GLuint indexes[MAX_WIDTH]; - for (i = 0; i < n; i++) - indexes[i] = index; - multi_write_index_span( ctx, n, x, y, indexes, mask ); - } - else { - /* normal situation: draw to exactly one buffer */ - (*swrast->Driver.WriteMonoCISpan)( ctx, n, x, y, index, mask ); } } -} + /* restore default dest buffer */ + _swrast_use_draw_buffer(ctx); +} -/* +/** * Draw to more than one RGBA color buffer (or none). + * All fragment operations, up to (but not) blending/logicop should + * have been done first. */ static void -multi_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - CONST GLchan rgba[][4], const GLubyte mask[] ) +multi_write_rgba_span( GLcontext *ctx, struct sw_span *span ) { const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); GLuint bufferBit; SWcontext *swrast = SWRAST_CONTEXT(ctx); + ASSERT(colorMask != 0x0); + if (ctx->Color.DrawBuffer == GL_NONE) return; /* loop over four possible dest color buffers */ - for (bufferBit = 1; bufferBit <= 8; bufferBit = bufferBit << 1) { - if (bufferBit & ctx->Color.DrawDestMask) { + for (bufferBit = 1; bufferBit <= 8; bufferBit <<= 1) { + if (bufferBit & ctx->Color._DrawDestMask) { GLchan rgbaTmp[MAX_WIDTH][4]; - ASSERT(n < MAX_WIDTH); + ASSERT(span->end < MAX_WIDTH); - if (bufferBit == FRONT_LEFT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontLeftAlpha; - } - else if (bufferBit == FRONT_RIGHT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontRightAlpha; - } - else if (bufferBit == BACK_LEFT_BIT) { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackLeftAlpha; - } - else { - (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); - ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackRightAlpha; - } + /* Set the current read/draw buffer */ + swrast->CurrentBuffer = bufferBit; + (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit); /* make copy of incoming colors */ - MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLchan) ); + MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) ); if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask ); + _mesa_logicop_rgba_span(ctx, span, rgbaTmp); } else if (ctx->Color.BlendEnabled) { - _mesa_blend_span( ctx, n, x, y, rgbaTmp, mask ); + _mesa_blend_span(ctx, span, rgbaTmp); } - if (colorMask == 0x0) { - break; - } - else if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp ); + + if (colorMask != 0xffffffff) { + _mesa_mask_rgba_span(ctx, span, rgbaTmp); } - (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, - (const GLchan (*)[4]) rgbaTmp, mask ); - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_span( ctx, n, x, y, - (const GLchan (*)[4])rgbaTmp, mask ); + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, + span->array->x, span->array->y, + (const GLchan (*)[4]) rgbaTmp, + span->array->mask); + if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { + _mesa_write_alpha_pixels(ctx, span->end, + span->array->x, span->array->y, + (const GLchan (*)[4]) rgbaTmp, + span->array->mask); + } + } + else { + /* horizontal run of pixels */ + (*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y, + (const GLchan (*)[4]) rgbaTmp, + span->array->mask); + if (swrast->_RasterMask & ALPHABUF_BIT) { + _mesa_write_alpha_span(ctx, span->end, span->x, span->y, + (const GLchan (*)[4]) rgbaTmp, + span->array->mask); + } } } } /* restore default dest buffer */ - (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer ); + _swrast_use_draw_buffer(ctx); } -/* - * Apply fragment processing to a span of RGBA fragments. - * Input: - * n - number of fragments in the span - * x,y - location of first (left) fragment - * fog - array of fog factor values in [0,1] +/** + * This function may modify any of the array values in the span. + * span->interpMask and span->arrayMask may be changed but will be restored + * to their original values before returning. */ void -_mesa_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - GLchan rgbaIn[][4], const GLfloat coverage[], - GLenum primitive ) +_mesa_write_index_span( GLcontext *ctx, struct sw_span *span) { - const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | - LOGIC_OP_BIT | TEXTURE_BIT; - GLubyte mask[MAX_WIDTH]; - GLboolean write_all = GL_TRUE; - GLchan rgbaBackup[MAX_WIDTH][4]; - GLchan (*rgba)[4]; - const GLubyte *Null = 0; SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint origInterpMask = span->interpMask; + const GLuint origArrayMask = span->arrayMask; - /* init mask to 1's (all pixels are to be written) */ - MEMSET(mask, 1, n); + ASSERT(span->end <= MAX_WIDTH); + ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || + span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); + ASSERT((span->interpMask | span->arrayMask) & SPAN_INDEX); + ASSERT((span->interpMask & span->arrayMask) == 0); - if ((swrast->_RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { - if ((n = clip_span( ctx,n,x,y,mask)) == 0) { - return; - } - if (mask[0] == 0) - write_all = GL_FALSE; - } - - if ((primitive==GL_BITMAP && (swrast->_RasterMask & modBits)) - || (swrast->_RasterMask & MULTI_DRAW_BIT)) { - /* must make a copy of the colors since they may be modified */ - MEMCPY( rgbaBackup, rgbaIn, 4 * n * sizeof(GLchan) ); - rgba = rgbaBackup; + if (span->arrayMask & SPAN_MASK) { + /* mask was initialized by caller, probably glBitmap */ + span->writeAll = GL_FALSE; } else { - rgba = rgbaIn; + MEMSET(span->array->mask, 1, span->end); + span->writeAll = GL_TRUE; } - /* Do the scissor test */ - if (ctx->Scissor.Enabled) { - if ((n = _mesa_scissor_span( ctx, n, x, y, mask )) == 0) { + /* Clipping */ + if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { + if (!clip_span(ctx, span)) { return; } - if (mask[0] == 0) - write_all = GL_FALSE; - } - - /* Polygon Stippling */ - if (ctx->Polygon.StippleFlag && primitive==GL_POLYGON) { - stipple_polygon_span( ctx, n, x, y, mask ); - write_all = GL_FALSE; } - /* Do the alpha test */ - if (ctx->Color.AlphaEnabled) { - if (_mesa_alpha_test( ctx, n, (const GLchan (*)[4]) rgba, mask ) == 0) { - return; +#ifdef DEBUG + if (span->arrayMask & SPAN_XY) { + GLuint i; + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); + assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); + assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); + assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); + } } - write_all = GL_FALSE; } +#endif - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { - return; - } - write_all = GL_FALSE; + /* Polygon Stippling */ + if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { + stipple_polygon_span(ctx, span); } - else if (ctx->Depth.Test) { - /* regular depth testing */ - GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); - if (m == 0) { - return; + + /* Depth test and stencil */ + if (ctx->Depth.Test || ctx->Stencil.Enabled) { + if (span->interpMask & SPAN_Z) + _mesa_span_interpolate_z(ctx, span); + + if (ctx->Stencil.Enabled) { + if (!_mesa_stencil_and_ztest_span(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } } - if (m < n) { - write_all = GL_FALSE; + else { + ASSERT(ctx->Depth.Test); + if (!_mesa_depth_test_span(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } } } /* if we get here, something passed the depth test */ ctx->OcclusionResult = GL_TRUE; - /* Per-pixel fog */ + /* we have to wait until after occlusion to do this test */ + if (ctx->Color.DrawBuffer == GL_NONE || ctx->Color.IndexMask == 0) { + /* write no pixels */ + span->arrayMask = origArrayMask; + return; + } + + /* Interpolate the color indexes if needed */ + if (span->interpMask & SPAN_INDEX) { + interpolate_indexes(ctx, span); + /* clear the bit - this allows the WriteMonoCISpan optimization below */ + span->interpMask &= ~SPAN_INDEX; + } + + /* Fog */ if (ctx->Fog.Enabled) { - if (fog && !swrast->_PreferPixelFog) - _mesa_fog_rgba_pixels( ctx, n, fog, rgba ); - else - _mesa_depth_fog_rgba_pixels( ctx, n, z, rgba ); + _mesa_fog_ci_span(ctx, span); } /* Antialias coverage application */ - if (coverage) { + if (span->arrayMask & SPAN_COVERAGE) { GLuint i; - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); + GLuint *index = span->array->index; + GLfloat *coverage = span->array->coverage; + for (i = 0; i < span->end; i++) { + ASSERT(coverage[i] < 16); + index[i] = (index[i] & ~0xf) | ((GLuint) coverage[i]); } } if (swrast->_RasterMask & MULTI_DRAW_BIT) { - multi_write_rgba_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, mask ); + /* draw to zero or two or more buffers */ + multi_write_index_span(ctx, span); } else { - /* normal: write to exactly one buffer */ - /* logic op or blending */ - const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); - - if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); - } - else if (ctx->Color.BlendEnabled) { - _mesa_blend_span( ctx, n, x, y, rgba, mask ); + /* normal situation: draw to exactly one buffer */ + if (ctx->Color.IndexLogicOpEnabled) { + _mesa_logicop_ci_span(ctx, span, span->array->index); } - /* Color component masking */ - if (colorMask == 0x0) { - return; - } - else if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, n, x, y, rgba ); + if (ctx->Color.IndexMask != 0xffffffff) { + _mesa_mask_index_span(ctx, span, span->array->index); } /* write pixels */ - (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, - (const GLchan (*)[4]) rgba, - write_all ? Null : mask ); - - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_span( ctx, n, x, y, - (const GLchan (*)[4]) rgba, - write_all ? Null : mask ); + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) { + /* all pixels have same color index */ + (*swrast->Driver.WriteMonoCIPixels)(ctx, span->end, + span->array->x, span->array->y, + FixedToInt(span->index), + span->array->mask); + } + else { + (*swrast->Driver.WriteCI32Pixels)(ctx, span->end, span->array->x, + span->array->y, span->array->index, + span->array->mask ); + } + } + else { + /* horizontal run of pixels */ + if ((span->interpMask & SPAN_INDEX) && span->indexStep == 0) { + /* all pixels have same color index */ + (*swrast->Driver.WriteMonoCISpan)(ctx, span->end, span->x, span->y, + FixedToInt(span->index), + span->array->mask); + } + else { + (*swrast->Driver.WriteCI32Span)(ctx, span->end, span->x, span->y, + span->array->index, + span->array->mask); + } } } -} + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; +} -/* - * Write a horizontal span of color pixels to the frame buffer. - * The color is initially constant for the whole span. - * Alpha-testing, stenciling, depth-testing, and blending are done as needed. - * Input: n - number of pixels in the span - * x, y - location of leftmost pixel in the span - * z - array of [n] z-values - * fog - array of fog factor values in [0,1] - * r, g, b, a - the color of the pixels - * primitive - either GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP. +/** + * This function may modify any of the array values in the span. + * span->interpMask and span->arrayMask may be changed but will be restored + * to their original values before returning. */ void -_mesa_write_monocolor_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - const GLchan color[4], const GLfloat coverage[], - GLenum primitive ) +_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span) { - const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); - GLuint i; - GLubyte mask[MAX_WIDTH]; - GLboolean write_all = GL_TRUE; - GLchan rgba[MAX_WIDTH][4]; - const GLubyte *Null = 0; SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); + const GLuint origInterpMask = span->interpMask; + const GLuint origArrayMask = span->arrayMask; + GLboolean monoColor; + + ASSERT(span->end <= MAX_WIDTH); + ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || + span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); + ASSERT((span->interpMask & span->arrayMask) == 0); + ASSERT((span->interpMask | span->arrayMask) & SPAN_RGBA); +#ifdef DEBUG + if (ctx->Fog.Enabled) + ASSERT((span->interpMask | span->arrayMask) & SPAN_FOG); + if (ctx->Depth.Test) + ASSERT((span->interpMask | span->arrayMask) & SPAN_Z); +#endif - /* init mask to 1's (all pixels are to be written) */ - MEMSET(mask, 1, n); + if (span->arrayMask & SPAN_MASK) { + /* mask was initialized by caller, probably glBitmap */ + span->writeAll = GL_FALSE; + } + else { + MEMSET(span->array->mask, 1, span->end); + span->writeAll = GL_TRUE; + } - if ((swrast->_RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { - if ((n = clip_span( ctx,n,x,y,mask)) == 0) { - return; + /* Determine if we have mono-chromatic colors */ + monoColor = (span->interpMask & SPAN_RGBA) && + span->redStep == 0 && span->greenStep == 0 && + span->blueStep == 0 && span->alphaStep == 0; + + /* Clipping */ + if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { + if (!clip_span(ctx, span)) { + return; } - if (mask[0] == 0) - write_all = GL_FALSE; } - /* Do the scissor test */ - if (ctx->Scissor.Enabled) { - if ((n = _mesa_scissor_span( ctx, n, x, y, mask )) == 0) { - return; +#ifdef DEBUG + if (span->arrayMask & SPAN_XY) { + GLuint i; + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); + assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); + assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); + assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); + } } - if (mask[0] == 0) - write_all = GL_FALSE; } +#endif /* Polygon Stippling */ - if (ctx->Polygon.StippleFlag && primitive==GL_POLYGON) { - stipple_polygon_span( ctx, n, x, y, mask ); - write_all = GL_FALSE; + if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { + stipple_polygon_span(ctx, span); } /* Do the alpha test */ if (ctx->Color.AlphaEnabled) { - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = color[ACOMP]; - } - if (_mesa_alpha_test( ctx, n, (const GLchan (*)[4])rgba, mask ) == 0) { + if (!_mesa_alpha_test(ctx, span)) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; return; } - write_all = GL_FALSE; } - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { - return; - } - write_all = GL_FALSE; - } - else if (ctx->Depth.Test) { - /* regular depth testing */ - GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); - if (m == 0) { - return; + /* Stencil and Z testing */ + if (ctx->Stencil.Enabled || ctx->Depth.Test) { + if (span->interpMask & SPAN_Z) + _mesa_span_interpolate_z(ctx, span); + + if (ctx->Stencil.Enabled) { + if (!_mesa_stencil_and_ztest_span(ctx, span)) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; + return; + } } - if (m < n) { - write_all = GL_FALSE; + else { + ASSERT(ctx->Depth.Test); + ASSERT(span->arrayMask & SPAN_Z); + /* regular depth testing */ + if (!_mesa_depth_test_span(ctx, span)) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; + return; + } } } /* if we get here, something passed the depth test */ ctx->OcclusionResult = GL_TRUE; - if (ctx->Color.DrawBuffer == GL_NONE) { - /* write no pixels */ + /* can't abort span-writing until after occlusion testing */ + if (colorMask == 0x0) { + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; return; } - if (ctx->Color.ColorLogicOpEnabled || colorMask != 0xffffffff || - (swrast->_RasterMask & (BLEND_BIT | FOG_BIT)) || coverage) { - /* assign same color to each pixel */ - for (i = 0; i < n; i++) { - if (mask[i]) { - COPY_CHAN4(rgba[i], color); - } - } + /* Now we may need to interpolate the colors */ + if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) { + interpolate_colors(ctx, span); + /* clear the bit - this allows the WriteMonoCISpan optimization below */ + span->interpMask &= ~SPAN_RGBA; + } - /* Per-pixel fog */ - if (ctx->Fog.Enabled) { - if (fog && !swrast->_PreferPixelFog) - _mesa_fog_rgba_pixels( ctx, n, fog, rgba ); - else - _mesa_depth_fog_rgba_pixels( ctx, n, z, rgba ); - } + /* Fog */ + if (ctx->Fog.Enabled) { + _mesa_fog_rgba_span(ctx, span); + monoColor = GL_FALSE; + } - /* Antialias coverage application */ - if (coverage) { - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); - } + /* Antialias coverage application */ + if (span->arrayMask & SPAN_COVERAGE) { + GLchan (*rgba)[4] = span->array->rgba; + GLfloat *coverage = span->array->coverage; + GLuint i; + for (i = 0; i < span->end; i++) { + rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); } + monoColor = GL_FALSE; + } - if (swrast->_RasterMask & MULTI_DRAW_BIT) { - multi_write_rgba_span( ctx, n, x, y, - (const GLchan (*)[4]) rgba, mask ); + if (swrast->_RasterMask & MULTI_DRAW_BIT) { + multi_write_rgba_span(ctx, span); + } + else { + /* normal: write to exactly one buffer */ + if (ctx->Color.ColorLogicOpEnabled) { + _mesa_logicop_rgba_span(ctx, span, span->array->rgba); + monoColor = GL_FALSE; + } + else if (ctx->Color.BlendEnabled) { + _mesa_blend_span(ctx, span, span->array->rgba); + monoColor = GL_FALSE; } - else { - /* normal: write to exactly one buffer */ - if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); - } - else if (ctx->Color.BlendEnabled) { - _mesa_blend_span( ctx, n, x, y, rgba, mask ); - } - - /* Color component masking */ - if (colorMask == 0x0) { - return; - } - else if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, n, x, y, rgba ); - } - /* write pixels */ - (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, - (const GLchan (*)[4]) rgba, - write_all ? Null : mask ); - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_span( ctx, n, x, y, - (const GLchan (*)[4]) rgba, - write_all ? Null : mask ); - } + /* Color component masking */ + if (colorMask != 0xffffffff) { + _mesa_mask_rgba_span(ctx, span, span->array->rgba); + monoColor = GL_FALSE; } - } - else { - /* same color for all pixels */ - ASSERT(!ctx->Color.BlendEnabled); - ASSERT(!ctx->Color.ColorLogicOpEnabled); - if (swrast->_RasterMask & MULTI_DRAW_BIT) { - for (i = 0; i < n; i++) { - if (mask[i]) { - COPY_CHAN4(rgba[i], color); - } + /* write pixels */ + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + /* XXX test for mono color */ + (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x, + span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask); + if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { + _mesa_write_alpha_pixels(ctx, span->end, + span->array->x, span->array->y, + (const GLchan (*)[4]) span->array->rgba, + span->array->mask); } - multi_write_rgba_span( ctx, n, x, y, - (const GLchan (*)[4]) rgba, mask ); } else { - (*swrast->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask ); - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_write_mono_alpha_span( ctx, n, x, y, (GLchan) color[ACOMP], - write_all ? Null : mask ); + /* horizontal run of pixels */ + if (monoColor) { + /* all pixels have same color */ + GLchan color[4]; + color[RCOMP] = FixedToChan(span->red); + color[GCOMP] = FixedToChan(span->green); + color[BCOMP] = FixedToChan(span->blue); + color[ACOMP] = FixedToChan(span->alpha); + (*swrast->Driver.WriteMonoRGBASpan)(ctx, span->end, span->x, + span->y, color, span->array->mask); + if (swrast->_RasterMask & ALPHABUF_BIT) { + _mesa_write_mono_alpha_span(ctx, span->end, span->x, span->y, + color[ACOMP], + span->writeAll ? ((const GLubyte *) NULL) : span->array->mask); + } + } + else { + /* each pixel is a different color */ + (*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y, + (const GLchan (*)[4]) span->array->rgba, + span->writeAll ? ((const GLubyte *) NULL) : span->array->mask); + if (swrast->_RasterMask & ALPHABUF_BIT) { + _mesa_write_alpha_span(ctx, span->end, span->x, span->y, + (const GLchan (*)[4]) span->array->rgba, + span->writeAll ? ((const GLubyte *) NULL) : span->array->mask); + } } } } -} + span->interpMask = origInterpMask; + span->arrayMask = origArrayMask; +} -/* +/** * Add specular color to base color. This is used only when * GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR. */ static void -add_colors(GLuint n, GLchan rgba[][4], CONST GLchan specular[][4] ) +add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] ) { GLuint i; for (i = 0; i < n; i++) { @@ -801,330 +1110,205 @@ add_colors(GLuint n, GLchan rgba[][4], CONST GLchan specular[][4] ) } -/* - * Write a horizontal span of textured pixels to the frame buffer. - * The color of each pixel is different. - * Alpha-testing, stenciling, depth-testing, and blending are done - * as needed. - * Input: n - number of pixels in the span - * x, y - location of leftmost pixel in the span - * z - array of [n] z-values - * fog - array of fog factor values in [0,1] - * s, t - array of (s,t) texture coordinates for each pixel - * lambda - array of texture lambda values - * rgba - array of [n] color components - * primitive - either GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP. +/** + * This function may modify any of the array values in the span. + * span->interpMask and span->arrayMask may be changed but will be restored + * to their original values before returning. */ void -_mesa_write_texture_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - const GLfloat s[], const GLfloat t[], - const GLfloat u[], GLfloat lambda[], - GLchan rgbaIn[][4], CONST GLchan spec[][4], - const GLfloat coverage[], GLenum primitive ) +_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span) { const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); - GLubyte mask[MAX_WIDTH]; - GLboolean write_all = GL_TRUE; - GLchan rgbaBackup[MAX_WIDTH][4]; - GLchan (*rgba)[4]; /* points to either rgbaIn or rgbaBackup */ - const GLubyte *Null = 0; SWcontext *swrast = SWRAST_CONTEXT(ctx); + const GLuint origArrayMask = span->arrayMask; - /* init mask to 1's (all pixels are to be written) */ - MEMSET(mask, 1, n); - - if ((swrast->_RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { - if ((n=clip_span(ctx, n, x, y, mask)) == 0) { - return; - } - if (mask[0] == 0) - write_all = GL_FALSE; - } + ASSERT(span->primitive == GL_POINT || span->primitive == GL_LINE || + span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); + ASSERT(span->end <= MAX_WIDTH); + ASSERT((span->interpMask & span->arrayMask) == 0); + ASSERT(ctx->Texture._EnabledUnits); + /* + printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask); + */ - if (primitive==GL_BITMAP || (swrast->_RasterMask & MULTI_DRAW_BIT)) { - /* must make a copy of the colors since they may be modified */ - MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLchan)); - rgba = rgbaBackup; + if (span->arrayMask & SPAN_MASK) { + /* mask was initialized by caller, probably glBitmap */ + span->writeAll = GL_FALSE; } else { - rgba = rgbaIn; - } - - /* Do the scissor test */ - if (ctx->Scissor.Enabled) { - if ((n = _mesa_scissor_span( ctx, n, x, y, mask )) == 0) { - return; - } - if (mask[0] == 0) - write_all = GL_FALSE; - } - - /* Polygon Stippling */ - if (ctx->Polygon.StippleFlag && primitive==GL_POLYGON) { - stipple_polygon_span( ctx, n, x, y, mask ); - write_all = GL_FALSE; + MEMSET(span->array->mask, 1, span->end); + span->writeAll = GL_TRUE; } - /* Texture with alpha test */ - if (ctx->Color.AlphaEnabled) { - /* Texturing without alpha is done after depth-testing which - gives a potential speed-up. */ - ASSERT(ctx->Texture._ReallyEnabled); - _swrast_texture_fragments( ctx, 0, n, s, t, u, lambda, - (CONST GLchan (*)[4]) rgba, rgba ); - - /* Do the alpha test */ - if (_mesa_alpha_test( ctx, n, (const GLchan (*)[4]) rgba, mask ) == 0) { - return; - } - write_all = GL_FALSE; - } - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { + /* Clipping */ + if ((swrast->_RasterMask & CLIP_BIT) || (span->primitive != GL_POLYGON)) { + if (!clip_span(ctx, span)) { return; } - write_all = GL_FALSE; - } - else if (ctx->Depth.Test) { - /* regular depth testing */ - GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); - if (m == 0) { - return; - } - if (m < n) { - write_all = GL_FALSE; - } } - /* if we get here, something passed the depth test */ - ctx->OcclusionResult = GL_TRUE; - - /* Texture without alpha test */ - if (! ctx->Color.AlphaEnabled) { - ASSERT(ctx->Texture._ReallyEnabled); - _swrast_texture_fragments( ctx, 0, n, s, t, u, lambda, - (CONST GLchan (*)[4]) rgba, rgba ); - } - - /* Add base and specular colors */ - if (spec && - (ctx->Fog.ColorSumEnabled || - (ctx->Light.Enabled && - ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR))) - add_colors( n, rgba, spec ); /* rgba = rgba + spec */ - - /* Per-pixel fog */ - if (ctx->Fog.Enabled) { - if (fog && !swrast->_PreferPixelFog) - _mesa_fog_rgba_pixels( ctx, n, fog, rgba ); - else - _mesa_depth_fog_rgba_pixels( ctx, n, z, rgba ); - } - - /* Antialias coverage application */ - if (coverage) { +#ifdef DEBUG + if (span->arrayMask & SPAN_XY) { GLuint i; - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); - } - } - - if (swrast->_RasterMask & MULTI_DRAW_BIT) { - multi_write_rgba_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, mask ); - } - else { - /* normal: write to exactly one buffer */ - if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); - } - else if (ctx->Color.BlendEnabled) { - _mesa_blend_span( ctx, n, x, y, rgba, mask ); - } - if (colorMask == 0x0) { - return; - } - else if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, n, x, y, rgba ); - } - - (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba, - write_all ? Null : mask ); - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, - write_all ? Null : mask ); - } - } -} - - - -/* - * As above but perform multiple stages of texture application. - */ -void -_mesa_write_multitexture_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH], - CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH], - CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH], - GLfloat lambda[][MAX_WIDTH], - GLchan rgbaIn[MAX_TEXTURE_UNITS][4], - CONST GLchan spec[MAX_TEXTURE_UNITS][4], - const GLfloat coverage[], - GLenum primitive ) -{ - GLubyte mask[MAX_WIDTH]; - GLboolean write_all = GL_TRUE; - GLchan rgbaBackup[MAX_WIDTH][4]; - GLchan (*rgba)[4]; /* points to either rgbaIn or rgbaBackup */ - GLuint i; - const GLubyte *Null = 0; - const GLuint texUnits = ctx->Const.MaxTextureUnits; - SWcontext *swrast = SWRAST_CONTEXT(ctx); - - /* init mask to 1's (all pixels are to be written) */ - MEMSET(mask, 1, n); - - if ((swrast->_RasterMask & WINCLIP_BIT) || primitive==GL_BITMAP) { - if ((n=clip_span(ctx, n, x, y, mask)) == 0) { - return; - } - if (mask[0] == 0) - write_all = GL_FALSE; - } - - - if (primitive==GL_BITMAP || (swrast->_RasterMask & MULTI_DRAW_BIT) - || texUnits > 1) { - /* must make a copy of the colors since they may be modified */ - MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLchan)); - rgba = rgbaBackup; - } - else { - rgba = rgbaIn; - } - - /* Do the scissor test */ - if (ctx->Scissor.Enabled) { - if ((n = _mesa_scissor_span( ctx, n, x, y, mask )) == 0) { - return; + for (i = 0; i < span->end; i++) { + if (span->array->mask[i]) { + assert(span->array->x[i] >= ctx->DrawBuffer->_Xmin); + assert(span->array->x[i] < ctx->DrawBuffer->_Xmax); + assert(span->array->y[i] >= ctx->DrawBuffer->_Ymin); + assert(span->array->y[i] < ctx->DrawBuffer->_Ymax); + } } - if (mask[0] == 0) - write_all = GL_FALSE; } +#endif /* Polygon Stippling */ - if (ctx->Polygon.StippleFlag && primitive==GL_POLYGON) { - stipple_polygon_span( ctx, n, x, y, mask ); - write_all = GL_FALSE; + if (ctx->Polygon.StippleFlag && span->primitive == GL_POLYGON) { + stipple_polygon_span(ctx, span); } + /* Need texture coordinates now */ + if ((span->interpMask & SPAN_TEXTURE) + && (span->arrayMask & SPAN_TEXTURE) == 0) + interpolate_texcoords(ctx, span); + /* Texture with alpha test */ if (ctx->Color.AlphaEnabled) { + + /* Now we need the rgba array, fill it in if needed */ + if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) + interpolate_colors(ctx, span); + /* Texturing without alpha is done after depth-testing which * gives a potential speed-up. */ - ASSERT(ctx->Texture._ReallyEnabled); - for (i = 0; i < texUnits; i++) - _swrast_texture_fragments( ctx, i, n, s[i], t[i], u[i], lambda[i], - (CONST GLchan (*)[4]) rgbaIn, rgba ); + _swrast_texture_span( ctx, span ); /* Do the alpha test */ - if (_mesa_alpha_test( ctx, n, (const GLchan (*)[4])rgba, mask ) == 0) { - return; - } - write_all = GL_FALSE; - } - - if (ctx->Stencil.Enabled) { - /* first stencil test */ - if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (!_mesa_alpha_test(ctx, span)) { + span->arrayMask = origArrayMask; return; } - write_all = GL_FALSE; } - else if (ctx->Depth.Test) { - /* regular depth testing */ - GLuint m = _mesa_depth_test_span( ctx, n, x, y, z, mask ); - if (m == 0) { - return; + + /* Stencil and Z testing */ + if (ctx->Stencil.Enabled || ctx->Depth.Test) { + if (span->interpMask & SPAN_Z) + _mesa_span_interpolate_z(ctx, span); + + if (ctx->Stencil.Enabled) { + if (!_mesa_stencil_and_ztest_span(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } } - if (m < n) { - write_all = GL_FALSE; + else { + ASSERT(ctx->Depth.Test); + ASSERT(span->arrayMask & SPAN_Z); + /* regular depth testing */ + if (!_mesa_depth_test_span(ctx, span)) { + span->arrayMask = origArrayMask; + return; + } } } - /* if we get here, something passed the depth test */ + /* if we get here, some fragments passed the depth test */ ctx->OcclusionResult = GL_TRUE; + /* We had to wait until now to check for glColorMask(F,F,F,F) because of + * the occlusion test. + */ + if (colorMask == 0x0) { + span->arrayMask = origArrayMask; + return; + } + /* Texture without alpha test */ - if (! ctx->Color.AlphaEnabled) { - ASSERT(ctx->Texture._ReallyEnabled); - for (i = 0; i < texUnits; i++) - _swrast_texture_fragments( ctx, i, n, s[i], t[i], u[i], lambda[i], - (CONST GLchan (*)[4]) rgbaIn, rgba ); + if (!ctx->Color.AlphaEnabled) { + + /* Now we need the rgba array, fill it in if needed */ + if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0) + interpolate_colors(ctx, span); + + _swrast_texture_span( ctx, span ); } + ASSERT(span->arrayMask & SPAN_RGBA); + /* Add base and specular colors */ - if (spec && - (ctx->Fog.ColorSumEnabled || - (ctx->Light.Enabled && - ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR))) - add_colors( n, rgba, spec ); /* rgba = rgba + spec */ + if (ctx->Fog.ColorSumEnabled || + (ctx->Light.Enabled && + ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { + if (span->interpMask & SPAN_SPEC) { + interpolate_specular(ctx, span); + } + ASSERT(span->arrayMask & SPAN_SPEC); + add_colors( span->end, span->array->rgba, span->array->spec ); + } - /* Per-pixel fog */ + /* Fog */ if (ctx->Fog.Enabled) { - if (fog && !swrast->_PreferPixelFog) - _mesa_fog_rgba_pixels( ctx, n, fog, rgba ); - else - _mesa_depth_fog_rgba_pixels( ctx, n, z, rgba ); + _mesa_fog_rgba_span(ctx, span); } /* Antialias coverage application */ - if (coverage) { + if (span->arrayMask & SPAN_COVERAGE) { + GLchan (*rgba)[4] = span->array->rgba; + GLfloat *coverage = span->array->coverage; GLuint i; - for (i = 0; i < n; i++) { + for (i = 0; i < span->end; i++) { rgba[i][ACOMP] = (GLchan) (rgba[i][ACOMP] * coverage[i]); } } if (swrast->_RasterMask & MULTI_DRAW_BIT) { - multi_write_rgba_span( ctx, n, x, y, (const GLchan (*)[4]) rgba, mask ); + multi_write_rgba_span(ctx, span); } else { /* normal: write to exactly one buffer */ - const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask); - if (ctx->Color.ColorLogicOpEnabled) { - _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span(ctx, span, span->array->rgba); } - else if (ctx->Color.BlendEnabled) { - _mesa_blend_span( ctx, n, x, y, rgba, mask ); + else if (ctx->Color.BlendEnabled) { + _mesa_blend_span(ctx, span, span->array->rgba); } - if (colorMask == 0x0) { - return; - } - else if (colorMask != 0xffffffff) { - _mesa_mask_rgba_span( ctx, n, x, y, rgba ); + if (colorMask != 0xffffffff) { + _mesa_mask_rgba_span(ctx, span, span->array->rgba); } - (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba, - write_all ? Null : mask ); - if (swrast->_RasterMask & ALPHABUF_BIT) { - _mesa_write_alpha_span( ctx, n, x, y, (const GLchan (*)[4])rgba, - write_all ? Null : mask ); + + if (span->arrayMask & SPAN_XY) { + /* array of pixel coords */ + (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x, + span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask); + if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { + _mesa_write_alpha_pixels(ctx, span->end, + span->array->x, span->array->y, + (const GLchan (*)[4]) span->array->rgba, + span->array->mask); + } + } + else { + /* horizontal run of pixels */ + (*swrast->Driver.WriteRGBASpan)(ctx, span->end, span->x, span->y, + (const GLchan (*)[4]) span->array->rgba, + span->writeAll ? NULL : span->array->mask); + if (swrast->_RasterMask & ALPHABUF_BIT) { + _mesa_write_alpha_span(ctx, span->end, span->x, span->y, + (const GLchan (*)[4]) span->array->rgba, + span->writeAll ? NULL : span->array->mask); + } } } + + span->arrayMask = origArrayMask; } -/* +/** * Read RGBA pixels from frame buffer. Clipping will be done to prevent * reading ouside the buffer's boundaries. */ @@ -1139,7 +1323,7 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ /* XXX maybe leave undefined? */ - BZERO(rgba, 4 * n * sizeof(GLchan)); + _mesa_bzero(rgba, 4 * n * sizeof(GLchan)); } else { GLint skip, length; @@ -1152,7 +1336,7 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, return; } if (length > bufWidth) { - length = buffer->Width; + length = bufWidth; } } else if ((GLint) (x + n) > bufWidth) { @@ -1172,15 +1356,13 @@ _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, (*swrast->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip ); if (buffer->UseSoftwareAlphaBuffers) { - _mesa_read_alpha_span( ctx, length, x + skip, y, rgba + skip ); + _mesa_read_alpha_span(ctx, length, x + skip, y, rgba + skip); } } } - - -/* +/** * Read CI pixels from frame buffer. Clipping will be done to prevent * reading ouside the buffer's boundaries. */ @@ -1194,7 +1376,7 @@ _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer, if (y < 0 || y >= bufHeight || x + (GLint) n < 0 || x >= bufWidth) { /* completely above, below, or right */ - BZERO(indx, n * sizeof(GLuint)); + _mesa_bzero(indx, n * sizeof(GLuint)); } else { GLint skip, length; diff --git a/xc/extras/Mesa/src/swrast/s_span.h b/xc/extras/Mesa/src/swrast/s_span.h index 063494258..d37961e98 100644 --- a/xc/extras/Mesa/src/swrast/s_span.h +++ b/xc/extras/Mesa/src/swrast/s_span.h @@ -1,10 +1,9 @@ -/* $Id: s_span.h,v 1.1.1.1 2002/10/22 13:06:57 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -34,61 +33,38 @@ extern void -_mesa_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - GLuint index[], const GLint coverage[], - GLenum primitive ); - +_mesa_span_default_z( GLcontext *ctx, struct sw_span *span ); extern void -_mesa_write_monoindex_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - GLuint index, const GLint coverage[], - GLenum primitive ); +_mesa_span_interpolate_z( const GLcontext *ctx, struct sw_span *span ); +extern void +_mesa_span_default_fog( GLcontext *ctx, struct sw_span *span ); extern void -_mesa_write_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - GLchan rgba[][4], const GLfloat coverage[], - GLenum primitive ); +_mesa_span_default_color( GLcontext *ctx, struct sw_span *span ); +extern void +_mesa_span_default_texcoords( GLcontext *ctx, struct sw_span *span ); extern void -_mesa_write_monocolor_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - const GLchan color[4], const GLfloat coverage[], - GLenum primitive ); +_mesa_write_index_span( GLcontext *ctx, struct sw_span *span); extern void -_mesa_write_texture_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - const GLfloat s[], const GLfloat t[], - const GLfloat u[], GLfloat lambda[], - GLchan rgba[][4], CONST GLchan spec[][4], - const GLfloat coverage[], GLenum primitive ); +_mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span); extern void -_mesa_write_multitexture_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], const GLfloat fog[], - CONST GLfloat s[MAX_TEXTURE_UNITS][MAX_WIDTH], - CONST GLfloat t[MAX_TEXTURE_UNITS][MAX_WIDTH], - CONST GLfloat u[MAX_TEXTURE_UNITS][MAX_WIDTH], - GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH], - GLchan rgba[][4], CONST GLchan spec[][4], - const GLfloat coverage[], GLenum primitive ); +_mesa_write_texture_span( GLcontext *ctx, struct sw_span *span); extern void _mesa_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, GLuint n, GLint x, GLint y, GLchan rgba[][4] ); - extern void _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer, GLuint n, GLint x, GLint y, GLuint indx[] ); - #endif diff --git a/xc/extras/Mesa/src/swrast/s_stencil.c b/xc/extras/Mesa/src/swrast/s_stencil.c index 13ecc70da..b535830fe 100644 --- a/xc/extras/Mesa/src/swrast/s_stencil.c +++ b/xc/extras/Mesa/src/swrast/s_stencil.c @@ -1,8 +1,7 @@ -/* $Id: s_stencil.c,v 1.1.1.1 2002/10/22 13:06:41 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -28,17 +27,14 @@ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "s_context.h" #include "s_depth.h" -#include "s_pb.h" #include "s_stencil.h" - - /* Stencil Logic: IF stencil test fails THEN @@ -55,8 +51,6 @@ ENDIF */ - - /* * Return the address of a stencil buffer value given the window coords: */ @@ -65,22 +59,23 @@ ENDIF -/* +/** * Apply the given stencil operator to the array of stencil values. * Don't touch stencil[i] if mask[i] is zero. * Input: n - size of stencil array * oper - the stencil buffer operator + * face - 0 or 1 for front or back face operation * stencil - array of stencil values * mask - array [n] of flag: 1=apply operator, 0=don't apply operator * Output: stencil - modified values */ -static void apply_stencil_op( const GLcontext *ctx, GLenum oper, - GLuint n, GLstencil stencil[], - const GLubyte mask[] ) +static void +apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face, + GLuint n, GLstencil stencil[], const GLubyte mask[] ) { - const GLstencil ref = ctx->Stencil.Ref; - const GLstencil wrtmask = ctx->Stencil.WriteMask; - const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask); + const GLstencil ref = ctx->Stencil.Ref[face]; + const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; + const GLstencil invmask = (GLstencil) (~wrtmask); GLuint i; switch (oper) { @@ -226,9 +221,10 @@ static void apply_stencil_op( const GLcontext *ctx, GLenum oper, -/* +/** * Apply stencil test to an array of stencil values (before depth buffering). - * Input: n - number of pixels in the array + * Input: face - 0 or 1 for front or back-face polygons + * n - number of pixels in the array * stencil - array of [n] stencil values * mask - array [n] of flag: 0=skip the pixel, 1=stencil the pixel * Output: mask - pixels which fail the stencil test will have their @@ -237,15 +233,16 @@ static void apply_stencil_op( const GLcontext *ctx, GLenum oper, * Return: GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed. */ static GLboolean -do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], +do_stencil_test( GLcontext *ctx, GLuint face, GLuint n, GLstencil stencil[], GLubyte mask[] ) { - GLubyte fail[PB_SIZE]; + GLubyte fail[MAX_WIDTH]; GLboolean allfail = GL_FALSE; GLuint i; GLstencil r, s; + const GLuint valueMask = ctx->Stencil.ValueMask[face]; - ASSERT(n <= PB_SIZE); + ASSERT(n <= MAX_WIDTH); /* * Perform stencil test. The results of this operation are stored @@ -256,9 +253,9 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], * the stencil fail operator is not to be applied * ENDIF */ - switch (ctx->Stencil.Function) { + switch (ctx->Stencil.Function[face]) { case GL_NEVER: - /* always fail */ + /* never pass; always fail */ for (i=0;i<n;i++) { if (mask[i]) { mask[i] = 0; @@ -271,10 +268,10 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], allfail = GL_TRUE; break; case GL_LESS: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { - s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); + s = (GLstencil) (stencil[i] & valueMask); if (r < s) { /* passed */ fail[i] = 0; @@ -290,10 +287,10 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], } break; case GL_LEQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { - s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); + s = (GLstencil) (stencil[i] & valueMask); if (r <= s) { /* pass */ fail[i] = 0; @@ -309,10 +306,10 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], } break; case GL_GREATER: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { - s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); + s = (GLstencil) (stencil[i] & valueMask); if (r > s) { /* passed */ fail[i] = 0; @@ -328,10 +325,10 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], } break; case GL_GEQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { - s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); + s = (GLstencil) (stencil[i] & valueMask); if (r >= s) { /* passed */ fail[i] = 0; @@ -347,10 +344,10 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], } break; case GL_EQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { - s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); + s = (GLstencil) (stencil[i] & valueMask); if (r == s) { /* passed */ fail[i] = 0; @@ -366,10 +363,10 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], } break; case GL_NOTEQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { - s = (GLstencil) (stencil[i] & ctx->Stencil.ValueMask); + s = (GLstencil) (stencil[i] & valueMask); if (r != s) { /* passed */ fail[i] = 0; @@ -395,8 +392,8 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], return 0; } - if (ctx->Stencil.FailFunc != GL_KEEP) { - apply_stencil_op( ctx, ctx->Stencil.FailFunc, n, stencil, fail ); + if (ctx->Stencil.FailFunc[face] != GL_KEEP) { + apply_stencil_op( ctx, ctx->Stencil.FailFunc[face], face, n, stencil, fail ); } return !allfail; @@ -404,47 +401,69 @@ do_stencil_test( GLcontext *ctx, GLuint n, GLstencil stencil[], - -/* - * Apply stencil and depth testing to an array of pixels. - * Hardware or software stencil buffer acceptable. +/** + * Apply stencil and depth testing to the span of pixels. + * Both software and hardware stencil buffers are acceptable. * Input: n - number of pixels in the span + * x, y - location of leftmost pixel in span * z - array [n] of z values - * stencil - array [n] of stencil values * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) - * Output: stencil - modified stencil values - * mask - array [n] of flags (1=stencil and depth test passed) - * Return: GL_TRUE - all fragments failed the testing - * GL_FALSE - one or more fragments passed the testing + * Output: mask - array [n] of flags (1=stencil and depth test passed) + * Return: GL_FALSE - all fragments failed the testing + * GL_TRUE - one or more fragments passed the testing * */ static GLboolean -stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLstencil stencil[], - GLubyte mask[] ) +stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span, GLuint face) { - ASSERT(ctx->Stencil.Enabled); - ASSERT(n <= PB_SIZE); + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLstencil stencilRow[MAX_WIDTH]; + GLstencil *stencil; + const GLuint n = span->end; + const GLint x = span->x; + const GLint y = span->y; + GLubyte *mask = span->array->mask; + ASSERT((span->arrayMask & SPAN_XY) == 0); + ASSERT(ctx->Stencil.Enabled); + ASSERT(n <= MAX_WIDTH); +#ifdef DEBUG + if (ctx->Depth.Test) { + ASSERT(span->arrayMask & SPAN_Z); + } +#endif + + /* Get initial stencil values */ + if (swrast->Driver.WriteStencilSpan) { + /* Get stencil values from the hardware stencil buffer */ + ASSERT(swrast->Driver.ReadStencilSpan); + (*swrast->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow); + stencil = stencilRow; + } + else { + /* Get pointer into software stencil buffer */ + stencil = STENCIL_ADDRESS(x, y); + } + /* * Apply the stencil test to the fragments. * failMask[i] is 1 if the stencil test failed. */ - if (do_stencil_test( ctx, n, stencil, mask ) == GL_FALSE) { + if (do_stencil_test( ctx, face, n, stencil, mask ) == GL_FALSE) { /* all fragments failed the stencil test, we're done. */ + span->writeAll = GL_FALSE; return GL_FALSE; } - /* * Some fragments passed the stencil test, apply depth test to them * and apply Zpass and Zfail stencil ops. */ - if (ctx->Depth.Test==GL_FALSE) { + if (ctx->Depth.Test == GL_FALSE) { /* * No depth buffer, just apply zpass stencil function to active pixels. */ - apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, mask ); + apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, mask ); } else { /* @@ -457,7 +476,7 @@ stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, MEMCPY(oldmask, mask, n * sizeof(GLubyte)); /* apply the depth test */ - _mesa_depth_test_span(ctx, n, x, y, z, mask); + _mesa_depth_test_span(ctx, span); /* Set the stencil pass/fail flags according to result of depth testing. * if oldmask[i] == 0 then @@ -476,72 +495,36 @@ stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } /* apply the pass and fail operations */ - if (ctx->Stencil.ZFailFunc != GL_KEEP) { - apply_stencil_op( ctx, ctx->Stencil.ZFailFunc, n, stencil, failmask ); + if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { + apply_stencil_op( ctx, ctx->Stencil.ZFailFunc[face], face, + n, stencil, failmask ); } - if (ctx->Stencil.ZPassFunc != GL_KEEP) { - apply_stencil_op( ctx, ctx->Stencil.ZPassFunc, n, stencil, passmask ); + if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { + apply_stencil_op( ctx, ctx->Stencil.ZPassFunc[face], face, + n, stencil, passmask ); } } - return GL_TRUE; /* one or more fragments passed both tests */ -} - - - -/* - * Apply stencil and depth testing to the span of pixels. - * Both software and hardware stencil buffers are acceptable. - * Input: n - number of pixels in the span - * x, y - location of leftmost pixel in span - * z - array [n] of z values - * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) - * Output: mask - array [n] of flags (1=stencil and depth test passed) - * Return: GL_TRUE - all fragments failed the testing - * GL_FALSE - one or more fragments passed the testing - * - */ -GLboolean -_mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLubyte mask[] ) -{ - SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLstencil stencilRow[MAX_WIDTH]; - GLstencil *stencil; - GLboolean result; - - ASSERT(ctx->Stencil.Enabled); - ASSERT(n <= MAX_WIDTH); - - /* Get initial stencil values */ - if (swrast->Driver.WriteStencilSpan) { - ASSERT(swrast->Driver.ReadStencilSpan); - /* Get stencil values from the hardware stencil buffer */ - (*swrast->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow); - stencil = stencilRow; - } - else { - /* software stencil buffer */ - stencil = STENCIL_ADDRESS(x, y); - } - - /* do all the stencil/depth testing/updating */ - result = stencil_and_ztest_span( ctx, n, x, y, z, stencil, mask ); - + /* + * Write updated stencil values back into hardware stencil buffer. + */ if (swrast->Driver.WriteStencilSpan) { - /* Write updated stencil values into hardware stencil buffer */ + ASSERT(stencil == stencilRow); (swrast->Driver.WriteStencilSpan)(ctx, n, x, y, stencil, mask ); } - - return result; + + span->writeAll = GL_FALSE; + + return GL_TRUE; /* one or more fragments passed both tests */ } -/* +/** * Apply the given stencil operator for each pixel in the array whose - * mask flag is set. This is for software stencil buffers only. + * mask flag is set. + * \note This is for software stencil buffers only. * Input: n - number of pixels in the span * x, y - array of [n] pixels * operator - the stencil buffer operator @@ -550,11 +533,11 @@ _mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, static void apply_stencil_op_to_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - GLenum oper, const GLubyte mask[] ) + GLenum oper, GLuint face, const GLubyte mask[] ) { - const GLstencil ref = ctx->Stencil.Ref; - const GLstencil wrtmask = ctx->Stencil.WriteMask; - const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask); + const GLstencil ref = ctx->Stencil.Ref[face]; + const GLstencil wrtmask = ctx->Stencil.WriteMask[face]; + const GLstencil invmask = (GLstencil) (~wrtmask); GLuint i; ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */ @@ -704,26 +687,31 @@ apply_stencil_op_to_pixels( const GLcontext *ctx, -/* +/** * Apply stencil test to an array of pixels before depth buffering. - * Used for software stencil buffer only. + * + * \note Used for software stencil buffer only. * Input: n - number of pixels in the span * x, y - array of [n] pixels to stencil * mask - array [n] of flag: 0=skip the pixel, 1=stencil the pixel * Output: mask - pixels which fail the stencil test will have their * mask flag set to 0. - * Return: 0 = all pixels failed, 1 = zero or more pixels passed. + * \return GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed. */ static GLboolean -stencil_test_pixels( GLcontext *ctx, GLuint n, +stencil_test_pixels( GLcontext *ctx, GLuint face, GLuint n, const GLint x[], const GLint y[], GLubyte mask[] ) { - GLubyte fail[PB_SIZE]; + GLubyte fail[MAX_WIDTH]; GLstencil r, s; GLuint i; GLboolean allfail = GL_FALSE; + const GLuint valueMask = ctx->Stencil.ValueMask[face]; - ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */ + /* software stencil buffer only! */ + ASSERT(ctx->DrawBuffer->UseSoftwareStencilBuffer); + ASSERT(!SWRAST_CONTEXT(ctx)->Driver.ReadStencilSpan); + ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* * Perform stencil test. The results of this operation are stored @@ -735,7 +723,7 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, * ENDIF */ - switch (ctx->Stencil.Function) { + switch (ctx->Stencil.Function[face]) { case GL_NEVER: /* always fail */ for (i=0;i<n;i++) { @@ -750,11 +738,11 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, allfail = GL_TRUE; break; case GL_LESS: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); - s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); + s = (GLstencil) (*sptr & valueMask); if (r < s) { /* passed */ fail[i] = 0; @@ -770,11 +758,11 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, } break; case GL_LEQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); - s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); + s = (GLstencil) (*sptr & valueMask); if (r <= s) { /* pass */ fail[i] = 0; @@ -790,11 +778,11 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, } break; case GL_GREATER: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); - s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); + s = (GLstencil) (*sptr & valueMask); if (r > s) { /* passed */ fail[i] = 0; @@ -810,11 +798,11 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, } break; case GL_GEQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); - s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); + s = (GLstencil) (*sptr & valueMask); if (r >= s) { /* passed */ fail[i] = 0; @@ -830,11 +818,11 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, } break; case GL_EQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); - s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); + s = (GLstencil) (*sptr & valueMask); if (r == s) { /* passed */ fail[i] = 0; @@ -850,11 +838,11 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, } break; case GL_NOTEQUAL: - r = (GLstencil) (ctx->Stencil.Ref & ctx->Stencil.ValueMask); + r = (GLstencil) (ctx->Stencil.Ref[face] & valueMask); for (i=0;i<n;i++) { if (mask[i]) { GLstencil *sptr = STENCIL_ADDRESS(x[i],y[i]); - s = (GLstencil) (*sptr & ctx->Stencil.ValueMask); + s = (GLstencil) (*sptr & valueMask); if (r != s) { /* passed */ fail[i] = 0; @@ -880,8 +868,9 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, return 0; } - if (ctx->Stencil.FailFunc != GL_KEEP) { - apply_stencil_op_to_pixels( ctx, n, x, y, ctx->Stencil.FailFunc, fail ); + if (ctx->Stencil.FailFunc[face] != GL_KEEP) { + apply_stencil_op_to_pixels( ctx, n, x, y, ctx->Stencil.FailFunc[face], + face, fail ); } return !allfail; @@ -890,7 +879,7 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, -/* +/** * Apply stencil and depth testing to an array of pixels. * This is used both for software and hardware stencil buffers. * @@ -903,54 +892,60 @@ stencil_test_pixels( GLcontext *ctx, GLuint n, * z - array [n] of z values * mask - array [n] of flags (1=test this pixel, 0=skip the pixel) * Output: mask - array [n] of flags (1=stencil and depth test passed) - * Return: GL_TRUE - all fragments failed the testing - * GL_FALSE - one or more fragments passed the testing + * Return: GL_FALSE - all fragments failed the testing + * GL_TRUE - one or more fragments passed the testing */ -GLboolean -_mesa_stencil_and_ztest_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - const GLdepth z[], GLubyte mask[] ) +static GLboolean +stencil_and_ztest_pixels( GLcontext *ctx, struct sw_span *span, GLuint face ) { + const GLuint n = span->end; + const GLint *x = span->array->x; + const GLint *y = span->array->y; + GLubyte *mask = span->array->mask; SWcontext *swrast = SWRAST_CONTEXT(ctx); + + ASSERT(span->arrayMask & SPAN_XY); ASSERT(ctx->Stencil.Enabled); - ASSERT(n <= PB_SIZE); + ASSERT(n <= MAX_WIDTH); if (swrast->Driver.WriteStencilPixels) { /*** Hardware stencil buffer ***/ - GLstencil stencil[PB_SIZE]; - GLubyte origMask[PB_SIZE]; + GLstencil stencil[MAX_WIDTH]; + GLubyte origMask[MAX_WIDTH]; + ASSERT(!ctx->DrawBuffer->UseSoftwareStencilBuffer); ASSERT(swrast->Driver.ReadStencilPixels); (*swrast->Driver.ReadStencilPixels)(ctx, n, x, y, stencil); MEMCPY(origMask, mask, n * sizeof(GLubyte)); - (void) do_stencil_test(ctx, n, stencil, mask); + (void) do_stencil_test(ctx, face, n, stencil, mask); if (ctx->Depth.Test == GL_FALSE) { - apply_stencil_op(ctx, ctx->Stencil.ZPassFunc, n, stencil, mask); + apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, + n, stencil, mask); } else { - _mesa_depth_test_pixels(ctx, n, x, y, z, mask); + _mesa_depth_test_span(ctx, span); - if (ctx->Stencil.ZFailFunc != GL_KEEP) { - GLubyte failmask[PB_SIZE]; + if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { + GLubyte failmask[MAX_WIDTH]; GLuint i; for (i = 0; i < n; i++) { ASSERT(mask[i] == 0 || mask[i] == 1); failmask[i] = origMask[i] & (mask[i] ^ 1); } - apply_stencil_op(ctx, ctx->Stencil.ZFailFunc, + apply_stencil_op(ctx, ctx->Stencil.ZFailFunc[face], face, n, stencil, failmask); } - if (ctx->Stencil.ZPassFunc != GL_KEEP) { - GLubyte passmask[PB_SIZE]; + if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { + GLubyte passmask[MAX_WIDTH]; GLuint i; for (i = 0; i < n; i++) { ASSERT(mask[i] == 0 || mask[i] == 1); passmask[i] = origMask[i] & mask[i]; } - apply_stencil_op(ctx, ctx->Stencil.ZPassFunc, + apply_stencil_op(ctx, ctx->Stencil.ZPassFunc[face], face, n, stencil, passmask); } } @@ -963,22 +958,24 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx, else { /*** Software stencil buffer ***/ - if (stencil_test_pixels(ctx, n, x, y, mask) == GL_FALSE) { + ASSERT(ctx->DrawBuffer->UseSoftwareStencilBuffer); + + if (stencil_test_pixels(ctx, face, n, x, y, mask) == GL_FALSE) { /* all fragments failed the stencil test, we're done. */ return GL_FALSE; } if (ctx->Depth.Test==GL_FALSE) { apply_stencil_op_to_pixels(ctx, n, x, y, - ctx->Stencil.ZPassFunc, mask); + ctx->Stencil.ZPassFunc[face], face, mask); } else { - GLubyte passmask[PB_SIZE], failmask[PB_SIZE], oldmask[PB_SIZE]; + GLubyte passmask[MAX_WIDTH], failmask[MAX_WIDTH], oldmask[MAX_WIDTH]; GLuint i; MEMCPY(oldmask, mask, n * sizeof(GLubyte)); - _mesa_depth_test_pixels(ctx, n, x, y, z, mask); + _mesa_depth_test_span(ctx, span); for (i=0;i<n;i++) { ASSERT(mask[i] == 0 || mask[i] == 1); @@ -986,13 +983,15 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx, failmask[i] = oldmask[i] & (mask[i] ^ 1); } - if (ctx->Stencil.ZFailFunc != GL_KEEP) { + if (ctx->Stencil.ZFailFunc[face] != GL_KEEP) { apply_stencil_op_to_pixels(ctx, n, x, y, - ctx->Stencil.ZFailFunc, failmask); + ctx->Stencil.ZFailFunc[face], + face, failmask); } - if (ctx->Stencil.ZPassFunc != GL_KEEP) { + if (ctx->Stencil.ZPassFunc[face] != GL_KEEP) { apply_stencil_op_to_pixels(ctx, n, x, y, - ctx->Stencil.ZPassFunc, passmask); + ctx->Stencil.ZPassFunc[face], + face, passmask); } } @@ -1001,8 +1000,23 @@ _mesa_stencil_and_ztest_pixels( GLcontext *ctx, } +/** + * /return GL_TRUE = one or more fragments passed, + * GL_FALSE = all fragments failed. + */ +GLboolean +_mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span) +{ + /* span->facing can only be non-zero if using two-sided stencil */ + ASSERT(ctx->Stencil.TestTwoSide || span->facing == 0); + if (span->arrayMask & SPAN_XY) + return stencil_and_ztest_pixels(ctx, span, span->facing); + else + return stencil_and_ztest_span(ctx, span, span->facing); +} -/* + +/** * Return a span of stencil values from the stencil buffer. * Used for glRead/CopyPixels * Input: n - how many pixels @@ -1014,8 +1028,10 @@ _mesa_read_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, GLstencil stencil[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || - x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { + const GLint bufWidth = (GLint) ctx->DrawBuffer->Width; + const GLint bufHeight = (GLint) ctx->DrawBuffer->Height; + + if (y < 0 || y >= bufHeight || x + n <= 0 || x >= bufWidth) { /* span is completely outside framebuffer */ return; /* undefined values OK */ } @@ -1026,8 +1042,8 @@ _mesa_read_stencil_span( GLcontext *ctx, n -= dx; stencil += dx; } - if (x + n > (GLint) ctx->DrawBuffer->Width) { - GLint dx = x + n - (GLint) ctx->DrawBuffer->Width; + if (x + n > bufWidth) { + GLint dx = x + n - bufWidth; n -= dx; } if (n <= 0) { @@ -1053,7 +1069,7 @@ _mesa_read_stencil_span( GLcontext *ctx, -/* +/** * Write a span of stencil values to the stencil buffer. * Used for glDraw/CopyPixels * Input: n - how many pixels @@ -1066,9 +1082,10 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, { SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLstencil *ssrc = stencil; + const GLint bufWidth = (GLint) ctx->DrawBuffer->Width; + const GLint bufHeight = (GLint) ctx->DrawBuffer->Height; - if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height || - x + n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) { + if (y < 0 || y >= bufHeight || x + n <= 0 || x >= bufWidth) { /* span is completely outside framebuffer */ return; /* undefined values OK */ } @@ -1079,8 +1096,8 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, n -= dx; ssrc += dx; } - if (x + n > (GLint) ctx->DrawBuffer->Width) { - GLint dx = x + n - (GLint) ctx->DrawBuffer->Width; + if (x + n > bufWidth) { + GLint dx = x + n - bufWidth; n -= dx; } if (n <= 0) { @@ -1104,7 +1121,7 @@ _mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y, -/* +/** * Allocate a new stencil buffer. If there's an old one it will be * deallocated first. The new stencil buffer will be uninitialized. */ @@ -1118,8 +1135,8 @@ _mesa_alloc_stencil_buffer( GLframebuffer *buffer ) } /* allocate new stencil buffer */ - buffer->Stencil = (GLstencil *) MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height - * sizeof(GLstencil)); + buffer->Stencil = (GLstencil *) + MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height * sizeof(GLstencil)); if (!buffer->Stencil) { /* out of memory */ _mesa_error( NULL, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" ); @@ -1128,7 +1145,7 @@ _mesa_alloc_stencil_buffer( GLframebuffer *buffer ) -/* +/** * Clear the software (malloc'd) stencil buffer. */ static void @@ -1142,11 +1159,11 @@ clear_software_stencil_buffer( GLcontext *ctx ) if (ctx->Scissor.Enabled) { /* clear scissor region only */ const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; - if (ctx->Stencil.WriteMask != STENCIL_MAX) { + if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { /* must apply mask to the clear */ GLint y; for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) { - const GLstencil mask = ctx->Stencil.WriteMask; + const GLstencil mask = ctx->Stencil.WriteMask[0]; const GLstencil invMask = ~mask; const GLstencil clearVal = (ctx->Stencil.Clear & mask); GLstencil *stencil = STENCIL_ADDRESS( ctx->DrawBuffer->_Xmin, y ); @@ -1173,11 +1190,11 @@ clear_software_stencil_buffer( GLcontext *ctx ) } else { /* clear whole stencil buffer */ - if (ctx->Stencil.WriteMask != STENCIL_MAX) { + if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { /* must apply mask to the clear */ const GLuint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height; GLstencil *stencil = ctx->DrawBuffer->Stencil; - const GLstencil mask = ctx->Stencil.WriteMask; + const GLstencil mask = ctx->Stencil.WriteMask[0]; const GLstencil invMask = ~mask; const GLstencil clearVal = (ctx->Stencil.Clear & mask); GLuint i; @@ -1204,7 +1221,7 @@ clear_software_stencil_buffer( GLcontext *ctx ) -/* +/** * Clear the hardware (in graphics card) stencil buffer. * This is done with the Driver.WriteStencilSpan() and Driver.ReadStencilSpan() * functions. @@ -1224,11 +1241,11 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) /* clear scissor region only */ const GLint x = ctx->DrawBuffer->_Xmin; const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin; - if (ctx->Stencil.WriteMask != STENCIL_MAX) { + if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { /* must apply mask to the clear */ GLint y; for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) { - const GLstencil mask = ctx->Stencil.WriteMask; + const GLstencil mask = ctx->Stencil.WriteMask[0]; const GLstencil invMask = ~mask; const GLstencil clearVal = (ctx->Stencil.Clear & mask); GLstencil stencil[MAX_WIDTH]; @@ -1254,9 +1271,9 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) } else { /* clear whole stencil buffer */ - if (ctx->Stencil.WriteMask != STENCIL_MAX) { + if (ctx->Stencil.WriteMask[0] != STENCIL_MAX) { /* must apply mask to the clear */ - const GLstencil mask = ctx->Stencil.WriteMask; + const GLstencil mask = ctx->Stencil.WriteMask[0]; const GLstencil invMask = ~mask; const GLstencil clearVal = (ctx->Stencil.Clear & mask); const GLint width = ctx->DrawBuffer->Width; @@ -1292,8 +1309,8 @@ clear_hardware_stencil_buffer( GLcontext *ctx ) -/* - * Clear the stencil buffer. +/** + * Clear the stencil buffer (hardware or software). */ void _mesa_clear_stencil_buffer( GLcontext *ctx ) diff --git a/xc/extras/Mesa/src/swrast/s_stencil.h b/xc/extras/Mesa/src/swrast/s_stencil.h index 03e0de901..30b390e1b 100644 --- a/xc/extras/Mesa/src/swrast/s_stencil.h +++ b/xc/extras/Mesa/src/swrast/s_stencil.h @@ -1,8 +1,7 @@ -/* $Id: s_stencil.h,v 1.1.1.1 2002/10/22 13:06:41 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -33,14 +32,10 @@ #include "swrast.h" -extern GLboolean -_mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLdepth z[], GLubyte mask[] ); extern GLboolean -_mesa_stencil_and_ztest_pixels( GLcontext *ctx, GLuint n, - const GLint x[], const GLint y[], - const GLdepth z[], GLubyte mask[] ); +_mesa_stencil_and_ztest_span(GLcontext *ctx, struct sw_span *span); + extern void diff --git a/xc/extras/Mesa/src/swrast/s_texstore.c b/xc/extras/Mesa/src/swrast/s_texstore.c index 0ec021b70..1865b22e3 100644 --- a/xc/extras/Mesa/src/swrast/s_texstore.c +++ b/xc/extras/Mesa/src/swrast/s_texstore.c @@ -1,10 +1,9 @@ -/* $Id: s_texstore.c,v 1.1.1.1 2002/10/22 13:06:53 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -42,8 +41,8 @@ #include "context.h" #include "convolve.h" #include "image.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" @@ -73,8 +72,7 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, return NULL; /* Select buffer to read from */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, - ctx->Pixel.DriverReadBuffer ); + _swrast_use_read_buffer(ctx); RENDER_START(swrast,ctx); @@ -89,8 +87,7 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, RENDER_FINISH(swrast,ctx); /* Read from draw buffer (the default) */ - (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, - ctx->Color.DriverDrawBuffer ); + _swrast_use_draw_buffer(ctx); return image; } @@ -146,8 +143,8 @@ is_depth_format(GLenum format) */ void _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLint border ) + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLint border ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -194,7 +191,7 @@ _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -204,9 +201,9 @@ _swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, */ void _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border ) + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -253,7 +250,7 @@ _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -262,8 +259,8 @@ _swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, * Fallback for Driver.CopyTexSubImage1D(). */ void -_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width) +_swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, GLsizei width ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -277,55 +274,38 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, ASSERT(ctx->Driver.TexImage1D); - if (texImage->Format != GL_DEPTH_COMPONENT) { - /* read RGBA image from framebuffer */ - GLchan *image = read_color_image(ctx, x, y, width, 1); + if (texImage->Format == GL_DEPTH_COMPONENT) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, 1); if (!image) { - _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" ); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); return; } -#if 0 - /* - * XXX this is a bit of a hack. We need to be sure that the alpha - * channel is 1.0 if the internal texture format is not supposed to - * have an alpha channel. This is because some drivers may store - * RGB textures as RGBA and the texutil.c code isn't smart enough - * to set the alpha channel to 1.0 in this situation. - */ - if (texImage->Format == GL_LUMINANCE || - texImage->Format == GL_RGB) { - const GLuint n = width * 4; - GLuint i; - for (i = 0; i < n; i += 4) { - image[i + 3] = CHAN_MAX; - } - } -#endif - /* now call glTexSubImage1D to do the real work */ + /* call glTexSubImage1D to redefine the texture */ (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, - GL_RGBA, CHAN_TYPE, image, + GL_DEPTH_COMPONENT, GL_FLOAT, image, &_mesa_native_packing, texObj, texImage); FREE(image); } else { - /* read depth image from framebuffer */ - GLfloat *image = read_depth_image(ctx, x, y, width, 1); + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, 1); if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" ); return; } - /* call glTexSubImage1D to redefine the texture */ + /* now call glTexSubImage1D to do the real work */ (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width, - GL_DEPTH_COMPONENT, GL_FLOAT, image, + GL_RGBA, CHAN_TYPE, image, &_mesa_native_packing, texObj, texImage); FREE(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -335,9 +315,9 @@ _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, */ void _swrast_copy_texsubimage2d( GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height ) + GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -351,57 +331,40 @@ _swrast_copy_texsubimage2d( GLcontext *ctx, ASSERT(ctx->Driver.TexImage2D); - if (texImage->Format != GL_DEPTH_COMPONENT) { - /* read RGBA image from framebuffer */ - GLchan *image = read_color_image(ctx, x, y, width, height); + if (texImage->Format == GL_DEPTH_COMPONENT) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { - _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); return; } -#if 0 - /* - * XXX this is a bit of a hack. We need to be sure that the alpha - * channel is 1.0 if the internal texture format is not supposed to - * have an alpha channel. This is because some drivers may store - * RGB textures as RGBA and the texutil.c code isn't smart enough - * to set the alpha channel to 1.0 in this situation. - */ - if (texImage->Format == GL_LUMINANCE || - texImage->Format == GL_RGB) { - const GLuint n = width * height * 4; - GLuint i; - for (i = 0; i < n; i += 4) { - image[i + 3] = CHAN_MAX; - } - } -#endif - /* now call glTexSubImage2D to do the real work */ + /* call glTexImage1D to redefine the texture */ (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, width, height, - GL_RGBA, CHAN_TYPE, image, + GL_DEPTH_COMPONENT, GL_FLOAT, image, &_mesa_native_packing, texObj, texImage); FREE(image); } else { - /* read depth image from framebuffer */ - GLfloat *image = read_depth_image(ctx, x, y, width, height); + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, height); if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); return; } - /* call glTexImage1D to redefine the texture */ + /* now call glTexSubImage2D to do the real work */ (*ctx->Driver.TexSubImage2D)(ctx, target, level, xoffset, yoffset, width, height, - GL_DEPTH_COMPONENT, GL_FLOAT, image, + GL_RGBA, CHAN_TYPE, image, &_mesa_native_packing, texObj, texImage); FREE(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } @@ -411,9 +374,9 @@ _swrast_copy_texsubimage2d( GLcontext *ctx, */ void _swrast_copy_texsubimage3d( GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint x, GLint y, GLsizei width, GLsizei height ) + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height ) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -427,55 +390,39 @@ _swrast_copy_texsubimage3d( GLcontext *ctx, ASSERT(ctx->Driver.TexImage3D); - if (texImage->Format != GL_DEPTH_COMPONENT) { - /* read RGBA image from framebuffer */ - GLchan *image = read_color_image(ctx, x, y, width, height); + if (texImage->Format == GL_DEPTH_COMPONENT) { + /* read depth image from framebuffer */ + GLfloat *image = read_depth_image(ctx, x, y, width, height); if (!image) { - _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" ); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); return; } -#if 0 - /* - * XXX this is a bit of a hack. We need to be sure that the alpha - * channel is 1.0 if the internal texture format is not supposed to - * have an alpha channel. This is because some drivers may store - * RGB textures as RGBA and the texutil.c code isn't smart enough - * to set the alpha channel to 1.0 in this situation. - */ - if (texImage->Format == GL_LUMINANCE || - texImage->Format == GL_RGB) { - const GLuint n = width * height * 4; - GLuint i; - for (i = 0; i < n; i += 4) { - image[i + 3] = CHAN_MAX; - } - } -#endif - /* now call glTexSubImage3D to do the real work */ + + /* call glTexImage1D to redefine the texture */ (*ctx->Driver.TexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, width, height, 1, - GL_RGBA, CHAN_TYPE, image, + GL_DEPTH_COMPONENT, GL_FLOAT, image, &_mesa_native_packing, texObj, texImage); FREE(image); } else { - /* read depth image from framebuffer */ - GLfloat *image = read_depth_image(ctx, x, y, width, height); + /* read RGBA image from framebuffer */ + GLchan *image = read_color_image(ctx, x, y, width, height); if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); + _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" ); return; } - /* call glTexImage1D to redefine the texture */ + /* now call glTexSubImage3D to do the real work */ (*ctx->Driver.TexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, width, height, 1, - GL_DEPTH_COMPONENT, GL_FLOAT, image, + GL_RGBA, CHAN_TYPE, image, &_mesa_native_packing, texObj, texImage); FREE(image); } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, texUnit, texObj); + _mesa_generate_mipmap(ctx, target, texUnit, texObj); } } diff --git a/xc/extras/Mesa/src/swrast/s_texture.c b/xc/extras/Mesa/src/swrast/s_texture.c index 66672a94f..5286601f8 100644 --- a/xc/extras/Mesa/src/swrast/s_texture.c +++ b/xc/extras/Mesa/src/swrast/s_texture.c @@ -1,8 +1,6 @@ -/* $Id: s_texture.c,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ - /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 5.0 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -30,12 +28,11 @@ #include "colormac.h" #include "macros.h" #include "mmath.h" -#include "mem.h" +#include "imports.h" #include "texformat.h" #include "teximage.h" #include "s_context.h" -#include "s_pb.h" #include "s_texture.h" @@ -50,7 +47,7 @@ /* * Used to compute texel locations for linear sampling. * Input: - * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER_ARB + * wrapMode = GL_REPEAT, GL_CLAMP, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_BORDER * S = texcoord in [0,1] * SIZE = width (or height or depth) of texture * Output: @@ -79,7 +76,7 @@ if (I1 >= (GLint) SIZE) \ I1 = SIZE - 1; \ } \ - else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \ + else if (wrapMode == GL_CLAMP_TO_BORDER) { \ const GLfloat min = -1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ if (S <= min) \ @@ -92,12 +89,37 @@ I0 = IFLOOR(U); \ I1 = I0 + 1; \ } \ - else if (wrapMode == GL_MIRRORED_REPEAT_ARB) { \ + else if (wrapMode == GL_MIRRORED_REPEAT) { \ const GLint flr = IFLOOR(S); \ if (flr & 1) \ U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ else \ U = S - (GLfloat) flr; /* flr is even */ \ + U = (U * SIZE) - 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + if (I0 < 0) \ + I0 = 0; \ + if (I1 >= (GLint) SIZE) \ + I1 = SIZE - 1; \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \ + U = (GLfloat) fabs(S); \ + if (U >= 1.0F) \ + U = (GLfloat) SIZE; \ + else \ + U *= SIZE; \ + U -= 0.5F; \ + I0 = IFLOOR(U); \ + I1 = I0 + 1; \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \ + U = (GLfloat) fabs(S); \ + if (U >= 1.0F) \ + U = (GLfloat) SIZE; \ + else \ + U *= SIZE; \ + U -= 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ if (I0 < 0) \ @@ -143,7 +165,7 @@ else \ I = IFLOOR(S * SIZE); \ } \ - else if (wrapMode == GL_CLAMP_TO_BORDER_ARB) { \ + else if (wrapMode == GL_CLAMP_TO_BORDER) { \ /* s limited to [min,max] */ \ /* i limited to [-1, size] */ \ const GLfloat min = -1.0F / (2.0F * SIZE); \ @@ -155,7 +177,7 @@ else \ I = IFLOOR(S * SIZE); \ } \ - else if (wrapMode == GL_MIRRORED_REPEAT_ARB) { \ + else if (wrapMode == GL_MIRRORED_REPEAT) { \ const GLfloat min = 1.0F / (2.0F * SIZE); \ const GLfloat max = 1.0F - min; \ const GLint flr = IFLOOR(S); \ @@ -171,6 +193,30 @@ else \ I = IFLOOR(u * SIZE); \ } \ + else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \ + /* s limited to [0,1] */ \ + /* i limited to [0,size-1] */ \ + const GLfloat u = (GLfloat) fabs(S); \ + if (u <= 0.0F) \ + I = 0; \ + else if (u >= 1.0F) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(u * SIZE); \ + } \ + else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \ + /* s limited to [min,max] */ \ + /* i limited to [0, size-1] */ \ + const GLfloat min = 1.0F / (2.0F * SIZE); \ + const GLfloat max = 1.0F - min; \ + const GLfloat u = (GLfloat) fabs(S); \ + if (u < min) \ + I = 0; \ + else if (u > max) \ + I = SIZE - 1; \ + else \ + I = IFLOOR(u * SIZE); \ + } \ else { \ ASSERT(wrapMode == GL_CLAMP); \ /* s limited to [0,1] */ \ @@ -185,16 +231,25 @@ } +#define COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(S, U, SIZE, I0, I1) \ +{ \ + U = S * SIZE - 0.5F; \ + I0 = IFLOOR(U) & (SIZE - 1); \ + I1 = (I0 + 1) & (SIZE - 1); \ +} + + /* * Compute linear mipmap levels for given lambda. */ #define COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level) \ { \ if (lambda < 0.0F) \ - lambda = 0.0F; \ + level = tObj->BaseLevel; \ else if (lambda > tObj->_MaxLambda) \ - lambda = tObj->_MaxLambda; \ - level = (GLint) (tObj->BaseLevel + lambda); \ + level = (GLint) (tObj->BaseLevel + tObj->_MaxLambda); \ + else \ + level = (GLint) (tObj->BaseLevel + lambda); \ } @@ -203,11 +258,14 @@ */ #define COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level) \ { \ + GLfloat l; \ if (lambda <= 0.5F) \ - lambda = 0.0F; \ + l = 0.0F; \ else if (lambda > tObj->_MaxLambda + 0.4999F) \ - lambda = tObj->_MaxLambda + 0.4999F; \ - level = (GLint) (tObj->BaseLevel + lambda + 0.5F); \ + l = tObj->_MaxLambda + 0.4999F; \ + else \ + l = lambda; \ + level = (GLint) (tObj->BaseLevel + l + 0.5F); \ if (level > tObj->_MaxLevel) \ level = tObj->_MaxLevel; \ } @@ -236,7 +294,6 @@ #define K1BIT 32 - /* * Get texture palette entry. */ @@ -288,6 +345,100 @@ palette_sample(const GLcontext *ctx, } +/* + * The lambda[] array values are always monotonic. Either the whole span + * will be minified, magnified, or split between the two. This function + * determines the subranges in [0, n-1] that are to be minified or magnified. + */ +static INLINE void +compute_min_mag_ranges( GLfloat minMagThresh, GLuint n, const GLfloat lambda[], + GLuint *minStart, GLuint *minEnd, + GLuint *magStart, GLuint *magEnd ) +{ + ASSERT(lambda != NULL); +#if 0 + /* Verify that lambda[] is monotonous. + * We can't really use this because the inaccuracy in the LOG2 function + * causes this test to fail, yet the resulting texturing is correct. + */ + if (n > 1) { + GLuint i; + printf("lambda delta = %g\n", lambda[0] - lambda[n-1]); + if (lambda[0] >= lambda[n-1]) { /* decreasing */ + for (i = 0; i < n - 1; i++) { + ASSERT((GLint) (lambda[i] * 10) >= (GLint) (lambda[i+1] * 10)); + } + } + else { /* increasing */ + for (i = 0; i < n - 1; i++) { + ASSERT((GLint) (lambda[i] * 10) <= (GLint) (lambda[i+1] * 10)); + } + } + } +#endif /* DEBUG */ + + /* since lambda is monotonous-array use this check first */ + if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) { + /* magnification for whole span */ + *magStart = 0; + *magEnd = n; + *minStart = *minEnd = 0; + } + else if (lambda[0] > minMagThresh && lambda[n-1] > minMagThresh) { + /* minification for whole span */ + *minStart = 0; + *minEnd = n; + *magStart = *magEnd = 0; + } + else { + /* a mix of minification and magnification */ + GLuint i; + if (lambda[0] > minMagThresh) { + /* start with minification */ + for (i = 1; i < n; i++) { + if (lambda[i] <= minMagThresh) + break; + } + *minStart = 0; + *minEnd = i; + *magStart = i; + *magEnd = n; + } + else { + /* start with magnification */ + for (i = 1; i < n; i++) { + if (lambda[i] > minMagThresh) + break; + } + *magStart = 0; + *magEnd = i; + *minStart = i; + *minEnd = n; + } + } + +#if 0 + /* Verify the min/mag Start/End values + * We don't use this either (see above) + */ + { + GLint i; + for (i = 0; i < n; i++) { + if (lambda[i] > minMagThresh) { + /* minification */ + ASSERT(i >= *minStart); + ASSERT(i < *minEnd); + } + else { + /* magnification */ + ASSERT(i >= *magStart); + ASSERT(i < *magEnd); + } + } + } +#endif +} + /**********************************************************************/ /* 1-D Texture Sampling Functions */ @@ -300,19 +451,19 @@ static void sample_1d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - GLfloat s, GLchan rgba[4]) + const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ GLint i; - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); /* skip over the border, if any */ i += img->Border; if (i < 0 || i >= (GLint) img->Width) { - /* Need this test for GL_CLAMP_TO_BORDER_ARB mode */ - COPY_CHAN4(rgba, tObj->BorderColor); + /* Need this test for GL_CLAMP_TO_BORDER mode */ + COPY_CHAN4(rgba, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i, 0, 0, (GLvoid *) rgba); @@ -331,14 +482,14 @@ static void sample_1d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - GLfloat s, GLchan rgba[4]) + const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; GLint i0, i1; GLfloat u; GLuint useBorderColor; - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); useBorderColor = 0; if (img->Border) { @@ -364,7 +515,7 @@ sample_1d_linear(GLcontext *ctx, GLchan t0[4], t1[4]; /* texels */ if (useBorderColor & I0BIT) { - COPY_CHAN4(t0, tObj->BorderColor); + COPY_CHAN4(t0, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, 0, 0, (GLvoid *) t0); @@ -373,7 +524,7 @@ sample_1d_linear(GLcontext *ctx, } } if (useBorderColor & I1BIT) { - COPY_CHAN4(t1, tObj->BorderColor); + COPY_CHAN4(t1, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, 0, 0, (GLvoid *) t1); @@ -406,24 +557,32 @@ sample_1d_linear(GLcontext *ctx, static void sample_1d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - sample_1d_nearest(ctx, tObj, tObj->Image[level], s, rgba); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_1d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + } } static void sample_1d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - sample_1d_linear(ctx, tObj, tObj->Image[level], s, rgba); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_1d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + } } @@ -432,34 +591,37 @@ sample_1d_linear_mipmap_nearest(GLcontext *ctx, * This is really just needed in order to prevent warnings with some compilers. */ #if CHAN_TYPE == GL_FLOAT -#define INTCAST +#define CHAN_CAST #else -#define INTCAST (GLint) +#define CHAN_CAST (GLchan) (GLint) #endif static void sample_1d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - if (level >= tObj->_MaxLevel) { - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, rgba); - } - else { - GLchan t0[4], t1[4]; - const GLfloat f = FRAC(lambda); - sample_1d_nearest(ctx, tObj, tObj->Image[level ], s, t0); - sample_1d_nearest(ctx, tObj, tObj->Image[level+1], s, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_1d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; + const GLfloat f = FRAC(lambda[i]); + sample_1d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_1d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } @@ -468,25 +630,28 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx, static void sample_1d_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - if (level >= tObj->_MaxLevel) { - sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, rgba); - } - else { - GLchan t0[4], t1[4]; - const GLfloat f = FRAC(lambda); - sample_1d_linear(ctx, tObj, tObj->Image[level ], s, t0); - sample_1d_linear(ctx, tObj, tObj->Image[level+1], s, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_1d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; + const GLfloat f = FRAC(lambda[i]); + sample_1d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_1d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } @@ -495,17 +660,14 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx, static void sample_nearest_1d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; - (void) t; - (void) u; (void) lambda; for (i=0;i<n;i++) { - sample_1d_nearest(ctx, tObj, image, s[i], rgba[i]); + sample_1d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); } } @@ -514,17 +676,14 @@ sample_nearest_1d( GLcontext *ctx, GLuint texUnit, static void sample_linear_1d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; - (void) t; - (void) u; (void) lambda; for (i=0;i<n;i++) { - sample_1d_linear(ctx, tObj, image, s[i], rgba[i]); + sample_1d_linear(ctx, tObj, image, texcoords[i], rgba[i]); } } @@ -537,71 +696,74 @@ sample_linear_1d( GLcontext *ctx, GLuint texUnit, static void sample_lambda_1d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { - GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; + GLuint minStart, minEnd; /* texels with minification */ + GLuint magStart, magEnd; /* texels with magnification */ GLuint i; - (void) t; - (void) u; + ASSERT(lambda != NULL); + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); - for (i=0;i<n;i++) { - if (lambda[i] > MinMagThresh) { - /* minification */ - switch (tObj->MinFilter) { - case GL_NEAREST: - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], rgba[i]); - break; - case GL_LINEAR: - sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], rgba[i]); - break; - case GL_NEAREST_MIPMAP_NEAREST: - sample_1d_nearest_mipmap_nearest(ctx, tObj, lambda[i], s[i], - rgba[i]); - break; - case GL_LINEAR_MIPMAP_NEAREST: - sample_1d_linear_mipmap_nearest(ctx, tObj, s[i], lambda[i], - rgba[i]); - break; - case GL_NEAREST_MIPMAP_LINEAR: - sample_1d_nearest_mipmap_linear(ctx, tObj, s[i], lambda[i], - rgba[i]); - break; - case GL_LINEAR_MIPMAP_LINEAR: - sample_1d_linear_mipmap_linear(ctx, tObj, s[i], lambda[i], - rgba[i]); - break; - default: - _mesa_problem(NULL, "Bad min filter in sample_1d_texture"); - return; - } + if (minStart < minEnd) { + /* do the minified texels */ + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + for (i = minStart; i < minEnd; i++) + sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = minStart; i < minEnd; i++) + sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_1d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_1d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_1d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + sample_1d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_1d_texture"); + return; } - else { - /* magnification */ - switch (tObj->MagFilter) { - case GL_NEAREST: - sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], rgba[i]); - break; - case GL_LINEAR: - sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], rgba[i]); - break; - default: - _mesa_problem(NULL, "Bad mag filter in sample_1d_texture"); - return; - } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + switch (tObj->MagFilter) { + case GL_NEAREST: + for (i = magStart; i < magEnd; i++) + sample_1d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = magStart; i < magEnd; i++) + sample_1d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_1d_texture"); + return; } } } - - /**********************************************************************/ /* 2-D Texture Sampling Functions */ /**********************************************************************/ @@ -610,27 +772,27 @@ sample_lambda_1d( GLcontext *ctx, GLuint texUnit, /* * Return the texture sample for coordinate (s,t) using GL_NEAREST filter. */ -static void +static INLINE void sample_2d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - GLfloat s, GLfloat t, + const GLfloat texcoord[4], GLchan rgba[]) { const GLint width = img->Width2; /* without border, power of two */ const GLint height = img->Height2; /* without border, power of two */ GLint i, j; - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i); - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); /* skip over the border, if any */ i += img->Border; j += img->Border; if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) { - /* Need this test for GL_CLAMP_TO_BORDER_ARB mode */ - COPY_CHAN4(rgba, tObj->BorderColor); + /* Need this test for GL_CLAMP_TO_BORDER mode */ + COPY_CHAN4(rgba, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i, j, 0, (GLvoid *) rgba); @@ -646,11 +808,11 @@ sample_2d_nearest(GLcontext *ctx, * Return the texture sample for coordinate (s,t) using GL_LINEAR filter. * New sampling code contributed by Lynn Quam <quam@ai.sri.com>. */ -static void +static INLINE void sample_2d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - GLfloat s, GLfloat t, + const GLfloat texcoord[4], GLchan rgba[]) { const GLint width = img->Width2; @@ -659,8 +821,8 @@ sample_2d_linear(GLcontext *ctx, GLuint useBorderColor; GLfloat u, v; - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1); - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, t, v, height, j0, j1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); useBorderColor = 0; if (img->Border) { @@ -698,7 +860,7 @@ sample_2d_linear(GLcontext *ctx, GLchan t11[4]; if (useBorderColor & (I0BIT | J0BIT)) { - COPY_CHAN4(t00, tObj->BorderColor); + COPY_CHAN4(t00, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00); @@ -707,7 +869,7 @@ sample_2d_linear(GLcontext *ctx, } } if (useBorderColor & (I1BIT | J0BIT)) { - COPY_CHAN4(t10, tObj->BorderColor); + COPY_CHAN4(t10, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10); @@ -716,7 +878,7 @@ sample_2d_linear(GLcontext *ctx, } } if (useBorderColor & (I0BIT | J1BIT)) { - COPY_CHAN4(t01, tObj->BorderColor); + COPY_CHAN4(t01, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01); @@ -725,7 +887,7 @@ sample_2d_linear(GLcontext *ctx, } } if (useBorderColor & (I1BIT | J1BIT)) { - COPY_CHAN4(t11, tObj->BorderColor); + COPY_CHAN4(t11, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11); @@ -763,16 +925,99 @@ sample_2d_linear(GLcontext *ctx, } +/* + * As above, but we know WRAP_S == REPEAT and WRAP_T == REPEAT + * and we're not using a paletted texture. + */ +static INLINE void +sample_2d_linear_repeat(GLcontext *ctx, + const struct gl_texture_object *tObj, + const struct gl_texture_image *img, + const GLfloat texcoord[4], + GLchan rgba[]) +{ + const GLint width = img->Width2; + const GLint height = img->Height2; + GLint i0, j0, i1, j1; + GLfloat u, v; + + ASSERT(tObj->WrapS == GL_REPEAT); + ASSERT(tObj->WrapT == GL_REPEAT); + ASSERT(img->Border == 0); + ASSERT(img->Format != GL_COLOR_INDEX); + + COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[0], u, width, i0, i1); + COMPUTE_LINEAR_REPEAT_TEXEL_LOCATION(texcoord[1], v, height, j0, j1); + + { + const GLfloat a = FRAC(u); + const GLfloat b = FRAC(v); + +#if CHAN_TYPE == GL_FLOAT || CHAN_TYPE == GL_UNSIGNED_SHORT + const GLfloat w00 = (1.0F-a) * (1.0F-b); + const GLfloat w10 = a * (1.0F-b); + const GLfloat w01 = (1.0F-a) * b ; + const GLfloat w11 = a * b ; +#else /* CHAN_BITS == 8 */ + /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ + const GLint w00 = IROUND_POS((1.0F-a) * (1.0F-b) * WEIGHT_SCALE); + const GLint w10 = IROUND_POS( a * (1.0F-b) * WEIGHT_SCALE); + const GLint w01 = IROUND_POS((1.0F-a) * b * WEIGHT_SCALE); + const GLint w11 = IROUND_POS( a * b * WEIGHT_SCALE); +#endif + GLchan t00[4]; + GLchan t10[4]; + GLchan t01[4]; + GLchan t11[4]; + + (*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00); + (*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10); + (*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01); + (*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11); + +#if CHAN_TYPE == GL_FLOAT + rgba[0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]; + rgba[1] = w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]; + rgba[2] = w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]; + rgba[3] = w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]; +#elif CHAN_TYPE == GL_UNSIGNED_SHORT + rgba[0] = (GLchan) (w00 * t00[0] + w10 * t10[0] + + w01 * t01[0] + w11 * t11[0] + 0.5); + rgba[1] = (GLchan) (w00 * t00[1] + w10 * t10[1] + + w01 * t01[1] + w11 * t11[1] + 0.5); + rgba[2] = (GLchan) (w00 * t00[2] + w10 * t10[2] + + w01 * t01[2] + w11 * t11[2] + 0.5); + rgba[3] = (GLchan) (w00 * t00[3] + w10 * t10[3] + + w01 * t01[3] + w11 * t11[3] + 0.5); +#else /* CHAN_BITS == 8 */ + rgba[0] = (GLchan) ((w00 * t00[0] + w10 * t10[0] + + w01 * t01[0] + w11 * t11[0]) >> WEIGHT_SHIFT); + rgba[1] = (GLchan) ((w00 * t00[1] + w10 * t10[1] + + w01 * t01[1] + w11 * t11[1]) >> WEIGHT_SHIFT); + rgba[2] = (GLchan) ((w00 * t00[2] + w10 * t10[2] + + w01 * t01[2] + w11 * t11[2]) >> WEIGHT_SHIFT); + rgba[3] = (GLchan) ((w00 * t00[3] + w10 * t10[3] + + w01 * t01[3] + w11 * t11[3]) >> WEIGHT_SHIFT); +#endif + + } + +} + + static void sample_2d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - sample_2d_nearest(ctx, tObj, tObj->Image[level], s, t, rgba); + GLuint i; + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_2d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + } } @@ -780,12 +1025,16 @@ sample_2d_nearest_mipmap_nearest(GLcontext *ctx, static void sample_2d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - sample_2d_linear(ctx, tObj, tObj->Image[level], s, t, rgba); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_2d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + } } @@ -793,70 +1042,105 @@ sample_2d_linear_mipmap_nearest(GLcontext *ctx, static void sample_2d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat lambda, - GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - if (level >= tObj->_MaxLevel) { - sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, t, rgba); - } - else { - GLchan t0[4], t1[4]; /* texels */ - const GLfloat f = FRAC(lambda); - sample_2d_nearest(ctx, tObj, tObj->Image[level ], s, t, t0); - sample_2d_nearest(ctx, tObj, tObj->Image[level+1], s, t, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_2d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_2d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } +/* Trilinear filtering */ static void -sample_2d_linear_mipmap_linear(GLcontext *ctx, - const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat lambda, - GLchan rgba[4]) +sample_2d_linear_mipmap_linear( GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { - GLint level; + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_2d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } + } +} - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - if (level >= tObj->_MaxLevel) { - sample_2d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, t, rgba); - } - else { - GLchan t0[4], t1[4]; /* texels */ - const GLfloat f = FRAC(lambda); - sample_2d_linear(ctx, tObj, tObj->Image[level ], s, t, t0); - sample_2d_linear(ctx, tObj, tObj->Image[level+1], s, t, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); +static void +sample_2d_linear_mipmap_linear_repeat( GLcontext *ctx, + const struct gl_texture_object *tObj, + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4] ) +{ + GLuint i; + ASSERT(lambda != NULL); + ASSERT(tObj->WrapS == GL_REPEAT); + ASSERT(tObj->WrapT == GL_REPEAT); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_2d_linear_repeat(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_2d_linear_repeat(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } - static void sample_nearest_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; - (void) u; (void) lambda; for (i=0;i<n;i++) { - sample_2d_nearest(ctx, tObj, image, s[i], t[i], rgba[i]); + sample_2d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); } } @@ -865,16 +1149,14 @@ sample_nearest_2d( GLcontext *ctx, GLuint texUnit, static void sample_linear_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; - (void) u; (void) lambda; for (i=0;i<n;i++) { - sample_2d_linear(ctx, tObj, image, s[i], t[i], rgba[i]); + sample_2d_linear(ctx, tObj, image, texcoords[i], rgba[i]); } } @@ -883,15 +1165,15 @@ sample_linear_2d( GLcontext *ctx, GLuint texUnit, * Optimized 2-D texture sampling: * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter - * No border + * No border, + * RowStride == Width, * Format = GL_RGB */ static void opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLuint n, const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLuint n, GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; @@ -900,7 +1182,6 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, const GLint rowMask = img->Height - 1; const GLint shift = img->WidthLog2; GLuint k; - (void) u; (void) lambda; ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); @@ -908,8 +1189,8 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, ASSERT(img->Format==GL_RGB); for (k=0; k<n; k++) { - GLint i = IFLOOR(s[k] * width) & colMask; - GLint j = IFLOOR(t[k] * height) & rowMask; + GLint i = IFLOOR(texcoords[k][0] * width) & colMask; + GLint j = IFLOOR(texcoords[k][1] * height) & rowMask; GLint pos = (j << shift) | i; GLchan *texel = ((GLchan *) img->Data) + 3*pos; rgba[k][RCOMP] = texel[0]; @@ -924,14 +1205,14 @@ opt_sample_rgb_2d( GLcontext *ctx, GLuint texUnit, * S and T wrap mode == GL_REPEAT * GL_NEAREST min/mag filter * No border + * RowStride == Width, * Format = GL_RGBA */ static void opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLuint n, const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLuint n, GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; const GLfloat width = (GLfloat) img->Width; @@ -940,7 +1221,6 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, const GLint rowMask = img->Height - 1; const GLint shift = img->WidthLog2; GLuint i; - (void) u; (void) lambda; ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); @@ -948,8 +1228,8 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, ASSERT(img->Format==GL_RGBA); for (i = 0; i < n; i++) { - const GLint col = IFLOOR(s[i] * width) & colMask; - const GLint row = IFLOOR(t[i] * height) & rowMask; + const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; + const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ COPY_CHAN4(rgba[i], texel); @@ -958,105 +1238,115 @@ opt_sample_rgba_2d( GLcontext *ctx, GLuint texUnit, /* - * Given an array of (s,t) texture coordinate and lambda (level of detail) + * Given an array of texture coordinate and lambda (level of detail) * values, return an array of texture sample. */ static void sample_lambda_2d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLuint n, GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { - const GLfloat minMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; - GLuint i; - (void) u; - - /* since lambda is monotonous-array use this check first */ - if (lambda[0] <= minMagThresh && lambda[n-1] <= minMagThresh) { - /* magnification for whole span */ - const struct gl_texture_image *img = tObj->Image[tObj->BaseLevel]; - switch (tObj->MagFilter) { + const struct gl_texture_image *tImg = tObj->Image[tObj->BaseLevel]; + GLuint minStart, minEnd; /* texels with minification */ + GLuint magStart, magEnd; /* texels with magnification */ + + const GLboolean repeatNoBorder = (tObj->WrapS == GL_REPEAT) + && (tObj->WrapT == GL_REPEAT) + && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) + && (tImg->Format != GL_COLOR_INDEX); + + ASSERT(lambda != NULL); + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + /* do the minified texels */ + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { case GL_NEAREST: - if (tObj->WrapS == GL_REPEAT && tObj->WrapT == GL_REPEAT && - img->Border == 0) { - switch (img->Format) { + if (repeatNoBorder) { + switch (tImg->Format) { case GL_RGB: - opt_sample_rgb_2d(ctx, texUnit, tObj, n, s, t, NULL, - NULL, rgba); + opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); break; case GL_RGBA: - opt_sample_rgba_2d(ctx, texUnit, tObj, n, s, t, NULL, - NULL, rgba); + opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); break; default: - sample_nearest_2d(ctx, texUnit, tObj, n, s, t, NULL, - NULL, rgba); + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart ); } } else { - sample_nearest_2d(ctx, texUnit, tObj, n, s, t, NULL, - NULL, rgba); + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); } break; case GL_LINEAR: - sample_linear_2d(ctx, texUnit, tObj, n, s, t, NULL, - NULL, rgba); + sample_linear_2d(ctx, texUnit, tObj, m, texcoords + minStart, + NULL, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_2d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_2d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_2d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + if (repeatNoBorder) + sample_2d_linear_mipmap_linear_repeat(ctx, tObj, m, + texcoords + minStart, lambda + minStart, rgba + minStart); + else + sample_2d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); break; default: - _mesa_problem(NULL, "Bad mag filter in sample_lambda_2d"); + _mesa_problem(ctx, "Bad min filter in sample_2d_texture"); + return; } } - else { - for (i = 0; i < n; i++) { - if (lambda[i] > minMagThresh) { - /* minification */ - switch (tObj->MinFilter) { - case GL_NEAREST: - sample_2d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], rgba[i]); - break; - case GL_LINEAR: - sample_2d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], rgba[i]); - break; - case GL_NEAREST_MIPMAP_NEAREST: - sample_2d_nearest_mipmap_nearest(ctx, tObj, s[i], t[i], - lambda[i], rgba[i]); - break; - case GL_LINEAR_MIPMAP_NEAREST: - sample_2d_linear_mipmap_nearest(ctx,tObj, s[i], t[i], - lambda[i], rgba[i]); - break; - case GL_NEAREST_MIPMAP_LINEAR: - sample_2d_nearest_mipmap_linear(ctx,tObj, s[i], t[i], - lambda[i], rgba[i]); - break; - case GL_LINEAR_MIPMAP_LINEAR: - sample_2d_linear_mipmap_linear(ctx,tObj, s[i], t[i], - lambda[i], rgba[i] ); - break; - default: - _mesa_problem(NULL, "Bad min filter in sample_2d_texture"); - return; + + if (magStart < magEnd) { + /* do the magnified texels */ + const GLuint m = magEnd - magStart; + + switch (tObj->MagFilter) { + case GL_NEAREST: + if (repeatNoBorder) { + switch (tImg->Format) { + case GL_RGB: + opt_sample_rgb_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + break; + case GL_RGBA: + opt_sample_rgba_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + break; + default: + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart ); } } else { - /* magnification */ - switch (tObj->MagFilter) { - case GL_NEAREST: - sample_2d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], rgba[i]); - break; - case GL_LINEAR: - sample_2d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], rgba[i] ); - break; - default: - _mesa_problem(NULL, "Bad mag filter in sample_2d_texture"); - } + sample_nearest_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); } + break; + case GL_LINEAR: + sample_linear_2d(ctx, texUnit, tObj, m, texcoords + magStart, + NULL, rgba + magStart); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_lambda_2d"); } } } @@ -1074,7 +1364,7 @@ static void sample_3d_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - GLfloat s, GLfloat t, GLfloat r, + const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; /* without border, power of two */ @@ -1082,15 +1372,15 @@ sample_3d_nearest(GLcontext *ctx, const GLint depth = img->Depth2; /* without border, power of two */ GLint i, j, k; - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, s, width, i); - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j); - COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, r, depth, k); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoord[0], width, i); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoord[1], height, j); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, texcoord[2], depth, k); if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height || k < 0 || k >= (GLint) img->Depth) { - /* Need this test for GL_CLAMP_TO_BORDER_ARB mode */ - COPY_CHAN4(rgba, tObj->BorderColor); + /* Need this test for GL_CLAMP_TO_BORDER mode */ + COPY_CHAN4(rgba, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i, j, k, (GLvoid *) rgba); @@ -1109,7 +1399,7 @@ static void sample_3d_linear(GLcontext *ctx, const struct gl_texture_object *tObj, const struct gl_texture_image *img, - GLfloat s, GLfloat t, GLfloat r, + const GLfloat texcoord[4], GLchan rgba[4]) { const GLint width = img->Width2; @@ -1119,9 +1409,9 @@ sample_3d_linear(GLcontext *ctx, GLuint useBorderColor; GLfloat u, v, w; - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, s, u, width, i0, i1); - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, t, v, height, j0, j1); - COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, r, w, depth, k0, k1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoord[0], u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoord[1], v, height, j0, j1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapR, texcoord[2], w, depth, k0, k1); useBorderColor = 0; if (img->Border) { @@ -1173,7 +1463,7 @@ sample_3d_linear(GLcontext *ctx, GLchan t100[4], t110[4], t101[4], t111[4]; if (useBorderColor & (I0BIT | J0BIT | K0BIT)) { - COPY_CHAN4(t000, tObj->BorderColor); + COPY_CHAN4(t000, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, j0, k0, (GLvoid *) t000); @@ -1182,7 +1472,7 @@ sample_3d_linear(GLcontext *ctx, } } if (useBorderColor & (I1BIT | J0BIT | K0BIT)) { - COPY_CHAN4(t100, tObj->BorderColor); + COPY_CHAN4(t100, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, j0, k0, (GLvoid *) t100); @@ -1191,7 +1481,7 @@ sample_3d_linear(GLcontext *ctx, } } if (useBorderColor & (I0BIT | J1BIT | K0BIT)) { - COPY_CHAN4(t010, tObj->BorderColor); + COPY_CHAN4(t010, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, j1, k0, (GLvoid *) t010); @@ -1200,7 +1490,7 @@ sample_3d_linear(GLcontext *ctx, } } if (useBorderColor & (I1BIT | J1BIT | K0BIT)) { - COPY_CHAN4(t110, tObj->BorderColor); + COPY_CHAN4(t110, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, j1, k0, (GLvoid *) t110); @@ -1210,7 +1500,7 @@ sample_3d_linear(GLcontext *ctx, } if (useBorderColor & (I0BIT | J0BIT | K1BIT)) { - COPY_CHAN4(t001, tObj->BorderColor); + COPY_CHAN4(t001, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, j0, k1, (GLvoid *) t001); @@ -1219,7 +1509,7 @@ sample_3d_linear(GLcontext *ctx, } } if (useBorderColor & (I1BIT | J0BIT | K1BIT)) { - COPY_CHAN4(t101, tObj->BorderColor); + COPY_CHAN4(t101, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, j0, k1, (GLvoid *) t101); @@ -1228,7 +1518,7 @@ sample_3d_linear(GLcontext *ctx, } } if (useBorderColor & (I0BIT | J1BIT | K1BIT)) { - COPY_CHAN4(t011, tObj->BorderColor); + COPY_CHAN4(t011, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i0, j1, k1, (GLvoid *) t011); @@ -1237,7 +1527,7 @@ sample_3d_linear(GLcontext *ctx, } } if (useBorderColor & (I1BIT | J1BIT | K1BIT)) { - COPY_CHAN4(t111, tObj->BorderColor); + COPY_CHAN4(t111, tObj->_BorderChan); } else { (*img->FetchTexel)(img, i1, j1, k1, (GLvoid *) t111); @@ -1299,50 +1589,59 @@ sample_3d_linear(GLcontext *ctx, static void sample_3d_nearest_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat r, - GLfloat lambda, GLchan rgba[4] ) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { - GLint level; - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - sample_3d_nearest(ctx, tObj, tObj->Image[level], s, t, r, rgba); + GLuint i; + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_3d_nearest(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + } } static void sample_3d_linear_mipmap_nearest(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat r, - GLfloat lambda, GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - sample_3d_linear(ctx, tObj, tObj->Image[level], s, t, r, rgba); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + sample_3d_linear(ctx, tObj, tObj->Image[level], texcoord[i], rgba[i]); + } } static void sample_3d_nearest_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat r, - GLfloat lambda, GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - if (level >= tObj->_MaxLevel) { - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], - s, t, r, rgba); - } - else { - GLchan t0[4], t1[4]; /* texels */ - const GLfloat f = FRAC(lambda); - sample_3d_nearest(ctx, tObj, tObj->Image[level ], s, t, r, t0); - sample_3d_nearest(ctx, tObj, tObj->Image[level+1], s, t, r, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_3d_nearest(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_3d_nearest(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_3d_nearest(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } @@ -1350,25 +1649,28 @@ sample_3d_nearest_mipmap_linear(GLcontext *ctx, static void sample_3d_linear_mipmap_linear(GLcontext *ctx, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat r, - GLfloat lambda, GLchan rgba[4] ) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - if (level >= tObj->_MaxLevel) { - sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], s, t, r, rgba); - } - else { - GLchan t0[4], t1[4]; /* texels */ - const GLfloat f = FRAC(lambda); - sample_3d_linear(ctx, tObj, tObj->Image[level ], s, t, r, t0); - sample_3d_linear(ctx, tObj, tObj->Image[level+1], s, t, r, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + if (level >= tObj->_MaxLevel) { + sample_3d_linear(ctx, tObj, tObj->Image[tObj->_MaxLevel], + texcoord[i], rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_3d_linear(ctx, tObj, tObj->Image[level ], texcoord[i], t0); + sample_3d_linear(ctx, tObj, tObj->Image[level+1], texcoord[i], t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } @@ -1376,15 +1678,14 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx, static void sample_nearest_3d(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { - sample_3d_nearest(ctx, tObj, image, s[i], t[i], u[i], rgba[i]); + sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]); } } @@ -1393,15 +1694,14 @@ sample_nearest_3d(GLcontext *ctx, GLuint texUnit, static void sample_linear_3d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4] ) + GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4] ) { GLuint i; struct gl_texture_image *image = tObj->Image[tObj->BaseLevel]; (void) lambda; for (i=0;i<n;i++) { - sample_3d_linear(ctx, tObj, image, s[i], t[i], u[i], rgba[i]); + sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]); } } @@ -1413,60 +1713,69 @@ sample_linear_3d( GLcontext *ctx, GLuint texUnit, static void sample_lambda_3d( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4] ) { + GLuint minStart, minEnd; /* texels with minification */ + GLuint magStart, magEnd; /* texels with magnification */ GLuint i; - GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; - for (i=0;i<n;i++) { + ASSERT(lambda != NULL); + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); - if (lambda[i] > MinMagThresh) { - /* minification */ - switch (tObj->MinFilter) { - case GL_NEAREST: - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], u[i], rgba[i]); - break; - case GL_LINEAR: - sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], u[i], rgba[i]); - break; - case GL_NEAREST_MIPMAP_NEAREST: - sample_3d_nearest_mipmap_nearest(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - case GL_LINEAR_MIPMAP_NEAREST: - sample_3d_linear_mipmap_nearest(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - case GL_NEAREST_MIPMAP_LINEAR: - sample_3d_nearest_mipmap_linear(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - case GL_LINEAR_MIPMAP_LINEAR: - sample_3d_linear_mipmap_linear(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - default: - _mesa_problem(NULL, "Bad min filterin sample_3d_texture"); - } + if (minStart < minEnd) { + /* do the minified texels */ + GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + for (i = minStart; i < minEnd; i++) + sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = minStart; i < minEnd; i++) + sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_3d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_3d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_3d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + sample_3d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_3d_texture"); + return; } - else { - /* magnification */ - switch (tObj->MagFilter) { - case GL_NEAREST: - sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], u[i], rgba[i]); - break; - case GL_LINEAR: - sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], - s[i], t[i], u[i], rgba[i]); - break; - default: - _mesa_problem(NULL, "Bad mag filter in sample_3d_texture"); - } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + switch (tObj->MagFilter) { + case GL_NEAREST: + for (i = magStart; i < magEnd; i++) + sample_3d_nearest(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + case GL_LINEAR: + for (i = magStart; i < magEnd; i++) + sample_3d_linear(ctx, tObj, tObj->Image[tObj->BaseLevel], + texcoords[i], rgba[i]); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_3d_texture"); + return; } } } @@ -1483,8 +1792,7 @@ sample_lambda_3d( GLcontext *ctx, GLuint texUnit, */ static const struct gl_texture_image ** choose_cube_face(const struct gl_texture_object *texObj, - GLfloat rx, GLfloat ry, GLfloat rz, - GLfloat *newS, GLfloat *newT) + const GLfloat texcoord[4], GLfloat newCoord[4]) { /* major axis @@ -1497,6 +1805,9 @@ choose_cube_face(const struct gl_texture_object *texObj, +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz */ + const GLfloat rx = texcoord[0]; + const GLfloat ry = texcoord[1]; + const GLfloat rz = texcoord[2]; const struct gl_texture_image **imgArray; const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz); GLfloat sc, tc, ma; @@ -1544,8 +1855,8 @@ choose_cube_face(const struct gl_texture_object *texObj, } } - *newS = ( sc / ma + 1.0F ) * 0.5F; - *newT = ( tc / ma + 1.0F ) * 0.5F; + newCoord[0] = ( sc / ma + 1.0F ) * 0.5F; + newCoord[1] = ( tc / ma + 1.0F ) * 0.5F; return imgArray; } @@ -1553,18 +1864,17 @@ choose_cube_face(const struct gl_texture_object *texObj, static void sample_nearest_cube(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) lambda; for (i = 0; i < n; i++) { const struct gl_texture_image **images; - GLfloat newS, newT; - images = choose_cube_face(tObj, s[i], t[i], u[i], &newS, &newT); + GLfloat newCoord[4]; + images = choose_cube_face(tObj, texcoords[i], newCoord); sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel], - newS, newT, rgba[i]); + newCoord, rgba[i]); } } @@ -1572,112 +1882,119 @@ sample_nearest_cube(GLcontext *ctx, GLuint texUnit, static void sample_linear_cube(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]) { GLuint i; (void) lambda; for (i = 0; i < n; i++) { const struct gl_texture_image **images; - GLfloat newS, newT; - images = choose_cube_face(tObj, s[i], t[i], u[i], &newS, &newT); + GLfloat newCoord[4]; + images = choose_cube_face(tObj, texcoords[i], newCoord); sample_2d_linear(ctx, tObj, images[tObj->BaseLevel], - newS, newT, rgba[i]); + newCoord, rgba[i]); } } static void -sample_cube_nearest_mipmap_nearest(GLcontext *ctx, +sample_cube_nearest_mipmap_nearest(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat u, - GLfloat lambda, GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image **images; - GLfloat newS, newT; - GLint level; - - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - - images = choose_cube_face(tObj, s, t, u, &newS, &newT); - sample_2d_nearest(ctx, tObj, images[level], newS, newT, rgba); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + sample_2d_nearest(ctx, tObj, images[level], newCoord, rgba[i]); + } } static void -sample_cube_linear_mipmap_nearest(GLcontext *ctx, +sample_cube_linear_mipmap_nearest(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat u, - GLfloat lambda, GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image **images; - GLfloat newS, newT; - GLint level; - - COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda, level); - - images = choose_cube_face(tObj, s, t, u, &newS, &newT); - sample_2d_linear(ctx, tObj, images[level], newS, newT, rgba); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_NEAREST_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + sample_2d_linear(ctx, tObj, images[level], newCoord, rgba[i]); + } } static void -sample_cube_nearest_mipmap_linear(GLcontext *ctx, +sample_cube_nearest_mipmap_linear(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat u, - GLfloat lambda, GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image **images; - GLfloat newS, newT; - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - images = choose_cube_face(tObj, s, t, u, &newS, &newT); - - if (level >= tObj->_MaxLevel) { - sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], newS, newT, rgba); - } - else { - GLchan t0[4], t1[4]; /* texels */ - const GLfloat f = FRAC(lambda); - sample_2d_nearest(ctx, tObj, images[level ], newS, newT, t0); - sample_2d_nearest(ctx, tObj, images[level+1], newS, newT, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + if (level >= tObj->_MaxLevel) { + sample_2d_nearest(ctx, tObj, images[tObj->_MaxLevel], + newCoord, rgba[i]); + } + else { + GLchan t0[4], t1[4]; /* texels */ + const GLfloat f = FRAC(lambda[i]); + sample_2d_nearest(ctx, tObj, images[level ], newCoord, t0); + sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } static void -sample_cube_linear_mipmap_linear(GLcontext *ctx, +sample_cube_linear_mipmap_linear(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, - GLfloat s, GLfloat t, GLfloat u, - GLfloat lambda, GLchan rgba[4]) + GLuint n, GLfloat texcoord[][4], + const GLfloat lambda[], GLchan rgba[][4]) { - const struct gl_texture_image **images; - GLfloat newS, newT; - GLint level; - - COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda, level); - - images = choose_cube_face(tObj, s, t, u, &newS, &newT); - - if (level >= tObj->_MaxLevel) { - sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], newS, newT, rgba); - } - else { - GLchan t0[4], t1[4]; - const GLfloat f = FRAC(lambda); - sample_2d_linear(ctx, tObj, images[level ], newS, newT, t0); - sample_2d_linear(ctx, tObj, images[level+1], newS, newT, t1); - rgba[RCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); - rgba[GCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); - rgba[BCOMP] = (GLchan) INTCAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); - rgba[ACOMP] = (GLchan) INTCAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + GLuint i; + ASSERT(lambda != NULL); + for (i = 0; i < n; i++) { + const struct gl_texture_image **images; + GLfloat newCoord[4]; + GLint level; + COMPUTE_LINEAR_MIPMAP_LEVEL(tObj, lambda[i], level); + images = choose_cube_face(tObj, texcoord[i], newCoord); + if (level >= tObj->_MaxLevel) { + sample_2d_linear(ctx, tObj, images[tObj->_MaxLevel], + newCoord, rgba[i]); + } + else { + GLchan t0[4], t1[4]; + const GLfloat f = FRAC(lambda[i]); + sample_2d_linear(ctx, tObj, images[level ], newCoord, t0); + sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1); + rgba[i][RCOMP] = CHAN_CAST ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); + rgba[i][GCOMP] = CHAN_CAST ((1.0F-f) * t0[GCOMP] + f * t1[GCOMP]); + rgba[i][BCOMP] = CHAN_CAST ((1.0F-f) * t0[BCOMP] + f * t1[BCOMP]); + rgba[i][ACOMP] = CHAN_CAST ((1.0F-f) * t0[ACOMP] + f * t1[ACOMP]); + } } } @@ -1685,81 +2002,72 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx, static void sample_lambda_cube( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { - GLfloat MinMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; - GLuint i; + GLuint minStart, minEnd; /* texels with minification */ + GLuint magStart, magEnd; /* texels with magnification */ - for (i = 0; i < n; i++) { - if (lambda[i] > MinMagThresh) { - /* minification */ - switch (tObj->MinFilter) { - case GL_NEAREST: - { - const struct gl_texture_image **images; - GLfloat newS, newT; - images = choose_cube_face(tObj, s[i], t[i], u[i], - &newS, &newT); - sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel], - newS, newT, rgba[i]); - } - break; - case GL_LINEAR: - { - const struct gl_texture_image **images; - GLfloat newS, newT; - images = choose_cube_face(tObj, s[i], t[i], u[i], - &newS, &newT); - sample_2d_linear(ctx, tObj, images[tObj->BaseLevel], - newS, newT, rgba[i]); - } - break; - case GL_NEAREST_MIPMAP_NEAREST: - sample_cube_nearest_mipmap_nearest(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - case GL_LINEAR_MIPMAP_NEAREST: - sample_cube_linear_mipmap_nearest(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - case GL_NEAREST_MIPMAP_LINEAR: - sample_cube_nearest_mipmap_linear(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - case GL_LINEAR_MIPMAP_LINEAR: - sample_cube_linear_mipmap_linear(ctx, tObj, s[i], t[i], u[i], - lambda[i], rgba[i]); - break; - default: - _mesa_problem(NULL, "Bad min filter in sample_lambda_cube"); - } + ASSERT(lambda != NULL); + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + /* do the minified texels */ + const GLuint m = minEnd - minStart; + switch (tObj->MinFilter) { + case GL_NEAREST: + sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR: + sample_linear_cube(ctx, texUnit, tObj, m, texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_NEAREST: + sample_cube_nearest_mipmap_nearest(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_NEAREST: + sample_cube_linear_mipmap_nearest(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_NEAREST_MIPMAP_LINEAR: + sample_cube_nearest_mipmap_linear(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + case GL_LINEAR_MIPMAP_LINEAR: + sample_cube_linear_mipmap_linear(ctx, texUnit, tObj, m, + texcoords + minStart, + lambda + minStart, rgba + minStart); + break; + default: + _mesa_problem(ctx, "Bad min filter in sample_lambda_cube"); } - else { - /* magnification */ - const struct gl_texture_image **images; - GLfloat newS, newT; - images = choose_cube_face(tObj, s[i], t[i], u[i], - &newS, &newT); - switch (tObj->MagFilter) { - case GL_NEAREST: - sample_2d_nearest(ctx, tObj, images[tObj->BaseLevel], - newS, newT, rgba[i]); - break; - case GL_LINEAR: - sample_2d_linear(ctx, tObj, images[tObj->BaseLevel], - newS, newT, rgba[i]); - break; - default: - _mesa_problem(NULL, "Bad mag filter in sample_lambda_cube"); - } + } + + if (magStart < magEnd) { + /* do the magnified texels */ + const GLuint m = magEnd - magStart; + switch (tObj->MagFilter) { + case GL_NEAREST: + sample_nearest_cube(ctx, texUnit, tObj, m, texcoords + magStart, + lambda + magStart, rgba + magStart); + break; + case GL_LINEAR: + sample_linear_cube(ctx, texUnit, tObj, m, texcoords + magStart, + lambda + magStart, rgba + magStart); + break; + default: + _mesa_problem(ctx, "Bad mag filter in sample_lambda_cube"); } } } - /**********************************************************************/ /* Texture Rectangle Sampling Functions */ /**********************************************************************/ @@ -1767,8 +2075,7 @@ sample_lambda_cube( GLcontext *ctx, GLuint texUnit, static void sample_nearest_rect(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0]; @@ -1783,10 +2090,10 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit, ASSERT(tObj->WrapS == GL_CLAMP || tObj->WrapS == GL_CLAMP_TO_EDGE || - tObj->WrapS == GL_CLAMP_TO_BORDER_ARB); + tObj->WrapS == GL_CLAMP_TO_BORDER); ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || - tObj->WrapT == GL_CLAMP_TO_BORDER_ARB); + tObj->WrapT == GL_CLAMP_TO_BORDER); ASSERT(img->Format != GL_COLOR_INDEX); /* XXX move Wrap mode tests outside of loops for common cases */ @@ -1794,22 +2101,22 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit, GLint row, col; /* NOTE: we DO NOT use [0, 1] texture coordinates! */ if (tObj->WrapS == GL_CLAMP) { - col = IFLOOR( CLAMP(s[i], 0.0F, width) ); + col = IFLOOR( CLAMP(texcoords[i][0], 0.0F, width) ); } else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { - col = IFLOOR( CLAMP(s[i], 0.5F, width - 0.5F) ); + col = IFLOOR( CLAMP(texcoords[i][0], 0.5F, width - 0.5F) ); } else { - col = IFLOOR( CLAMP(s[i], -0.5F, width + 0.5F) ); + col = IFLOOR( CLAMP(texcoords[i][0], -0.5F, width + 0.5F) ); } if (tObj->WrapT == GL_CLAMP) { - row = IFLOOR( CLAMP(t[i], 0.0F, height) ); + row = IFLOOR( CLAMP(texcoords[i][1], 0.0F, height) ); } else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { - row = IFLOOR( CLAMP(t[i], 0.5F, height - 0.5F) ); + row = IFLOOR( CLAMP(texcoords[i][1], 0.5F, height - 0.5F) ); } else { - row = IFLOOR( CLAMP(t[i], -0.5F, height + 0.5F) ); + row = IFLOOR( CLAMP(texcoords[i][1], -0.5F, height + 0.5F) ); } col = CLAMP(col, 0, width_minus_1); @@ -1823,9 +2130,8 @@ sample_nearest_rect(GLcontext *ctx, GLuint texUnit, static void sample_linear_rect(GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], - GLchan rgba[][4]) + GLfloat texcoords[][4], + const GLfloat lambda[], GLchan rgba[][4]) { const struct gl_texture_image *img = tObj->Image[0]; const GLfloat width = (GLfloat) img->Width; @@ -1839,10 +2145,10 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit, ASSERT(tObj->WrapS == GL_CLAMP || tObj->WrapS == GL_CLAMP_TO_EDGE || - tObj->WrapS == GL_CLAMP_TO_BORDER_ARB); + tObj->WrapS == GL_CLAMP_TO_BORDER); ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || - tObj->WrapT == GL_CLAMP_TO_BORDER_ARB); + tObj->WrapT == GL_CLAMP_TO_BORDER); ASSERT(img->Format != GL_COLOR_INDEX); /* XXX lots of opportunity for optimization in this loop */ @@ -1854,22 +2160,22 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit, /* NOTE: we DO NOT use [0, 1] texture coordinates! */ if (tObj->WrapS == GL_CLAMP) { - fcol = CLAMP(s[i], 0.0F, width); + fcol = CLAMP(texcoords[i][0], 0.0F, width); } else if (tObj->WrapS == GL_CLAMP_TO_EDGE) { - fcol = CLAMP(s[i], 0.5F, width - 0.5F); + fcol = CLAMP(texcoords[i][0], 0.5F, width - 0.5F); } else { - fcol = CLAMP(s[i], -0.5F, width + 0.5F); + fcol = CLAMP(texcoords[i][0], -0.5F, width + 0.5F); } if (tObj->WrapT == GL_CLAMP) { - frow = CLAMP(t[i], 0.0F, height); + frow = CLAMP(texcoords[i][1], 0.0F, height); } else if (tObj->WrapT == GL_CLAMP_TO_EDGE) { - frow = CLAMP(t[i], 0.5F, height - 0.5F); + frow = CLAMP(texcoords[i][1], 0.5F, height - 0.5F); } else { - frow = CLAMP(t[i], -0.5F, height + 0.5F); + frow = CLAMP(texcoords[i][1], -0.5F, height + 0.5F); } /* compute integer rows/columns */ @@ -1897,92 +2203,456 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit, w11 = a * b ; /* compute weighted average of samples */ - rgba[i][0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]; - rgba[i][1] = w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]; - rgba[i][2] = w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]; - rgba[i][3] = w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]; + rgba[i][0] = + (GLchan) (w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]); + rgba[i][1] = + (GLchan) (w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]); + rgba[i][2] = + (GLchan) (w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]); + rgba[i][3] = + (GLchan) (w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]); } } - static void sample_lambda_rect( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { - const GLfloat minMagThresh = SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit]; - GLuint i; + GLuint minStart, minEnd, magStart, magEnd; - { + /* We only need lambda to decide between minification and magnification. + * There is no mipmapping with rectangular textures. + */ + compute_min_mag_ranges(SWRAST_CONTEXT(ctx)->_MinMagThresh[texUnit], + n, lambda, &minStart, &minEnd, &magStart, &magEnd); + + if (minStart < minEnd) { + if (tObj->MinFilter == GL_NEAREST) { + sample_nearest_rect( ctx, texUnit, tObj, minEnd - minStart, + texcoords + minStart, NULL, rgba + minStart); + } + else { + sample_linear_rect( ctx, texUnit, tObj, minEnd - minStart, + texcoords + minStart, NULL, rgba + minStart); + } + } + if (magStart < magEnd) { + if (tObj->MagFilter == GL_NEAREST) { + sample_nearest_rect( ctx, texUnit, tObj, magEnd - magStart, + texcoords + magStart, NULL, rgba + magStart); + } + else { + sample_linear_rect( ctx, texUnit, tObj, magEnd - magStart, + texcoords + magStart, NULL, rgba + magStart); + } + } +} + + + +/* + * Sample a shadow/depth texture. + */ +static void +sample_depth_texture( GLcontext *ctx, GLuint unit, + const struct gl_texture_object *tObj, GLuint n, + GLfloat texcoords[][4], const GLfloat lambda[], + GLchan texel[][4] ) +{ + const GLint baseLevel = tObj->BaseLevel; + const struct gl_texture_image *texImage = tObj->Image[baseLevel]; + const GLuint width = texImage->Width; + const GLuint height = texImage->Height; + GLchan ambient; + GLenum function; + GLchan result; + + (void) unit; + + ASSERT(tObj->Image[tObj->BaseLevel]->Format == GL_DEPTH_COMPONENT); + ASSERT(tObj->Target == GL_TEXTURE_1D || + tObj->Target == GL_TEXTURE_2D || + tObj->Target == GL_TEXTURE_RECTANGLE_NV); + + UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); + + /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ + + /* XXX this could be precomputed and saved in the texture object */ + if (tObj->CompareFlag) { + /* GL_SGIX_shadow */ + if (tObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { + function = GL_LEQUAL; + } + else { + ASSERT(tObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); + function = GL_GEQUAL; + } + } + else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { + /* GL_ARB_shadow */ + function = tObj->CompareFunc; + } + else { + function = GL_NONE; /* pass depth through as grayscale */ + } + + if (tObj->MagFilter == GL_NEAREST) { + GLuint i; for (i = 0; i < n; i++) { - GLfloat coord[4]; - coord[0] = s[i]; - coord[1] = t[i]; - coord[2] = u[i]; - coord[3] = 1.0; - if (lambda[i] > minMagThresh) { - /* minification */ - switch (tObj->MinFilter) { - case GL_NEAREST: - sample_nearest_rect(ctx, texUnit, tObj, 1, - s + i, t + i, u + i, lambda + i, - rgba + i ); - break; - case GL_LINEAR: - sample_linear_rect(ctx, texUnit, tObj, 1, - s + i, t + i, u + i, lambda + i, - rgba + i ); - break; - default: - _mesa_problem(NULL, "Bad min filter in sample_lambda_rect"); - return; + GLfloat depthSample; + GLint col, row; + /* XXX fix for texture rectangle! */ + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapS, texcoords[i][0], width, col); + COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, texcoords[i][1], height, row); + depthSample = *((const GLfloat *) texImage->Data + row * width + col); + + switch (function) { + case GL_LEQUAL: + result = (texcoords[i][2] <= depthSample) ? CHAN_MAX : ambient; + break; + case GL_GEQUAL: + result = (texcoords[i][2] >= depthSample) ? CHAN_MAX : ambient; + break; + case GL_LESS: + result = (texcoords[i][2] < depthSample) ? CHAN_MAX : ambient; + break; + case GL_GREATER: + result = (texcoords[i][2] > depthSample) ? CHAN_MAX : ambient; + break; + case GL_EQUAL: + result = (texcoords[i][2] == depthSample) ? CHAN_MAX : ambient; + break; + case GL_NOTEQUAL: + result = (texcoords[i][2] != depthSample) ? CHAN_MAX : ambient; + break; + case GL_ALWAYS: + result = CHAN_MAX; + break; + case GL_NEVER: + result = ambient; + break; + case GL_NONE: + CLAMPED_FLOAT_TO_CHAN(result, depthSample); + break; + default: + _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); + return; + } + + switch (tObj->DepthMode) { + case GL_LUMINANCE: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = result; + break; + case GL_ALPHA: + texel[i][RCOMP] = 0; + texel[i][GCOMP] = 0; + texel[i][BCOMP] = 0; + texel[i][ACOMP] = result; + break; + default: + _mesa_problem(ctx, "Bad depth texture mode"); + } + } + } + else { + GLuint i; + ASSERT(tObj->MagFilter == GL_LINEAR); + for (i = 0; i < n; i++) { + GLfloat depth00, depth01, depth10, depth11; + GLint i0, i1, j0, j1; + GLfloat u, v; + GLuint useBorderTexel; + + /* XXX fix for texture rectangle! */ + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapS, texcoords[i][0], u, width, i0, i1); + COMPUTE_LINEAR_TEXEL_LOCATIONS(tObj->WrapT, texcoords[i][1], v, height,j0, j1); + + useBorderTexel = 0; + if (texImage->Border) { + i0 += texImage->Border; + i1 += texImage->Border; + j0 += texImage->Border; + j1 += texImage->Border; + } + else { + if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT; + if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT; + if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT; + if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT; + } + + /* get four depth samples from the texture */ + if (useBorderTexel & (I0BIT | J0BIT)) { + depth00 = 1.0; + } + else { + depth00 = *((const GLfloat *) texImage->Data + j0 * width + i0); + } + if (useBorderTexel & (I1BIT | J0BIT)) { + depth10 = 1.0; + } + else { + depth10 = *((const GLfloat *) texImage->Data + j0 * width + i1); + } + if (useBorderTexel & (I0BIT | J1BIT)) { + depth01 = 1.0; + } + else { + depth01 = *((const GLfloat *) texImage->Data + j1 * width + i0); + } + if (useBorderTexel & (I1BIT | J1BIT)) { + depth11 = 1.0; + } + else { + depth11 = *((const GLfloat *) texImage->Data + j1 * width + i1); + } + + if (0) { + /* compute a single weighted depth sample and do one comparison */ + const GLfloat a = FRAC(u + 1.0F); + const GLfloat b = FRAC(v + 1.0F); + const GLfloat w00 = (1.0F - a) * (1.0F - b); + const GLfloat w10 = ( a) * (1.0F - b); + const GLfloat w01 = (1.0F - a) * ( b); + const GLfloat w11 = ( a) * ( b); + const GLfloat depthSample = w00 * depth00 + w10 * depth10 + + w01 * depth01 + w11 * depth11; + if ((depthSample <= texcoords[i][2] && function == GL_LEQUAL) || + (depthSample >= texcoords[i][2] && function == GL_GEQUAL)) { + result = ambient; + } + else { + result = CHAN_MAX; } } else { - /* magnification */ - switch (tObj->MagFilter) { - case GL_NEAREST: - sample_nearest_rect(ctx, texUnit, tObj, 1, - s + i, t + i, u + i, lambda + i, - rgba + i ); - break; - case GL_LINEAR: - sample_linear_rect(ctx, texUnit, tObj, 1, - s + i, t + i, u + i, lambda + i, - rgba + i ); - break; - default: - _mesa_problem(NULL, "Bad mag filter in sample_lambda_rect"); - return; + /* Do four depth/R comparisons and compute a weighted result. + * If this touches on somebody's I.P., I'll remove this code + * upon request. + */ + const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; + GLfloat luminance = CHAN_MAXF; + + switch (function) { + case GL_LEQUAL: + if (depth00 <= texcoords[i][2]) luminance -= d; + if (depth01 <= texcoords[i][2]) luminance -= d; + if (depth10 <= texcoords[i][2]) luminance -= d; + if (depth11 <= texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_GEQUAL: + if (depth00 >= texcoords[i][2]) luminance -= d; + if (depth01 >= texcoords[i][2]) luminance -= d; + if (depth10 >= texcoords[i][2]) luminance -= d; + if (depth11 >= texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_LESS: + if (depth00 < texcoords[i][2]) luminance -= d; + if (depth01 < texcoords[i][2]) luminance -= d; + if (depth10 < texcoords[i][2]) luminance -= d; + if (depth11 < texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_GREATER: + if (depth00 > texcoords[i][2]) luminance -= d; + if (depth01 > texcoords[i][2]) luminance -= d; + if (depth10 > texcoords[i][2]) luminance -= d; + if (depth11 > texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_EQUAL: + if (depth00 == texcoords[i][2]) luminance -= d; + if (depth01 == texcoords[i][2]) luminance -= d; + if (depth10 == texcoords[i][2]) luminance -= d; + if (depth11 == texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_NOTEQUAL: + if (depth00 != texcoords[i][2]) luminance -= d; + if (depth01 != texcoords[i][2]) luminance -= d; + if (depth10 != texcoords[i][2]) luminance -= d; + if (depth11 != texcoords[i][2]) luminance -= d; + result = (GLchan) luminance; + break; + case GL_ALWAYS: + result = 0; + break; + case GL_NEVER: + result = CHAN_MAX; + break; + case GL_NONE: + /* ordinary bilinear filtering */ + { + const GLfloat a = FRAC(u + 1.0F); + const GLfloat b = FRAC(v + 1.0F); + const GLfloat w00 = (1.0F - a) * (1.0F - b); + const GLfloat w10 = ( a) * (1.0F - b); + const GLfloat w01 = (1.0F - a) * ( b); + const GLfloat w11 = ( a) * ( b); + const GLfloat depthSample = w00 * depth00 + w10 * depth10 + + w01 * depth01 + w11 * depth11; + CLAMPED_FLOAT_TO_CHAN(result, depthSample); + } + break; + default: + _mesa_problem(ctx, "Bad compare func in sample_depth_texture"); + return; } } - } - } + switch (tObj->DepthMode) { + case GL_LUMINANCE: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = CHAN_MAX; + break; + case GL_INTENSITY: + texel[i][RCOMP] = result; + texel[i][GCOMP] = result; + texel[i][BCOMP] = result; + texel[i][ACOMP] = result; + break; + case GL_ALPHA: + texel[i][RCOMP] = 0; + texel[i][GCOMP] = 0; + texel[i][BCOMP] = 0; + texel[i][ACOMP] = result; + break; + default: + _mesa_problem(ctx, "Bad depth texture mode"); + } + } /* for */ + } /* if filter */ } +#if 0 +/* + * Experimental depth texture sampling function. + */ +static void +sample_depth_texture2(const GLcontext *ctx, + const struct gl_texture_unit *texUnit, + GLuint n, GLfloat texcoords[][4], + GLchan texel[][4]) +{ + const struct gl_texture_object *texObj = texUnit->_Current; + const GLint baseLevel = texObj->BaseLevel; + const struct gl_texture_image *texImage = texObj->Image[baseLevel]; + const GLuint width = texImage->Width; + const GLuint height = texImage->Height; + GLchan ambient; + GLboolean lequal, gequal; + + if (texObj->Target != GL_TEXTURE_2D) { + _mesa_problem(ctx, "only 2-D depth textures supported at this time"); + return; + } + + if (texObj->MinFilter != texObj->MagFilter) { + _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); + return; + } + + /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if + * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object + * isn't a depth texture. + */ + if (texImage->Format != GL_DEPTH_COMPONENT) { + _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); + return; + } + UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); + + if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { + lequal = GL_TRUE; + gequal = GL_FALSE; + } + else { + lequal = GL_FALSE; + gequal = GL_TRUE; + } + + { + GLuint i; + for (i = 0; i < n; i++) { + const GLint K = 3; + GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; + GLfloat w; + GLchan lum; + COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, texcoords[i][0], + width, col); + COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, texcoords[i][1], + height, row); + + imin = col - K; + imax = col + K; + jmin = row - K; + jmax = row + K; + + if (imin < 0) imin = 0; + if (imax >= width) imax = width - 1; + if (jmin < 0) jmin = 0; + if (jmax >= height) jmax = height - 1; + + samples = (imax - imin + 1) * (jmax - jmin + 1); + count = 0; + for (jj = jmin; jj <= jmax; jj++) { + for (ii = imin; ii <= imax; ii++) { + GLfloat depthSample = *((const GLfloat *) texImage->Data + + jj * width + ii); + if ((depthSample <= r[i] && lequal) || + (depthSample >= r[i] && gequal)) { + count++; + } + } + } + + w = (GLfloat) count / (GLfloat) samples; + w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); + lum = (GLint) w; + + texel[i][RCOMP] = lum; + texel[i][GCOMP] = lum; + texel[i][BCOMP] = lum; + texel[i][ACOMP] = CHAN_MAX; + } + } +} +#endif + + +/** + * We use this function when a texture object is in an "incomplete" state. + */ static void null_sample_func( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat u[], const GLfloat lambda[], + GLfloat texcoords[][4], const GLfloat lambda[], GLchan rgba[][4]) { } -/**********************************************************************/ -/* Texture Sampling Setup */ -/**********************************************************************/ - - -/* +/** * Setup the texture sampling function for this texture object. */ void @@ -1991,11 +2661,12 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, { SWcontext *swrast = SWRAST_CONTEXT(ctx); - if (!t->Complete) { - swrast->TextureSample[texUnit] = null_sample_func; + if (!t->Complete) { + swrast->TextureSample[texUnit] = null_sample_func; } else { - GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); + const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); + const GLenum format = t->Image[t->BaseLevel]->Format; if (needLambda) { /* Compute min/mag filter threshold */ @@ -2011,27 +2682,33 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, switch (t->Target) { case GL_TEXTURE_1D: - if (needLambda) { + if (format == GL_DEPTH_COMPONENT) { + swrast->TextureSample[texUnit] = sample_depth_texture; + } + else if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_1d; } - else if (t->MinFilter==GL_LINEAR) { + else if (t->MinFilter == GL_LINEAR) { swrast->TextureSample[texUnit] = sample_linear_1d; } else { - ASSERT(t->MinFilter==GL_NEAREST); + ASSERT(t->MinFilter == GL_NEAREST); swrast->TextureSample[texUnit] = sample_nearest_1d; } break; case GL_TEXTURE_2D: - if (needLambda) { + if (format == GL_DEPTH_COMPONENT) { + swrast->TextureSample[texUnit] = sample_depth_texture; + } + else if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_2d; } - else if (t->MinFilter==GL_LINEAR) { + else if (t->MinFilter == GL_LINEAR) { swrast->TextureSample[texUnit] = sample_linear_2d; } else { GLint baseLevel = t->BaseLevel; - ASSERT(t->MinFilter==GL_NEAREST); + ASSERT(t->MinFilter == GL_NEAREST); if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && t->Image[baseLevel]->Border == 0 && @@ -2052,23 +2729,23 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_3d; } - else if (t->MinFilter==GL_LINEAR) { + else if (t->MinFilter == GL_LINEAR) { swrast->TextureSample[texUnit] = sample_linear_3d; } else { - ASSERT(t->MinFilter==GL_NEAREST); + ASSERT(t->MinFilter == GL_NEAREST); swrast->TextureSample[texUnit] = sample_nearest_3d; } break; - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: if (needLambda) { swrast->TextureSample[texUnit] = sample_lambda_cube; } - else if (t->MinFilter==GL_LINEAR) { + else if (t->MinFilter == GL_LINEAR) { swrast->TextureSample[texUnit] = sample_linear_cube; } else { - ASSERT(t->MinFilter==GL_NEAREST); + ASSERT(t->MinFilter == GL_NEAREST); swrast->TextureSample[texUnit] = sample_nearest_cube; } break; @@ -2085,7 +2762,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, } break; default: - _mesa_problem(NULL, "invalid dimensions in _mesa_set_texture_sampler"); + _mesa_problem(ctx, "invalid target in _swrast_choose_texture_sample_func"); } } } @@ -2094,70 +2771,131 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, GLuint texUnit, #define PROD(A,B) ( (GLuint)(A) * ((GLuint)(B)+1) ) #define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) ) + +/** + * Do texture application for GL_ARB/EXT_texture_env_combine. + * This function also supports GL_{EXT,ARB}_texture_env_dot3 and + * GL_ATI_texture_env_combine3 + * + * \param ctx rendering context + * \param textureUnit the texture unit to apply + * \param n number of fragments to process (span width) + * \param primary_rgba incoming fragment color array + * \param texelBuffer pointer to texel colors for all texture units + * + * \param rgba incoming colors, which get modified here + */ static INLINE void -texture_combine(const GLcontext *ctx, - const struct gl_texture_unit *textureUnit, - GLuint n, - CONST GLchan (*primary_rgba)[4], - CONST GLchan (*texel)[4], - GLchan (*rgba)[4]) +texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, + CONST GLchan (*primary_rgba)[4], + CONST GLchan *texelBuffer, + GLchan (*rgba)[4] ) { + const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); const GLchan (*argRGB [3])[4]; const GLchan (*argA [3])[4]; - GLuint i, j; const GLuint RGBshift = textureUnit->CombineScaleShiftRGB; const GLuint Ashift = textureUnit->CombineScaleShiftA; #if CHAN_TYPE == GL_FLOAT const GLchan RGBmult = (GLfloat) (1 << RGBshift); const GLchan Amult = (GLfloat) (1 << Ashift); + static const GLchan one[4] = { 1.0, 1.0, 1.0, 1.0 }; + static const GLchan zero[4] = { 0.0, 0.0, 0.0, 0.0 }; #else const GLint half = (CHAN_MAX + 1) / 2; + static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX }; + static const GLchan zero[4] = { 0, 0, 0, 0 }; #endif + GLuint i, j; + GLuint numColorArgs; + GLuint numAlphaArgs; + /* GLchan ccolor[3][4]; */ DEFMNARRAY(GLchan, ccolor, 3, 3 * MAX_WIDTH, 4); /* mac 32k limitation */ CHECKARRAY(ccolor, return); /* mac 32k limitation */ ASSERT(ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine); + ASSERT(SWRAST_CONTEXT(ctx)->_AnyTextureCombine); + + + /* + printf("modeRGB 0x%x modeA 0x%x srcRGB1 0x%x srcA1 0x%x srcRGB2 0x%x srcA2 0x%x\n", + textureUnit->CombineModeRGB, + textureUnit->CombineModeA, + textureUnit->CombineSourceRGB[0], + textureUnit->CombineSourceA[0], + textureUnit->CombineSourceRGB[1], + textureUnit->CombineSourceA[1]); + */ /* * Do operand setup for up to 3 operands. Loop over the terms. */ - for (j = 0; j < 3; j++) { - switch (textureUnit->CombineSourceA[j]) { - case GL_TEXTURE: - argA[j] = texel; - break; - case GL_PRIMARY_COLOR_EXT: - argA[j] = primary_rgba; - break; - case GL_PREVIOUS_EXT: - argA[j] = (const GLchan (*)[4]) rgba; - break; - case GL_CONSTANT_EXT: - { - GLchan alpha, (*c)[4] = ccolor[j]; - UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); - for (i = 0; i < n; i++) - c[i][ACOMP] = alpha; - argA[j] = (const GLchan (*)[4]) ccolor[j]; - } - break; - default: - _mesa_problem(ctx, "invalid combine source"); - } + switch (textureUnit->CombineModeRGB) { + case GL_REPLACE: + numColorArgs = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_SUBTRACT: + case GL_DOT3_RGB: + case GL_DOT3_RGBA: + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + numColorArgs = 2; + break; + case GL_INTERPOLATE: + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + numColorArgs = 3; + break; + default: + numColorArgs = 0; + ASSERT(0); + break; + } + + switch (textureUnit->CombineModeA) { + case GL_REPLACE: + numAlphaArgs = 1; + break; + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_SUBTRACT: + numAlphaArgs = 2; + break; + case GL_INTERPOLATE: + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + numAlphaArgs = 3; + break; + default: + numAlphaArgs = 0; + ASSERT(0); + break; + } + + for (j = 0; j < numColorArgs; j++) { + const GLenum srcRGB = textureUnit->CombineSourceRGB[j]; - switch (textureUnit->CombineSourceRGB[j]) { + + switch (srcRGB) { case GL_TEXTURE: - argRGB[j] = texel; + argRGB[j] = (const GLchan (*)[4]) + (texelBuffer + unit * (n * 4 * sizeof(GLchan))); break; - case GL_PRIMARY_COLOR_EXT: + case GL_PRIMARY_COLOR: argRGB[j] = primary_rgba; break; - case GL_PREVIOUS_EXT: + case GL_PREVIOUS: argRGB[j] = (const GLchan (*)[4]) rgba; break; - case GL_CONSTANT_EXT: + case GL_CONSTANT: { GLchan (*c)[4] = ccolor[j]; GLchan red, green, blue, alpha; @@ -2174,8 +2912,24 @@ texture_combine(const GLcontext *ctx, argRGB[j] = (const GLchan (*)[4]) ccolor[j]; } break; + /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. + */ + case GL_ZERO: + argRGB[j] = & zero; + break; + case GL_ONE: + argRGB[j] = & one; + break; default: - _mesa_problem(ctx, "invalid combine source"); + /* ARB_texture_env_crossbar source */ + { + const GLuint srcUnit = srcRGB - GL_TEXTURE0; + ASSERT(srcUnit < ctx->Const.MaxTextureUnits); + if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) + return; + argRGB[j] = (const GLchan (*)[4]) + (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); + } } if (textureUnit->CombineOperandRGB[j] != GL_SRC_COLOR) { @@ -2208,6 +2962,51 @@ texture_combine(const GLcontext *ctx, } } } + } + + + for (j = 0; j < numAlphaArgs; j++) { + const GLenum srcA = textureUnit->CombineSourceA[j]; + + switch (srcA) { + case GL_TEXTURE: + argA[j] = (const GLchan (*)[4]) + (texelBuffer + unit * (n * 4 * sizeof(GLchan))); + break; + case GL_PRIMARY_COLOR: + argA[j] = primary_rgba; + break; + case GL_PREVIOUS: + argA[j] = (const GLchan (*)[4]) rgba; + break; + case GL_CONSTANT: + { + GLchan alpha, (*c)[4] = ccolor[j]; + UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]); + for (i = 0; i < n; i++) + c[i][ACOMP] = alpha; + argA[j] = (const GLchan (*)[4]) ccolor[j]; + } + break; + /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources. + */ + case GL_ZERO: + argA[j] = & zero; + break; + case GL_ONE: + argA[j] = & one; + break; + default: + /* ARB_texture_env_crossbar source */ + { + const GLuint srcUnit = srcA - GL_TEXTURE0; + ASSERT(srcUnit < ctx->Const.MaxTextureUnits); + if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled) + return; + argA[j] = (const GLchan (*)[4]) + (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan))); + } + } if (textureUnit->CombineOperandA[j] == GL_ONE_MINUS_SRC_ALPHA) { const GLchan (*src)[4] = argA[j]; @@ -2217,17 +3016,6 @@ texture_combine(const GLcontext *ctx, dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP]; } } - - if (textureUnit->CombineModeRGB == GL_REPLACE && - textureUnit->CombineModeA == GL_REPLACE) { - break; /* done, we need only arg0 */ - } - - if (j == 1 && - textureUnit->CombineModeRGB != GL_INTERPOLATE_EXT && - textureUnit->CombineModeA != GL_INTERPOLATE_EXT) { - break; /* arg0 and arg1 are done. we don't need arg2. */ - } } /* @@ -2305,7 +3093,7 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_ADD_SIGNED_EXT: + case GL_ADD_SIGNED: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; @@ -2328,7 +3116,7 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_INTERPOLATE_EXT: + case GL_INTERPOLATE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; @@ -2361,7 +3149,7 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_SUBTRACT_ARB: + case GL_SUBTRACT: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; @@ -2407,8 +3195,8 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_DOT3_RGB_ARB: - case GL_DOT3_RGBA_ARB: + case GL_DOT3_RGB: + case GL_DOT3_RGBA: { /* DO scale the result by 1 2 or 4 */ const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; @@ -2418,8 +3206,8 @@ texture_combine(const GLcontext *ctx, GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) + (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) + (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F)) - * 4.0F; - dot = CLAMP(dot, 0.0, CHAN_MAXF) * RGBmult; + * 4.0F * RGBmult; + dot = CLAMP(dot, 0.0, CHAN_MAXF); #else GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half, (GLint)arg1[i][RCOMP] - half) + @@ -2427,12 +3215,100 @@ texture_combine(const GLcontext *ctx, (GLint)arg1[i][GCOMP] - half) + S_PROD((GLint)arg0[i][BCOMP] - half, (GLint)arg1[i][BCOMP] - half)) >> 6; - dot = CLAMP(dot, 0, CHAN_MAX) << RGBshift; + dot <<= RGBshift; + dot = CLAMP(dot, 0, CHAN_MAX); #endif rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot; } } break; + case GL_MODULATE_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP]) * RGBmult; +#else + GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + + ((GLuint) arg1[i][RCOMP] << CHAN_BITS)) >> shift; + GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + + ((GLuint) arg1[i][GCOMP] << CHAN_BITS)) >> shift; + GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + + ((GLuint) arg1[i][BCOMP] << CHAN_BITS)) >> shift; + rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SIGNED_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP] - 0.5) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP] - 0.5) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP] - 0.5) * RGBmult; +#else + GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + + (((GLint) arg1[i][RCOMP] - half) << CHAN_BITS)) + >> shift; + GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + + (((GLint) arg1[i][GCOMP] - half) << CHAN_BITS)) + >> shift; + GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + + (((GLint) arg1[i][BCOMP] - half) << CHAN_BITS)) + >> shift; + rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SUBTRACT_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - RGBshift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - arg1[i][RCOMP]) * RGBmult; + rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - arg1[i][GCOMP]) * RGBmult; + rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - arg1[i][BCOMP]) * RGBmult; +#else + GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP]) + - ((GLint) arg1[i][RCOMP] << CHAN_BITS)) + >> shift; + GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP]) + - ((GLint) arg1[i][GCOMP] << CHAN_BITS)) + >> shift; + GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP]) + - ((GLint) arg1[i][BCOMP] << CHAN_BITS)) + >> shift; + rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX); + rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX); + rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX); +#endif + } + } + break; default: _mesa_problem(ctx, "invalid combine mode"); } @@ -2489,7 +3365,7 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_ADD_SIGNED_EXT: + case GL_ADD_SIGNED: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; @@ -2504,7 +3380,7 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_INTERPOLATE_EXT: + case GL_INTERPOLATE: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; @@ -2526,7 +3402,7 @@ texture_combine(const GLcontext *ctx, } } break; - case GL_SUBTRACT_ARB: + case GL_SUBTRACT: { const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; @@ -2540,7 +3416,66 @@ texture_combine(const GLcontext *ctx, } } break; - + case GL_MODULATE_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP]) * Amult; +#else + GLuint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + + ((GLuint) arg1[i][ACOMP] << CHAN_BITS)) + >> shift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SIGNED_ADD_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP] - 0.5F) * Amult; +#else + GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + + (((GLint) arg1[i][ACOMP] - half) << CHAN_BITS)) + >> shift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; + case GL_MODULATE_SUBTRACT_ATI: + { + const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0]; + const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1]; + const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2]; +#if CHAN_TYPE != GL_FLOAT + const GLint shift = CHAN_BITS - Ashift; +#endif + for (i = 0; i < n; i++) { +#if CHAN_TYPE == GL_FLOAT + rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) - arg1[i][ACOMP]) * Amult; +#else + GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) + - ((GLint) arg1[i][ACOMP] << CHAN_BITS)) + >> shift; + rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX); +#endif + } + } + break; default: _mesa_problem(ctx, "invalid combine mode"); } @@ -2551,7 +3486,7 @@ texture_combine(const GLcontext *ctx, * GL_DOT3. */ if (textureUnit->CombineModeRGB == GL_DOT3_RGBA_EXT || - textureUnit->CombineModeRGB == GL_DOT3_RGBA_ARB) { + textureUnit->CombineModeRGB == GL_DOT3_RGBA) { for (i = 0; i < n; i++) { rgba[i][ACOMP] = rgba[i][RCOMP]; } @@ -2561,14 +3496,23 @@ texture_combine(const GLcontext *ctx, #undef PROD +/** + * Implement NVIDIA's GL_NV_texture_env_combine4 extension when + * texUnit->EnvMode == GL_COMBINE4_NV. + */ +static INLINE void +texture_combine4( const GLcontext *ctx, GLuint unit, GLuint n, + CONST GLchan (*primary_rgba)[4], + CONST GLchan *texelBuffer, + GLchan (*rgba)[4] ) +{ +} -/**********************************************************************/ -/* Texture Application */ -/**********************************************************************/ -/* - * Combine incoming fragment color with texel color to produce output color. +/** + * Apply a conventional OpenGL texture env mode (REPLACE, ADD, BLEND, + * MODULATE, or DECAL) to an array of fragments. * Input: textureUnit - pointer to texture unit to apply * format - base internal texture format * n - number of fragments @@ -2578,7 +3522,7 @@ texture_combine(const GLcontext *ctx, * according to the texture environment mode. */ static void -apply_texture( const GLcontext *ctx, +texture_apply( const GLcontext *ctx, const struct gl_texture_unit *texUnit, GLuint n, CONST GLchan primary_rgba[][4], CONST GLchan texel[][4], @@ -2597,8 +3541,9 @@ apply_texture( const GLcontext *ctx, format = texUnit->_Current->Image[baseLevel]->Format; - if (format==GL_COLOR_INDEX || format==GL_DEPTH_COMPONENT) { - format = GL_RGBA; /* XXXX a hack! */ + if (format == GL_COLOR_INDEX || format == GL_DEPTH_COMPONENT + || format == GL_YCBCR_MESA) { + format = GL_RGBA; /* a bit of a hack */ } switch (texUnit->EnvMode) { @@ -2657,7 +3602,7 @@ apply_texture( const GLcontext *ctx, } break; default: - _mesa_problem(ctx, "Bad format (GL_REPLACE) in apply_texture"); + _mesa_problem(ctx, "Bad format (GL_REPLACE) in texture_apply"); return; } break; @@ -2723,7 +3668,7 @@ apply_texture( const GLcontext *ctx, } break; default: - _mesa_problem(ctx, "Bad format (GL_MODULATE) in apply_texture"); + _mesa_problem(ctx, "Bad format (GL_MODULATE) in texture_apply"); return; } break; @@ -2756,7 +3701,7 @@ apply_texture( const GLcontext *ctx, } break; default: - _mesa_problem(ctx, "Bad format (GL_DECAL) in apply_texture"); + _mesa_problem(ctx, "Bad format (GL_DECAL) in texture_apply"); return; } break; @@ -2826,7 +3771,7 @@ apply_texture( const GLcontext *ctx, } break; default: - _mesa_problem(ctx, "Bad format (GL_BLEND) in apply_texture"); + _mesa_problem(ctx, "Bad format (GL_BLEND) in texture_apply"); return; } break; @@ -2903,351 +3848,109 @@ apply_texture( const GLcontext *ctx, } break; default: - _mesa_problem(ctx, "Bad format (GL_ADD) in apply_texture"); + _mesa_problem(ctx, "Bad format (GL_ADD) in texture_apply"); return; } break; - case GL_COMBINE_EXT: - texture_combine(ctx, texUnit, n, primary_rgba, texel, rgba); - break; - default: - _mesa_problem(ctx, "Bad env mode in apply_texture"); + _mesa_problem(ctx, "Bad env mode in texture_apply"); return; } } -/* - * Sample a shadow/depth texture. - * Input: ctx - context - * texUnit - the texture unit - * n - number of samples - * s,t,r - array [n] of texture coordinates - * In/Out: rgba - array [n] of texel colors. +/** + * Apply texture mapping to a span of fragments. */ -static void -sample_depth_texture(const GLcontext *ctx, - const struct gl_texture_unit *texUnit, - GLuint n, - const GLfloat s[], const GLfloat t[], const GLfloat r[], - GLchan texel[][4]) +void +_swrast_texture_span( GLcontext *ctx, struct sw_span *span ) { - const struct gl_texture_object *texObj = texUnit->_Current; - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *texImage = texObj->Image[baseLevel]; - const GLuint width = texImage->Width; - const GLuint height = texImage->Height; - const GLchan ambient = texObj->ShadowAmbient; - GLboolean lequal, gequal; + SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLchan primary_rgba[MAX_WIDTH][4]; + GLuint unit; - if (texObj->Target != GL_TEXTURE_2D) { - _mesa_problem(ctx, "only 2-D depth textures supported at this time"); - return; - } + ASSERT(span->end < MAX_WIDTH); + ASSERT(span->arrayMask & SPAN_TEXTURE); - if (texObj->MinFilter != texObj->MagFilter) { - _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); - return; - } - - /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if - * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object - * isn't a depth texture. + /* + * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR) */ - if (texImage->Format != GL_DEPTH_COMPONENT) { - _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); - return; - } - - if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - lequal = GL_TRUE; - gequal = GL_FALSE; - } - else { - lequal = GL_FALSE; - gequal = GL_TRUE; - } + if (swrast->_AnyTextureCombine) + MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan)); - if (texObj->MagFilter == GL_NEAREST) { - GLuint i; - for (i = 0; i < n; i++) { - GLfloat depthSample; - GLint col, row; - COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, s[i], width, col); - COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, t[i], height, row); - depthSample = *((const GLfloat *) texImage->Data + row * width + col); - if ((r[i] <= depthSample && lequal) || - (r[i] >= depthSample && gequal)) { - texel[i][RCOMP] = CHAN_MAX; - texel[i][GCOMP] = CHAN_MAX; - texel[i][BCOMP] = CHAN_MAX; - texel[i][ACOMP] = CHAN_MAX; - } - else { - texel[i][RCOMP] = ambient; - texel[i][GCOMP] = ambient; - texel[i][BCOMP] = ambient; - texel[i][ACOMP] = CHAN_MAX; - } - } - } - else { - GLuint i; - ASSERT(texObj->MagFilter == GL_LINEAR); - for (i = 0; i < n; i++) { - GLfloat depth00, depth01, depth10, depth11; - GLint i0, i1, j0, j1; - GLfloat u, v; - GLuint useBorderTexel; - - COMPUTE_LINEAR_TEXEL_LOCATIONS(texObj->WrapS, s[i], u, width, i0, i1); - COMPUTE_LINEAR_TEXEL_LOCATIONS(texObj->WrapT, t[i], v, height,j0, j1); - - useBorderTexel = 0; - if (texImage->Border) { - i0 += texImage->Border; - i1 += texImage->Border; - j0 += texImage->Border; - j1 += texImage->Border; - } - else { - if (i0 < 0 || i0 >= (GLint) width) useBorderTexel |= I0BIT; - if (i1 < 0 || i1 >= (GLint) width) useBorderTexel |= I1BIT; - if (j0 < 0 || j0 >= (GLint) height) useBorderTexel |= J0BIT; - if (j1 < 0 || j1 >= (GLint) height) useBorderTexel |= J1BIT; - } - - /* get four depth samples from the texture */ - if (useBorderTexel & (I0BIT | J0BIT)) { - depth00 = 1.0; - } - else { - depth00 = *((const GLfloat *) texImage->Data + j0 * width + i0); - } - if (useBorderTexel & (I1BIT | J0BIT)) { - depth10 = 1.0; - } - else { - depth10 = *((const GLfloat *) texImage->Data + j0 * width + i1); - } - if (useBorderTexel & (I0BIT | J1BIT)) { - depth01 = 1.0; - } - else { - depth01 = *((const GLfloat *) texImage->Data + j1 * width + i0); - } - if (useBorderTexel & (I1BIT | J1BIT)) { - depth11 = 1.0; - } - else { - depth11 = *((const GLfloat *) texImage->Data + j1 * width + i1); - } - - if (0) { - /* compute a single weighted depth sample and do one comparison */ - const GLfloat a = FRAC(u + 1.0F); - const GLfloat b = FRAC(v + 1.0F); - const GLfloat w00 = (1.0F - a) * (1.0F - b); - const GLfloat w10 = ( a) * (1.0F - b); - const GLfloat w01 = (1.0F - a) * ( b); - const GLfloat w11 = ( a) * ( b); - const GLfloat depthSample = w00 * depth00 + w10 * depth10 - + w01 * depth01 + w11 * depth11; - if ((depthSample <= r[i] && lequal) || - (depthSample >= r[i] && gequal)) { - texel[i][RCOMP] = ambient; - texel[i][GCOMP] = ambient; - texel[i][BCOMP] = ambient; - texel[i][ACOMP] = CHAN_MAX; - } - else { - texel[i][RCOMP] = CHAN_MAX; - texel[i][GCOMP] = CHAN_MAX; - texel[i][BCOMP] = CHAN_MAX; - texel[i][ACOMP] = CHAN_MAX; - } - } - else { - /* Do four depth/R comparisons and compute a weighted result. - * If this touches on somebody's I.P., I'll remove this code - * upon request. - */ - const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F; - GLfloat luminance = CHAN_MAXF; - GLchan lum; - if (lequal) { - if (depth00 <= r[i]) luminance -= d; - if (depth01 <= r[i]) luminance -= d; - if (depth10 <= r[i]) luminance -= d; - if (depth11 <= r[i]) luminance -= d; - } - else { - if (depth00 >= r[i]) luminance -= d; - if (depth01 >= r[i]) luminance -= d; - if (depth10 >= r[i]) luminance -= d; - if (depth11 >= r[i]) luminance -= d; - } - lum = (GLchan) luminance; - texel[i][RCOMP] = lum; - texel[i][GCOMP] = lum; - texel[i][BCOMP] = lum; - texel[i][ACOMP] = CHAN_MAX; - } - } - } -} - - -#if 0 -/* - * Experimental depth texture sampling function. - */ -static void -sample_depth_texture2(const GLcontext *ctx, - const struct gl_texture_unit *texUnit, - GLuint n, - const GLfloat s[], const GLfloat t[], const GLfloat r[], - GLchan texel[][4]) -{ - const struct gl_texture_object *texObj = texUnit->_Current; - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *texImage = texObj->Image[baseLevel]; - const GLuint width = texImage->Width; - const GLuint height = texImage->Height; - const GLchan ambient = texObj->ShadowAmbient; - GLboolean lequal, gequal; - - if (texObj->Dimensions != 2) { - _mesa_problem(ctx, "only 2-D depth textures supported at this time"); - return; - } - - if (texObj->MinFilter != texObj->MagFilter) { - _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); - return; - } - - /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if - * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object - * isn't a depth texture. + /* + * Must do all texture sampling before combining in order to + * accomodate GL_ARB_texture_env_crossbar. */ - if (texImage->Format != GL_DEPTH_COMPONENT) { - _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); - return; - } - - if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - lequal = GL_TRUE; - gequal = GL_FALSE; - } - else { - lequal = GL_FALSE; - gequal = GL_TRUE; - } - - { - GLuint i; - for (i = 0; i < n; i++) { - const GLint K = 3; - GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; - GLfloat w; - GLchan lum; - COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapS, s[i], width, col); - COMPUTE_NEAREST_TEXEL_LOCATION(texObj->WrapT, t[i], height, row); - - imin = col - K; - imax = col + K; - jmin = row - K; - jmax = row + K; - - if (imin < 0) imin = 0; - if (imax >= width) imax = width - 1; - if (jmin < 0) jmin = 0; - if (jmax >= height) jmax = height - 1; - - samples = (imax - imin + 1) * (jmax - jmin + 1); - count = 0; - for (jj = jmin; jj <= jmax; jj++) { - for (ii = imin; ii <= imax; ii++) { - GLfloat depthSample = *((const GLfloat *) texImage->Data - + jj * width + ii); - if ((depthSample <= r[i] && lequal) || - (depthSample >= r[i] && gequal)) { - count++; - } - } - } - - w = (GLfloat) count / (GLfloat) samples; - w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); - lum = (GLint) w; - - texel[i][RCOMP] = lum; - texel[i][GCOMP] = lum; - texel[i][BCOMP] = lum; - texel[i][ACOMP] = CHAN_MAX; - } - } -} -#endif - - -/* - * Apply a unit of texture mapping to the incoming fragments. - */ -void -_swrast_texture_fragments( GLcontext *ctx, GLuint texUnit, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat r[], GLfloat lambda[], - CONST GLchan primary_rgba[][4], GLchan rgba[][4] ) -{ - const GLuint mask = TEXTURE0_ANY << (texUnit * NUM_TEXTURE_TARGETS); - - if (ctx->Texture._ReallyEnabled & mask) { - const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; - - if (textureUnit->_Current) { /* XXX need this? */ - GLchan texel[PB_SIZE][4]; - - if (lambda) { - if (textureUnit->LodBias != 0.0F) { + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_object *curObj = texUnit->_Current; + GLfloat *lambda = span->array->lambda[unit]; + GLchan (*texels)[4] = (GLchan (*)[4]) + (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); + + /* adjust texture lod (lambda) */ + if (span->arrayMask | SPAN_LAMBDA) { + if (texUnit->LodBias != 0.0F) { /* apply LOD bias, but don't clamp yet */ GLuint i; - for (i=0;i<n;i++) { - lambda[i] += textureUnit->LodBias; + for (i = 0; i < span->end; i++) { + lambda[i] += texUnit->LodBias; } } - if (textureUnit->_Current->MinLod != -1000.0 || - textureUnit->_Current->MaxLod != 1000.0) { + if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { /* apply LOD clamping to lambda */ - const GLfloat min = textureUnit->_Current->MinLod; - const GLfloat max = textureUnit->_Current->MaxLod; + const GLfloat min = curObj->MinLod; + const GLfloat max = curObj->MaxLod; GLuint i; - for (i=0;i<n;i++) { + for (i = 0; i < span->end; i++) { GLfloat l = lambda[i]; lambda[i] = CLAMP(l, min, max); } } } - /* Sample the texture. */ - if (textureUnit->_Current->CompareFlag) { - /* depth texture */ - sample_depth_texture(ctx, textureUnit, n, s, t, r, texel); + /* Sample the texture (span->end fragments) */ + swrast->TextureSample[unit]( ctx, unit, texUnit->_Current, + span->end, span->array->texcoords[unit], + lambda, texels ); + } + } + + /* + * OK, now apply the texture (aka texture combine/blend). + * We modify the span->color.rgba values. + */ + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + if (texUnit->EnvMode == GL_COMBINE) { + /* GL_ARB/EXT_texture_env_combine */ + texture_combine( ctx, unit, span->end, + (CONST GLchan (*)[4]) primary_rgba, + swrast->TexelBuffer, + span->array->rgba ); + } + else if (texUnit->EnvMode == GL_COMBINE4_NV) { + /* GL_NV_texture_env_combine4 */ + texture_combine4( ctx, unit, span->end, + (CONST GLchan (*)[4]) primary_rgba, + swrast->TexelBuffer, + span->array->rgba ); } else { - /* color texture */ - SWRAST_CONTEXT(ctx)->TextureSample[texUnit]( ctx, texUnit, - textureUnit->_Current, - n, s, t, r, - lambda, texel ); - } - apply_texture( ctx, textureUnit, n, primary_rgba, - (const GLchan (*)[4]) texel, rgba ); + /* conventional texture blend */ + const GLchan (*texels)[4] = (const GLchan (*)[4]) + (swrast->TexelBuffer + unit * + (span->end * 4 * sizeof(GLchan))); + texture_apply( ctx, texUnit, span->end, + (CONST GLchan (*)[4]) primary_rgba, texels, + span->array->rgba ); + } } } } diff --git a/xc/extras/Mesa/src/swrast/s_texture.h b/xc/extras/Mesa/src/swrast/s_texture.h index c1b792094..0157071f1 100644 --- a/xc/extras/Mesa/src/swrast/s_texture.h +++ b/xc/extras/Mesa/src/swrast/s_texture.h @@ -1,10 +1,9 @@ -/* $Id: s_texture.h,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -40,10 +39,6 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, extern void -_swrast_texture_fragments( GLcontext *ctx, GLuint texSet, GLuint n, - const GLfloat s[], const GLfloat t[], - const GLfloat r[], GLfloat lambda[], - CONST GLchan primary_rgba[][4], GLchan rgba[][4] ); - +_swrast_texture_span( GLcontext *ctx, struct sw_span *span ); #endif diff --git a/xc/extras/Mesa/src/swrast/s_triangle.c b/xc/extras/Mesa/src/swrast/s_triangle.c index ad9e77926..a4efb679f 100644 --- a/xc/extras/Mesa/src/swrast/s_triangle.c +++ b/xc/extras/Mesa/src/swrast/s_triangle.c @@ -1,10 +1,9 @@ -/* $Id: s_triangle.c,v 1.1.1.1 2002/10/22 13:06:48 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -34,8 +33,8 @@ #include "glheader.h" #include "context.h" #include "colormac.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "texformat.h" #include "teximage.h" @@ -47,10 +46,11 @@ #include "s_feedback.h" #include "s_span.h" #include "s_triangle.h" -#include "s_trispan.h" - +/* + * Just used for feedback mode. + */ GLboolean _mesa_cull_triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, @@ -81,18 +81,12 @@ static void flat_ci_triangle( GLcontext *ctx, #define INTERP_Z 1 #define INTERP_FOG 1 -#define RENDER_SPAN( span ) \ - GLdepth zSpan[MAX_WIDTH]; \ - GLfloat fogSpan[MAX_WIDTH]; \ - GLuint i; \ - for (i = 0; i < span.count; i++) { \ - zSpan[i] = FixedToDepth(span.z); \ - span.z += span.zStep; \ - fogSpan[i] = span.fog; \ - span.fog += span.fogStep; \ - } \ - _mesa_write_monoindex_span(ctx, span.count, span.x, span.y, \ - zSpan, fogSpan, v2->index, NULL, GL_POLYGON ); +#define SETUP_CODE \ + span.interpMask |= SPAN_INDEX; \ + span.index = IntToFixed(v2->index); \ + span.indexStep = 0; + +#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span); #include "s_tritemp.h" } @@ -111,21 +105,7 @@ static void smooth_ci_triangle( GLcontext *ctx, #define INTERP_FOG 1 #define INTERP_INDEX 1 -#define RENDER_SPAN( span ) \ - GLdepth zSpan[MAX_WIDTH]; \ - GLfloat fogSpan[MAX_WIDTH]; \ - GLuint indexSpan[MAX_WIDTH]; \ - GLuint i; \ - for (i = 0; i < span.count; i++) { \ - zSpan[i] = FixedToDepth(span.z); \ - span.z += span.zStep; \ - indexSpan[i] = FixedToInt(span.index); \ - span.index += span.indexStep; \ - fogSpan[i] = span.fog; \ - span.fog += span.fogStep; \ - } \ - _mesa_write_index_span(ctx, span.count, span.x, span.y, \ - zSpan, fogSpan, indexSpan, NULL, GL_POLYGON); +#define RENDER_SPAN( span ) _mesa_write_index_span(ctx, &span); #include "s_tritemp.h" } @@ -144,23 +124,22 @@ static void flat_rgba_triangle( GLcontext *ctx, #define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define RENDER_SPAN( span ) \ - GLdepth zSpan[MAX_WIDTH]; \ - GLfloat fogSpan[MAX_WIDTH]; \ - GLuint i; \ - for (i = 0; i < span.count; i++) { \ - zSpan[i] = FixedToDepth(span.z); \ - span.z += span.zStep; \ - fogSpan[i] = span.fog; \ - span.fog += span.fogStep; \ - } \ - _mesa_write_monocolor_span(ctx, span.count, span.x, span.y, zSpan, \ - fogSpan, v2->color, NULL, GL_POLYGON ); +#define SETUP_CODE \ + ASSERT(ctx->Texture._EnabledUnits == 0); \ + ASSERT(ctx->Light.ShadeModel==GL_FLAT); \ + span.interpMask |= SPAN_RGBA; \ + span.red = ChanToFixed(v2->color[0]); \ + span.green = ChanToFixed(v2->color[1]); \ + span.blue = ChanToFixed(v2->color[2]); \ + span.alpha = ChanToFixed(v2->color[3]); \ + span.redStep = 0; \ + span.greenStep = 0; \ + span.blueStep = 0; \ + span.alphaStep = 0; + +#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span); #include "s_tritemp.h" - - ASSERT(!ctx->Texture._ReallyEnabled); /* texturing must be off */ - ASSERT(ctx->Light.ShadeModel==GL_FLAT); } @@ -180,33 +159,17 @@ static void smooth_rgba_triangle( GLcontext *ctx, #define INTERP_RGB 1 #define INTERP_ALPHA 1 -#define RENDER_SPAN( span ) \ - GLdepth zSpan[MAX_WIDTH]; \ - GLchan rgbaSpan[MAX_WIDTH][4]; \ - GLfloat fogSpan[MAX_WIDTH]; \ - GLuint i; \ - for (i = 0; i < span.count; i++) { \ - rgbaSpan[i][RCOMP] = FixedToChan(span.red); \ - rgbaSpan[i][GCOMP] = FixedToChan(span.green); \ - rgbaSpan[i][BCOMP] = FixedToChan(span.blue); \ - rgbaSpan[i][ACOMP] = FixedToChan(span.alpha); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.alpha += span.alphaStep; \ - zSpan[i] = FixedToDepth(span.z); \ - span.z += span.zStep; \ - fogSpan[i] = span.fog; \ - span.fog += span.fogStep; \ - } \ - _mesa_write_rgba_span(ctx, span.count, span.x, span.y, \ - (CONST GLdepth *) zSpan, \ - fogSpan, rgbaSpan, NULL, GL_POLYGON); +#define SETUP_CODE \ + { \ + /* texturing must be off */ \ + ASSERT(ctx->Texture._EnabledUnits == 0); \ + ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \ + } + +#define RENDER_SPAN( span ) _mesa_write_rgba_span(ctx, &span); #include "s_tritemp.h" - ASSERT(!ctx->Texture._ReallyEnabled); /* texturing must be off */ - ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); } @@ -228,7 +191,7 @@ static void simple_textured_triangle( GLcontext *ctx, #define SETUP_CODE \ SWcontext *swrast = SWRAST_CONTEXT(ctx); \ struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ - GLint b = obj->BaseLevel; \ + const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ @@ -241,23 +204,23 @@ static void simple_textured_triangle( GLcontext *ctx, } #define RENDER_SPAN( span ) \ - GLchan rgbSpan[MAX_WIDTH][3]; \ GLuint i; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ GLint s = FixedToInt(span.intTex[0]) & smask; \ GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ - rgbSpan[i][RCOMP] = texture[pos]; \ - rgbSpan[i][GCOMP] = texture[pos+1]; \ - rgbSpan[i][BCOMP] = texture[pos+2]; \ + span.array->rgb[i][RCOMP] = texture[pos]; \ + span.array->rgb[i][GCOMP] = texture[pos+1]; \ + span.array->rgb[i][BCOMP] = texture[pos+2]; \ span.intTex[0] += span.intTexStep[0]; \ span.intTex[1] += span.intTexStep[1]; \ } \ - (*swrast->Driver.WriteRGBSpan)(ctx, span.count, span.x, span.y, \ - (CONST GLchan (*)[3]) rgbSpan, NULL ); + (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \ + (CONST GLchan (*)[3]) span.array->rgb,\ + NULL ); #include "s_tritemp.h" } @@ -284,46 +247,45 @@ static void simple_z_textured_triangle( GLcontext *ctx, #define SETUP_CODE \ SWcontext *swrast = SWRAST_CONTEXT(ctx); \ 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; \ - GLint twidth_log2 = obj->Image[b]->WidthLog2; \ + const GLint b = obj->BaseLevel; \ + const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ + const GLint twidth_log2 = obj->Image[b]->WidthLog2; \ const GLchan *texture = (const GLchan *) obj->Image[b]->Data; \ - GLint smask = obj->Image[b]->Width - 1; \ - GLint tmask = obj->Image[b]->Height - 1; \ + const GLint smask = obj->Image[b]->Width - 1; \ + const GLint tmask = obj->Image[b]->Height - 1; \ if (!texture) { \ /* this shouldn't happen */ \ return; \ } #define RENDER_SPAN( span ) \ - GLchan rgbSpan[MAX_WIDTH][3]; \ - GLubyte mask[MAX_WIDTH]; \ GLuint i; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ const GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ GLint s = FixedToInt(span.intTex[0]) & smask; \ GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ - rgbSpan[i][RCOMP] = texture[pos]; \ - rgbSpan[i][GCOMP] = texture[pos+1]; \ - rgbSpan[i][BCOMP] = texture[pos+2]; \ + span.array->rgb[i][RCOMP] = texture[pos]; \ + span.array->rgb[i][GCOMP] = texture[pos+1]; \ + span.array->rgb[i][BCOMP] = texture[pos+2]; \ zRow[i] = z; \ - mask[i] = 1; \ + span.array->mask[i] = 1; \ } \ else { \ - mask[i] = 0; \ + span.array->mask[i] = 0; \ } \ span.intTex[0] += span.intTexStep[0]; \ span.intTex[1] += span.intTexStep[1]; \ span.z += span.zStep; \ } \ - (*swrast->Driver.WriteRGBSpan)(ctx, span.count, span.x, span.y, \ - (CONST GLchan (*)[3]) rgbSpan, mask ); + (*swrast->Driver.WriteRGBSpan)(ctx, span.end, span.x, span.y, \ + (CONST GLchan (*)[3]) span.array->rgb,\ + span.array->mask ); #include "s_tritemp.h" } @@ -341,7 +303,6 @@ struct affine_info const GLchan *texture; GLfixed er, eg, eb, ea; GLint tbytesline, tsize; - GLint fixedToDepthShift; }; @@ -349,8 +310,8 @@ struct affine_info * textures with GL_REPLACE, GL_MODULATE, GL_BLEND, GL_DECAL or GL_ADD * texture env modes. */ -static void -affine_span(GLcontext *ctx, struct triangle_span *span, +static INLINE void +affine_span(GLcontext *ctx, struct sw_span *span, struct affine_info *info) { GLchan sample[4]; /* the filtered texture sample */ @@ -388,7 +349,7 @@ affine_span(GLcontext *ctx, struct triangle_span *span, sample[ACOMP] = (ti * (si * tex00[3] + sf * tex01[3]) + \ tf * (si * tex10[3] + sf * tex11[3])) >> 2 * FIXED_SHIFT -#define MODULATE \ +#define MODULATE \ dest[RCOMP] = span->red * (sample[RCOMP] + 1u) >> (FIXED_SHIFT + 8); \ dest[GCOMP] = span->green * (sample[GCOMP] + 1u) >> (FIXED_SHIFT + 8); \ dest[BCOMP] = span->blue * (sample[BCOMP] + 1u) >> (FIXED_SHIFT + 8); \ @@ -440,17 +401,13 @@ affine_span(GLcontext *ctx, struct triangle_span *span, #define NEAREST_RGBA_REPLACE COPY_CHAN4(dest, tex00) #define SPAN_NEAREST(DO_TEX,COMP) \ - for (i = 0; i < span->count; i++) { \ + for (i = 0; i < span->end; i++) { \ /* Isn't it necessary to use FixedFloor below?? */ \ GLint s = FixedToInt(span->intTex[0]) & info->smask; \ GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ GLint pos = (t << info->twidth_log2) + s; \ const GLchan *tex00 = info->texture + COMP * pos; \ - zspan[i] = FixedToDepth(span->z); \ - fogspan[i] = span->fog; \ DO_TEX; \ - span->fog += span->fogStep; \ - span->z += span->zStep; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ @@ -461,7 +418,7 @@ affine_span(GLcontext *ctx, struct triangle_span *span, } #define SPAN_LINEAR(DO_TEX,COMP) \ - for (i = 0; i < span->count; i++) { \ + for (i = 0; i < span->end; i++) { \ /* Isn't it necessary to use FixedFloor below?? */ \ GLint s = FixedToInt(span->intTex[0]) & info->smask; \ GLint t = FixedToInt(span->intTex[1]) & info->tmask; \ @@ -484,11 +441,7 @@ affine_span(GLcontext *ctx, struct triangle_span *span, tex01 -= info->tbytesline; \ tex11 -= info->tbytesline; \ } \ - zspan[i] = FixedToDepth(span->z); \ - fogspan[i] = span->fog; \ DO_TEX; \ - span->fog += span->fogStep; \ - span->z += span->zStep; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ @@ -498,14 +451,9 @@ affine_span(GLcontext *ctx, struct triangle_span *span, dest += 4; \ } -#define FixedToDepth(F) ((F) >> fixedToDepthShift) GLuint i; - GLdepth zspan[MAX_WIDTH]; - GLfloat fogspan[MAX_WIDTH]; - GLchan rgba[MAX_WIDTH][4]; - GLchan *dest = rgba[0]; - const GLint fixedToDepthShift = info->fixedToDepthShift; + GLchan *dest = span->array->rgba[0]; span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; @@ -528,7 +476,8 @@ affine_span(GLcontext *ctx, struct triangle_span *span, SPAN_NEAREST(NEAREST_RGB;ADD,3); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode in SPAN_LINEAR"); + return; } break; case GL_RGBA: @@ -549,7 +498,8 @@ affine_span(GLcontext *ctx, struct triangle_span *span, SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode (2) in SPAN_LINEAR"); + return; } break; } @@ -575,7 +525,8 @@ affine_span(GLcontext *ctx, struct triangle_span *span, SPAN_LINEAR(LINEAR_RGB;ADD,3); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode (3) in SPAN_LINEAR"); + return; } break; case GL_RGBA: @@ -596,17 +547,19 @@ affine_span(GLcontext *ctx, struct triangle_span *span, SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); break; default: - abort(); - } break; + _mesa_problem(ctx, "bad tex env mode (4) in SPAN_LINEAR"); + return; + } + break; } break; } - _mesa_write_rgba_span(ctx, span->count, span->x, span->y, - zspan, fogspan, rgba, NULL, GL_POLYGON); + span->interpMask &= ~SPAN_RGBA; + ASSERT(span->arrayMask & SPAN_RGBA); + _mesa_write_rgba_span(ctx, span); #undef SPAN_NEAREST #undef SPAN_LINEAR -#undef FixedToDepth } @@ -632,10 +585,9 @@ static void affine_textured_triangle( GLcontext *ctx, struct affine_info info; \ struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ 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; \ - info.fixedToDepthShift = ctx->Visual.depthBits <= 16 ? FIXED_SHIFT : 0;\ + const GLint b = obj->BaseLevel; \ + const GLfloat twidth = (GLfloat) obj->Image[b]->Width; \ + const GLfloat theight = (GLfloat) obj->Image[b]->Height; \ info.texture = (const GLchan *) obj->Image[b]->Data; \ info.twidth_log2 = obj->Image[b]->WidthLog2; \ info.smask = obj->Image[b]->Width - 1; \ @@ -643,6 +595,7 @@ static void affine_textured_triangle( GLcontext *ctx, info.format = obj->Image[b]->Format; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ + span.arrayMask |= SPAN_RGBA; \ \ if (info.envmode == GL_BLEND) { \ /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ @@ -695,12 +648,11 @@ struct persp_info const GLchan *texture; GLfixed er, eg, eb, ea; /* texture env color */ GLint tbytesline, tsize; - GLint fixedToDepthShift; }; -static void -fast_persp_span(GLcontext *ctx, struct triangle_span *span, +static INLINE void +fast_persp_span(GLcontext *ctx, struct sw_span *span, struct persp_info *info) { GLchan sample[4]; /* the filtered texture sample */ @@ -711,7 +663,7 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, * unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). */ #define SPAN_NEAREST(DO_TEX,COMP) \ - for (i = 0; i < span->count; i++) { \ + for (i = 0; i < span->end; i++) { \ GLdouble invQ = tex_coord[2] ? \ (1.0 / tex_coord[2]) : 1.0; \ GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ @@ -720,11 +672,7 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, GLint t = IFLOOR(t_tmp) & info->tmask; \ GLint pos = (t << info->twidth_log2) + s; \ const GLchan *tex00 = info->texture + COMP * pos; \ - zspan[i] = FixedToDepth(span->z); \ - fogspan[i] = span->fog; \ DO_TEX; \ - span->fog += span->fogStep; \ - span->z += span->zStep; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ @@ -736,7 +684,7 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, } #define SPAN_LINEAR(DO_TEX,COMP) \ - for (i = 0; i < span->count; i++) { \ + for (i = 0; i < span->end; i++) { \ GLdouble invQ = tex_coord[2] ? \ (1.0 / tex_coord[2]) : 1.0; \ GLfloat s_tmp = (GLfloat) (tex_coord[0] * invQ); \ @@ -764,11 +712,7 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, tex01 -= info->tbytesline; \ tex11 -= info->tbytesline; \ } \ - zspan[i] = FixedToDepth(span->z); \ - fogspan[i] = span->fog; \ DO_TEX; \ - span->fog += span->fogStep; \ - span->z += span->zStep; \ span->red += span->redStep; \ span->green += span->greenStep; \ span->blue += span->blueStep; \ @@ -779,23 +723,17 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, dest += 4; \ } -#define FixedToDepth(F) ((F) >> fixedToDepthShift) - GLuint i; - GLdepth zspan[MAX_WIDTH]; GLfloat tex_coord[3], tex_step[3]; - GLfloat fogspan[MAX_WIDTH]; - GLchan rgba[MAX_WIDTH][4]; - GLchan *dest = rgba[0]; - const GLint fixedToDepthShift = info->fixedToDepthShift; - - tex_coord[0] = span->tex[0][0] * (info->smask + 1), - tex_step[0] = span->texStep[0][0] * (info->smask + 1); - tex_coord[1] = span->tex[0][1] * (info->tmask + 1), - tex_step[1] = span->texStep[0][1] * (info->tmask + 1); + GLchan *dest = span->array->rgba[0]; + + tex_coord[0] = span->tex[0][0] * (info->smask + 1); + tex_step[0] = span->texStepX[0][0] * (info->smask + 1); + tex_coord[1] = span->tex[0][1] * (info->tmask + 1); + tex_step[1] = span->texStepX[0][1] * (info->tmask + 1); /* span->tex[0][2] only if 3D-texturing, here only 2D */ - tex_coord[2] = span->tex[0][3], - tex_step[2] = span->texStep[0][3]; + tex_coord[2] = span->tex[0][3]; + tex_step[2] = span->texStepX[0][3]; switch (info->filter) { case GL_NEAREST: @@ -816,7 +754,8 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, SPAN_NEAREST(NEAREST_RGB;ADD,3); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode (5) in SPAN_LINEAR"); + return; } break; case GL_RGBA: @@ -837,7 +776,8 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, SPAN_NEAREST(NEAREST_RGBA_REPLACE,4); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode (6) in SPAN_LINEAR"); + return; } break; } @@ -861,7 +801,8 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, SPAN_LINEAR(LINEAR_RGB;ADD,3); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode (7) in SPAN_LINEAR"); + return; } break; case GL_RGBA: @@ -882,25 +823,19 @@ fast_persp_span(GLcontext *ctx, struct triangle_span *span, SPAN_LINEAR(LINEAR_RGBA;REPLACE,4); break; default: - abort(); + _mesa_problem(ctx, "bad tex env mode (8) in SPAN_LINEAR"); + return; } break; } break; } - /* This does not seem to be necessary, but I don't know !! */ - /* span->tex[0][0] = tex_coord[0] / (info->smask + 1), - span->tex[0][1] = tex_coord[1] / (info->tmask + 1),*/ - /* span->tex[0][2] only if 3D-texturing, here only 2D */ - /* span->tex[0][3] = tex_coord[2]; */ - _mesa_write_rgba_span(ctx, span->count, span->x, span->y, - zspan, fogspan, rgba, NULL, GL_POLYGON); - + ASSERT(span->arrayMask & SPAN_RGBA); + _mesa_write_rgba_span(ctx, span); #undef SPAN_NEAREST #undef SPAN_LINEAR -#undef FixedToDepth } @@ -924,10 +859,9 @@ static void persp_textured_triangle( GLcontext *ctx, #define SETUP_CODE \ struct persp_info info; \ - struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - struct gl_texture_object *obj = unit->Current2D; \ - GLint b = obj->BaseLevel; \ - info.fixedToDepthShift = ctx->Visual.depthBits <= 16 ? FIXED_SHIFT : 0;\ + const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ + const struct gl_texture_object *obj = unit->Current2D; \ + const GLint b = obj->BaseLevel; \ info.texture = (const GLchan *) obj->Image[b]->Data; \ info.twidth_log2 = obj->Image[b]->WidthLog2; \ info.smask = obj->Image[b]->Width - 1; \ @@ -969,7 +903,10 @@ static void persp_textured_triangle( GLcontext *ctx, } \ info.tsize = obj->Image[b]->Height * info.tbytesline; -#define RENDER_SPAN( span ) fast_persp_span(ctx, &span, &info); +#define RENDER_SPAN( span ) \ + span.interpMask &= ~SPAN_RGBA; \ + span.arrayMask |= SPAN_RGBA; \ + fast_persp_span(ctx, &span, &info); #include "s_tritemp.h" @@ -978,335 +915,6 @@ static void persp_textured_triangle( GLcontext *ctx, #endif /* CHAN_BITS != GL_FLOAT */ - -/* - * Generate arrays of fragment colors, z, fog, texcoords, etc from a - * triangle span object. Then call the span/fragment processsing - * functions in s_span.[ch]. This is used by a bunch of the textured - * triangle functions. - */ -static void -rasterize_span(GLcontext *ctx, const struct triangle_span *span) -{ - DEFMARRAY(GLchan, rgba, MAX_WIDTH, 4); - DEFMARRAY(GLchan, spec, MAX_WIDTH, 4); - DEFARRAY(GLuint, index, MAX_WIDTH); - DEFARRAY(GLuint, z, MAX_WIDTH); - DEFARRAY(GLfloat, fog, MAX_WIDTH); - DEFARRAY(GLfloat, sTex, MAX_WIDTH); - DEFARRAY(GLfloat, tTex, MAX_WIDTH); - DEFARRAY(GLfloat, rTex, MAX_WIDTH); - DEFARRAY(GLfloat, lambda, MAX_WIDTH); - DEFMARRAY(GLfloat, msTex, MAX_TEXTURE_UNITS, MAX_WIDTH); - DEFMARRAY(GLfloat, mtTex, MAX_TEXTURE_UNITS, MAX_WIDTH); - DEFMARRAY(GLfloat, mrTex, MAX_TEXTURE_UNITS, MAX_WIDTH); - DEFMARRAY(GLfloat, mLambda, MAX_TEXTURE_UNITS, MAX_WIDTH); - - CHECKARRAY(rgba, return); - CHECKARRAY(spec, return); - CHECKARRAY(index, return); - CHECKARRAY(z, return); - CHECKARRAY(fog, return); - CHECKARRAY(sTex, return); - CHECKARRAY(tTex, return); - CHECKARRAY(rTex, return); - CHECKARRAY(lambda, return); - CHECKARRAY(msTex, return); - CHECKARRAY(mtTex, return); - CHECKARRAY(mrTex, return); - CHECKARRAY(mLambda, return); - - if (span->activeMask & SPAN_RGBA) { - if (span->activeMask & SPAN_FLAT) { - GLuint i; - GLchan color[4]; - color[RCOMP] = FixedToChan(span->red); - color[GCOMP] = FixedToChan(span->green); - color[BCOMP] = FixedToChan(span->blue); - color[ACOMP] = FixedToChan(span->alpha); - for (i = 0; i < span->count; i++) { - COPY_CHAN4(rgba[i], color); - } - } - else { - /* smooth interpolation */ -#if CHAN_TYPE == GL_FLOAT - GLfloat r = span->red; - GLfloat g = span->green; - GLfloat b = span->blue; - GLfloat a = span->alpha; -#else - GLfixed r = span->red; - GLfixed g = span->green; - GLfixed b = span->blue; - GLfixed a = span->alpha; -#endif - GLuint i; - for (i = 0; i < span->count; i++) { - rgba[i][RCOMP] = FixedToChan(r); - rgba[i][GCOMP] = FixedToChan(g); - rgba[i][BCOMP] = FixedToChan(b); - rgba[i][ACOMP] = FixedToChan(a); - r += span->redStep; - g += span->greenStep; - b += span->blueStep; - a += span->alphaStep; - } - } - } - - if (span->activeMask & SPAN_SPEC) { - if (span->activeMask & SPAN_FLAT) { - const GLchan r = FixedToChan(span->specRed); - const GLchan g = FixedToChan(span->specGreen); - const GLchan b = FixedToChan(span->specBlue); - GLuint i; - for (i = 0; i < span->count; i++) { - spec[i][RCOMP] = r; - spec[i][GCOMP] = g; - spec[i][BCOMP] = b; - } - } - else { - /* smooth interpolation */ -#if CHAN_TYPE == GL_FLOAT - GLfloat r = span->specRed; - GLfloat g = span->specGreen; - GLfloat b = span->specBlue; -#else - GLfixed r = span->specRed; - GLfixed g = span->specGreen; - GLfixed b = span->specBlue; -#endif - GLuint i; - for (i = 0; i < span->count; i++) { - spec[i][RCOMP] = FixedToChan(r); - spec[i][GCOMP] = FixedToChan(g); - spec[i][BCOMP] = FixedToChan(b); - r += span->specRedStep; - g += span->specGreenStep; - b += span->specBlueStep; - } - } - } - - if (span->activeMask & SPAN_INDEX) { - if (span->activeMask & SPAN_FLAT) { - GLuint i; - const GLint indx = FixedToInt(span->index); - for (i = 0; i < span->count; i++) { - index[i] = indx; - } - } - else { - /* smooth interpolation */ - GLuint i; - GLfixed ind = span->index; - for (i = 0; i < span->count; i++) { - index[i] = FixedToInt(ind); - ind += span->indexStep; - } - } - } - - if (span->activeMask & SPAN_Z) { - if (ctx->Visual.depthBits <= 16) { - GLuint i; - GLfixed zval = span->z; - for (i = 0; i < span->count; i++) { - z[i] = FixedToInt(zval); - zval += span->zStep; - } - } - else { - /* Deep Z buffer, no fixed->int shift */ - GLuint i; - GLfixed zval = span->z; - for (i = 0; i < span->count; i++) { - z[i] = zval; - zval += span->zStep; - } - } - } - if (span->activeMask & SPAN_FOG) { - GLuint i; - GLfloat f = span->fog; - for (i = 0; i < span->count; i++) { - fog[i] = f; - f += span->fogStep; - } - } - if (span->activeMask & SPAN_TEXTURE) { - if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) { - /* multitexture */ - if (span->activeMask & SPAN_LAMBDA) { - /* with lambda */ - GLuint u; - for (u = 0; u < MAX_TEXTURE_UNITS; u++) { - if (ctx->Texture.Unit[u]._ReallyEnabled) { - GLfloat s = span->tex[u][0]; - GLfloat t = span->tex[u][1]; - GLfloat r = span->tex[u][2]; - GLfloat q = span->tex[u][3]; - GLuint i; - for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); - msTex[u][i] = s * invQ; - mtTex[u][i] = t * invQ; - mrTex[u][i] = r * invQ; - mLambda[u][i] = (GLfloat) - (log(span->rho[u] * invQ * invQ) * 1.442695F * 0.5F); - s += span->texStep[u][0]; - t += span->texStep[u][1]; - r += span->texStep[u][2]; - q += span->texStep[u][3]; - } - } - } - } - else { - /* without lambda */ - GLuint u; - for (u = 0; u < MAX_TEXTURE_UNITS; u++) { - if (ctx->Texture.Unit[u]._ReallyEnabled) { - GLfloat s = span->tex[u][0]; - GLfloat t = span->tex[u][1]; - GLfloat r = span->tex[u][2]; - GLfloat q = span->tex[u][3]; - GLuint i; - for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); - msTex[u][i] = s * invQ; - mtTex[u][i] = t * invQ; - mrTex[u][i] = r * invQ; - s += span->texStep[u][0]; - t += span->texStep[u][1]; - r += span->texStep[u][2]; - q += span->texStep[u][3]; - } - } - } - } - } - else { - /* just texture unit 0 */ - if (span->activeMask & SPAN_LAMBDA) { - /* with lambda */ - GLfloat s = span->tex[0][0]; - GLfloat t = span->tex[0][1]; - GLfloat r = span->tex[0][2]; - GLfloat q = span->tex[0][3]; - GLuint i; - for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); - sTex[i] = s * invQ; - tTex[i] = t * invQ; - rTex[i] = r * invQ; - lambda[i] = (GLfloat) - (log(span->rho[0] * invQ * invQ) * 1.442695F * 0.5F); - s += span->texStep[0][0]; - t += span->texStep[0][1]; - r += span->texStep[0][2]; - q += span->texStep[0][3]; - } - } - else { - /* without lambda */ - GLfloat s = span->tex[0][0]; - GLfloat t = span->tex[0][1]; - GLfloat r = span->tex[0][2]; - GLfloat q = span->tex[0][3]; - GLuint i; - for (i = 0; i < span->count; i++) { - const GLfloat invQ = (q == 0.0F) ? 1.0F : (1.0F / q); - sTex[i] = s * invQ; - tTex[i] = t * invQ; - rTex[i] = r * invQ; - s += span->texStep[0][0]; - t += span->texStep[0][1]; - r += span->texStep[0][2]; - q += span->texStep[0][3]; - } - } - } - } - /* XXX keep this? */ - if (span->activeMask & SPAN_INT_TEXTURE) { - GLint intTexcoord[MAX_WIDTH][2]; - GLfixed s = span->intTex[0]; - GLfixed t = span->intTex[1]; - GLuint i; - for (i = 0; i < span->count; i++) { - intTexcoord[i][0] = FixedToInt(s); - intTexcoord[i][1] = FixedToInt(t); - s += span->intTexStep[0]; - t += span->intTexStep[1]; - } - } - - /* examine activeMask and call a s_span.c function */ - if (span->activeMask & SPAN_TEXTURE) { - const GLfloat *fogPtr; - if (span->activeMask & SPAN_FOG) - fogPtr = fog; - else - fogPtr = NULL; - - if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) { - if (span->activeMask & SPAN_SPEC) { - _mesa_write_multitexture_span(ctx, span->count, span->x, span->y, - z, fogPtr, - (const GLfloat (*)[MAX_WIDTH]) msTex, - (const GLfloat (*)[MAX_WIDTH]) mtTex, - (const GLfloat (*)[MAX_WIDTH]) mrTex, - (GLfloat (*)[MAX_WIDTH]) mLambda, - rgba, (CONST GLchan (*)[4]) spec, - NULL, GL_POLYGON ); - } - else { - _mesa_write_multitexture_span(ctx, span->count, span->x, span->y, - z, fogPtr, - (const GLfloat (*)[MAX_WIDTH]) msTex, - (const GLfloat (*)[MAX_WIDTH]) mtTex, - (const GLfloat (*)[MAX_WIDTH]) mrTex, - (GLfloat (*)[MAX_WIDTH]) mLambda, - rgba, NULL, NULL, GL_POLYGON); - } - } - else { - /* single texture */ - if (span->activeMask & SPAN_SPEC) { - _mesa_write_texture_span(ctx, span->count, span->x, span->y, - z, fogPtr, sTex, tTex, rTex, lambda, - rgba, (CONST GLchan (*)[4]) spec, - NULL, GL_POLYGON); - } - else { - _mesa_write_texture_span(ctx, span->count, span->x, span->y, - z, fogPtr, sTex, tTex, rTex, lambda, - rgba, NULL, NULL, GL_POLYGON); - } - } - } - else { - _mesa_problem(ctx, "rasterize_span() should only be used for texturing"); - } - - UNDEFARRAY(rgba); - UNDEFARRAY(spec); - UNDEFARRAY(index); - UNDEFARRAY(z); - UNDEFARRAY(fog); - UNDEFARRAY(sTex); - UNDEFARRAY(tTex); - UNDEFARRAY(rTex); - UNDEFARRAY(lambda); - UNDEFARRAY(msTex); - UNDEFARRAY(mtTex); - UNDEFARRAY(mrTex); - UNDEFARRAY(mLambda); -} - @@ -1323,173 +931,27 @@ static void general_textured_triangle( GLcontext *ctx, #define INTERP_FOG 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define INTERP_TEX 1 - -#define SETUP_CODE \ - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; \ - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\ - DEFARRAY(GLfloat, sSpan, MAX_WIDTH); /* mac 32k limitation */ \ - DEFARRAY(GLfloat, tSpan, MAX_WIDTH); /* mac 32k limitation */ \ - DEFARRAY(GLfloat, uSpan, MAX_WIDTH); /* mac 32k limitation */ \ - CHECKARRAY(sSpan, return); /* mac 32k limitation */ \ - CHECKARRAY(tSpan, return); /* mac 32k limitation */ \ - CHECKARRAY(uSpan, return); /* mac 32k limitation */ \ - span.texWidth[0] = (GLfloat) texImage->Width; \ - span.texHeight[0] = (GLfloat) texImage->Height; \ - (void) fixedToDepthShift; - -#define RENDER_SPAN( span ) \ - GLdepth zSpan[MAX_WIDTH]; \ - GLfloat fogSpan[MAX_WIDTH]; \ - GLchan rgbaSpan[MAX_WIDTH][4]; \ - GLuint i; \ - /* NOTE: we could just call rasterize_span() here instead */ \ - for (i = 0; i < span.count; i++) { \ - GLdouble invQ = span.tex[0][3] ? (1.0 / span.tex[0][3]) : 1.0; \ - zSpan[i] = FixedToDepth(span.z); \ - span.z += span.zStep; \ - fogSpan[i] = span.fog; \ - span.fog += span.fogStep; \ - rgbaSpan[i][RCOMP] = FixedToChan(span.red); \ - rgbaSpan[i][GCOMP] = FixedToChan(span.green); \ - rgbaSpan[i][BCOMP] = FixedToChan(span.blue); \ - rgbaSpan[i][ACOMP] = FixedToChan(span.alpha); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.alpha += span.alphaStep; \ - sSpan[i] = (GLfloat) (span.tex[0][0] * invQ); \ - tSpan[i] = (GLfloat) (span.tex[0][1] * invQ); \ - uSpan[i] = (GLfloat) (span.tex[0][2] * invQ); \ - span.tex[0][0] += span.texStep[0][0]; \ - span.tex[0][1] += span.texStep[0][1]; \ - span.tex[0][2] += span.texStep[0][2]; \ - span.tex[0][3] += span.texStep[0][3]; \ - } \ - _mesa_write_texture_span(ctx, span.count, span.x, span.y, \ - zSpan, fogSpan, sSpan, tSpan, uSpan, \ - NULL, rgbaSpan, NULL, NULL, GL_POLYGON ); - -#define CLEANUP_CODE \ - UNDEFARRAY(sSpan); /* mac 32k limitation */ \ - UNDEFARRAY(tSpan); \ - UNDEFARRAY(uSpan); - -#include "s_tritemp.h" -} - - -/* - * Render a smooth-shaded, textured, RGBA triangle with separate specular - * color interpolation. - * Interpolate texcoords with perspective correction, w/out mipmapping. - */ -static void general_textured_spec_triangle( GLcontext *ctx, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2 ) -{ -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 #define INTERP_SPEC 1 #define INTERP_ALPHA 1 #define INTERP_TEX 1 -#define SETUP_CODE \ - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; \ - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\ - span.texWidth[0] = (GLfloat) texImage->Width; \ - span.texHeight[0] = (GLfloat) texImage->Height; \ - (void) fixedToDepthShift; - -#define RENDER_SPAN( span ) rasterize_span(ctx, &span); - -#include "s_tritemp.h" -} - - -/* - * Render a smooth-shaded, textured, RGBA triangle. - * Interpolate S,T,R with perspective correction and compute lambda for - * each fragment. Lambda is used to determine whether to use the - * minification or magnification filter. If minification and using - * mipmaps, lambda is also used to select the texture level of detail. - */ -static void lambda_textured_triangle( GLcontext *ctx, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2 ) -{ -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define INTERP_ALPHA 1 -#define INTERP_TEX 1 -#define INTERP_LAMBDA 1 - -#define SETUP_CODE \ - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; \ - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\ - span.texWidth[0] = (GLfloat) texImage->Width; \ - span.texHeight[0] = (GLfloat) texImage->Height; \ - (void) fixedToDepthShift; - -#define RENDER_SPAN( span ) rasterize_span(ctx, &span); +#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span); #include "s_tritemp.h" } -/* - * Render a smooth-shaded, textured, RGBA triangle with separate specular - * interpolation. - * Interpolate S,T,R with perspective correction and compute lambda for - * each fragment. Lambda is used to determine whether to use the - * minification or magnification filter. If minification and using - * mipmaps, lambda is also used to select the texture level of detail. - */ -static void lambda_textured_spec_triangle( GLcontext *ctx, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2 ) -{ -#define INTERP_Z 1 -#define INTERP_FOG 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define INTERP_SPEC 1 -#define INTERP_ALPHA 1 -#define INTERP_TEX 1 -#define INTERP_LAMBDA 1 - -#define SETUP_CODE \ - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; \ - const struct gl_texture_image *texImage = obj->Image[obj->BaseLevel];\ - span.texWidth[0] = (GLfloat) texImage->Width; \ - span.texHeight[0] = (GLfloat) texImage->Height; \ - (void) fixedToDepthShift; - -#define RENDER_SPAN( span ) rasterize_span(ctx, &span); - -#include "s_tritemp.h" -} - /* * This is the big one! - * Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates - * with lambda (LOD). + * Interpolate Z, RGB, Alpha, specular, fog, and N sets of texture coordinates. * Yup, it's slow. */ static void -lambda_multitextured_triangle( GLcontext *ctx, - const SWvertex *v0, - const SWvertex *v1, - const SWvertex *v2 ) +multitextured_triangle( GLcontext *ctx, + const SWvertex *v0, + const SWvertex *v1, + const SWvertex *v2 ) { #define INTERP_Z 1 @@ -1499,23 +961,8 @@ lambda_multitextured_triangle( GLcontext *ctx, #define INTERP_ALPHA 1 #define INTERP_SPEC 1 #define INTERP_MULTITEX 1 -#define INTERP_LAMBDA 1 -#define SETUP_CODE \ - GLuint u; \ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \ - if (ctx->Texture.Unit[u]._ReallyEnabled) { \ - const struct gl_texture_object *texObj; \ - const struct gl_texture_image *texImage; \ - texObj = ctx->Texture.Unit[u]._Current; \ - texImage = texObj->Image[texObj->BaseLevel]; \ - span.texWidth[u] = (GLfloat) texImage->Width; \ - span.texHeight[u] = (GLfloat) texImage->Height; \ - } \ - } \ - (void) fixedToDepthShift; - -#define RENDER_SPAN( span ) rasterize_span(ctx, &span); +#define RENDER_SPAN( span ) _mesa_write_texture_span(ctx, &span); #include "s_tritemp.h" @@ -1537,7 +984,7 @@ static void occlusion_zless_triangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - for (i = 0; i < span.count; i++) { \ + for (i = 0; i < span.end; i++) { \ GLdepth z = FixedToDepth(span.z); \ if (z < zRow[i]) { \ ctx->OcclusionResult = GL_TRUE; \ @@ -1616,13 +1063,13 @@ void _swrast_add_spec_terms_triangle( GLcontext *ctx, #ifdef DEBUG /* record the current triangle function name */ -static const char *triFuncName = NULL; +const char *_mesa_triFuncName = NULL; -#define USE(triFunc) \ -do { \ - triFuncName = #triFunc; \ - /*printf("%s\n", triFuncName);*/ \ - swrast->Triangle = triFunc; \ +#define USE(triFunc) \ +do { \ + _mesa_triFuncName = #triFunc; \ + /*printf("%s\n", _mesa_triFuncName);*/ \ + swrast->Triangle = triFunc; \ } while (0) #else @@ -1678,7 +1125,7 @@ _swrast_choose_triangle( GLcontext *ctx ) } } - if (ctx->Texture._ReallyEnabled) { + if (ctx->Texture._EnabledUnits) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; @@ -1692,10 +1139,12 @@ _swrast_choose_triangle( GLcontext *ctx ) envMode = ctx->Texture.Unit[0].EnvMode; /* First see if we can used an optimized 2-D texture function */ - if (ctx->Texture._ReallyEnabled==TEXTURE0_2D + if (ctx->Texture._EnabledUnits == 1 + && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && texObj2D->WrapS==GL_REPEAT && texObj2D->WrapT==GL_REPEAT && texImg->Border==0 + && texImg->Width == texImg->RowStride && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR @@ -1733,38 +1182,17 @@ _swrast_choose_triangle( GLcontext *ctx ) } } else { - /* More complicated textures (mipmap, multi-tex, sep specular) */ - GLboolean needLambda; - /* if mag filter != min filter we need to compute lambda */ - const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current; - if (obj && obj->MinFilter != obj->MagFilter) - needLambda = GL_TRUE; - else - needLambda = GL_FALSE; - if (ctx->Texture._ReallyEnabled > TEXTURE0_ANY) { - USE(lambda_multitextured_triangle); - } - else if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { - /* separate specular color interpolation */ - if (needLambda) { - USE(lambda_textured_spec_triangle); - } - else { - USE(general_textured_spec_triangle); - } + /* general case textured triangles */ + if (ctx->Texture._EnabledUnits > 1) { + USE(multitextured_triangle); } else { - if (needLambda) { - USE(lambda_textured_triangle); - } - else { - USE(general_textured_triangle); - } + USE(general_textured_triangle); } } } else { - ASSERT(!ctx->Texture._ReallyEnabled); + ASSERT(!ctx->Texture._EnabledUnits); if (ctx->Light.ShadeModel==GL_SMOOTH) { /* smooth shaded, no texturing, stippled or some raster ops */ if (rgbmode) { diff --git a/xc/extras/Mesa/src/swrast/s_trispan.h b/xc/extras/Mesa/src/swrast/s_trispan.h index 9a85132fe..15207e863 100644 --- a/xc/extras/Mesa/src/swrast/s_trispan.h +++ b/xc/extras/Mesa/src/swrast/s_trispan.h @@ -1,4 +1,3 @@ -/* $Id: s_trispan.h,v 1.1.1.1 2002/10/22 13:06:42 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -29,65 +28,4 @@ #define S_TRISPAN_H -/* - * The triangle_span structure is used by the triangle template code in - * s_tritemp.h. It describes how colors, Z, texcoords, etc are to be - * interpolated across each scanline of triangle. - * With this structure it's easy to hand-off span rasterization to a - * subroutine instead of doing it all inline like we used to do. - * It also cleans up the local variable namespace a great deal. - * - * It would be interesting to experiment with multiprocessor rasterization - * with this structure. The triangle rasterizer could simply emit a - * stream of these structures which would be consumed by one or more - * span-processing threads which could run in parallel. - */ - - -/* When the triangle_span struct is initialized, these flags indicates - * which values are needed for rendering the triangle. - */ -#define SPAN_RGBA 0x001 -#define SPAN_SPEC 0x002 -#define SPAN_INDEX 0x004 -#define SPAN_Z 0x008 -#define SPAN_FOG 0x010 -#define SPAN_TEXTURE 0x020 -#define SPAN_INT_TEXTURE 0x040 -#define SPAN_LAMBDA 0x080 -#define SPAN_FLAT 0x100 /* flat shading? */ - - -struct triangle_span { - GLint x, y; - GLuint count; - GLuint activeMask; /* OR of the SPAN_* flags */ -#if CHAN_TYPE == GL_FLOAT - GLfloat red, redStep; - GLfloat green, greenStep; - GLfloat blue, blueStep; - GLfloat alpha, alphaStep; - GLfloat specRed, specRedStep; - GLfloat specGreen, specGreenStep; - GLfloat specBlue, specBlueStep; -#else - GLfixed red, redStep; - GLfixed green, greenStep; - GLfixed blue, blueStep; - GLfixed alpha, alphaStep; - GLfixed specRed, specRedStep; - GLfixed specGreen, specGreenStep; - GLfixed specBlue, specBlueStep; -#endif - GLfixed index, indexStep; - GLfixed z, zStep; - GLfloat fog, fogStep; - GLfloat tex[MAX_TEXTURE_UNITS][4], texStep[MAX_TEXTURE_UNITS][4]; - GLfixed intTex[2], intTexStep[2]; - /* Needed for texture lambda (LOD) computation */ - GLfloat rho[MAX_TEXTURE_UNITS]; - GLfloat texWidth[MAX_TEXTURE_UNITS], texHeight[MAX_TEXTURE_UNITS]; -}; - - #endif /* S_TRISPAN_H */ diff --git a/xc/extras/Mesa/src/swrast/s_tritemp.h b/xc/extras/Mesa/src/swrast/s_tritemp.h index 41306fc03..2feeb8b13 100644 --- a/xc/extras/Mesa/src/swrast/s_tritemp.h +++ b/xc/extras/Mesa/src/swrast/s_tritemp.h @@ -1,3 +1,4 @@ + /* * Mesa 3-D graphics library * Version: 3.5 @@ -21,7 +22,7 @@ * 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. */ -/* $XFree86: xc/extras/Mesa/src/swrast/s_tritemp.h,v 1.3 2002/09/09 21:07:37 dawes Exp $ */ +/* $XFree86: xc/extras/Mesa/src/swrast/s_tritemp.h,v 1.2 2002/02/27 21:07:54 tsi Exp $ */ /* * Triangle Rasterizer Template @@ -41,8 +42,6 @@ * INTERP_TEX - if defined, interpolate set 0 float STRQ texcoords * NOTE: OpenGL STRQ = Mesa STUV (R was taken for red) * INTERP_MULTITEX - if defined, interpolate N units of STRQ texcoords - * INTERP_LAMBDA - if defined, compute lambda value (for mipmapping) - * a lambda value for every texture unit * INTERP_FLOAT_RGBA - if defined, interpolate RGBA with floating point * INTERP_FLOAT_SPEC - if defined, interpolate specular with floating point * @@ -115,10 +114,12 @@ GLfloat oneOverArea; const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */ float bf = SWRAST_CONTEXT(ctx)->_backface_sign; - const GLint snapMask = ~((FIXED_ONE / 16) - 1); /* for x/y coord snapping */ + const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */ GLfixed vMin_fx, vMin_fy, vMid_fx, vMid_fy, vMax_fx, vMax_fy; - struct triangle_span span; + struct sw_span span; + + INIT_SPAN(span, GL_POLYGON, 0, 0, 0); #ifdef INTERP_Z (void) fixedToDepthShift; @@ -127,14 +128,8 @@ /* printf("%s()\n", __FUNCTION__); printf(" %g, %g, %g\n", v0->win[0], v0->win[1], v0->win[2]); - printf(" %d, %d, %d, %d\n", - v0->color[0], v0->color[1], v0->color[2], v0->color[3]); printf(" %g, %g, %g\n", v1->win[0], v1->win[1], v1->win[2]); - printf(" %d, %d, %d, %d\n", - v1->color[0], v1->color[1], v1->color[2], v1->color[3]); printf(" %g, %g, %g\n", v2->win[0], v2->win[1], v2->win[2]); - printf(" %d, %d, %d, %d\n", - v2->color[0], v2->color[1], v2->color[2], v2->color[3]); */ /* Compute fixed point x,y coords w/ half-pixel offsets and snapping. @@ -210,7 +205,7 @@ if (area * bf < 0.0) return; - if (area == 0.0F || IS_INF_OR_NAN(area)) + if (IS_INF_OR_NAN(area) || area == 0.0F) return; oneOverArea = 1.0F / area; @@ -219,6 +214,7 @@ #ifndef DO_OCCLUSION_TEST ctx->OcclusionResult = GL_TRUE; #endif + span.facing = ctx->_Facing; /* for 2-sided stencil test */ /* Edge setup. For a triangle strip these could be reused... */ { @@ -319,20 +315,16 @@ GLfloat dtdx, dtdy; #endif #ifdef INTERP_TEX - GLfloat dsdy; - GLfloat dtdy; - GLfloat dudy; - GLfloat dvdy; + GLfloat dsdx, dsdy; + GLfloat dtdx, dtdy; + GLfloat dudx, dudy; + GLfloat dvdx, dvdy; #endif #ifdef INTERP_MULTITEX - GLfloat dsdy[MAX_TEXTURE_UNITS]; - GLfloat dtdy[MAX_TEXTURE_UNITS]; - GLfloat dudy[MAX_TEXTURE_UNITS]; - GLfloat dvdy[MAX_TEXTURE_UNITS]; -#endif - -#if defined(INTERP_LAMBDA) && !defined(INTERP_TEX) && !defined(INTERP_MULTITEX) -#error "Mipmapping without texturing doesn't make sense." + GLfloat dsdx[MAX_TEXTURE_UNITS], dsdy[MAX_TEXTURE_UNITS]; + GLfloat dtdx[MAX_TEXTURE_UNITS], dtdy[MAX_TEXTURE_UNITS]; + GLfloat dudx[MAX_TEXTURE_UNITS], dudy[MAX_TEXTURE_UNITS]; + GLfloat dvdx[MAX_TEXTURE_UNITS], dvdy[MAX_TEXTURE_UNITS]; #endif /* @@ -344,11 +336,10 @@ scan_from_left_to_right = (oneOverArea < 0.0F); - span.activeMask = 0; /* compute d?/dx and d?/dy derivatives */ #ifdef INTERP_Z - span.activeMask |= SPAN_Z; + span.interpMask |= SPAN_Z; { GLfloat eMaj_dz, eBot_dz; eMaj_dz = vMax->win[2] - vMin->win[2]; @@ -369,7 +360,7 @@ } #endif #ifdef INTERP_FOG - span.activeMask |= SPAN_FOG; + span.interpMask |= SPAN_FOG; { const GLfloat eMaj_dfog = vMax->fog - vMin->fog; const GLfloat eBot_dfog = vMid->fog - vMin->fog; @@ -378,7 +369,7 @@ } #endif #ifdef INTERP_RGB - span.activeMask |= SPAN_RGBA; + span.interpMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_dr, eBot_dr; GLfloat eMaj_dg, eBot_dg; @@ -419,7 +410,7 @@ } else { ASSERT (ctx->Light.ShadeModel == GL_FLAT); - span.activeMask |= SPAN_FLAT; + span.interpMask |= SPAN_FLAT; drdx = drdy = 0.0F; dgdx = dgdy = 0.0F; dbdx = dbdy = 0.0F; @@ -433,7 +424,7 @@ } #endif #ifdef INTERP_FLOAT_RGBA - span.activeMask |= SPAN_RGBA; + span.interpMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_dr, eBot_dr; GLfloat eMaj_dg, eBot_dg; @@ -468,7 +459,7 @@ } #endif #ifdef INTERP_SPEC - span.activeMask |= SPAN_SPEC; + span.interpMask |= SPAN_SPEC; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_dsr, eBot_dsr; GLfloat eMaj_dsg, eBot_dsg; @@ -505,7 +496,7 @@ } #endif #ifdef INTERP_FLOAT_SPEC - span.activeMask |= SPAN_SPEC; + span.interpMask |= SPAN_SPEC; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_dsr, eBot_dsr; GLfloat eMaj_dsg, eBot_dsg; @@ -533,7 +524,7 @@ } #endif #ifdef INTERP_INDEX - span.activeMask |= SPAN_INDEX; + span.interpMask |= SPAN_INDEX; if (ctx->Light.ShadeModel == GL_SMOOTH) { GLfloat eMaj_di, eBot_di; eMaj_di = (GLfloat) ((GLint) vMax->index - (GLint) vMin->index); @@ -543,13 +534,13 @@ didy = oneOverArea * (eMaj.dx * eBot_di - eMaj_di * eBot.dx); } else { - span.activeMask |= SPAN_FLAT; + span.interpMask |= SPAN_FLAT; didx = didy = 0.0F; span.indexStep = 0; } #endif #ifdef INTERP_INT_TEX - span.activeMask |= SPAN_INT_TEXTURE; + span.interpMask |= SPAN_INT_TEXTURE; { GLfloat eMaj_ds, eBot_ds; eMaj_ds = (vMax->texcoord[0][0] - vMin->texcoord[0][0]) * S_SCALE; @@ -569,7 +560,7 @@ #endif #ifdef INTERP_TEX - span.activeMask |= SPAN_TEXTURE; + span.interpMask |= SPAN_TEXTURE; { GLfloat wMax = vMax->win[3]; GLfloat wMin = vMin->win[3]; @@ -581,46 +572,35 @@ eMaj_ds = vMax->texcoord[0][0] * wMax - vMin->texcoord[0][0] * wMin; eBot_ds = vMid->texcoord[0][0] * wMid - vMin->texcoord[0][0] * wMin; - span.texStep[0][0] = oneOverArea * (eMaj_ds * eBot.dy - - eMaj.dy * eBot_ds); + dsdx = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); dsdy = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.texStepX[0][0] = dsdx; + span.texStepY[0][0] = dsdy; eMaj_dt = vMax->texcoord[0][1] * wMax - vMin->texcoord[0][1] * wMin; eBot_dt = vMid->texcoord[0][1] * wMid - vMin->texcoord[0][1] * wMin; - span.texStep[0][1] = oneOverArea * (eMaj_dt * eBot.dy - - eMaj.dy * eBot_dt); + dtdx = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); dtdy = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.texStepX[0][1] = dtdx; + span.texStepY[0][1] = dtdy; eMaj_du = vMax->texcoord[0][2] * wMax - vMin->texcoord[0][2] * wMin; eBot_du = vMid->texcoord[0][2] * wMid - vMin->texcoord[0][2] * wMin; - span.texStep[0][2] = oneOverArea * (eMaj_du * eBot.dy - - eMaj.dy * eBot_du); + dudx = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); dudy = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); + span.texStepX[0][2] = dudx; + span.texStepY[0][2] = dudy; eMaj_dv = vMax->texcoord[0][3] * wMax - vMin->texcoord[0][3] * wMin; eBot_dv = vMid->texcoord[0][3] * wMid - vMin->texcoord[0][3] * wMin; - span.texStep[0][3] = oneOverArea * (eMaj_dv * eBot.dy - - eMaj.dy * eBot_dv); + dvdx = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); dvdy = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); + span.texStepX[0][3] = dvdx; + span.texStepY[0][3] = dvdy; } -# ifdef INTERP_LAMBDA - { - GLfloat dudx = span.texStep[0][0] * span.texWidth[0]; - GLfloat dudy = dsdy * span.texWidth[0]; - GLfloat dvdx = span.texStep[0][1] * span.texHeight[0]; - GLfloat dvdy = dtdy * span.texHeight[0]; - GLfloat r1 = dudx * dudx + dudy * dudy; - GLfloat r2 = dvdx * dvdx + dvdy * dvdy; - span.rho[0] = r1 + r2; /* was rho2 = MAX2(r1,r2) */ - span.activeMask |= SPAN_LAMBDA; - } -# endif #endif #ifdef INTERP_MULTITEX - span.activeMask |= SPAN_TEXTURE; -# ifdef INTERP_LAMBDA - span.activeMask |= SPAN_LAMBDA; -# endif + span.interpMask |= SPAN_TEXTURE; { GLfloat wMax = vMax->win[3]; GLfloat wMin = vMin->win[3]; @@ -636,44 +616,37 @@ - vMin->texcoord[u][0] * wMin; eBot_ds = vMid->texcoord[u][0] * wMid - vMin->texcoord[u][0] * wMin; - span.texStep[u][0] = oneOverArea * (eMaj_ds * eBot.dy - - eMaj.dy * eBot_ds); + dsdx[u] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); dsdy[u] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.texStepX[u][0] = dsdx[u]; + span.texStepY[u][0] = dsdy[u]; eMaj_dt = vMax->texcoord[u][1] * wMax - vMin->texcoord[u][1] * wMin; eBot_dt = vMid->texcoord[u][1] * wMid - vMin->texcoord[u][1] * wMin; - span.texStep[u][1] = oneOverArea * (eMaj_dt * eBot.dy - - eMaj.dy * eBot_dt); + dtdx[u] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); dtdy[u] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.texStepX[u][1] = dtdx[u]; + span.texStepY[u][1] = dtdy[u]; eMaj_du = vMax->texcoord[u][2] * wMax - vMin->texcoord[u][2] * wMin; eBot_du = vMid->texcoord[u][2] * wMid - vMin->texcoord[u][2] * wMin; - span.texStep[u][2] = oneOverArea * (eMaj_du * eBot.dy - - eMaj.dy * eBot_du); + dudx[u] = oneOverArea * (eMaj_du * eBot.dy - eMaj.dy * eBot_du); dudy[u] = oneOverArea * (eMaj.dx * eBot_du - eMaj_du * eBot.dx); + span.texStepX[u][2] = dudx[u]; + span.texStepY[u][2] = dudy[u]; eMaj_dv = vMax->texcoord[u][3] * wMax - vMin->texcoord[u][3] * wMin; eBot_dv = vMid->texcoord[u][3] * wMid - vMin->texcoord[u][3] * wMin; - span.texStep[u][3] = oneOverArea * (eMaj_dv * eBot.dy - - eMaj.dy * eBot_dv); + dvdx[u] = oneOverArea * (eMaj_dv * eBot.dy - eMaj.dy * eBot_dv); dvdy[u] = oneOverArea * (eMaj.dx * eBot_dv - eMaj_dv * eBot.dx); -# ifdef INTERP_LAMBDA - { - GLfloat dudx = span.texStep[u][0] * span.texWidth[u]; - GLfloat dudy = dsdy[u] * span.texWidth[u]; - GLfloat dvdx = span.texStep[u][1] * span.texHeight[u]; - GLfloat dvdy = dtdy[u] * span.texHeight[u]; - GLfloat r1 = dudx * dudx + dudy * dudy; - GLfloat r2 = dvdx * dvdx + dvdy * dvdy; - span.rho[u] = r1 + r2; /* was rho2 = MAX2(r1,r2) */ - } -# endif + span.texStepX[u][3] = dvdx[u]; + span.texStepY[u][3] = dvdy[u]; } } } @@ -1033,21 +1006,21 @@ GLfloat invW = vLower->win[3]; GLfloat s0, t0, u0, v0; s0 = vLower->texcoord[0][0] * invW; - sLeft = s0 + (span.texStep[0][0] * adjx + dsdy * adjy) + sLeft = s0 + (span.texStepX[0][0] * adjx + dsdy * adjy) * (1.0F/FIXED_SCALE); - dsOuter = dsdy + dxOuter * span.texStep[0][0]; + dsOuter = dsdy + dxOuter * span.texStepX[0][0]; t0 = vLower->texcoord[0][1] * invW; - tLeft = t0 + (span.texStep[0][1] * adjx + dtdy * adjy) + tLeft = t0 + (span.texStepX[0][1] * adjx + dtdy * adjy) * (1.0F/FIXED_SCALE); - dtOuter = dtdy + dxOuter * span.texStep[0][1]; + dtOuter = dtdy + dxOuter * span.texStepX[0][1]; u0 = vLower->texcoord[0][2] * invW; - uLeft = u0 + (span.texStep[0][2] * adjx + dudy * adjy) + uLeft = u0 + (span.texStepX[0][2] * adjx + dudy * adjy) * (1.0F/FIXED_SCALE); - duOuter = dudy + dxOuter * span.texStep[0][2]; + duOuter = dudy + dxOuter * span.texStepX[0][2]; v0 = vLower->texcoord[0][3] * invW; - vLeft = v0 + (span.texStep[0][3] * adjx + dvdy * adjy) + vLeft = v0 + (span.texStepX[0][3] * adjx + dvdy * adjy) * (1.0F/FIXED_SCALE); - dvOuter = dvdy + dxOuter * span.texStep[0][3]; + dvOuter = dvdy + dxOuter * span.texStepX[0][3]; } #endif #ifdef INTERP_MULTITEX @@ -1058,21 +1031,21 @@ GLfloat invW = vLower->win[3]; GLfloat s0, t0, u0, v0; s0 = vLower->texcoord[u][0] * invW; - sLeft[u] = s0 + (span.texStep[u][0] * adjx + dsdy[u] + sLeft[u] = s0 + (span.texStepX[u][0] * adjx + dsdy[u] * adjy) * (1.0F/FIXED_SCALE); - dsOuter[u] = dsdy[u] + dxOuter * span.texStep[u][0]; + dsOuter[u] = dsdy[u] + dxOuter * span.texStepX[u][0]; t0 = vLower->texcoord[u][1] * invW; - tLeft[u] = t0 + (span.texStep[u][1] * adjx + dtdy[u] + tLeft[u] = t0 + (span.texStepX[u][1] * adjx + dtdy[u] * adjy) * (1.0F/FIXED_SCALE); - dtOuter[u] = dtdy[u] + dxOuter * span.texStep[u][1]; + dtOuter[u] = dtdy[u] + dxOuter * span.texStepX[u][1]; u0 = vLower->texcoord[u][2] * invW; - uLeft[u] = u0 + (span.texStep[u][2] * adjx + dudy[u] + uLeft[u] = u0 + (span.texStepX[u][2] * adjx + dudy[u] * adjy) * (1.0F/FIXED_SCALE); - duOuter[u] = dudy[u] + dxOuter * span.texStep[u][2]; + duOuter[u] = dudy[u] + dxOuter * span.texStepX[u][2]; v0 = vLower->texcoord[u][3] * invW; - vLeft[u] = v0 + (span.texStep[u][3] * adjx + dvdy[u] + vLeft[u] = v0 + (span.texStepX[u][3] * adjx + dvdy[u] * adjy) * (1.0F/FIXED_SCALE); - dvOuter[u] = dvdy[u] + dxOuter * span.texStep[u][3]; + dvOuter[u] = dvdy[u] + dxOuter * span.texStepX[u][3]; } } } @@ -1125,20 +1098,20 @@ fdtInner = fdtOuter + span.intTexStep[1]; #endif #ifdef INTERP_TEX - dsInner = dsOuter + span.texStep[0][0]; - dtInner = dtOuter + span.texStep[0][1]; - duInner = duOuter + span.texStep[0][2]; - dvInner = dvOuter + span.texStep[0][3]; + dsInner = dsOuter + span.texStepX[0][0]; + dtInner = dtOuter + span.texStepX[0][1]; + duInner = duOuter + span.texStepX[0][2]; + dvInner = dvOuter + span.texStepX[0][3]; #endif #ifdef INTERP_MULTITEX { GLuint u; for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { - dsInner[u] = dsOuter[u] + span.texStep[u][0]; - dtInner[u] = dtOuter[u] + span.texStep[u][1]; - duInner[u] = duOuter[u] + span.texStep[u][2]; - dvInner[u] = dvOuter[u] + span.texStep[u][3]; + dsInner[u] = dsOuter[u] + span.texStepX[u][0]; + dtInner[u] = dtOuter[u] + span.texStepX[u][1]; + duInner[u] = duOuter[u] + span.texStepX[u][2]; + dvInner[u] = dvOuter[u] + span.texStepX[u][3]; } } } @@ -1148,11 +1121,13 @@ /* initialize the span interpolants to the leftmost value */ /* ff = fixed-pt fragment */ const GLint right = FixedToInt(fxRightEdge); + span.x = FixedToInt(fxLeftEdge); + if (right <= span.x) - span.count = 0; + span.end = 0; else - span.count = right - span.x; + span.end = right - span.x; #ifdef INTERP_Z span.z = fz; @@ -1266,7 +1241,7 @@ #endif /* This is where we actually generate fragments */ - if (span.count > 0) { + if (span.end > 0) { RENDER_SPAN( span ); } @@ -1276,7 +1251,7 @@ * pixel-center x coordinate so that it stays * on or inside the major edge. */ - span.y++; + (span.y)++; lines--; fxLeftEdge += fdxLeftEdge; @@ -1419,7 +1394,6 @@ #undef INTERP_INT_TEX #undef INTERP_TEX #undef INTERP_MULTITEX -#undef INTERP_LAMBDA #undef INTERP_FLOAT_RGBA #undef INTERP_FLOAT_SPEC diff --git a/xc/extras/Mesa/src/swrast/s_zoom.c b/xc/extras/Mesa/src/swrast/s_zoom.c index b56128147..0d1f08458 100644 --- a/xc/extras/Mesa/src/swrast/s_zoom.c +++ b/xc/extras/Mesa/src/swrast/s_zoom.c @@ -1,8 +1,7 @@ -/* $Id: s_zoom.c,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -26,6 +25,8 @@ #include "glheader.h" #include "macros.h" +#include "imports.h" +#include "colormac.h" #include "s_context.h" #include "s_span.h" @@ -33,342 +34,229 @@ #include "s_zoom.h" - /* - * Write a span of pixels to the frame buffer while applying a pixel zoom. - * This is only used by glDrawPixels and glCopyPixels. - * Input: n - number of pixels in input row - * x, y - destination of the span - * z - depth values for the span - * red, green, blue, alpha - array of colors - * y0 - location of first row in the image we're drawing. + * Helper function called from _mesa_write_zoomed_rgba/rgb/index_span(). */ -void -_mesa_write_zoomed_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, const GLdepth z[], - const GLfloat *fog, - CONST GLchan rgba[][4], GLint y0 ) +static void +zoom_span( GLcontext *ctx, const struct sw_span *span, + const GLvoid *src, GLint y0, GLenum format ) { - GLint m; - GLint r0, r1, row, r; - GLint i, j, skipcol; - GLchan zrgba[MAX_WIDTH][4]; /* zoomed pixel colors */ - GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */ - GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */ - GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); - const GLuint *srcRGBA32 = (const GLuint *) rgba; - GLuint *dstRGBA32 = (GLuint *) zrgba; - - /* compute width of output row */ - m = (GLint) ABSF( n * ctx->Pixel.ZoomX ); - if (m==0) { + GLint r0, r1, row; + GLint c0, c1, skipCol; + GLint i, j; + const GLuint maxWidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); + GLchan rgbaSave[MAX_WIDTH][4]; + GLuint indexSave[MAX_WIDTH]; + const GLchan (*rgba)[4] = (const GLchan (*)[4]) src; + const GLchan (*rgb)[3] = (const GLchan (*)[3]) src; + const GLuint *indexes = (const GLuint *) src; + struct sw_span zoomed; + struct span_arrays zoomed_arrays; /* this is big! */ + + /* no pixel arrays! */ + ASSERT((span->arrayMask & SPAN_XY) == 0); + ASSERT(span->primitive == GL_BITMAP); + + INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0); + zoomed.array = &zoomed_arrays; + + if (format == GL_RGBA || format == GL_RGB) { + zoomed.z = span->z; + zoomed.zStep = span->z; + zoomed.fog = span->fog; + zoomed.fogStep = span->fogStep; + zoomed.interpMask = span->interpMask & ~SPAN_RGBA; + zoomed.arrayMask |= SPAN_RGBA; + } + else if (format == GL_COLOR_INDEX) { + zoomed.z = span->z; + zoomed.zStep = span->z; + zoomed.fog = span->fog; + zoomed.fogStep = span->fogStep; + zoomed.interpMask = span->interpMask & ~SPAN_INDEX; + zoomed.arrayMask |= SPAN_INDEX; + } + + /* + * Compute which columns to draw: [c0, c1) + */ + c0 = (GLint) span->x; + c1 = (GLint) (span->x + span->end * ctx->Pixel.ZoomX); + if (c0 == c1) { return; } - if (ctx->Pixel.ZoomX<0.0) { - /* adjust x coordinate for left/right mirroring */ - x = x - m; + else if (c1 < c0) { + /* swap */ + GLint ctmp = c1; + c1 = c0; + c0 = ctmp; } - - /* compute which rows to draw */ - row = y-y0; + if (c0 < 0) { + zoomed.x = 0; + zoomed.start = 0; + zoomed.end = c1; + skipCol = -c0; + } + else { + zoomed.x = c0; + zoomed.start = 0; + zoomed.end = c1 - c0; + skipCol = 0; + } + if (zoomed.end > maxWidth) + zoomed.end = maxWidth; + + /* + * Compute which rows to draw: [r0, r1) + */ + row = span->y - y0; r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); - if (r0==r1) { + if (r0 == r1) { return; } - else if (r1<r0) { + else if (r1 < r0) { + /* swap */ GLint rtmp = r1; r1 = r0; r0 = rtmp; } - /* return early if r0...r1 is above or below window */ - if (r0<0 && r1<0) { - /* below window */ + ASSERT(r0 < r1); + ASSERT(c0 < c1); + + /* + * Trivial clip rejection testing. + */ + if (r1 < 0) /* below window */ return; - } - if (r0 >= (GLint) ctx->DrawBuffer->Height && - r1 >= (GLint) ctx->DrawBuffer->Height) { - /* above window */ + if (r0 >= (GLint) ctx->DrawBuffer->Height) /* above window */ return; - } - - /* check if left edge is outside window */ - skipcol = 0; - if (x<0) { - skipcol = -x; - m += x; - } - /* make sure span isn't too long or short */ - if (m>maxwidth) { - m = maxwidth; - } - else if (m<=0) { + if (c1 < 0) /* left of window */ + return; + if (c0 >= (GLint) ctx->DrawBuffer->Width) /* right of window */ return; - } - - assert( m <= MAX_WIDTH ); /* zoom the span horizontally */ - if (ctx->Pixel.ZoomX==-1.0F) { - /* n==m */ - for (j=0;j<m;j++) { - i = n - (j+skipcol) - 1; - dstRGBA32[j] = srcRGBA32[i]; - zdepth[j] = z[i]; + if (format == GL_RGBA) { + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); + } } - if (fog && ctx->Fog.Enabled) { - for (j=0;j<m;j++) { - i = n - (j+skipcol) - 1; - zfog[j] = fog[i]; - } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (i < 0) + i = span->end + i - 1; + COPY_CHAN4(zoomed.array->rgba[j], rgba[i]); + } } } - else { - GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; - for (j=0;j<m;j++) { - i = (GLint) ((j+skipcol) * xscale); - if (i<0) i = n + i - 1; - dstRGBA32[j] = srcRGBA32[i]; - zdepth[j] = z[i]; + else if (format == GL_RGB) { + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + zoomed.array->rgba[j][0] = rgb[i][0]; + zoomed.array->rgba[j][1] = rgb[i][1]; + zoomed.array->rgba[j][2] = rgb[i][2]; + zoomed.array->rgba[j][3] = CHAN_MAX; + } } - if (fog && ctx->Fog.Enabled) { - for (j=0;j<m;j++) { - i = (GLint) ((j+skipcol) * xscale); - if (i<0) i = n + i - 1; - zfog[j] = fog[i]; - } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (i < 0) + i = span->end + i - 1; + zoomed.array->rgba[j][0] = rgb[i][0]; + zoomed.array->rgba[j][1] = rgb[i][1]; + zoomed.array->rgba[j][2] = rgb[i][2]; + zoomed.array->rgba[j][3] = CHAN_MAX; + } } } - - /* write the span */ - for (r=r0; r<r1; r++) { - _mesa_write_rgba_span( ctx, m, x+skipcol, r, zdepth, - (fog ? zfog : 0), zrgba, NULL, GL_BITMAP ); - } -} - - - -void -_mesa_write_zoomed_rgb_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, const GLdepth z[], - const GLfloat *fog, - CONST GLchan rgb[][3], GLint y0 ) -{ - GLint m; - GLint r0, r1, row, r; - GLint i, j, skipcol; - GLchan zrgba[MAX_WIDTH][4]; /* zoomed pixel colors */ - GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */ - GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */ - GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); - - /* compute width of output row */ - m = (GLint) ABSF( n * ctx->Pixel.ZoomX ); - if (m==0) { - return; - } - if (ctx->Pixel.ZoomX<0.0) { - /* adjust x coordinate for left/right mirroring */ - x = x - m; - } - - /* compute which rows to draw */ - row = y-y0; - r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); - r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); - if (r0==r1) { - return; - } - else if (r1<r0) { - GLint rtmp = r1; - r1 = r0; - r0 = rtmp; - } - - /* return early if r0...r1 is above or below window */ - if (r0<0 && r1<0) { - /* below window */ - return; - } - if (r0 >= (GLint) ctx->DrawBuffer->Height && - r1 >= (GLint) ctx->DrawBuffer->Height) { - /* above window */ - return; - } - - /* check if left edge is outside window */ - skipcol = 0; - if (x<0) { - skipcol = -x; - m += x; - } - /* make sure span isn't too long or short */ - if (m>maxwidth) { - m = maxwidth; - } - else if (m<=0) { - return; + else if (format == GL_COLOR_INDEX) { + if (ctx->Pixel.ZoomX == -1.0F) { + /* common case */ + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = span->end - (j + skipCol) - 1; + zoomed.array->index[j] = indexes[i]; + } + } + else { + /* general solution */ + const GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; + for (j = (GLint) zoomed.start; j < (GLint) zoomed.end; j++) { + i = (GLint) ((j + skipCol) * xscale); + if (i < 0) + i = span->end + i - 1; + zoomed.array->index[j] = indexes[i]; + } + } } - assert( m <= MAX_WIDTH ); - - /* zoom the span horizontally */ - if (ctx->Pixel.ZoomX==-1.0F) { - /* n==m */ - for (j=0;j<m;j++) { - i = n - (j+skipcol) - 1; - zrgba[j][0] = rgb[i][0]; - zrgba[j][1] = rgb[i][1]; - zrgba[j][2] = rgb[i][2]; - zrgba[j][3] = CHAN_MAX; - zdepth[j] = z[i]; + /* write the span in rows [r0, r1) */ + if (format == GL_RGBA || format == GL_RGB) { + /* Writing the span may modify the colors, so make a backup now if we're + * going to call _mesa_write_zoomed_span() more than once. + */ + if (r1 - r0 > 1) { + MEMCPY(rgbaSave, zoomed.array->rgba, zoomed.end * 4 * sizeof(GLchan)); } - if (fog && ctx->Fog.Enabled) { - for (j=0;j<m;j++) { - i = n - (j+skipcol) - 1; - zfog[j] = fog[i]; - } + for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { + _mesa_write_rgba_span(ctx, &zoomed); + if (r1 - r0 > 1) { + /* restore the colors */ + MEMCPY(zoomed.array->rgba, rgbaSave, zoomed.end*4 * sizeof(GLchan)); + } } } - else { - GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; - for (j=0;j<m;j++) { - i = (GLint) ((j+skipcol) * xscale); - if (i<0) i = n + i - 1; - zrgba[j][0] = rgb[i][0]; - zrgba[j][1] = rgb[i][1]; - zrgba[j][2] = rgb[i][2]; - zrgba[j][3] = CHAN_MAX; - zdepth[j] = z[i]; + else if (format == GL_COLOR_INDEX) { + if (r1 - r0 > 1) { + MEMCPY(indexSave, zoomed.array->index, zoomed.end * sizeof(GLuint)); } - if (fog && ctx->Fog.Enabled) { - for (j=0;j<m;j++) { - i = (GLint) ((j+skipcol) * xscale); - if (i<0) i = n + i - 1; - zfog[j] = fog[i]; - } + for (zoomed.y = r0; zoomed.y < r1; zoomed.y++) { + _mesa_write_index_span(ctx, &zoomed); + if (r1 - r0 > 1) { + /* restore the colors */ + MEMCPY(zoomed.array->index, indexSave, zoomed.end * sizeof(GLuint)); + } } } - - /* write the span */ - for (r=r0; r<r1; r++) { - _mesa_write_rgba_span( ctx, m, x+skipcol, r, zdepth, - (fog ? zfog : 0), zrgba, NULL, GL_BITMAP ); - } } - -/* - * As above, but write CI pixels. - */ void -_mesa_write_zoomed_index_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, const GLdepth z[], - const GLfloat *fog, - const GLuint indexes[], GLint y0 ) +_mesa_write_zoomed_rgba_span( GLcontext *ctx, const struct sw_span *span, + CONST GLchan rgba[][4], GLint y0 ) { - GLint m; - GLint r0, r1, row, r; - GLint i, j, skipcol; - GLuint zindexes[MAX_WIDTH]; /* zoomed color indexes */ - GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */ - GLfloat zfog[MAX_WIDTH]; /* zoomed fog values */ - GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); - - /* compute width of output row */ - m = (GLint) ABSF( n * ctx->Pixel.ZoomX ); - if (m==0) { - return; - } - if (ctx->Pixel.ZoomX<0.0) { - /* adjust x coordinate for left/right mirroring */ - x = x - m; - } - - /* compute which rows to draw */ - row = y-y0; - r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY); - r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY); - if (r0==r1) { - return; - } - else if (r1<r0) { - GLint rtmp = r1; - r1 = r0; - r0 = rtmp; - } - - /* return early if r0...r1 is above or below window */ - if (r0<0 && r1<0) { - /* below window */ - return; - } - if (r0 >= (GLint) ctx->DrawBuffer->Height && - r1 >= (GLint) ctx->DrawBuffer->Height) { - /* above window */ - return; - } + zoom_span(ctx, span, (const GLvoid *) rgba, y0, GL_RGBA); +} - /* check if left edge is outside window */ - skipcol = 0; - if (x<0) { - skipcol = -x; - m += x; - } - /* make sure span isn't too long or short */ - if (m>maxwidth) { - m = maxwidth; - } - else if (m<=0) { - return; - } - assert( m <= MAX_WIDTH ); +void +_mesa_write_zoomed_rgb_span( GLcontext *ctx, const struct sw_span *span, + CONST GLchan rgb[][3], GLint y0 ) +{ + zoom_span(ctx, span, (const GLvoid *) rgb, y0, GL_RGB); +} - /* zoom the span horizontally */ - if (ctx->Pixel.ZoomX==-1.0F) { - /* n==m */ - for (j=0;j<m;j++) { - i = n - (j+skipcol) - 1; - zindexes[j] = indexes[i]; - zdepth[j] = z[i]; - } - if (fog && ctx->Fog.Enabled) { - for (j=0;j<m;j++) { - i = n - (j+skipcol) - 1; - zfog[j] = fog[i]; - } - } - } - else { - GLfloat xscale = 1.0F / ctx->Pixel.ZoomX; - for (j=0;j<m;j++) { - i = (GLint) ((j+skipcol) * xscale); - if (i<0) i = n + i - 1; - zindexes[j] = indexes[i]; - zdepth[j] = z[i]; - } - if (fog && ctx->Fog.Enabled) { - for (j=0;j<m;j++) { - i = (GLint) ((j+skipcol) * xscale); - if (i<0) i = n + i - 1; - zfog[j] = fog[i]; - } - } - } - /* write the span */ - for (r=r0; r<r1; r++) { - _mesa_write_index_span( ctx, m, x+skipcol, r, zdepth, - (fog ? zfog : 0), zindexes, NULL, GL_BITMAP ); - } +void +_mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, + GLint y0 ) +{ + zoom_span(ctx, span, (const GLvoid *) span->array->index, y0, GL_COLOR_INDEX); } - /* * As above, but write stencil values. */ @@ -431,7 +319,7 @@ _mesa_write_zoomed_stencil_span( GLcontext *ctx, return; } - assert( m <= MAX_WIDTH ); + ASSERT( m <= MAX_WIDTH ); /* zoom the span horizontally */ if (ctx->Pixel.ZoomX==-1.0F) { diff --git a/xc/extras/Mesa/src/swrast/s_zoom.h b/xc/extras/Mesa/src/swrast/s_zoom.h index a55223607..bdc7013e0 100644 --- a/xc/extras/Mesa/src/swrast/s_zoom.h +++ b/xc/extras/Mesa/src/swrast/s_zoom.h @@ -1,10 +1,9 @@ -/* $Id: s_zoom.h,v 1.1.1.1 2002/10/22 13:06:58 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,39 +23,26 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #ifndef S_ZOOM_H #define S_ZOOM_H - #include "mtypes.h" - +#include "swrast.h" extern void -_mesa_write_zoomed_rgba_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, const GLdepth z[], - const GLfloat *fog, - CONST GLchan rgba[][4], GLint y0 ); - +_mesa_write_zoomed_rgba_span( GLcontext *ctx, const struct sw_span *span, + CONST GLchan rgb[][4], GLint y0 ); extern void -_mesa_write_zoomed_rgb_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, const GLdepth z[], - const GLfloat *fog, +_mesa_write_zoomed_rgb_span( GLcontext *ctx, const struct sw_span *span, CONST GLchan rgb[][3], GLint y0 ); - extern void -_mesa_write_zoomed_index_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, const GLdepth z[], - const GLfloat *fog, - const GLuint indexes[], GLint y0 ); - +_mesa_write_zoomed_index_span( GLcontext *ctx, const struct sw_span *span, + GLint y0 ); extern void -_mesa_write_zoomed_stencil_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, +_mesa_write_zoomed_stencil_span( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLstencil stencil[], GLint y0 ); - #endif diff --git a/xc/extras/Mesa/src/swrast/swrast.h b/xc/extras/Mesa/src/swrast/swrast.h index 7149be8fb..76e9ca24d 100644 --- a/xc/extras/Mesa/src/swrast/swrast.h +++ b/xc/extras/Mesa/src/swrast/swrast.h @@ -1,10 +1,9 @@ -/* $Id: swrast.h,v 1.1.1.1 2002/10/22 13:06:46 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,8 +22,12 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - * Authors: - * Keith Whitwell <keithw@valinux.com> + */ + +/** + * \file swrast/swrast.h + * \brief Defines basic structures for sw_rasterizer. + * \author Keith Whitwell <keith@tungstengraphics.com> */ #ifndef SWRAST_H @@ -32,9 +35,11 @@ #include "mtypes.h" - - -/* The software rasterizer now uses this format for vertices. Thus a +/** + * \struct SWvertex + * \brief Data-structure to handle vertices in the software rasterizer. + * + * The software rasterizer now uses this format for vertices. Thus a * 'RasterSetup' stage or other translation is required between the * tnl module and the swrast rasterization functions. This serves to * isolate the swrast module from the internals of the tnl module, and @@ -57,6 +62,8 @@ * primitives unaccelerated), hook in swrast_setup instead. */ typedef struct { + /** win[0], win[1] are the screen-coords of SWvertex. win[2] is the + * z-coord. what is win[3]? */ GLfloat win[4]; GLfloat texcoord[MAX_TEXTURE_UNITS][4]; GLchan color[4]; @@ -67,6 +74,154 @@ typedef struct { } SWvertex; +/** + * \struct sw_span + * \brief Contains data for either a horizontal line or a set of + * pixels that are passed through a pipeline of functions before being + * drawn. + * + * The sw_span structure describes the colors, Z, fogcoord, texcoords, + * etc for either a horizontal run or a set of independent pixels. We + * can either specify a base/step to indicate interpolated values, or + * fill in arrays of values. The interpMask and arrayMask bitfields + * indicate which are active. + * + * With this structure it's easy to hand-off span rasterization to + * subroutines instead of doing it all inline in the triangle functions + * like we used to do. + * It also cleans up the local variable namespace a great deal. + * + * It would be interesting to experiment with multiprocessor rasterization + * with this structure. The triangle rasterizer could simply emit a + * stream of these structures which would be consumed by one or more + * span-processing threads which could run in parallel. + */ + + +/** + * \defgroup SpanFlags SPAN_XXX-flags + * Bitmasks to indicate which span_arrays need to be computed + * (sw_span::interpMask) or have already been filled + * (sw_span::arrayMask) + */ +/*@{*/ +#define SPAN_RGBA 0x001 +#define SPAN_SPEC 0x002 +#define SPAN_INDEX 0x004 +#define SPAN_Z 0x008 +#define SPAN_FOG 0x010 +#define SPAN_TEXTURE 0x020 +#define SPAN_INT_TEXTURE 0x040 +#define SPAN_LAMBDA 0x080 +#define SPAN_COVERAGE 0x100 +#define SPAN_FLAT 0x200 /**< flat shading? */ +/** sw_span::arrayMask only - for span_arrays::x, span_arrays::y */ +#define SPAN_XY 0x400 +#define SPAN_MASK 0x800 /**< sw_span::arrayMask only */ +/*@}*/ + + +/** + * \struct span_arrays + * \brief Arrays of fragment values. + * + * These will either be computed from the x/xStep values above or + * filled in by glDraw/CopyPixels, etc. + */ +struct span_arrays { + GLchan rgb[MAX_WIDTH][3]; + GLchan rgba[MAX_WIDTH][4]; + GLuint index[MAX_WIDTH]; + GLchan spec[MAX_WIDTH][4]; /* specular color */ + GLint x[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ + GLint y[MAX_WIDTH]; /**< X/Y used for point/line rendering only */ + GLdepth z[MAX_WIDTH]; + GLfloat fog[MAX_WIDTH]; + GLfloat texcoords[MAX_TEXTURE_UNITS][MAX_WIDTH][4]; + GLfloat lambda[MAX_TEXTURE_UNITS][MAX_WIDTH]; + GLfloat coverage[MAX_WIDTH]; + + /** This mask indicates if fragment is alive or culled */ + GLubyte mask[MAX_WIDTH]; +}; + + +struct sw_span { + GLint x, y; + + /** Only need to process pixels between start <= i < end */ + /** At this time, start is always zero. */ + GLuint start, end; + + /** This flag indicates that mask[] array is effectively filled with ones */ + GLboolean writeAll; + + /** either GL_POLYGON, GL_LINE, GL_POLYGON, GL_BITMAP */ + GLenum primitive; + + /** 0 = front-facing span, 1 = back-facing span (for two-sided stencil) */ + GLuint facing; + + /** + * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates + * which of the x/xStep variables are relevant. + */ + GLuint interpMask; + +#if CHAN_TYPE == GL_FLOAT + GLfloat red, redStep; + GLfloat green, greenStep; + GLfloat blue, blueStep; + GLfloat alpha, alphaStep; + GLfloat specRed, specRedStep; + GLfloat specGreen, specGreenStep; + GLfloat specBlue, specBlueStep; +#else /* CHAN_TYPE == GL_UNSIGNED_BYTE or GL_UNSIGNED SHORT */ + GLfixed red, redStep; + GLfixed green, greenStep; + GLfixed blue, blueStep; + GLfixed alpha, alphaStep; + GLfixed specRed, specRedStep; + GLfixed specGreen, specGreenStep; + GLfixed specBlue, specBlueStep; +#endif + GLfixed index, indexStep; + GLfixed z, zStep; + GLfloat fog, fogStep; + GLfloat tex[MAX_TEXTURE_UNITS][4]; + GLfloat texStepX[MAX_TEXTURE_UNITS][4]; + GLfloat texStepY[MAX_TEXTURE_UNITS][4]; + GLfixed intTex[2], intTexStep[2]; + + /** + * This bitmask (of \link SpanFlags SPAN_* flags\endlink) indicates + * which of the fragment arrays in the span_arrays struct are relevant. + */ + GLuint arrayMask; + + /** + * We store the arrays of fragment values in a separate struct so + * that we can allocate sw_span structs on the stack without using + * a lot of memory. The span_arrays struct is about 400KB while the + * sw_span struct is only about 512 bytes. + */ + struct span_arrays *array; +}; + + +#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK) \ +do { \ + (S).primitive = (PRIMITIVE); \ + (S).interpMask = (INTERP_MASK); \ + (S).arrayMask = (ARRAY_MASK); \ + (S).start = 0; \ + (S).end = (END); \ + (S).facing = 0; \ + (S).array = SWRAST_CONTEXT(ctx)->SpanArrays; \ +} while (0) + + + struct swrast_device_driver; @@ -75,6 +230,12 @@ struct swrast_device_driver; extern void _swrast_alloc_buffers( GLframebuffer *buffer ); +extern void +_swrast_use_read_buffer( GLcontext *ctx ); + +extern void +_swrast_use_draw_buffer( GLcontext *ctx ); + extern GLboolean _swrast_CreateContext( GLcontext *ctx ); @@ -125,6 +286,10 @@ _swrast_Accum( GLcontext *ctx, GLenum op, GLint width, GLint height ); +extern void +_swrast_DrawBuffer( GLcontext *ctx, GLenum mode ); + + /* Reset the stipple counter */ extern void @@ -153,6 +318,14 @@ _swrast_Quad( GLcontext *ctx, extern void _swrast_flush( GLcontext *ctx ); +extern void +_swrast_render_primitive( GLcontext *ctx, GLenum mode ); + +extern void +_swrast_render_start( GLcontext *ctx ); + +extern void +_swrast_render_finish( GLcontext *ctx ); /* Tell the software rasterizer about core state changes. */ @@ -177,19 +350,19 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); * Imaging fallbacks (a better solution should be found, perhaps * moving all the imaging fallback code to a new module) */ -void +extern void _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height); -void +extern void _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width); -void +extern void _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -void +extern void _swrast_CopyColorTable( GLcontext *ctx, GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); @@ -201,48 +374,51 @@ _swrast_CopyColorTable( GLcontext *ctx, */ extern void _swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLint border); + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLint border); extern void _swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border); + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border); extern void _swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width); + GLint xoffset, GLint x, GLint y, GLsizei width); extern void _swrast_copy_texsubimage2d(GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height); + GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, GLsizei width, GLsizei height); extern void _swrast_copy_texsubimage3d(GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint x, GLint y, GLsizei width, GLsizei height); + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, GLsizei width, GLsizei height); -/* The driver interface for the software rasterizer. Unless otherwise - * noted, all functions are mandatory. +/* The driver interface for the software rasterizer. + * Unless otherwise noted, all functions are mandatory. */ struct swrast_device_driver { - void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer, - GLenum buffer ); + void (*SetBuffer)( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit); /* - * Specifies the current buffer for span/pixel reading. - * colorBuffer will be one of: - * GL_FRONT_LEFT - this buffer always exists - * GL_BACK_LEFT - when double buffering - * GL_FRONT_RIGHT - when using stereo - * GL_BACK_RIGHT - when using stereo and double buffering + * Specifies the current buffer for span/pixel writing/reading. + * buffer indicates which window to write to / read from. Normally, + * this'll be the buffer currently bound to the context, but it doesn't + * have to be! + * bufferBit indicates which color buffer, one of: + * FRONT_LEFT_BIT - this buffer always exists + * BACK_LEFT_BIT - when double buffering + * FRONT_RIGHT_BIT - when using stereo + * BACK_RIGHT_BIT - when using stereo and double buffering + * AUXn_BIT - if aux buffers are implemented */ diff --git a/xc/extras/Mesa/src/swrast_setup/ss_context.c b/xc/extras/Mesa/src/swrast_setup/ss_context.c index 974f18bd4..c000e4194 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_context.c +++ b/xc/extras/Mesa/src/swrast_setup/ss_context.c @@ -1,10 +1,9 @@ -/* $Id: ss_context.c,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,11 +23,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" -#include "mem.h" +#include "imports.h" #include "ss_context.h" #include "ss_triangle.h" #include "ss_vb.h" @@ -49,7 +48,6 @@ #define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT) - GLboolean _swsetup_CreateContext( GLcontext *ctx ) { @@ -99,8 +97,13 @@ static void _swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) { SWSETUP_CONTEXT(ctx)->render_prim = mode; + _swrast_render_primitive( ctx, mode ); } +/* + * We patch this function into tnl->Driver.Render.Start. + * It's called when we start rendering a vertex buffer. + */ static void _swsetup_RenderStart( GLcontext *ctx ) { @@ -117,19 +120,17 @@ _swsetup_RenderStart( GLcontext *ctx ) swsetup->NewState = 0; - if (swsetup->Driver.Start) - swsetup->Driver.Start( ctx ); + _swrast_render_start( ctx ); } +/* + * We patch this function into tnl->Driver.Render.Finish. + * It's called when we finish rendering a vertex buffer. + */ static void _swsetup_RenderFinish( GLcontext *ctx ) { - SScontext *swsetup = SWSETUP_CONTEXT(ctx); - - _swrast_flush( ctx ); - - if (swsetup->Driver.Finish) - swsetup->Driver.Finish( ctx ); + _swrast_render_finish( ctx ); } void diff --git a/xc/extras/Mesa/src/swrast_setup/ss_context.h b/xc/extras/Mesa/src/swrast_setup/ss_context.h index d7b595461..84813e98e 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_context.h +++ b/xc/extras/Mesa/src/swrast_setup/ss_context.h @@ -1,10 +1,9 @@ -/* $Id: ss_context.h,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef SS_CONTEXT_H @@ -44,12 +43,6 @@ typedef struct { */ struct gl_client_array ChanColor; struct gl_client_array ChanSecondaryColor; - - - struct { - void (*Start)( GLcontext * ); - void (*Finish)( GLcontext * ); - } Driver; } SScontext; #define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context) diff --git a/xc/extras/Mesa/src/swrast_setup/ss_triangle.c b/xc/extras/Mesa/src/swrast_setup/ss_triangle.c index 3a3cf1f32..b041c32ef 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_triangle.c +++ b/xc/extras/Mesa/src/swrast_setup/ss_triangle.c @@ -1,4 +1,3 @@ -/* $Id: ss_triangle.c,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" @@ -48,7 +47,8 @@ static quad_func quad_tab[SS_MAX_TRIFUNC]; static void _swsetup_render_line_tri( GLcontext *ctx, - GLuint e0, GLuint e1, GLuint e2 ) + GLuint e0, GLuint e1, GLuint e2, + GLuint facing ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -61,6 +61,14 @@ static void _swsetup_render_line_tri( GLcontext *ctx, GLchan s[2][4]; GLuint i[2]; + /* cull testing */ + if (ctx->Polygon.CullFlag) { + if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) + return; + if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) + return; + } + if (ctx->_TriangleCaps & DD_FLATSHADE) { COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); @@ -98,7 +106,8 @@ static void _swsetup_render_line_tri( GLcontext *ctx, } static void _swsetup_render_point_tri( GLcontext *ctx, - GLuint e0, GLuint e1, GLuint e2 ) + GLuint e0, GLuint e1, GLuint e2, + GLuint facing ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -111,6 +120,14 @@ static void _swsetup_render_point_tri( GLcontext *ctx, GLchan s[2][4]; GLuint i[2]; + /* cull testing */ + if (ctx->Polygon.CullFlag) { + if (facing == 1 && ctx->Polygon.CullFaceMode != GL_FRONT) + return; + if (facing == 0 && ctx->Polygon.CullFaceMode != GL_BACK) + return; + } + if (ctx->_TriangleCaps & DD_FLATSHADE) { COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); @@ -139,6 +156,7 @@ static void _swsetup_render_point_tri( GLcontext *ctx, v0->index = i[0]; v1->index = i[1]; } + _swrast_flush(ctx); } #define SS_COLOR(a,b) COPY_CHAN4(a,b) @@ -265,13 +283,19 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint ind = 0; - if (ctx->Polygon._OffsetAny) + if (ctx->Polygon.OffsetPoint || + ctx->Polygon.OffsetLine || + ctx->Polygon.OffsetFill) ind |= SS_OFFSET_BIT; if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) ind |= SS_TWOSIDE_BIT; - if (ctx->_TriangleCaps & DD_TRI_UNFILLED) + /* We piggyback the two-sided stencil front/back determination on the + * unfilled triangle path. + */ + if ((ctx->_TriangleCaps & DD_TRI_UNFILLED) || + (ctx->Stencil.Enabled && ctx->Stencil.TestTwoSide)) ind |= SS_UNFILLED_BIT; if (ctx->Visual.rgbMode) @@ -281,4 +305,6 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) tnl->Driver.Render.Quad = quad_tab[ind]; tnl->Driver.Render.Line = swsetup_line; tnl->Driver.Render.Points = swsetup_points; + + ctx->_Facing = 0; } diff --git a/xc/extras/Mesa/src/swrast_setup/ss_triangle.h b/xc/extras/Mesa/src/swrast_setup/ss_triangle.h index 655d7deab..78833269e 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_triangle.h +++ b/xc/extras/Mesa/src/swrast_setup/ss_triangle.h @@ -1,4 +1,3 @@ -/* $Id: ss_triangle.h,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef SS_TRIANGLE_H diff --git a/xc/extras/Mesa/src/swrast_setup/ss_tritmp.h b/xc/extras/Mesa/src/swrast_setup/ss_tritmp.h index 9801b7ab7..77219fc60 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_tritmp.h +++ b/xc/extras/Mesa/src/swrast_setup/ss_tritmp.h @@ -1,10 +1,9 @@ -/* $Id: ss_tritmp.h,v 1.1.1.1 2002/10/22 13:06:39 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -36,7 +35,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) GLfloat z[3]; GLfloat offset; GLenum mode = GL_FILL; - GLuint facing; + GLuint facing = 0; v[0] = &verts[e0]; v[1] = &verts[e1]; @@ -54,6 +53,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) { facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; + if (ctx->Stencil.TestTwoSide) + ctx->_Facing = facing; /* for 2-sided stencil test */ if (IND & SS_UNFILLED_BIT) mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; @@ -110,14 +111,14 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) v[1]->win[2] += offset; v[2]->win[2] += offset; } - _swsetup_render_point_tri( ctx, e0, e1, e2 ); + _swsetup_render_point_tri( ctx, e0, e1, e2, facing ); } else if (mode == GL_LINE) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { v[0]->win[2] += offset; v[1]->win[2] += offset; v[2]->win[2] += offset; } - _swsetup_render_line_tri( ctx, e0, e1, e2 ); + _swsetup_render_line_tri( ctx, e0, e1, e2, facing ); } else { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { v[0]->win[2] += offset; diff --git a/xc/extras/Mesa/src/swrast_setup/ss_vb.c b/xc/extras/Mesa/src/swrast_setup/ss_vb.c index 8f5d9161f..7f6832b4c 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_vb.c +++ b/xc/extras/Mesa/src/swrast_setup/ss_vb.c @@ -1,8 +1,7 @@ -/* $Id: ss_vb.c,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,13 +23,14 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "colormac.h" +#include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "swrast/swrast.h" #include "tnl/t_context.h" @@ -291,33 +291,32 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) * Initialization ***********************************************************************/ - - - - static void emit_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) { - fprintf(stderr, "swrast_setup: invalid setup function\n"); + _mesa_debug(ctx, "swrast_setup: invalid setup function\n"); (void) (ctx && start && end && newinputs); } + static void interp_invalid( GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) { - fprintf(stderr, "swrast_setup: invalid interp function\n"); + _mesa_debug(ctx, "swrast_setup: invalid interp function\n"); (void) (ctx && t && edst && eout && ein && force_boundary); } + static void copy_pv_invalid( GLcontext *ctx, GLuint edst, GLuint esrc ) { - fprintf(stderr, "swrast_setup: invalid copy_pv function\n"); + _mesa_debug(ctx, "swrast_setup: invalid copy_pv function\n"); (void) (ctx && edst && esrc ); } + static void init_standard( void ) { GLuint i; @@ -359,21 +358,24 @@ static void init_standard( void ) init_index_fog_point(); } -static void printSetupFlags(char *msg, GLuint flags ) + +/* debug only */ +#if 0 +static void +printSetupFlags(const GLcontext *ctx, char *msg, GLuint flags ) { - fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s\n", - msg, - (int)flags, - (flags & COLOR) ? "color, " : "", - (flags & INDEX) ? "index, " : "", - (flags & TEX0) ? "tex0, " : "", - (flags & MULTITEX) ? "multitex, " : "", - (flags & SPEC) ? "spec, " : "", - (flags & FOG) ? "fog, " : "", - (flags & POINT) ? "point, " : ""); + _mesa_debug(ctx, "%s(%x): %s%s%s%s%s%s%s\n", + msg, + (int) flags, + (flags & COLOR) ? "color, " : "", + (flags & INDEX) ? "index, " : "", + (flags & TEX0) ? "tex0, " : "", + (flags & MULTITEX) ? "multitex, " : "", + (flags & SPEC) ? "spec, " : "", + (flags & FOG) ? "fog, " : "", + (flags & POINT) ? "point, " : ""); } - - +#endif void _swsetup_choose_rastersetup_func(GLcontext *ctx) @@ -386,10 +388,10 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx) if (ctx->Visual.rgbMode) { funcindex = COLOR; - if (ctx->Texture._ReallyEnabled & ~TEXTURE0_ANY) - funcindex |= MULTITEX; - else if (ctx->Texture._ReallyEnabled & TEXTURE0_ANY) - funcindex |= TEX0; + if (ctx->Texture._EnabledUnits > 1) + funcindex |= MULTITEX; /* a unit above unit[0] is enabled */ + else if (ctx->Texture._EnabledUnits == 1) + funcindex |= TEX0; /* only unit 0 is enabled */ if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) funcindex |= SPEC; @@ -398,7 +400,8 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx) funcindex = INDEX; } - if (ctx->Point._Attenuated) + if (ctx->Point._Attenuated || + (ctx->VertexProgram.Enabled && ctx->VertexProgram.PointSizeEnabled)) funcindex |= POINT; if (ctx->Fog.Enabled) @@ -435,6 +438,8 @@ _swsetup_vb_init( GLcontext *ctx ) { (void) ctx; init_standard(); - (void) printSetupFlags; + /* + printSetupFlags(ctx); + */ } diff --git a/xc/extras/Mesa/src/swrast_setup/ss_vb.h b/xc/extras/Mesa/src/swrast_setup/ss_vb.h index c9c1f8cd8..6ea0cb1a7 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_vb.h +++ b/xc/extras/Mesa/src/swrast_setup/ss_vb.h @@ -1,4 +1,3 @@ -/* $Id: ss_vb.h,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef SS_VB_H diff --git a/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h b/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h index c2a48aca1..ba5f20fde 100644 --- a/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h +++ b/xc/extras/Mesa/src/swrast_setup/ss_vbtmp.h @@ -1,8 +1,7 @@ -/* $Id: ss_vbtmp.h,v 1.1.1.1 2002/10/22 13:06:38 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -73,11 +72,11 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, } } - proj = VB->ProjectedClipPtr->data[0]; - proj_stride = VB->ProjectedClipPtr->stride; + proj = VB->NdcPtr->data[0]; + proj_stride = VB->NdcPtr->stride; if (IND & FOG) { - fog = VB->FogCoordPtr->data; + fog = (GLfloat *) VB->FogCoordPtr->data; fog_stride = VB->FogCoordPtr->stride; } if (IND & COLOR) { @@ -99,7 +98,7 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, index_stride = VB->IndexPtr[0]->stride; } if (IND & POINT) { - pointSize = VB->PointSizePtr->data; + pointSize = (GLfloat *) VB->PointSizePtr->data; pointSize_stride = VB->PointSizePtr->stride; } @@ -215,6 +214,7 @@ static void TAG(interp)( GLcontext *ctx, INTERP_UI( t, dst->index, out->index, in->index ); } + /* XXX Point size interpolation??? */ if (IND & POINT) { INTERP_F( t, dst->pointSize, out->pointSize, in->pointSize ); } diff --git a/xc/extras/Mesa/src/swrast_setup/swrast_setup.h b/xc/extras/Mesa/src/swrast_setup/swrast_setup.h index 16dde40e9..4825c772f 100644 --- a/xc/extras/Mesa/src/swrast_setup/swrast_setup.h +++ b/xc/extras/Mesa/src/swrast_setup/swrast_setup.h @@ -1,4 +1,3 @@ -/* $Id: swrast_setup.h,v 1.1.1.1 2002/10/22 13:06:39 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ /* Public interface to the swrast_setup module. This module provides diff --git a/xc/extras/Mesa/src/texcompress.c b/xc/extras/Mesa/src/texcompress.c new file mode 100644 index 000000000..1890b0a13 --- /dev/null +++ b/xc/extras/Mesa/src/texcompress.c @@ -0,0 +1,154 @@ + +/* + * Mesa 3-D graphics library + * Version: 4.1 + * + * Copyright (C) 1999-2002 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. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "image.h" +#include "texcompress.h" +#include "texformat.h" + + +/** + * Get the list of supported internal compression formats. + * \param formats - the results list (may be NULL) + * \return number of formats. + */ +GLuint +_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ) +{ + GLuint n = 0; + if (ctx->Extensions.ARB_texture_compression) { + if (ctx->Extensions.TDFX_texture_compression_FXT1) { + if (formats) { + formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX; + formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX; + } + else { + n += 4; + } + } + } + return n; +} + + + +/** + * Return bytes of storage needed for the given texture size and compressed + * format. + * \param width, height, depth - texture size in texels + * \param texFormat - one of the compressed format enums + * \return size in bytes, or zero if bad texFormat + */ +GLuint +_mesa_compressed_texture_size( GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format ) +{ + GLuint size; + + switch (format) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + /* round up to multiple of 4 */ + size = ((width + 7) / 8) * ((height + 3) / 4) * 16; + return size; + default: + _mesa_problem(ctx, "bad texformat in compressed_texture_size"); + return 0; + } +} + + +/* + * Compute the bytes per row in a compressed texture image. + */ +GLint +_mesa_compressed_row_stride(GLenum format, GLsizei width) +{ + GLint bytesPerTile, stride; + + switch (format) { + default: + return 0; + } + + stride = ((width + 3) / 4) * bytesPerTile; + return stride; +} + + +/* + * Return the address of the pixel at (col, row, img) in a + * compressed texture image. + * \param col, row, img - image position (3D) + * \param format - compressed image format + * \param width - image width + * \param image - the image address + * \return address of pixel at (row, col) + */ +GLubyte * +_mesa_compressed_image_address(GLint col, GLint row, GLint img, + GLenum format, + GLsizei width, const GLubyte *image) +{ + GLint bytesPerTile, stride; + GLubyte *addr; + + ASSERT((row & 3) == 0); + ASSERT((col & 3) == 0); + (void) img; + + switch (format) { + default: + return 0; + } + + stride = ((width + 3) / 4) * bytesPerTile; + + addr = (GLubyte *) image + (row / 4) * stride + (col / 4) * bytesPerTile; + return addr; +} + + + +/* + * \param srcRowStride - source stride, in pixels + */ +void +_mesa_compress_teximage( GLcontext *ctx, GLsizei width, GLsizei height, + GLenum srcFormat, const GLchan *source, + GLint srcRowStride, + const struct gl_texture_format *dstFormat, + GLubyte *dest, GLint dstRowStride ) +{ + switch (dstFormat->MesaFormat) { + default: + _mesa_problem(ctx, "Bad dstFormat in _mesa_compress_teximage()"); + return; + } +} diff --git a/xc/extras/Mesa/src/swrast/s_scissor.h b/xc/extras/Mesa/src/texcompress.h index ec454e4dd..d0856142e 100644 --- a/xc/extras/Mesa/src/swrast/s_scissor.h +++ b/xc/extras/Mesa/src/texcompress.h @@ -1,10 +1,9 @@ -/* $Id: s_scissor.h,v 1.1.1.1 2002/10/22 13:06:51 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,17 +23,35 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef S_SCISSOR_H -#define S_SCISSOR_H - +#ifndef TEXCOMPRESS_H +#define TEXCOMPRESS_H #include "mtypes.h" -#include "swrast.h" extern GLuint -_mesa_scissor_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte mask[]); +_mesa_get_compressed_formats( GLcontext *ctx, GLint *formats ); + +extern GLuint +_mesa_compressed_texture_size( GLcontext *ctx, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format ); + +extern GLint +_mesa_compressed_row_stride(GLenum format, GLsizei width); + + +extern GLubyte * +_mesa_compressed_image_address(GLint col, GLint row, GLint img, + GLenum format, + GLsizei width, const GLubyte *image); + +extern void +_mesa_compress_teximage( GLcontext *ctx, GLsizei width, GLsizei height, + GLenum srcFormat, const GLchan *source, + GLint srcRowStride, + const struct gl_texture_format *dstFormat, + GLubyte *dest, GLint dstRowStride ); -#endif +#endif /* TEXCOMPRESS_H */ diff --git a/xc/extras/Mesa/src/texformat.c b/xc/extras/Mesa/src/texformat.c index a55d9ddb0..88ab316d8 100644 --- a/xc/extras/Mesa/src/texformat.c +++ b/xc/extras/Mesa/src/texformat.c @@ -23,24 +23,19 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" #include "image.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "texformat.h" #include "teximage.h" #include "texstate.h" -#include "swrast/s_span.h" -#endif /* Texel fetch routines for all supported formats: @@ -74,7 +69,6 @@ static void fetch_null_texel( const struct gl_texture_image *texImage, const struct gl_texture_format _mesa_texformat_rgba = { MESA_FORMAT_RGBA, /* MesaFormat */ GL_RGBA, /* BaseFormat */ - CHAN_TYPE, /* Type */ CHAN_BITS, /* RedBits */ CHAN_BITS, /* GreenBits */ CHAN_BITS, /* BlueBits */ @@ -92,7 +86,6 @@ const struct gl_texture_format _mesa_texformat_rgba = { const struct gl_texture_format _mesa_texformat_rgb = { MESA_FORMAT_RGB, /* MesaFormat */ GL_RGB, /* BaseFormat */ - CHAN_TYPE, /* Type */ CHAN_BITS, /* RedBits */ CHAN_BITS, /* GreenBits */ CHAN_BITS, /* BlueBits */ @@ -110,7 +103,6 @@ const struct gl_texture_format _mesa_texformat_rgb = { const struct gl_texture_format _mesa_texformat_alpha = { MESA_FORMAT_ALPHA, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ - CHAN_TYPE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -128,7 +120,6 @@ const struct gl_texture_format _mesa_texformat_alpha = { const struct gl_texture_format _mesa_texformat_luminance = { MESA_FORMAT_LUMINANCE, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ - CHAN_TYPE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -146,7 +137,6 @@ const struct gl_texture_format _mesa_texformat_luminance = { const struct gl_texture_format _mesa_texformat_luminance_alpha = { MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ - CHAN_TYPE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -164,7 +154,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { const struct gl_texture_format _mesa_texformat_intensity = { MESA_FORMAT_INTENSITY, /* MesaFormat */ GL_INTENSITY, /* BaseFormat */ - CHAN_TYPE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -182,7 +171,6 @@ const struct gl_texture_format _mesa_texformat_intensity = { const struct gl_texture_format _mesa_texformat_color_index = { MESA_FORMAT_COLOR_INDEX, /* MesaFormat */ GL_COLOR_INDEX, /* BaseFormat */ - CHAN_TYPE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -200,7 +188,6 @@ const struct gl_texture_format _mesa_texformat_color_index = { const struct gl_texture_format _mesa_texformat_depth_component = { MESA_FORMAT_DEPTH_COMPONENT, /* MesaFormat */ GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_FLOAT, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -223,7 +210,6 @@ const struct gl_texture_format _mesa_texformat_depth_component = { const struct gl_texture_format _mesa_texformat_rgba8888 = { MESA_FORMAT_RGBA8888, /* MesaFormat */ GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_INT_8_8_8_8, /* Type */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ @@ -241,7 +227,6 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { const struct gl_texture_format _mesa_texformat_argb8888 = { MESA_FORMAT_ARGB8888, /* MesaFormat */ GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_INT_8_8_8_8_REV, /* Type */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ @@ -259,7 +244,6 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { const struct gl_texture_format _mesa_texformat_rgb888 = { MESA_FORMAT_RGB888, /* MesaFormat */ GL_RGB, /* BaseFormat */ - GL_UNSIGNED_BYTE, /* Type */ 8, /* RedBits */ 8, /* GreenBits */ 8, /* BlueBits */ @@ -277,7 +261,6 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { const struct gl_texture_format _mesa_texformat_rgb565 = { MESA_FORMAT_RGB565, /* MesaFormat */ GL_RGB, /* BaseFormat */ - GL_UNSIGNED_SHORT_5_6_5, /* Type */ 5, /* RedBits */ 6, /* GreenBits */ 5, /* BlueBits */ @@ -295,7 +278,6 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { const struct gl_texture_format _mesa_texformat_argb4444 = { MESA_FORMAT_ARGB4444, /* MesaFormat */ GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */ 4, /* RedBits */ 4, /* GreenBits */ 4, /* BlueBits */ @@ -313,7 +295,6 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { const struct gl_texture_format _mesa_texformat_argb1555 = { MESA_FORMAT_ARGB1555, /* MesaFormat */ GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */ 5, /* RedBits */ 5, /* GreenBits */ 5, /* BlueBits */ @@ -331,7 +312,6 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { const struct gl_texture_format _mesa_texformat_al88 = { MESA_FORMAT_AL88, /* MesaFormat */ GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_BYTE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -349,7 +329,6 @@ const struct gl_texture_format _mesa_texformat_al88 = { const struct gl_texture_format _mesa_texformat_rgb332 = { MESA_FORMAT_RGB332, /* MesaFormat */ GL_RGB, /* BaseFormat */ - GL_UNSIGNED_BYTE_3_3_2, /* Type */ 3, /* RedBits */ 3, /* GreenBits */ 2, /* BlueBits */ @@ -367,7 +346,6 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { const struct gl_texture_format _mesa_texformat_a8 = { MESA_FORMAT_A8, /* MesaFormat */ GL_ALPHA, /* BaseFormat */ - GL_UNSIGNED_BYTE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -385,7 +363,6 @@ const struct gl_texture_format _mesa_texformat_a8 = { const struct gl_texture_format _mesa_texformat_l8 = { MESA_FORMAT_L8, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_BYTE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -403,7 +380,6 @@ const struct gl_texture_format _mesa_texformat_l8 = { const struct gl_texture_format _mesa_texformat_i8 = { MESA_FORMAT_I8, /* MesaFormat */ GL_INTENSITY, /* BaseFormat */ - GL_UNSIGNED_BYTE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -421,7 +397,6 @@ const struct gl_texture_format _mesa_texformat_i8 = { const struct gl_texture_format _mesa_texformat_ci8 = { MESA_FORMAT_CI8, /* MesaFormat */ GL_COLOR_INDEX, /* BaseFormat */ - GL_UNSIGNED_BYTE, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -436,15 +411,196 @@ const struct gl_texture_format _mesa_texformat_ci8 = { fetch_3d_texel_ci8, /* FetchTexel3D */ }; +const struct gl_texture_format _mesa_texformat_ycbcr = { + MESA_FORMAT_YCBCR, /* MesaFormat */ + GL_YCBCR_MESA, /* BaseFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_ycbcr, /* FetchTexel1D */ + fetch_2d_texel_ycbcr, /* FetchTexel2D */ + fetch_3d_texel_ycbcr, /* FetchTexel3D */ +}; + + +const struct gl_texture_format _mesa_texformat_ycbcr_rev = { + MESA_FORMAT_YCBCR_REV, /* MesaFormat */ + GL_YCBCR_MESA, /* BaseFormat */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_ycbcr_rev, /* FetchTexel1D */ + fetch_2d_texel_ycbcr_rev, /* FetchTexel2D */ + fetch_3d_texel_ycbcr_rev, /* FetchTexel3D */ +}; + + +/* Big-endian */ +#if 0 +const struct gl_texture_format _mesa_texformat_abgr8888 = { + MESA_FORMAT_ABGR8888, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_INT_8_8_8_8, /* Type */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4, /* TexelBytes */ + fetch_1d_texel_abgr8888, /* FetchTexel1D */ + fetch_2d_texel_abgr8888, /* FetchTexel2D */ + fetch_3d_texel_abgr8888, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_bgra8888 = { + MESA_FORMAT_BGRA8888, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_INT_8_8_8_8, /* Type */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 4, /* TexelBytes */ + fetch_1d_texel_bgra8888, /* FetchTexel1D */ + fetch_2d_texel_bgra8888, /* FetchTexel2D */ + fetch_3d_texel_bgra8888, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_bgr888 = { + MESA_FORMAT_BGR888, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_BYTE, /* Type */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 3, /* TexelBytes */ + fetch_1d_texel_bgr888, /* FetchTexel1D */ + fetch_2d_texel_bgr888, /* FetchTexel2D */ + fetch_3d_texel_bgr888, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_bgr565 = { + MESA_FORMAT_BGR565, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_SHORT_5_6_5, /* Type */ + 5, /* RedBits */ + 6, /* GreenBits */ + 5, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_bgr565, /* FetchTexel1D */ + fetch_2d_texel_bgr565, /* FetchTexel2D */ + fetch_3d_texel_bgr565, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_bgra4444 = { + MESA_FORMAT_BGRA4444, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_SHORT_4_4_4_4_REV, /* Type */ + 4, /* RedBits */ + 4, /* GreenBits */ + 4, /* BlueBits */ + 4, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_bgra4444, /* FetchTexel1D */ + fetch_2d_texel_bgra4444, /* FetchTexel2D */ + fetch_3d_texel_bgra4444, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_bgra5551 = { + MESA_FORMAT_BGRA5551, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_SHORT_1_5_5_5_REV, /* Type */ + 5, /* RedBits */ + 5, /* GreenBits */ + 5, /* BlueBits */ + 1, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_bgra1555, /* FetchTexel1D */ + fetch_2d_texel_bgra1555, /* FetchTexel2D */ + fetch_3d_texel_bgra1555, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_la88 = { + MESA_FORMAT_LA88, /* MesaFormat */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_BYTE, /* Type */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 8, /* AlphaBits */ + 8, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 2, /* TexelBytes */ + fetch_1d_texel_la88, /* FetchTexel1D */ + fetch_2d_texel_la88, /* FetchTexel2D */ + fetch_3d_texel_la88, /* FetchTexel3D */ +}; + +const struct gl_texture_format _mesa_texformat_bgr233 = { + MESA_FORMAT_BGR233, /* MesaFormat */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_BYTE_3_3_2, /* Type */ + 3, /* RedBits */ + 3, /* GreenBits */ + 2, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 1, /* TexelBytes */ + fetch_1d_texel_bgr233, /* FetchTexel1D */ + fetch_2d_texel_bgr233, /* FetchTexel2D */ + fetch_3d_texel_bgr233, /* FetchTexel3D */ +}; +#endif /* ============================================================= - * Null format: + * Null format (useful for proxy textures): */ const struct gl_texture_format _mesa_null_texformat = { -1, /* MesaFormat */ 0, /* BaseFormat */ - 0, /* Type */ 0, /* RedBits */ 0, /* GreenBits */ 0, /* BlueBits */ @@ -460,7 +616,6 @@ const struct gl_texture_format _mesa_null_texformat = { }; - GLboolean _mesa_is_hardware_tex_format( const struct gl_texture_format *format ) { @@ -471,8 +626,8 @@ _mesa_is_hardware_tex_format( const struct gl_texture_format *format ) /* Given an internal texture format (or 1, 2, 3, 4) return a pointer * to a gl_texture_format which which to store the texture. * This is called via ctx->Driver.ChooseTextureFormat(). - * Hardware drivers should not use this function, but instead a - * specialized function. + * Hardware drivers typically override this function with a specialized + * version. */ const struct gl_texture_format * _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, @@ -589,9 +744,15 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, _mesa_problem(ctx, "texture compression extension not enabled"); return &_mesa_texformat_rgba; + /* GL_MESA_ycrcr_texture */ + case GL_YCBCR_MESA: + if (type == GL_UNSIGNED_SHORT_8_8_MESA) + return &_mesa_texformat_ycbcr; + else + return &_mesa_texformat_ycbcr_rev; + default: _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); - printf("intformat = %d %x\n", internalFormat, internalFormat); return NULL; } } @@ -626,23 +787,3 @@ _mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat) return -1; /* not a recognized compressed format */ } } - - -/* - * Called via ctx->Driver.CompressedTextureSize(). - * This function is only used by software rasterizers. - * Hardware drivers will have to implement a specialized function. - */ -GLint -_mesa_compressed_texture_size(GLcontext *ctx, - const struct gl_texture_image *texImage) -{ - GLint b; - assert(texImage); - assert(texImage->TexFormat); - - b = texImage->Width * texImage->Height * texImage->Depth * - texImage->TexFormat->TexelBytes; - assert(b > 0); - return b; -} diff --git a/xc/extras/Mesa/src/texformat.h b/xc/extras/Mesa/src/texformat.h index 72b473cdf..1ea33090f 100644 --- a/xc/extras/Mesa/src/texformat.h +++ b/xc/extras/Mesa/src/texformat.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef TEXFORMAT_H @@ -32,17 +32,20 @@ #include "mtypes.h" -/* The Mesa internal texture image types. These will be set to their - * default value, but may be changed by drivers as required. +/* + * The Mesa internal texture image types. + * All texture images must be stored in one of these formats. */ enum _format { /* Hardware-friendly formats. Drivers can override the default * formats and convert texture images to one of these as required. + * The driver's ChooseTextureFormat() function will choose one of + * these formats. * These formats are all little endian, as shown below. They will be * most useful for x86-based PC graphics card drivers. * * NOTE: In the default case, some of these formats will be - * duplicates of the default formats listed above. However, these + * duplicates of the generic formats listed below. However, these * formats guarantee their internal component sizes, while GLchan may * vary betwen GLubyte, GLushort and GLfloat. */ @@ -60,6 +63,23 @@ enum _format { MESA_FORMAT_L8, /* LLLL LLLL */ MESA_FORMAT_I8, /* IIII IIII */ MESA_FORMAT_CI8, /* CCCC CCCC */ + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ + +#if 0 + /* upcoming little-endian formats: */ + + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_ABGR8888, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_BGRA8888, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_BGR565, /* BBBB BGGG GGGR RRRR */ + MESA_FORMAT_BGRA4444, /* BBBB GGGG RRRR AAAA */ + MESA_FORMAT_BGRA5551, /* BBBB BGGG GGRR RRRA */ + MESA_FORMAT_LA88, /* LLLL LLLL AAAA AAAA */ + MESA_FORMAT_BGR233, /* BBGG GRRR */ +#endif /* Generic GLchan-based formats. These are the default formats used * by the software rasterizer and, unless the driver overrides the @@ -69,7 +89,7 @@ enum _format { * * NOTE: Because these are based on the GLchan datatype, one cannot * assume 8 bits per channel with these formats. If you require - * GLubyte per channel, use one of the hardware formats above. + * GLubyte channels, use one of the hardware formats above. */ MESA_FORMAT_RGBA, MESA_FORMAT_RGB, @@ -92,10 +112,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, extern GLint _mesa_base_compressed_texformat(GLcontext *ctx, GLint intFormat); -extern GLint -_mesa_compressed_texture_size(GLcontext *ctx, - const struct gl_texture_image *texImage); - /* The default formats, GLchan per component: */ @@ -122,6 +138,8 @@ extern const struct gl_texture_format _mesa_texformat_a8; extern const struct gl_texture_format _mesa_texformat_l8; extern const struct gl_texture_format _mesa_texformat_i8; extern const struct gl_texture_format _mesa_texformat_ci8; +extern const struct gl_texture_format _mesa_texformat_ycbcr; +extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; /* The null format: */ diff --git a/xc/extras/Mesa/src/texformat_tmp.h b/xc/extras/Mesa/src/texformat_tmp.h index cc788d658..6b1c001dc 100644 --- a/xc/extras/Mesa/src/texformat_tmp.h +++ b/xc/extras/Mesa/src/texformat_tmp.h @@ -1,10 +1,9 @@ -/* $Id: texformat_tmp.h,v 1.1.1.1 2002/10/22 13:05:22 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,10 +22,18 @@ * 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. * - * Author: - * Gareth Hughes <gareth@valinux.com> + * Authors: + * Gareth Hughes + * Brian Paul */ + +/* + * This template file generates texel fetch functions for 1-D, 2-D and 3-D + * texture images. + */ + + #if DIM == 1 #define CHAN_SRC( t, i, j, k, sz ) \ @@ -43,13 +50,13 @@ #elif DIM == 2 #define CHAN_SRC( t, i, j, k, sz ) \ - ((GLchan *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) + ((GLchan *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) #define UBYTE_SRC( t, i, j, k, sz ) \ - ((GLubyte *)(t)->Data + ((t)->Width * (j) + (i)) * (sz)) + ((GLubyte *)(t)->Data + ((t)->RowStride * (j) + (i)) * (sz)) #define USHORT_SRC( t, i, j, k ) \ - ((GLushort *)(t)->Data + ((t)->Width * (j) + (i))) + ((GLushort *)(t)->Data + ((t)->RowStride * (j) + (i))) #define FLOAT_SRC( t, i, j, k ) \ - ((GLfloat *)(t)->Data + ((t)->Width * (j) + (i))) + ((GLfloat *)(t)->Data + ((t)->RowStride * (j) + (i))) #define FETCH(x) fetch_2d_texel_##x @@ -57,16 +64,16 @@ #define CHAN_SRC( t, i, j, k, sz ) \ (GLchan *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz) + (t)->RowStride + (i)) * (sz) #define UBYTE_SRC( t, i, j, k, sz ) \ ((GLubyte *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i)) * (sz)) + (t)->RowStride + (i)) * (sz)) #define USHORT_SRC( t, i, j, k ) \ ((GLushort *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) + (t)->RowStride + (i))) #define FLOAT_SRC( t, i, j, k ) \ ((GLfloat *)(t)->Data + (((t)->Height * (k) + (j)) * \ - (t)->Width + (i))) + (t)->RowStride + (i))) #define FETCH(x) fetch_3d_texel_##x @@ -191,7 +198,8 @@ static void FETCH(rgb565)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 ); @@ -202,7 +210,8 @@ static void FETCH(argb4444)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); @@ -213,7 +222,8 @@ static void FETCH(argb1555)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLushort *src = USHORT_SRC( texImage, i, j, k ); - GLchan *rgba = (GLchan *) texel; GLushort s = *src; + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f ); @@ -235,7 +245,8 @@ static void FETCH(rgb332)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLvoid *texel ) { const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); - GLchan *rgba = (GLchan *) texel; GLubyte s = *src; + const GLubyte s = *src; + GLchan *rgba = (GLchan *) texel; rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 ); rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 ); rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 ); @@ -283,6 +294,163 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage, *index = UBYTE_TO_CHAN( *src ); } +/* XXX this may break if GLchan != GLubyte */ +static void FETCH(ycbcr)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ + const GLubyte cb = *src0 & 0xff; /* chroma U */ + const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ + const GLubyte cr = *src1 & 0xff; /* chroma V */ + GLchan *rgba = (GLchan *) texel; + GLint r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + } + rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX); + rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX); + rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX); + rgba[ACOMP] = CHAN_MAX; +} + +/* XXX this may break if GLchan != GLubyte */ +static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src0 = USHORT_SRC( texImage, (i & ~1), j, k ); /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = *src0 & 0xff; /* luminance */ + const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma U */ + const GLubyte y1 = *src1 & 0xff; /* luminance */ + const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma V */ + GLchan *rgba = (GLchan *) texel; + GLint r, g, b; + if (i & 1) { + /* odd pixel: use y1,cr,cb */ + r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128)); + } + else { + /* even pixel: use y0,cr,cb */ + r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128)); + g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128)); + b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128)); + } + rgba[RCOMP] = CLAMP(r, 0, CHAN_MAX); + rgba[GCOMP] = CLAMP(g, 0, CHAN_MAX); + rgba[BCOMP] = CLAMP(b, 0, CHAN_MAX); + rgba[ACOMP] = CHAN_MAX; +} + + +/* big-endian */ + +#if 0 +static void FETCH(abgr8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 ); + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( src[3] ); + rgba[GCOMP] = UBYTE_TO_CHAN( src[2] ); + rgba[BCOMP] = UBYTE_TO_CHAN( src[1] ); + rgba[ACOMP] = UBYTE_TO_CHAN( src[0] ); +} + +static void FETCH(bgra8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 4 ); + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( src[2] ); + rgba[GCOMP] = UBYTE_TO_CHAN( src[1] ); + rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); + rgba[ACOMP] = UBYTE_TO_CHAN( src[3] ); +} + +static void FETCH(bgr888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 3 ); + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( src[2] ); + rgba[GCOMP] = UBYTE_TO_CHAN( src[1] ); + rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); + rgba[ACOMP] = CHAN_MAX; +} + +static void FETCH(bgr565)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src = USHORT_SRC( texImage, i, j, k ); + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) * 255 / 0xf8 ); + rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) * 255 / 0xfc ); + rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) * 255 / 0xf8 ); + rgba[ACOMP] = CHAN_MAX; +} + +static void FETCH(bgra4444)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src = USHORT_SRC( texImage, i, j, k ); + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf) * 255 / 0xf ); + rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 4) & 0xf) * 255 / 0xf ); + rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0xf) * 255 / 0xf ); + rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) * 255 / 0xf ); +} + +static void FETCH(bgra5551)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLushort *src = USHORT_SRC( texImage, i, j, k ); + const GLushort s = *src; + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( ((s >> 10) & 0x1f) * 255 / 0x1f ); + rgba[GCOMP] = UBYTE_TO_CHAN( ((s >> 5) & 0x1f) * 255 / 0x1f ); + rgba[BCOMP] = UBYTE_TO_CHAN( ((s ) & 0x1f) * 255 / 0x1f ); + rgba[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 ); +} + +static void FETCH(la88)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 2 ); + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( src[0] ); + rgba[GCOMP] = UBYTE_TO_CHAN( src[0] ); + rgba[BCOMP] = UBYTE_TO_CHAN( src[0] ); + rgba[ACOMP] = UBYTE_TO_CHAN( src[1] ); +} + +static void FETCH(bgr233)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLvoid *texel ) +{ + const GLubyte *src = UBYTE_SRC( texImage, i, j, k, 1 ); + const GLubyte s = *src; + GLchan *rgba = (GLchan *) texel; + rgba[RCOMP] = UBYTE_TO_CHAN( ((s ) & 0xe0) * 255 / 0xe0 ); + rgba[GCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xe0) * 255 / 0xe0 ); + rgba[BCOMP] = UBYTE_TO_CHAN( ((s << 5) & 0xc0) * 255 / 0xc0 ); + rgba[ACOMP] = CHAN_MAX; +} +#endif + #undef CHAN_SRC #undef UBYTE_SRC diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index 48cf19c68..1beccc5ce 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,25 +23,20 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "convolve.h" #include "image.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "mmath.h" #include "state.h" +#include "texcompress.h" #include "texformat.h" #include "teximage.h" #include "texstate.h" #include "texstore.h" #include "mtypes.h" -#include "swrast/s_span.h" /* XXX SWRAST hack */ -#endif /* @@ -54,8 +49,8 @@ */ -#ifdef DEBUG -static void PrintTexture(const struct gl_texture_image *img) +#if 0 +static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) { #if CHAN_TYPE == GL_FLOAT _mesa_problem(NULL, "PrintTexture doesn't support float channels"); @@ -64,7 +59,7 @@ static void PrintTexture(const struct gl_texture_image *img) const GLchan *data = (const GLchan *) img->Data; if (!data) { - printf("No texture data\n"); + _mesa_printf("No texture data\n"); return; } @@ -92,16 +87,16 @@ static void PrintTexture(const struct gl_texture_image *img) for (i = 0; i < img->Height; i++) { for (j = 0; j < img->Width; j++) { if (c==1) - printf("%02x ", data[0]); + _mesa_printf("%02x ", data[0]); else if (c==2) - printf("%02x%02x ", data[0], data[1]); + _mesa_printf("%02x%02x ", data[0], data[1]); else if (c==3) - printf("%02x%02x%02x ", data[0], data[1], data[2]); + _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); else if (c==4) - printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); - data += c; + _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + data += (img->RowStride - img->Width) * c; } - printf("\n"); + _mesa_printf("\n"); } #endif } @@ -142,6 +137,10 @@ logbase2( int n ) * Given an internal texture format enum or 1, 2, 3, 4 return the * corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE, * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. + * + * This is the format which is used during texture application (i.e. the + * texture format and env mode determine the arithmetic used. + * * Return -1 if invalid enum. */ GLint @@ -151,12 +150,6 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format ) * Ask the driver for the base format, if it doesn't * know, it will return -1; */ - if (ctx->Driver.BaseCompressedTexFormat) { - GLint ifmt = (*ctx->Driver.BaseCompressedTexFormat)(ctx, format); - if (ifmt >= 0) { - return ifmt; - } - } switch (format) { case GL_ALPHA: case GL_ALPHA4: @@ -213,7 +206,10 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format ) case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return GL_COLOR_INDEX; + if (ctx->Extensions.EXT_paletted_texture) + return GL_COLOR_INDEX; + else + return -1; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16_SGIX: case GL_DEPTH_COMPONENT24_SGIX: @@ -222,6 +218,55 @@ _mesa_base_tex_format( GLcontext *ctx, GLint format ) return GL_DEPTH_COMPONENT; else return -1; + + /* GL_ARB_texture_compression */ + case GL_COMPRESSED_ALPHA: + if (ctx->Extensions.ARB_texture_compression) + return GL_ALPHA; + else + return -1; + case GL_COMPRESSED_LUMINANCE: + if (ctx->Extensions.ARB_texture_compression) + return GL_LUMINANCE; + else + return -1; + case GL_COMPRESSED_LUMINANCE_ALPHA: + if (ctx->Extensions.ARB_texture_compression) + return GL_LUMINANCE_ALPHA; + else + return -1; + case GL_COMPRESSED_INTENSITY: + if (ctx->Extensions.ARB_texture_compression) + return GL_INTENSITY; + else + return -1; + case GL_COMPRESSED_RGB: + if (ctx->Extensions.ARB_texture_compression) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGBA: + if (ctx->Extensions.ARB_texture_compression) + return GL_RGBA; + else + return -1; + case GL_COMPRESSED_RGB_FXT1_3DFX: + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return GL_RGBA; + else + return -1; + + case GL_YCBCR_MESA: + if (ctx->Extensions.MESA_ycbcr_texture) + return GL_YCBCR_MESA; + else + return -1; + default: return -1; /* error */ } @@ -279,6 +324,7 @@ is_color_format(GLenum format) case GL_RGBA12: case GL_RGBA16: return GL_TRUE; + case GL_YCBCR_MESA: /* not considered to be RGB */ default: return GL_FALSE; } @@ -303,25 +349,24 @@ is_index_format(GLenum format) } -/* - * Return GL_TRUE if internalFormat is a compressed format, return GL_FALSE - * otherwise. +/** + * Return GL_TRUE if internalFormat is a supported compressed format, + * return GL_FALSE otherwise. + * \param - internalFormat - the internal format token provided by the user */ static GLboolean -is_compressed_format(GLcontext *ctx, GLenum internalFormat) +is_compressed_format(GLenum internalFormat) { - if (ctx->Driver.BaseCompressedTexFormat) { - GLint b = (*ctx->Driver.BaseCompressedTexFormat)(ctx, internalFormat); - if (b > 0) + switch (internalFormat) { + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: return GL_TRUE; - else + default: return GL_FALSE; } - return GL_FALSE; } - /* * Store a gl_texture_image pointer in a gl_texture_object structure * according to the target and level parameters. @@ -384,7 +429,7 @@ _mesa_alloc_texture_image( void ) void _mesa_free_texture_image( struct gl_texture_image *teximage ) { - if (teximage->Data) { + if (teximage->Data && !teximage->IsClientData) { MESA_PBUFFER_FREE( teximage->Data ); teximage->Data = NULL; } @@ -532,6 +577,41 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, } +/* + * Return the maximum number of allows mipmap levels for the given + * texture target. + */ +GLint +_mesa_max_texture_levels(GLcontext *ctx, GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + return ctx->Const.MaxTextureLevels; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return ctx->Const.Max3DTextureLevels; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Const.MaxCubeTextureLevels; + break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return 1; + break; + default: + return 0; /* bad target */ + } +} + + #if 000 /* not used anymore */ /* @@ -605,6 +685,7 @@ clear_teximage_fields(struct gl_texture_image *img) img->Width = 0; img->Height = 0; img->Depth = 0; + img->RowStride = 0; img->Width2 = 0; img->Height2 = 0; img->Depth2 = 0; @@ -636,6 +717,7 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->Width = width; img->Height = height; img->Depth = depth; + img->RowStride = width; img->WidthLog2 = logbase2(width - 2 * border); if (height == 1) /* 1-D texture */ img->HeightLog2 = 0; @@ -649,7 +731,13 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->Height2 = 1 << img->HeightLog2; img->Depth2 = 1 << img->DepthLog2; img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); - img->IsCompressed = is_compressed_format(ctx, internalFormat); + img->IsCompressed = is_compressed_format(internalFormat); + if (img->IsCompressed) + img->CompressedSize = _mesa_compressed_texture_size(ctx, width, height, + depth, internalFormat); + else + img->CompressedSize = 0; + /* Compute Width/Height/DepthScale for mipmap lod computation */ if (target == GL_TEXTURE_RECTANGLE_NV) { /* scale = 1.0 since texture coords directly map to texels */ @@ -661,7 +749,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->WidthScale = (GLfloat) img->Width; img->HeightScale = (GLfloat) img->Height; img->DepthScale = (GLfloat) img->Depth; - }} + } +} @@ -680,7 +769,6 @@ texture_error_check( GLcontext *ctx, GLenum target, GLint depth, GLint border ) { GLboolean isProxy; - GLint iformat; GLint maxLevels = 0, maxTextureSize; if (dimensions == 1) { @@ -767,9 +855,8 @@ texture_error_check( GLcontext *ctx, GLenum target, /* Border */ if (border != 0 && border != 1) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(border=%d)", dimensions, border); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(border=%d)", dimensions, border); } return GL_TRUE; } @@ -783,9 +870,8 @@ texture_error_check( GLcontext *ctx, GLenum target, target == GL_PROXY_TEXTURE_RECTANGLE_NV) { if (width < 1 || width > ctx->Const.MaxTextureRectSize) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(width=%d)", dimensions, width); } return GL_TRUE; } @@ -793,9 +879,8 @@ texture_error_check( GLcontext *ctx, GLenum target, else if (width < 2 * border || width > 2 + maxTextureSize || logbase2( width - 2 * border ) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(width=%d)", dimensions, width); } return GL_TRUE; } @@ -805,9 +890,8 @@ texture_error_check( GLcontext *ctx, GLenum target, target == GL_PROXY_TEXTURE_RECTANGLE_NV) { if (height < 1 || height > ctx->Const.MaxTextureRectSize) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(height=%d)", dimensions, height); } return GL_TRUE; } @@ -816,9 +900,8 @@ texture_error_check( GLcontext *ctx, GLenum target, if (height < 2 * border || height > 2 + maxTextureSize || logbase2( height - 2 * border ) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(height=%d)", dimensions, height); } return GL_TRUE; } @@ -840,9 +923,8 @@ texture_error_check( GLcontext *ctx, GLenum target, if (depth < 2 * border || depth > 2 + maxTextureSize || logbase2( depth - 2 * border ) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage3D(depth=%d)", depth ); - _mesa_error( ctx, GL_INVALID_VALUE, message ); + _mesa_error( ctx, GL_INVALID_VALUE, + "glTexImage3D(depth=%d)", depth ); } return GL_TRUE; } @@ -853,18 +935,16 @@ texture_error_check( GLcontext *ctx, GLenum target, target == GL_PROXY_TEXTURE_RECTANGLE_NV) { if (level != 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage2D(level=%d)", level); } return GL_TRUE; } } else if (level < 0 || level >= maxLevels) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(level=%d)", dimensions, level); } return GL_TRUE; } @@ -878,32 +958,85 @@ texture_error_check( GLcontext *ctx, GLenum target, } } - iformat = _mesa_base_tex_format( ctx, internalFormat ); - if (iformat < 0) { + if (_mesa_base_tex_format(ctx, internalFormat) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(internalFormat=0x%x)", dimensions, - internalFormat); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(internalFormat=0x%x)", + dimensions, internalFormat); } return GL_TRUE; } - ASSERT(iformat > 0); - - if (!is_compressed_format( ctx, internalFormat ) && - !_mesa_is_legal_format_and_type( format, type )) { + if (!_mesa_is_legal_format_and_type(format, type)) { /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. */ if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(format or type)", dimensions); - _mesa_error(ctx, GL_INVALID_OPERATION, message); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(format or type)", dimensions); } return GL_TRUE; } + if (format == GL_YCBCR_MESA || internalFormat == GL_YCBCR_MESA) { + ASSERT(ctx->Extensions.MESA_ycbcr_texture); + if (format != GL_YCBCR_MESA || + internalFormat != GL_YCBCR_MESA || + (type != GL_UNSIGNED_SHORT_8_8_MESA && + type != GL_UNSIGNED_SHORT_8_8_REV_MESA)) { + char message[100]; + _mesa_sprintf(message, + "glTexImage%d(format/type/internalFormat YCBCR mismatch", + dimensions); + _mesa_error(ctx, GL_INVALID_ENUM, message); + return GL_TRUE; /* error */ + } + if (target != GL_TEXTURE_2D && + target != GL_PROXY_TEXTURE_2D && + target != GL_TEXTURE_RECTANGLE_NV && + target != GL_PROXY_TEXTURE_RECTANGLE_NV) { + if (!isProxy) + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)"); + return GL_TRUE; + } + if (border != 0) { + if (!isProxy) { + char message[100]; + _mesa_sprintf(message, + "glTexImage%d(format=GL_YCBCR_MESA and border=%d)", + dimensions, border); + _mesa_error(ctx, GL_INVALID_VALUE, message); + } + return GL_TRUE; + } + } + + if (is_compressed_format(internalFormat)) { + if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { + /* OK */ + } + else if (ctx->Extensions.ARB_texture_cube_map && + (target == GL_PROXY_TEXTURE_CUBE_MAP || + (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { + /* OK */ + } + else { + if (!isProxy) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexImage%d(target)", dimensions); + return GL_TRUE; + } + } + if (border != 0) { + if (!isProxy) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%D(border!=0)", dimensions); + } + return GL_TRUE; + } + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -926,39 +1059,42 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *destTex; GLint maxLevels = 0; - GLboolean compressed; if (dimensions == 1) { - if (target != GL_TEXTURE_1D) { + if (target == GL_TEXTURE_1D) { + maxLevels = ctx->Const.MaxTextureLevels; + } + else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage1D(target)" ); return GL_TRUE; } - maxLevels = ctx->Const.MaxTextureLevels; } else if (dimensions == 2) { - if (ctx->Extensions.ARB_texture_cube_map) { - if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || - target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && - target != GL_TEXTURE_2D) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); - return GL_TRUE; - } + if (ctx->Extensions.ARB_texture_cube_map && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <=GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + maxLevels = ctx->Const.MaxCubeTextureLevels; } - else if (target != GL_TEXTURE_2D) { + else if (ctx->Extensions.NV_texture_rectangle && + target == GL_TEXTURE_RECTANGLE_NV) { + maxLevels = 1; + } + else if (target == GL_TEXTURE_2D) { + maxLevels = ctx->Const.MaxTextureLevels; + } + else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } - if (target == GL_PROXY_TEXTURE_2D && target == GL_TEXTURE_2D) - maxLevels = ctx->Const.MaxTextureLevels; - else - maxLevels = ctx->Const.MaxCubeTextureLevels; } else if (dimensions == 3) { - if (target != GL_TEXTURE_3D) { + if (target == GL_TEXTURE_3D) { + maxLevels = ctx->Const.Max3DTextureLevels; + } + else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexSubImage3D(target)" ); return GL_TRUE; } - maxLevels = ctx->Const.Max3DTextureLevels; } else { _mesa_problem( ctx, "bad dims in texture_error_check" ); @@ -968,28 +1104,22 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, ASSERT(maxLevels > 0); if (level < 0 || level >= maxLevels) { - char message[100]; - sprintf(message, "glTexSubImage2D(level=%d)", level); - _mesa_error(ctx, GL_INVALID_ENUM, message); + _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level); return GL_TRUE; } if (width < 0) { - char message[100]; - sprintf(message, "glTexSubImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexSubImage%dD(width=%d)", dimensions, width); return GL_TRUE; } if (height < 0 && dimensions > 1) { - char message[100]; - sprintf(message, "glTexSubImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexSubImage%dD(height=%d)", dimensions, height); return GL_TRUE; } if (depth < 0 && dimensions > 2) { - char message[100]; - sprintf(message, "glTexSubImage%dD(depth=%d)", dimensions, depth); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(depth=%d)", dimensions, depth); return GL_TRUE; } @@ -1029,31 +1159,51 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } - compressed = is_compressed_format(ctx, destTex->IntFormat); - - if (!compressed && !_mesa_is_legal_format_and_type(format, type)) { - char message[100]; - sprintf(message, "glTexSubImage%dD(format or type)", dimensions); - _mesa_error(ctx, GL_INVALID_ENUM, message); + if (!_mesa_is_legal_format_and_type(format, type)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexSubImage%dD(format or type)", dimensions); return GL_TRUE; } - if (compressed) { - if (xoffset != -((GLint)destTex->Border)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage1/2/3D(xoffset != -border"); + if (destTex->IsCompressed) { + const struct gl_texture_unit *texUnit; + const struct gl_texture_object *texObj; + const struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + + if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { + /* OK */ + } + else if (ctx->Extensions.ARB_texture_cube_map && + (target == GL_PROXY_TEXTURE_CUBE_MAP || + (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { + /* OK */ + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexSubImage%D(target)", dimensions); return GL_TRUE; } - if (dimensions > 1 && yoffset != -((GLint)destTex->Border)) { + /* offset must be multiple of 4 */ + if ((xoffset & 3) || (yoffset & 3)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage2/3D(yoffset != -border"); + "glTexSubImage%D(xoffset or yoffset)", dimensions); return GL_TRUE; } - if (dimensions > 2 && zoffset != -((GLint)destTex->Border)) { + /* size must be multiple of 4 or equal to whole texture size */ + if ((width & 3) && (GLuint) width != texImage->Width) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage3D(zoffset != -border"); + "glTexSubImage%D(width)", dimensions); return GL_TRUE; - } + } + if ((height & 3) && (GLuint) height != texImage->Height) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexSubImage%D(width)", dimensions); + return GL_TRUE; + } } return GL_FALSE; @@ -1070,7 +1220,6 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border ) { - GLint iformat; GLint maxLevels = 0, maxTextureSize; if (dimensions == 1) { @@ -1111,18 +1260,16 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* Border */ if (border != 0 && border != 1) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(border)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(border)", dimensions); return GL_TRUE; } /* Width */ if (width < 2 * border || width > 2 + maxTextureSize || logbase2( width - 2 * border ) < 0) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(width=%d)", dimensions, width); return GL_TRUE; } @@ -1130,9 +1277,8 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, if (dimensions >= 2) { if (height < 2 * border || height > 2 + maxTextureSize || logbase2( height - 2 * border ) < 0) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(height=%d)", dimensions, height); return GL_TRUE; } } @@ -1148,20 +1294,30 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* Level */ if (level < 0 || level >= maxLevels) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(level=%d)", dimensions, level); return GL_TRUE; } - iformat = _mesa_base_tex_format(ctx, internalFormat); - if (iformat < 0) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(internalFormat)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + if (_mesa_base_tex_format(ctx, internalFormat) < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(internalFormat)", dimensions); return GL_TRUE; } + if (is_compressed_format(internalFormat)) { + if (target != GL_TEXTURE_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glCopyTexImage%d(target)", dimensions); + return GL_TRUE; + } + if (border != 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexImage%D(border!=0)", dimensions); + return GL_TRUE; + } + } + /* if we get here, the parameters are OK */ return GL_FALSE; } @@ -1176,7 +1332,6 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *teximage; GLint maxLevels = 0; - GLboolean compressed; if (dimensions == 1) { if (target != GL_TEXTURE_1D) { @@ -1198,7 +1353,7 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, _mesa_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); return GL_TRUE; } - if (target == GL_TEXTURE_2D) + if (target == GL_PROXY_TEXTURE_2D && target == GL_TEXTURE_2D) maxLevels = ctx->Const.MaxTextureLevels; else maxLevels = ctx->Const.MaxCubeTextureLevels; @@ -1214,93 +1369,95 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, ASSERT(maxLevels > 0); if (level < 0 || level >= maxLevels) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(level=%d)", dimensions, level); return GL_TRUE; } if (width < 0) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(width=%d)", dimensions, width); return GL_TRUE; } if (dimensions > 1 && height < 0) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(height=%d)", dimensions, height); return GL_TRUE; } teximage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!teximage) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(undefined texture)", dimensions); - _mesa_error(ctx, GL_INVALID_OPERATION, message); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(undefined texture level: %d)", + dimensions, level); return GL_TRUE; } if (xoffset < -((GLint)teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); return GL_TRUE; } if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(xoffset+width)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(xoffset+width)", dimensions); return GL_TRUE; } if (dimensions > 1) { if (yoffset < -((GLint)teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); return GL_TRUE; } /* NOTE: we're adding the border here, not subtracting! */ if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(yoffset+height)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(yoffset+height)", dimensions); return GL_TRUE; } } if (dimensions > 2) { if (zoffset < -((GLint)teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(zoffset)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(zoffset)", dimensions); return GL_TRUE; } if (zoffset > (GLint) (teximage->Depth + teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(zoffset+depth)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(zoffset+depth)", dimensions); return GL_TRUE; } } - compressed = is_compressed_format(ctx, teximage->IntFormat); - if (compressed) { - if (xoffset != -((GLint)teximage->Border)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage1/2/3D(xoffset != -border"); + if (teximage->IsCompressed) { + if (target != GL_TEXTURE_2D) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glCopyTexSubImage%d(target)", dimensions); return GL_TRUE; } - if (dimensions > 1 && yoffset != -((GLint)teximage->Border)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage2/3D(yoffset != -border"); + /* offset must be multiple of 4 */ + if ((xoffset & 3) || (yoffset & 3)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%D(xoffset or yoffset)", dimensions); return GL_TRUE; } - if (dimensions > 2 && zoffset != -((GLint)teximage->Border)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage3D(zoffset != -border"); + /* size must be multiple of 4 */ + if ((width & 3) != 0 && (GLuint) width != teximage->Width) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%D(width)", dimensions); return GL_TRUE; - } + } + if ((height & 3) != 0 && (GLuint) height != teximage->Height) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%D(height)", dimensions); + return GL_TRUE; + } + } + + if (teximage->IntFormat == GL_YCBCR_MESA) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage2D"); + return GL_TRUE; } /* if we get here, the parameters are OK */ @@ -1315,7 +1472,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, { const struct gl_texture_unit *texUnit; const struct gl_texture_object *texObj; - struct gl_texture_image *texImage; + const struct gl_texture_image *texImage; GLint maxLevels = 0; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -1327,20 +1484,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (target == GL_TEXTURE_1D || target == GL_TEXTURE_2D) { - maxLevels = ctx->Const.MaxTextureLevels; - } - else if (target == GL_TEXTURE_3D) { - maxLevels = ctx->Const.Max3DTextureLevels; - } - else if (target == GL_TEXTURE_RECTANGLE_NV) { - maxLevels = 1; - } - else { - maxLevels = ctx->Const.MaxCubeTextureLevels; - } - - ASSERT(maxLevels > 0); + maxLevels = _mesa_max_texture_levels(ctx, target); + ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ if (level < 0 || level >= maxLevels) { _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" ); @@ -1366,6 +1511,10 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); } + if (!ctx->Extensions.MESA_ycbcr_texture && format == GL_YCBCR_MESA) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(format)"); + } + /* XXX what if format/type doesn't match texture format/type? */ if (!pixels) @@ -1390,7 +1539,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { /* compute destination address in client memory */ - GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels, + GLvoid *dest = _mesa_image_address( &ctx->Pack, pixels, width, height, format, type, img, row, 0); assert(dest); @@ -1416,6 +1565,24 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack); } + else if (format == GL_YCBCR_MESA) { + /* No pixel transfer */ + const GLint rowstride = texImage->RowStride; + MEMCPY(dest, + (const GLushort *) texImage->Data + row * rowstride, + width * sizeof(GLushort)); + /* check for byte swapping */ + if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR + && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || + (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV + && type == GL_UNSIGNED_SHORT_8_8_MESA)) { + if (!ctx->Pack.SwapBytes) + _mesa_swap2((GLushort *) dest, width); + } + else if (ctx->Pack.SwapBytes) { + _mesa_swap2((GLushort *) dest, width); + } + } else { /* general case: convert row to RGBA format */ GLchan rgba[MAX_WIDTH][4]; @@ -1473,13 +1640,14 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, 1, 1, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) @@ -1487,28 +1655,10 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, ASSERT(ctx->Driver.TexImage1D); -#if 0 /* don't make default teximage anymore */ - if (pixels) { - (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, - width, border, format, type, pixels, - &ctx->Unpack, texObj, texImage); - } - else { - GLubyte *dummy = make_null_texture(width, 1, 1, format); - if (dummy) { - (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, - width, border, - format, GL_UNSIGNED_BYTE, dummy, - &_mesa_native_packing, texObj, texImage); - FREE(dummy); - } - } -#else - /* <pixels> may be null! */ + /* Give the texture to the driver! <pixels> may be null! */ (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat, width, border, format, type, pixels, &ctx->Unpack, texObj, texImage); -#endif ASSERT(texImage->TexFormat); if (!texImage->FetchTexel) { @@ -1517,26 +1667,15 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, } ASSERT(texImage->FetchTexel); - if (texImage->IsCompressed) { - ASSERT(texImage->CompressedSize > 0); - } - /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ - GLenum error = texture_error_check(ctx, target, level, internalFormat, - format, type, 1, - postConvWidth, 1, 1, border); + GLboolean error = texture_error_check(ctx, target, level, internalFormat, + format, type, 1, postConvWidth, 1, 1, border); if (!error) { - struct gl_texture_unit *texUnit; - struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, - border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, format, type, @@ -1548,6 +1687,16 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, clear_teximage_fields(ctx->Texture.Proxy1D->Image[level]); } } + else { + /* no error, set the tex image parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, 1, 1, + border, internalFormat); + } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); @@ -1600,43 +1749,25 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, - postConvWidth, postConvHeight, - 1, border, internalFormat); + postConvWidth, postConvHeight, 1, + border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); ASSERT(ctx->Driver.TexImage2D); -#if 0 /* don't make default teximage anymore */ - if (pixels) { - (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, - width, height, border, format, type, pixels, - &ctx->Unpack, texObj, texImage); - } - else { - GLubyte *dummy = make_null_texture(width, height, 1, format); - if (dummy) { - (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, - width, height, border, - format, GL_UNSIGNED_BYTE, dummy, - &_mesa_native_packing, texObj, texImage); - FREE(dummy); - } - } -#else - /* <pixels> may be null! */ + /* Give the texture to the driver! <pixels> may be null! */ (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat, width, height, border, format, type, pixels, &ctx->Unpack, texObj, texImage); -#endif ASSERT(texImage->TexFormat); if (!texImage->FetchTexel) { @@ -1645,10 +1776,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } ASSERT(texImage->FetchTexel); - if (texImage->IsCompressed) { - ASSERT(texImage->CompressedSize > 0); - } - /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; @@ -1659,16 +1786,9 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, (target == GL_PROXY_TEXTURE_RECTANGLE_NV && ctx->Extensions.NV_texture_rectangle)) { /* Proxy texture: check for errors and update proxy state */ - GLenum error = texture_error_check(ctx, target, level, internalFormat, - format, type, 2, - postConvWidth, postConvHeight, 1, border); + GLboolean error = texture_error_check(ctx, target, level, internalFormat, + format, type, 2, postConvWidth, postConvHeight, 1, border); if (!error) { - struct gl_texture_unit *texUnit; - struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, - postConvHeight, 1, border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, format, type, @@ -1682,6 +1802,16 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]); } } + else { + /* no error, set the tex image parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); @@ -1695,7 +1825,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, * Note that width and height include the border. */ void -_mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, +_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) @@ -1725,12 +1855,13 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ - _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, + _mesa_init_teximage_fields(ctx, target, texImage, + width, height, depth, border, internalFormat); if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) @@ -1738,30 +1869,10 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, ASSERT(ctx->Driver.TexImage3D); -#if 0 /* don't make default teximage anymore */ - if (pixels) { - (*ctx->Driver.TexImage3D)(ctx, target, level, (GLint) internalFormat, - width, height, depth, border, - format, type, pixels, - &ctx->Unpack, texObj, texImage); - } - else { - GLubyte *dummy = make_null_texture(width, height, depth, format); - if (dummy) { - (*ctx->Driver.TexImage3D)(ctx, target, level, - (GLint) internalFormat, - width, height, depth, border, - format, GL_UNSIGNED_BYTE, dummy, - &_mesa_native_packing, texObj, texImage); - FREE(dummy); - } - } -#else - /* <pixels> may be null! */ + /* Give the texture to the driver! <pixels> may be null! */ (*ctx->Driver.TexImage3D)(ctx, target, level, internalFormat, width, height, depth, border, format, type, pixels, &ctx->Unpack, texObj, texImage); -#endif ASSERT(texImage->TexFormat); if (!texImage->FetchTexel) { @@ -1770,25 +1881,15 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, } ASSERT(texImage->FetchTexel); - if (texImage->IsCompressed) { - ASSERT(texImage->CompressedSize > 0); - } - /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ - GLenum error = texture_error_check(ctx, target, level, internalFormat, + GLboolean error = texture_error_check(ctx, target, level, internalFormat, format, type, 3, width, height, depth, border); if (!error) { - struct gl_texture_unit *texUnit; - struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, - border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, format, type, @@ -1800,6 +1901,15 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, clear_teximage_fields(ctx->Texture.Proxy3D->Image[level]); } } + else { + /* no error, set the tex image parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); + } } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); @@ -1814,7 +1924,7 @@ _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { - _mesa_TexImage3D(target, level, internalFormat, width, height, + _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height, depth, border, format, type, pixels); } @@ -1994,11 +2104,11 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, @@ -2058,11 +2168,11 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, @@ -2200,6 +2310,176 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, + +/**********************************************************************/ +/****** Compressed Textures ******/ +/**********************************************************************/ + + +/** + * Error checking for glCompressedTexImage[123]D(). + * \return error code or GL_NO_ERROR. + */ +static GLenum +compressed_texture_error_check(GLcontext *ctx, GLint dimensions, + GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize) +{ + GLboolean isProxy = GL_FALSE; + GLint expectedSize, maxLevels = 0, maxTextureSize; + + if (dimensions == 1) { + /* 1D compressed textures not allowed */ + return GL_INVALID_ENUM; + } + 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; + } + else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { + 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) { + if (!ctx->Extensions.ARB_texture_cube_map) + return GL_INVALID_ENUM; /*target*/ + maxLevels = ctx->Const.MaxCubeTextureLevels; + } + else { + return GL_INVALID_ENUM; /*target*/ + } + } + else if (dimensions == 3) { + /* 3D compressed textures not allowed */ + return GL_INVALID_ENUM; + } + + maxTextureSize = 1 << (maxLevels - 1); + + if (!is_compressed_format(internalFormat)) + return GL_INVALID_ENUM; + + if (border != 0) + return GL_INVALID_VALUE; + + if (width < 1 || width > maxTextureSize || logbase2(width) < 0) + return GL_INVALID_VALUE; + + if ((height < 1 || height > maxTextureSize || logbase2(height) < 0) + && dimensions > 1) + return GL_INVALID_VALUE; + + if ((depth < 1 || depth > maxTextureSize || logbase2(depth) < 0) + && dimensions > 2) + return GL_INVALID_VALUE; + + /* For cube map, width must equal height */ + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB && width != height) + return GL_INVALID_VALUE; + + if (level < 0 || level >= maxLevels) + return GL_INVALID_VALUE; + + expectedSize = _mesa_compressed_texture_size(ctx, width, height, depth, + internalFormat); + if (expectedSize != imageSize) + return GL_INVALID_VALUE; + + return GL_NO_ERROR; +} + + +/** + * Error checking for glCompressedTexSubImage[123]D(). + * \return error code or GL_NO_ERROR. + */ +static GLenum +compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, + GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLsizei imageSize) +{ + GLboolean isProxy = GL_FALSE; + GLint expectedSize, maxLevels = 0, maxTextureSize; + + if (dimensions == 1) { + /* 1D compressed textures not allowed */ + return GL_INVALID_ENUM; + } + 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; + } + else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { + 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) { + if (!ctx->Extensions.ARB_texture_cube_map) + return GL_INVALID_ENUM; /*target*/ + maxLevels = ctx->Const.MaxCubeTextureLevels; + } + else { + return GL_INVALID_ENUM; /*target*/ + } + } + else if (dimensions == 3) { + /* 3D compressed textures not allowed */ + return GL_INVALID_ENUM; + } + + maxTextureSize = 1 << (maxLevels - 1); + + if (!is_compressed_format(format)) + return GL_INVALID_ENUM; + + if (width < 1 || width > maxTextureSize || logbase2(width) < 0) + return GL_INVALID_VALUE; + + if ((height < 1 || height > maxTextureSize || logbase2(height) < 0) + && dimensions > 1) + return GL_INVALID_VALUE; + + if (level < 0 || level >= maxLevels) + return GL_INVALID_VALUE; + + if ((xoffset & 3) != 0 || (yoffset & 3) != 0) + return GL_INVALID_VALUE; + + if ((width & 3) != 0 && width != 2 && width != 1) + return GL_INVALID_VALUE; + + if ((height & 3) != 0 && height != 2 && height != 1) + return GL_INVALID_VALUE; + + expectedSize = _mesa_compressed_texture_size(ctx, width, height, depth, + format); + if (expectedSize != imageSize) + return GL_INVALID_VALUE; + + return GL_NO_ERROR; +} + + + void _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, @@ -2209,28 +2489,15 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - switch (internalFormat) { - case GL_COMPRESSED_ALPHA_ARB: - case GL_COMPRESSED_LUMINANCE_ARB: - case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - case GL_COMPRESSED_INTENSITY_ARB: - case GL_COMPRESSED_RGB_ARB: - case GL_COMPRESSED_RGBA_ARB: - _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1DARB"); - return; - default: - /* silence compiler warning */ - ; - } - if (target == GL_TEXTURE_1D) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - - if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, 1, 1, border)) { - return; /* error in texture image was detected */ + GLenum error = compressed_texture_error_check(ctx, 1, target, level, + internalFormat, width, 1, 1, border, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexImage1D"); + return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -2241,26 +2508,23 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, texImage = _mesa_alloc_texture_image(); texObj->Image[level] = texImage; if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1D"); return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); - if (ctx->Extensions.ARB_texture_compression) { - ASSERT(ctx->Driver.CompressedTexImage1D); - (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, - internalFormat, width, border, - imageSize, data, - texObj, texImage); - ASSERT(texImage->CompressedSize > 0); /* sanity */ - } + ASSERT(ctx->Driver.CompressedTexImage1D); + (*ctx->Driver.CompressedTexImage1D)(ctx, target, level, + internalFormat, width, border, + imageSize, data, + texObj, texImage); /* state update */ texObj->Complete = GL_FALSE; @@ -2268,15 +2532,9 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ - GLenum error = texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, 1, 1, border); + GLenum error = compressed_texture_error_check(ctx, 1, target, level, + internalFormat, width, 1, 1, border, imageSize); if (!error) { - struct gl_texture_unit *texUnit; - struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, - border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, GL_NONE, GL_NONE, @@ -2288,9 +2546,18 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, clear_teximage_fields(ctx->Texture.Proxy1D->Image[level]); } } + else { + /* store the teximage parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, + border, internalFormat); + } } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1DARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)"); return; } } @@ -2305,33 +2572,18 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - switch (internalFormat) { - case GL_COMPRESSED_ALPHA_ARB: - case GL_COMPRESSED_LUMINANCE_ARB: - case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - case GL_COMPRESSED_INTENSITY_ARB: - case GL_COMPRESSED_RGB_ARB: - case GL_COMPRESSED_RGBA_ARB: - _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2DARB"); - return; - default: - /* silence compiler warning */ - ; - } - if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && - target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) || - (ctx->Extensions.NV_texture_rectangle && - target == GL_TEXTURE_RECTANGLE_NV)) { + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - - if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 2, width, height, 1, border)) { - return; /* error in texture image was detected */ + GLenum error = compressed_texture_error_check(ctx, 2, target, level, + internalFormat, width, height, 1, border, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexImage2D"); + return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -2342,42 +2594,35 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, texImage = _mesa_alloc_texture_image(); texObj->Image[level] = texImage; if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); - if (ctx->Extensions.ARB_texture_compression) { - ASSERT(ctx->Driver.CompressedTexImage2D); - (*ctx->Driver.CompressedTexImage2D)(ctx, target, level, - internalFormat, width, height, - border, imageSize, data, - texObj, texImage); - ASSERT(texImage->CompressedSize > 0); /* sanity */ - } + ASSERT(ctx->Driver.CompressedTexImage2D); + (*ctx->Driver.CompressedTexImage2D)(ctx, target, level, + internalFormat, width, height, + border, imageSize, data, + texObj, texImage); /* state update */ texObj->Complete = GL_FALSE; ctx->NewState |= _NEW_TEXTURE; } - else if (target == GL_PROXY_TEXTURE_2D) { + else if (target == GL_PROXY_TEXTURE_2D || + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB && + ctx->Extensions.ARB_texture_cube_map)) { /* Proxy texture: check for errors and update proxy state */ - GLenum error = texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 2, width, height, 1, border); + GLenum error = compressed_texture_error_check(ctx, 2, target, level, + internalFormat, width, height, 1, border, imageSize); if (!error) { - struct gl_texture_unit *texUnit; - struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, - border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, GL_NONE, GL_NONE, @@ -2391,9 +2636,18 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, clear_teximage_fields(ctx->Texture.Proxy2D->Image[level]); } } + else { + /* store the teximage parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, + border, internalFormat); + } } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2DARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage2D(target)"); return; } } @@ -2408,28 +2662,15 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - switch (internalFormat) { - case GL_COMPRESSED_ALPHA_ARB: - case GL_COMPRESSED_LUMINANCE_ARB: - case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - case GL_COMPRESSED_INTENSITY_ARB: - case GL_COMPRESSED_RGB_ARB: - case GL_COMPRESSED_RGBA_ARB: - _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3DARB"); - return; - default: - /* silence compiler warning */ - ; - } - if (target == GL_TEXTURE_3D) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - - if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 3, width, height, depth, border)) { - return; /* error in texture image was detected */ + GLenum error = compressed_texture_error_check(ctx, 3, target, level, + internalFormat, width, height, depth, border, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexImage3D"); + return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -2440,27 +2681,24 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, texImage = _mesa_alloc_texture_image(); texObj->Image[level] = texImage; if (!texImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3D"); return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); - if (ctx->Extensions.ARB_texture_compression) { - ASSERT(ctx->Driver.CompressedTexImage3D); - (*ctx->Driver.CompressedTexImage3D)(ctx, target, level, - internalFormat, - width, height, depth, - border, imageSize, data, - texObj, texImage); - ASSERT(texImage->CompressedSize > 0); /* sanity */ - } + ASSERT(ctx->Driver.CompressedTexImage3D); + (*ctx->Driver.CompressedTexImage3D)(ctx, target, level, + internalFormat, + width, height, depth, + border, imageSize, data, + texObj, texImage); /* state update */ texObj->Complete = GL_FALSE; @@ -2468,16 +2706,9 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ - GLenum error = texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 3, width, height, depth, border); + GLenum error = compressed_texture_error_check(ctx, 3, target, level, + internalFormat, width, height, depth, border, imageSize); if (!error) { - struct gl_texture_unit *texUnit; - struct gl_texture_image *texImage; - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texImage = _mesa_select_tex_image(ctx, texUnit, target, level); - _mesa_init_teximage_fields(ctx, target, texImage, - width, height, depth, - border, internalFormat); ASSERT(ctx->Driver.TestProxyTexImage); error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, internalFormat, GL_NONE, GL_NONE, @@ -2489,9 +2720,18 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, clear_teximage_fields(ctx->Texture.Proxy3D->Image[level]); } } + else { + /* store the teximage parameters */ + struct gl_texture_unit *texUnit; + struct gl_texture_image *texImage; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + _mesa_init_teximage_fields(ctx, target, texImage, width, height, + depth, border, internalFormat); + } } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3DARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage3D(target)"); return; } } @@ -2505,12 +2745,15 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; + GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, - width, 1, 1, format, GL_NONE)) { - return; /* error was detected */ + error = compressed_subtexture_error_check(ctx, 1, target, level, + xoffset, 0, 0, width, 1, 1, format, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexSubImage1D"); + return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -2518,6 +2761,17 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); + if ((GLint) format != texImage->IntFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage1D(format)"); + return; + } + + if ((width == 1 || width == 2) && (GLuint) width != texImage->Width) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage1D(width)"); + return; + } + if (width == 0 || !data) return; /* no-op, not an error */ @@ -2540,12 +2794,15 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; + GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, - width, height, 1, format, GL_NONE)) { - return; /* error was detected */ + error = compressed_subtexture_error_check(ctx, 2, target, level, + xoffset, yoffset, 0, width, height, 1, format, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexSubImage2D"); + return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -2553,6 +2810,18 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); + if ((GLint) format != texImage->IntFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage2D(format)"); + return; + } + + if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || + ((height == 1 || height == 2) && (GLuint) height != texImage->Height)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); + return; + } + if (width == 0 || height == 0 || !data) return; /* no-op, not an error */ @@ -2575,12 +2844,15 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; + GLenum error; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, - width, height, depth, format, GL_NONE)) { - return; /* error was detected */ + error = compressed_subtexture_error_check(ctx, 3, target, level, + xoffset, yoffset, zoffset, width, height, depth, format, imageSize); + if (error) { + _mesa_error(ctx, error, "glCompressedTexSubImage2D"); + return; } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -2588,6 +2860,19 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texUnit, target, level); assert(texImage); + if ((GLint) format != texImage->IntFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage3D(format)"); + return; + } + + if (((width == 1 || width == 2) && (GLuint) width != texImage->Width) || + ((height == 1 || height == 2) && (GLuint) height != texImage->Height) || + ((depth == 1 || depth == 2) && (GLuint) depth != texImage->Depth)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); + return; + } + if (width == 0 || height == 0 || depth == 0 || !data) return; /* no-op, not an error */ @@ -2619,17 +2904,8 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) return; } - if (target == GL_TEXTURE_1D || target == GL_TEXTURE_2D) { - maxLevels = ctx->Const.MaxTextureLevels; - } - else if (target == GL_TEXTURE_3D) { - maxLevels = ctx->Const.Max3DTextureLevels; - } - else { - maxLevels = ctx->Const.MaxCubeTextureLevels; - } - - ASSERT(maxLevels > 0); + maxLevels = _mesa_max_texture_levels(ctx, target); + ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ if (level < 0 || level >= maxLevels) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); @@ -2656,9 +2932,6 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) if (!img) return; - if (ctx->Extensions.ARB_texture_compression) { - ASSERT(ctx->Driver.GetCompressedTexImage); - (*ctx->Driver.GetCompressedTexImage)(ctx, target, level, img, texObj, - texImage); - } + /* just memcpy, no pixelstore or pixel transfer */ + MEMCPY(img, texImage->Data, texImage->CompressedSize); } diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h index 46f9b60a5..ac467d27c 100644 --- a/xc/extras/Mesa/src/teximage.h +++ b/xc/extras/Mesa/src/teximage.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 3.5 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -69,6 +69,9 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target, GLint level); +extern GLint +_mesa_max_texture_levels(GLcontext *ctx, GLenum target); + /*** API entry point functions ***/ @@ -86,7 +89,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, extern void -_mesa_TexImage3D( GLenum target, GLint level, GLenum internalformat, +_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index 1b0e583a2..75c92be18 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,23 +23,17 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colortab.h" #include "context.h" #include "enums.h" #include "hash.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "teximage.h" #include "texstate.h" #include "texobj.h" #include "mtypes.h" -#endif - /* @@ -48,7 +42,8 @@ * table. * 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) + * target - either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, + * GL_TEXTURE_CUBE_MAP_ARB or GL_TEXTURE_RECTANGLE_NV * zero is ok for the sake of GenTextures() * Return: pointer to new texture object */ @@ -86,16 +81,18 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared, obj->WrapR = GL_REPEAT; obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; } - obj->MinFilter = GL_NEAREST_MIPMAP_LINEAR; obj->MagFilter = GL_LINEAR; obj->MinLod = -1000.0; obj->MaxLod = 1000.0; obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MaxAnisotropy = 1.0; - obj->CompareFlag = GL_FALSE; - obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; - obj->ShadowAmbient = 0; + obj->CompareFlag = GL_FALSE; /* SGIX_shadow */ + obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ + obj->CompareMode = GL_LUMINANCE; /* ARB_shadow */ + obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ + obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ + obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ _mesa_init_colortable(&obj->Palette); /* insert into linked list */ @@ -166,12 +163,14 @@ void _mesa_free_texture_object( struct gl_shared_state *shared, } } + /* destroy the mutex -- it may have allocated memory (eg on bsd) */ + _glthread_DESTROY_MUTEX(t->Mutex); + /* free this object */ FREE( t ); } - /* * Copy texture object state from one texture object to another. */ @@ -198,14 +197,17 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->CompareFlag = src->CompareFlag; dest->CompareOperator = src->CompareOperator; dest->ShadowAmbient = src->ShadowAmbient; + dest->CompareMode = src->CompareMode; + dest->CompareFunc = src->CompareFunc; + dest->DepthMode = src->DepthMode; dest->_MaxLevel = src->_MaxLevel; dest->_MaxLambda = src->_MaxLambda; + dest->GenerateMipmap = src->GenerateMipmap; dest->Palette = src->Palette; dest->Complete = src->Complete; } - /* * Report why a texture object is incomplete. (for debug only) */ @@ -213,7 +215,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, static void incomplete(const struct gl_texture_object *t, const char *why) { - printf("Texture Obj %d incomplete because: %s\n", t->Name, why); + _mesa_printf("Texture Obj %d incomplete because: %s\n", t->Name, why); } #else #define incomplete(a, b) @@ -413,6 +415,11 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, t->Complete = GL_FALSE; return; } + if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); + return; + } if (t->Image[i]->Width2 != width) { t->Complete = GL_FALSE; incomplete(t, "3D Image[i] bad width"); @@ -446,6 +453,12 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, height /= 2; } if (i >= minLevel && i <= maxLevel) { + /* Don't support GL_DEPTH_COMPONENT for cube maps */ + if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); + return; + } /* check that we have images defined */ if (!t->Image[i] || !t->NegX[i] || !t->PosY[i] || !t->NegY[i] || @@ -475,7 +488,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } else { - /* Dimensions = ??? */ + /* Target = ??? */ _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n"); } } @@ -519,8 +532,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) /* Allocate new, empty texture objects */ for (i=0;i<n;i++) { GLuint name = first + i; - GLuint dims = 0; - (void) _mesa_alloc_texture_object( ctx->Shared, name, dims); + GLenum target = 0; + (void) _mesa_alloc_texture_object( ctx->Shared, name, target); } _glthread_UNLOCK_MUTEX(GenTexturesLock); @@ -555,27 +568,38 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) if (delObj == unit->Current1D) { unit->Current1D = ctx->Shared->Default1D; ctx->Shared->Default1D->RefCount++; + delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->Current1D; } else if (delObj == unit->Current2D) { unit->Current2D = ctx->Shared->Default2D; ctx->Shared->Default2D->RefCount++; + delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->Current2D; } else if (delObj == unit->Current3D) { unit->Current3D = ctx->Shared->Default3D; ctx->Shared->Default3D->RefCount++; + delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->Current3D; } else if (delObj == unit->CurrentCubeMap) { unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; ctx->Shared->DefaultCubeMap->RefCount++; + delObj->RefCount--; if (delObj == unit->_Current) unit->_Current = unit->CurrentCubeMap; } + else if (delObj == unit->CurrentRect) { + unit->CurrentRect = ctx->Shared->DefaultRect; + ctx->Shared->DefaultRect->RefCount++; + delObj->RefCount--; + if (delObj == unit->_Current) + unit->_Current = unit->CurrentRect; + } } ctx->NewState |= _NEW_TEXTURE; @@ -610,8 +634,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glBindTexture %s %d\n", - _mesa_lookup_enum_by_nr(target), (GLint) texName); + _mesa_debug(ctx, "glBindTexture %s %d\n", + _mesa_lookup_enum_by_nr(target), (GLint) texName); switch (target) { case GL_TEXTURE_1D: @@ -726,6 +750,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) break; default: _mesa_problem(ctx, "bad target in BindTexture"); + return; } /* Pass BindTexture call to device driver */ diff --git a/xc/extras/Mesa/src/texobj.h b/xc/extras/Mesa/src/texobj.h index c04f732eb..d0a0e8381 100644 --- a/xc/extras/Mesa/src/texobj.h +++ b/xc/extras/Mesa/src/texobj.h @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index eae7db349..af71ec985 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 4.0.4 + * 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"), @@ -24,9 +23,6 @@ */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "colormac.h" #include "context.h" @@ -39,7 +35,6 @@ #include "mtypes.h" #include "math/m_xform.h" #include "math/m_matrix.h" -#endif @@ -119,6 +114,35 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) } +/* + * For debugging + */ +void +_mesa_print_texunit_state( GLcontext *ctx, GLuint unit ) +{ + const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit; + _mesa_printf("Texture Unit %d\n", unit); + _mesa_printf(" GL_TEXTURE_ENV_MODE = %s\n", _mesa_lookup_enum_by_nr(texUnit->EnvMode)); + _mesa_printf(" GL_COMBINE_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineModeRGB)); + _mesa_printf(" GL_COMBINE_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineModeA)); + _mesa_printf(" GL_SOURCE0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[0])); + _mesa_printf(" GL_SOURCE1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[1])); + _mesa_printf(" GL_SOURCE2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceRGB[2])); + _mesa_printf(" GL_SOURCE0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[0])); + _mesa_printf(" GL_SOURCE1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[1])); + _mesa_printf(" GL_SOURCE2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineSourceA[2])); + _mesa_printf(" GL_OPERAND0_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[0])); + _mesa_printf(" GL_OPERAND1_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[1])); + _mesa_printf(" GL_OPERAND2_RGB = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandRGB[2])); + _mesa_printf(" GL_OPERAND0_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[0])); + _mesa_printf(" GL_OPERAND1_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[1])); + _mesa_printf(" GL_OPERAND2_ALPHA = %s\n", _mesa_lookup_enum_by_nr(texUnit->CombineOperandA[2])); + _mesa_printf(" GL_RGB_SCALE = %d\n", 1 << texUnit->CombineScaleShiftRGB); + _mesa_printf(" GL_ALPHA_SCALE = %d\n", 1 << texUnit->CombineScaleShiftA); + _mesa_printf(" GL_TEXTURE_ENV_COLOR = (%f, %f, %f, %f)\n", texUnit->EnvColor[0], texUnit->EnvColor[1], texUnit->EnvColor[2], texUnit->EnvColor[3]); +} + + /**********************************************************************/ /* Texture Environment */ @@ -133,60 +157,47 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) ASSERT_OUTSIDE_BEGIN_END(ctx); #define TE_ERROR(errCode, msg, value) \ - { \ - char s[100]; \ - sprintf(s, msg, _mesa_lookup_enum_by_nr(value)); \ - _mesa_error(ctx, errCode, s); \ - } + _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); - if (target==GL_TEXTURE_ENV) { + if (target == GL_TEXTURE_ENV) { switch (pname) { - case GL_TEXTURE_ENV_MODE: { - GLenum mode = (GLenum) (GLint) *param; - - switch (mode) { - case GL_ADD: - if (!ctx->Extensions.EXT_texture_env_add) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - case GL_COMBINE_EXT: - if (!ctx->Extensions.EXT_texture_env_combine && - !ctx->Extensions.ARB_texture_env_combine) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - case GL_MODULATE: - case GL_BLEND: - case GL_DECAL: - case GL_REPLACE: - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - - if (texUnit->EnvMode == mode) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->EnvMode = mode; - break; - } - case GL_TEXTURE_ENV_COLOR: { - GLfloat tmp[4]; - tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); - tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); - tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); - tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); - if (TEST_EQ_4V(tmp, texUnit->EnvColor)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EnvColor, tmp); - break; - } - case GL_COMBINE_RGB_EXT: + case GL_TEXTURE_ENV_MODE: + { + const GLenum mode = (GLenum) (GLint) *param; + if (mode == GL_MODULATE || + mode == GL_BLEND || + mode == GL_DECAL || + mode == GL_REPLACE || + (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) || + (mode == GL_COMBINE && + (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine))) { + /* legal */ + if (texUnit->EnvMode == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->EnvMode = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + } + break; + case GL_TEXTURE_ENV_COLOR: + { + GLfloat tmp[4]; + tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); + tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); + tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); + tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); + if (TEST_EQ_4V(tmp, texUnit->EnvColor)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EnvColor, tmp); + } + break; + case GL_COMBINE_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum mode = (GLenum) (GLint) *param; @@ -194,11 +205,11 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) case GL_REPLACE: case GL_MODULATE: case GL_ADD: - case GL_ADD_SIGNED_EXT: - case GL_INTERPOLATE_EXT: + case GL_ADD_SIGNED: + case GL_INTERPOLATE: /* OK */ break; - case GL_SUBTRACT_ARB: + case GL_SUBTRACT: if (!ctx->Extensions.ARB_texture_env_combine) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; @@ -211,9 +222,17 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } break; - case GL_DOT3_RGB_ARB: - case GL_DOT3_RGBA_ARB: - if (!ctx->Extensions.ARB_texture_env_dot3) { + case GL_DOT3_RGB: + case GL_DOT3_RGBA: + if (!ctx->Extensions.ARB_texture_env_dot3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + if (!ctx->Extensions.ATI_texture_env_combine3) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } @@ -232,56 +251,70 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } break; - case GL_COMBINE_ALPHA_EXT: + case GL_COMBINE_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { const GLenum mode = (GLenum) (GLint) *param; - switch (mode) { + switch (mode) { case GL_REPLACE: case GL_MODULATE: case GL_ADD: - case GL_ADD_SIGNED_EXT: - case GL_INTERPOLATE_EXT: - /* OK */ + case GL_ADD_SIGNED: + case GL_INTERPOLATE: + /* OK */ break; - case GL_SUBTRACT_ARB: - if (!ctx->Extensions.ARB_texture_env_combine) { + case GL_SUBTRACT: + if (!ctx->Extensions.ARB_texture_env_combine) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + if (!ctx->Extensions.ATI_texture_env_combine3) { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; + return; + } + break; default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); return; } - if (texUnit->CombineModeA == mode) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->CombineModeA = mode; + + if (texUnit->CombineModeA == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineModeA = mode; } else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } break; - case GL_SOURCE0_RGB_EXT: - case GL_SOURCE1_RGB_EXT: - case GL_SOURCE2_RGB_EXT: + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { - GLenum source = (GLenum) (GLint) *param; - GLuint s = pname - GL_SOURCE0_RGB_EXT; - switch (source) { - case GL_TEXTURE: - case GL_CONSTANT_EXT: - case GL_PRIMARY_COLOR_EXT: - case GL_PREVIOUS_EXT: - if (texUnit->CombineSourceRGB[s] == source) - return; + const GLenum source = (GLenum) (GLint) *param; + const GLuint s = pname - GL_SOURCE0_RGB; + if (source == GL_TEXTURE || + source == GL_CONSTANT || + source == GL_PRIMARY_COLOR || + source == GL_PREVIOUS || + (ctx->Extensions.ARB_texture_env_crossbar && + source >= GL_TEXTURE0 && + source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || + (ctx->Extensions.ATI_texture_env_combine3 && + (source == GL_ZERO || source == GL_ONE))) { + /* legal */ + if (texUnit->CombineSourceRGB[s] == source) + return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->CombineSourceRGB[s] = source; - break; - default: + } + else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); return; } @@ -291,23 +324,29 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } break; - case GL_SOURCE0_ALPHA_EXT: - case GL_SOURCE1_ALPHA_EXT: - case GL_SOURCE2_ALPHA_EXT: + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { - GLenum source = (GLenum) (GLint) *param; - GLuint s = pname - GL_SOURCE0_ALPHA_EXT; - switch (source) { - case GL_TEXTURE: - case GL_CONSTANT_EXT: - case GL_PRIMARY_COLOR_EXT: - case GL_PREVIOUS_EXT: - if (texUnit->CombineSourceA[s] == source) return; + const GLenum source = (GLenum) (GLint) *param; + const GLuint s = pname - GL_SOURCE0_ALPHA; + if (source == GL_TEXTURE || + source == GL_CONSTANT || + source == GL_PRIMARY_COLOR || + source == GL_PREVIOUS || + (ctx->Extensions.ARB_texture_env_crossbar && + source >= GL_TEXTURE0 && + source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || + (ctx->Extensions.ATI_texture_env_combine3 && + (source == GL_ZERO || source == GL_ONE))) { + /* legal */ + if (texUnit->CombineSourceA[s] == source) + return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->CombineSourceA[s] = source; - break; - default: + } + else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); return; } @@ -317,12 +356,13 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } break; - case GL_OPERAND0_RGB_EXT: - case GL_OPERAND1_RGB_EXT: + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { - GLenum operand = (GLenum) (GLint) *param; - GLuint s = pname - GL_OPERAND0_RGB_EXT; + const GLenum operand = (GLenum) (GLint) *param; + const GLuint s = pname - GL_OPERAND0_RGB; switch (operand) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: @@ -343,64 +383,20 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } break; - case GL_OPERAND0_ALPHA_EXT: - case GL_OPERAND1_ALPHA_EXT: + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { - GLenum operand = (GLenum) (GLint) *param; + const GLenum operand = (GLenum) (GLint) *param; switch (operand) { case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: - if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] == + if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA] == operand) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand; - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_OPERAND2_RGB_EXT: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - GLenum operand = (GLenum) (GLint) *param; - switch (operand) { - case GL_SRC_COLOR: /* ARB combine only */ - case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ - if (texUnit->CombineOperandRGB[2] == operand) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->CombineOperandRGB[2] = operand; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_OPERAND2_ALPHA_EXT: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - GLenum operand = (GLenum) (GLint) *param; - switch (operand) { - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ - if (texUnit->CombineOperandA[2] == operand) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->CombineOperandA[2] = operand; + texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA] = operand; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); @@ -412,7 +408,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } break; - case GL_RGB_SCALE_EXT: + case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { GLuint newshift; @@ -473,35 +469,63 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) return; } } - else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) { + else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { + /* GL_EXT_texture_lod_bias */ if (!ctx->Extensions.EXT_texture_lod_bias) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); return; } - switch (pname) { - case GL_TEXTURE_LOD_BIAS_EXT: + if (pname == GL_TEXTURE_LOD_BIAS_EXT) { if (texUnit->LodBias == param[0]) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->LodBias = CLAMP(param[0], -ctx->Const.MaxTextureLodBias, ctx->Const.MaxTextureLodBias); - break; - default: + } + else { TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } } + else if (target == GL_POINT_SPRITE_NV) { + /* GL_NV_point_sprite */ + if (!ctx->Extensions.NV_point_sprite) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); + return; + } + if (pname == GL_COORD_REPLACE_NV) { + const GLenum value = (GLenum) param[0]; + if (value == GL_TRUE || value == GL_FALSE) { + /* It's kind of weird to set point state via glTexEnv, + * but that's what the spec calls for. + */ + const GLboolean state = (GLboolean) value; + if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value); + return; + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname ); + return; + } + } else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); return; } if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n", - _mesa_lookup_enum_by_nr(target), - _mesa_lookup_enum_by_nr(pname), - *param, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); + _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n", + _mesa_lookup_enum_by_nr(target), + _mesa_lookup_enum_by_nr(pname), + *param, + _mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); /* Tell device driver about the new texture environment */ if (ctx->Driver.TexEnv) { @@ -561,7 +585,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) case GL_TEXTURE_ENV_COLOR: COPY_4FV( params, texUnit->EnvColor ); break; - case GL_COMBINE_RGB_EXT: + case GL_COMBINE_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineModeRGB; @@ -570,7 +594,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_COMBINE_ALPHA_EXT: + case GL_COMBINE_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineModeA; @@ -579,7 +603,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_SOURCE0_RGB_EXT: + case GL_SOURCE0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineSourceRGB[0]; @@ -588,7 +612,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_SOURCE1_RGB_EXT: + case GL_SOURCE1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineSourceRGB[1]; @@ -597,7 +621,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_SOURCE2_RGB_EXT: + case GL_SOURCE2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineSourceRGB[2]; @@ -606,7 +630,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_SOURCE0_ALPHA_EXT: + case GL_SOURCE0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineSourceA[0]; @@ -615,7 +639,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_SOURCE1_ALPHA_EXT: + case GL_SOURCE1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineSourceA[1]; @@ -624,7 +648,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_SOURCE2_ALPHA_EXT: + case GL_SOURCE2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineSourceA[2]; @@ -633,7 +657,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_OPERAND0_RGB_EXT: + case GL_OPERAND0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineOperandRGB[0]; @@ -642,7 +666,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_OPERAND1_RGB_EXT: + case GL_OPERAND1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineOperandRGB[1]; @@ -651,7 +675,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_OPERAND2_RGB_EXT: + case GL_OPERAND2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineOperandRGB[2]; @@ -660,7 +684,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_OPERAND0_ALPHA_EXT: + case GL_OPERAND0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineOperandA[0]; @@ -669,7 +693,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_OPERAND1_ALPHA_EXT: + case GL_OPERAND1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineOperandA[1]; @@ -678,7 +702,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_OPERAND2_ALPHA_EXT: + case GL_OPERAND2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLfloat) texUnit->CombineOperandA[2]; @@ -687,7 +711,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); } break; - case GL_RGB_SCALE_EXT: + case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { if (texUnit->CombineScaleShiftRGB == 0) @@ -735,6 +759,20 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) return; } } + else if (target == GL_POINT_SPRITE_NV) { + /* GL_NV_point_sprite */ + if (!ctx->Extensions.NV_point_sprite) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); + return; + } + if (pname == GL_COORD_REPLACE_NV) { + *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); + return; + } + } else { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); return; @@ -749,11 +787,6 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target != GL_TEXTURE_ENV) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); - return; - } - if (target == GL_TEXTURE_ENV) { switch (pname) { case GL_TEXTURE_ENV_MODE: @@ -765,7 +798,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] ); params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] ); break; - case GL_COMBINE_RGB_EXT: + case GL_COMBINE_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineModeRGB; @@ -774,7 +807,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_COMBINE_ALPHA_EXT: + case GL_COMBINE_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineModeA; @@ -783,7 +816,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_SOURCE0_RGB_EXT: + case GL_SOURCE0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineSourceRGB[0]; @@ -792,7 +825,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_SOURCE1_RGB_EXT: + case GL_SOURCE1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineSourceRGB[1]; @@ -801,7 +834,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_SOURCE2_RGB_EXT: + case GL_SOURCE2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineSourceRGB[2]; @@ -810,7 +843,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_SOURCE0_ALPHA_EXT: + case GL_SOURCE0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineSourceA[0]; @@ -819,7 +852,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_SOURCE1_ALPHA_EXT: + case GL_SOURCE1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineSourceA[1]; @@ -828,7 +861,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_SOURCE2_ALPHA_EXT: + case GL_SOURCE2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineSourceA[2]; @@ -837,7 +870,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_OPERAND0_RGB_EXT: + case GL_OPERAND0_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineOperandRGB[0]; @@ -846,7 +879,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_OPERAND1_RGB_EXT: + case GL_OPERAND1_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineOperandRGB[1]; @@ -855,7 +888,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_OPERAND2_RGB_EXT: + case GL_OPERAND2_RGB: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineOperandRGB[2]; @@ -864,7 +897,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_OPERAND0_ALPHA_EXT: + case GL_OPERAND0_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineOperandA[0]; @@ -873,7 +906,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_OPERAND1_ALPHA_EXT: + case GL_OPERAND1_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineOperandA[1]; @@ -882,7 +915,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_OPERAND2_ALPHA_EXT: + case GL_OPERAND2_ALPHA: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { *params = (GLint) texUnit->CombineOperandA[2]; @@ -891,7 +924,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); } break; - case GL_RGB_SCALE_EXT: + case GL_RGB_SCALE: if (ctx->Extensions.EXT_texture_env_combine || ctx->Extensions.ARB_texture_env_combine) { if (texUnit->CombineScaleShiftRGB == 0) @@ -939,8 +972,22 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) return; } } + else if (target == GL_POINT_SPRITE_NV) { + /* GL_NV_point_sprite */ + if (!ctx->Extensions.NV_point_sprite) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); + return; + } + if (pname == GL_COORD_REPLACE_NV) { + *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); + return; + } + } else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); return; } } @@ -970,10 +1017,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "texPARAM %s %s %d...\n", - _mesa_lookup_enum_by_nr(target), - _mesa_lookup_enum_by_nr(pname), - eparam); + _mesa_debug(ctx, "texPARAM %s %s %d...\n", + _mesa_lookup_enum_by_nr(target), + _mesa_lookup_enum_by_nr(pname), + eparam); switch (target) { @@ -983,10 +1030,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_2D: texObj = texUnit->Current2D; break; - case GL_TEXTURE_3D_EXT: + case GL_TEXTURE_3D: texObj = texUnit->Current3D; break; - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: if (!ctx->Extensions.ARB_texture_cube_map) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; @@ -1010,7 +1057,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) /* A small optimization */ if (texObj->MinFilter == eparam) return; - if (eparam==GL_NEAREST || eparam==GL_LINEAR) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MinFilter = eparam; @@ -1046,7 +1092,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (texObj->WrapS == eparam) return; if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || - (eparam == GL_CLAMP_TO_BORDER_ARB && + (eparam == GL_CLAMP_TO_BORDER && ctx->Extensions.ARB_texture_border_clamp)) { /* any texture target */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -1054,8 +1100,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && (eparam == GL_REPEAT || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat))) { + (eparam == GL_MIRRORED_REPEAT && + ctx->Extensions.ARB_texture_mirrored_repeat) || + (eparam == GL_MIRROR_CLAMP_ATI && + ctx->Extensions.ATI_texture_mirror_once) || + (eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && + ctx->Extensions.ATI_texture_mirror_once))) { /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapS = eparam; @@ -1069,7 +1119,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (texObj->WrapT == eparam) return; if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || - (eparam == GL_CLAMP_TO_BORDER_ARB && + (eparam == GL_CLAMP_TO_BORDER && ctx->Extensions.ARB_texture_border_clamp)) { /* any texture target */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -1077,8 +1127,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && (eparam == GL_REPEAT || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat))) { + (eparam == GL_MIRRORED_REPEAT && + ctx->Extensions.ARB_texture_mirrored_repeat) || + (eparam == GL_MIRROR_CLAMP_ATI && + ctx->Extensions.ATI_texture_mirror_once) || + (eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && + ctx->Extensions.ATI_texture_mirror_once))) { /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapT = eparam; @@ -1088,11 +1142,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } break; - case GL_TEXTURE_WRAP_R_EXT: + case GL_TEXTURE_WRAP_R: if (texObj->WrapR == eparam) return; if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || - (eparam == GL_CLAMP_TO_BORDER_ARB && + (eparam == GL_CLAMP_TO_BORDER && ctx->Extensions.ARB_texture_border_clamp)) { /* any texture target */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -1100,8 +1154,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && (eparam == GL_REPEAT || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat))) { + (eparam == GL_MIRRORED_REPEAT && + ctx->Extensions.ARB_texture_mirrored_repeat) || + (eparam == GL_MIRROR_CLAMP_ATI && + ctx->Extensions.ATI_texture_mirror_once) || + (eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && + ctx->Extensions.ATI_texture_mirror_once))) { /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapR = eparam; @@ -1112,10 +1170,14 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) break; case GL_TEXTURE_BORDER_COLOR: FLUSH_VERTICES(ctx, _NEW_TEXTURE); - UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], params[0]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], params[1]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[2], params[2]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], params[3]); + texObj->BorderColor[RCOMP] = params[0]; + texObj->BorderColor[GCOMP] = params[1]; + texObj->BorderColor[BCOMP] = params[2]; + texObj->BorderColor[ACOMP] = params[3]; + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); break; case GL_TEXTURE_MIN_LOD: if (texObj->MinLod == params[0]) @@ -1150,7 +1212,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) texObj->MaxLevel = (GLint) params[0]; break; case GL_TEXTURE_PRIORITY: - /* (keithh@netcomuk.co.uk) */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); break; @@ -1165,7 +1226,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } else { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_MAX_TEXTURE_ANISOTROPY_EXT)"); + "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); return; } break; @@ -1198,10 +1259,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } break; - case GL_SHADOW_AMBIENT_SGIX: + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); - UNCLAMPED_FLOAT_TO_CHAN(texObj->ShadowAmbient, params[0]); + texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -1211,7 +1272,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) break; case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; } else { @@ -1220,12 +1280,78 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } break; - default: - { - char s[100]; - sprintf(s, "glTexParameter(pname=0x%x)", pname); - _mesa_error( ctx, GL_INVALID_ENUM, s); + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum mode = (GLenum) params[0]; + if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareMode = mode; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); + return; } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum func = (GLenum) params[0]; + if (func == GL_LEQUAL || func == GL_GEQUAL) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFunc = func; + } + else if (ctx->Extensions.EXT_shadow_funcs && + (func == GL_EQUAL || + func == GL_NOTEQUAL || + func == GL_LESS || + func == GL_GREATER || + func == GL_ALWAYS || + func == GL_NEVER)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFunc = func; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + const GLenum result = (GLenum) params[0]; + if (result == GL_LUMINANCE || result == GL_INTENSITY + || result == GL_ALPHA) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->DepthMode = result; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); + return; + } + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=0x%x)", pname); return; } @@ -1246,12 +1372,21 @@ _mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) _mesa_TexParameterfv(target, pname, fparam); } + void _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) { GLfloat fparam[4]; - fparam[0] = (GLfloat) params[0]; - fparam[1] = fparam[2] = fparam[3] = 0.0; + if (pname == GL_TEXTURE_BORDER_COLOR) { + fparam[0] = INT_TO_FLOAT(params[0]); + fparam[1] = INT_TO_FLOAT(params[1]); + fparam[2] = INT_TO_FLOAT(params[2]); + fparam[3] = INT_TO_FLOAT(params[3]); + } + else { + fparam[0] = (GLfloat) params[0]; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + } _mesa_TexParameterfv(target, pname, fparam); } @@ -1279,14 +1414,14 @@ tex_image_dimensions(GLcontext *ctx, GLenum target) case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: return 3; - case GL_TEXTURE_CUBE_MAP_ARB: - case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP: + case GL_PROXY_TEXTURE_CUBE_MAP: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; case GL_TEXTURE_RECTANGLE_NV: case GL_PROXY_TEXTURE_RECTANGLE_NV: @@ -1310,6 +1445,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, GLint maxLevels; ASSERT_OUTSIDE_BEGIN_END(ctx); + /* this will catch bad target values */ dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ if (dimensions == 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); @@ -1327,13 +1463,13 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_PROXY_TEXTURE_3D: maxLevels = ctx->Const.Max3DTextureLevels; break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case GL_PROXY_TEXTURE_CUBE_MAP: maxLevels = ctx->Const.MaxCubeTextureLevels; break; case GL_TEXTURE_RECTANGLE_NV: @@ -1341,8 +1477,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, maxLevels = 1; break; default: - maxLevels = ctx->Const.MaxCubeTextureLevels; - break; + _mesa_problem(ctx, "switch in _mesa_GetTexLevelParameter"); + return; } if (level < 0 || level >= maxLevels) { @@ -1363,7 +1499,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, isProxy = (target == GL_PROXY_TEXTURE_1D) || (target == GL_PROXY_TEXTURE_2D) || (target == GL_PROXY_TEXTURE_3D) || - (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) || + (target == GL_PROXY_TEXTURE_CUBE_MAP) || (target == GL_PROXY_TEXTURE_RECTANGLE_NV); switch (pname) { @@ -1437,33 +1573,37 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, if (ctx->Extensions.SGIX_depth_texture) *params = img->TexFormat->DepthBits; else - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); return; /* GL_ARB_texture_compression */ - case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB: + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: if (ctx->Extensions.ARB_texture_compression) { if (img->IsCompressed && !isProxy) *params = img->CompressedSize; else _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexLevelParameter[if]v(pname)"); + "glGetTexLevelParameter[if]v(pname)"); } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); } return; - case GL_TEXTURE_COMPRESSED_ARB: + case GL_TEXTURE_COMPRESSED: if (ctx->Extensions.ARB_texture_compression) { *params = (GLint) img->IsCompressed; } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); } return; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); } } @@ -1496,14 +1636,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) case GL_TEXTURE_WRAP_T: *params = ENUM_TO_FLOAT(obj->WrapT); return; - case GL_TEXTURE_WRAP_R_EXT: + case GL_TEXTURE_WRAP_R: *params = ENUM_TO_FLOAT(obj->WrapR); return; case GL_TEXTURE_BORDER_COLOR: - params[0] = obj->BorderColor[0] / CHAN_MAXF; - params[1] = obj->BorderColor[1] / CHAN_MAXF; - params[2] = obj->BorderColor[2] / CHAN_MAXF; - params[3] = obj->BorderColor[3] / CHAN_MAXF; + params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); + params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); + params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); + params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); return; case GL_TEXTURE_RESIDENT: { @@ -1548,9 +1688,9 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) return; } break; - case GL_SHADOW_AMBIENT_SGIX: + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { - *params = CHAN_TO_FLOAT(obj->ShadowAmbient); + *params = obj->ShadowAmbient; return; } break; @@ -1560,6 +1700,24 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) return; } break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareFunc; + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLfloat) obj->DepthMode; + return; + } + break; default: ; /* silence warnings */ } @@ -1595,20 +1753,20 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) case GL_TEXTURE_WRAP_T: *params = (GLint) obj->WrapT; return; - case GL_TEXTURE_WRAP_R_EXT: + case GL_TEXTURE_WRAP_R: *params = (GLint) obj->WrapR; return; case GL_TEXTURE_BORDER_COLOR: { - GLfloat color[4]; - color[0] = obj->BorderColor[0] / CHAN_MAXF; - color[1] = obj->BorderColor[1] / CHAN_MAXF; - color[2] = obj->BorderColor[2] / CHAN_MAXF; - color[3] = obj->BorderColor[3] / CHAN_MAXF; - params[0] = FLOAT_TO_INT( color[0] ); - params[1] = FLOAT_TO_INT( color[1] ); - params[2] = FLOAT_TO_INT( color[2] ); - params[3] = FLOAT_TO_INT( color[3] ); + GLfloat b[4]; + b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); + b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); + b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); + b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); + params[0] = FLOAT_TO_INT(b[0]); + params[1] = FLOAT_TO_INT(b[1]); + params[2] = FLOAT_TO_INT(b[2]); + params[3] = FLOAT_TO_INT(b[3]); } return; case GL_TEXTURE_RESIDENT: @@ -1654,10 +1812,9 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) return; } break; - case GL_SHADOW_AMBIENT_SGIX: + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ if (ctx->Extensions.SGIX_shadow_ambient) { - /* XXX range? */ - *params = (GLint) CHAN_TO_FLOAT(obj->ShadowAmbient); + *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); return; } break; @@ -1667,6 +1824,24 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) return; } break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareFunc; + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLint) obj->DepthMode; + return; + } + break; default: ; /* silence warnings */ } @@ -1691,10 +1866,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "texGEN %s %s %x...\n", - _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(pname), - *(int *)params); + _mesa_debug(ctx, "texGEN %s %s %x...\n", + _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(pname), + *(int *)params); switch (coord) { case GL_S: @@ -1740,10 +1915,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } - _mesa_transform_vector( tmp, params, ctx->ModelView.inv ); + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneS, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -1796,10 +1971,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } - _mesa_transform_vector( tmp, params, ctx->ModelView.inv ); + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneT, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -1849,10 +2024,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } - _mesa_transform_vector( tmp, params, ctx->ModelView.inv ); + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneR, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -1896,10 +2071,10 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) else if (pname==GL_EYE_PLANE) { GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { - _math_matrix_analyse( &ctx->ModelView ); + if (ctx->ModelviewMatrixStack.Top->flags & MAT_DIRTY_INVERSE) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); } - _mesa_transform_vector( tmp, params, ctx->ModelView.inv ); + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp)) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -2226,20 +2401,27 @@ void _mesa_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); - GLuint texUnit = target - GL_TEXTURE0_ARB; + GLuint texUnit = target - GL_TEXTURE0; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glActiveTexture %s\n", - _mesa_lookup_enum_by_nr(target)); + _mesa_debug(ctx, "glActiveTexture %s\n", + _mesa_lookup_enum_by_nr(target)); - if (texUnit > ctx->Const.MaxTextureUnits) { - _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTextureARB(target)"); + /* Cater for texture unit 0 is first, therefore use >= */ + if (texUnit >= ctx->Const.MaxTextureUnits) { + _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(target)"); return; } FLUSH_VERTICES(ctx, _NEW_TEXTURE); + ctx->Texture.CurrentUnit = texUnit; + if (ctx->Transform.MatrixMode == GL_TEXTURE) { + /* update current stack pointer */ + ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit]; + } + if (ctx->Driver.ActiveTexture) { (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); } @@ -2251,11 +2433,11 @@ void _mesa_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); - GLuint texUnit = target - GL_TEXTURE0_ARB; + GLuint texUnit = target - GL_TEXTURE0; ASSERT_OUTSIDE_BEGIN_END(ctx); if (texUnit > ctx->Const.MaxTextureUnits) { - _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTextureARB(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(target)"); return; } diff --git a/xc/extras/Mesa/src/texstate.h b/xc/extras/Mesa/src/texstate.h index 7f15673ad..66e7dfd88 100644 --- a/xc/extras/Mesa/src/texstate.h +++ b/xc/extras/Mesa/src/texstate.h @@ -1,7 +1,6 @@ - /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 5.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -34,6 +33,9 @@ extern void _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ); +extern void +_mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); + /*** Called from API ***/ diff --git a/xc/extras/Mesa/src/texstore.c b/xc/extras/Mesa/src/texstore.c index 2285c4663..62768c598 100644 --- a/xc/extras/Mesa/src/texstore.c +++ b/xc/extras/Mesa/src/texstore.c @@ -1,8 +1,7 @@ -/* $Id: texstore.c,v 1.1.1.1 2002/10/22 13:05:22 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.4 + * Version: 5.0.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -29,12 +28,38 @@ * Brian Paul */ +/* + * The GL texture image functions in teximage.c basically just do + * error checking and data structure allocation. They in turn call + * device driver functions which actually copy/convert/store the user's + * texture image data. + * + * However, most device drivers will be able to use the fallback functions + * in this file. That is, most drivers will have the following bit of + * code: + * ctx->Driver.TexImage1D = _mesa_store_teximage1d; + * ctx->Driver.TexImage2D = _mesa_store_teximage2d; + * ctx->Driver.TexImage3D = _mesa_store_teximage3d; + * etc... + * + * Texture image processing is actually kind of complicated. We have to do: + * Format/type conversions + * pixel unpacking + * pixel transfer (scale, bais, lookup, convolution!, etc) + * + * These functions can handle most everything, including processing full + * images and sub-images. + */ + + +#include "glheader.h" #include "colormac.h" #include "context.h" #include "convolve.h" #include "image.h" #include "macros.h" -#include "mem.h" +#include "imports.h" +#include "texcompress.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" @@ -46,9 +71,6 @@ * corresponding _base_ internal format: GL_ALPHA, GL_LUMINANCE, * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. Return the * number of components for the format. Return -1 if invalid enum. - * - * GH: Do we really need this? We have the number of bytes per texel - * in the texture format structures, so why don't we just use that? */ static GLint components_in_intformat( GLint format ) @@ -115,6 +137,8 @@ components_in_intformat( GLint format ) case GL_DEPTH_COMPONENT24_SGIX: case GL_DEPTH_COMPONENT32_SGIX: return 1; + case GL_YCBCR_MESA: + return 2; /* Y + (Cb or Cr) */ default: return -1; /* error */ } @@ -127,7 +151,8 @@ components_in_intformat( GLint format ) * We also take care of all image transfer operations here, including * convolution, scale/bias, colortables, etc. * - * The destination texel channel type is always GLchan. + * The destination texel type is always GLchan. + * The destination texel format is one of the 6 basic types. * * A hardware driver may use this as a helper routine to unpack and * apply pixel transfer ops into a temporary image buffer. Then, @@ -135,8 +160,8 @@ components_in_intformat( GLint format ) * * Input: * dimensions - 1, 2, or 3 - * texFormat - GL_LUMINANCE, GL_INTENSITY, GL_LUMINANCE_ALPHA, GL_ALPHA, - * GL_RGB or GL_RGBA + * texDestFormat - GL_LUMINANCE, GL_INTENSITY, GL_LUMINANCE_ALPHA, GL_ALPHA, + * GL_RGB or GL_RGBA (the destination format) * texDestAddr - destination image address * srcWidth, srcHeight, srcDepth - size (in pixels) of src and dest images * dstXoffset, dstYoffset, dstZoffset - position to store the image within @@ -162,6 +187,12 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions, ASSERT(ctx); ASSERT(dimensions >= 1 && dimensions <= 3); + ASSERT(texDestFormat == GL_LUMINANCE || + texDestFormat == GL_INTENSITY || + texDestFormat == GL_LUMINANCE_ALPHA || + texDestFormat == GL_ALPHA || + texDestFormat == GL_RGB || + texDestFormat == GL_RGBA); ASSERT(texDestAddr); ASSERT(srcWidth >= 1); ASSERT(srcHeight >= 1); @@ -255,6 +286,26 @@ transfer_teximage(GLcontext *ctx, GLuint dimensions, dest += dstImageStride; } } + else if (texDestFormat == GL_YCBCR_MESA) { + /* YCbCr texture */ + GLint img, row; + GLushort *dest = (GLushort *) texDestAddr + + dstZoffset * (dstImageStride / sizeof(GLushort)) + + dstYoffset * (dstRowStride / sizeof(GLushort)) + + dstXoffset * texComponents; + ASSERT(ctx->Extensions.MESA_ycbcr_texture); + for (img = 0; img < srcDepth; img++) { + GLushort *destRow = dest; + for (row = 0; row < srcHeight; row++) { + const GLvoid *srcRow = _mesa_image_address(srcPacking, + srcAddr, srcWidth, srcHeight, + srcFormat, srcType, img, row, 0); + MEMCPY(destRow, srcRow, srcWidth * sizeof(GLushort)); + destRow += (dstRowStride / sizeof(GLushort)); + } + dest += dstImageStride / sizeof(GLushort); + } + } else if (texDestFormat == GL_DEPTH_COMPONENT) { /* Depth texture (shadow maps) */ GLint img, row; @@ -422,6 +473,12 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, GLint postConvWidth = srcWidth, postConvHeight = srcHeight; assert(baseInternalFormat > 0); + ASSERT(baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_INTENSITY || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_RGBA); if (transferOps & IMAGE_CONVOLUTION_BIT) { _mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth, @@ -604,12 +661,86 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions, } + +/** + * Given a user's uncompressed texture image, this function takes care of + * pixel unpacking, pixel transfer, format conversion and compression. + */ +static void +transfer_compressed_teximage(GLcontext *ctx, GLuint dimensions, + GLsizei width, GLsizei height, GLsizei depth, + GLenum srcFormat, GLenum srcType, + const struct gl_pixelstore_attrib *unpacking, + const GLvoid *source, + const struct gl_texture_format *dstFormat, + GLubyte *dest, + GLint dstRowStride) +{ + GLchan *tempImage = NULL; + GLint srcRowStride; + GLenum baseFormat; + + ASSERT(dimensions == 2); + /* TexelBytes is zero if and only if it's a compressed format */ + ASSERT(dstFormat->TexelBytes == 0); + + baseFormat = dstFormat->BaseFormat; + + if (srcFormat != baseFormat || srcType != CHAN_TYPE || + ctx->_ImageTransferState != 0 || unpacking->SwapBytes) { + /* need to convert user's image to texImage->Format, GLchan */ + GLint comps = components_in_intformat(baseFormat); + GLint postConvWidth = width, postConvHeight = height; + + /* XXX convolution untested */ + if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { + _mesa_adjust_image_for_convolution(ctx, dimensions, &postConvWidth, + &postConvHeight); + } + + tempImage = (GLchan*) MALLOC(width * height * comps * sizeof(GLchan)); + if (!tempImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + transfer_teximage(ctx, dimensions, + baseFormat, /* dest format */ + tempImage, /* dst address */ + width, height, depth, /* src size */ + 0, 0, 0, /* x/y/zoffset */ + comps * width, /* dst row stride */ + comps * width * height, /* dst image stride */ + srcFormat, srcType, /* src format, type */ + source, unpacking, /* src and src packing */ + ctx->_ImageTransferState); + source = tempImage; + width = postConvWidth; + height = postConvHeight; + srcRowStride = width; + } + else { + if (unpacking->RowLength) + srcRowStride = unpacking->RowLength; + else + srcRowStride = width; + } + + _mesa_compress_teximage(ctx, width, height, baseFormat, + (const GLchan *) source, srcRowStride, + dstFormat, dest, dstRowStride); + if (tempImage) { + FREE(tempImage); + } +} + + + /* - * This is the software fallback for Driver.TexImage1D(). + * This is the software fallback for Driver.TexImage1D() + * and Driver.CopyTexImage2D(). * The texture image type will be GLchan. * The texture image format will be GL_COLOR_INDEX, GL_INTENSITY, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA. - * */ void _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, @@ -636,52 +767,55 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, texelBytes = texImage->TexFormat->TexelBytes; - /* Compute image size, in bytes */ - if (texImage->IsCompressed) { - assert(ctx->Driver.CompressedTextureSize); - sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, texImage); - assert(sizeInBytes > 0); - texImage->CompressedSize = sizeInBytes; - } - else { - sizeInBytes = postConvWidth * texelBytes; - } - /* allocate memory */ + if (texImage->IsCompressed) + sizeInBytes = texImage->CompressedSize; + else + sizeInBytes = postConvWidth * texelBytes; texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); return; } - if (pixels) { - /* unpack image, apply transfer ops and store in texImage->Data */ + if (!pixels) + return; + + /* unpack image, apply transfer ops and store in texImage->Data */ + if (texImage->IsCompressed) { + GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + width); + transfer_compressed_teximage(ctx, 1, width, 1, 1, + format, type, packing, + pixels, texImage->TexFormat, + (GLubyte *) texImage->Data, dstRowStride); + } + else { _mesa_transfer_teximage(ctx, 1, - _mesa_base_tex_format(ctx, internalFormat), + texImage->Format, /* base format */ texImage->TexFormat, texImage->Data, - width, 1, 1, 0, 0, 0, + width, 1, 1, /* src size */ + 0, 0, 0, /* dstX/Y/Zoffset */ 0, /* dstRowStride */ 0, /* dstImageStride */ format, type, pixels, packing); + } - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); - } + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } } /* - * This is the software fallback for Driver.TexImage2D(). + * This is the software fallback for Driver.TexImage2D() + * and Driver.CopyTexImage2D(). * The texture image type will be GLchan. * The texture image format will be GL_COLOR_INDEX, GL_INTENSITY, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA. - * - * NOTE: if real texture compression is supported, this whole function - * will need to be overridden. */ void _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, @@ -709,51 +843,56 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, texelBytes = texImage->TexFormat->TexelBytes; - /* Compute image size, in bytes */ - if (texImage->IsCompressed) { - assert(ctx->Driver.CompressedTextureSize); - sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, texImage); - assert(sizeInBytes > 0); - texImage->CompressedSize = sizeInBytes; - } - else { - sizeInBytes = postConvWidth * postConvHeight * texelBytes; - } - /* allocate memory */ + if (texImage->IsCompressed) + sizeInBytes = texImage->CompressedSize; + else + sizeInBytes = postConvWidth * postConvHeight * texelBytes; texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); return; } - if (pixels) { - /* unpack image, apply transfer ops and store in texImage->Data */ + if (!pixels) + return; + + /* unpack image, apply transfer ops and store in texImage->Data */ + if (texImage->IsCompressed) { + GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + width); + transfer_compressed_teximage(ctx, 2, width, height, 1, + format, type, packing, + pixels, texImage->TexFormat, + (GLubyte *) texImage->Data, dstRowStride); + } + else { _mesa_transfer_teximage(ctx, 2, - _mesa_base_tex_format(ctx, internalFormat), + texImage->Format, texImage->TexFormat, texImage->Data, - width, height, 1, 0, 0, 0, - texImage->Width * texelBytes, + width, height, 1, /* src size */ + 0, 0, 0, /* dstX/Y/Zoffset */ + texImage->Width * texelBytes, /* dstRowStride */ 0, /* dstImageStride */ format, type, pixels, packing); + } - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); - } + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } } /* - * This is the software fallback for Driver.TexImage3D(). + * This is the software fallback for Driver.TexImage3D() + * and Driver.CopyTexImage3D(). * The texture image type will be GLchan. * The texture image format will be GL_COLOR_INDEX, GL_INTENSITY, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_ALPHA, GL_RGB or GL_RGBA. - * */ void _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, @@ -775,40 +914,45 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, texelBytes = texImage->TexFormat->TexelBytes; - /* Compute image size, in bytes */ - if (texImage->IsCompressed) { - assert(ctx->Driver.CompressedTextureSize); - sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, texImage); - assert(sizeInBytes > 0); - texImage->CompressedSize = sizeInBytes; - } - else { - sizeInBytes = width * height * depth * texelBytes; - } - /* allocate memory */ + if (texImage->IsCompressed) + sizeInBytes = texImage->CompressedSize; + else + sizeInBytes = width * height * depth * texelBytes; texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); return; } - if (pixels) { - /* unpack image, apply transfer ops and store in texImage->Data */ + if (!pixels) + return; + + /* unpack image, apply transfer ops and store in texImage->Data */ + if (texImage->IsCompressed) { + GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + width); + transfer_compressed_teximage(ctx, 3, width, height, depth, + format, type, packing, + pixels, texImage->TexFormat, + (GLubyte *) texImage->Data, dstRowStride); + } + else { _mesa_transfer_teximage(ctx, 3, - _mesa_base_tex_format(ctx, internalFormat), + texImage->Format, texImage->TexFormat, texImage->Data, - width, height, depth, 0, 0, 0, - texImage->Width * texelBytes, + width, height, depth, /* src size */ + 0, 0, 0, /* dstX/Y/Zoffset */ + texImage->Width * texelBytes, /* dstRowStride */ texImage->Width * texImage->Height * texelBytes, format, type, pixels, packing); + } - /* GL_SGIS_generate_mipmap */ - if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); - } + /* GL_SGIS_generate_mipmap */ + if (level == texObj->BaseLevel && texObj->GenerateMipmap) { + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } } @@ -816,7 +960,8 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, /* - * This is the software fallback for Driver.TexSubImage1D(). + * This is the software fallback for Driver.TexSubImage1D() + * and Driver.CopyTexSubImage1D(). */ void _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, @@ -826,25 +971,45 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - _mesa_transfer_teximage(ctx, 1, - _mesa_base_tex_format(ctx, texImage->IntFormat), - texImage->TexFormat, texImage->Data, - width, 1, 1, /* src size */ - xoffset, 0, 0, /* dest offsets */ - 0, /* dstRowStride */ - 0, /* dstImageStride */ - format, type, pixels, packing); + if (texImage->IsCompressed) { + GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + GLubyte *dest = _mesa_compressed_image_address(xoffset, 0, 0, + texImage->IntFormat, + texImage->Width, + texImage->Data); + transfer_compressed_teximage(ctx, 1, /* dimensions */ + width, 1, 1, /* size to replace */ + format, type, /* source format/type */ + packing, /* source packing */ + pixels, /* source data */ + texImage->TexFormat,/* dest format */ + dest, dstRowStride); + } + else { + _mesa_transfer_teximage(ctx, 1, + texImage->Format, + texImage->TexFormat, texImage->Data, + width, 1, 1, /* src size */ + xoffset, 0, 0, /* dest offsets */ + 0, /* dstRowStride */ + 0, /* dstImageStride */ + format, type, pixels, packing); + } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } } + /* - * This is the software fallback for Driver.TexSubImage2D(). + * This is the software fallback for Driver.TexSubImage2D() + * and Driver.CopyTexSubImage2D(). */ void _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, @@ -855,18 +1020,36 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - _mesa_transfer_teximage(ctx, 2, - _mesa_base_tex_format(ctx, texImage->IntFormat), - texImage->TexFormat, texImage->Data, - width, height, 1, /* src size */ - xoffset, yoffset, 0, /* dest offsets */ - texImage->Width * texImage->TexFormat->TexelBytes, - 0, /* dstImageStride */ - format, type, pixels, packing); + if (texImage->IsCompressed) { + GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + GLubyte *dest = _mesa_compressed_image_address(xoffset, yoffset, 0, + texImage->IntFormat, + texImage->Width, + texImage->Data); + transfer_compressed_teximage(ctx, 2, /* dimensions */ + width, height, 1, /* size to replace */ + format, type, /* source format/type */ + packing, /* source packing */ + pixels, /* source data */ + texImage->TexFormat,/* dest format */ + dest, dstRowStride); + } + else { + _mesa_transfer_teximage(ctx, 2, + texImage->Format, + texImage->TexFormat, texImage->Data, + width, height, 1, /* src size */ + xoffset, yoffset, 0, /* dest offsets */ + texImage->Width *texImage->TexFormat->TexelBytes, + 0, /* dstImageStride */ + format, type, pixels, packing); + } /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } } @@ -874,6 +1057,7 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, /* * This is the software fallback for Driver.TexSubImage3D(). + * and Driver.CopyTexSubImage3D(). */ void _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, @@ -884,18 +1068,37 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - const GLint texelBytes = texImage->TexFormat->TexelBytes; - _mesa_transfer_teximage(ctx, 3, - _mesa_base_tex_format(ctx, texImage->IntFormat), + if (texImage->IsCompressed) { + GLint dstRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + GLubyte *dest = _mesa_compressed_image_address(xoffset, yoffset, zoffset, + texImage->IntFormat, + texImage->Width, + texImage->Data); + transfer_compressed_teximage(ctx, 3, /* dimensions */ + width, height, depth,/* size to replace */ + format, type, /* source format/type */ + packing, /* source packing */ + pixels, /* source data */ + texImage->TexFormat,/* dest format */ + dest, dstRowStride); + } + else { + const GLint texelBytes = texImage->TexFormat->TexelBytes; + _mesa_transfer_teximage(ctx, 3, + texImage->Format, texImage->TexFormat, texImage->Data, width, height, depth, /* src size */ xoffset, yoffset, xoffset, /* dest offsets */ - texImage->Width * texelBytes, + texImage->Width * texelBytes, /* dst row stride */ texImage->Width * texImage->Height * texelBytes, format, type, pixels, packing); + } + /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + _mesa_generate_mipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], texObj); } } @@ -914,9 +1117,7 @@ _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - /* Nothing here. - * The device driver has to do it all. - */ + /* this space intentionally left blank */ } @@ -932,9 +1133,33 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - /* Nothing here. - * The device driver has to do it all. + /* This is pretty simple, basically just do a memcpy without worrying + * about the usual image unpacking or image transfer operations. */ + ASSERT(texObj); + ASSERT(texImage); + ASSERT(texImage->Width > 0); + ASSERT(texImage->Height > 0); + ASSERT(texImage->Depth == 1); + ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */ + + /* choose the texture format */ + assert(ctx->Driver.ChooseTextureFormat); + texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, + internalFormat, 0, 0); + assert(texImage->TexFormat); + texImage->FetchTexel = texImage->TexFormat->FetchTexel2D; + + /* allocate storage */ + texImage->Data = MESA_PBUFFER_ALLOC(imageSize); + if (!texImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); + return; + } + + /* copy the data */ + ASSERT(texImage->CompressedSize == imageSize); + MEMCPY(texImage->Data, data, imageSize); } @@ -951,31 +1176,90 @@ _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - /* Nothing here. - * The device driver has to do it all. - */ + /* this space intentionally left blank */ } -/* - * Fallback for Driver.GetCompressedTexImage3D() - * This will probably work find for hardware drivers. That is, hardware - * drivers won't have to override this function, unless the compressed - * texture must first be fetched from the TRAM. +/** + * Fallback for Driver.CompressedTexSubImage1D() */ void -_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, - GLint level, void *image, - const struct gl_texture_object *texObj, - struct gl_texture_image *texImage) +_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, + GLint level, + GLint xoffset, GLsizei width, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { - assert(texImage->IsCompressed); - assert(texImage->CompressedSize > 0); - MEMCPY(image, texImage->Data, texImage->CompressedSize); + /* this space intentionally left blank */ } +/** + * Fallback for Driver.CompressedTexSubImage2D() + */ +void +_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, + GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + GLint bytesPerRow, destRowStride, srcRowStride; + GLint i, rows; + GLubyte *dest; + const GLubyte *src; + + /* these should have been caught sooner */ + ASSERT((width & 3) == 0 || width == 2 || width == 1); + ASSERT((height & 3) == 0 || height == 2 || height == 1); + ASSERT((xoffset & 3) == 0); + ASSERT((yoffset & 3) == 0); + + srcRowStride = _mesa_compressed_row_stride(texImage->IntFormat, width); + src = (const GLubyte *) data; + + destRowStride = _mesa_compressed_row_stride(texImage->IntFormat, + texImage->Width); + dest = _mesa_compressed_image_address(xoffset, yoffset, 0, + texImage->IntFormat, + texImage->Width, texImage->Data); + + bytesPerRow = srcRowStride; + rows = height / 4; + + for (i = 0; i < rows; i++) { + MEMCPY(dest, src, bytesPerRow); + dest += destRowStride; + src += srcRowStride; + } +} + + +/** + * Fallback for Driver.CompressedTexSubImage3D() + */ +void +_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, + GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + /* this space intentionally left blank */ +} + + + + /* * This is the fallback for Driver.TestProxyTexImage(). @@ -1470,7 +1754,7 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, */ /* - printf("mip3d %d x %d x %d -> %d x %d x %d\n", + _mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n", srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth); */ @@ -1603,53 +1887,74 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, * Stop at texObj's MaxLevel or when we get to the 1x1 texture. */ void -_mesa_generate_mipmap(GLcontext *ctx, +_mesa_generate_mipmap(GLcontext *ctx, GLenum target, const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj) { - const GLenum targets1D[] = { GL_TEXTURE_1D, 0 }; - const GLenum targets2D[] = { GL_TEXTURE_2D, 0 }; - const GLenum targets3D[] = { GL_TEXTURE_3D, 0 }; - const GLenum targetsCube[] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, - 0 }; - const GLenum targetsRect[] = { GL_TEXTURE_RECTANGLE_NV, 0 }; - const GLenum *targets; - GLint level; - GLint maxLevels = 0; + const struct gl_texture_image *srcImage; + const struct gl_texture_format *convertFormat; + const GLubyte *srcData; + GLubyte *dstData; + GLint level, maxLevels; ASSERT(texObj); - ASSERT(texObj->Image[texObj->BaseLevel]); - - switch (texObj->Target) { - case GL_TEXTURE_1D: - targets = targets1D; - maxLevels = ctx->Const.MaxTextureLevels; - break; - case GL_TEXTURE_2D: - targets = targets2D; - maxLevels = ctx->Const.MaxTextureLevels; - break; - case GL_TEXTURE_3D: - targets = targets3D; - maxLevels = ctx->Const.Max3DTextureLevels; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - targets = targetsCube; - maxLevels = ctx->Const.MaxCubeTextureLevels; - break; - case GL_TEXTURE_RECTANGLE_NV: - targets = targetsRect; - maxLevels = 1; - break; - default: - _mesa_problem(ctx, - "Bad texture object dimension in _mesa_generate_mipmaps"); - return; + srcImage = texObj->Image[texObj->BaseLevel]; + ASSERT(srcImage); + + maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); + ASSERT(maxLevels > 0); /* bad target */ + + /* Find convertFormat - the format that do_row() will process */ + if (srcImage->IsCompressed) { + /* setup for compressed textures */ + GLuint row; + GLint components, size; + GLchan *dst; + + assert(texObj->Target == GL_TEXTURE_2D); + + if (srcImage->Format == GL_RGB) { + convertFormat = &_mesa_texformat_rgb; + components = 3; + } + else if (srcImage->Format == GL_RGBA) { + convertFormat = &_mesa_texformat_rgba; + components = 4; + } + else { + _mesa_problem(ctx, "bad srcImage->Format in _mesa_generate_mipmaps"); + return; + } + + /* allocate storage for uncompressed GL_RGB or GL_RGBA images */ + size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE) + * srcImage->Width * srcImage->Height * srcImage->Depth + 20; + /* 20 extra bytes, just be safe when calling last FetchTexel */ + srcData = MALLOC(size); + if (!srcData) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); + return; + } + dstData = MALLOC(size / 2); /* 1/4 would probably be OK */ + if (!dstData) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); + FREE((void *) srcData); + return; + } + + /* decompress base image here */ + dst = (GLchan *) srcData; + for (row = 0; row < srcImage->Height; row++) { + GLuint col; + for (col = 0; col < srcImage->Width; col++) { + (*srcImage->FetchTexel)(srcImage, col, row, 0, (GLvoid *) dst); + dst += components; + } + } + } + else { + /* uncompressed */ + convertFormat = srcImage->TexFormat; } for (level = texObj->BaseLevel; level < texObj->MaxLevel @@ -1660,15 +1965,14 @@ _mesa_generate_mipmap(GLcontext *ctx, GLint srcWidth, srcHeight, srcDepth; GLint dstWidth, dstHeight, dstDepth; GLint border, bytesPerTexel; - GLint t; - srcImage = texObj->Image[level]; + /* get src image parameters */ + srcImage = _mesa_select_tex_image(ctx, texUnit, target, level); ASSERT(srcImage); srcWidth = srcImage->Width; srcHeight = srcImage->Height; srcDepth = srcImage->Depth; border = srcImage->Border; - bytesPerTexel = srcImage->TexFormat->TexelBytes; /* compute next (level+1) image size */ if (srcWidth - 2 * border > 1) { @@ -1694,65 +1998,88 @@ _mesa_generate_mipmap(GLcontext *ctx, dstHeight == srcHeight && dstDepth == srcDepth) { /* all done */ + if (srcImage->IsCompressed) { + FREE((void *) srcData); + FREE(dstData); + } return; } - /* Need this loop just because of cubemaps */ - for (t = 0; targets[t]; t++) { - ASSERT(t < 6); - - dstImage = _mesa_select_tex_image(ctx, texUnit, targets[t], level+1); + /* get dest gl_texture_image */ + dstImage = _mesa_select_tex_image(ctx, texUnit, target, level+1); + if (!dstImage) { + dstImage = _mesa_alloc_texture_image(); if (!dstImage) { - dstImage = _mesa_alloc_texture_image(); - if (!dstImage) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - return; - } - _mesa_set_tex_image(texObj, targets[t], level + 1, dstImage); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); + return; } + _mesa_set_tex_image(texObj, target, level + 1, dstImage); + } - /* Free old image data */ - if (dstImage->Data) - MESA_PBUFFER_FREE(dstImage->Data); - - /* initialize new image */ - _mesa_init_teximage_fields(ctx, t, dstImage, dstWidth, dstHeight, - dstDepth, border, srcImage->Format); - dstImage->DriverData = NULL; - dstImage->TexFormat = srcImage->TexFormat; - dstImage->FetchTexel = srcImage->FetchTexel; - ASSERT(dstImage->TexFormat); - ASSERT(dstImage->FetchTexel); - + /* Free old image data */ + if (dstImage->Data) + MESA_PBUFFER_FREE(dstImage->Data); + + /* initialize new image */ + _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, + dstDepth, border, srcImage->IntFormat); + dstImage->DriverData = NULL; + dstImage->TexFormat = srcImage->TexFormat; + dstImage->FetchTexel = srcImage->FetchTexel; + ASSERT(dstImage->TexFormat); + ASSERT(dstImage->FetchTexel); + + /* Alloc new teximage data buffer. + * Setup src and dest data pointers. + */ + if (dstImage->IsCompressed) { + ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/ + dstImage->Data = MESA_PBUFFER_ALLOC(dstImage->CompressedSize); + if (!dstImage->Data) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); + return; + } + /* srcData and dstData are already set */ + ASSERT(srcData); + ASSERT(dstData); + } + else { + bytesPerTexel = srcImage->TexFormat->TexelBytes; ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); - - /* alloc new image buffer */ dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth - * bytesPerTexel); + * bytesPerTexel); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; } + srcData = (const GLubyte *) srcImage->Data; + dstData = (GLubyte *) dstImage->Data; + } - /* - * We use simple 2x2 averaging to compute the next mipmap level. - */ - switch (texObj->Target) { + /* + * We use simple 2x2 averaging to compute the next mipmap level. + */ + switch (target) { case GL_TEXTURE_1D: - make_1d_mipmap(srcImage->TexFormat, border, - srcWidth, (const GLubyte *) srcImage->Data, - dstWidth, (GLubyte *) dstImage->Data); + make_1d_mipmap(convertFormat, border, + srcWidth, srcData, + dstWidth, dstData); break; case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_ARB: - make_2d_mipmap(srcImage->TexFormat, border, - srcWidth, srcHeight, (const GLubyte *) srcImage->Data, - dstWidth, dstHeight, (GLubyte *) dstImage->Data); + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + make_2d_mipmap(convertFormat, border, + srcWidth, srcHeight, srcData, + dstWidth, dstHeight, dstData); break; case GL_TEXTURE_3D: - make_3d_mipmap(srcImage->TexFormat, border, - srcWidth, srcHeight, srcDepth, (const GLubyte *) srcImage->Data, - dstWidth, dstHeight, dstDepth, (GLubyte *) dstImage->Data); + make_3d_mipmap(convertFormat, border, + srcWidth, srcHeight, srcDepth, srcData, + dstWidth, dstHeight, dstDepth, dstData); break; case GL_TEXTURE_RECTANGLE_NV: /* no mipmaps, do nothing */ @@ -1760,7 +2087,29 @@ _mesa_generate_mipmap(GLcontext *ctx, default: _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); return; - } - } /* loop over tex image targets */ - } /* loop over tex levels */ + } + + if (dstImage->IsCompressed) { + GLubyte *temp; + /* compress image from dstData into dstImage->Data */ + const GLenum srcFormat = convertFormat->BaseFormat; + GLint dstRowStride = _mesa_compressed_row_stride(srcImage->IntFormat, + dstWidth); + ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); + _mesa_compress_teximage(ctx, + dstWidth, dstHeight, /* size */ + srcFormat, /* source format */ + dstData, /* source buffer */ + dstWidth, /* source row stride */ + dstImage->TexFormat, /* dest format */ + dstImage->Data, /* dest buffer */ + dstRowStride ); /* dest row stride */ + + /* swap src and dest pointers */ + temp = (GLubyte *) srcData; + srcData = dstData; + dstData = temp; + } + + } /* loop over mipmap levels */ } diff --git a/xc/extras/Mesa/src/texstore.h b/xc/extras/Mesa/src/texstore.h index 53c1a2807..799769698 100644 --- a/xc/extras/Mesa/src/texstore.h +++ b/xc/extras/Mesa/src/texstore.h @@ -1,10 +1,9 @@ -/* $Id: texstore.h,v 1.1.1.1 2002/10/22 13:05:22 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -136,10 +135,33 @@ _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, - GLint level, void *image, - const struct gl_texture_object *texObj, - struct gl_texture_image *texImage); +_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target, + GLint level, + GLint xoffset, GLsizei width, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + +extern void +_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, + GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); + +extern void +_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target, + GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); extern GLboolean @@ -149,7 +171,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, extern void -_mesa_generate_mipmap(GLcontext *ctx, +_mesa_generate_mipmap(GLcontext *ctx, GLenum target, const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj); diff --git a/xc/extras/Mesa/src/texutil.c b/xc/extras/Mesa/src/texutil.c index bf9285a7e..5b515b776 100644 --- a/xc/extras/Mesa/src/texutil.c +++ b/xc/extras/Mesa/src/texutil.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,22 +23,27 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ -#ifdef PC_HEADER -#include "all.h" -#else +/* + * Description: + * Functions for texture image conversion. This takes care of converting + * typical GL_RGBA/GLubyte textures into hardware-specific formats. + * We can handle non-standard row strides and pixel unpacking parameters. + */ + + #include "glheader.h" #include "context.h" #include "enums.h" #include "image.h" +#include "imports.h" #include "macros.h" -#include "mem.h" #include "mtypes.h" #include "texformat.h" #include "texutil.h" -#endif + #define DEBUG_TEXUTIL 0 @@ -50,7 +55,7 @@ #endif -struct gl_texture_convert { +struct convert_info { GLint xoffset, yoffset, zoffset; /* Subimage offset */ GLint width, height, depth; /* Subimage region */ @@ -66,15 +71,16 @@ struct gl_texture_convert { GLint index; }; -typedef GLboolean (*convert_func)( struct gl_texture_convert *convert ); +typedef GLboolean (*convert_func)( const struct convert_info *convert ); +/* bitvalues for convert->index */ #define CONVERT_STRIDE_BIT 0x1 #define CONVERT_UNPACKING_BIT 0x2 /* ============================================================= - * RGBA8888 textures: + * Convert to RGBA8888 textures: */ #define DST_TYPE GLuint @@ -117,7 +123,7 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert ); #define CONVERT_RGBA8888( name ) \ static GLboolean \ -convert_##name##_rgba8888( struct gl_texture_convert *convert ) \ +convert_##name##_rgba8888( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -153,7 +159,7 @@ CONVERT_RGBA8888( texsubimage3d ) /* ============================================================= - * ARGB8888 textures: + * Convert to ARGB8888 textures: */ #define DST_TYPE GLuint @@ -196,7 +202,7 @@ CONVERT_RGBA8888( texsubimage3d ) #define CONVERT_ARGB8888( name ) \ static GLboolean \ -convert_##name##_argb8888( struct gl_texture_convert *convert ) \ +convert_##name##_argb8888( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -231,11 +237,11 @@ CONVERT_ARGB8888( texsubimage3d ) /* ============================================================= - * RGB888 textures: + * Convert to RGB888 textures: */ static GLboolean -convert_texsubimage2d_rgb888( struct gl_texture_convert *convert ) +convert_texsubimage2d_rgb888( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -243,7 +249,7 @@ convert_texsubimage2d_rgb888( struct gl_texture_convert *convert ) } static GLboolean -convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) +convert_texsubimage3d_rgb888( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -253,7 +259,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) /* ============================================================= - * RGB565 textures: + * Convert to RGB565 textures: */ #define DST_TYPE GLushort @@ -300,7 +306,7 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert ) #define CONVERT_RGB565( name ) \ static GLboolean \ -convert_##name##_rgb565( struct gl_texture_convert *convert ) \ +convert_##name##_rgb565( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -335,7 +341,7 @@ CONVERT_RGB565( texsubimage3d ) /* ============================================================= - * ARGB4444 textures: + * Convert to ARGB4444 textures: */ #define DST_TYPE GLushort @@ -368,7 +374,7 @@ CONVERT_RGB565( texsubimage3d ) #define CONVERT_ARGB4444( name ) \ static GLboolean \ -convert_##name##_argb4444( struct gl_texture_convert *convert ) \ +convert_##name##_argb4444( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -398,7 +404,7 @@ CONVERT_ARGB4444( texsubimage3d ) /* ============================================================= - * ARGB1555 textures: + * Convert to ARGB1555 textures: */ #define DST_TYPE GLushort @@ -462,7 +468,7 @@ CONVERT_ARGB4444( texsubimage3d ) #define CONVERT_ARGB1555( name ) \ static GLboolean \ -convert_##name##_argb1555( struct gl_texture_convert *convert ) \ +convert_##name##_argb1555( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -558,7 +564,7 @@ CONVERT_ARGB1555( texsubimage3d ) #define CONVERT_AL88( name ) \ static GLboolean \ -convert_##name##_al88( struct gl_texture_convert *convert ) \ +convert_##name##_al88( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -598,11 +604,11 @@ CONVERT_AL88( texsubimage3d ) /* ============================================================= - * RGB332 textures: + * Convert to RGB332 textures: */ static GLboolean -convert_texsubimage2d_rgb332( struct gl_texture_convert *convert ) +convert_texsubimage2d_rgb332( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -610,7 +616,7 @@ convert_texsubimage2d_rgb332( struct gl_texture_convert *convert ) } static GLboolean -convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) +convert_texsubimage3d_rgb332( const struct convert_info *convert ) { /* This is a placeholder for now... */ @@ -638,7 +644,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert ) #define CONVERT_CI8( name ) \ static GLboolean \ -convert_##name##_ci8( struct gl_texture_convert *convert ) \ +convert_##name##_ci8( const struct convert_info *convert ) \ { \ convert_func *tab; \ GLint index = convert->index; \ @@ -664,12 +670,88 @@ CONVERT_CI8( texsubimage2d ) CONVERT_CI8( texsubimage3d ) +/* ============================================================= + * convert to YCBCR textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( dst, src ) \ + dst = (src[0] << 8) | src[1]; + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_ycbcr_direct +#include "texutil_tmp.h" + + +#define CONVERT_YCBCR( name ) \ +static GLboolean \ +convert_##name##_ycbcr( const struct convert_info *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if (convert->format != GL_YCBCR_MESA) { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + tab = name##_tab_ycbcr_direct; \ + \ + return tab[index]( convert ); \ +} + +CONVERT_YCBCR( texsubimage2d ) +CONVERT_YCBCR( texsubimage3d ) + + +/* ============================================================= + * convert to YCBCR_REV textures: + */ + +#define DST_TYPE GLushort +#define DST_TEXELS_PER_DWORD 2 + +#define CONVERT_TEXEL( dst, src ) \ + dst = (src[1] << 8) | src[0]; + +#define CONVERT_DIRECT + +#define SRC_TEXEL_BYTES 2 + +#define TAG(x) x##_ycbcr_rev_direct +#include "texutil_tmp.h" + + +#define CONVERT_YCBCR_REV( name ) \ +static GLboolean \ +convert_##name##_ycbcr_rev( const struct convert_info *convert ) \ +{ \ + convert_func *tab; \ + GLint index = convert->index; \ + \ + if (convert->format != GL_YCBCR_MESA) { \ + /* Can't handle this source format/type combination */ \ + return GL_FALSE; \ + } \ + tab = name##_tab_ycbcr_rev_direct; \ + \ + return tab[index]( convert ); \ +} + +CONVERT_YCBCR_REV( texsubimage2d ) +CONVERT_YCBCR_REV( texsubimage3d ) + + /* ============================================================= * Global entry points */ -static convert_func gl_convert_texsubimage2d_tab[] = { +static convert_func convert_texsubimage2d_tab[] = { convert_texsubimage2d_rgba8888, convert_texsubimage2d_argb8888, convert_texsubimage2d_rgb888, @@ -682,9 +764,11 @@ static convert_func gl_convert_texsubimage2d_tab[] = { convert_texsubimage2d_ci8, convert_texsubimage2d_ci8, convert_texsubimage2d_ci8, + convert_texsubimage2d_ycbcr, + convert_texsubimage2d_ycbcr_rev, }; -static convert_func gl_convert_texsubimage3d_tab[] = { +static convert_func convert_texsubimage3d_tab[] = { convert_texsubimage3d_rgba8888, convert_texsubimage3d_argb8888, convert_texsubimage3d_rgb888, @@ -697,6 +781,8 @@ static convert_func gl_convert_texsubimage3d_tab[] = { convert_texsubimage3d_ci8, convert_texsubimage3d_ci8, convert_texsubimage3d_ci8, + convert_texsubimage3d_ycbcr, + convert_texsubimage3d_ycbcr_rev, }; @@ -734,14 +820,14 @@ _mesa_convert_texsubimage1d( GLint mesaFormat, const struct gl_pixelstore_attrib *unpacking, const GLvoid *srcImage, GLvoid *dstImage ) { - struct gl_texture_convert convert; + struct convert_info convert; ASSERT( unpacking ); ASSERT( srcImage ); ASSERT( dstImage ); ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); - ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); /* Make it easier to pass all the parameters around. */ @@ -760,7 +846,9 @@ _mesa_convert_texsubimage1d( GLint mesaFormat, if ( convert_needs_unpacking( unpacking, format, type ) ) convert.index |= CONVERT_UNPACKING_BIT; - return gl_convert_texsubimage2d_tab[mesaFormat]( &convert ); + ASSERT(convert.index < 4); + + return convert_texsubimage2d_tab[mesaFormat]( &convert ); } @@ -790,22 +878,22 @@ _mesa_convert_texsubimage1d( GLint mesaFormat, * destImage - pointer to dest image */ GLboolean -_mesa_convert_texsubimage2d( GLint mesaFormat, +_mesa_convert_texsubimage2d( GLint mesaFormat, /* dest */ GLint xoffset, GLint yoffset, GLint width, GLint height, GLint destImageWidth, - GLenum format, GLenum type, + GLenum format, GLenum type, /* source */ const struct gl_pixelstore_attrib *unpacking, const GLvoid *srcImage, GLvoid *dstImage ) { - struct gl_texture_convert convert; + struct convert_info convert; ASSERT( unpacking ); ASSERT( srcImage ); ASSERT( dstImage ); ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); - ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); /* Make it easier to pass all the parameters around. */ @@ -828,26 +916,26 @@ _mesa_convert_texsubimage2d( GLint mesaFormat, if ( width != destImageWidth ) convert.index |= CONVERT_STRIDE_BIT; - return gl_convert_texsubimage2d_tab[mesaFormat]( &convert ); + return convert_texsubimage2d_tab[mesaFormat]( &convert ); } GLboolean -_mesa_convert_texsubimage3d( GLint mesaFormat, +_mesa_convert_texsubimage3d( GLint mesaFormat, /* dest */ GLint xoffset, GLint yoffset, GLint zoffset, GLint width, GLint height, GLint depth, GLint dstImageWidth, GLint dstImageHeight, - GLenum format, GLenum type, + GLenum format, GLenum type, /* source */ const struct gl_pixelstore_attrib *unpacking, const GLvoid *srcImage, GLvoid *dstImage ) { - struct gl_texture_convert convert; + struct convert_info convert; ASSERT( unpacking ); ASSERT( srcImage ); ASSERT( dstImage ); ASSERT( mesaFormat >= MESA_FORMAT_RGBA8888 ); - ASSERT( mesaFormat <= MESA_FORMAT_CI8 ); + ASSERT( mesaFormat <= MESA_FORMAT_YCBCR_REV ); /* Make it easier to pass all the parameters around. */ @@ -873,7 +961,7 @@ _mesa_convert_texsubimage3d( GLint mesaFormat, if ( width != dstImageWidth || height != dstImageHeight ) convert.index |= CONVERT_STRIDE_BIT; - return gl_convert_texsubimage3d_tab[mesaFormat]( &convert ); + return convert_texsubimage3d_tab[mesaFormat]( &convert ); } diff --git a/xc/extras/Mesa/src/texutil.h b/xc/extras/Mesa/src/texutil.h index 9a1be1ddb..97e629cfb 100644 --- a/xc/extras/Mesa/src/texutil.h +++ b/xc/extras/Mesa/src/texutil.h @@ -23,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ diff --git a/xc/extras/Mesa/src/texutil_tmp.h b/xc/extras/Mesa/src/texutil_tmp.h index 34fbfd7cf..d6b94376b 100644 --- a/xc/extras/Mesa/src/texutil_tmp.h +++ b/xc/extras/Mesa/src/texutil_tmp.h @@ -1,5 +1,3 @@ -/* $Id: texutil_tmp.h,v 1.1.1.3 2002/10/22 13:05:37 alanh Exp $ */ - /* * Mesa 3-D graphics library * Version: 4.0.2 @@ -24,11 +22,28 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ + /* - * NOTE: All 3D teximage code is untested and most definitely broken... + * For 2D and 3D texture images, we generate functions for + * - conversion without pixel unpacking and standard stride + * - conversion without pixel unpacking and non-standard stride + * - conversion with pixel unpacking and standard stride + * - conversion with pixel unpacking and non-standard stride + * + * + * Macros which need to be defined before including this file: + * TAG(x) - the function name wrapper + * DST_TYPE - the destination texel datatype (GLuint, GLushort, etc) + * DST_TEXELS_PER_DWORD - number of dest texels that'll fit in 4 bytes + * CONVERT_TEXEL - code to convert from source to dest texel + * CONVER_TEXEL_DWORD - if multiple texels fit in 4 bytes, this macros + * will convert/store multiple texels at once + * CONVERT_DIRECT - if defined, just memcpy texels from src to dest + * SRC_TEXEL_BYTES - bytes per source texel + * PRESERVE_DST_TYPE - if defined, don't undefined these macros at end */ @@ -43,7 +58,7 @@ * PRE: No pixelstore attribs, width == dstImageWidth. */ static GLboolean -TAG(texsubimage2d)( struct gl_texture_convert *convert ) +TAG(texsubimage2d)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + @@ -51,7 +66,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert ) convert->xoffset) * DST_TEXEL_BYTES); #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif #ifdef CONVERT_DIRECT @@ -79,7 +94,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert ) /* PRE: As above, height == dstImageHeight also. */ static GLboolean -TAG(texsubimage3d)( struct gl_texture_convert *convert ) +TAG(texsubimage3d)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + @@ -87,7 +102,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) convert->yoffset) * convert->width + convert->xoffset) * DST_TEXEL_BYTES); #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif #ifdef CONVERT_DIRECT @@ -118,7 +133,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) * PRE: No pixelstore attribs, width != dstImageWidth. */ static GLboolean -TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_stride)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + @@ -130,11 +145,11 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _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 ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -151,7 +166,7 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) /* PRE: As above, or height != dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_stride)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + @@ -164,11 +179,11 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _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 ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { @@ -191,7 +206,7 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) * PRE: Require pixelstore attribs, width == dstImageWidth. */ static GLboolean -TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -203,7 +218,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) GLint row, col; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { @@ -249,7 +264,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) /* PRE: as above, height == dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -265,7 +280,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) GLint row, col, img; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { @@ -324,7 +339,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) * PRE: Require pixelstore attribs, width != dstImageWidth. */ static GLboolean -TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -343,11 +358,11 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _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 ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -372,7 +387,7 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) /* PRE: As above, or height != dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -396,11 +411,11 @@ TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _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 ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { diff --git a/xc/extras/Mesa/src/tnl/t_array_api.c b/xc/extras/Mesa/src/tnl/t_array_api.c index 060203b81..60744a2d7 100644 --- a/xc/extras/Mesa/src/tnl/t_array_api.c +++ b/xc/extras/Mesa/src/tnl/t_array_api.c @@ -1,8 +1,7 @@ -/* $Id: t_array_api.c,v 1.1.1.1 2002/10/22 13:06:23 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -22,19 +21,22 @@ * 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. - * - * Authors: - * Keith Whitwell <keithw@valinux.com> + */ + +/** + * \file vpexec.c + * \brief Vertex array API functions (glDrawArrays, etc) + * \author Keith Whitwell */ #include "glheader.h" #include "api_validate.h" #include "context.h" +#include "imports.h" #include "macros.h" #include "mmath.h" -#include "mem.h" -#include "state.h" #include "mtypes.h" +#include "state.h" #include "array_cache/acache.h" @@ -77,7 +79,7 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, TNLcontext *tnl = TNL_CONTEXT(ctx); FLUSH_CURRENT( ctx, 0 ); - /* fprintf(stderr, "%s\n", __FUNCTION__); */ + /* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); @@ -101,7 +103,9 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, - +/** + * Called via the GL API dispatcher. + */ void _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) { @@ -111,7 +115,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) GLuint thresh = (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) ? 30 : 10; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_DrawArrays %d %d\n", start, count); + _mesa_debug(NULL, "_tnl_DrawArrays %d %d\n", start, count); /* Check arguments, etc. */ @@ -130,43 +134,28 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) */ fallback_drawarrays( ctx, mode, start, start + count ); } - else if (count < (GLint) ctx->Const.MaxArrayLockSize) { - /* Moderate primitives which can fit in a single vertex buffer: + else if (ctx->Array.LockCount && + count < (GLint) ctx->Const.MaxArrayLockSize) { + + /* Locked primitives which can fit in a single vertex buffer: */ FLUSH_CURRENT( ctx, 0 ); - if (ctx->Array.LockCount) - { - if (start < (GLint) ctx->Array.LockFirst) - start = ctx->Array.LockFirst; - if (start + count > (GLint) ctx->Array.LockCount) - count = ctx->Array.LockCount - start; - - /* Locked drawarrays. Reuse any previously transformed data. - */ - _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); - VB->FirstPrimitive = start; - VB->Primitive[start] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; - VB->PrimitiveLength[start] = count; - tnl->Driver.RunPipeline( ctx ); - } else { - /* The arrays are small enough to fit in a single VB; just bind - * them and go. Any untransformed data will be copied on - * clipping. - * - * Invalidate any cached data dependent on these arrays. - */ - _tnl_vb_bind_arrays( ctx, start, start + count ); - VB->FirstPrimitive = 0; - VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; - VB->PrimitiveLength[0] = count; - tnl->pipeline.run_input_changes |= ctx->Array._Enabled; - tnl->Driver.RunPipeline( ctx ); - tnl->pipeline.run_input_changes |= ctx->Array._Enabled; - } - } + if (start < (GLint) ctx->Array.LockFirst) + start = ctx->Array.LockFirst; + if (start + count > (GLint) ctx->Array.LockCount) + count = ctx->Array.LockCount - start; + + /* Locked drawarrays. Reuse any previously transformed data. + */ + _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); + VB->FirstPrimitive = start; + VB->Primitive[start] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; + VB->PrimitiveLength[start] = count; + tnl->Driver.RunPipeline( ctx ); + } else { - int bufsz = 256; /* use a small buffer for cache goodness */ + int bufsz = 256; /* Use a small buffer for cache goodness */ int j, nr; int minimum, modulo, skip; @@ -178,10 +167,12 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) minimum = 0; modulo = 1; skip = 0; + break; case GL_LINES: minimum = 1; modulo = 2; skip = 1; + break; case GL_LINE_STRIP: minimum = 1; modulo = 1; @@ -212,10 +203,19 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) case GL_POLYGON: default: /* Primitives requiring a copied vertex (fan-like primitives) - * must use the slow path: + * must use the slow path if they cannot fit in a single + * vertex buffer. */ - fallback_drawarrays( ctx, mode, start, start + count ); - return; + if (count < (GLint) ctx->Const.MaxArrayLockSize) { + bufsz = ctx->Const.MaxArrayLockSize; + minimum = 0; + modulo = 1; + skip = 0; + } + else { + fallback_drawarrays( ctx, mode, start, start + count ); + return; + } } FLUSH_CURRENT( ctx, 0 ); @@ -241,6 +241,9 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) } +/** + * Called via the GL API dispatcher. + */ void _tnl_DrawRangeElements(GLenum mode, GLuint start, GLuint end, @@ -250,7 +253,7 @@ _tnl_DrawRangeElements(GLenum mode, GLuint *ui_indices; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); + _mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); /* Check arguments, etc. */ @@ -306,6 +309,9 @@ _tnl_DrawRangeElements(GLenum mode, +/** + * Called via the GL API dispatcher. + */ void _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) @@ -314,7 +320,7 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, GLuint *ui_indices; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_DrawElements %d\n", count); + _mesa_debug(NULL, "_tnl_DrawElements %d\n", count); /* Check arguments, etc. */ @@ -354,6 +360,10 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, } +/** + * Initialize context's vertex array fields. Called during T 'n L context + * creation. + */ void _tnl_array_init( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -368,8 +378,8 @@ void _tnl_array_init( GLcontext *ctx ) /* Setup vector pointers that will be used to bind arrays to VB's. */ _mesa_vector4f_init( &tmp->Obj, 0, 0 ); - _mesa_vector3f_init( &tmp->Normal, 0, 0 ); - _mesa_vector1f_init( &tmp->FogCoord, 0, 0 ); + _mesa_vector4f_init( &tmp->Normal, 0, 0 ); + _mesa_vector4f_init( &tmp->FogCoord, 0, 0 ); _mesa_vector1ui_init( &tmp->Index, 0, 0 ); _mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); @@ -381,6 +391,10 @@ void _tnl_array_init( GLcontext *ctx ) } +/** + * Destroy the context's vertex array stuff. + * Called during T 'n L context destruction. + */ void _tnl_array_destroy( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); diff --git a/xc/extras/Mesa/src/tnl/t_array_import.c b/xc/extras/Mesa/src/tnl/t_array_import.c index 7bcdac975..6f62aa398 100644 --- a/xc/extras/Mesa/src/tnl/t_array_import.c +++ b/xc/extras/Mesa/src/tnl/t_array_import.c @@ -1,10 +1,9 @@ -/* $Id: t_array_import.c,v 1.1.1.1 2002/10/22 13:06:18 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,13 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "state.h" #include "mtypes.h" @@ -81,7 +80,7 @@ static void _tnl_import_normal( GLcontext *ctx, stride ? 3*sizeof(GLfloat) : 0, writeable, &is_writeable); - inputs->Normal.data = (GLfloat (*)[3]) tmp->Ptr; + inputs->Normal.data = (GLfloat (*)[4]) tmp->Ptr; inputs->Normal.start = (GLfloat *) tmp->Ptr; inputs->Normal.stride = tmp->StrideB; inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); @@ -143,7 +142,7 @@ static void _tnl_import_fogcoord( GLcontext *ctx, stride ? sizeof(GLfloat) : 0, writeable, &is_writeable); - inputs->FogCoord.data = (GLfloat *) tmp->Ptr; + inputs->FogCoord.data = (GLfloat (*)[4]) tmp->Ptr; inputs->FogCoord.start = (GLfloat *) tmp->Ptr; inputs->FogCoord.stride = tmp->StrideB; inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); @@ -177,7 +176,7 @@ static void _tnl_import_index( GLcontext *ctx, static void _tnl_import_texcoord( GLcontext *ctx, - GLuint i, + GLuint unit, GLboolean writeable, GLboolean stride ) { @@ -185,21 +184,21 @@ static void _tnl_import_texcoord( GLcontext *ctx, struct gl_client_array *tmp; GLboolean is_writeable = 0; - tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, - stride ? 4*sizeof(GLfloat) : 0, + tmp = _ac_import_texcoord(ctx, unit, GL_FLOAT, + stride ? 4 * sizeof(GLfloat) : 0, 0, writeable, &is_writeable); - inputs->TexCoord[i].data = (GLfloat (*)[4]) tmp->Ptr; - inputs->TexCoord[i].start = (GLfloat *) tmp->Ptr; - inputs->TexCoord[i].stride = tmp->StrideB; - inputs->TexCoord[i].size = tmp->Size; - inputs->TexCoord[i].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); - if (inputs->TexCoord[i].stride != 4*sizeof(GLfloat)) - inputs->TexCoord[i].flags |= VEC_BAD_STRIDE; + inputs->TexCoord[unit].data = (GLfloat (*)[4]) tmp->Ptr; + inputs->TexCoord[unit].start = (GLfloat *) tmp->Ptr; + inputs->TexCoord[unit].stride = tmp->StrideB; + inputs->TexCoord[unit].size = tmp->Size; + inputs->TexCoord[unit].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (inputs->TexCoord[unit].stride != 4*sizeof(GLfloat)) + inputs->TexCoord[unit].flags |= VEC_BAD_STRIDE; if (!is_writeable) - inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE; + inputs->TexCoord[unit].flags |= VEC_NOT_WRITEABLE; } @@ -228,9 +227,40 @@ static void _tnl_import_edgeflag( GLcontext *ctx, -/* Callback for VB stages that need to improve the quality of arrays +static void _tnl_import_attrib( GLcontext *ctx, + GLuint index, + GLboolean writeable, + GLboolean stride ) +{ + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + + tmp = _ac_import_attrib(ctx, index, GL_FLOAT, + stride ? 4 * sizeof(GLfloat) : 0, + 4, /* want GLfloat[4] */ + writeable, + &is_writeable); + + inputs->Attribs[index].data = (GLfloat (*)[4]) tmp->Ptr; + inputs->Attribs[index].start = (GLfloat *) tmp->Ptr; + inputs->Attribs[index].stride = tmp->StrideB; + inputs->Attribs[index].size = tmp->Size; + inputs->Attribs[index].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (inputs->Attribs[index].stride != 4 * sizeof(GLfloat)) + inputs->Attribs[index].flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->Attribs[index].flags |= VEC_NOT_WRITEABLE; +} + + + +/** + * Callback for VB stages that need to improve the quality of arrays * bound to the VB. This is only necessary for client arrays which * have not been transformed at any point in the pipeline. + * \param required - bitmask of VERT_*_BIT flags + * \param flags - bitmask of VEC_* flags (ex: VEC_NOT_WRITABLE) */ static void _tnl_upgrade_client_data( GLcontext *ctx, GLuint required, @@ -246,56 +276,58 @@ static void _tnl_upgrade_client_data( GLcontext *ctx, if (writeable || stride) ca_flags |= CA_CLIENT_DATA; - if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) - required |= VERT_OBJ; + if ((required & VERT_BIT_CLIP) && VB->ClipPtr == VB->ObjPtr) + required |= VERT_BIT_POS; /* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */ - if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) { + if ((required & VERT_BIT_POS) && (VB->ObjPtr->flags & flags)) { ASSERT(VB->ObjPtr == &inputs->Obj); _tnl_import_vertex( ctx, writeable, stride ); - VB->importable_data &= ~(VERT_OBJ|VERT_CLIP); + VB->importable_data &= ~(VERT_BIT_POS|VERT_BIT_CLIP); } - if ((required & VERT_NORM) && (VB->NormalPtr->flags & flags)) { + if ((required & VERT_BIT_NORMAL) && (VB->NormalPtr->flags & flags)) { ASSERT(VB->NormalPtr == &inputs->Normal); _tnl_import_normal( ctx, writeable, stride ); - VB->importable_data &= ~VERT_NORM; + VB->importable_data &= ~VERT_BIT_NORMAL; } - if ((required & VERT_RGBA) && (VB->ColorPtr[0]->Flags & ca_flags)) { + if ((required & VERT_BIT_COLOR0) && (VB->ColorPtr[0]->Flags & ca_flags)) { ASSERT(VB->ColorPtr[0] == &inputs->Color); _tnl_import_color( ctx, GL_FLOAT, writeable, stride ); - VB->importable_data &= ~VERT_RGBA; + VB->importable_data &= ~VERT_BIT_COLOR0; } - if ((required & VERT_SPEC_RGB) && + if ((required & VERT_BIT_COLOR1) && (VB->SecondaryColorPtr[0]->Flags & ca_flags)) { ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor); _tnl_import_secondarycolor( ctx, GL_FLOAT, writeable, stride ); - VB->importable_data &= ~VERT_SPEC_RGB; + VB->importable_data &= ~VERT_BIT_COLOR1; } - if ((required & VERT_FOG_COORD) && (VB->FogCoordPtr->flags & flags)) { + if ((required & VERT_BIT_FOG) + && (VB->FogCoordPtr->flags & flags)) { ASSERT(VB->FogCoordPtr == &inputs->FogCoord); _tnl_import_fogcoord( ctx, writeable, stride ); - VB->importable_data &= ~VERT_FOG_COORD; + VB->importable_data &= ~VERT_BIT_FOG; } - if ((required & VERT_INDEX) && (VB->IndexPtr[0]->flags & flags)) { + if ((required & VERT_BIT_INDEX) && (VB->IndexPtr[0]->flags & flags)) { ASSERT(VB->IndexPtr[0] == &inputs->Index); _tnl_import_index( ctx, writeable, stride ); - VB->importable_data &= ~VERT_INDEX; + VB->importable_data &= ~VERT_BIT_INDEX; } - if (required & VERT_TEX_ANY) + if (required & VERT_BITS_TEX_ANY) for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) - if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { + if ((required & VERT_BIT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]); _tnl_import_texcoord( ctx, i, writeable, stride ); - VB->importable_data &= ~VERT_TEX(i); + VB->importable_data &= ~VERT_BIT_TEX(i); } + /* XXX not sure what to do here for vertex program arrays */ } @@ -306,24 +338,23 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) struct vertex_buffer *VB = &tnl->vb; GLuint inputs = tnl->pipeline.inputs; struct vertex_arrays *tmp = &tnl->array_inputs; - GLuint i; -/* fprintf(stderr, "%s %d..%d // %d..%d\n", __FUNCTION__, */ +/* _mesa_debug(ctx, "%s %d..%d // %d..%d\n", __FUNCTION__, */ /* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */ /* _tnl_print_vert_flags(" inputs", inputs); */ /* _tnl_print_vert_flags(" _Enabled", ctx->Array._Enabled); */ -/* _tnl_print_vert_flags(" importable", inputs & VERT_FIXUP); */ +/* _tnl_print_vert_flags(" importable", inputs & VERT_BITS_FIXUP); */ VB->Count = count - start; VB->FirstClipped = VB->Count; - VB->Elts = 0; - VB->MaterialMask = 0; - VB->Material = 0; - VB->Flag = 0; + VB->Elts = NULL; + VB->MaterialMask = NULL; + VB->Material = NULL; + VB->Flag = NULL; VB->Primitive = tnl->tmp_primitive; VB->PrimitiveLength = tnl->tmp_primitive_length; VB->import_data = _tnl_upgrade_client_data; - VB->importable_data = inputs & VERT_FIXUP; + VB->importable_data = inputs & VERT_BITS_FIXUP; if (ctx->Array.LockCount) { ASSERT(start == (GLint) ctx->Array.LockFirst); @@ -332,59 +363,69 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) _ac_import_range( ctx, start, count ); - if (inputs & VERT_OBJ) { + if (inputs & VERT_BIT_POS) { _tnl_import_vertex( ctx, 0, 0 ); tmp->Obj.count = VB->Count; VB->ObjPtr = &tmp->Obj; } - if (inputs & VERT_NORM) { + if (inputs & VERT_BIT_NORMAL) { _tnl_import_normal( ctx, 0, 0 ); tmp->Normal.count = VB->Count; VB->NormalPtr = &tmp->Normal; } - if (inputs & VERT_RGBA) { + if (inputs & VERT_BIT_COLOR0) { _tnl_import_color( ctx, 0, 0, 0 ); VB->ColorPtr[0] = &tmp->Color; VB->ColorPtr[1] = 0; } - if (inputs & VERT_TEX_ANY) { - for (i = 0; i < ctx->Const.MaxTextureUnits ; i++) { - if (inputs & VERT_TEX(i)) { - _tnl_import_texcoord( ctx, i, 0, 0 ); - tmp->TexCoord[i].count = VB->Count; - VB->TexCoordPtr[i] = &tmp->TexCoord[i]; + if (inputs & VERT_BITS_TEX_ANY) { + GLuint unit; + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (inputs & VERT_BIT_TEX(unit)) { + _tnl_import_texcoord( ctx, unit, GL_FALSE, GL_FALSE ); + tmp->TexCoord[unit].count = VB->Count; + VB->TexCoordPtr[unit] = &tmp->TexCoord[unit]; } } } - if (inputs & (VERT_INDEX|VERT_FOG_COORD|VERT_EDGE|VERT_SPEC_RGB)) { - if (inputs & VERT_INDEX) { + if (inputs & (VERT_BIT_INDEX | VERT_BIT_FOG | + VERT_BIT_EDGEFLAG | VERT_BIT_COLOR1)) { + if (inputs & VERT_BIT_INDEX) { _tnl_import_index( ctx, 0, 0 ); tmp->Index.count = VB->Count; VB->IndexPtr[0] = &tmp->Index; VB->IndexPtr[1] = 0; } - if (inputs & VERT_FOG_COORD) { + if (inputs & VERT_BIT_FOG) { _tnl_import_fogcoord( ctx, 0, 0 ); tmp->FogCoord.count = VB->Count; VB->FogCoordPtr = &tmp->FogCoord; } - if (inputs & VERT_EDGE) { + if (inputs & VERT_BIT_EDGEFLAG) { _tnl_import_edgeflag( ctx, GL_TRUE, sizeof(GLboolean) ); VB->EdgeFlag = (GLboolean *) tmp->EdgeFlag.data; } - if (inputs & VERT_SPEC_RGB) { + if (inputs & VERT_BIT_COLOR1) { _tnl_import_secondarycolor( ctx, 0, 0, 0 ); VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; VB->SecondaryColorPtr[1] = 0; } } -} - + /* XXX not 100% sure this is finished. Keith should probably inspect. */ + if (ctx->VertexProgram.Enabled) { + GLuint index; + for (index = 0; index < VERT_ATTRIB_MAX; index++) { + /* XXX check program->InputsRead to reduce work here */ + _tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE ); + VB->AttribPtr[index] = &tmp->Attribs[index]; + } + } +} diff --git a/xc/extras/Mesa/src/tnl/t_context.c b/xc/extras/Mesa/src/tnl/t_context.c index 029a22368..906953712 100644 --- a/xc/extras/Mesa/src/tnl/t_context.c +++ b/xc/extras/Mesa/src/tnl/t_context.c @@ -1,10 +1,9 @@ -/* $Id: t_context.c,v 1.1.1.1 2002/10/22 13:06:16 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 3.5 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -24,14 +23,14 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" +#include "imports.h" #include "macros.h" #include "mtypes.h" -#include "mem.h" #include "dlist.h" #include "light.h" #include "vtxfmt.h" @@ -103,7 +102,7 @@ _tnl_CreateContext( GLcontext *ctx ) _tnl_install_pipeline( ctx, _tnl_default_pipeline ); - tnl->NeedProjCoords = GL_TRUE; + tnl->NeedNdcCoords = GL_TRUE; tnl->LoopbackDListCassettes = GL_FALSE; tnl->CalcDListNormalLengths = GL_TRUE; @@ -196,7 +195,7 @@ _tnl_wakeup_exec( GLcontext *ctx ) tnl->pipeline.run_input_changes = ~0; if (ctx->Light.ColorMaterialEnabled) { - _mesa_update_color_material( ctx, ctx->Current.Color ); + _mesa_update_color_material( ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); } } @@ -216,8 +215,8 @@ void _tnl_need_projected_coords( GLcontext *ctx, GLboolean mode ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - if (tnl->NeedProjCoords != mode) { - tnl->NeedProjCoords = mode; + if (tnl->NeedNdcCoords != mode) { + tnl->NeedNdcCoords = mode; _tnl_InvalidateState( ctx, _NEW_PROJECTION ); } } diff --git a/xc/extras/Mesa/src/tnl/t_context.h b/xc/extras/Mesa/src/tnl/t_context.h index c301934f2..396406ccb 100644 --- a/xc/extras/Mesa/src/tnl/t_context.h +++ b/xc/extras/Mesa/src/tnl/t_context.h @@ -1,10 +1,9 @@ -/* $Id: t_context.h,v 1.1.1.1 2002/10/22 13:06:17 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -22,9 +21,12 @@ * 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. - * - * Author: - * Keith Whitwell <keithw@valinux.com> + */ + +/** + * \file t_context.h + * \brief TnL module datatypes and definitions. + * \author Keith Whitwell */ #ifndef _T_CONTEXT_H @@ -58,110 +60,94 @@ /* Flags to be added to the primitive enum in VB->Primitive. */ -#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */ -#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */ -#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */ -#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */ -#define PRIM_LAST 0x800 /* No more prims in the VB */ +#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */ +#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */ +#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */ +#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */ +#define PRIM_LAST 0x800 /* No more prims in the VB */ -/* Flags that describe the inputs and outputs of pipeline stages, and - * the contents of a vertex-cassette. - * - * 5 spare flags, rearrangement of eval flags can secure at least 3 - * more. +/** + * Flags that describe the inputs and outputs of pipeline stages, and + * the contents of a vertex-cassette. We reuse the VERT_BIT_* flags + * defined in mtypes.h and add a bunch of new ones. */ -#define VERT_OBJ _NEW_ARRAY_VERTEX -#define VERT_RGBA _NEW_ARRAY_COLOR -#define VERT_NORM _NEW_ARRAY_NORMAL -#define VERT_INDEX _NEW_ARRAY_INDEX -#define VERT_EDGE _NEW_ARRAY_EDGEFLAG -#define VERT_SPEC_RGB _NEW_ARRAY_SECONDARYCOLOR -#define VERT_FOG_COORD _NEW_ARRAY_FOGCOORD -#define VERT_TEX0 _NEW_ARRAY_TEXCOORD_0 -#define VERT_TEX1 _NEW_ARRAY_TEXCOORD_1 -#define VERT_TEX2 _NEW_ARRAY_TEXCOORD_2 -#define VERT_TEX3 _NEW_ARRAY_TEXCOORD_3 -#define VERT_TEX4 _NEW_ARRAY_TEXCOORD_4 -#define VERT_TEX5 _NEW_ARRAY_TEXCOORD_5 -#define VERT_TEX6 _NEW_ARRAY_TEXCOORD_6 -#define VERT_TEX7 _NEW_ARRAY_TEXCOORD_7 -#define VERT_EVAL_C1 0x8000 /* imm only */ -#define VERT_EVAL_C2 0x10000 /* imm only */ -#define VERT_EVAL_P1 0x20000 /* imm only */ -#define VERT_EVAL_P2 0x40000 /* imm only */ -#define VERT_OBJ_3 0x80000 /* imm only */ -#define VERT_OBJ_4 0x100000 /* imm only */ -#define VERT_MATERIAL 0x200000 /* imm only, but tested in vb code */ -#define VERT_ELT 0x400000 /* imm only */ -#define VERT_BEGIN 0x800000 /* imm only, but tested in vb code */ -#define VERT_END 0x1000000 /* imm only, but tested in vb code */ -#define VERT_END_VB 0x2000000 /* imm only, but tested in vb code */ -#define VERT_POINT_SIZE 0x4000000 /* vb only, could reuse a bit */ -#define VERT_EYE VERT_BEGIN /* vb only, reuse imm bit */ -#define VERT_CLIP VERT_END /* vb only, reuse imm bit*/ +/* bits 0..5 defined in mtypes.h */ +#define VERT_BIT_INDEX VERT_BIT_SIX /* a free vertex attrib bit */ +#define VERT_BIT_EDGEFLAG VERT_BIT_SEVEN /* a free vertex attrib bit */ +/* bits 8..15 defined in mtypes.h */ +#define VERT_BIT_EVAL_C1 (1 << 16) /* imm only */ +#define VERT_BIT_EVAL_C2 (1 << 17) /* imm only */ +#define VERT_BIT_EVAL_P1 (1 << 18) /* imm only */ +#define VERT_BIT_EVAL_P2 (1 << 19) /* imm only */ +#define VERT_BIT_OBJ_3 (1 << 20) /* imm only */ +#define VERT_BIT_OBJ_4 (1 << 21) /* imm only */ +#define VERT_BIT_MATERIAL (1 << 22) /* imm only, but tested in vb code */ +#define VERT_BIT_ELT (1 << 23) /* imm only */ +#define VERT_BIT_BEGIN (1 << 24) /* imm only, but tested in vb code */ +#define VERT_BIT_END (1 << 25) /* imm only, but tested in vb code */ +#define VERT_BIT_END_VB (1 << 26) /* imm only, but tested in vb code */ +#define VERT_BIT_POINT_SIZE (1 << 27) /* vb only, could reuse a bit */ +#define VERT_BIT_EYE VERT_BIT_BEGIN /* vb only, reuse imm bit */ +#define VERT_BIT_CLIP VERT_BIT_END /* vb only, reuse imm bit*/ /* Flags for IM->TexCoordSize. Enough flags for 16 units. */ -#define TEX_0_SIZE_3 (GLuint) 0x1 -#define TEX_0_SIZE_4 (GLuint) 0x1001 -#define TEX_SIZE_3(unit) (TEX_0_SIZE_3<<unit) -#define TEX_SIZE_4(unit) (TEX_0_SIZE_4<<unit) +#define TEX_0_SIZE_3 (unsigned)0x1 +#define TEX_0_SIZE_4 (unsigned)0x10001 +#define TEX_SIZE_3(unit) (TEX_0_SIZE_3 << (unit)) +#define TEX_SIZE_4(unit) (TEX_0_SIZE_4 << (unit)) /* Shorthands. */ -#define VERT_EVAL_ANY (VERT_EVAL_C1|VERT_EVAL_P1| \ - VERT_EVAL_C2|VERT_EVAL_P2) - -#define VERT_OBJ_23 (VERT_OBJ_3|VERT_OBJ) -#define VERT_OBJ_234 (VERT_OBJ_4|VERT_OBJ_23) - -#define VERT_TEX0_SHIFT 11 - -#define VERT_TEX(i) (VERT_TEX0 << i) - -#define VERT_TEX_ANY (VERT_TEX0 | \ - VERT_TEX1 | \ - VERT_TEX2 | \ - VERT_TEX3 | \ - VERT_TEX4 | \ - VERT_TEX5 | \ - VERT_TEX6 | \ - VERT_TEX7) - -#define VERT_FIXUP (VERT_TEX_ANY | \ - VERT_RGBA | \ - VERT_SPEC_RGB | \ - VERT_FOG_COORD | \ - VERT_INDEX | \ - VERT_EDGE | \ - VERT_NORM) - -#define VERT_CURRENT_DATA (VERT_FIXUP | \ - VERT_MATERIAL) - -#define VERT_DATA (VERT_TEX_ANY | \ - VERT_RGBA | \ - VERT_SPEC_RGB | \ - VERT_FOG_COORD | \ - VERT_INDEX | \ - VERT_EDGE | \ - VERT_NORM | \ - VERT_OBJ | \ - VERT_MATERIAL | \ - VERT_ELT | \ - VERT_EVAL_ANY) - - -/* KW: Represents everything that can take place between a begin and +#define VERT_BITS_OBJ_23 (VERT_BIT_POS | VERT_BIT_OBJ_3) +#define VERT_BITS_OBJ_234 (VERT_BIT_POS | VERT_BIT_OBJ_3 | VERT_BIT_OBJ_4) + +#define VERT_BITS_TEX_ANY (VERT_BIT_TEX0 | \ + VERT_BIT_TEX1 | \ + VERT_BIT_TEX2 | \ + VERT_BIT_TEX3 | \ + VERT_BIT_TEX4 | \ + VERT_BIT_TEX5 | \ + VERT_BIT_TEX6 | \ + VERT_BIT_TEX7) + +#define VERT_BITS_EVAL_ANY (VERT_BIT_EVAL_C1 | VERT_BIT_EVAL_P1 | \ + VERT_BIT_EVAL_C2 | VERT_BIT_EVAL_P2) + +#define VERT_BITS_FIXUP (VERT_BITS_TEX_ANY | \ + VERT_BIT_COLOR0 | \ + VERT_BIT_COLOR1 | \ + VERT_BIT_FOG | \ + VERT_BIT_INDEX | \ + VERT_BIT_EDGEFLAG | \ + VERT_BIT_NORMAL) + +#define VERT_BITS_CURRENT_DATA (VERT_BITS_FIXUP | \ + VERT_BIT_MATERIAL) + +#define VERT_BITS_DATA (VERT_BITS_TEX_ANY | \ + VERT_BIT_COLOR0 | \ + VERT_BIT_COLOR1 | \ + VERT_BIT_FOG | \ + VERT_BIT_INDEX | \ + VERT_BIT_EDGEFLAG | \ + VERT_BIT_NORMAL | \ + VERT_BIT_POS | \ + VERT_BIT_MATERIAL | \ + VERT_BIT_ELT | \ + VERT_BITS_EVAL_ANY) + + +/** + * KW: Represents everything that can take place between a begin and * end, and can represent multiple begin/end pairs. Can be used to * losslessly encode this information in display lists. */ struct immediate { - struct __GLcontextRec *backref; GLuint id, ref_count; /* This must be saved when immediates are shared in display lists. @@ -200,41 +186,44 @@ struct immediate GLuint MaterialOrMask; GLuint MaterialAndMask; - GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4]; - - GLuint Primitive[IMM_SIZE]; /* BEGIN/END */ + GLuint Primitive[IMM_SIZE]; /* BEGIN/END */ GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */ - GLuint Flag[IMM_SIZE]; /* VERT_* flags */ - GLfloat Color[IMM_SIZE][4]; - GLfloat Obj[IMM_SIZE][4]; - GLfloat Normal[IMM_SIZE][3]; - GLfloat *NormalLengthPtr; - GLfloat TexCoord0[IMM_SIZE][4]; /* just VERT_TEX0 */ + GLuint Flag[IMM_SIZE]; /* VERT_BIT_* flags */ + + /* All vertex attributes (position, normal, color, secondary color, + * texcoords, fog coord) are stored in the Attrib[] arrays instead + * of individual arrays as we did prior to Mesa 4.1. + * + * XXX may need to use 32-byte aligned allocation for this!!! + */ + GLfloat Attrib[VERT_ATTRIB_MAX][IMM_SIZE][4]; /* GL_NV_vertex_program */ + + GLfloat *NormalLengthPtr; /* length of normal vectors (display list only) */ + GLuint Elt[IMM_SIZE]; GLubyte EdgeFlag[IMM_SIZE]; GLuint Index[IMM_SIZE]; - GLfloat SecondaryColor[IMM_SIZE][4]; - GLfloat FogCoord[IMM_SIZE]; }; struct vertex_arrays { + /* XXX move a bunch of these fields into the Attribs[] array??? */ GLvector4f Obj; - GLvector3f Normal; + GLvector4f Normal; struct gl_client_array Color; struct gl_client_array SecondaryColor; GLvector1ui Index; GLvector1ub EdgeFlag; GLvector4f TexCoord[MAX_TEXTURE_UNITS]; GLvector1ui Elt; - GLvector1f FogCoord; + GLvector4f FogCoord; + GLvector4f Attribs[VERT_ATTRIB_MAX]; }; -typedef struct gl_material GLmaterial; - -/* Contains the current state of a running pipeline. +/** + * Contains the current state of a running pipeline. */ typedef struct vertex_buffer { @@ -244,34 +233,36 @@ typedef struct vertex_buffer /* Constant over the pipeline. */ - GLuint Count; /* for everything except Elts */ - GLuint FirstClipped; /* temp verts for clipping */ - GLuint FirstPrimitive; /* usually zero */ + GLuint Count; /* for everything except Elts */ + GLuint FirstClipped; /* temp verts for clipping */ + GLuint FirstPrimitive; /* usually zero */ /* Pointers to current data. */ - GLuint *Elts; /* VERT_ELT */ - GLvector4f *ObjPtr; /* VERT_OBJ */ - GLvector4f *EyePtr; /* VERT_EYE */ - GLvector4f *ClipPtr; /* VERT_CLIP */ - GLvector4f *ProjectedClipPtr; /* VERT_CLIP (2) */ - GLubyte ClipOrMask; /* VERT_CLIP (3) */ - GLubyte *ClipMask; /* VERT_CLIP (4) */ - GLvector3f *NormalPtr; /* VERT_NORM */ - GLfloat *NormalLengthPtr; /* VERT_NORM */ - GLboolean *EdgeFlag; /* VERT_EDGE */ + GLuint *Elts; /* VERT_BIT_ELT */ + GLvector4f *ObjPtr; /* VERT_BIT_POS */ + GLvector4f *EyePtr; /* VERT_BIT_EYE */ + GLvector4f *ClipPtr; /* VERT_BIT_CLIP */ + GLvector4f *NdcPtr; /* VERT_BIT_CLIP (2) */ + GLubyte ClipOrMask; /* VERT_BIT_CLIP (3) */ + GLubyte *ClipMask; /* VERT_BIT_CLIP (4) */ + GLvector4f *NormalPtr; /* VERT_BIT_NORMAL */ + GLfloat *NormalLengthPtr; /* VERT_BIT_NORMAL */ + GLboolean *EdgeFlag; /* VERT_BIT_EDGEFLAG */ GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */ - GLvector1ui *IndexPtr[2]; /* VERT_INDEX */ - struct gl_client_array *ColorPtr[2]; /* VERT_RGBA */ - struct gl_client_array *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */ - GLvector1f *FogCoordPtr; /* VERT_FOG_COORD */ - GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */ - GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */ - GLuint *MaterialMask; /* VERT_MATERIAL, optional */ - GLuint *Flag; /* VERT_* flags, optional */ - GLuint *Primitive; /* GL_(mode)|PRIM_* flags */ - GLuint *PrimitiveLength; /* integers */ - + GLvector1ui *IndexPtr[2]; /* VERT_BIT_INDEX */ + struct gl_client_array *ColorPtr[2]; /* VERT_BIT_COLOR0 */ + struct gl_client_array *SecondaryColorPtr[2];/* VERT_BIT_COLOR1 */ + GLvector4f *PointSizePtr; /* VERT_BIT_POINT_SIZE */ + GLvector4f *FogCoordPtr; /* VERT_BIT_FOG */ + struct gl_material (*Material)[2]; /* VERT_BIT_MATERIAL, optional */ + GLuint *MaterialMask; /* VERT_BIT_MATERIAL, optional */ + GLuint *Flag; /* VERT_BIT_* flags, optional */ + GLuint *Primitive; /* GL_(mode)|PRIM_* flags */ + GLuint *PrimitiveLength; /* integers */ + + /* Inputs to the vertex program stage */ + GLvector4f *AttribPtr[VERT_ATTRIB_MAX]; /* GL_NV_vertex_program */ GLuint importable_data; void *import_source; @@ -360,6 +351,8 @@ struct gl_pipeline { struct tnl_eval_store { GLuint EvalMap1Flags; GLuint EvalMap2Flags; + GLuint EvalMap1AttribFlags; /* GL_NV_vertex_program */ + GLuint EvalMap2AttribFlags; /* GL_NV_vertex_program */ GLuint EvalNewState; struct immediate *im; /* used for temporary data */ }; @@ -538,7 +531,7 @@ typedef struct { /* Probably need a better configuration mechanism: */ - GLboolean NeedProjCoords; + GLboolean NeedNdcCoords; GLboolean LoopbackDListCassettes; GLboolean CalcDListNormalLengths; GLboolean IsolateMaterials; diff --git a/xc/extras/Mesa/src/tnl/t_eval_api.c b/xc/extras/Mesa/src/tnl/t_eval_api.c index 5bd3880df..cd38d92d3 100644 --- a/xc/extras/Mesa/src/tnl/t_eval_api.c +++ b/xc/extras/Mesa/src/tnl/t_eval_api.c @@ -1,8 +1,7 @@ -/* $Id: t_eval_api.c,v 1.1.1.1 2002/10/22 13:06:21 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -22,6 +21,10 @@ * 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. + * + * Authors: + * Keith Whitwell - original code + * Brian Paul - vertex program updates */ @@ -29,7 +32,7 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "math/m_eval.h" @@ -40,9 +43,6 @@ #include "t_imm_exec.h" - - - /* KW: If are compiling, we don't know whether eval will produce a * vertex when it is run in the future. If this is pure immediate * mode, eval is a noop if neither vertex map is enabled. @@ -61,7 +61,8 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) GLenum prim; ASSERT_OUTSIDE_BEGIN_END(ctx); -/* fprintf(stderr, "%s\n", __FUNCTION__); */ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glEvalMesh1()"); switch (mode) { case GL_POINT: @@ -77,7 +78,8 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) /* No effect if vertex maps disabled. */ - if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3) + if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3 && + (!ctx->VertexProgram.Enabled || !ctx->Eval.Map1Attrib[VERT_ATTRIB_POS])) return; du = ctx->Eval.MapGrid1du; @@ -108,10 +110,10 @@ _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) tnl->Driver.NotifyBegin = 0; if (compiling) { - struct immediate *IM = _tnl_alloc_immediate( ctx ); + struct immediate *tmp = _tnl_alloc_immediate( ctx ); FLUSH_VERTICES( ctx, 0 ); - SET_IMMEDIATE( ctx, IM ); - IM->ref_count++; + SET_IMMEDIATE( ctx, tmp ); + TNL_CURRENT_IM(ctx)->ref_count++; ctx->CompileFlag = GL_FALSE; } @@ -146,14 +148,15 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) GLfloat u, du, v, dv, v1, u1; ASSERT_OUTSIDE_BEGIN_END(ctx); -/* fprintf(stderr, "%s\n", __FUNCTION__); */ + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glEvalMesh2()"); /* No effect if vertex maps disabled. */ - if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) + if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3 && + (!ctx->VertexProgram.Enabled || !ctx->Eval.Map2Attrib[VERT_ATTRIB_POS])) return; - du = ctx->Eval.MapGrid2du; dv = ctx->Eval.MapGrid2dv; v1 = ctx->Eval.MapGrid2v1 + j1 * dv; @@ -173,10 +176,10 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) tnl->Driver.NotifyBegin = 0; if (compiling) { - struct immediate *IM = _tnl_alloc_immediate( ctx ); + struct immediate *tmp = _tnl_alloc_immediate( ctx ); FLUSH_VERTICES( ctx, 0 ); - SET_IMMEDIATE( ctx, IM ); - IM->ref_count++; + SET_IMMEDIATE( ctx, tmp ); + TNL_CURRENT_IM(ctx)->ref_count++; ctx->CompileFlag = GL_FALSE; } @@ -236,7 +239,6 @@ _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) } - void _tnl_eval_init( GLcontext *ctx ) { GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); diff --git a/xc/extras/Mesa/src/tnl/t_imm_alloc.c b/xc/extras/Mesa/src/tnl/t_imm_alloc.c index 0cee83712..65d5a752d 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_alloc.c +++ b/xc/extras/Mesa/src/tnl/t_imm_alloc.c @@ -1,8 +1,7 @@ -/* $Id: t_imm_alloc.c,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,11 +23,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" -#include "mem.h" +#include "imports.h" #include "mtypes.h" #include "t_imm_alloc.h" @@ -38,8 +37,7 @@ static int id = 0; /* give each struct immediate a unique ID number */ static struct immediate *real_alloc_immediate( GLcontext *ctx ) { - struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 ); - GLuint j; + struct immediate *IM = ALIGN_CALLOC_STRUCT( immediate, 32 ); if (!IM) return 0; @@ -48,7 +46,6 @@ static struct immediate *real_alloc_immediate( GLcontext *ctx ) IM->id = id++; IM->ref_count = 0; - IM->backref = ctx; IM->FlushElt = 0; IM->LastPrimitive = IMM_MAX_COPIED_VERTS; IM->Count = IMM_MAX_COPIED_VERTS; @@ -62,23 +59,6 @@ static struct immediate *real_alloc_immediate( GLcontext *ctx ) IM->CopyTexSize = 0; IM->CopyStart = IM->Start; - - /* TexCoord0 is special. - */ - IM->TexCoord[0] = IM->TexCoord0; - - for (j = 1; j < ctx->Const.MaxTextureUnits; j++) { - IM->TexCoord[j] = (GLfloat (*)[4]) - ALIGN_MALLOC( IMM_SIZE * sizeof(GLfloat) * 4, 32 ); - } - - /* KW: Removed initialization of normals as these are now treated - * identically to all other data types. - */ - - MEMSET(IM->Flag, 0, sizeof(IM->Flag)); - MEMSET(IM->Normal, 0.0 , sizeof(IM->Normal)); - return IM; } @@ -86,7 +66,6 @@ static struct immediate *real_alloc_immediate( GLcontext *ctx ) static void real_free_immediate( struct immediate *IM ) { static int freed = 0; - GLuint j; if (IM->Material) { FREE( IM->Material ); @@ -95,9 +74,6 @@ static void real_free_immediate( struct immediate *IM ) IM->MaterialMask = 0; } - for (j = 1; j < IM->MaxTextureUnits; j++) - ALIGN_FREE( IM->TexCoord[j] ); - if (IM->NormalLengthPtr) ALIGN_FREE( IM->NormalLengthPtr ); diff --git a/xc/extras/Mesa/src/tnl/t_imm_alloc.h b/xc/extras/Mesa/src/tnl/t_imm_alloc.h index e560dcc4d..502be3fe9 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_alloc.h +++ b/xc/extras/Mesa/src/tnl/t_imm_alloc.h @@ -1,10 +1,9 @@ -/* $Id: t_imm_alloc.h,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 3.5 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), diff --git a/xc/extras/Mesa/src/tnl/t_imm_api.c b/xc/extras/Mesa/src/tnl/t_imm_api.c index b9a956ce5..9e073f162 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_api.c +++ b/xc/extras/Mesa/src/tnl/t_imm_api.c @@ -1,8 +1,7 @@ -/* $Id: t_imm_api.c,v 1.1.1.1 2002/10/22 13:06:24 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -34,10 +33,11 @@ #include "dlist.h" #include "enums.h" #include "light.h" -#include "mem.h" +#include "imports.h" #include "state.h" #include "colormac.h" #include "macros.h" +#include "vtxfmt.h" #include "t_context.h" #include "t_imm_api.h" @@ -48,13 +48,19 @@ /* A cassette is full or flushed on a statechange. */ -void _tnl_flush_immediate( struct immediate *IM ) +void _tnl_flush_immediate( GLcontext *ctx, struct immediate *IM ) { - GLcontext *ctx = IM->backref; + if (!ctx) { + /* We were called by glVertex, glEvalCoord, glArrayElement, etc. + * The current context is corresponds to the IM structure. + */ + GET_CURRENT_CONTEXT(context); + ctx = context; + } if (MESA_VERBOSE & VERBOSE_IMMEDIATE) - fprintf(stderr, "_tnl_flush_immediate IM: %d compiling: %d\n", - IM->id, ctx->CompileFlag); + _mesa_debug(ctx, "_tnl_flush_immediate IM: %d compiling: %d\n", + IM->id, ctx->CompileFlag); if (IM->FlushElt == FLUSH_ELT_EAGER) { _tnl_translate_array_elts( ctx, IM, IM->LastPrimitive, IM->Count ); @@ -79,21 +85,21 @@ void _tnl_flush_vertices( GLcontext *ctx, GLuint flags ) struct immediate *IM = TNL_CURRENT_IM(ctx); if (MESA_VERBOSE & VERBOSE_IMMEDIATE) - fprintf( stderr, - "_tnl_flush_vertices flags %x IM(%d) %d..%d Flag[%d]: %x\n", - flags, IM->id, IM->Start, IM->Count, IM->Start, - IM->Flag[IM->Start]); + _mesa_debug(ctx, + "_tnl_flush_vertices flags %x IM(%d) %d..%d Flag[%d]: %x\n", + flags, IM->id, IM->Start, IM->Count, IM->Start, + IM->Flag[IM->Start]); - if (IM->Flag[IM->Start]) + if (IM->Flag[IM->Start]) { if ((flags & FLUSH_UPDATE_CURRENT) || IM->Count > IM->Start || - (IM->Flag[IM->Start] & (VERT_BEGIN|VERT_END))) - _tnl_flush_immediate( IM ); + (IM->Flag[IM->Start] & (VERT_BIT_BEGIN | VERT_BIT_END))) { + _tnl_flush_immediate( ctx, IM ); + } + } } - - void _tnl_save_Begin( GLenum mode ) { @@ -101,7 +107,7 @@ _tnl_save_Begin( GLenum mode ) struct immediate *IM = TNL_CURRENT_IM(ctx); GLuint inflags, state; -/* fprintf(stderr, "%s: before: %x\n", __FUNCTION__, IM->BeginState); */ +/* _mesa_debug(ctx, "%s: before: %x\n", __FUNCTION__, IM->BeginState); */ if (mode > GL_POLYGON) { _mesa_compile_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" ); @@ -111,10 +117,19 @@ _tnl_save_Begin( GLenum mode ) if (ctx->NewState) _mesa_update_state(ctx); +#if 000 + /* if only a very few slots left, might as well flush now + */ + if (IM->Count > IMM_MAXDATA-8) { + _tnl_flush_immediate( ctx, IM ); + IM = TNL_CURRENT_IM(ctx); + } +#endif + /* Check for and flush buffered vertices from internal operations. */ if (IM->SavedBeginState) { - _tnl_flush_immediate( IM ); + _tnl_flush_immediate( ctx, IM ); IM = TNL_CURRENT_IM(ctx); IM->BeginState = IM->SavedBeginState; IM->SavedBeginState = 0; @@ -130,7 +145,7 @@ _tnl_save_Begin( GLenum mode ) GLuint last = IM->LastPrimitive; state |= (VERT_BEGIN_0|VERT_BEGIN_1); - IM->Flag[count] |= VERT_BEGIN; + IM->Flag[count] |= VERT_BIT_BEGIN; IM->Primitive[count] = mode | PRIM_BEGIN; IM->PrimitiveLength[IM->LastPrimitive] = count - IM->LastPrimitive; IM->LastPrimitive = count; @@ -166,7 +181,7 @@ _tnl_Begin( GLenum mode ) ASSERT (!ctx->CompileFlag); if (mode > GL_POLYGON) { - _mesa_error( ctx, GL_INVALID_ENUM, "_tnl_Begin" ); + _mesa_error( ctx, GL_INVALID_ENUM, "_tnl_Begin(0x%x)", mode ); return; } @@ -189,8 +204,8 @@ _tnl_Begin( GLenum mode ) return; } - assert( IM->SavedBeginState == 0 ); - assert( IM->BeginState == 0 ); + assert( (IM->SavedBeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) == 0 ); + assert( (IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) == 0 ); /* Not quite right. Need to use the fallback '_aa_ArrayElement' * when not known to be inside begin/end and arrays are @@ -200,12 +215,14 @@ _tnl_Begin( GLenum mode ) _tnl_translate_array_elts( ctx, IM, last, count ); } - IM->Flag[count] |= VERT_BEGIN; + IM->Flag[count] |= VERT_BIT_BEGIN; IM->Primitive[count] = mode | PRIM_BEGIN; IM->PrimitiveLength[last] = count - last; IM->LastPrimitive = count; IM->BeginState = (VERT_BEGIN_0|VERT_BEGIN_1); +/* _mesa_debug(ctx, "%s: %x\n", __FUNCTION__, IM->BeginState); */ + ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; ctx->Driver.CurrentExecPrimitive = mode; } @@ -219,12 +236,12 @@ _tnl_Begin( GLenum mode ) GLboolean _tnl_hard_begin( GLcontext *ctx, GLenum p ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ +/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ if (!ctx->CompileFlag) { /* If not compiling, treat as a normal begin(). */ -/* fprintf(stderr, "%s: treating as glBegin\n", __FUNCTION__); */ +/* _mesa_debug(ctx, "%s: treating as glBegin\n", __FUNCTION__); */ glBegin( p ); return GL_TRUE; } @@ -239,7 +256,7 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) _mesa_update_state(ctx); if (IM->Count > IMM_MAXDATA-8) { - _tnl_flush_immediate( IM ); + _tnl_flush_immediate( ctx, IM ); IM = TNL_CURRENT_IM(ctx); } @@ -278,7 +295,7 @@ _tnl_hard_begin( GLcontext *ctx, GLenum p ) ASSERT (IM->FlushElt != FLUSH_ELT_EAGER); IM->BeginState |= VERT_BEGIN_0|VERT_BEGIN_1; - IM->Flag[IM->Count] |= VERT_BEGIN; + IM->Flag[IM->Count] |= VERT_BIT_BEGIN; IM->Primitive[IM->Count] = p | PRIM_BEGIN; IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive; IM->LastPrimitive = IM->Count; @@ -314,7 +331,10 @@ _tnl_end( GLcontext *ctx ) GLuint state = IM->BeginState; GLuint inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1); - assert( ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES ); + /* Not the case if vertices emitted without calling glBegin first: + */ +/* assert( ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES ); */ + state |= inflags << 2; /* errors */ @@ -324,7 +344,7 @@ _tnl_end( GLcontext *ctx ) GLuint last = IM->LastPrimitive; state &= ~(VERT_BEGIN_0|VERT_BEGIN_1); /* update state */ - IM->Flag[count] |= VERT_END; + IM->Flag[count] |= VERT_BIT_END; IM->Primitive[last] |= PRIM_END; IM->PrimitiveLength[last] = count - last; IM->Primitive[count] = PRIM_OUTSIDE_BEGIN_END; /* removes PRIM_BEGIN @@ -339,10 +359,6 @@ _tnl_end( GLcontext *ctx ) IM->BeginState = state; - /* Only update CurrentExecPrimitive if not compiling. If we are in - * COMPILE_AND_EXECUTE mode, it will be done on replay of this - * cassette. - */ if (!ctx->CompileFlag) { if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) _mesa_error( ctx, GL_INVALID_OPERATION, "_tnl_End" ); @@ -354,13 +370,14 @@ _tnl_end( GLcontext *ctx ) * behaviour. */ if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) - _tnl_flush_immediate( IM ); + _tnl_flush_immediate( ctx, IM ); } -static void +void _tnl_End(void) { GET_CURRENT_CONTEXT(ctx); + _tnl_end( ctx ); /* Need to keep save primitive uptodate in COMPILE and @@ -372,29 +389,28 @@ _tnl_End(void) } -#define COLOR( IM, r, g, b, a ) \ -{ \ - GLuint count = IM->Count; \ - IM->Flag[count] |= VERT_RGBA; \ - IM->Color[count][0] = r; \ - IM->Color[count][1] = g; \ - IM->Color[count][2] = b; \ - IM->Color[count][3] = a; \ +#define COLOR( r, g, b, a ) \ +{ \ + GET_IMMEDIATE; \ + GLuint count = IM->Count; \ + GLfloat *color = IM->Attrib[VERT_ATTRIB_COLOR0][count]; \ + IM->Flag[count] |= VERT_BIT_COLOR0; \ + color[0] = r; \ + color[1] = g; \ + color[2] = b; \ + color[3] = a; \ } static void _tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue ) { - GET_IMMEDIATE; - COLOR( IM, red, green, blue, 1.0 ); + COLOR( red, green, blue, 1.0 ); } static void _tnl_Color3ub( GLubyte red, GLubyte green, GLubyte blue ) { - GET_IMMEDIATE; - COLOR(IM, - UBYTE_TO_FLOAT(red), + COLOR(UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), UBYTE_TO_FLOAT(blue), 1.0); @@ -403,16 +419,13 @@ _tnl_Color3ub( GLubyte red, GLubyte green, GLubyte blue ) static void _tnl_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { - GET_IMMEDIATE; - COLOR( IM, red, green, blue, alpha ); + COLOR( red, green, blue, alpha ); } static void _tnl_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { - GET_IMMEDIATE; - COLOR(IM, - UBYTE_TO_FLOAT(red), + COLOR(UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), UBYTE_TO_FLOAT(blue), UBYTE_TO_FLOAT(alpha)); @@ -421,16 +434,13 @@ _tnl_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) static void _tnl_Color3fv( const GLfloat *v ) { - GET_IMMEDIATE; - COLOR( IM, v[0], v[1], v[2], 1.0 ); + COLOR( v[0], v[1], v[2], 1.0 ); } static void _tnl_Color3ubv( const GLubyte *v ) { - GET_IMMEDIATE; - COLOR(IM, - UBYTE_TO_FLOAT(v[0]), + COLOR(UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), 1.0 ); @@ -439,16 +449,13 @@ _tnl_Color3ubv( const GLubyte *v ) static void _tnl_Color4fv( const GLfloat *v ) { - GET_IMMEDIATE; - COLOR( IM, v[0], v[1], v[2], v[3] ); + COLOR( v[0], v[1], v[2], v[3] ); } static void _tnl_Color4ubv( const GLubyte *v) { - GET_IMMEDIATE; - COLOR(IM, - UBYTE_TO_FLOAT(v[0]), + COLOR(UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2]), UBYTE_TO_FLOAT(v[3])); @@ -457,28 +464,27 @@ _tnl_Color4ubv( const GLubyte *v) -#define SECONDARY_COLOR( IM, r, g, b ) \ -{ \ - GLuint count = IM->Count; \ - IM->Flag[count] |= VERT_SPEC_RGB; \ - IM->SecondaryColor[count][0] = r; \ - IM->SecondaryColor[count][1] = g; \ - IM->SecondaryColor[count][2] = b; \ +#define SECONDARY_COLOR( r, g, b ) \ +{ \ + GLuint count; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_BIT_COLOR1; \ + IM->Attrib[VERT_ATTRIB_COLOR1][count][0] = r; \ + IM->Attrib[VERT_ATTRIB_COLOR1][count][1] = g; \ + IM->Attrib[VERT_ATTRIB_COLOR1][count][2] = b; \ } static void _tnl_SecondaryColor3fEXT( GLfloat red, GLfloat green, GLfloat blue ) { - GET_IMMEDIATE; - SECONDARY_COLOR( IM, red, green, blue ); + SECONDARY_COLOR( red, green, blue ); } static void _tnl_SecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue ) { - GET_IMMEDIATE; - SECONDARY_COLOR(IM, - UBYTE_TO_FLOAT(red), + SECONDARY_COLOR(UBYTE_TO_FLOAT(red), UBYTE_TO_FLOAT(green), UBYTE_TO_FLOAT(blue)); } @@ -486,23 +492,18 @@ _tnl_SecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue ) static void _tnl_SecondaryColor3fvEXT( const GLfloat *v ) { - GET_IMMEDIATE; - SECONDARY_COLOR( IM, v[0], v[1], v[2] ); + SECONDARY_COLOR( v[0], v[1], v[2] ); } static void _tnl_SecondaryColor3ubvEXT( const GLubyte *v ) { - GET_IMMEDIATE; - SECONDARY_COLOR(IM, - UBYTE_TO_FLOAT(v[0]), + SECONDARY_COLOR(UBYTE_TO_FLOAT(v[0]), UBYTE_TO_FLOAT(v[1]), UBYTE_TO_FLOAT(v[2])); } - - static void _tnl_EdgeFlag( GLboolean flag ) { @@ -510,7 +511,7 @@ _tnl_EdgeFlag( GLboolean flag ) GET_IMMEDIATE; count = IM->Count; IM->EdgeFlag[count] = flag; - IM->Flag[count] |= VERT_EDGE; + IM->Flag[count] |= VERT_BIT_EDGEFLAG; } @@ -521,7 +522,7 @@ _tnl_EdgeFlagv( const GLboolean *flag ) GET_IMMEDIATE; count = IM->Count; IM->EdgeFlag[count] = *flag; - IM->Flag[count] |= VERT_EDGE; + IM->Flag[count] |= VERT_BIT_EDGEFLAG; } @@ -531,8 +532,8 @@ _tnl_FogCoordfEXT( GLfloat f ) GLuint count; GET_IMMEDIATE; count = IM->Count; - IM->FogCoord[count] = f; - IM->Flag[count] |= VERT_FOG_COORD; + IM->Attrib[VERT_ATTRIB_FOG][count][0] = f; /*FogCoord[count] = f;*/ + IM->Flag[count] |= VERT_BIT_FOG; } static void @@ -541,8 +542,8 @@ _tnl_FogCoordfvEXT( const GLfloat *v ) GLuint count; GET_IMMEDIATE; count = IM->Count; - IM->FogCoord[count] = v[0]; - IM->Flag[count] |= VERT_FOG_COORD; + IM->Attrib[VERT_ATTRIB_FOG][count][0] = v[0]; /*FogCoord[count] = v[0];*/ + IM->Flag[count] |= VERT_BIT_FOG; } @@ -553,7 +554,7 @@ _tnl_Indexi( GLint c ) GET_IMMEDIATE; count = IM->Count; IM->Index[count] = c; - IM->Flag[count] |= VERT_INDEX; + IM->Flag[count] |= VERT_BIT_INDEX; } @@ -564,19 +565,19 @@ _tnl_Indexiv( const GLint *c ) GET_IMMEDIATE; count = IM->Count; IM->Index[count] = *c; - IM->Flag[count] |= VERT_INDEX; + IM->Flag[count] |= VERT_BIT_INDEX; } -#define NORMAL( x, y, z ) \ -{ \ - GLuint count; \ - GLfloat *normal; \ - GET_IMMEDIATE; \ - count = IM->Count; \ - IM->Flag[count] |= VERT_NORM; \ - normal = IM->Normal[count]; \ - ASSIGN_3V(normal, x,y,z); \ +#define NORMAL( x, y, z ) \ +{ \ + GLuint count; \ + GLfloat *normal; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_BIT_NORMAL; \ + normal = IM->Attrib[VERT_ATTRIB_NORMAL][count]; \ + ASSIGN_3V(normal, x,y,z); \ } #if defined(USE_IEEE) @@ -586,8 +587,8 @@ _tnl_Indexiv( const GLint *c ) fi_type *normal; \ GET_IMMEDIATE; \ count = IM->Count; \ - IM->Flag[count] |= VERT_NORM; \ - normal = (fi_type *)IM->Normal[count]; \ + IM->Flag[count] |= VERT_BIT_NORMAL; \ + normal = (fi_type *)IM->Attrib[VERT_ATTRIB_NORMAL][count]; \ normal[0].i = ((fi_type *)&(x))->i; \ normal[1].i = ((fi_type *)&(y))->i; \ normal[2].i = ((fi_type *)&(z))->i; \ @@ -619,55 +620,55 @@ _tnl_Normal3fv( const GLfloat *v ) GLfloat *tc; \ GET_IMMEDIATE; \ count = IM->Count; \ - IM->Flag[count] |= VERT_TEX0; \ - tc = IM->TexCoord0[count]; \ + IM->Flag[count] |= VERT_BIT_TEX0; \ + tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ ASSIGN_4V(tc,s,0,0,1); \ } -#define TEXCOORD2(s,t) \ +#define TEXCOORD2(s, t) \ { \ GLuint count; \ GLfloat *tc; \ GET_IMMEDIATE; \ count = IM->Count; \ - IM->Flag[count] |= VERT_TEX0; \ - tc = IM->TexCoord0[count]; \ - ASSIGN_4V(tc, s,t,0,1); \ + IM->Flag[count] |= VERT_BIT_TEX0; \ + tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ + ASSIGN_4V(tc, s, t, 0, 1); \ } -#define TEXCOORD3(s,t,u) \ +#define TEXCOORD3(s, t, u) \ { \ GLuint count; \ GLfloat *tc; \ GET_IMMEDIATE; \ count = IM->Count; \ - IM->Flag[count] |= VERT_TEX0; \ - IM->TexSize |= TEX_0_SIZE_3; \ - tc = IM->TexCoord0[count]; \ - ASSIGN_4V(tc, s,t,u,1); \ + IM->Flag[count] |= VERT_BIT_TEX0; \ + IM->TexSize |= TEX_0_SIZE_3; \ + tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ + ASSIGN_4V(tc, s, t, u, 1); \ } -#define TEXCOORD4(s,t,u,v) \ +#define TEXCOORD4(s, t, u, v) \ { \ GLuint count; \ GLfloat *tc; \ GET_IMMEDIATE; \ count = IM->Count; \ - IM->Flag[count] |= VERT_TEX0; \ - IM->TexSize |= TEX_0_SIZE_4; \ - tc = IM->TexCoord0[count]; \ - ASSIGN_4V(tc, s,t,u,v); \ + IM->Flag[count] |= VERT_BIT_TEX0; \ + IM->TexSize |= TEX_0_SIZE_4; \ + tc = IM->Attrib[VERT_ATTRIB_TEX0][count]; \ + ASSIGN_4V(tc, s, t, u, v); \ } #if defined(USE_IEEE) -#define TEXCOORD2F(s,t) \ +#define TEXCOORD2F(s, t) \ { \ GLuint count; \ fi_type *tc; \ GET_IMMEDIATE; \ count = IM->Count; \ - IM->Flag[count] |= VERT_TEX0; \ - tc = (fi_type *)IM->TexCoord0[count]; \ + IM->Flag[count] |= VERT_BIT_TEX0; \ + tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0][count]; \ tc[0].i = ((fi_type *)&(s))->i; \ tc[1].i = ((fi_type *)&(t))->i; \ tc[2].i = 0; \ @@ -687,20 +688,20 @@ _tnl_TexCoord1f( GLfloat s ) static void _tnl_TexCoord2f( GLfloat s, GLfloat t ) { - TEXCOORD2F(s,t); + TEXCOORD2F(s, t); } static void _tnl_TexCoord3f( GLfloat s, GLfloat t, GLfloat r ) { - TEXCOORD3(s,t,r); + TEXCOORD3(s, t, r); } static void _tnl_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) { - TEXCOORD4(s,t,r,q) + TEXCOORD4(s, t, r, q) } static void @@ -712,19 +713,19 @@ _tnl_TexCoord1fv( const GLfloat *v ) static void _tnl_TexCoord2fv( const GLfloat *v ) { - TEXCOORD2F(v[0],v[1]); + TEXCOORD2F(v[0], v[1]); } static void _tnl_TexCoord3fv( const GLfloat *v ) { - TEXCOORD3(v[0],v[1],v[2]); + TEXCOORD3(v[0], v[1], v[2]); } static void _tnl_TexCoord4fv( const GLfloat *v ) { - TEXCOORD4(v[0],v[1],v[2],v[3]); + TEXCOORD4(v[0], v[1], v[2], v[3]); } @@ -732,86 +733,86 @@ _tnl_TexCoord4fv( const GLfloat *v ) /* KW: Run into bad problems in vertex copying if we don't fully pad * the incoming vertices. */ -#define VERTEX2(IM, x,y) \ -{ \ - GLuint count = IM->Count++; \ - GLfloat *dest = IM->Obj[count]; \ - IM->Flag[count] |= VERT_OBJ; \ - ASSIGN_4V(dest, x, y, 0, 1); \ -/* ASSERT(IM->Flag[IM->Count]==0); */\ - if (count == IMM_MAXDATA - 1) \ - _tnl_flush_immediate( IM ); \ +#define VERTEX2(IM, x,y) \ +{ \ + GLuint count = IM->Count++; \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BIT_POS; \ + ASSIGN_4V(dest, x, y, 0, 1); \ +/* ASSERT(IM->Flag[IM->Count]==0); */ \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( NULL, IM ); \ } -#define VERTEX3(IM,x,y,z) \ -{ \ - GLuint count = IM->Count++; \ - GLfloat *dest = IM->Obj[count]; \ - IM->Flag[count] |= VERT_OBJ_23; \ - ASSIGN_4V(dest, x, y, z, 1); \ +#define VERTEX3(IM,x,y,z) \ +{ \ + GLuint count = IM->Count++; \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BITS_OBJ_23; \ + ASSIGN_4V(dest, x, y, z, 1); \ /* ASSERT(IM->Flag[IM->Count]==0); */ \ - if (count == IMM_MAXDATA - 1) \ - _tnl_flush_immediate( IM ); \ -} - -#define VERTEX4(IM, x,y,z,w) \ -{ \ - GLuint count = IM->Count++; \ - GLfloat *dest = IM->Obj[count]; \ - IM->Flag[count] |= VERT_OBJ_234; \ - ASSIGN_4V(dest, x, y, z, w); \ if (count == IMM_MAXDATA - 1) \ - _tnl_flush_immediate( IM ); \ + _tnl_flush_immediate( NULL, IM ); \ } -#if defined(USE_IEEE) -#define VERTEX2F(IM, x, y) \ +#define VERTEX4(IM, x,y,z,w) \ { \ GLuint count = IM->Count++; \ - fi_type *dest = (fi_type *)IM->Obj[count]; \ - IM->Flag[count] |= VERT_OBJ; \ - dest[0].i = ((fi_type *)&(x))->i; \ - dest[1].i = ((fi_type *)&(y))->i; \ - dest[2].i = 0; \ - dest[3].i = IEEE_ONE; \ -/* ASSERT(IM->Flag[IM->Count]==0); */ \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BITS_OBJ_234; \ + ASSIGN_4V(dest, x, y, z, w); \ if (count == IMM_MAXDATA - 1) \ - _tnl_flush_immediate( IM ); \ + _tnl_flush_immediate( NULL, IM ); \ +} + +#if defined(USE_IEEE) +#define VERTEX2F(IM, x, y) \ +{ \ + GLuint count = IM->Count++; \ + fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BIT_POS; \ + dest[0].i = ((fi_type *)&(x))->i; \ + dest[1].i = ((fi_type *)&(y))->i; \ + dest[2].i = 0; \ + dest[3].i = IEEE_ONE; \ +/* ASSERT(IM->Flag[IM->Count]==0); */ \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( NULL, IM ); \ } #else #define VERTEX2F VERTEX2 #endif #if defined(USE_IEEE) -#define VERTEX3F(IM, x, y, z) \ -{ \ - GLuint count = IM->Count++; \ - fi_type *dest = (fi_type *)IM->Obj[count]; \ - IM->Flag[count] |= VERT_OBJ_23; \ - dest[0].i = ((fi_type *)&(x))->i; \ - dest[1].i = ((fi_type *)&(y))->i; \ - dest[2].i = ((fi_type *)&(z))->i; \ - dest[3].i = IEEE_ONE; \ -/* ASSERT(IM->Flag[IM->Count]==0); */ \ - if (count == IMM_MAXDATA - 1) \ - _tnl_flush_immediate( IM ); \ +#define VERTEX3F(IM, x, y, z) \ +{ \ + GLuint count = IM->Count++; \ + fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BITS_OBJ_23; \ + dest[0].i = ((fi_type *)&(x))->i; \ + dest[1].i = ((fi_type *)&(y))->i; \ + dest[2].i = ((fi_type *)&(z))->i; \ + dest[3].i = IEEE_ONE; \ +/* ASSERT(IM->Flag[IM->Count]==0); */ \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( NULL, IM ); \ } #else #define VERTEX3F VERTEX3 #endif #if defined(USE_IEEE) -#define VERTEX4F(IM, x, y, z, w) \ -{ \ - GLuint count = IM->Count++; \ - fi_type *dest = (fi_type *)IM->Obj[count]; \ - IM->Flag[count] |= VERT_OBJ_234; \ - dest[0].i = ((fi_type *)&(x))->i; \ - dest[1].i = ((fi_type *)&(y))->i; \ - dest[2].i = ((fi_type *)&(z))->i; \ - dest[3].i = ((fi_type *)&(w))->i; \ - if (count == IMM_MAXDATA - 1) \ - _tnl_flush_immediate( IM ); \ +#define VERTEX4F(IM, x, y, z, w) \ +{ \ + GLuint count = IM->Count++; \ + fi_type *dest = (fi_type *)IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BITS_OBJ_234; \ + dest[0].i = ((fi_type *)&(x))->i; \ + dest[1].i = ((fi_type *)&(y))->i; \ + dest[2].i = ((fi_type *)&(z))->i; \ + dest[3].i = ((fi_type *)&(w))->i; \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( NULL, IM ); \ } #else #define VERTEX4F VERTEX4 @@ -879,9 +880,9 @@ _tnl_Vertex4fv( const GLfloat *v ) GLuint texunit = target - GL_TEXTURE0_ARB; \ if (texunit < IM->MaxTextureUnits) { \ GLuint count = IM->Count; \ - GLfloat *tc = IM->TexCoord[texunit][count]; \ + GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ ASSIGN_4V(tc, s, 0.0F, 0.0F, 1.0F); \ - IM->Flag[count] |= VERT_TEX(texunit); \ + IM->Flag[count] |= VERT_BIT_TEX(texunit); \ } \ } @@ -891,9 +892,9 @@ _tnl_Vertex4fv( const GLfloat *v ) GLuint texunit = target - GL_TEXTURE0_ARB; \ if (texunit < IM->MaxTextureUnits) { \ GLuint count = IM->Count; \ - GLfloat *tc = IM->TexCoord[texunit][count]; \ + GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ ASSIGN_4V(tc, s, t, 0.0F, 1.0F); \ - IM->Flag[count] |= VERT_TEX(texunit); \ + IM->Flag[count] |= VERT_BIT_TEX(texunit); \ } \ } @@ -903,9 +904,9 @@ _tnl_Vertex4fv( const GLfloat *v ) GLuint texunit = target - GL_TEXTURE0_ARB; \ if (texunit < IM->MaxTextureUnits) { \ GLuint count = IM->Count; \ - GLfloat *tc = IM->TexCoord[texunit][count]; \ + GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ ASSIGN_4V(tc, s, t, u, 1.0F); \ - IM->Flag[count] |= VERT_TEX(texunit); \ + IM->Flag[count] |= VERT_BIT_TEX(texunit); \ IM->TexSize |= TEX_SIZE_3(texunit); \ } \ } @@ -916,9 +917,9 @@ _tnl_Vertex4fv( const GLfloat *v ) GLuint texunit = target - GL_TEXTURE0_ARB; \ if (texunit < IM->MaxTextureUnits) { \ GLuint count = IM->Count; \ - GLfloat *tc = IM->TexCoord[texunit][count]; \ + GLfloat *tc = IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count]; \ ASSIGN_4V(tc, s, t, u, v); \ - IM->Flag[count] |= VERT_TEX(texunit); \ + IM->Flag[count] |= VERT_BIT_TEX(texunit); \ IM->TexSize |= TEX_SIZE_4(texunit); \ } \ } @@ -930,8 +931,8 @@ _tnl_Vertex4fv( const GLfloat *v ) GLuint texunit = target - GL_TEXTURE0_ARB; \ if (texunit < IM->MaxTextureUnits) { \ GLuint count = IM->Count; \ - fi_type *tc = (fi_type *)IM->TexCoord[texunit][count]; \ - IM->Flag[count] |= VERT_TEX(texunit); \ + fi_type *tc = (fi_type *)IM->Attrib[VERT_ATTRIB_TEX0 + texunit][count];\ + IM->Flag[count] |= VERT_BIT_TEX(texunit); \ tc[0].i = ((fi_type *)&(s))->i; \ tc[1].i = ((fi_type *)&(t))->i; \ tc[2].i = 0; \ @@ -1001,37 +1002,41 @@ _tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v) #define EVALCOORD1(IM, x) \ { \ GLuint count = IM->Count++; \ - IM->Flag[count] |= VERT_EVAL_C1; \ - ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BIT_EVAL_C1; \ + ASSIGN_4V(dest, x, 0, 0, 1); \ if (count == IMM_MAXDATA-1) \ - _tnl_flush_immediate( IM ); \ + _tnl_flush_immediate( NULL, IM ); \ } #define EVALCOORD2(IM, x, y) \ { \ GLuint count = IM->Count++; \ - IM->Flag[count] |= VERT_EVAL_C2; \ - ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BIT_EVAL_C2; \ + ASSIGN_4V(dest, x, y, 0, 1); \ if (count == IMM_MAXDATA-1) \ - _tnl_flush_immediate( IM ); \ + _tnl_flush_immediate( NULL, IM ); \ } #define EVALPOINT1(IM, x) \ { \ GLuint count = IM->Count++; \ - IM->Flag[count] |= VERT_EVAL_P1; \ - ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BIT_EVAL_P1; \ + ASSIGN_4V(dest, x, 0, 0, 1); \ if (count == IMM_MAXDATA-1) \ - _tnl_flush_immediate( IM ); \ + _tnl_flush_immediate( NULL, IM ); \ } #define EVALPOINT2(IM, x, y) \ { \ GLuint count = IM->Count++; \ - IM->Flag[count] |= VERT_EVAL_P2; \ - ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ + GLfloat *dest = IM->Attrib[VERT_ATTRIB_POS][count]; \ + IM->Flag[count] |= VERT_BIT_EVAL_P2; \ + ASSIGN_4V(dest, x, y, 0, 1); \ if (count == IMM_MAXDATA-1) \ - _tnl_flush_immediate( IM ); \ + _tnl_flush_immediate( NULL, IM ); \ } static void @@ -1087,11 +1092,11 @@ _tnl_EvalPoint2( GLint i, GLint j ) GLuint count = IM->Count; \ IM->Elt[count] = i; \ IM->Flag[count] &= IM->ArrayEltFlags; \ - IM->Flag[count] |= VERT_ELT; \ + IM->Flag[count] |= VERT_BIT_ELT; \ IM->FlushElt = IM->ArrayEltFlush; \ IM->Count += IM->ArrayEltIncr; \ - if (IM->Count == IMM_MAXDATA) \ - _tnl_flush_immediate( IM ); \ + if (IM->Count == IMM_MAXDATA) \ + _tnl_flush_immediate( NULL, IM ); \ } @@ -1129,6 +1134,51 @@ _tnl_eval_coord2f( GLcontext *CC, GLfloat u, GLfloat v ) +/* + * NV_vertex_program + */ + +static void +_tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + if (index < 16) { + GET_IMMEDIATE; + const GLuint count = IM->Count; + GLfloat *attrib = IM->Attrib[index][count]; + ASSIGN_4V(attrib, x, y, z, w); + IM->Flag[count] |= (1 << index); + if (index == 0) { + IM->Count++; + if (count == IMM_MAXDATA - 1) + _tnl_flush_immediate( NULL, IM ); + } + } + else { + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribNV(index > 15)"); + } +} + +static void +_tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + if (index < 16) { + GET_IMMEDIATE; + const GLuint count = IM->Count; + GLfloat *attrib = IM->Attrib[index][count]; + COPY_4V(attrib, v); + IM->Flag[count] |= (1 << index); + if (index == 0) { + IM->Count++; + if (count == IMM_MAXDATA - 1) + _tnl_flush_immediate( NULL, IM ); + } + } + else { + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribNV(index > 15)"); + } +} /* Execute a glRectf() function. _tnl_hard_begin() ensures the check @@ -1164,20 +1214,20 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) return; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_Materialfv\n"); + _mesa_debug(ctx, "_tnl_Materialfv\n"); if (tnl->IsolateMaterials && !(IM->BeginState & VERT_BEGIN_1)) /* heuristic */ { - _tnl_flush_immediate( IM ); + _tnl_flush_immediate( ctx, IM ); IM = TNL_CURRENT_IM(ctx); count = IM->Count; } - if (!(IM->Flag[count] & VERT_MATERIAL)) { + if (!(IM->Flag[count] & VERT_BIT_MATERIAL)) { if (!IM->Material) { - IM->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) * - IMM_SIZE * 2 ); + IM->Material = (struct gl_material (*)[2]) + MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 ); IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); IM->MaterialMask[IM->LastMaterial] = 0; } @@ -1187,7 +1237,7 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) IM->MaterialOrMask & ~bitmask ); } - IM->Flag[count] |= VERT_MATERIAL; + IM->Flag[count] |= VERT_BIT_MATERIAL; IM->MaterialMask[count] = 0; IM->MaterialAndMask &= IM->MaterialMask[IM->LastMaterial]; IM->LastMaterial = count; @@ -1243,7 +1293,7 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) if (tnl->IsolateMaterials && !(IM->BeginState & VERT_BEGIN_1)) /* heuristic */ { - _tnl_flush_immediate( IM ); + _tnl_flush_immediate( ctx, IM ); } } @@ -1305,6 +1355,8 @@ void _tnl_imm_vtxfmt_init( GLcontext *ctx ) vfmt->Vertex3fv = _tnl_Vertex3fv; vfmt->Vertex4f = _tnl_Vertex4f; vfmt->Vertex4fv = _tnl_Vertex4fv; + vfmt->VertexAttrib4fNV = _tnl_VertexAttrib4fNV; + vfmt->VertexAttrib4fvNV = _tnl_VertexAttrib4fvNV; /* Outside begin/end functions (from t_varray.c, t_eval.c, ...): */ diff --git a/xc/extras/Mesa/src/tnl/t_imm_api.h b/xc/extras/Mesa/src/tnl/t_imm_api.h index 101acf651..1cb89fd4d 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_api.h +++ b/xc/extras/Mesa/src/tnl/t_imm_api.h @@ -1,8 +1,7 @@ -/* $Id: t_imm_api.h,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -35,6 +34,11 @@ extern void _tnl_save_Begin( GLenum mode ); extern void _tnl_Begin( GLenum mode ); +extern void _tnl_Begin( GLenum mode ); + +extern void _tnl_End(void); + + /* TNL-private internal functions for building higher-level operations: */ extern GLboolean _tnl_hard_begin( GLcontext *ctx, GLenum p ); diff --git a/xc/extras/Mesa/src/tnl/t_imm_debug.c b/xc/extras/Mesa/src/tnl/t_imm_debug.c index d60300bc3..98b009c38 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_debug.c +++ b/xc/extras/Mesa/src/tnl/t_imm_debug.c @@ -1,4 +1,3 @@ -/* $Id: t_imm_debug.c,v 1.1.1.1 2002/10/22 13:06:17 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -25,39 +24,42 @@ */ #include "mtypes.h" +#include "context.h" +#include "imports.h" #include "t_context.h" #include "t_imm_debug.h" + void _tnl_print_vert_flags( const char *name, GLuint flags ) { - fprintf(stderr, + _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", name, flags, - (flags & VERT_CLIP) ? "clip/proj-clip/glend, " : "", - (flags & VERT_EDGE) ? "edgeflag, " : "", - (flags & VERT_ELT) ? "array-elt, " : "", - (flags & VERT_END_VB) ? "end-vb, " : "", - (flags & VERT_EVAL_ANY) ? "eval-coord, " : "", - (flags & VERT_EYE) ? "eye/glbegin, " : "", - (flags & VERT_FOG_COORD) ? "fog-coord, " : "", - (flags & VERT_INDEX) ? "index, " : "", - (flags & VERT_MATERIAL) ? "material, " : "", - (flags & VERT_NORM) ? "normals, " : "", - (flags & VERT_OBJ) ? "obj, " : "", - (flags & VERT_OBJ_3) ? "obj-3, " : "", - (flags & VERT_OBJ_4) ? "obj-4, " : "", - (flags & VERT_POINT_SIZE) ? "point-size, " : "", - (flags & VERT_RGBA) ? "colors, " : "", - (flags & VERT_SPEC_RGB) ? "specular, " : "", - (flags & VERT_TEX0) ? "texcoord0, " : "", - (flags & VERT_TEX1) ? "texcoord1, " : "", - (flags & VERT_TEX2) ? "texcoord2, " : "", - (flags & VERT_TEX3) ? "texcoord3, " : "", - (flags & VERT_TEX4) ? "texcoord4, " : "", - (flags & VERT_TEX5) ? "texcoord5, " : "", - (flags & VERT_TEX6) ? "texcoord6, " : "", - (flags & VERT_TEX7) ? "texcoord7, " : "" + (flags & VERT_BIT_CLIP) ? "clip/proj-clip/glend, " : "", + (flags & VERT_BIT_EDGEFLAG) ? "edgeflag, " : "", + (flags & VERT_BIT_ELT) ? "array-elt, " : "", + (flags & VERT_BIT_END_VB) ? "end-vb, " : "", + (flags & VERT_BITS_EVAL_ANY) ? "eval-coord, " : "", + (flags & VERT_BIT_EYE) ? "eye/glbegin, " : "", + (flags & VERT_BIT_FOG) ? "fog-coord, " : "", + (flags & VERT_BIT_INDEX) ? "index, " : "", + (flags & VERT_BIT_MATERIAL) ? "material, " : "", + (flags & VERT_BIT_NORMAL) ? "normals, " : "", + (flags & VERT_BIT_POS) ? "obj, " : "", + (flags & VERT_BIT_OBJ_3) ? "obj-3, " : "", + (flags & VERT_BIT_OBJ_4) ? "obj-4, " : "", + (flags & VERT_BIT_POINT_SIZE) ? "point-size, " : "", + (flags & VERT_BIT_COLOR0) ? "colors, " : "", + (flags & VERT_BIT_COLOR1) ? "specular, " : "", + (flags & VERT_BIT_TEX0) ? "texcoord0, " : "", + (flags & VERT_BIT_TEX1) ? "texcoord1, " : "", + (flags & VERT_BIT_TEX2) ? "texcoord2, " : "", + (flags & VERT_BIT_TEX3) ? "texcoord3, " : "", + (flags & VERT_BIT_TEX4) ? "texcoord4, " : "", + (flags & VERT_BIT_TEX5) ? "texcoord5, " : "", + (flags & VERT_BIT_TEX6) ? "texcoord6, " : "", + (flags & VERT_BIT_TEX7) ? "texcoord7, " : "" ); } @@ -70,7 +72,7 @@ void _tnl_print_cassette( struct immediate *IM ) GLuint state = IM->BeginState; GLuint req = ~0; - fprintf(stderr, "Cassette id %d, %u rows.\n", IM->id, + _mesa_debug(NULL, "Cassette id %d, %u rows.\n", IM->id, IM->Count - IM->CopyStart); _tnl_print_vert_flags("Contains at least one", orflag); @@ -79,91 +81,102 @@ void _tnl_print_cassette( struct immediate *IM ) { _tnl_print_vert_flags("Contains a full complement of", andflag); - fprintf(stderr, "Final begin/end state %s/%s, errors %s/%s\n", - (state & VERT_BEGIN_0) ? "in" : "out", - (state & VERT_BEGIN_1) ? "in" : "out", - (state & VERT_ERROR_0) ? "y" : "n", - (state & VERT_ERROR_1) ? "y" : "n"); + _mesa_debug(NULL, "Final begin/end state %s/%s, errors %s/%s\n", + (state & VERT_BEGIN_0) ? "in" : "out", + (state & VERT_BEGIN_1) ? "in" : "out", + (state & VERT_ERROR_0) ? "y" : "n", + (state & VERT_ERROR_1) ? "y" : "n"); } - if ((MESA_VERBOSE & VERBOSE_IMMEDIATE) && - (MESA_VERBOSE & VERBOSE_VERTS)) { - for (i = IM->CopyStart ; i <= IM->Count ; i++) { - fprintf(stderr, "%u: ", i); - if (req & VERT_OBJ_234) { - if (flags[i] & VERT_EVAL_C1) - fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]); - else if (flags[i] & VERT_EVAL_P1) - fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]); - else if (flags[i] & VERT_EVAL_C2) - fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]); - else if (flags[i] & VERT_EVAL_P2) - fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]); - else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) { - fprintf(stderr, "Obj %f %f %f %f", - IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]); - } + for (i = IM->CopyStart ; i <= IM->Count ; i++) { + _mesa_debug(NULL, "%u: ", i); + if (req & VERT_BITS_OBJ_234) { + if (flags[i] & VERT_BIT_EVAL_C1) + _mesa_debug(NULL, "EvalCoord %f ", + IM->Attrib[VERT_ATTRIB_POS][i][0]); + else if (flags[i] & VERT_BIT_EVAL_P1) + _mesa_debug(NULL, "EvalPoint %.0f ", + IM->Attrib[VERT_ATTRIB_POS][i][0]); + else if (flags[i] & VERT_BIT_EVAL_C2) + _mesa_debug(NULL, "EvalCoord %f %f ", + IM->Attrib[VERT_ATTRIB_POS][i][0], + IM->Attrib[VERT_ATTRIB_POS][i][1]); + else if (flags[i] & VERT_BIT_EVAL_P2) + _mesa_debug(NULL, "EvalPoint %.0f %.0f ", + IM->Attrib[VERT_ATTRIB_POS][i][0], + IM->Attrib[VERT_ATTRIB_POS][i][1]); + else if (i < IM->Count && (flags[i] & VERT_BITS_OBJ_234)) { + _mesa_debug(NULL, "Obj %f %f %f %f", + IM->Attrib[VERT_ATTRIB_POS][i][0], + IM->Attrib[VERT_ATTRIB_POS][i][1], + IM->Attrib[VERT_ATTRIB_POS][i][2], + IM->Attrib[VERT_ATTRIB_POS][i][3]); } + } - if (req & flags[i] & VERT_ELT) - fprintf(stderr, " Elt %u\t", IM->Elt[i]); - - if (req & flags[i] & VERT_NORM) - fprintf(stderr, " Norm %f %f %f ", - IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]); - - if (req & flags[i] & VERT_TEX_ANY) { - GLuint j; - for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { - if (req & flags[i] & VERT_TEX(j)) { - fprintf(stderr, - "TC%d %f %f %f %f", - j, - IM->TexCoord[j][i][0], IM->TexCoord[j][i][1], - IM->TexCoord[j][i][2], IM->TexCoord[j][i][2]); - } + if (req & flags[i] & VERT_BIT_ELT) + _mesa_debug(NULL, " Elt %u\t", IM->Elt[i]); + + if (req & flags[i] & VERT_BIT_NORMAL) + _mesa_debug(NULL, " Norm %f %f %f ", + IM->Attrib[VERT_ATTRIB_NORMAL][i][0], + IM->Attrib[VERT_ATTRIB_NORMAL][i][1], + IM->Attrib[VERT_ATTRIB_NORMAL][i][2]); + + if (req & flags[i] & VERT_BITS_TEX_ANY) { + GLuint j; + for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { + if (req & flags[i] & VERT_BIT_TEX(j)) { + _mesa_debug(NULL, "TC%d %f %f %f %f", j, + IM->Attrib[VERT_ATTRIB_TEX0 + j][i][0], + IM->Attrib[VERT_ATTRIB_TEX0 + j][i][1], + IM->Attrib[VERT_ATTRIB_TEX0 + j][i][2], + IM->Attrib[VERT_ATTRIB_TEX0 + j][i][3]); } } + } - if (req & flags[i] & VERT_RGBA) - fprintf(stderr, " Rgba %f %f %f %f ", - IM->Color[i][0], IM->Color[i][1], - IM->Color[i][2], IM->Color[i][3]); + if (req & flags[i] & VERT_BIT_COLOR0) + _mesa_debug(NULL, " Rgba %f %f %f %f ", + IM->Attrib[VERT_ATTRIB_COLOR0][i][0], + IM->Attrib[VERT_ATTRIB_COLOR0][i][1], + IM->Attrib[VERT_ATTRIB_COLOR0][i][2], + IM->Attrib[VERT_ATTRIB_COLOR0][i][3]); - if (req & flags[i] & VERT_SPEC_RGB) - fprintf(stderr, " Spec %f %f %f ", - IM->SecondaryColor[i][0], IM->SecondaryColor[i][1], - IM->SecondaryColor[i][2]); + if (req & flags[i] & VERT_BIT_COLOR1) + _mesa_debug(NULL, " Spec %f %f %f ", + IM->Attrib[VERT_ATTRIB_COLOR1][i][0], + IM->Attrib[VERT_ATTRIB_COLOR1][i][1], + IM->Attrib[VERT_ATTRIB_COLOR1][i][2]); - if (req & flags[i] & VERT_FOG_COORD) - fprintf(stderr, " Fog %f ", IM->FogCoord[i]); + if (req & flags[i] & VERT_BIT_FOG) + _mesa_debug(NULL, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]); - if (req & flags[i] & VERT_INDEX) - fprintf(stderr, " Index %u ", IM->Index[i]); + if (req & flags[i] & VERT_BIT_INDEX) + _mesa_debug(NULL, " Index %u ", IM->Index[i]); - if (req & flags[i] & VERT_EDGE) - fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]); + if (req & flags[i] & VERT_BIT_EDGEFLAG) + _mesa_debug(NULL, " Edgeflag %d ", IM->EdgeFlag[i]); - if (req & flags[i] & VERT_MATERIAL) - fprintf(stderr, " Material "); + if (req & flags[i] & VERT_BIT_MATERIAL) + _mesa_debug(NULL, " Material "); - /* The order of these two is not easily knowable, but this is - * the usually correct way to look at them. - */ - if (req & flags[i] & VERT_END) - fprintf(stderr, " END "); + /* The order of these two is not easily knowable, but this is + * the usually correct way to look at them. + */ + if (req & flags[i] & VERT_BIT_END) + _mesa_debug(NULL, " END "); - if (req & flags[i] & VERT_BEGIN) - fprintf(stderr, " BEGIN(%s) (%s%s%s%s)", - _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], - (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", - (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", - (IM->Primitive[i] & PRIM_END) ? "END," : "", - (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : ""); + if (req & flags[i] & VERT_BIT_BEGIN) + _mesa_debug(NULL, " BEGIN(%s) (%s%s%s%s)", + _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], + (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", + (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", + (IM->Primitive[i] & PRIM_END) ? "END," : "", + (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : ""); - fprintf(stderr, "\n"); - } + _mesa_debug(NULL, "\n"); } } diff --git a/xc/extras/Mesa/src/tnl/t_imm_debug.h b/xc/extras/Mesa/src/tnl/t_imm_debug.h index 2f9853089..91eea9347 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_debug.h +++ b/xc/extras/Mesa/src/tnl/t_imm_debug.h @@ -1,4 +1,3 @@ -/* $Id: t_imm_debug.h,v 1.1.1.1 2002/10/22 13:06:18 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef _T_DEBUG_H diff --git a/xc/extras/Mesa/src/tnl/t_imm_dlist.c b/xc/extras/Mesa/src/tnl/t_imm_dlist.c index c9be06e26..e74c944a8 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_dlist.c +++ b/xc/extras/Mesa/src/tnl/t_imm_dlist.c @@ -1,10 +1,9 @@ -/* $Id: t_imm_dlist.c,v 1.1.1.1 2002/10/22 13:06:19 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 3.5 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -33,7 +32,7 @@ #include "dlist.h" #include "debug.h" #include "mmath.h" -#include "mem.h" +#include "imports.h" #include "state.h" #include "t_context.h" @@ -70,7 +69,7 @@ static void build_normal_lengths( struct immediate *IM ) { GLuint i; GLfloat len; - GLfloat (*data)[3] = IM->Normal + IM->Start; + GLfloat (*data)[4] = IM->Attrib[VERT_ATTRIB_NORMAL] + IM->Start; GLfloat *dest = IM->NormalLengthPtr; GLuint *flags = IM->Flag + IM->Start; GLuint count = IM->Count - IM->Start; @@ -86,7 +85,7 @@ static void build_normal_lengths( struct immediate *IM ) for (i = 0 ; i < count ; ) { dest[i] = len; - if (flags[++i] & VERT_NORM) { + if (flags[++i] & VERT_BIT_NORMAL) { len = (GLfloat) LEN_3FV( data[i] ); if (len > 0.0F) len = 1.0F / len; } @@ -97,7 +96,7 @@ static void fixup_normal_lengths( struct immediate *IM ) { GLuint i; GLfloat len = 1.0F; /* just to silence warnings */ - GLfloat (*data)[3] = IM->Normal; + GLfloat (*data)[4] = IM->Attrib[VERT_ATTRIB_NORMAL]; GLfloat *dest = IM->NormalLengthPtr; GLuint *flags = IM->Flag; @@ -108,7 +107,7 @@ static void fixup_normal_lengths( struct immediate *IM ) } if (i < IM->Count) { - while (!(flags[i] & (VERT_NORM|VERT_END_VB))) { + while (!(flags[i] & (VERT_BIT_NORMAL|VERT_BIT_END_VB))) { dest[i] = len; i++; } @@ -129,7 +128,7 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) GLuint new_beginstate; if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) - fprintf(stderr, "_tnl_compiled_cassette IM: %d\n", IM->id); + _mesa_debug(ctx, "_tnl_compiled_cassette IM: %d\n", IM->id); if (IM->FlushElt) { ASSERT (IM->FlushElt == FLUSH_ELT_LAZY); @@ -142,8 +141,8 @@ _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) * array-elements have been translated away by now, so it's ok to * remove it.) */ - IM->OrFlag &= ~VERT_ELT; - IM->AndFlag &= ~VERT_ELT; + IM->OrFlag &= ~VERT_BIT_ELT; + IM->AndFlag &= ~VERT_BIT_ELT; _tnl_fixup_input( ctx, IM ); @@ -225,17 +224,17 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM ) _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) - if (IM->Flag[i] & (VERT_BEGIN|VERT_END_VB)) + if (IM->Flag[i] & (VERT_BIT_BEGIN|VERT_BIT_END_VB)) break; /* Would like to just ignore vertices upto this point. Can't * set copystart because it might skip materials? */ ASSERT(IM->Start == IM->CopyStart); - if (i > IM->CopyStart || !(IM->Flag[IM->Start] & VERT_BEGIN)) { + if (i > IM->CopyStart || !(IM->Flag[IM->Start] & VERT_BIT_BEGIN)) { IM->Primitive[IM->CopyStart] = GL_POLYGON+1; IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; - if (IM->Flag[i] & VERT_END_VB) { + if (IM->Flag[i] & VERT_BIT_END_VB) { IM->Primitive[IM->CopyStart] |= PRIM_LAST; IM->LastPrimitive = IM->CopyStart; } @@ -247,7 +246,7 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM ) _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin/glEnd"); if (IM->CopyStart == IM->Start && - IM->Flag[IM->Start] & (VERT_END|VERT_END_VB)) + IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB)) { } else @@ -259,16 +258,16 @@ static void fixup_compiled_primitives( GLcontext *ctx, struct immediate *IM ) /* one of these should be true, else we'll be in an infinite loop */ ASSERT(IM->PrimitiveLength[IM->Start] > 0 || - IM->Flag[IM->Start] & (VERT_END|VERT_END_VB)); + IM->Flag[IM->Start] & (VERT_BIT_END | VERT_BIT_END_VB)); for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) - if (IM->Flag[i] & (VERT_END|VERT_END_VB)) { + if (IM->Flag[i] & (VERT_BIT_END | VERT_BIT_END_VB)) { IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; - if (IM->Flag[i] & VERT_END_VB) { + if (IM->Flag[i] & VERT_BIT_END_VB) { IM->Primitive[IM->CopyStart] |= PRIM_LAST; IM->LastPrimitive = IM->CopyStart; } - if (IM->Flag[i] & VERT_END) { + if (IM->Flag[i] & VERT_BIT_END) { IM->Primitive[IM->CopyStart] |= PRIM_END; } break; @@ -296,8 +295,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data ) TNLvertexcassette *node = (TNLvertexcassette *)data; struct immediate *IM = node->IM; - if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) - fprintf(stderr, "execute_compiled_cassette IM: %d\n", IM->id); +/* _mesa_debug("%s\n", __FUNCTION__); */ IM->Start = node->Start; IM->CopyStart = node->Start; @@ -313,15 +311,13 @@ execute_compiled_cassette( GLcontext *ctx, void *data ) IM->MaterialOrMask = node->MaterialOrMask; IM->MaterialAndMask = node->MaterialAndMask; - if ((MESA_VERBOSE & VERBOSE_DISPLAY_LIST) && (MESA_VERBOSE & VERBOSE_IMMEDIATE)) _tnl_print_cassette( IM ); if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) { - fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x ", - IM->id, - IM->Start, IM->Count, IM->BeginState); + _mesa_debug(ctx, "Run cassette %d, rows %d..%d, beginstate %x ", + IM->id, IM->Start, IM->Count, IM->BeginState); _tnl_print_vert_flags("orflag", IM->OrFlag); } @@ -368,12 +364,6 @@ execute_compiled_cassette( GLcontext *ctx, void *data ) IM->Primitive[IM->LastPrimitive] & PRIM_MODE_MASK; } -/* fprintf(stderr, "%s: IM->Primitive[%d]: %x, CurrExecPrim: %x\n", */ -/* __FUNCTION__, */ -/* IM->LastPrimitive, */ -/* IM->Primitive[IM->LastPrimitive], */ -/* ctx->Driver.CurrentExecPrimitive); */ - _tnl_get_exec_copy_verts( ctx, IM ); if (IM->NormalLengthPtr) @@ -409,8 +399,8 @@ print_compiled_cassette( GLcontext *ctx, void *data ) TNLvertexcassette *node = (TNLvertexcassette *)data; struct immediate *IM = node->IM; - fprintf(stderr, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n", - node->IM->id, node->Start, node->Count); + _mesa_debug(ctx, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n", + node->IM->id, node->Start, node->Count); IM->Start = node->Start; IM->CopyStart = node->Start; @@ -433,7 +423,7 @@ _tnl_BeginCallList( GLcontext *ctx, GLuint list ) { (void) ctx; (void) list; - FLUSH_CURRENT(ctx, 0); /* Current immediate is emptied on CallList */ + FLUSH_CURRENT(ctx, 0); } @@ -581,17 +571,15 @@ static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM ) void (GLAPIENTRY *texcoordfv[MAX_TEXTURE_UNITS])( GLenum, const GLfloat * ); GLuint maxtex = 0; GLuint p, length, prim = 0; - -/* _tnl_print_vert_flags(__FUNCTION__, orflag); */ - - if (orflag & VERT_OBJ_234) + + if (orflag & VERT_BITS_OBJ_234) vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex4fv; else vertex = (void (GLAPIENTRY *)(const GLfloat *)) glVertex3fv; - if (orflag & VERT_TEX_ANY) { + if (orflag & VERT_BITS_TEX_ANY) { for (j = 0 ; j < ctx->Const.MaxTextureUnits ; j++) { - if (orflag & VERT_TEX(j)) { + if (orflag & VERT_BIT_TEX(j)) { maxtex = j+1; if ((IM->TexSize & TEX_SIZE_4(j)) == TEX_SIZE_4(j)) texcoordfv[j] = glMultiTexCoord4fvARB; @@ -615,49 +603,49 @@ static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM ) } for ( i = p ; i <= p+length ; i++) { - if (flags[i] & VERT_TEX_ANY) { + if (flags[i] & VERT_BITS_TEX_ANY) { GLuint k; for (k = 0 ; k < maxtex ; k++) { - if (flags[i] & VERT_TEX(k)) { - texcoordfv[k]( GL_TEXTURE0_ARB + k, IM->TexCoord[k][i] ); + if (flags[i] & VERT_BIT_TEX(k)) { + texcoordfv[k]( GL_TEXTURE0_ARB + k, + IM->Attrib[VERT_ATTRIB_TEX0 + k][i] ); } } } - if (flags[i] & VERT_NORM) { - glNormal3fv(IM->Normal[i]); - } + if (flags[i] & VERT_BIT_NORMAL) + glNormal3fv(IM->Attrib[VERT_ATTRIB_NORMAL][i]); - if (flags[i] & VERT_RGBA) { - glColor4fv( IM->Color[i] ); - } + if (flags[i] & VERT_BIT_COLOR0) + glColor4fv( IM->Attrib[VERT_ATTRIB_COLOR0][i] ); - if (flags[i] & VERT_SPEC_RGB) - _glapi_Dispatch->SecondaryColor3fvEXT( IM->SecondaryColor[i] ); + if (flags[i] & VERT_BIT_COLOR1) + _glapi_Dispatch->SecondaryColor3fvEXT( IM->Attrib[VERT_ATTRIB_COLOR1][i] ); - if (flags[i] & VERT_FOG_COORD) - _glapi_Dispatch->FogCoordfEXT( IM->FogCoord[i] ); + if (flags[i] & VERT_BIT_FOG) + _glapi_Dispatch->FogCoordfEXT( IM->Attrib[VERT_ATTRIB_FOG][i][0] ); - if (flags[i] & VERT_INDEX) + if (flags[i] & VERT_BIT_INDEX) glIndexi( IM->Index[i] ); - if (flags[i] & VERT_EDGE) + if (flags[i] & VERT_BIT_EDGEFLAG) glEdgeFlag( IM->EdgeFlag[i] ); - if (flags[i] & VERT_MATERIAL) + if (flags[i] & VERT_BIT_MATERIAL) emit_material( IM->Material[i], IM->MaterialMask[i] ); - if (flags[i]&VERT_OBJ_234) { - vertex( IM->Obj[i] ); - } - else if (flags[i] & VERT_EVAL_C1) - glEvalCoord1f( IM->Obj[i][0] ); - else if (flags[i] & VERT_EVAL_P1) - glEvalPoint1( (GLint) IM->Obj[i][0] ); - else if (flags[i] & VERT_EVAL_C2) - glEvalCoord2f( IM->Obj[i][0], IM->Obj[i][1] ); - else if (flags[i] & VERT_EVAL_P2) - glEvalPoint2( (GLint) IM->Obj[i][0], (GLint) IM->Obj[i][1] ); + if (flags[i]&VERT_BITS_OBJ_234) + vertex( IM->Attrib[VERT_ATTRIB_POS][i] ); + else if (flags[i] & VERT_BIT_EVAL_C1) + glEvalCoord1f( IM->Attrib[VERT_ATTRIB_POS][i][0] ); + else if (flags[i] & VERT_BIT_EVAL_P1) + glEvalPoint1( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0] ); + else if (flags[i] & VERT_BIT_EVAL_C2) + glEvalCoord2f( IM->Attrib[VERT_ATTRIB_POS][i][0], + IM->Attrib[VERT_ATTRIB_POS][i][1] ); + else if (flags[i] & VERT_BIT_EVAL_P2) + glEvalPoint2( (GLint) IM->Attrib[VERT_ATTRIB_POS][i][0], + (GLint) IM->Attrib[VERT_ATTRIB_POS][i][1] ); } if (prim & PRIM_END) { diff --git a/xc/extras/Mesa/src/tnl/t_imm_dlist.h b/xc/extras/Mesa/src/tnl/t_imm_dlist.h index c11ebf2e5..e12d4c053 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_dlist.h +++ b/xc/extras/Mesa/src/tnl/t_imm_dlist.h @@ -1,4 +1,3 @@ -/* $Id: t_imm_dlist.h,v 1.1.1.1 2002/10/22 13:06:19 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef _T_DLIST_H diff --git a/xc/extras/Mesa/src/tnl/t_imm_elt.c b/xc/extras/Mesa/src/tnl/t_imm_elt.c index e153264bb..254b78d7f 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_elt.c +++ b/xc/extras/Mesa/src/tnl/t_imm_elt.c @@ -1,10 +1,9 @@ -/* $Id: t_imm_elt.c,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,12 +23,13 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "colormac.h" -#include "mem.h" +#include "context.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" @@ -138,7 +138,7 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; GLuint start, GLuint n #define SRC_START 0 #define DST_START start -#define CHECK if ((flags[i]&match) == VERT_ELT) +#define CHECK if ((flags[i]&match) == VERT_BIT_ELT) #define NEXT_F (void)1 #define NEXT_F2 f = first + elts[i] * stride; @@ -597,6 +597,7 @@ void _tnl_imm_elt_init( void ) } +#if 00 static void _tnl_trans_elt_1f(GLfloat *to, const struct gl_client_array *from, GLuint *flags, @@ -615,6 +616,7 @@ static void _tnl_trans_elt_1f(GLfloat *to, n ); } +#endif static void _tnl_trans_elt_1ui(GLuint *to, const struct gl_client_array *from, @@ -719,6 +721,7 @@ static void _tnl_trans_elt_4f(GLfloat (*to)[4], +#if 0 static void _tnl_trans_elt_3f(GLfloat (*to)[3], const struct gl_client_array *from, GLuint *flags, @@ -736,7 +739,7 @@ static void _tnl_trans_elt_3f(GLfloat (*to)[3], start, n ); } - +#endif @@ -754,66 +757,66 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, GLuint translate = ctx->Array._Enabled; GLuint i; - if (MESA_VERBOSE&VERBOSE_IMMEDIATE) - fprintf(stderr, "exec_array_elements %d .. %d\n", start, count); + if (MESA_VERBOSE & VERBOSE_IMMEDIATE) + _mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count); - if (translate & VERT_OBJ) { - _tnl_trans_elt_4f( IM->Obj, + if (translate & VERT_BIT_POS) { + _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS], &ctx->Array.Vertex, - flags, elts, (VERT_ELT|VERT_OBJ), + flags, elts, (VERT_BIT_ELT|VERT_BIT_POS), start, count); if (ctx->Array.Vertex.Size == 4) - translate |= VERT_OBJ_234; + translate |= VERT_BITS_OBJ_234; else if (ctx->Array.Vertex.Size == 3) - translate |= VERT_OBJ_23; + translate |= VERT_BITS_OBJ_23; } - if (translate & VERT_NORM) - _tnl_trans_elt_3f( IM->Normal, + if (translate & VERT_BIT_NORMAL) + _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL], &ctx->Array.Normal, - flags, elts, (VERT_ELT|VERT_NORM), + flags, elts, (VERT_BIT_ELT|VERT_BIT_NORMAL), start, count); - if (translate & VERT_EDGE) + if (translate & VERT_BIT_EDGEFLAG) _tnl_trans_elt_1ub( IM->EdgeFlag, &ctx->Array.EdgeFlag, - flags, elts, (VERT_ELT|VERT_EDGE), + flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG), start, count); - if (translate & VERT_RGBA) { - _tnl_trans_elt_4f( IM->Color, + if (translate & VERT_BIT_COLOR0) { + _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0], &ctx->Array.Color, - flags, elts, (VERT_ELT|VERT_RGBA), + flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0), start, count); } - if (translate & VERT_SPEC_RGB) { - _tnl_trans_elt_4f( IM->SecondaryColor, + if (translate & VERT_BIT_COLOR1) { + _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1], &ctx->Array.SecondaryColor, - flags, elts, (VERT_ELT|VERT_SPEC_RGB), + flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1), start, count); } - if (translate & VERT_FOG_COORD) - _tnl_trans_elt_1f( IM->FogCoord, + if (translate & VERT_BIT_FOG) + _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_FOG], &ctx->Array.FogCoord, - flags, elts, (VERT_ELT|VERT_FOG_COORD), + flags, elts, (VERT_BIT_ELT|VERT_BIT_FOG), start, count); - if (translate & VERT_INDEX) + if (translate & VERT_BIT_INDEX) _tnl_trans_elt_1ui( IM->Index, &ctx->Array.Index, - flags, elts, (VERT_ELT|VERT_INDEX), + flags, elts, (VERT_BIT_ELT|VERT_BIT_INDEX), start, count); - if (translate & VERT_TEX_ANY) { + if (translate & VERT_BITS_TEX_ANY) { for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) - if (translate & VERT_TEX(i)) { - _tnl_trans_elt_4f( IM->TexCoord[i], + if (translate & VERT_BIT_TEX(i)) { + _tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], &ctx->Array.TexCoord[i], - flags, elts, (VERT_ELT|VERT_TEX(i)), + flags, elts, (VERT_BIT_ELT|VERT_BIT_TEX(i)), start, count); if (ctx->Array.TexCoord[i].Size == 4) @@ -824,7 +827,7 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, } for (i = start ; i < count ; i++) - if (flags[i] & VERT_ELT) flags[i] |= translate; + if (flags[i] & VERT_BIT_ELT) flags[i] |= translate; IM->FlushElt = 0; } diff --git a/xc/extras/Mesa/src/tnl/t_imm_elt.h b/xc/extras/Mesa/src/tnl/t_imm_elt.h index d5088edcf..811cb17c3 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_elt.h +++ b/xc/extras/Mesa/src/tnl/t_imm_elt.h @@ -1,4 +1,3 @@ -/* $Id: t_imm_elt.h,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ diff --git a/xc/extras/Mesa/src/tnl/t_imm_eval.c b/xc/extras/Mesa/src/tnl/t_imm_eval.c index e0dd25800..d71845320 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_eval.c +++ b/xc/extras/Mesa/src/tnl/t_imm_eval.c @@ -1,10 +1,9 @@ -/* $Id: t_imm_eval.c,v 1.1.1.1 2002/10/22 13:06:23 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,8 +23,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> - * + * Keith Whitwell <keith@tungstengraphics.com> + * Brian Paul - vertex program updates */ @@ -33,7 +32,7 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" #include "math/m_eval.h" @@ -52,11 +51,11 @@ static void eval_points1( GLfloat outcoord[][4], GLfloat du, GLfloat u1 ) { GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & VERT_EVAL_ANY) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & VERT_BITS_EVAL_ANY) { outcoord[i][0] = coord[i][0]; outcoord[i][1] = coord[i][1]; - if (flags[i] & VERT_EVAL_P1) + if (flags[i] & VERT_BIT_EVAL_P1) outcoord[i][0] = coord[i][0] * du + u1; } } @@ -68,11 +67,11 @@ static void eval_points2( GLfloat outcoord[][4], GLfloat dv, GLfloat v1 ) { GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) { - if (flags[i] & VERT_EVAL_ANY) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) { + if (flags[i] & VERT_BITS_EVAL_ANY) { outcoord[i][0] = coord[i][0]; outcoord[i][1] = coord[i][1]; - if (flags[i] & VERT_EVAL_P2) { + if (flags[i] & VERT_BIT_EVAL_P2) { outcoord[i][0] = coord[i][0] * du + u1; outcoord[i][1] = coord[i][1] * dv + v1; } @@ -93,15 +92,15 @@ static void eval1_4f( GLvector4f *dest, GLfloat coord[][4], const GLuint *flags, GLuint dimension, - struct gl_1d_map *map ) + const struct gl_1d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; GLfloat (*to)[4] = dest->data; GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { GLfloat u = (coord[i][0] - u1) * du; ASSIGN_4V(to[i], 0,0,0,1); _math_horner_bezier_curve(map->Points, to[i], u, @@ -112,11 +111,13 @@ static void eval1_4f( GLvector4f *dest, dest->flags |= dirty_flags[dimension]; } + +/* as above, but dest is a gl_client_array */ static void eval1_4f_ca( struct gl_client_array *dest, GLfloat coord[][4], const GLuint *flags, GLuint dimension, - struct gl_1d_map *map ) + const struct gl_1d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; @@ -126,8 +127,8 @@ static void eval1_4f_ca( struct gl_client_array *dest, ASSERT(dest->Type == GL_FLOAT); ASSERT(dest->StrideB == 4 * sizeof(GLfloat)); - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { GLfloat u = (coord[i][0] - u1) * du; ASSIGN_4V(to[i], 0,0,0,1); _math_horner_bezier_curve(map->Points, to[i], u, @@ -141,15 +142,15 @@ static void eval1_4f_ca( struct gl_client_array *dest, static void eval1_1ui( GLvector1ui *dest, GLfloat coord[][4], const GLuint *flags, - struct gl_1d_map *map ) + const struct gl_1d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; GLuint *to = dest->data; GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { GLfloat u = (coord[i][0] - u1) * du; GLfloat tmp; _math_horner_bezier_curve(map->Points, &tmp, u, 1, map->Order); @@ -158,46 +159,41 @@ static void eval1_1ui( GLvector1ui *dest, } -static void eval1_norm( GLvector3f *dest, +static void eval1_norm( GLvector4f *dest, GLfloat coord[][4], const GLuint *flags, - struct gl_1d_map *map ) + const struct gl_1d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; - GLfloat (*to)[3] = dest->data; + GLfloat (*to)[4] = dest->data; GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1)) { GLfloat u = (coord[i][0] - u1) * du; _math_horner_bezier_curve(map->Points, to[i], u, 3, map->Order); } } - - - static void eval2_obj_norm( GLvector4f *obj_ptr, - GLvector3f *norm_ptr, + GLvector4f *norm_ptr, GLfloat coord[][4], GLuint *flags, GLuint dimension, - struct gl_2d_map *map ) + const struct gl_2d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; const GLfloat v1 = map->v1; const GLfloat dv = map->dv; GLfloat (*obj)[4] = obj_ptr->data; - GLfloat (*normal)[3] = norm_ptr->data; + GLfloat (*normal)[4] = norm_ptr->data; GLuint i; -/* fprintf(stderr, "%s\n", __FUNCTION__); */ - - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { GLfloat u = (coord[i][0] - u1) * du; GLfloat v = (coord[i][1] - v1) * dv; GLfloat du[4], dv[4]; @@ -229,7 +225,7 @@ static void eval2_4f( GLvector4f *dest, GLfloat coord[][4], const GLuint *flags, GLuint dimension, - struct gl_2d_map *map ) + const struct gl_2d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; @@ -238,8 +234,8 @@ static void eval2_4f( GLvector4f *dest, GLfloat (*to)[4] = dest->data; GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { GLfloat u = (coord[i][0] - u1) * du; GLfloat v = (coord[i][1] - v1) * dv; @@ -251,11 +247,13 @@ static void eval2_4f( GLvector4f *dest, dest->flags |= dirty_flags[dimension]; } + +/* as above, but dest is a gl_client_array */ static void eval2_4f_ca( struct gl_client_array *dest, GLfloat coord[][4], const GLuint *flags, GLuint dimension, - struct gl_2d_map *map ) + const struct gl_2d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; @@ -267,8 +265,8 @@ static void eval2_4f_ca( struct gl_client_array *dest, ASSERT(dest->Type == GL_FLOAT); ASSERT(dest->StrideB == 4 * sizeof(GLfloat)); - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { GLfloat u = (coord[i][0] - u1) * du; GLfloat v = (coord[i][1] - v1) * dv; _math_horner_bezier_surf(map->Points, to[i], u, v, dimension, @@ -279,33 +277,33 @@ static void eval2_4f_ca( struct gl_client_array *dest, } -static void eval2_norm( GLvector3f *dest, +static void eval2_norm( GLvector4f *dest, GLfloat coord[][4], GLuint *flags, - struct gl_2d_map *map ) + const struct gl_2d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; const GLfloat v1 = map->v1; const GLfloat dv = map->dv; - GLfloat (*to)[3] = dest->data; + GLfloat (*to)[4] = dest->data; GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) { + if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { GLfloat u = (coord[i][0] - u1) * du; GLfloat v = (coord[i][1] - v1) * dv; _math_horner_bezier_surf(map->Points, to[i], u, v, 3, map->Uorder, map->Vorder); - } - + } + } } static void eval2_1ui( GLvector1ui *dest, GLfloat coord[][4], const GLuint *flags, - struct gl_2d_map *map ) + const struct gl_2d_map *map ) { const GLfloat u1 = map->u1; const GLfloat du = map->du; @@ -314,8 +312,8 @@ static void eval2_1ui( GLvector1ui *dest, GLuint *to = dest->data; GLuint i; - for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) - if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + for (i = 0 ; !(flags[i] & VERT_BIT_END_VB) ; i++) + if (flags[i] & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2)) { GLfloat u = (coord[i][0] - u1) * du; GLfloat v = (coord[i][1] - v1) * dv; GLfloat tmp; @@ -327,16 +325,12 @@ static void eval2_1ui( GLvector1ui *dest, } - - - - static void copy_4f( GLfloat to[][4], GLfloat from[][4], GLuint count ) { MEMCPY( to, from, count * sizeof(to[0])); } -static void copy_4f_stride( GLfloat to[][4], GLfloat *from, +static void copy_4f_stride( GLfloat to[][4], const GLfloat *from, GLuint stride, GLuint count ) { if (stride == 4 * sizeof(GLfloat)) @@ -348,7 +342,7 @@ static void copy_4f_stride( GLfloat to[][4], GLfloat *from, } } -static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count ) +static void copy_3f( GLfloat to[][4], GLfloat from[][4], GLuint count ) { GLuint i; for (i = 0 ; i < count ; i++) { @@ -357,7 +351,7 @@ static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count ) } -static void copy_1ui( GLuint to[], GLuint from[], GLuint count ) +static void copy_1ui( GLuint to[], const GLuint from[], GLuint count ) { MEMCPY( to, from, (count) * sizeof(to[0])); } @@ -370,58 +364,71 @@ static void update_eval( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint eval1 = 0, eval2 = 0; + GLuint i; if (ctx->Eval.Map1Index) - eval1 |= VERT_INDEX; + eval1 |= VERT_BIT_INDEX; if (ctx->Eval.Map2Index) - eval2 |= VERT_INDEX; + eval2 |= VERT_BIT_INDEX; if (ctx->Eval.Map1Color4) - eval1 |= VERT_RGBA; + eval1 |= VERT_BIT_COLOR0; if (ctx->Eval.Map2Color4) - eval2 |= VERT_RGBA; + eval2 |= VERT_BIT_COLOR0; if (ctx->Eval.Map1Normal) - eval1 |= VERT_NORM; + eval1 |= VERT_BIT_NORMAL; if (ctx->Eval.Map2Normal) - eval2 |= VERT_NORM; + eval2 |= VERT_BIT_NORMAL; if (ctx->Eval.Map1TextureCoord4 || ctx->Eval.Map1TextureCoord3 || ctx->Eval.Map1TextureCoord2 || ctx->Eval.Map1TextureCoord1) - eval1 |= VERT_TEX0; + eval1 |= VERT_BIT_TEX0; if (ctx->Eval.Map2TextureCoord4 || ctx->Eval.Map2TextureCoord3 || ctx->Eval.Map2TextureCoord2 || ctx->Eval.Map2TextureCoord1) - eval2 |= VERT_TEX0; + eval2 |= VERT_BIT_TEX0; if (ctx->Eval.Map1Vertex4) - eval1 |= VERT_OBJ_234; + eval1 |= VERT_BITS_OBJ_234; if (ctx->Eval.Map1Vertex3) - eval1 |= VERT_OBJ_23; + eval1 |= VERT_BITS_OBJ_23; if (ctx->Eval.Map2Vertex4) { if (ctx->Eval.AutoNormal) - eval2 |= VERT_OBJ_234 | VERT_NORM; + eval2 |= VERT_BITS_OBJ_234 | VERT_BIT_NORMAL; else - eval2 |= VERT_OBJ_234; + eval2 |= VERT_BITS_OBJ_234; } else if (ctx->Eval.Map2Vertex3) { if (ctx->Eval.AutoNormal) - eval2 |= VERT_OBJ_23 | VERT_NORM; + eval2 |= VERT_BITS_OBJ_23 | VERT_BIT_NORMAL; else - eval2 |= VERT_OBJ_23; + eval2 |= VERT_BITS_OBJ_23; } tnl->eval.EvalMap1Flags = eval1; tnl->eval.EvalMap2Flags = eval2; + + /* GL_NV_vertex_program evaluators */ + eval1 = eval2 = 0; + for (i = 0; i < VERT_ATTRIB_MAX; i++) { + if (ctx->Eval.Map1Attrib[i]) + eval1 |= (1 << i); + if (ctx->Eval.Map2Attrib[i]) + eval2 |= (1 << i); + } + tnl->eval.EvalMap1AttribFlags = eval1; + tnl->eval.EvalMap2AttribFlags = eval2; + tnl->eval.EvalNewState = 0; } @@ -441,13 +448,13 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) GLuint *flags = IM->Flag + IM->CopyStart; GLuint copycount; GLuint orflag = IM->OrFlag; - GLuint any_eval1 = orflag & (VERT_EVAL_C1|VERT_EVAL_P1); - GLuint any_eval2 = orflag & (VERT_EVAL_C2|VERT_EVAL_P2); + GLuint any_eval1 = orflag & (VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1); + GLuint any_eval2 = orflag & (VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2); GLuint req = 0; GLuint purge_flags = 0; - GLfloat (*coord)[4] = IM->Obj + IM->CopyStart; + GLfloat (*coord)[4] = IM->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; - if (IM->AndFlag & VERT_EVAL_ANY) + if (IM->AndFlag & VERT_BITS_EVAL_ANY) copycount = IM->Start - IM->CopyStart; /* just copy copied vertices */ else copycount = IM->Count - IM->CopyStart; /* copy all vertices */ @@ -459,46 +466,46 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) update_eval( ctx ); if (any_eval1) { - req |= tnl->pipeline.inputs & tnl->eval.EvalMap1Flags; + req |= tnl->pipeline.inputs + & (tnl->eval.EvalMap1Flags | tnl->eval.EvalMap1AttribFlags); - if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3) - purge_flags = (VERT_EVAL_P1|VERT_EVAL_C1); + if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3 && + !ctx->Eval.Map1Attrib[0]) + purge_flags = (VERT_BIT_EVAL_P1|VERT_BIT_EVAL_C1); - if (orflag & VERT_EVAL_P1) { - eval_points1( store->Obj + IM->CopyStart, + if (orflag & VERT_BIT_EVAL_P1) { + eval_points1( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart, coord, flags, ctx->Eval.MapGrid1du, ctx->Eval.MapGrid1u1); - coord = store->Obj + IM->CopyStart; + coord = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; } } if (any_eval2) { - req |= tnl->pipeline.inputs & tnl->eval.EvalMap2Flags; + req |= tnl->pipeline.inputs + & (tnl->eval.EvalMap2Flags | tnl->eval.EvalMap2AttribFlags); - if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) - purge_flags |= (VERT_EVAL_P2|VERT_EVAL_C2); + if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3 && + !ctx->Eval.Map2Attrib[0]) + purge_flags |= (VERT_BIT_EVAL_P2|VERT_BIT_EVAL_C2); - if (orflag & VERT_EVAL_P2) { - eval_points2( store->Obj + IM->CopyStart, + if (orflag & VERT_BIT_EVAL_P2) { + eval_points2( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart, coord, flags, ctx->Eval.MapGrid2du, ctx->Eval.MapGrid2u1, ctx->Eval.MapGrid2dv, ctx->Eval.MapGrid2v1 ); - coord = store->Obj + IM->CopyStart; + coord = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; } } - -/* _tnl_print_vert_flags(__FUNCTION__, req); */ - /* Perform the evaluations on active data elements. */ - if (req & VERT_INDEX) - { + if (req & VERT_BIT_INDEX) { GLuint generated = 0; if (copycount) @@ -509,152 +516,230 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) if (ctx->Eval.Map1Index && any_eval1) { eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; } if (ctx->Eval.Map2Index && any_eval2) { eval2_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map2Index ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; } } - if (req & VERT_RGBA) - { + if (req & VERT_BIT_COLOR0) { GLuint generated = 0; if (copycount) - copy_4f_stride( store->Color + IM->CopyStart, + copy_4f_stride( store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart, (GLfloat *)tmp->Color.Ptr, tmp->Color.StrideB, copycount ); - tmp->Color.Ptr = store->Color + IM->CopyStart; + tmp->Color.Ptr = store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart; tmp->Color.StrideB = 4 * sizeof(GLfloat); tmp->Color.Flags = 0; - tnl->vb.importable_data &= ~VERT_RGBA; + tnl->vb.importable_data &= ~VERT_BIT_COLOR0; + + if (ctx->VertexProgram.Enabled) { + tmp->Attribs[VERT_ATTRIB_COLOR0].data = + store->Attrib[VERT_ATTRIB_COLOR0] + IM->CopyStart; + tmp->Attribs[VERT_ATTRIB_COLOR0].start = + (GLfloat *) tmp->Attribs[VERT_ATTRIB_COLOR0].data; + tmp->Attribs[VERT_ATTRIB_COLOR0].size = 0; + } - if (ctx->Eval.Map1Color4 && any_eval1) { - eval1_4f_ca( &tmp->Color, coord, flags, 4, &ctx->EvalMap.Map1Color4 ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + /* Vertex program maps have priority over conventional attribs */ + if (any_eval1) { + if (ctx->VertexProgram.Enabled + && ctx->Eval.Map1Attrib[VERT_ATTRIB_COLOR0]) { + eval1_4f_ca( &tmp->Color, coord, flags, 4, + &ctx->EvalMap.Map1Attrib[VERT_ATTRIB_COLOR0] ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } + else if (ctx->Eval.Map1Color4) { + eval1_4f_ca( &tmp->Color, coord, flags, 4, + &ctx->EvalMap.Map1Color4 ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } } - if (ctx->Eval.Map2Color4 && any_eval2) { - eval2_4f_ca( &tmp->Color, coord, flags, 4, &ctx->EvalMap.Map2Color4 ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + if (any_eval2) { + if (ctx->VertexProgram.Enabled + && ctx->Eval.Map2Attrib[VERT_ATTRIB_COLOR0]) { + eval2_4f_ca( &tmp->Color, coord, flags, 4, + &ctx->EvalMap.Map2Attrib[VERT_ATTRIB_COLOR0] ); + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; + } + else if (ctx->Eval.Map2Color4) { + eval2_4f_ca( &tmp->Color, coord, flags, 4, + &ctx->EvalMap.Map2Color4 ); + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; + } } } - - if (req & VERT_TEX(0)) - { + if (req & VERT_BIT_TEX0) { GLuint generated = 0; if (copycount) - copy_4f( store->TexCoord[0] + IM->CopyStart, + copy_4f( store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart, tmp->TexCoord[0].data, copycount ); else tmp->TexCoord[0].size = 0; - tmp->TexCoord[0].data = store->TexCoord[0] + IM->CopyStart; + tmp->TexCoord[0].data = store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart; tmp->TexCoord[0].start = (GLfloat *)tmp->TexCoord[0].data; + if (ctx->VertexProgram.Enabled) { + tmp->Attribs[VERT_ATTRIB_TEX0].data = + store->Attrib[VERT_ATTRIB_TEX0] + IM->CopyStart; + tmp->Attribs[VERT_ATTRIB_TEX0].start = + (GLfloat *) tmp->Attribs[VERT_ATTRIB_TEX0].data; + tmp->Attribs[VERT_ATTRIB_TEX0].size = 0; + } + + /* Vertex program maps have priority over conventional attribs */ if (any_eval1) { - if (ctx->Eval.Map1TextureCoord4) { + if (ctx->VertexProgram.Enabled + && ctx->Eval.Map1Attrib[VERT_ATTRIB_TEX0]) { + eval1_4f( &tmp->TexCoord[0], coord, flags, 4, + &ctx->EvalMap.Map1Attrib[VERT_ATTRIB_TEX0] ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } + else if (ctx->Eval.Map1TextureCoord4) { eval1_4f( &tmp->TexCoord[0], coord, flags, 4, &ctx->EvalMap.Map1Texture4 ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; } else if (ctx->Eval.Map1TextureCoord3) { eval1_4f( &tmp->TexCoord[0], coord, flags, 3, &ctx->EvalMap.Map1Texture3 ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; } else if (ctx->Eval.Map1TextureCoord2) { eval1_4f( &tmp->TexCoord[0], coord, flags, 2, &ctx->EvalMap.Map1Texture2 ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; } else if (ctx->Eval.Map1TextureCoord1) { eval1_4f( &tmp->TexCoord[0], coord, flags, 1, &ctx->EvalMap.Map1Texture1 ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; } } if (any_eval2) { - if (ctx->Eval.Map2TextureCoord4) { + if (ctx->VertexProgram.Enabled + && ctx->Eval.Map2Attrib[VERT_ATTRIB_TEX0]) { + eval2_4f( &tmp->TexCoord[0], coord, flags, 4, + &ctx->EvalMap.Map2Attrib[VERT_ATTRIB_TEX0] ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } + else if (ctx->Eval.Map2TextureCoord4) { eval2_4f( &tmp->TexCoord[0], coord, flags, 4, &ctx->EvalMap.Map2Texture4 ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; } else if (ctx->Eval.Map2TextureCoord3) { eval2_4f( &tmp->TexCoord[0], coord, flags, 3, &ctx->EvalMap.Map2Texture3 ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; } else if (ctx->Eval.Map2TextureCoord2) { eval2_4f( &tmp->TexCoord[0], coord, flags, 2, &ctx->EvalMap.Map2Texture2 ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; } else if (ctx->Eval.Map2TextureCoord1) { eval2_4f( &tmp->TexCoord[0], coord, flags, 1, &ctx->EvalMap.Map2Texture1 ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; } } } - - if (req & VERT_NORM) - { + if (req & VERT_BIT_NORMAL) { GLuint generated = 0; if (copycount) { - copy_3f( store->Normal + IM->CopyStart, tmp->Normal.data, - copycount ); + copy_3f( store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart, + tmp->Normal.data, copycount ); } - tmp->Normal.data = store->Normal + IM->CopyStart; + tmp->Normal.data = store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart; tmp->Normal.start = (GLfloat *)tmp->Normal.data; - if (ctx->Eval.Map1Normal && any_eval1) { - eval1_norm( &tmp->Normal, coord, flags, - &ctx->EvalMap.Map1Normal ); - generated |= VERT_EVAL_C1|VERT_EVAL_P1; + if (ctx->VertexProgram.Enabled) { + tmp->Attribs[VERT_ATTRIB_NORMAL].data = + store->Attrib[VERT_ATTRIB_NORMAL] + IM->CopyStart; + tmp->Attribs[VERT_ATTRIB_NORMAL].start = + (GLfloat *) tmp->Attribs[VERT_ATTRIB_NORMAL].data; + tmp->Attribs[VERT_ATTRIB_NORMAL].size = 0; } - if (ctx->Eval.Map2Normal && any_eval2) { - eval2_norm( &tmp->Normal, coord, flags, - &ctx->EvalMap.Map2Normal ); - generated |= VERT_EVAL_C2|VERT_EVAL_P2; + if (any_eval1) { + if (ctx->VertexProgram.Enabled && + ctx->Eval.Map1Attrib[VERT_ATTRIB_NORMAL]) { + eval1_norm( &tmp->Normal, coord, flags, + &ctx->EvalMap.Map1Attrib[VERT_ATTRIB_NORMAL] ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } + else if (ctx->Eval.Map1Normal) { + eval1_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map1Normal ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } } - } - + if (any_eval2) { + if (ctx->VertexProgram.Enabled && + ctx->Eval.Map2Attrib[VERT_ATTRIB_NORMAL]) { + eval2_norm( &tmp->Normal, coord, flags, + &ctx->EvalMap.Map2Attrib[VERT_ATTRIB_NORMAL] ); + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; + } + else if (ctx->Eval.Map2Normal) { + eval2_norm( &tmp->Normal, coord, flags, &ctx->EvalMap.Map2Normal ); + generated |= VERT_BIT_EVAL_C2|VERT_BIT_EVAL_P2; + } + } + } /* In the AutoNormal case, the copy and assignment of tmp->NormalPtr * are done above. */ - if (req & VERT_OBJ) - { + if (req & VERT_BIT_POS) { if (copycount) { /* This copy may already have occurred when eliminating * glEvalPoint calls: */ - if (coord != store->Obj + IM->CopyStart) - copy_4f( store->Obj + IM->CopyStart, tmp->Obj.data, copycount ); - } else + if (coord != store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart) { + copy_4f( store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart, + tmp->Obj.data, copycount ); + } + } + else { tmp->Obj.size = 0; + } + + tmp->Obj.data = store->Attrib[VERT_ATTRIB_POS] + IM->CopyStart; + tmp->Obj.start = (GLfloat *) tmp->Obj.data; - tmp->Obj.data = store->Obj + IM->CopyStart; - tmp->Obj.start = (GLfloat *)tmp->Obj.data; +#if 1 + /*tmp->Attribs[0].count = count;*/ + tmp->Attribs[0].data = store->Attrib[0] + IM->CopyStart; + tmp->Attribs[0].start = (GLfloat *) tmp->Attribs[0].data; + tmp->Attribs[0].size = 0; +#endif /* Note: Normal data is already prepared above. */ if (any_eval1) { - if (ctx->Eval.Map1Vertex4) { + if (ctx->VertexProgram.Enabled && + ctx->Eval.Map1Attrib[VERT_ATTRIB_POS]) { + eval1_4f( &tmp->Obj, coord, flags, 4, + &ctx->EvalMap.Map1Attrib[VERT_ATTRIB_POS] ); + } + else if (ctx->Eval.Map1Vertex4) { eval1_4f( &tmp->Obj, coord, flags, 4, &ctx->EvalMap.Map1Vertex4 ); } @@ -665,18 +750,25 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) } if (any_eval2) { - if (ctx->Eval.Map2Vertex4) - { - if (ctx->Eval.AutoNormal && (req & VERT_NORM)) + if (ctx->VertexProgram.Enabled && + ctx->Eval.Map2Attrib[VERT_ATTRIB_POS]) { + if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL)) + eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, + &ctx->EvalMap.Map2Attrib[VERT_ATTRIB_POS] ); + else + eval2_4f( &tmp->Obj, coord, flags, 4, + &ctx->EvalMap.Map2Attrib[VERT_ATTRIB_POS] ); + } + else if (ctx->Eval.Map2Vertex4) { + if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL)) eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, &ctx->EvalMap.Map2Vertex4 ); else eval2_4f( &tmp->Obj, coord, flags, 4, &ctx->EvalMap.Map2Vertex4 ); } - else if (ctx->Eval.Map2Vertex3) - { - if (ctx->Eval.AutoNormal && (req & VERT_NORM)) + else if (ctx->Eval.Map2Vertex3) { + if (ctx->Eval.AutoNormal && (req & VERT_BIT_NORMAL)) eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3, &ctx->EvalMap.Map2Vertex3 ); else @@ -687,18 +779,47 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) } + if (ctx->VertexProgram.Enabled) { + /* We already evaluated position, normal, color and texture 0 above. + * now evaluate any other generic attributes. + */ + const GLuint skipBits = (VERT_BIT_POS | + VERT_BIT_NORMAL | + VERT_BIT_COLOR0 | + VERT_BIT_TEX0); + GLuint generated = 0; + GLuint attr; + for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { + if ((1 << attr) & req & ~skipBits) { + if (any_eval1 && ctx->Eval.Map1Attrib[attr]) { + /* evaluate 1-D vertex attrib map [i] */ + eval1_4f( &tmp->Attribs[attr], coord, flags, 4, + &ctx->EvalMap.Map1Attrib[attr] ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } + if (any_eval2 && ctx->Eval.Map2Attrib[attr]) { + /* evaluate 2-D vertex attrib map [i] */ + eval2_4f( &tmp->Attribs[attr], coord, flags, 4, + &ctx->EvalMap.Map2Attrib[attr] ); + generated |= VERT_BIT_EVAL_C1|VERT_BIT_EVAL_P1; + } + } + } + } + /* Calculate new IM->Elts, IM->Primitive, IM->PrimitiveLength for * the case where vertex maps are not enabled for some received * eval coordinates. In this case those slots in the immediate * must be ignored. */ if (purge_flags) { - GLuint vertex = VERT_OBJ|(VERT_EVAL_ANY & ~purge_flags); + const GLuint vertex = VERT_BIT_POS|(VERT_BITS_EVAL_ANY & ~purge_flags); GLuint last_new_prim = 0; GLuint new_prim_length = 0; GLuint next_old_prim = 0; struct vertex_buffer *VB = &tnl->vb; - GLuint i,j,count = VB->Count; + const GLuint count = VB->Count; + GLuint i, j; for (i = 0, j = 0 ; i < count ; i++) { if (flags[i] & vertex) { @@ -720,8 +841,8 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM ) /* Produce new flags array: */ { + const GLuint count = tnl->vb.Count + 1; GLuint i; - GLuint count = tnl->vb.Count + 1; copy_1ui( store->Flag, flags, count ); tnl->vb.Flag = store->Flag; diff --git a/xc/extras/Mesa/src/tnl/t_imm_exec.c b/xc/extras/Mesa/src/tnl/t_imm_exec.c index 7036a8675..bf5050856 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_exec.c +++ b/xc/extras/Mesa/src/tnl/t_imm_exec.c @@ -1,8 +1,7 @@ -/* $Id: t_imm_exec.c,v 1.1.1.1 2002/10/22 13:06:24 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -22,11 +21,13 @@ * 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. - * - * Authors: - * Keith Whitwell <keithw@valinux.com> */ +/** + * \file tnl/t_imm_exec.c + * \brief Setup to execute immediate-mode vertex data. + * \author Keith Whitwell + */ #include "glheader.h" #include "colormac.h" @@ -34,7 +35,7 @@ #include "enums.h" #include "dlist.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "light.h" #include "state.h" @@ -70,8 +71,7 @@ static void reset_input( GLcontext *ctx, MEMSET(IM->Flag + start, 0, sizeof(GLuint) * (IM->Count+2-start)); if (MESA_VERBOSE & VERBOSE_IMMEDIATE) - fprintf(stderr, "reset_input: IM(%d) new %x\n", - IM->id, beginstate); + _mesa_debug(ctx, "reset_input: IM(%d) new %x\n", IM->id, beginstate); IM->Start = start; IM->Count = start; @@ -100,6 +100,7 @@ void _tnl_reset_exec_input( GLcontext *ctx, reset_input( ctx, start, beginstate, savedbeginstate ); IM->CopyStart = start - tnl->ExecCopyCount; + IM->Primitive[IM->CopyStart] = ctx->Driver.CurrentExecPrimitive; if (tnl->ExecParity) IM->Primitive[IM->CopyStart] |= PRIM_PARITY; @@ -121,45 +122,57 @@ void _tnl_reset_compile_input( GLcontext *ctx, } +/** + * Copy the last specified normal, color, texcoord, edge flag, etc + * from the immediate struct into the ctx->Current attribute group. + */ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM, GLuint flag, GLuint count ) { if (MESA_VERBOSE&VERBOSE_IMMEDIATE) _tnl_print_vert_flags("copy to current", flag); - if (flag & VERT_NORM) - COPY_3FV( ctx->Current.Normal, IM->Normal[count]); + /* XXX should be able to replace these conditions with a loop over + * the 16 vertex attributes. + */ + if (flag & VERT_BIT_NORMAL) + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], + IM->Attrib[VERT_ATTRIB_NORMAL][count]); - if (flag & VERT_INDEX) + if (flag & VERT_BIT_INDEX) ctx->Current.Index = IM->Index[count]; - if (flag & VERT_EDGE) + if (flag & VERT_BIT_EDGEFLAG) ctx->Current.EdgeFlag = IM->EdgeFlag[count]; - if (flag & VERT_RGBA) { - COPY_4FV(ctx->Current.Color, IM->Color[count]); + if (flag & VERT_BIT_COLOR0) { + COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], + IM->Attrib[VERT_ATTRIB_COLOR0][count]); if (ctx->Light.ColorMaterialEnabled) { - _mesa_update_color_material( ctx, ctx->Current.Color ); - TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); + _mesa_update_color_material( ctx, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); + TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx ); } } - if (flag & VERT_SPEC_RGB) - COPY_4FV(ctx->Current.SecondaryColor, IM->SecondaryColor[count]); + if (flag & VERT_BIT_COLOR1) + COPY_4FV(ctx->Current.Attrib[VERT_ATTRIB_COLOR1], + IM->Attrib[VERT_ATTRIB_COLOR1][count]); - if (flag & VERT_FOG_COORD) - ctx->Current.FogCoord = IM->FogCoord[count]; + if (flag & VERT_BIT_FOG) + ctx->Current.Attrib[VERT_ATTRIB_FOG][0] = IM->Attrib[VERT_ATTRIB_FOG][count][0]; - if (flag & VERT_TEX_ANY) { + if (flag & VERT_BITS_TEX_ANY) { GLuint i; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (flag & VERT_TEX(i)) { - COPY_4FV( ctx->Current.Texcoord[0], IM->TexCoord[0][count]); + if (flag & VERT_BIT_TEX(i)) { + COPY_4FV( ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i], + IM->Attrib[VERT_ATTRIB_TEX0 + i][count]); } } } - if (flag & VERT_MATERIAL) { + if (flag & VERT_BIT_MATERIAL) { _mesa_update_material( ctx, IM->Material[IM->LastMaterial], IM->MaterialOrMask ); @@ -193,12 +206,12 @@ void _tnl_compute_orflag( struct immediate *IM, GLuint start ) * eg. a single glMaterial call, in which case IM->Start == * IM->Count, but the buffer is definitely not empty. */ - if (IM->Flag[i] & VERT_DATA) { + if (IM->Flag[i] & VERT_BITS_DATA) { IM->LastData++; orflag |= IM->Flag[i]; } - IM->Flag[IM->LastData+1] |= VERT_END_VB; + IM->Flag[IM->LastData+1] |= VERT_BIT_END_VB; IM->CopyAndFlag = IM->AndFlag = andflag; IM->OrFlag = orflag; IM->CopyOrFlag = orflag; @@ -206,13 +219,11 @@ void _tnl_compute_orflag( struct immediate *IM, GLuint start ) } - - - - - - -/* Note: The 'start' member of the GLvector structs is now redundant +/** + * This is where the vertex data is transfered from the 'struct immediate + * into the 'struct vertex_buffer'. + * + * Note: The 'start' member of the GLvector structs is now redundant * because we always re-transform copied vertices, and the vectors * below are set up so that the first copied vertex (if any) appears * at position zero. @@ -223,8 +234,8 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) struct vertex_buffer *VB = &tnl->vb; struct vertex_arrays *tmp = &tnl->imm_inputs; GLuint inputs = tnl->pipeline.inputs; /* for copy-to-current */ - GLuint start = IM->CopyStart; - GLuint count = IM->Count - start; + const GLuint start = IM->CopyStart; + const GLuint count = IM->Count - start; /* TODO: optimize the case where nothing has changed. (Just bind * tmp to vb). @@ -234,7 +245,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) */ VB->Count = count; VB->FirstClipped = IMM_MAXDATA - IM->CopyStart; - VB->import_data = 0; + VB->import_data = NULL; VB->importable_data = 0; /* Need an IM->FirstPrimitive? @@ -247,19 +258,18 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) /* TexCoordPtr's are zeroed in loop below. */ - VB->NormalPtr = 0; - VB->NormalLengthPtr = 0; - VB->FogCoordPtr = 0; - VB->EdgeFlag = 0; - VB->IndexPtr[0] = 0; - VB->IndexPtr[1] = 0; - VB->ColorPtr[0] = 0; - VB->ColorPtr[1] = 0; - VB->SecondaryColorPtr[0] = 0; - VB->SecondaryColorPtr[1] = 0; - VB->Elts = 0; - VB->MaterialMask = 0; - VB->Material = 0; + VB->NormalPtr = NULL; + VB->NormalLengthPtr = NULL; + VB->EdgeFlag = NULL; + VB->IndexPtr[0] = NULL; + VB->IndexPtr[1] = NULL; + VB->ColorPtr[0] = NULL; + VB->ColorPtr[1] = NULL; + VB->SecondaryColorPtr[0] = NULL; + VB->SecondaryColorPtr[1] = NULL; + VB->Elts = NULL; + VB->MaterialMask = NULL; + VB->Material = NULL; /* _tnl_print_vert_flags("copy-orflag", IM->CopyOrFlag); */ /* _tnl_print_vert_flags("orflag", IM->OrFlag); */ @@ -267,75 +277,77 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) /* Setup the initial values of array pointers in the vb. */ - if (inputs & VERT_OBJ) { - tmp->Obj.data = IM->Obj + start; - tmp->Obj.start = (GLfloat *)(IM->Obj + start); + if (inputs & VERT_BIT_POS) { + tmp->Obj.data = IM->Attrib[VERT_ATTRIB_POS] + start; + tmp->Obj.start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_POS] + start); tmp->Obj.count = count; VB->ObjPtr = &tmp->Obj; - if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_234) + if ((IM->CopyOrFlag & VERT_BITS_OBJ_234) == VERT_BITS_OBJ_234) tmp->Obj.size = 4; - else if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_23) + else if ((IM->CopyOrFlag & VERT_BITS_OBJ_234) == VERT_BITS_OBJ_23) tmp->Obj.size = 3; else tmp->Obj.size = 2; } - if (inputs & VERT_NORM) { - tmp->Normal.data = IM->Normal + start; - tmp->Normal.start = (GLfloat *)(IM->Normal + start); + if (inputs & VERT_BIT_NORMAL) { + tmp->Normal.data = IM->Attrib[VERT_ATTRIB_NORMAL] + start; + tmp->Normal.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_NORMAL] + start); tmp->Normal.count = count; + tmp->Normal.size = 3; /* just to be safe */ VB->NormalPtr = &tmp->Normal; if (IM->NormalLengthPtr) VB->NormalLengthPtr = IM->NormalLengthPtr + start; } - if (inputs & VERT_INDEX) { + if (inputs & VERT_BIT_INDEX) { tmp->Index.count = count; tmp->Index.data = IM->Index + start; tmp->Index.start = IM->Index + start; VB->IndexPtr[0] = &tmp->Index; } - if (inputs & VERT_FOG_COORD) { - tmp->FogCoord.data = IM->FogCoord + start; - tmp->FogCoord.start = IM->FogCoord + start; + if (inputs & VERT_BIT_FOG) { + tmp->FogCoord.data = IM->Attrib[VERT_ATTRIB_FOG] + start; + tmp->FogCoord.start = (GLfloat *) (IM->Attrib[VERT_ATTRIB_FOG] + start); tmp->FogCoord.count = count; VB->FogCoordPtr = &tmp->FogCoord; } - if (inputs & VERT_SPEC_RGB) { - tmp->SecondaryColor.Ptr = IM->SecondaryColor + start; + if (inputs & VERT_BIT_COLOR1) { + tmp->SecondaryColor.Ptr = IM->Attrib[VERT_ATTRIB_COLOR1] + start; VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; } - if (inputs & VERT_EDGE) { + if (inputs & VERT_BIT_EDGEFLAG) { VB->EdgeFlag = IM->EdgeFlag + start; } - if (inputs & VERT_RGBA) { - if (IM->CopyOrFlag & VERT_RGBA) { - tmp->Color.Ptr = IM->Color + start; + if (inputs & VERT_BIT_COLOR0) { + if (IM->CopyOrFlag & VERT_BIT_COLOR0) { + tmp->Color.Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start; tmp->Color.StrideB = 4 * sizeof(GLfloat); tmp->Color.Flags = 0; - } else { - tmp->Color.Ptr = ctx->Current.Color; + } + else { + tmp->Color.Ptr = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; tmp->Color.StrideB = 0; tmp->Color.Flags = CA_CLIENT_DATA; /* hack */ VB->import_source = IM; - VB->importable_data |= VERT_RGBA; + VB->importable_data |= VERT_BIT_COLOR0; VB->import_data = _tnl_upgrade_current_data; } VB->ColorPtr[0] = &tmp->Color; } - if (inputs & VERT_TEX_ANY) { + if (inputs & VERT_BITS_TEX_ANY) { GLuint i; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - VB->TexCoordPtr[i] = 0; - if (inputs & VERT_TEX(i)) { + VB->TexCoordPtr[i] = NULL; + if (inputs & VERT_BIT_TEX(i)) { tmp->TexCoord[i].count = count; - tmp->TexCoord[i].data = IM->TexCoord[i] + start; - tmp->TexCoord[i].start = (GLfloat *)(IM->TexCoord[i] + start); + tmp->TexCoord[i].data = IM->Attrib[VERT_ATTRIB_TEX0 + i] + start; + tmp->TexCoord[i].start = (GLfloat *)(IM->Attrib[VERT_ATTRIB_TEX0 + i] + start); tmp->TexCoord[i].size = 2; if (IM->TexSize & TEX_SIZE_3(i)) { tmp->TexCoord[i].size = 3; @@ -347,27 +359,38 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) } } - if ((inputs & IM->OrFlag & VERT_MATERIAL) && IM->Material) { + if ((inputs & IM->OrFlag & VERT_BIT_MATERIAL) && IM->Material) { VB->MaterialMask = IM->MaterialMask + start; VB->Material = IM->Material + start; } + + /* GL_NV_vertex_program */ + if (ctx->VertexProgram.Enabled) { + GLuint attr; + for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { + tmp->Attribs[attr].count = count; + tmp->Attribs[attr].data = IM->Attrib[attr] + start; + tmp->Attribs[attr].start = (GLfloat *) (IM->Attrib[attr] + start); + tmp->Attribs[attr].size = 4; + VB->AttribPtr[attr] = &(tmp->Attribs[attr]); + } + } } -/* Called by exec_vert_cassette, execute_compiled_cassette, but not +/** + * Called by exec_vert_cassette, execute_compiled_cassette, but not * exec_elt_cassette. */ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ) { TNLcontext *tnl = TNL_CONTEXT(ctx); -/* fprintf(stderr, "%s\n", __FUNCTION__); */ - _tnl_vb_bind_immediate( ctx, IM ); - if (IM->OrFlag & VERT_EVAL_ANY) + if (IM->OrFlag & VERT_BITS_EVAL_ANY) _tnl_eval_immediate( ctx, IM ); /* Invalidate all stored data before and after run: @@ -380,12 +403,11 @@ void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ) } -/* Called for regular vertex cassettes. +/** + * Called for regular vertex cassettes. */ static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ - if (IM->FlushElt) { /* Orflag is computed twice, but only reach this code if app is * using a mixture of glArrayElement() and glVertex() while @@ -403,7 +425,7 @@ static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) } -/* Called for pure, locked VERT_ELT cassettes instead of +/* Called for pure, locked VERT_BIT_ELT cassettes instead of * _tnl_run_cassette. */ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) @@ -411,8 +433,6 @@ static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; -/* fprintf(stderr, "%s\n", __FUNCTION__); */ - _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); /* Take only elements and primitive information from the immediate: @@ -446,7 +466,8 @@ exec_empty_cassette( GLcontext *ctx, struct immediate *IM ) -/* Called for all cassettes when not compiling or playing a display +/** + * Called for all cassettes when not compiling or playing a display * list. */ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) @@ -463,7 +484,7 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) if (IM->CopyStart == IM->Count) { exec_empty_cassette( ctx, IM ); } - else if ((IM->CopyOrFlag & VERT_DATA) == VERT_ELT && + else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT && ctx->Array.LockCount && ctx->Array.Vertex.Enabled) { exec_elt_cassette( ctx, IM ); @@ -492,15 +513,13 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES; - -/* fprintf(stderr, "%s: NeedFlush: %x\n", __FUNCTION__, */ -/* ctx->Driver.NeedFlush); */ } -/* Setup vector pointers that will be used to bind immediates to VB's. +/** + * Setup vector pointers that will be used to bind immediates to VB's. */ void _tnl_imm_init( GLcontext *ctx ) { @@ -524,23 +543,23 @@ void _tnl_imm_init( GLcontext *ctx ) TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS; _mesa_vector4f_init( &tmp->Obj, 0, 0 ); - _mesa_vector3f_init( &tmp->Normal, 0, 0 ); + _mesa_vector4f_init( &tmp->Normal, 0, 0 ); - tmp->Color.Ptr = 0; + tmp->Color.Ptr = NULL; tmp->Color.Type = GL_FLOAT; tmp->Color.Size = 4; tmp->Color.Stride = 0; tmp->Color.StrideB = 4 * sizeof(GLfloat); tmp->Color.Flags = 0; - tmp->SecondaryColor.Ptr = 0; + tmp->SecondaryColor.Ptr = NULL; tmp->SecondaryColor.Type = GL_FLOAT; tmp->SecondaryColor.Size = 4; tmp->SecondaryColor.Stride = 0; tmp->SecondaryColor.StrideB = 4 * sizeof(GLfloat); tmp->SecondaryColor.Flags = 0; - _mesa_vector1f_init( &tmp->FogCoord, 0, 0 ); + _mesa_vector4f_init( &tmp->FogCoord, 0, 0 ); _mesa_vector1ui_init( &tmp->Index, 0, 0 ); _mesa_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); @@ -556,6 +575,10 @@ void _tnl_imm_init( GLcontext *ctx ) } +/** + * Deallocate the immediate-mode buffer for the given context, if + * its reference count goes to zero. + */ void _tnl_imm_destroy( GLcontext *ctx ) { if (TNL_CURRENT_IM(ctx)) { @@ -569,6 +592,6 @@ void _tnl_imm_destroy( GLcontext *ctx ) * So we just set the context's own tnl immediate pointer * to 0. */ - ctx->swtnl_im = 0; + ctx->swtnl_im = NULL; } } diff --git a/xc/extras/Mesa/src/tnl/t_imm_exec.h b/xc/extras/Mesa/src/tnl/t_imm_exec.h index b4ecb9a1b..6b3c65f4c 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_exec.h +++ b/xc/extras/Mesa/src/tnl/t_imm_exec.h @@ -1,4 +1,3 @@ -/* $Id: t_imm_exec.h,v 1.1.1.1 2002/10/22 13:06:24 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -38,7 +37,7 @@ extern void _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags ); /* Called from imm_api.c and _tnl_flush_vertices: */ -extern void _tnl_flush_immediate( struct immediate *IM ); +extern void _tnl_flush_immediate( GLcontext *ctx, struct immediate *IM ); /* Called from imm_dlist.c and _tnl_flush_immediate: */ diff --git a/xc/extras/Mesa/src/tnl/t_imm_fixup.c b/xc/extras/Mesa/src/tnl/t_imm_fixup.c index 0ce42b458..ca5a2a554 100644 --- a/xc/extras/Mesa/src/tnl/t_imm_fixup.c +++ b/xc/extras/Mesa/src/tnl/t_imm_fixup.c @@ -1,8 +1,7 @@ -/* $Id: t_imm_fixup.c,v 1.1.1.1 2002/10/22 13:06:20 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -26,7 +25,7 @@ /* * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -37,7 +36,7 @@ #include "colormac.h" #include "light.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "state.h" #include "mtypes.h" @@ -65,7 +64,7 @@ _tnl_fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match ) for (;;) { if ((flag[++i] & match) == 0) { COPY_4FV(data[i], data[i-1]); - if (flag[i] & VERT_END_VB) break; + if (flag[i] & VERT_BIT_END_VB) break; } } } @@ -78,13 +77,13 @@ _tnl_fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match ) for (;;) { if ((flag[++i] & match) == 0) { -/* fprintf(stderr, "_tnl_fixup_3f copy to %p values %f %f %f\n", */ +/* _mesa_debug(NULL, "_tnl_fixup_3f copy to %p values %f %f %f\n", */ /* data[i], */ /* data[i-1][0], */ /* data[i-1][1], */ /* data[i-1][2]); */ COPY_3V(data[i], data[i-1]); - if (flag[i] & VERT_END_VB) break; + if (flag[i] & VERT_BIT_END_VB) break; } } } @@ -98,7 +97,7 @@ _tnl_fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match ) for (;;) { if ((flag[++i] & match) == 0) { data[i] = data[i-1]; - if (flag[i] & VERT_END_VB) break; + if (flag[i] & VERT_BIT_END_VB) break; } } flag[i] |= match; @@ -113,7 +112,7 @@ _tnl_fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match ) for (;;) { if ((flag[++i] & match) == 0) { data[i] = data[i-1]; - if (flag[i] & VERT_END_VB) break; + if (flag[i] & VERT_BIT_END_VB) break; } } flag[i] |= match; @@ -127,7 +126,7 @@ _tnl_fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match ) for (;;) { if ((flag[++i] & match) == 0) { data[i] = data[i-1]; - if (flag[i] & VERT_END_VB) break; + if (flag[i] & VERT_BIT_END_VB) break; } } flag[i] |= match; @@ -139,94 +138,114 @@ fixup_first_4f( GLfloat data[][4], GLuint flag[], GLuint match, GLuint start, GLfloat *dflt ) { GLuint i = start-1; - match |= VERT_END_VB; + match |= VERT_BIT_END_VB; while ((flag[++i]&match) == 0) COPY_4FV(data[i], dflt); } +#if 0 static void fixup_first_3f( GLfloat data[][3], GLuint flag[], GLuint match, GLuint start, GLfloat *dflt ) { GLuint i = start-1; - match |= VERT_END_VB; + match |= VERT_BIT_END_VB; -/* fprintf(stderr, "fixup_first_3f default: %f %f %f start: %d\n", */ +/* _mesa_debug(NULL, "fixup_first_3f default: %f %f %f start: %d\n", */ /* dflt[0], dflt[1], dflt[2], start); */ while ((flag[++i]&match) == 0) COPY_3FV(data[i], dflt); } - +#endif static void fixup_first_1ui( GLuint data[], GLuint flag[], GLuint match, GLuint start, GLuint dflt ) { GLuint i = start-1; - match |= VERT_END_VB; + match |= VERT_BIT_END_VB; while ((flag[++i]&match) == 0) data[i] = dflt; } +#if 00 static void fixup_first_1f( GLfloat data[], GLuint flag[], GLuint match, GLuint start, GLfloat dflt ) { GLuint i = start-1; - match |= VERT_END_VB; + match |= VERT_BIT_END_VB; while ((flag[++i]&match) == 0) data[i] = dflt; } - +#endif static void fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match, GLuint start, GLubyte dflt ) { GLuint i = start-1; - match |= VERT_END_VB; + match |= VERT_BIT_END_VB; while ((flag[++i]&match) == 0) data[i] = dflt; } +/* + * Copy vertex attributes from the ctx->Current group into the immediate + * struct at the given position according to copyMask. + */ static void copy_from_current( GLcontext *ctx, struct immediate *IM, - GLuint start, GLuint copy ) + GLuint pos, GLuint copyMask ) { + GLuint attrib, attribBit; + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) - _tnl_print_vert_flags("copy from current", copy); + _tnl_print_vert_flags("copy from current", copyMask); - if (copy & VERT_NORM) { - COPY_3V( IM->Normal[start], ctx->Current.Normal ); +#if 0 + if (copyMask & VERT_BIT_NORMAL) { + COPY_4V(IM->Attrib[VERT_ATTRIB_NORMAL][pos], + ctx->Current.Attrib[VERT_ATTRIB_NORMAL]); } - if (copy & VERT_RGBA) { - COPY_4FV( IM->Color[start], ctx->Current.Color); + if (copyMask & VERT_BIT_COLOR0) { + COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][pos], + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } - if (copy & VERT_SPEC_RGB) - COPY_4FV( IM->SecondaryColor[start], ctx->Current.SecondaryColor); + if (copyMask & VERT_BIT_COLOR1) + COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR1][pos], + ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); - if (copy & VERT_FOG_COORD) - IM->FogCoord[start] = ctx->Current.FogCoord; + if (copyMask & VERT_BIT_FOG) + IM->Attrib[VERT_ATTRIB_FOG][pos][0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - if (copy & VERT_INDEX) - IM->Index[start] = ctx->Current.Index; - - if (copy & VERT_EDGE) - IM->EdgeFlag[start] = ctx->Current.EdgeFlag; - - if (copy & VERT_TEX_ANY) { + if (copyMask & VERT_BITS_TEX_ANY) { GLuint i; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (copy & VERT_TEX(i)) - COPY_4FV( IM->TexCoord[i][start], ctx->Current.Texcoord[i] ); + if (copyMask & VERT_BIT_TEX(i)) + COPY_4FV(IM->Attrib[VERT_ATTRIB_TEX0 + i][pos], + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i]); + } + } +#else + for (attrib = 0, attribBit = 1; attrib < 16; attrib++, attribBit <<= 1) { + if (copyMask & attribBit) { + COPY_4FV( IM->Attrib[attrib][pos], ctx->Current.Attrib[attrib]); } } +#endif + + if (copyMask & VERT_BIT_INDEX) + IM->Index[pos] = ctx->Current.Index; + + if (copyMask & VERT_BIT_EDGEFLAG) + IM->EdgeFlag[pos] = ctx->Current.EdgeFlag; } @@ -240,13 +259,13 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) IM->CopyTexSize = IM->TexSize; -/* fprintf(stderr, "Fixup input, Start: %u Count: %u LastData: %u\n", */ +/* _mesa_debug(ctx, "Fixup input, Start: %u Count: %u LastData: %u\n", */ /* IM->Start, IM->Count, IM->LastData); */ /* _tnl_print_vert_flags("Orflag", orflag); */ /* _tnl_print_vert_flags("Andflag", andflag); */ - fixup = ~andflag & VERT_FIXUP; + fixup = ~andflag & VERT_BITS_FIXUP; if (!ctx->CompileFlag) fixup &= tnl->pipeline.inputs; @@ -254,7 +273,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) if (!ctx->ExecuteFlag) fixup &= orflag; - if ((orflag & (VERT_OBJ|VERT_EVAL_ANY)) == 0) + if ((orflag & (VERT_BIT_POS|VERT_BITS_EVAL_ANY)) == 0) fixup = 0; if (fixup) { @@ -270,75 +289,84 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) if (MESA_VERBOSE&VERBOSE_IMMEDIATE) _tnl_print_vert_flags("fixup", fixup); - if (fixup & VERT_TEX_ANY) { + /* XXX replace these conditionals with a loop over the 16 + * vertex attributes. + */ + + if (fixup & VERT_BITS_TEX_ANY) { GLuint i; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (fixup & VERT_TEX(i)) { - if (orflag & VERT_TEX(i)) - _tnl_fixup_4f( IM->TexCoord[i], IM->Flag, start, - VERT_TEX(i) ); + if (fixup & VERT_BIT_TEX(i)) { + if (orflag & VERT_BIT_TEX(i)) + _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag, + start, VERT_BIT_TEX(i) ); else - fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_END_VB, start, - IM->TexCoord[i][start]); + fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag, + VERT_BIT_END_VB, start, + IM->Attrib[VERT_ATTRIB_TEX0 + i][start]); } } } - if (fixup & VERT_EDGE) { - if (orflag & VERT_EDGE) - _tnl_fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGE ); + if (fixup & VERT_BIT_EDGEFLAG) { + if (orflag & VERT_BIT_EDGEFLAG) + _tnl_fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_BIT_EDGEFLAG ); else - fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_END_VB, start, + fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_BIT_END_VB, start, IM->EdgeFlag[start] ); } - if (fixup & VERT_INDEX) { - if (orflag & VERT_INDEX) - _tnl_fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX ); + if (fixup & VERT_BIT_INDEX) { + if (orflag & VERT_BIT_INDEX) + _tnl_fixup_1ui( IM->Index, IM->Flag, start, VERT_BIT_INDEX ); else - fixup_first_1ui( IM->Index, IM->Flag, VERT_END_VB, start, + fixup_first_1ui( IM->Index, IM->Flag, VERT_BIT_END_VB, start, IM->Index[start] ); } - if (fixup & VERT_RGBA) { - if (orflag & VERT_RGBA) - _tnl_fixup_4f( IM->Color, IM->Flag, start, VERT_RGBA ); + if (fixup & VERT_BIT_COLOR0) { + if (orflag & VERT_BIT_COLOR0) + _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, start, + VERT_BIT_COLOR0 ); /* No need for else case as the drivers understand stride * zero here. (TODO - propogate this) */ } - if (fixup & VERT_SPEC_RGB) { - if (orflag & VERT_SPEC_RGB) - _tnl_fixup_4f( IM->SecondaryColor, IM->Flag, start, - VERT_SPEC_RGB ); + if (fixup & VERT_BIT_COLOR1) { + if (orflag & VERT_BIT_COLOR1) + _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, start, + VERT_BIT_COLOR1 ); else - fixup_first_4f( IM->SecondaryColor, IM->Flag, VERT_END_VB, start, - IM->SecondaryColor[start] ); + fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, VERT_BIT_END_VB, start, + IM->Attrib[VERT_ATTRIB_COLOR1][start] ); } - if (fixup & VERT_FOG_COORD) { - if (orflag & VERT_FOG_COORD) - _tnl_fixup_1f( IM->FogCoord, IM->Flag, start, VERT_FOG_COORD ); + if (fixup & VERT_BIT_FOG) { + if (orflag & VERT_BIT_FOG) + _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, + start, VERT_BIT_FOG ); else - fixup_first_1f( IM->FogCoord, IM->Flag, VERT_END_VB, start, - IM->FogCoord[start] ); + fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, VERT_BIT_END_VB, + start, IM->Attrib[VERT_ATTRIB_FOG][start] ); } - if (fixup & VERT_NORM) { - if (orflag & VERT_NORM) - _tnl_fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM ); + if (fixup & VERT_BIT_NORMAL) { + if (orflag & VERT_BIT_NORMAL) + _tnl_fixup_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, start, + VERT_BIT_NORMAL ); else - fixup_first_3f( IM->Normal, IM->Flag, VERT_END_VB, start, - IM->Normal[start] ); + fixup_first_4f( IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, + VERT_BIT_END_VB, start, + IM->Attrib[VERT_ATTRIB_NORMAL][start] ); } } /* Prune possible half-filled slot. */ - IM->Flag[IM->LastData+1] &= ~VERT_END_VB; - IM->Flag[IM->Count] |= VERT_END_VB; + IM->Flag[IM->LastData+1] &= ~VERT_BIT_END_VB; + IM->Flag[IM->Count] |= VERT_BIT_END_VB; /* Materials: @@ -348,7 +376,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) GLuint i = IM->Start; do { - while (!(IM->Flag[i] & VERT_MATERIAL)) + while (!(IM->Flag[i] & VERT_BIT_MATERIAL)) i++; vulnerable &= ~IM->MaterialMask[i]; @@ -363,24 +391,26 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) } - - -static void copy_material( struct immediate *next, - struct immediate *prev, - GLuint dst, GLuint src ) +static void +copy_material( struct immediate *next, + struct immediate *prev, + GLuint dst, GLuint src ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ +/* _mesa_debug(NULL, "%s\n", __FUNCTION__); */ if (next->Material == 0) { - next->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) * - IMM_SIZE * 2 ); + next->Material = (struct gl_material (*)[2]) + MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 ); next->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); } next->MaterialMask[dst] = prev->MaterialOrMask; - MEMCPY(next->Material[dst], prev->Material[src], 2*sizeof(GLmaterial)); + MEMCPY(next->Material[dst], prev->Material[src], + 2 * sizeof(struct gl_material)); } + + static GLboolean is_fan_like[GL_POLYGON+1] = { GL_FALSE, GL_FALSE, @@ -421,7 +451,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) next->CopyStart = next->Start - count; - if ((prev->CopyOrFlag & VERT_DATA) == VERT_ELT && + if ((prev->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT && ctx->Array.LockCount && ctx->Array.Vertex.Enabled) { @@ -432,25 +462,25 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) GLuint src = elts[i+offset]; GLuint dst = next->CopyStart+i; next->Elt[dst] = prev->Elt[src]; - next->Flag[dst] = VERT_ELT; + next->Flag[dst] = VERT_BIT_ELT; elts[i+offset] = dst; } -/* fprintf(stderr, "ADDING VERT_ELT!\n"); */ - next->CopyOrFlag |= VERT_ELT; - next->CopyAndFlag &= VERT_ELT; +/* _mesa_debug(ctx, "ADDING VERT_BIT_ELT!\n"); */ + next->CopyOrFlag |= VERT_BIT_ELT; + next->CopyAndFlag &= VERT_BIT_ELT; } else { GLuint copy = tnl->pipeline.inputs & (prev->CopyOrFlag|prev->Evaluated); GLuint flag; if (is_fan_like[ctx->Driver.CurrentExecPrimitive]) { - flag = ((prev->CopyOrFlag|prev->Evaluated) & VERT_FIXUP); + flag = ((prev->CopyOrFlag|prev->Evaluated) & VERT_BITS_FIXUP); next->CopyOrFlag |= flag; } else { /* Don't let an early 'glColor', etc. poison the elt path. */ - flag = ((prev->OrFlag|prev->Evaluated) & VERT_FIXUP); + flag = ((prev->OrFlag|prev->Evaluated) & VERT_BITS_FIXUP); } next->TexSize |= tnl->ExecCopyTexSize; @@ -474,30 +504,31 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) * * Note these pointers are null when inactive. */ - COPY_4FV( next->Obj[dst], inputs->Obj.data[isrc] ); + COPY_4FV( next->Attrib[VERT_ATTRIB_POS][dst], + inputs->Obj.data[isrc] ); - if (copy & VERT_NORM) { -/* fprintf(stderr, "copy vert norm %d to %d (%p): %f %f %f\n", */ + if (copy & VERT_BIT_NORMAL) { +/* _mesa_debug(ctx, "copy vert norm %d to %d (%p): %f %f %f\n", */ /* isrc, dst, */ /* next->Normal[dst], */ /* inputs->Normal.data[isrc][0], */ /* inputs->Normal.data[isrc][1], */ /* inputs->Normal.data[isrc][2]); */ - COPY_3FV( next->Normal[dst], inputs->Normal.data[isrc] ); + COPY_3FV( next->Attrib[VERT_ATTRIB_NORMAL][dst], inputs->Normal.data[isrc] ); } - if (copy & VERT_RGBA) - COPY_4FV( next->Color[dst], + if (copy & VERT_BIT_COLOR0) + COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR0][dst], ((GLfloat (*)[4])inputs->Color.Ptr)[isrc] ); - if (copy & VERT_INDEX) + if (copy & VERT_BIT_INDEX) next->Index[dst] = inputs->Index.data[isrc]; - if (copy & VERT_TEX_ANY) { + if (copy & VERT_BITS_TEX_ANY) { GLuint i; for (i = 0 ; i < prev->MaxTextureUnits ; i++) { - if (copy & VERT_TEX(i)) - COPY_4FV( next->TexCoord[i][dst], + if (copy & VERT_BIT_TEX(i)) + COPY_4FV( next->Attrib[VERT_ATTRIB_TEX0 + i][dst], inputs->TexCoord[i].data[isrc] ); } } @@ -505,29 +536,31 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) /* Remaining values should be the same in the 'input' struct and the * original immediate. */ - if (copy & (VERT_ELT|VERT_EDGE|VERT_SPEC_RGB|VERT_FOG_COORD| - VERT_MATERIAL)) { + if (copy & (VERT_BIT_ELT|VERT_BIT_EDGEFLAG|VERT_BIT_COLOR1|VERT_BIT_FOG| + VERT_BIT_MATERIAL)) { - if (prev->Flag[src] & VERT_MATERIAL) + if (prev->Flag[src] & VERT_BIT_MATERIAL) copy_material(next, prev, dst, src); next->Elt[dst] = prev->Elt[src]; next->EdgeFlag[dst] = prev->EdgeFlag[src]; - COPY_4FV( next->SecondaryColor[dst], prev->SecondaryColor[src] ); - next->FogCoord[dst] = prev->FogCoord[src]; + COPY_4FV( next->Attrib[VERT_ATTRIB_COLOR1][dst], + prev->Attrib[VERT_ATTRIB_COLOR1][src] ); + COPY_4FV( next->Attrib[VERT_ATTRIB_FOG][dst], + prev->Attrib[VERT_ATTRIB_FOG][src] ); } next->Flag[dst] = flag; - next->CopyOrFlag |= prev->Flag[src] & (VERT_FIXUP| - VERT_MATERIAL| - VERT_OBJ); - elts[i+offset] = dst; + next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP| + VERT_BIT_MATERIAL| + VERT_BIT_POS); + elts[i+offset] = dst; } } if (--tnl->ExecCopySource->ref_count == 0) _tnl_free_immediate( ctx, tnl->ExecCopySource ); - + tnl->ExecCopySource = next; next->ref_count++; } @@ -544,7 +577,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) GLuint fixup; GLuint start = IM->Start; -/* fprintf(stderr, "%s\n", __FUNCTION__); */ +/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ IM->Evaluated = 0; IM->CopyOrFlag = IM->OrFlag; @@ -560,7 +593,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) /* Naked array elements can be copied into the first cassette in a * display list. Need to translate them away: */ - if (IM->CopyOrFlag & VERT_ELT) { + if (IM->CopyOrFlag & VERT_BIT_ELT) { GLuint copy = tnl->pipeline.inputs & ~ctx->Array._Enabled; GLuint i; @@ -574,49 +607,59 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) _tnl_copy_to_current( ctx, IM, ctx->Array._Enabled, IM->Start ); } - fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_FIXUP; + fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_BITS_FIXUP; /* _tnl_print_vert_flags("fixup compiled", fixup); */ if (fixup) { - if (fixup & VERT_TEX_ANY) { - GLuint i; - for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (fixup & VERT_TEX(i)) - fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_TEX(i), start, - ctx->Current.Texcoord[i] ); - } - } - if (fixup & VERT_EDGE) - fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGE, start, - ctx->Current.EdgeFlag ); + /* XXX try to replace this code with a loop over the 16 vertex + * attributes. + */ - if (fixup & VERT_INDEX) - fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX, start, - ctx->Current.Index ); + if (fixup & VERT_BIT_NORMAL) { + fixup_first_4f(IM->Attrib[VERT_ATTRIB_NORMAL], IM->Flag, + VERT_BIT_NORMAL, start, + ctx->Current.Attrib[VERT_ATTRIB_NORMAL] ); + } - if (fixup & VERT_RGBA) { - if (IM->CopyOrFlag & VERT_RGBA) - fixup_first_4f(IM->Color, IM->Flag, VERT_RGBA, start, - ctx->Current.Color ); + if (fixup & VERT_BIT_COLOR0) { + if (IM->CopyOrFlag & VERT_BIT_COLOR0) + fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, + VERT_BIT_COLOR0, start, + ctx->Current.Attrib[VERT_ATTRIB_COLOR0] ); else - fixup &= ~VERT_RGBA; + fixup &= ~VERT_BIT_COLOR0; } - if (fixup & VERT_SPEC_RGB) - fixup_first_4f(IM->SecondaryColor, IM->Flag, VERT_SPEC_RGB, start, - ctx->Current.SecondaryColor ); + if (fixup & VERT_BIT_COLOR1) + fixup_first_4f(IM->Attrib[VERT_ATTRIB_COLOR1], IM->Flag, + VERT_BIT_COLOR1, start, + ctx->Current.Attrib[VERT_ATTRIB_COLOR1] ); - if (fixup & VERT_FOG_COORD) - fixup_first_1f(IM->FogCoord, IM->Flag, VERT_FOG_COORD, start, - ctx->Current.FogCoord ); + if (fixup & VERT_BIT_FOG) + fixup_first_4f( IM->Attrib[VERT_ATTRIB_FOG], IM->Flag, + VERT_BIT_FOG, start, + ctx->Current.Attrib[VERT_ATTRIB_FOG] ); - if (fixup & VERT_NORM) { - fixup_first_3f(IM->Normal, IM->Flag, VERT_NORM, start, - ctx->Current.Normal ); + if (fixup & VERT_BITS_TEX_ANY) { + GLuint i; + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (fixup & VERT_BIT_TEX(i)) + fixup_first_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i], IM->Flag, + VERT_BIT_TEX(i), start, + ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i] ); + } } + if (fixup & VERT_BIT_EDGEFLAG) + fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_BIT_EDGEFLAG, start, + ctx->Current.EdgeFlag ); + + if (fixup & VERT_BIT_INDEX) + fixup_first_1ui(IM->Index, IM->Flag, VERT_BIT_INDEX, start, + ctx->Current.Index ); + IM->CopyOrFlag |= fixup; } @@ -628,7 +671,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) GLuint i = IM->Start; do { - while (!(IM->Flag[i] & VERT_MATERIAL)) + while (!(IM->Flag[i] & VERT_BIT_MATERIAL)) i++; vulnerable &= ~IM->MaterialMask[i]; @@ -724,7 +767,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) GLuint pintro = intro[prim]; GLuint ovf = 0; -/* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */ +/* _mesa_debug(ctx, "_tnl_get_exec_copy_verts %s\n", */ /* _mesa_lookup_enum_by_nr(prim)); */ if (tnl->ExecCopySource) @@ -748,6 +791,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) tnl->ExecParity ^= IM->PrimitiveLength[IM->LastPrimitive] & 1; + if (pincr != 1 && (IM->Count - last - pintro)) ovf = (IM->Count - last - pintro) % pincr; @@ -801,24 +845,26 @@ void _tnl_upgrade_current_data( GLcontext *ctx, /* _tnl_print_vert_flags("_tnl_upgrade_client_data", required); */ - if ((required & VERT_RGBA) && (VB->ColorPtr[0]->Flags & CA_CLIENT_DATA)) { + if ((required & VERT_BIT_COLOR0) && (VB->ColorPtr[0]->Flags & CA_CLIENT_DATA)) { struct gl_client_array *tmp = &tnl->imm_inputs.Color; GLuint start = IM->CopyStart; - tmp->Ptr = IM->Color + start; + tmp->Ptr = IM->Attrib[VERT_ATTRIB_COLOR0] + start; tmp->StrideB = 4 * sizeof(GLfloat); tmp->Flags = 0; - COPY_4FV( IM->Color[start], ctx->Current.Color); + COPY_4FV( IM->Attrib[VERT_ATTRIB_COLOR0][start], + ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); /* - ASSERT(IM->Flag[IM->LastData+1] & VERT_END_VB); + ASSERT(IM->Flag[IM->LastData+1] & VERT_BIT_END_VB); */ - fixup_first_4f( IM->Color, IM->Flag, VERT_END_VB, start, - IM->Color[start] ); + fixup_first_4f( IM->Attrib[VERT_ATTRIB_COLOR0], IM->Flag, + VERT_BIT_END_VB, + start, IM->Attrib[VERT_ATTRIB_COLOR0][start] ); - VB->importable_data &= ~VERT_RGBA; + VB->importable_data &= ~VERT_BIT_COLOR0; } } diff --git a/xc/extras/Mesa/src/tnl/t_pipeline.c b/xc/extras/Mesa/src/tnl/t_pipeline.c index dcd4b27a0..144710e51 100644 --- a/xc/extras/Mesa/src/tnl/t_pipeline.c +++ b/xc/extras/Mesa/src/tnl/t_pipeline.c @@ -1,4 +1,3 @@ -/* $Id: t_pipeline.c,v 1.1.1.1 2002/10/22 13:06:18 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,12 +23,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "glheader.h" #include "context.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "state.h" #include "mtypes.h" @@ -186,7 +185,7 @@ void _tnl_run_pipeline( GLcontext *ctx ) * * - inserting optimized (but specialized) stages ahead of the * general-purpose fallback implementation. For example, the old - * fastpath mechanism, which only works when the VERT_ELT input is + * fastpath mechanism, which only works when the VERT_BIT_ELT input is * available, can be duplicated by placing the fastpath stage at the * head of this pipeline. Such specialized stages are currently * constrained to have no outputs (ie. they must either finish the * @@ -203,6 +202,9 @@ const struct gl_pipeline_stage *_tnl_default_pipeline[] = { &_tnl_texgen_stage, &_tnl_texture_transform_stage, &_tnl_point_attenuation_stage, +#if FEATURE_NV_vertex_program + &_tnl_vertex_program_stage, +#endif &_tnl_render_stage, 0 }; diff --git a/xc/extras/Mesa/src/tnl/t_pipeline.h b/xc/extras/Mesa/src/tnl/t_pipeline.h index c8b8e0a5a..9ccdb7998 100644 --- a/xc/extras/Mesa/src/tnl/t_pipeline.h +++ b/xc/extras/Mesa/src/tnl/t_pipeline.h @@ -1,4 +1,3 @@ -/* $Id: t_pipeline.h,v 1.1.1.1 2002/10/22 13:06:18 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -54,6 +53,7 @@ extern const struct gl_pipeline_stage _tnl_fog_coordinate_stage; extern const struct gl_pipeline_stage _tnl_texgen_stage; extern const struct gl_pipeline_stage _tnl_texture_transform_stage; extern const struct gl_pipeline_stage _tnl_point_attenuation_stage; +extern const struct gl_pipeline_stage _tnl_vertex_program_stage; extern const struct gl_pipeline_stage _tnl_render_stage; /* Shorthand to plug in the default pipeline: diff --git a/xc/extras/Mesa/src/tnl/t_vb_cliptmp.h b/xc/extras/Mesa/src/tnl/t_vb_cliptmp.h index 351ee782f..2484560d2 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_cliptmp.h +++ b/xc/extras/Mesa/src/tnl/t_vb_cliptmp.h @@ -1,4 +1,3 @@ -/* $Id: t_vb_cliptmp.h,v 1.1.1.1 2002/10/22 13:06:21 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -140,11 +139,11 @@ TAG(clip_line)( GLcontext *ctx, GLuint i, GLuint j, GLubyte mask ) if (mask & CLIP_USER_BIT) { for (p=0;p<MAX_CLIP_PLANES;p++) { - if (ctx->Transform.ClipEnabled[p]) { - GLfloat a = ctx->Transform._ClipUserPlane[p][0]; - GLfloat b = ctx->Transform._ClipUserPlane[p][1]; - GLfloat c = ctx->Transform._ClipUserPlane[p][2]; - GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; LINE_CLIP( CLIP_USER_BIT, a, b, c, d ); } } @@ -188,13 +187,13 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) if (mask & CLIP_USER_BIT) { for (p=0;p<MAX_CLIP_PLANES;p++) { - if (ctx->Transform.ClipEnabled[p]) { - GLfloat a = ctx->Transform._ClipUserPlane[p][0]; - GLfloat b = ctx->Transform._ClipUserPlane[p][1]; - GLfloat c = ctx->Transform._ClipUserPlane[p][2]; - GLfloat d = ctx->Transform._ClipUserPlane[p][3]; - POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); - } + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); + } } } @@ -241,11 +240,11 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, if (mask & CLIP_USER_BIT) { for (p=0;p<MAX_CLIP_PLANES;p++) { - if (ctx->Transform.ClipEnabled[p]) { - GLfloat a = ctx->Transform._ClipUserPlane[p][0]; - GLfloat b = ctx->Transform._ClipUserPlane[p][1]; - GLfloat c = ctx->Transform._ClipUserPlane[p][2]; - GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); } } diff --git a/xc/extras/Mesa/src/tnl/t_vb_fog.c b/xc/extras/Mesa/src/tnl/t_vb_fog.c index bddbc6211..d59980417 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_fog.c +++ b/xc/extras/Mesa/src/tnl/t_vb_fog.c @@ -1,10 +1,9 @@ -/* $Id: t_vb_fog.c,v 1.1.1.1 2002/10/22 13:06:22 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -32,7 +31,7 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" @@ -43,8 +42,8 @@ struct fog_stage_data { - GLvector1f fogcoord; /* has actual storage allocated */ - GLvector1f input; /* points into VB->EyePtr Z values */ + GLvector4f fogcoord; /* has actual storage allocated */ + GLvector4f input; /* points into VB->EyePtr Z values */ }; #define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) @@ -85,14 +84,14 @@ static void init_static_data( void ) } -static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, - const GLvector1f *in ) +static void make_win_fog_coords( GLcontext *ctx, GLvector4f *out, + const GLvector4f *in ) { GLfloat end = ctx->Fog.End; GLfloat *v = in->start; GLuint stride = in->stride; GLuint n = in->count; - GLfloat *data = out->data; + GLfloat (*data)[4] = out->data; GLfloat d; GLuint i; @@ -106,19 +105,19 @@ static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { GLfloat f = (end - ABSF(*v)) * d; - data[i] = CLAMP(f, 0.0F, 1.0F); + data[i][0] = CLAMP(f, 0.0F, 1.0F); } break; case GL_EXP: d = ctx->Fog.Density; for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) - NEG_EXP( data[i], d * ABSF(*v) ); + NEG_EXP( data[i][0], d * ABSF(*v) ); break; case GL_EXP2: d = ctx->Fog.Density*ctx->Fog.Density; for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { GLfloat z = *v; - NEG_EXP( data[i], d * z * z ); + NEG_EXP( data[i][0], d * z * z ); } break; default: @@ -133,7 +132,7 @@ static GLboolean run_fog_stage( GLcontext *ctx, { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct fog_stage_data *store = FOG_STAGE_DATA(stage); - GLvector1f *input; + GLvector4f *input; if (stage->changed_inputs == 0) return GL_TRUE; @@ -145,7 +144,7 @@ static GLboolean run_fog_stage( GLcontext *ctx, VB->FogCoordPtr = &store->fogcoord; if (!ctx->_NeedEyeCoords) { - GLfloat *m = ctx->ModelView.m; + const GLfloat *m = ctx->ModelviewMatrixStack.Top->m; GLfloat plane[4]; /* Use this to store calculated eye z values: @@ -160,25 +159,25 @@ static GLboolean run_fog_stage( GLcontext *ctx, /* Full eye coords weren't required, just calculate the * eye Z values. */ - _mesa_dotprod_tab[VB->ObjPtr->size]( input->data, - sizeof(GLfloat), + _mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data, + 4 * sizeof(GLfloat), VB->ObjPtr, plane ); input->count = VB->ObjPtr->count; } - else - { + else { input = &store->input; if (VB->EyePtr->size < 2) _mesa_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); - input->data = &(VB->EyePtr->data[0][2]); + input->data = (GLfloat (*)[4]) &(VB->EyePtr->data[0][2]); input->start = VB->EyePtr->start+2; input->stride = VB->EyePtr->stride; input->count = VB->EyePtr->count; } - } else { + } + else { /* use glFogCoord() coordinates */ /* source = VB->FogCoordPtr */ input = VB->FogCoordPtr; @@ -190,14 +189,15 @@ static GLboolean run_fog_stage( GLcontext *ctx, return GL_TRUE; } + static void check_fog_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - stage->active = ctx->Fog.Enabled; + stage->active = ctx->Fog.Enabled && !ctx->VertexProgram.Enabled; if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) - stage->inputs = VERT_EYE; + stage->inputs = VERT_BIT_EYE; else - stage->inputs = VERT_FOG_COORD; + stage->inputs = VERT_BIT_FOG; } @@ -213,8 +213,8 @@ static GLboolean alloc_fog_data( GLcontext *ctx, if (!store) return GL_FALSE; - _mesa_vector1f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); - _mesa_vector1f_init( &store->input, 0, 0 ); + _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); + _mesa_vector4f_init( &store->input, 0, 0 ); if (!inited) init_static_data(); @@ -230,7 +230,7 @@ static void free_fog_data( struct gl_pipeline_stage *stage ) { struct fog_stage_data *store = FOG_STAGE_DATA(stage); if (store) { - _mesa_vector1f_free( &store->fogcoord ); + _mesa_vector4f_free( &store->fogcoord ); FREE( store ); stage->privatePtr = NULL; } @@ -239,11 +239,14 @@ static void free_fog_data( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_fog_coordinate_stage = { - "build fog coordinates", - _NEW_FOG, - _NEW_FOG, - 0, 0, VERT_FOG_COORD, /* active, inputs, outputs */ - 0, 0, /* changed_inputs, private_data */ + "build fog coordinates", /* name */ + _NEW_FOG, /* check_state */ + _NEW_FOG, /* run_state */ + GL_FALSE, /* active? */ + 0, /* inputs */ + VERT_BIT_FOG, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private_data */ free_fog_data, /* dtr */ check_fog_stage, /* check */ alloc_fog_data /* run -- initially set to init. */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_light.c b/xc/extras/Mesa/src/tnl/t_vb_light.c index a38c42cf0..a75dacf54 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_light.c +++ b/xc/extras/Mesa/src/tnl/t_vb_light.c @@ -1,4 +1,3 @@ -/* $Id: t_vb_light.c,v 1.1.1.1 2002/10/22 13:06:19 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -30,7 +29,7 @@ #include "colormac.h" #include "light.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "simple_list.h" #include "mtypes.h" @@ -168,12 +167,12 @@ static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) /* Make sure we can talk about elements 0..2 in the vector we are * lighting. */ - if (stage->changed_inputs & (VERT_EYE|VERT_OBJ)) { + if (stage->changed_inputs & (VERT_BIT_EYE|VERT_BIT_POS)) { if (input->size <= 2) { if (input->flags & VEC_NOT_WRITEABLE) { - ASSERT(VB->importable_data & VERT_OBJ); + ASSERT(VB->importable_data & VERT_BIT_POS); - VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); + VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; ASSERT((input->flags & VEC_NOT_WRITEABLE) == 0); @@ -295,19 +294,19 @@ static GLboolean run_init_lighting( GLcontext *ctx, */ static void check_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - stage->active = ctx->Light.Enabled; + stage->active = ctx->Light.Enabled && !ctx->VertexProgram.Enabled; if (stage->active) { if (stage->privatePtr) stage->run = run_validate_lighting; - stage->inputs = VERT_NORM|VERT_MATERIAL; + stage->inputs = VERT_BIT_NORMAL|VERT_BIT_MATERIAL; if (ctx->Light._NeedVertices) - stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */ + stage->inputs |= VERT_BIT_EYE; /* effectively, even when lighting in obj */ if (ctx->Light.ColorMaterialEnabled) - stage->inputs |= VERT_RGBA; + stage->inputs |= VERT_BIT_COLOR0; - stage->outputs = VERT_RGBA; + stage->outputs = VERT_BIT_COLOR0; if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) - stage->outputs |= VERT_SPEC_RGB; + stage->outputs |= VERT_BIT_COLOR1; } } @@ -334,13 +333,16 @@ static void dtr( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_lighting_stage = { - "lighting", + "lighting", /* name */ _NEW_LIGHT, /* recheck */ _NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency * otherwise not captured by inputs - * (which may be VERT_OBJ) */ - 0,0,0, /* active, inputs, outputs */ - 0,0, /* changed_inputs, private_data */ + * (which may be VERT_BIT_POS) */ + GL_FALSE, /* active? */ + 0, /* inputs */ + 0, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private_data */ dtr, /* destroy */ check_lighting, /* check */ run_init_lighting /* run -- initially set to ctr */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h b/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h index 5618d4af7..c0ef45cce 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h +++ b/xc/extras/Mesa/src/tnl/t_vb_lighttmp.h @@ -1,8 +1,7 @@ -/* $Id: t_vb_lighttmp.h,v 1.1.1.1 2002/10/22 13:06:22 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -25,32 +24,32 @@ * * * Authors: - * Brian Paul <brianp@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Brian Paul + * Keith Whitwell <keith@tungstengraphics.com> */ #if (IDX & LIGHT_FLAGS) # define VSTRIDE (4 * sizeof(GLfloat)) -# define NSTRIDE (3 * sizeof(GLfloat)) -# define CHECK_MATERIAL(x) (flags[x] & VERT_MATERIAL) -# define CHECK_END_VB(x) (flags[x] & VERT_END_VB) +# define NSTRIDE nstride /*(3 * sizeof(GLfloat))*/ +# define CHECK_MATERIAL(x) (flags[x] & VERT_BIT_MATERIAL) +# define CHECK_END_VB(x) (flags[x] & VERT_BIT_END_VB) # if (IDX & LIGHT_COLORMATERIAL) # define CMSTRIDE STRIDE_F(CMcolor, CMstride) -# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_RGBA) -# define CHECK_VALIDATE(x) (flags[x] & (VERT_RGBA|VERT_MATERIAL)) +# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_BIT_COLOR0) +# define CHECK_VALIDATE(x) (flags[x] & (VERT_BIT_COLOR0|VERT_BIT_MATERIAL)) # define DO_ANOTHER_NORMAL(x) \ - ((flags[x] & (VERT_RGBA|VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == VERT_NORM) + ((flags[x] & (VERT_BIT_COLOR0|VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == VERT_BIT_NORMAL) # define REUSE_LIGHT_RESULTS(x) \ - ((flags[x] & (VERT_RGBA|VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == 0) + ((flags[x] & (VERT_BIT_COLOR0|VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == 0) # else # define CMSTRIDE (void)0 # define CHECK_COLOR_MATERIAL(x) 0 -# define CHECK_VALIDATE(x) (flags[x] & (VERT_MATERIAL)) +# define CHECK_VALIDATE(x) (flags[x] & (VERT_BIT_MATERIAL)) # define DO_ANOTHER_NORMAL(x) \ - ((flags[x] & (VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == VERT_NORM) + ((flags[x] & (VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == VERT_BIT_NORMAL) # define REUSE_LIGHT_RESULTS(x) \ - ((flags[x] & (VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == 0) + ((flags[x] & (VERT_BIT_NORMAL|VERT_BIT_END_VB|VERT_BIT_MATERIAL)) == 0) # endif #else # define VSTRIDE vstride @@ -80,7 +79,15 @@ #endif +/* define TRACE if to trace lighting code */ + +/* + * ctx is the current context + * VB is the vertex buffer + * stage is the lighting stage-private data + * input is the vector of eye or object-space vertex coordinates + */ static void TAG(light_rgba_spec)( GLcontext *ctx, struct vertex_buffer *VB, struct gl_pipeline_stage *stage, @@ -89,12 +96,11 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLfloat (*base)[3] = ctx->Light._BaseColor; GLchan sumA[2]; - GLuint j; - GLuint vstride = input->stride; + const GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *)input->data; - GLuint nstride = VB->NormalPtr->stride; + const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat *CMcolor; @@ -104,23 +110,19 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; GLchan (*Fspec)[4] = (GLchan (*)[4]) store->LitSecondary[0].Ptr; GLchan (*Bspec)[4] = (GLchan (*)[4]) store->LitSecondary[1].Ptr; - GLchan (*spec[2])[4]; - GLuint nr = VB->Count; - GLuint *flags = VB->Flag; + const GLuint nr = VB->Count; + const GLuint *flags = VB->Flag; struct gl_material (*new_material)[2] = VB->Material; - GLuint *new_material_mask = VB->MaterialMask; + const GLuint *new_material_mask = VB->MaterialMask; (void) flags; (void) nstride; (void) vstride; - - if (MESA_VERBOSE & VERBOSE_LIGHTING) - fprintf(stderr, "%s\n", __FUNCTION__ ); - - spec[0] = Fspec; - spec[1] = Bspec; +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif if (IDX & LIGHT_COLORMATERIAL) { if (VB->ColorPtr[0]->Type != GL_FLOAT || @@ -310,9 +312,9 @@ static void TAG(light_rgba)( GLcontext *ctx, GLfloat (*base)[3] = ctx->Light._BaseColor; GLchan sumA[2]; - GLuint vstride = input->stride; + const GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *) input->data; - GLuint nstride = VB->NormalPtr->stride; + const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat *CMcolor; @@ -321,14 +323,15 @@ static void TAG(light_rgba)( GLcontext *ctx, GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; GLchan (*color[2])[4]; - GLuint *flags = VB->Flag; + const GLuint *flags = VB->Flag; struct gl_material (*new_material)[2] = VB->Material; - GLuint *new_material_mask = VB->MaterialMask; - GLuint nr = VB->Count; + const GLuint *new_material_mask = VB->MaterialMask; + const GLuint nr = VB->Count; - if (MESA_VERBOSE & VERBOSE_LIGHTING) - fprintf(stderr, "%s\n", __FUNCTION__ ); +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif (void) flags; (void) nstride; @@ -522,23 +525,24 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); - GLuint nstride = VB->NormalPtr->stride; + const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat *CMcolor; GLuint CMstride; GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; - struct gl_light *light = ctx->Light.EnabledList.next; - GLuint *flags = VB->Flag; + const struct gl_light *light = ctx->Light.EnabledList.next; + const GLuint *flags = VB->Flag; GLchan basechan[2][4]; GLuint j = 0; struct gl_material (*new_material)[2] = VB->Material; - GLuint *new_material_mask = VB->MaterialMask; + const GLuint *new_material_mask = VB->MaterialMask; GLfloat base[2][3]; - GLuint nr = VB->Count; + const GLuint nr = VB->Count; - if (MESA_VERBOSE & VERBOSE_LIGHTING) - fprintf(stderr, "%s\n", __FUNCTION__ ); +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif (void) input; /* doesn't refer to Eye or Obj */ (void) flags; @@ -608,7 +612,8 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, Bcolor[j][3] = basechan[1][3]; } COPY_CHAN4(Fcolor[j], basechan[0]); - } else { + } + else { GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm); GLfloat sum[3]; COPY_3V(sum, base[0]); @@ -650,22 +655,22 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLchan sumA[2]; - GLuint nstride = VB->NormalPtr->stride; + const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat *CMcolor; GLuint CMstride; GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].Ptr; GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].Ptr; - GLuint *flags = VB->Flag; + const GLuint *flags = VB->Flag; GLuint j = 0; struct gl_material (*new_material)[2] = VB->Material; GLuint *new_material_mask = VB->MaterialMask; - GLuint nr = VB->Count; - struct gl_light *light; - - if (MESA_VERBOSE & VERBOSE_LIGHTING) - fprintf(stderr, "%s\n", __FUNCTION__ ); + const GLuint nr = VB->Count; + const struct gl_light *light; +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif (void) flags; (void) input; @@ -791,20 +796,21 @@ static void TAG(light_ci)( GLcontext *ctx, { struct light_stage_data *store = LIGHT_STAGE_DATA(stage); GLuint j; - GLuint vstride = input->stride; + const GLuint vstride = input->stride; const GLfloat *vertex = (GLfloat *) input->data; - GLuint nstride = VB->NormalPtr->stride; + const GLuint nstride = VB->NormalPtr->stride; const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; GLfloat *CMcolor; GLuint CMstride; - GLuint *flags = VB->Flag; + const GLuint *flags = VB->Flag; GLuint *indexResult[2]; struct gl_material (*new_material)[2] = VB->Material; GLuint *new_material_mask = VB->MaterialMask; - GLuint nr = VB->Count; + const GLuint nr = VB->Count; - if (MESA_VERBOSE & VERBOSE_LIGHTING) - fprintf(stderr, "%s\n", __FUNCTION__ ); +#ifdef TRACE + fprintf(stderr, "%s\n", __FUNCTION__ ); +#endif (void) flags; (void) nstride; diff --git a/xc/extras/Mesa/src/tnl/t_vb_normals.c b/xc/extras/Mesa/src/tnl/t_vb_normals.c index 6ec71d0a0..a99de7a21 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_normals.c +++ b/xc/extras/Mesa/src/tnl/t_vb_normals.c @@ -1,10 +1,9 @@ -/* $Id: t_vb_normals.c,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -32,7 +31,7 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" @@ -45,7 +44,7 @@ struct normal_stage_data { normal_func NormalTransform; - GLvector3f normal; + GLvector4f normal; }; #define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->privatePtr) @@ -66,16 +65,16 @@ static GLboolean run_normal_stage( GLcontext *ctx, * got a transformation matrix with uniform scaling. */ const GLfloat *lengths; - if (ctx->ModelView.flags & MAT_FLAG_GENERAL_SCALE) + if (ctx->ModelviewMatrixStack.Top->flags & MAT_FLAG_GENERAL_SCALE) lengths = NULL; else lengths = VB->NormalLengthPtr; - store->NormalTransform( &ctx->ModelView, + store->NormalTransform( ctx->ModelviewMatrixStack.Top, ctx->_ModelViewInvScale, - VB->NormalPtr, + VB->NormalPtr, /* input normals */ lengths, - &store->normal ); + &store->normal ); /* resulting normals */ } VB->NormalPtr = &store->normal; @@ -94,7 +93,7 @@ static GLboolean run_validate_normal_stage( GLcontext *ctx, if (ctx->_NeedEyeCoords) { GLuint transform = NORM_TRANSFORM_NO_ROT; - if (ctx->ModelView.flags & (MAT_FLAG_GENERAL | + if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_GENERAL | MAT_FLAG_ROTATION | MAT_FLAG_GENERAL_3D | MAT_FLAG_PERSPECTIVE)) @@ -138,7 +137,7 @@ static GLboolean run_validate_normal_stage( GLcontext *ctx, static void check_normal_transform( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - stage->active = ctx->_NeedNormals; + stage->active = ctx->_NeedNormals && !ctx->VertexProgram.Enabled; /* Don't clobber the initialize function: */ if (stage->privatePtr) @@ -156,7 +155,7 @@ static GLboolean alloc_normal_data( GLcontext *ctx, if (!store) return GL_FALSE; - _mesa_vector3f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); + _mesa_vector4f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); /* Now run the stage. */ @@ -170,7 +169,7 @@ static void free_normal_data( struct gl_pipeline_stage *stage ) { struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); if (store) { - _mesa_vector3f_free( &store->normal ); + _mesa_vector4f_free( &store->normal ); FREE( store ); stage->privatePtr = NULL; } @@ -185,11 +184,14 @@ static void free_normal_data( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_normal_transform_stage = { - "normal transform", + "normal transform", /* name */ _TNL_NEW_NORMAL_TRANSFORM, /* re-check */ _TNL_NEW_NORMAL_TRANSFORM, /* re-run */ - 0,VERT_NORM,VERT_NORM, /* active, inputs, outputs */ - 0, 0, /* changed_inputs, private */ + GL_FALSE, /* active? */ + VERT_BIT_NORMAL, /* inputs */ + VERT_BIT_NORMAL, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private data */ free_normal_data, /* destructor */ check_normal_transform, /* check */ alloc_normal_data /* run -- initially set to alloc */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_points.c b/xc/extras/Mesa/src/tnl/t_vb_points.c index 57b0142ee..67e527ca8 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_points.c +++ b/xc/extras/Mesa/src/tnl/t_vb_points.c @@ -1,10 +1,9 @@ -/* $Id: t_vb_points.c,v 1.1.1.1 2002/10/22 13:06:25 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,17 +23,17 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Brian Paul <brian@valinux.com> + * Brian Paul */ #include "mtypes.h" -#include "mem.h" +#include "imports.h" #include "t_context.h" #include "t_pipeline.h" struct point_stage_data { - GLvector1f PointSize; + GLvector4f PointSize; }; #define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->privatePtr) @@ -53,7 +52,7 @@ static GLboolean run_point_stage( GLcontext *ctx, const GLfloat p1 = ctx->Point.Params[1]; const GLfloat p2 = ctx->Point.Params[2]; const GLfloat pointSize = ctx->Point._Size; - GLfloat *size = store->PointSize.data; + GLfloat (*size)[4] = store->PointSize.data; GLuint i; if (stage->changed_inputs) { @@ -61,7 +60,7 @@ static GLboolean run_point_stage( GLcontext *ctx, for (i = 0; i < VB->Count; i++) { const GLfloat dist = -eye[i][2]; /* GLfloat dist = GL_SQRT(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);*/ - size[i] = pointSize / (p0 + dist * (p1 + dist * p2)); + size[i][0] = pointSize / (p0 + dist * (p1 + dist * p2)); } } @@ -76,7 +75,7 @@ static GLboolean run_point_stage( GLcontext *ctx, */ static void check_point_size( GLcontext *ctx, struct gl_pipeline_stage *d ) { - d->active = ctx->Point._Attenuated; + d->active = ctx->Point._Attenuated && !ctx->VertexProgram.Enabled; } static GLboolean alloc_point_data( GLcontext *ctx, @@ -89,7 +88,7 @@ static GLboolean alloc_point_data( GLcontext *ctx, if (!store) return GL_FALSE; - _mesa_vector1f_alloc( &store->PointSize, 0, VB->Size, 32 ); + _mesa_vector4f_alloc( &store->PointSize, 0, VB->Size, 32 ); /* Now run the stage. */ @@ -102,7 +101,7 @@ static void free_point_data( struct gl_pipeline_stage *stage ) { struct point_stage_data *store = POINT_STAGE_DATA(stage); if (store) { - _mesa_vector1f_free( &store->PointSize ); + _mesa_vector4f_free( &store->PointSize ); FREE( store ); stage->privatePtr = 0; } @@ -113,11 +112,11 @@ const struct gl_pipeline_stage _tnl_point_attenuation_stage = "point size attenuation", /* name */ _NEW_POINT, /* build_state_change */ _NEW_POINT, /* run_state_change */ - 0, /* active */ - VERT_EYE, /* inputs */ - VERT_POINT_SIZE, /* outputs */ + GL_FALSE, /* active */ + VERT_BIT_EYE, /* inputs */ + VERT_BIT_POINT_SIZE, /* outputs */ 0, /* changed_inputs (temporary value) */ - 0, /* stage private data */ + NULL, /* stage private data */ free_point_data, /* destructor */ check_point_size, /* check */ alloc_point_data /* run -- initially set to alloc data */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_render.c b/xc/extras/Mesa/src/tnl/t_vb_render.c index ac50cad60..3eb09b619 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_render.c +++ b/xc/extras/Mesa/src/tnl/t_vb_render.c @@ -1,4 +1,3 @@ -/* $Id: t_vb_render.c,v 1.1.1.1 2002/10/22 13:06:21 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -44,7 +43,7 @@ #include "context.h" #include "enums.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mtypes.h" #include "mmath.h" @@ -228,7 +227,7 @@ static void clip_elt_triangles( GLcontext *ctx, const quad_func QuadFunc = tnl->Driver.Render.Quad; \ const GLboolean stipple = ctx->Line.StippleFlag; \ (void) (LineFunc && TriangleFunc && QuadFunc); \ - (void) elt; (void) stipple; + (void) elt; (void) stipple #define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) #define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE @@ -283,7 +282,6 @@ static GLboolean run_render( GLcontext *ctx, render_func *tab; GLint pass = 0; - /* Allow the drivers to lock before projected verts are built so * that window coordinates are guarenteed not to change before * rendering. @@ -328,7 +326,7 @@ static GLboolean run_render( GLcontext *ctx, ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); if (MESA_VERBOSE & VERBOSE_PRIMS) - fprintf(stderr, "MESA prim %s %d..%d\n", + _mesa_debug(NULL, "MESA prim %s %d..%d\n", _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), i, i+length); @@ -357,39 +355,39 @@ static GLboolean run_render( GLcontext *ctx, */ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - GLuint inputs = VERT_CLIP; + GLuint inputs = VERT_BIT_CLIP; GLuint i; if (ctx->Visual.rgbMode) { - inputs |= VERT_RGBA; + inputs |= VERT_BIT_COLOR0; if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) - inputs |= VERT_SPEC_RGB; + inputs |= VERT_BIT_COLOR1; - if (ctx->Texture._ReallyEnabled) { + if (ctx->Texture._EnabledUnits) { for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { if (ctx->Texture.Unit[i]._ReallyEnabled) - inputs |= VERT_TEX(i); + inputs |= VERT_BIT_TEX(i); } } } else { - inputs |= VERT_INDEX; + inputs |= VERT_BIT_INDEX; } if (ctx->Point._Attenuated) - inputs |= VERT_POINT_SIZE; + inputs |= VERT_BIT_POINT_SIZE; /* How do drivers turn this off? */ if (ctx->Fog.Enabled) - inputs |= VERT_FOG_COORD; + inputs |= VERT_BIT_FOG; if (ctx->_TriangleCaps & DD_TRI_UNFILLED) - inputs |= VERT_EDGE; + inputs |= VERT_BIT_EDGEFLAG; if (ctx->RenderMode==GL_FEEDBACK) - inputs |= VERT_TEX_ANY; + inputs |= VERT_BITS_TEX_ANY; stage->inputs = inputs; } @@ -404,7 +402,7 @@ static void dtr( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_render_stage = { - "render", + "render", /* name */ (_NEW_BUFFERS | _DD_NEW_SEPARATE_SPECULAR | _DD_NEW_FLATSHADE | @@ -415,9 +413,11 @@ const struct gl_pipeline_stage _tnl_render_stage = _DD_NEW_TRI_UNFILLED | _NEW_RENDERMODE), /* re-check (new inputs, interp function) */ 0, /* re-run (always runs) */ - GL_TRUE, /* active */ - 0, 0, /* inputs (set in check_render), outputs */ - 0, 0, /* changed_inputs, private */ + GL_TRUE, /* active? */ + 0, /* inputs (set in check_render) */ + 0, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private data */ dtr, /* destructor */ check_render, /* check */ run_render /* run */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_rendertmp.h b/xc/extras/Mesa/src/tnl/t_vb_rendertmp.h index 5e3ad4ff0..7bc0e37fa 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_rendertmp.h +++ b/xc/extras/Mesa/src/tnl/t_vb_rendertmp.h @@ -1,4 +1,3 @@ -/* $Id: t_vb_rendertmp.h,v 1.1.1.1 2002/10/22 13:06:19 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_texgen.c b/xc/extras/Mesa/src/tnl/t_vb_texgen.c index 1e78644fa..25ae2bcd5 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_texgen.c +++ b/xc/extras/Mesa/src/tnl/t_vb_texgen.c @@ -1,4 +1,3 @@ -/* $Id: t_vb_texgen.c,v 1.1.1.1 2002/10/22 13:06:26 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,8 +23,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Brian Paul <brian@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Brian Paul + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -34,7 +33,7 @@ #include "context.h" #include "macros.h" #include "mmath.h" -#include "mem.h" +#include "imports.h" #include "mtypes.h" #include "math/m_xform.h" @@ -95,7 +94,7 @@ static GLuint all_bits[5] = { static void build_m3( GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -122,7 +121,7 @@ static void build_m3( GLfloat f[][3], GLfloat m[], static void build_m2( GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -152,7 +151,7 @@ static void build_m2( GLfloat f[][3], GLfloat m[], typedef void (*build_m_func)( GLfloat f[][3], GLfloat m[], - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ); @@ -171,7 +170,7 @@ static build_m_func build_m_tab[5] = { */ static void build_f3( GLfloat *f, GLuint fstride, - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -198,7 +197,7 @@ static void build_f3( GLfloat *f, static void build_f2( GLfloat *f, GLuint fstride, - const GLvector3f *normal, + const GLvector4f *normal, const GLvector4f *eye ) { GLuint stride = eye->stride; @@ -226,7 +225,7 @@ static void build_f2( GLfloat *f, typedef void (*build_f_func)( GLfloat *f, GLuint fstride, - const GLvector3f *normal_vec, + const GLvector4f *normal_vec, const GLvector4f *eye ); @@ -281,7 +280,7 @@ static void texgen_normal_map_nv( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLvector4f *in = VB->TexCoordPtr[unit]; GLvector4f *out = &store->texcoord[unit]; - GLvector3f *normal = VB->NormalPtr; + GLvector4f *normal = VB->NormalPtr; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; GLuint count = VB->Count; GLuint i; @@ -322,7 +321,7 @@ static void texgen_sphere_map( GLcontext *ctx, GLfloat (*f)[3] = store->tmp_f; GLfloat *m = store->tmp_m; -/* fprintf(stderr, "%s normstride %d eyestride %d\n", */ +/* _mesa_debug(NULL, "%s normstride %d eyestride %d\n", */ /* __FUNCTION__, VB->NormalPtr->stride, */ /* VB->EyePtr->stride); */ @@ -362,7 +361,7 @@ static void texgen( GLcontext *ctx, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; const GLvector4f *obj = VB->ObjPtr; const GLvector4f *eye = VB->EyePtr; - const GLvector3f *normal = VB->NormalPtr; + const GLvector4f *normal = VB->NormalPtr; GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; GLfloat *indata; GLuint count = VB->Count; @@ -529,7 +528,7 @@ static GLboolean run_texgen_stage( GLcontext *ctx, for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) { - if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i))) + if (stage->changed_inputs & (VERT_BIT_EYE | VERT_BIT_NORMAL | VERT_BIT_TEX(i))) store->TexgenFunc[i]( ctx, store, i ); VB->TexCoordPtr[i] = &store->texcoord[i]; @@ -591,28 +590,28 @@ static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage ) GLuint i; stage->active = 0; - if (ctx->Texture._TexGenEnabled) { + if (ctx->Texture._TexGenEnabled && !ctx->VertexProgram.Enabled) { GLuint inputs = 0; GLuint outputs = 0; if (ctx->Texture._GenFlags & TEXGEN_OBJ_LINEAR) - inputs |= VERT_OBJ; + inputs |= VERT_BIT_POS; if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) - inputs |= VERT_EYE; + inputs |= VERT_BIT_EYE; if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) - inputs |= VERT_NORM; + inputs |= VERT_BIT_NORMAL; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexGenEnabled & ENABLE_TEXGEN(i)) { - outputs |= VERT_TEX(i); + outputs |= VERT_BIT_TEX(i); /* Need the original input in case it contains a Q coord: * (sigh) */ - inputs |= VERT_TEX(i); + inputs |= VERT_BIT_TEX(i); /* Something for Feedback? */ } @@ -678,11 +677,14 @@ static void free_texgen_data( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_texgen_stage = { - "texgen", + "texgen", /* name */ _NEW_TEXTURE, /* when to call check() */ _NEW_TEXTURE, /* when to invalidate stored data */ - 0,0,0, /* active, inputs, outputs */ - 0,0, /* changed_inputs, private */ + GL_FALSE, /* active? */ + 0, /* inputs */ + 0, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private data */ free_texgen_data, /* destructor */ check_texgen, /* check */ alloc_texgen_data /* run -- initially set to alloc data */ diff --git a/xc/extras/Mesa/src/tnl/t_vb_texmat.c b/xc/extras/Mesa/src/tnl/t_vb_texmat.c index 600ec0e23..c81e790de 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_texmat.c +++ b/xc/extras/Mesa/src/tnl/t_vb_texmat.c @@ -1,4 +1,3 @@ -/* $Id: t_vb_texmat.c,v 1.1.1.1 2002/10/22 13:06:26 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -32,7 +31,7 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" @@ -60,12 +59,12 @@ static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage ) GLuint i; stage->active = 0; - if (ctx->Texture._TexMatEnabled) { + if (ctx->Texture._TexMatEnabled && !ctx->VertexProgram.Enabled) { GLuint flags = 0; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) - flags |= VERT_TEX(i); + flags |= VERT_BIT_TEX(i); stage->active = 1; stage->inputs = flags; @@ -85,8 +84,9 @@ static GLboolean run_texmat_stage( GLcontext *ctx, */ for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) { - if (stage->changed_inputs & VERT_TEX(i)) - (void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i], + if (stage->changed_inputs & VERT_BIT_TEX(i)) + (void) TransformRaw( &store->texcoord[i], + ctx->TextureMatrixStack[i].Top, VB->TexCoordPtr[i]); VB->TexCoordPtr[i] = &store->texcoord[i]; @@ -137,12 +137,15 @@ static void free_texmat_data( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_texture_transform_stage = { - "texture transform", - _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, - _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, - 0,0,0, /* active, inputs, outputs */ - 0,0, /* changed_inputs, private */ - free_texmat_data, /* destructor */ - check_texmat, /* check */ - alloc_texmat_data, /* run -- initially set to init */ + "texture transform", /* name */ + _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, /* check_state */ + _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, /* run_state */ + GL_FALSE, /* active? */ + 0, /* inputs */ + 0, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private data */ + free_texmat_data, /* destructor */ + check_texmat, /* check */ + alloc_texmat_data, /* run -- initially set to init */ }; diff --git a/xc/extras/Mesa/src/tnl/t_vb_vertex.c b/xc/extras/Mesa/src/tnl/t_vb_vertex.c index aacda742e..27e47feaf 100644 --- a/xc/extras/Mesa/src/tnl/t_vb_vertex.c +++ b/xc/extras/Mesa/src/tnl/t_vb_vertex.c @@ -1,8 +1,7 @@ -/* $Id: t_vb_vertex.c,v 1.1.1.1 2002/10/22 13:06:17 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -32,7 +31,7 @@ #include "colormac.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "mtypes.h" @@ -57,7 +56,7 @@ struct vertex_stage_data { */ GLvector4f *save_eyeptr; GLvector4f *save_clipptr; - GLvector4f *save_projptr; + GLvector4f *save_ndcptr; }; #define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->privatePtr) @@ -79,7 +78,7 @@ static void NAME( GLcontext *ctx, \ GLuint p; \ \ for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ - if (ctx->Transform.ClipEnabled[p]) { \ + if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { \ GLuint nr, i; \ const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ @@ -137,22 +136,26 @@ static GLboolean run_vertex_stage( GLcontext *ctx, TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; + ASSERT(!ctx->VertexProgram.Enabled); + if (stage->changed_inputs) { if (ctx->_NeedEyeCoords) { /* Separate modelview transformation: * Use combined ModelProject to avoid some depth artifacts */ - if (ctx->ModelView.type == MATRIX_IDENTITY) + if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) VB->EyePtr = VB->ObjPtr; else - VB->EyePtr = TransformRaw( &store->eye, &ctx->ModelView, + VB->EyePtr = TransformRaw( &store->eye, + ctx->ModelviewMatrixStack.Top, VB->ObjPtr); - if (ctx->ProjectionMatrix.type == MATRIX_IDENTITY) + if (ctx->ProjectionMatrixStack.Top->type == MATRIX_IDENTITY) VB->ClipPtr = VB->EyePtr; else - VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix, + VB->ClipPtr = TransformRaw( &store->clip, + &ctx->_ModelProjectMatrix, VB->ObjPtr ); } else { @@ -171,7 +174,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, if (VB->ClipPtr->size < 4) { if (VB->ClipPtr->flags & VEC_NOT_WRITEABLE) { ASSERT(VB->ClipPtr == VB->ObjPtr); - VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); + VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE ); VB->ClipPtr = VB->ObjPtr; } if (VB->ClipPtr->size == 2) @@ -185,16 +188,16 @@ static GLboolean run_vertex_stage( GLcontext *ctx, store->ormask = 0; store->andmask = CLIP_ALL_BITS; - if (tnl->NeedProjCoords) { - VB->ProjectedClipPtr = + if (tnl->NeedNdcCoords) { + VB->NdcPtr = _mesa_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, &store->proj, store->clipmask, &store->ormask, &store->andmask ); - - } else { - VB->ProjectedClipPtr = 0; + } + else { + VB->NdcPtr = 0; _mesa_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, 0, store->clipmask, @@ -209,7 +212,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, /* Test userclip planes. This contributes to VB->ClipMask, so * is essentially required to be in this stage. */ - if (ctx->Transform._AnyClip) { + if (ctx->Transform.ClipPlanesEnabled) { usercliptab[VB->ClipPtr->size]( ctx, VB->ClipPtr, store->clipmask, @@ -223,23 +226,23 @@ static GLboolean run_vertex_stage( GLcontext *ctx, VB->ClipOrMask = store->ormask; VB->ClipMask = store->clipmask; - if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ)) - VB->importable_data |= VERT_CLIP; + if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS)) + VB->importable_data |= VERT_BIT_CLIP; store->save_eyeptr = VB->EyePtr; store->save_clipptr = VB->ClipPtr; - store->save_projptr = VB->ProjectedClipPtr; + store->save_ndcptr = VB->NdcPtr; } else { /* Replay the sideeffects. */ VB->EyePtr = store->save_eyeptr; VB->ClipPtr = store->save_clipptr; - VB->ProjectedClipPtr = store->save_projptr; + VB->NdcPtr = store->save_ndcptr; VB->ClipMask = store->clipmask; VB->ClipOrMask = store->ormask; - if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ)) - VB->importable_data |= VERT_CLIP; + if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_BIT_POS)) + VB->importable_data |= VERT_BIT_CLIP; if (store->andmask) return GL_FALSE; } @@ -250,8 +253,7 @@ static GLboolean run_vertex_stage( GLcontext *ctx, static void check_vertex( GLcontext *ctx, struct gl_pipeline_stage *stage ) { - (void) ctx; - (void) stage; + stage->active = !ctx->VertexProgram.Enabled; } static GLboolean init_vertex_stage( GLcontext *ctx, @@ -303,15 +305,17 @@ static void dtr( struct gl_pipeline_stage *stage ) const struct gl_pipeline_stage _tnl_vertex_transform_stage = { "modelview/project/cliptest/divide", - 0, /* re-check -- always on */ - _MESA_NEW_NEED_EYE_COORDS | + _NEW_PROGRAM, /* check_state: only care about vertex prog */ + _MESA_NEW_NEED_EYE_COORDS | /* run_state: when to invalidate / re-run */ _NEW_MODELVIEW| _NEW_PROJECTION| - _NEW_TRANSFORM, /* re-run */ + _NEW_PROGRAM| + _NEW_TRANSFORM, GL_TRUE, /* active */ - VERT_OBJ, /* inputs */ - VERT_EYE|VERT_CLIP, /* outputs */ - 0, 0, /* changed_inputs, private */ + VERT_BIT_POS, /* inputs */ + VERT_BIT_EYE|VERT_BIT_CLIP, /* outputs */ + 0, /* changed_inputs */ + NULL, /* private data */ dtr, /* destructor */ check_vertex, /* check */ init_vertex_stage /* run -- initially set to init */ diff --git a/xc/extras/Mesa/src/tnl/t_vtx_api.c b/xc/extras/Mesa/src/tnl/t_vtx_api.c new file mode 100644 index 000000000..4076051c8 --- /dev/null +++ b/xc/extras/Mesa/src/tnl/t_vtx_api.c @@ -0,0 +1,808 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + */ +#include "mtypes.h" +#include "colormac.h" +#include "simple_list.h" +#include "vtxfmt.h" + +#include "tnl_vtx_api.h" + +/* Fallback versions of all the entrypoints for situations where + * codegen isn't available. This is slowed significantly by all the + * gumph necessary to get to the tnl pointer. + */ + + +/* MultiTexcoord ends up with both of these branches, unfortunately + * (it may get its own version of the macro after size-tracking is + * working). + * + * Errors (VertexAttribNV when ATTR>15) are handled at a higher level. + */ +#define ATTRF( ATTR, N, A, B, C, D ) \ +{ \ + GET_CURRENT_CONTEXT( ctx ); \ + TNLcontext *tnl = TNL_CONTEXT(ctx); \ + \ + if ((ATTR) == 0) { \ + int i; \ + \ + if (N>0) tnl->vbptr[0].f = A; \ + if (N>1) tnl->vbptr[1].f = B; \ + if (N>2) tnl->vbptr[2].f = C; \ + if (N>3) tnl->vbptr[3].f = D; \ + \ + for (i = N; i < tnl->vertex_size; i++) \ + *tnl->vbptr[i].i = tnl->vertex[i].i; \ + \ + tnl->vbptr += tnl->vertex_size; \ + \ + if (--tnl->counter == 0) \ + tnl->notify(); \ + } \ + else { \ + GLfloat *dest = tnl->attrptr[ATTR]; \ + if (N>0) dest[0] = A; \ + if (N>1) dest[1] = B; \ + if (N>2) dest[2] = C; \ + if (N>3) dest[3] = D; \ + } \ +} + +#define ATTR4F( ATTR, A, B, C, D ) ATTRF( ATTR, 4, A, B, C, D ) +#define ATTR3F( ATTR, A, B, C, D ) ATTRF( ATTR, 3, A, B, C, 1 ) +#define ATTR2F( ATTR, A, B, C, D ) ATTRF( ATTR, 2, A, B, 0, 1 ) +#define ATTR1F( ATTR, A, B, C, D ) ATTRF( ATTR, 1, A, 0, 0, 1 ) + +#define ATTR3UB( ATTR, A, B, C ) \ + ATTR3F( ATTR, \ + UBYTE_TO_FLOAT(A), \ + UBYTE_TO_FLOAT(B), \ + UBYTE_TO_FLOAT(C)) + + +#define ATTR4UB( ATTR, A, B, C, D ) \ + ATTR4F( ATTR, \ + UBYTE_TO_FLOAT(A), \ + UBYTE_TO_FLOAT(B), \ + UBYTE_TO_FLOAT(C), \ + UBYTE_TO_FLOAT(D)) + + +/* Vertex + */ +static void tnl_Vertex2f( GLfloat x, GLfloat y ) +{ + ATTR2F( VERT_ATTRIB_POS, x, y ); +} + +static void tnl_Vertex2fv( const GLfloat *v ) +{ + ATTR2F( VERT_ATTRIB_POS, v[0], v[1] ); +} + +static void tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) +{ + ATTR3F( VERT_ATTRIB_POS, x, y, z ); +} + +static void tnl_Vertex3fv( const GLfloat *v ) +{ + ATTR3F( VERT_ATTRIB_POS, v[0], v[1], v[2] ); +} + +static void tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + ATTR4F( VERT_ATTRIB_POS, x, y, z, w ); +} + +static void tnl_Vertex4fv( const GLfloat *v ) +{ + ATTR4F( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] ); +} + + +/* Color + */ +static void tnl_Color3ub( GLubyte r, GLubyte g, GLubyte b ) +{ + ATTR3UB( VERT_ATTRIB_COLOR0, r, g, b ); +} + +static void tnl_Color3ubv( const GLubyte *v ) +{ + ATTR3UB( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] ); +} + +static void tnl_Color4ub( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + ATTR4UB( VERT_ATTRIB_COLOR0, r, g, b, a ); +} + +static void tnl_Color4ubv( const GLubyte *v ) +{ + ATTR4UB( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] ); +} + +static void tnl_Color3f( GLfloat r, GLfloat g, GLfloat b ) +{ + ATTR3F( VERT_ATTRIB_COLOR0, r, g, b ); +} + +static void tnl_Color3fv( const GLfloat *v ) +{ + ATTR3F( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] ); +} + +static void tnl_Color4f( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) +{ + ATTR4F( VERT_ATTRIB_COLOR0, r, g, b, a ); +} + +static void tnl_Color4fv( const GLfloat *v ) +{ + ATTR4F( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] ); +} + + +/* Secondary Color + */ +static void tnl_SecondaryColor3ubEXT( GLubyte r, GLubyte g, GLubyte b ) +{ + ATTR3UB( VERT_ATTRIB_COLOR1, r, g, b ); +} + +static void tnl_SecondaryColor3ubvEXT( const GLubyte *v ) +{ + ATTR3UB( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); +} + +static void tnl_SecondaryColor3fEXT( GLfloat r, GLfloat g, GLfloat b ) +{ + ATTR3F( VERT_ATTRIB_COLOR1, r, g, b ); +} + +static void tnl_SecondaryColor3fvEXT( const GLfloat *v ) +{ + ATTR3F( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); +} + + + +/* Fog Coord + */ +static void tnl_FogCoordfEXT( GLfloat f ) +{ + ATTR1F( VERT_ATTRIB_FOG, f ); +} + +static void tnl_FogCoordfvEXT( const GLfloat *v ) +{ + ATTR1F( VERT_ATTRIB_FOG, v[0] ); +} + + + +/* Normal + */ +static void tnl_Normal3f( GLfloat n0, GLfloat n1, GLfloat n2 ) +{ + ATTR3F( VERT_ATTRIB_NORMAL, n0, n1, n2 ); +} + +static void tnl_Normal3fv( const GLfloat *v ) +{ + ATTR3F( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] ); +} + + +/* TexCoord + */ +static void tnl_TexCoord1f( GLfloat s ) +{ + ATTR1F( VERT_ATTRIB_TEX0, s ); +} + +static void tnl_TexCoord1fv( const GLfloat *v ) +{ + ATTR1F( VERT_ATTRIB_TEX0, v[0] ); +} + +static void tnl_TexCoord2f( GLfloat s, GLfloat t ) +{ + ATTR2F( VERT_ATTRIB_TEX0, s, t ); +} + +static void tnl_TexCoord2fv( const GLfloat *v ) +{ + ATTR2F( VERT_ATTRIB_TEX0, v[0], v[1] ); +} + +static void tnl_TexCoord3f( GLfloat s, GLfloat t, GLfloat r ) +{ + ATTR3F( VERT_ATTRIB_TEX0, s, t, r ); +} + +static void tnl_TexCoord3fv( const GLfloat *v ) +{ + ATTR3F( VERT_ATTRIB_TEX0, v[0], v[1], v[2] ); +} + +static void tnl_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +{ + ATTR4F( VERT_ATTRIB_TEX0, s, t, r, q ); +} + +static void tnl_TexCoord4fv( const GLfloat *v ) +{ + ATTR4F( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] ); +} + + +/* Miscellaneous: + * + * These don't alias NV attributes, but still need similar treatment. + * Basically these are attributes with numbers greater than 16. + */ +static void tnl_EdgeFlag( GLboolean flag ) +{ + GLfloat f = flag ? 1 : 0; + ATTR1F( VERT_ATTRIB_EDGEFLAG, f); +} + +static void tnl_EdgeFlagv( const GLboolean *flag ) +{ + GLfloat f = flag[0] ? 1 : 0; + ATTR1F( VERT_ATTRIB_EDGEFLAG, f); +} + +static void tnl_Indexi( GLint idx ) +{ + ATTR1F( VERT_ATTRIB_INDEX, idx ); +} + +static void tnl_Indexiv( const GLint *idx ) +{ + ATTR1F( VERT_ATTRIB_INDEX, idx ); +} + +/* Use dispatch switching to build 'ranges' of eval vertices for each + * type, avoiding need for flags. (Make + * evalcoords/evalpoints/vertices/attr0 mutually exclusive) + */ +static void _tnl_EvalCoord1f( GLfloat u ) +{ + ATTR1F( VERT_ATTRIB_POS, u ); +} + +static void _tnl_EvalCoord1fv( const GLfloat *v ) +{ + ATTR1F( VERT_ATTRIB_POS, v[0] ); +} + +static void _tnl_EvalCoord2f( GLfloat u, GLfloat v ) +{ + ATTR2F( VERT_ATTRIB_POS, u, v ); +} + +static void _tnl_EvalCoord2fv( const GLfloat *v ) +{ + ATTR2F( VERT_ATTRIB_POS, v[0], v[1] ); +} + + + +/* Second level dispatch table for MultiTexCoord, Material and + * VertexAttribNV. + * + * Need this because we want to track things like vertex attribute + * sizes, presence/otherwise of attribs in recorded vertices, etc, by + * manipulating the state of dispatch tables. Need therefore a + * dispatch slot for each value of 'index' or 'unit' in VertexAttribNV + * and MultiTexCoordARB. Also need a mechnism for keeping this data + * consistent with what's coming in via the Vertex/Normal/etc api + * above (where aliasing exists with the traditional entrypoints). + * Note that MultiTexCoordARB aliases with TexCoord when unit==0. + * + * Need presence tracking for material components, too, but not size + * tracking or help with aliasing. Could move material to seperate + * dispatch without the "*4" below, or even do the checks every time. + */ +struct attr_dispatch_tab { + void (*tab[32*4])( void ); + void (*swapped[32*4])( void ); + int swapcount; + int installed_sizes[32]; +}; + +#define DISPATCH_ATTR1F( ATTR, N, ) + tnl->vb.attr_dispatch + +/* Result at the back end after second dispatch -- could further + * specialize for attr zero -- maybe just in the codegen version. + */ +static void tnl_Attr1f( GLint attr, GLfloat s ) +{ + ATTR1F( attr, s ); +} + +static void tnl_Attr1fv( GLint attr, const GLfloat *v ) +{ + ATTR1F( attr, v[0] ); +} + +static void tnl_Attr2f( GLint attr, GLfloat s, GLfloat t ) +{ + ATTR2F( attr, s, t ); +} + +static void tnl_Attr2fv( GLint attr, const GLfloat *v ) +{ + ATTR2F( attr, v[0], v[1] ); +} + +static void tnl_Attr3f( GLint attr, GLfloat s, GLfloat t, GLfloat r ) +{ + ATTR3F( attr, s, t, r ); +} + +static void tnl_Attr3fv( GLint attr, const GLfloat *v ) +{ + ATTR3F( attr, v[0], v[1], v[2] ); +} + +static void tnl_Attr4f( GLint attr, GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +{ + ATTR4F( attr, s, t, r, q ); +} + +static void tnl_Attr4fv( GLint attr, const GLfloat *v ) +{ + ATTR4F( attr, v[0], v[1], v[2], v[3] ); +} + + +/* MultiTexcoord: Send through second level dispatch. + */ +static void tnl_MultiTexCoord1fARB( GLenum target, GLfloat s ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR1F( attr, s ); +} + +static void tnl_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR1F( attr, v[0] ); +} + +static void tnl_MultiTexCoord2fARB( GLenum target, GLfloat s, GLfloat t ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR2F( attr, s, t ); +} + +static void tnl_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR2F( attr, v[0], v[1] ); +} + +static void tnl_MultiTexCoord3fARB( GLenum target, GLfloat s, GLfloat t, + GLfloat r) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR3F( attr, s, t, r ); +} + +static void tnl_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR3F( attr, v[0], v[1], v[2] ); +} + +static void tnl_MultiTexCoord4fARB( GLenum target, GLfloat s, GLfloat t, + GLfloat r, GLfloat q ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR4F( attr, s, t, r, q ); +} + +static void tnl_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) +{ + GLuint attr = (target - GL_TEXTURE0_ARB) + VERT_ATTRIB_TEX0; + if (attr < MAX_VERT_ATTRS) + DISPATCH_ATTR4F( attr, v[0], v[1], v[2], v[3] ); +} + + +/* NV_vertex_program: + * + * Check for errors & reroute through second dispatch layer to get + * size tracking per-attribute. + */ +static void tnl_VertexAttrib1fNV( GLuint index, GLfloat s ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR1F( index, s ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR1F( index, v[0] ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib2fNV( GLuint index, GLfloat s, GLfloat t ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR2F( index, s, t ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR2F( index, v[0], v[1] ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib3fNV( GLuint index, GLfloat s, GLfloat t, + GLfloat r ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR3F( index, s, t, r ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR3F( index, v[0], v[1], v[2] ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib4fNV( GLuint index, GLfloat s, GLfloat t, + GLfloat r, GLfloat q ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR4F( index, s, t, r, q ); + else + DISPATCH_ERROR; +} + +static void tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) +{ + if (index < MAX_VERT_ATTRS) + DISPATCH_ATTR4F( index, v[0], v[1], v[2], v[3] ); + else + DISPATCH_ERROR; +} + + + + + + + +/* Materials: + * + * These are treated as per-vertex attributes, at indices above where + * the NV_vertex_program leaves off. There are a lot of good things + * about treating materials this way. + * + * *** Need a dispatch step (like VertexAttribute GLint attr, and MultiTexCoord) + * *** to expand vertex size, etc. Use the same second level dispatch + * *** (keyed by attr number) as above. + */ +#define MAT( ATTR, face, params ) \ +do { \ + if (face != GL_BACK) \ + DISPATCH_ATTRF( ATTR, N, params ); \ + if (face != GL_FRONT) \ + DISPATCH_ATTRF( ATTR+7, N, params ); \ +} while (0) + + +/* NOTE: Have to remove/dealwith colormaterial crossovers, probably + * later on - in the meantime just store everything. + */ +static void _tnl_Materialfv( GLenum face, GLenum pname, + const GLfloat *params ) +{ + switch (pname) { + case GL_EMISSION: + MAT( VERT_ATTRIB_FRONT_EMMISSION, 4, face, params ); + break; + case GL_AMBIENT: + MAT( VERT_ATTRIB_FRONT_AMBIENT, 4, face, params ); + break; + case GL_DIFFUSE: + MAT( VERT_ATTRIB_FRONT_DIFFUSE, 4, face, params ); + break; + case GL_SPECULAR: + MAT( VERT_ATTRIB_FRONT_SPECULAR, 4, face, params ); + break; + case GL_SHININESS: + MAT( VERT_ATTRIB_FRONT_SHININESS, 1, face, params ); + break; + case GL_COLOR_INDEXES: + MAT( VERT_ATTRIB_FRONT_EMMISSION, 3, face, params ); + break; + case GL_AMBIENT_AND_DIFFUSE: + MAT( VERT_ATTRIB_FRONT_AMBIENT, 4, face, params ); + MAT( VERT_ATTRIB_FRONT_DIFFUSE, 4, face, params ); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, where ); + return; + } +} + + + + +/* Codegen support + */ +static struct dynfn *lookup( struct dynfn *l, int key ) +{ + struct dynfn *f; + + foreach( f, l ) { + if (f->key == key) + return f; + } + + return 0; +} + +/* Vertex descriptor + */ +struct _tnl_vertex_descriptor { + GLuint attr_bits[4]; +}; + + +/* Can't use the loopback template for this: + */ +#define CHOOSE(FN, FNTYPE, MASK, ACTIVE, ARGS1, ARGS2 ) \ +static void choose_##FN ARGS1 \ +{ \ + int key = tnl->vertex_format & (MASK|ACTIVE); \ + struct dynfn *dfn = lookup( &tnl->dfn_cache.FN, key ); \ + \ + if (dfn == 0) \ + dfn = tnl->codegen.FN( &vb, key ); \ + else if (MESA_VERBOSE & DEBUG_CODEGEN) \ + _mesa_debug(NULL, "%s -- cached codegen\n", __FUNCTION__ ); \ + \ + if (dfn) \ + tnl->context->Exec->FN = (FNTYPE)(dfn->code); \ + else { \ + if (MESA_VERBOSE & DEBUG_CODEGEN) \ + _mesa_debug(NULL, "%s -- generic version\n", __FUNCTION__ ); \ + tnl->context->Exec->FN = tnl_##FN; \ + } \ + \ + tnl->context->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ + tnl->context->Exec->FN ARGS2; \ +} + + + +CHOOSE(Normal3f, p3f, 3, VERT_ATTRIB_NORMAL, + (GLfloat a,GLfloat b,GLfloat c), (a,b,c)) +CHOOSE(Normal3fv, pfv, 3, VERT_ATTRIB_NORMAL, + (const GLfloat *v), (v)) + +CHOOSE(Color4ub, p4ub, 4, VERT_ATTRIB_COLOR0, + (GLubyte a,GLubyte b, GLubyte c, GLubyte d), (a,b,c,d)) +CHOOSE(Color4ubv, pubv, 4, VERT_ATTRIB_COLOR0, + (const GLubyte *v), (v)) +CHOOSE(Color3ub, p3ub, 3, VERT_ATTRIB_COLOR0, + (GLubyte a,GLubyte b, GLubyte c), (a,b,c)) +CHOOSE(Color3ubv, pubv, 3, VERT_ATTRIB_COLOR0, + (const GLubyte *v), (v)) + +CHOOSE(Color4f, p4f, 4, VERT_ATTRIB_COLOR0, + (GLfloat a,GLfloat b, GLfloat c, GLfloat d), (a,b,c,d)) +CHOOSE(Color4fv, pfv, 4, VERT_ATTRIB_COLOR0, + (const GLfloat *v), (v)) +CHOOSE(Color3f, p3f, 3, VERT_ATTRIB_COLOR0, + (GLfloat a,GLfloat b, GLfloat c), (a,b,c)) +CHOOSE(Color3fv, pfv, 3, VERT_ATTRIB_COLOR0, + (const GLfloat *v), (v)) + + +CHOOSE(SecondaryColor3ubEXT, p3ub, VERT_ATTRIB_COLOR1, + (GLubyte a,GLubyte b, GLubyte c), (a,b,c)) +CHOOSE(SecondaryColor3ubvEXT, pubv, VERT_ATTRIB_COLOR1, + (const GLubyte *v), (v)) +CHOOSE(SecondaryColor3fEXT, p3f, VERT_ATTRIB_COLOR1, + (GLfloat a,GLfloat b, GLfloat c), (a,b,c)) +CHOOSE(SecondaryColor3fvEXT, pfv, VERT_ATTRIB_COLOR1, + (const GLfloat *v), (v)) + +CHOOSE(TexCoord2f, p2f, VERT_ATTRIB_TEX0, + (GLfloat a,GLfloat b), (a,b)) +CHOOSE(TexCoord2fv, pfv, VERT_ATTRIB_TEX0, + (const GLfloat *v), (v)) +CHOOSE(TexCoord1f, p1f, VERT_ATTRIB_TEX0, + (GLfloat a), (a)) +CHOOSE(TexCoord1fv, pfv, VERT_ATTRIB_TEX0, + (const GLfloat *v), (v)) + +CHOOSE(MultiTexCoord2fARB, pe2f, VERT_ATTRIB_TEX0, + (GLenum u,GLfloat a,GLfloat b), (u,a,b)) +CHOOSE(MultiTexCoord2fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL, + (GLenum u,const GLfloat *v), (u,v)) +CHOOSE(MultiTexCoord1fARB, pe1f, MASK_ST_ALL, ACTIVE_ST_ALL, + (GLenum u,GLfloat a), (u,a)) +CHOOSE(MultiTexCoord1fvARB, pefv, MASK_ST_ALL, ACTIVE_ST_ALL, + (GLenum u,const GLfloat *v), (u,v)) + +CHOOSE(Vertex3f, p3f, VERT_ATTRIB_POS, + (GLfloat a,GLfloat b,GLfloat c), (a,b,c)) +CHOOSE(Vertex3fv, pfv, VERT_ATTRIB_POS, + (const GLfloat *v), (v)) +CHOOSE(Vertex2f, p2f, VERT_ATTRIB_POS, + (GLfloat a,GLfloat b), (a,b)) +CHOOSE(Vertex2fv, pfv, VERT_ATTRIB_POS, + (const GLfloat *v), (v)) + + + + + +void _tnl_InitVtxfmtChoosers( GLvertexformat *vfmt ) +{ + vfmt->Color3f = choose_Color3f; + vfmt->Color3fv = choose_Color3fv; + vfmt->Color3ub = choose_Color3ub; + vfmt->Color3ubv = choose_Color3ubv; + vfmt->Color4f = choose_Color4f; + vfmt->Color4fv = choose_Color4fv; + vfmt->Color4ub = choose_Color4ub; + vfmt->Color4ubv = choose_Color4ubv; + vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT; + vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT; + vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT; + vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT; + vfmt->MultiTexCoord1fARB = dd_MultiTexCoord1fARB; + vfmt->MultiTexCoord1fvARB = dd_MultiTexCoord1fvARB; + vfmt->MultiTexCoord2fARB = dd_MultiTexCoord2fARB; + vfmt->MultiTexCoord2fvARB = dd_MultiTexCoord2fvARB; + vfmt->MultiTexCoord3fARB = dd_MultiTexCoord3fARB; + vfmt->MultiTexCoord3fvARB = dd_MultiTexCoord3fvARB; + vfmt->MultiTexCoord4fARB = dd_MultiTexCoord4fARB; + vfmt->MultiTexCoord4fvARB = dd_MultiTexCoord4fvARB; + vfmt->Normal3f = choose_Normal3f; + vfmt->Normal3fv = choose_Normal3fv; + vfmt->TexCoord1f = choose_TexCoord1f; + vfmt->TexCoord1fv = choose_TexCoord1fv; + vfmt->TexCoord2f = choose_TexCoord2f; + vfmt->TexCoord2fv = choose_TexCoord2fv; + vfmt->TexCoord3f = choose_TexCoord3f; + vfmt->TexCoord3fv = choose_TexCoord3fv; + vfmt->TexCoord4f = choose_TexCoord4f; + vfmt->TexCoord4fv = choose_TexCoord4fv; + vfmt->Vertex2f = choose_Vertex2f; + vfmt->Vertex2fv = choose_Vertex2fv; + vfmt->Vertex3f = choose_Vertex3f; + vfmt->Vertex3fv = choose_Vertex3fv; + vfmt->Vertex4f = choose_Vertex4f; + vfmt->Vertex4fv = choose_Vertex4fv; + vfmt->FogCoordfvEXT = choose_FogCoordfvEXT; + vfmt->FogCoordfEXT = choose_FogCoordfEXT; + vfmt->EdgeFlag = choose_EdgeFlag; + vfmt->EdgeFlagv = choose_EdgeFlagv; + vfmt->Indexi = choose_Indexi; + vfmt->Indexiv = choose_Indexiv; + vfmt->EvalCoord1f = choose_EvalCoord1f; + vfmt->EvalCoord1fv = choose_EvalCoord1fv; + vfmt->EvalCoord2f = choose_EvalCoord2f; + vfmt->EvalCoord2fv = choose_EvalCoord2fv; + vfmt->Materialfv = dd_Materialfv; +} + + +static struct dynfn *codegen_noop( struct _vb *vb, int key ) +{ + (void) vb; (void) key; + return 0; +} + +void _tnl_InitCodegen( struct dfn_generators *gen ) +{ + /* Generate an attribute or vertex command. + */ + gen->Attr1f = codegen_noop; + gen->Attr1fv = codegen_noop; + gen->Attr2f = codegen_noop; + gen->Attr2fv = codegen_noop; + gen->Attr3f = codegen_noop; + gen->Attr3fv = codegen_noop; + gen->Attr4f = codegen_noop; + gen->Attr4fv = codegen_noop; + + /* Index is never zero for these... + */ + gen->Attr3ub = codegen_noop; + gen->Attr3ubv = codegen_noop; + gen->Attr4ub = codegen_noop; + gen->Attr4ubv = codegen_noop; + + /* As above, but deal with the extra (redundant by now) index + * argument to the generated function. + */ + gen->NVAttr1f = codegen_noop; + gen->NVAttr1fv = codegen_noop; + gen->NVAttr2f = codegen_noop; + gen->NVAttr2fv = codegen_noop; + gen->NVAttr3f = codegen_noop; + gen->NVAttr3fv = codegen_noop; + gen->NVAttr4f = codegen_noop; + gen->NVAttr4fv = codegen_noop; + + + if (!getenv("MESA_NO_CODEGEN")) { +#if defined(USE_X86_ASM) + _tnl_InitX86Codegen( gen ); +#endif + +#if defined(USE_SSE_ASM) + _tnl_InitSSECodegen( gen ); +#endif + +#if defined(USE_3DNOW_ASM) +#endif + +#if defined(USE_SPARC_ASM) +#endif + } +} diff --git a/xc/extras/Mesa/src/tnl/t_vtx_api.h b/xc/extras/Mesa/src/tnl/t_vtx_api.h new file mode 100644 index 000000000..6bfdbe8fe --- /dev/null +++ b/xc/extras/Mesa/src/tnl/t_vtx_api.h @@ -0,0 +1,234 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * + */ + +#ifndef __RADEON_VTXFMT_H__ +#define __RADEON_VTXFMT_H__ + +#ifdef GLX_DIRECT_RENDERING + +#include "_tnl__context.h" + +extern void _tnl_UpdateVtxfmt( GLcontext *ctx ); +extern void _tnl_InitVtxfmt( GLcontext *ctx ); +extern void _tnl_InvalidateVtxfmt( GLcontext *ctx ); +extern void _tnl_DestroyVtxfmt( GLcontext *ctx ); + +typedef void (*p4f)( GLfloat, GLfloat, GLfloat, GLfloat ); +typedef void (*p3f)( GLfloat, GLfloat, GLfloat ); +typedef void (*p2f)( GLfloat, GLfloat ); +typedef void (*p1f)( GLfloat ); +typedef void (*pe2f)( GLenum, GLfloat, GLfloat ); +typedef void (*pe1f)( GLenum, GLfloat ); +typedef void (*p4ub)( GLubyte, GLubyte, GLubyte, GLubyte ); +typedef void (*p3ub)( GLubyte, GLubyte, GLubyte ); +typedef void (*pfv)( const GLfloat * ); +typedef void (*pefv)( GLenum, const GLfloat * ); +typedef void (*pubv)( const GLubyte * ); + +/* Want to keep a cache of these around. Each is parameterized by + * only a single value which has only a small range. Only expect a + * few, so just rescan the list each time? + */ +struct dynfn { + struct dynfn *next, *prev; + int key; + char *code; +}; + +struct dfn_lists { + struct dynfn Vertex2f; + struct dynfn Vertex2fv; + struct dynfn Vertex3f; + struct dynfn Vertex3fv; + struct dynfn Color4ub; + struct dynfn Color4ubv; + struct dynfn Color3ub; + struct dynfn Color3ubv; + struct dynfn Color4f; + struct dynfn Color4fv; + struct dynfn Color3f; + struct dynfn Color3fv; + struct dynfn SecondaryColor3ubEXT; + struct dynfn SecondaryColor3ubvEXT; + struct dynfn SecondaryColor3fEXT; + struct dynfn SecondaryColor3fvEXT; + struct dynfn Normal3f; + struct dynfn Normal3fv; + struct dynfn TexCoord2f; + struct dynfn TexCoord2fv; + struct dynfn TexCoord1f; + struct dynfn TexCoord1fv; + struct dynfn MultiTexCoord2fARB; + struct dynfn MultiTexCoord2fvARB; + struct dynfn MultiTexCoord1fARB; + struct dynfn MultiTexCoord1fvARB; +}; + +struct _vb; + +struct dfn_generators { + struct dynfn *(*Vertex2f)( struct _vb *, int ); + struct dynfn *(*Vertex2fv)( struct _vb *, int ); + struct dynfn *(*Vertex3f)( struct _vb *, int ); + struct dynfn *(*Vertex3fv)( struct _vb *, int ); + struct dynfn *(*Color4ub)( struct _vb *, int ); + struct dynfn *(*Color4ubv)( struct _vb *, int ); + struct dynfn *(*Color3ub)( struct _vb *, int ); + struct dynfn *(*Color3ubv)( struct _vb *, int ); + struct dynfn *(*Color4f)( struct _vb *, int ); + struct dynfn *(*Color4fv)( struct _vb *, int ); + struct dynfn *(*Color3f)( struct _vb *, int ); + struct dynfn *(*Color3fv)( struct _vb *, int ); + struct dynfn *(*SecondaryColor3ubEXT)( struct _vb *, int ); + struct dynfn *(*SecondaryColor3ubvEXT)( struct _vb *, int ); + struct dynfn *(*SecondaryColor3fEXT)( struct _vb *, int ); + struct dynfn *(*SecondaryColor3fvEXT)( struct _vb *, int ); + struct dynfn *(*Normal3f)( struct _vb *, int ); + struct dynfn *(*Normal3fv)( struct _vb *, int ); + struct dynfn *(*TexCoord2f)( struct _vb *, int ); + struct dynfn *(*TexCoord2fv)( struct _vb *, int ); + struct dynfn *(*TexCoord1f)( struct _vb *, int ); + struct dynfn *(*TexCoord1fv)( struct _vb *, int ); + struct dynfn *(*MultiTexCoord2fARB)( struct _vb *, int ); + struct dynfn *(*MultiTexCoord2fvARB)( struct _vb *, int ); + struct dynfn *(*MultiTexCoord1fARB)( struct _vb *, int ); + struct dynfn *(*MultiTexCoord1fvARB)( struct _vb *, int ); +}; + +struct prim { + GLuint start; + GLuint end; + GLuint prim; +}; + +#define _TNL__MAX_PRIMS 64 + + + +struct tnl_vbinfo { + /* Keep these first: referenced from codegen templates: + */ + GLint counter; + GLint *dmaptr; + void (*notify)( void ); + union { float f; int i; GLubyte ub4[4]; } vertex[16*4]; + + GLfloat *attrptr[16]; + GLuint size[16]; + + GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */ + GLuint primflags; + + GLboolean installed; + GLboolean recheck; + + GLint vertex_size; + GLint initial_counter; + GLint nrverts; + GLuint vertex_format; + + GLuint installed_vertex_format; + + struct prim primlist[RADEON_MAX_PRIMS]; + int nrprims; + + struct dfn_lists dfn_cache; + struct dfn_generators codegen; + GLvertexformat vtxfmt; +}; + + +extern void _tnl_InitVtxfmtChoosers( GLvertexformat *vfmt ); + + +#define FIXUP( CODE, OFFSET, CHECKVAL, NEWVAL ) \ +do { \ + int *icode = (int *)(CODE+OFFSET); \ + assert (*icode == CHECKVAL); \ + *icode = (int)NEWVAL; \ +} while (0) + + +/* Useful for figuring out the offsets: + */ +#define FIXUP2( CODE, OFFSET, CHECKVAL, NEWVAL ) \ +do { \ + while (*(int *)(CODE+OFFSET) != CHECKVAL) OFFSET++; \ + fprintf(stderr, "%s/%d CVAL %x OFFSET %d\n", __FUNCTION__, \ + __LINE__, CHECKVAL, OFFSET); \ + *(int *)(CODE+OFFSET) = (int)NEWVAL; \ + OFFSET += 4; \ +} while (0) + +/* + */ +void _tnl_InitCodegen( struct dfn_generators *gen ); +void _tnl_InitX86Codegen( struct dfn_generators *gen ); +void _tnl_InitSSECodegen( struct dfn_generators *gen ); + +void _tnl_copy_to_current( GLcontext *ctx ); + + +/* Defined in tnl_vtxfmt_c.c. + */ +struct dynfn *tnl_makeX86Vertex2f( TNLcontext *, int ); +struct dynfn *tnl_makeX86Vertex2fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86Vertex3f( TNLcontext *, int ); +struct dynfn *tnl_makeX86Vertex3fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color4ub( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color4ubv( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color3ub( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color3ubv( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color4f( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color4fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color3f( TNLcontext *, int ); +struct dynfn *tnl_makeX86Color3fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86SecondaryColor3ubEXT( TNLcontext *, int ); +struct dynfn *tnl_makeX86SecondaryColor3ubvEXT( TNLcontext *, int ); +struct dynfn *tnl_makeX86SecondaryColor3fEXT( TNLcontext *, int ); +struct dynfn *tnl_makeX86SecondaryColor3fvEXT( TNLcontext *, int ); +struct dynfn *tnl_makeX86Normal3f( TNLcontext *, int ); +struct dynfn *tnl_makeX86Normal3fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86TexCoord2f( TNLcontext *, int ); +struct dynfn *tnl_makeX86TexCoord2fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86TexCoord1f( TNLcontext *, int ); +struct dynfn *tnl_makeX86TexCoord1fv( TNLcontext *, int ); +struct dynfn *tnl_makeX86MultiTexCoord2fARB( TNLcontext *, int ); +struct dynfn *tnl_makeX86MultiTexCoord2fvARB( TNLcontext *, int ); +struct dynfn *tnl_makeX86MultiTexCoord1fARB( TNLcontext *, int ); +struct dynfn *tnl_makeX86MultiTexCoord1fvARB( TNLcontext *, int ); + + +#endif +#endif diff --git a/xc/extras/Mesa/src/tnl/t_vtx_exec.c b/xc/extras/Mesa/src/tnl/t_vtx_exec.c new file mode 100644 index 000000000..7e9db7892 --- /dev/null +++ b/xc/extras/Mesa/src/tnl/t_vtx_exec.c @@ -0,0 +1,632 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + * + */ +#include "api_noop.h" +#include "api_arrayelt.h" +#include "context.h" +#include "imports.h" +#include "mmath.h" +#include "mtypes.h" +#include "enums.h" +#include "glapi.h" +#include "colormac.h" +#include "light.h" +#include "state.h" +#include "vtxfmt.h" + +#include "tnl/tnl.h" +#include "tnl/t_context.h" +#include "tnl/t_array_api.h" + +static void _tnl_FlushVertices( GLcontext *, GLuint ); + + +void tnl_copy_to_current( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint flag = tnl->vertex_format; + GLint i; + + assert(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT); + + for (i = 0 ; i < 16 ; i++) + if (flag & (1<<i)) + COPY_4FV( ctx->Current.Attrib[i], tnl->attribptr[i] ); + + if (flag & VERT_BIT_INDEX) + ctx->Current.Index = tnl->indexptr[0]; + + if (flag & VERT_BIT_EDGEFLAG) + ctx->Current.EdgeFlag = tnl->edgeflagptr[0]; + + if (flag & VERT_BIT_MATERIAL) { + _mesa_update_material( ctx, + IM->Material[IM->LastMaterial], + IM->MaterialOrMask ); + + tnl->Driver.NotifyMaterialChange( ctx ); + } + + + ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; +} + +static GLboolean discreet_gl_prim[GL_POLYGON+1] = { + 1, /* 0 points */ + 1, /* 1 lines */ + 0, /* 2 line_strip */ + 0, /* 3 line_loop */ + 1, /* 4 tris */ + 0, /* 5 tri_fan */ + 0, /* 6 tri_strip */ + 1, /* 7 quads */ + 0, /* 8 quadstrip */ + 0, /* 9 poly */ +}; + +/* Optimize the primitive list: ONLY FOR EXECUTE ATM + */ +static void optimize_prims( TNLcontext *tnl ) +{ + int i, j; + + if (tnl->nrprims <= 1) + return; + + for (j = 0, i = 1 ; i < tnl->nrprims; i++) { + int pj = tnl->primlist[j].prim & 0xf; + int pi = tnl->primlist[i].prim & 0xf; + + if (pj == pi && discreet_gl_prim[pj] && + tnl->primlist[i].start == tnl->primlist[j].end) { + tnl->primlist[j].end = tnl->primlist[i].end; + } + else { + j++; + if (j != i) tnl->primlist[j] = tnl->primlist[i]; + } + } + + tnl->nrprims = j+1; +} + + +/* Bind vertex buffer pointers, run pipeline: + */ +static void flush_prims( TNLcontext *tnl ) +{ + int i,j; + + tnl->dma.current.ptr = tnl->dma.current.start += + (tnl->initial_counter - tnl->counter) * tnl->vertex_size * 4; + + tnl->tcl.vertex_format = tnl->vertex_format; + tnl->tcl.aos_components[0] = &tmp; + tnl->tcl.nr_aos_components = 1; + tnl->dma.flush = 0; + + tnl->Driver.RunPipeline( ... ); + + tnl->nrprims = 0; +} + + +static void start_prim( TNLcontext *tnl, GLuint mode ) +{ + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s %d\n", __FUNCTION__, + tnl->initial_counter - tnl->counter); + + tnl->primlist[tnl->nrprims].start = tnl->initial_counter - tnl->counter; + tnl->primlist[tnl->nrprims].prim = mode; +} + +static void note_last_prim( TNLcontext *tnl, GLuint flags ) +{ + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s %d\n", __FUNCTION__, + tnl->initial_counter - tnl->counter); + + if (tnl->prim[0] != GL_POLYGON+1) { + tnl->primlist[tnl->nrprims].prim |= flags; + tnl->primlist[tnl->nrprims].end = tnl->initial_counter - tnl->counter; + + if (++tnl->nrprims == TNL_MAX_PRIMS) + flush_prims( tnl ); + } +} + + +static void copy_vertex( TNLcontext *tnl, GLuint n, GLfloat *dst ) +{ + GLuint i; + GLfloat *src = (GLfloat *)(tnl->dma.current.address + + tnl->dma.current.ptr + + (tnl->primlist[tnl->nrprims].start + n) * + tnl->vertex_size * 4); + + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "copy_vertex %d\n", + tnl->primlist[tnl->nrprims].start + n); + + for (i = 0 ; i < tnl->vertex_size; i++) { + dst[i] = src[i]; + } +} + +static GLuint copy_wrapped_verts( TNLcontext *tnl, GLfloat (*tmp)[15] ) +{ + GLuint ovf, i; + GLuint nr = (tnl->initial_counter - tnl->counter) - tnl->primlist[tnl->nrprims].start; + + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s %d verts\n", __FUNCTION__, nr); + + switch( tnl->prim[0] ) + { + case GL_POINTS: + return 0; + case GL_LINES: + ovf = nr&1; + for (i = 0 ; i < ovf ; i++) + copy_vertex( tnl, nr-ovf+i, tmp[i] ); + return i; + case GL_TRIANGLES: + ovf = nr%3; + for (i = 0 ; i < ovf ; i++) + copy_vertex( tnl, nr-ovf+i, tmp[i] ); + return i; + case GL_QUADS: + ovf = nr&3; + for (i = 0 ; i < ovf ; i++) + copy_vertex( tnl, nr-ovf+i, tmp[i] ); + return i; + case GL_LINE_STRIP: + if (nr == 0) + return 0; + copy_vertex( tnl, nr-1, tmp[0] ); + return 1; + case GL_LINE_LOOP: + case GL_TRIANGLE_FAN: + case GL_POLYGON: + if (nr == 0) + return 0; + else if (nr == 1) { + copy_vertex( tnl, 0, tmp[0] ); + return 1; + } else { + copy_vertex( tnl, 0, tmp[0] ); + copy_vertex( tnl, nr-1, tmp[1] ); + return 2; + } + case GL_TRIANGLE_STRIP: + ovf = MIN2( nr-1, 2 ); + for (i = 0 ; i < ovf ; i++) + copy_vertex( tnl, nr-ovf+i, tmp[i] ); + return i; + case GL_QUAD_STRIP: + ovf = MIN2( nr-1, 2 ); + if (nr > 2) ovf += nr&1; + for (i = 0 ; i < ovf ; i++) + copy_vertex( tnl, nr-ovf+i, tmp[i] ); + return i; + default: + assert(0); + return 0; + } +} + + + +/* Extend for vertex-format changes on wrap: + */ +static void wrap_buffer( void ) +{ + TNLcontext *tnl = tnl->tnl; + GLfloat tmp[3][15]; + GLuint i, nrverts; + + if (MESA_VERBOSE & (DEBUG_VFMT|DEBUG_PRIMS)) + _mesa_debug(NULL, "%s %d\n", __FUNCTION__, + tnl->initial_counter - tnl->counter); + + /* Don't deal with parity. *** WONT WORK FOR COMPILE + */ + if ((((tnl->initial_counter - tnl->counter) - + tnl->primlist[tnl->nrprims].start) & 1)) { + tnl->counter++; + tnl->initial_counter++; + return; + } + + /* Copy vertices out of dma: + */ + nrverts = copy_dma_verts( tnl, tmp ); + + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%d vertices to copy\n", nrverts); + + + /* Finish the prim at this point: + */ + note_last_prim( tnl, 0 ); + flush_prims( tnl ); + + /* Reset counter, dmaptr + */ + tnl->dmaptr = (int *)(tnl->dma.current.ptr + tnl->dma.current.address); + tnl->counter = (tnl->dma.current.end - tnl->dma.current.ptr) / + (tnl->vertex_size * 4); + tnl->counter--; + tnl->initial_counter = tnl->counter; + tnl->notify = wrap_buffer; + + tnl->dma.flush = flush_prims; + start_prim( tnl, tnl->prim[0] ); + + + /* Reemit saved vertices + * *** POSSIBLY IN NEW FORMAT + * --> Can't always extend at end of vertex? + */ + for (i = 0 ; i < nrverts; i++) { + if (MESA_VERBOSE & DEBUG_VERTS) { + int j; + _mesa_debug(NULL, "re-emit vertex %d to %p\n", i, tnl->dmaptr); + if (MESA_VERBOSE & DEBUG_VERBOSE) + for (j = 0 ; j < tnl->vertex_size; j++) + _mesa_debug(NULL, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]); + } + + memcpy( tnl->dmaptr, tmp[i], tnl->vertex_size * 4 ); + tnl->dmaptr += tnl->vertex_size; + tnl->counter--; + } +} + + + +/* Always follow data, don't try to predict what's necessary. + */ +static GLboolean check_vtx_fmt( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) + ctx->Driver.FlushVertices( ctx, FLUSH_UPDATE_CURRENT ); + + + TNL_NEWPRIM(tnl); + tnl->vertex_format = VERT_BIT_POS; + tnl->prim = &ctx->Driver.CurrentExecPrimitive; + + + /* Currently allow the full 4 components per attrib. Can use the + * mechanism from radeon driver color handling to reduce this (and + * also to store ubyte colors where these are incoming). This + * won't work for compile mode. + * + * Only adding components when they are first received eliminates + * the need for displaylist fixup, as there are no 'empty' slots + * at the start of buffers. + */ + for (i = 0 ; i < 16 ; i++) { + if (ind & (1<<i)) { + tnl->attribptr[i] = &tnl->vertex[tnl->vertex_size].f; + tnl->vertex_size += 4; + tnl->attribptr[i][0] = ctx->Current.Attrib[i][0]; + tnl->attribptr[i][1] = ctx->Current.Attrib[i][1]; + tnl->attribptr[i][2] = ctx->Current.Attrib[i][2]; + tnl->attribptr[i][3] = ctx->Current.Attrib[i][3]; + } + else + tnl->attribptr[i] = ctx->Current.Attrib[i]; + } + + /* Edgeflag, Index: + */ + for (i = 16 ; i < 18 ; i++) + ; + + /* Materials: + */ + for (i = 18 ; i < 28 ; i++) + ; + + /* Eval: + */ + for (i = 28 ; i < 29 ; i++) + ; + + + if (tnl->installed_vertex_format != tnl->vertex_format) { + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "reinstall on vertex_format change\n"); + _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); + tnl->installed_vertex_format = tnl->vertex_format; + } + + return GL_TRUE; +} + + +void _tnl_InvalidateVtxfmt( GLcontext *ctx ) +{ + tnl->recheck = GL_TRUE; + tnl->fell_back = GL_FALSE; +} + + + + +static void _tnl_ValidateVtxfmt( GLcontext *ctx ) +{ + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s\n", __FUNCTION__); + + if (ctx->Driver.NeedFlush) + ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush ); + + tnl->recheck = GL_FALSE; + + if (check_vtx_fmt( ctx )) { + if (!tnl->installed) { + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "reinstall (new install)\n"); + + _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); + ctx->Driver.FlushVertices = _tnl_FlushVertices; + tnl->installed = GL_TRUE; + } + else + _mesa_debug(NULL, "%s: already installed", __FUNCTION__); + } + else { + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s: failed\n", __FUNCTION__); + + if (tnl->installed) { + if (tnl->tnl->dma.flush) + tnl->tnl->dma.flush( tnl->tnl ); + _tnl_wakeup_exec( ctx ); + tnl->installed = GL_FALSE; + } + } +} + + + + + +/* Begin/End + */ +static void _tnl_Begin( GLenum mode ) +{ + GLcontext *ctx = tnl->context; + TNLcontext *tnl = tnl->tnl; + + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s\n", __FUNCTION__); + + if (mode > GL_POLYGON) { + _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" ); + return; + } + + if (tnl->prim[0] != GL_POLYGON+1) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" ); + return; + } + + if (ctx->NewState) + _mesa_update_state( ctx ); + + if (tnl->recheck) + _tnl_ValidateVtxfmt( ctx ); + + if (tnl->dma.flush && tnl->counter < 12) { + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s: flush almost-empty buffers\n", __FUNCTION__); + flush_prims( tnl ); + } + + if (!tnl->dma.flush) { + if (tnl->dma.current.ptr + 12*tnl->vertex_size*4 > + tnl->dma.current.end) { + TNL_NEWPRIM( tnl ); + _tnl_RefillCurrentDmaRegion( tnl ); + } + + tnl->dmaptr = (int *)(tnl->dma.current.address + tnl->dma.current.ptr); + tnl->counter = (tnl->dma.current.end - tnl->dma.current.ptr) / + (tnl->vertex_size * 4); + tnl->counter--; + tnl->initial_counter = tnl->counter; + tnl->notify = wrap_buffer; + tnl->dma.flush = flush_prims; + tnl->context->Driver.NeedFlush |= FLUSH_STORED_VERTICES; + } + + + tnl->prim[0] = mode; + start_prim( tnl, mode | PRIM_BEGIN ); +} + + + + + +static void _tnl_End( void ) +{ + TNLcontext *tnl = tnl->tnl; + GLcontext *ctx = tnl->context; + + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s\n", __FUNCTION__); + + if (tnl->prim[0] == GL_POLYGON+1) { + _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); + return; + } + + note_last_prim( tnl, PRIM_END ); + tnl->prim[0] = GL_POLYGON+1; +} + + +static void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ) +{ + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "%s\n", __FUNCTION__); + + assert(tnl->installed); + + if (flags & FLUSH_UPDATE_CURRENT) { + _tnl_copy_to_current( ctx ); + if (MESA_VERBOSE & DEBUG_VFMT) + _mesa_debug(NULL, "reinstall on update_current\n"); + _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); + ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; + } + + if (flags & FLUSH_STORED_VERTICES) { + TNLcontext *tnl = TNL_CONTEXT( ctx ); + assert (tnl->dma.flush == 0 || + tnl->dma.flush == flush_prims); + if (tnl->dma.flush == flush_prims) + flush_prims( TNL_CONTEXT( ctx ) ); + ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES; + } +} + + + +/* At this point, don't expect very many versions of each function to + * be generated, so not concerned about freeing them? + */ + + +static void _tnl_InitVtxfmt( GLcontext *ctx ) +{ + GLvertexformat *vfmt = &(tnl->vtxfmt); + + MEMSET( vfmt, 0, sizeof(GLvertexformat) ); + + /* Hook in chooser functions for codegen, etc: + */ + _tnl_InitVtxfmtChoosers( vfmt ); + + /* Handled fully in supported states, but no codegen: + */ + vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + vfmt->Rectf = _mesa_noop_Rectf; /* generic helper */ + vfmt->Begin = _tnl_Begin; + vfmt->End = _tnl_End; + + tnl->context = ctx; + tnl->tnl = TNL_CONTEXT(ctx); + tnl->prim = &ctx->Driver.CurrentExecPrimitive; + tnl->primflags = 0; + + make_empty_list( &tnl->dfn_cache.Vertex2f ); + make_empty_list( &tnl->dfn_cache.Vertex2fv ); + make_empty_list( &tnl->dfn_cache.Vertex3f ); + make_empty_list( &tnl->dfn_cache.Vertex3fv ); + make_empty_list( &tnl->dfn_cache.Color4ub ); + make_empty_list( &tnl->dfn_cache.Color4ubv ); + make_empty_list( &tnl->dfn_cache.Color3ub ); + make_empty_list( &tnl->dfn_cache.Color3ubv ); + make_empty_list( &tnl->dfn_cache.Color4f ); + make_empty_list( &tnl->dfn_cache.Color4fv ); + make_empty_list( &tnl->dfn_cache.Color3f ); + make_empty_list( &tnl->dfn_cache.Color3fv ); + make_empty_list( &tnl->dfn_cache.SecondaryColor3fEXT ); + make_empty_list( &tnl->dfn_cache.SecondaryColor3fvEXT ); + make_empty_list( &tnl->dfn_cache.SecondaryColor3ubEXT ); + make_empty_list( &tnl->dfn_cache.SecondaryColor3ubvEXT ); + make_empty_list( &tnl->dfn_cache.Normal3f ); + make_empty_list( &tnl->dfn_cache.Normal3fv ); + make_empty_list( &tnl->dfn_cache.TexCoord2f ); + make_empty_list( &tnl->dfn_cache.TexCoord2fv ); + make_empty_list( &tnl->dfn_cache.TexCoord1f ); + make_empty_list( &tnl->dfn_cache.TexCoord1fv ); + make_empty_list( &tnl->dfn_cache.MultiTexCoord2fARB ); + make_empty_list( &tnl->dfn_cache.MultiTexCoord2fvARB ); + make_empty_list( &tnl->dfn_cache.MultiTexCoord1fARB ); + make_empty_list( &tnl->dfn_cache.MultiTexCoord1fvARB ); + + _tnl_InitCodegen( &tnl->codegen ); +} + +static void free_funcs( struct dynfn *l ) +{ + struct dynfn *f, *tmp; + foreach_s (f, tmp, l) { + remove_from_list( f ); + ALIGN_FREE( f->code ); + FREE( f ); + } +} + + +static void _tnl_DestroyVtxfmt( GLcontext *ctx ) +{ + count_funcs(); + free_funcs( &tnl->dfn_cache.Vertex2f ); + free_funcs( &tnl->dfn_cache.Vertex2fv ); + free_funcs( &tnl->dfn_cache.Vertex3f ); + free_funcs( &tnl->dfn_cache.Vertex3fv ); + free_funcs( &tnl->dfn_cache.Color4ub ); + free_funcs( &tnl->dfn_cache.Color4ubv ); + free_funcs( &tnl->dfn_cache.Color3ub ); + free_funcs( &tnl->dfn_cache.Color3ubv ); + free_funcs( &tnl->dfn_cache.Color4f ); + free_funcs( &tnl->dfn_cache.Color4fv ); + free_funcs( &tnl->dfn_cache.Color3f ); + free_funcs( &tnl->dfn_cache.Color3fv ); + free_funcs( &tnl->dfn_cache.SecondaryColor3ubEXT ); + free_funcs( &tnl->dfn_cache.SecondaryColor3ubvEXT ); + free_funcs( &tnl->dfn_cache.SecondaryColor3fEXT ); + free_funcs( &tnl->dfn_cache.SecondaryColor3fvEXT ); + free_funcs( &tnl->dfn_cache.Normal3f ); + free_funcs( &tnl->dfn_cache.Normal3fv ); + free_funcs( &tnl->dfn_cache.TexCoord2f ); + free_funcs( &tnl->dfn_cache.TexCoord2fv ); + free_funcs( &tnl->dfn_cache.TexCoord1f ); + free_funcs( &tnl->dfn_cache.TexCoord1fv ); + free_funcs( &tnl->dfn_cache.MultiTexCoord2fARB ); + free_funcs( &tnl->dfn_cache.MultiTexCoord2fvARB ); + free_funcs( &tnl->dfn_cache.MultiTexCoord1fARB ); + free_funcs( &tnl->dfn_cache.MultiTexCoord1fvARB ); +} + diff --git a/xc/extras/Mesa/src/tnl/t_vtx_sse.c b/xc/extras/Mesa/src/tnl/t_vtx_sse.c new file mode 100644 index 000000000..8998c901b --- /dev/null +++ b/xc/extras/Mesa/src/tnl/t_vtx_sse.c @@ -0,0 +1,91 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + */ + +#include "imports.h" +#include "simple_list.h" +#include "t_vtx_api.h" + +#if defined(USE_SSE_ASM) + +/* Build specialized versions of the immediate calls on the fly for + * the current state. ???P4 SSE2 versions??? + */ + + +static struct dynfn *makeSSENormal3fv( struct _vb *vb, int key ) +{ + /* Requires P4 (sse2?) + */ + static unsigned char temp[] = { + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $0x12345678,%edx */ + 0xf3, 0x0f, 0x7e, 0x00, /* movq (%eax),%xmm0 */ + 0x66, 0x0f, 0x6e, 0x48, 0x08, /* movd 0x8(%eax),%xmm1 */ + 0x66, 0x0f, 0xd6, 0x42, 0x0c, /* movq %xmm0,0xc(%edx) */ + 0x66, 0x0f, 0x7e, 0x4a, 0x14, /* movd %xmm1,0x14(%edx) */ + 0xc3, /* ret */ + }; + + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + insert_at_head( &vb->dfn_cache.Normal3fv, dfn ); + dfn->key = key; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 5, 0x0, (int)vb->normalptr); + return dfn; +} + +void _tnl_InitSSECodegen( struct dfn_generators *gen ) +{ + /* Need to: + * - check kernel sse support + * - check p4/sse2 + */ + (void) makeSSENormal3fv; +} + + +#else + +void _tnl_InitSSECodegen( struct dfn_generators *gen ) +{ + (void) gen; +} + +#endif + + + + diff --git a/xc/extras/Mesa/src/tnl/t_vtx_x86.c b/xc/extras/Mesa/src/tnl/t_vtx_x86.c new file mode 100644 index 000000000..7a55db72d --- /dev/null +++ b/xc/extras/Mesa/src/tnl/t_vtx_x86.c @@ -0,0 +1,705 @@ +/* $XFree86$ */ +/************************************************************************** + +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +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 +on the rights to use, copy, modify, merge, publish, distribute, sub +license, 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 (including the next +paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL +TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS 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. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + */ + +#include "imports.h" +#include "mmath.h" +#include "simple_list.h" +#include "tnl_vtxfmt.h" + +#if defined(USE_X86_ASM) + + +struct dynfn *tnl_makeX86Vertex2f( TNLcontext *tnl, int key ) +{ + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (RADEON_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + switch (tnl->vertex_size) { + default: { + /* Repz convenient as it's possible to emit code for any size + * vertex with little tweaking. Might as well read vertsize + * though, and have only one of these. + */ + static char temp[] = { + 0x57, /* push %edi */ + 0x56, /* push %esi */ + 0xbe, 0, 0, 0, 0, /* mov $VERTEX+2,%esi */ + 0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ + 0x8b, 0x44, 0x24, 0x0c, /* mov 0x0c(%esp,1),%eax */ + 0x8b, 0x54, 0x24, 0x10, /* mov 0x10(%esp,1),%edx */ + 0x89, 0x07, /* mov %eax,(%edi) */ + 0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ + 0x83, 0xc7, 0x08, /* add $0x8,%edi */ + 0xb9, 0, 0, 0, 0, /* mov $VERTSIZE-2,%ecx */ + 0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ + 0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ + 0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ + 0x48, /* dec %eax */ + 0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ + 0x5e, /* pop %esi */ + 0x5f, /* pop %edi */ + 0x74, 0x01, /* je +1 */ + 0xc3, /* ret */ + 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[2]); + FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 37, 0x0, tnl->vertex_size-2); + FIXUP(dfn->code, 44, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 50, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 56, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); + break; + } + } + + insert_at_head( &tnl->dfn_cache.Vertex3f, dfn ); + dfn->key = key; + return dfn; +} + +/* Build specialized versions of the immediate calls on the fly for + * the current state. Generic x86 versions. + */ + +struct dynfn *tnl_makeX86Vertex3f( TNLcontext *tnl, int key ) +{ + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (RADEON_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + switch (tnl->vertex_size) { + case 4: { + static char temp[] = { + 0x8b, 0x0d, 0,0,0,0, /* mov DMAPTR,%ecx */ + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0x8b, 0x54, 0x24, 0x08, /* mov 0x8(%esp,1),%edx */ + 0x89, 0x01, /* mov %eax,(%ecx) */ + 0x89, 0x51, 0x04, /* mov %edx,0x4(%ecx) */ + 0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ + 0x8b, 0x15, 0,0,0,0, /* mov VERTEX[3],%edx */ + 0x89, 0x41, 0x08, /* mov %eax,0x8(%ecx) */ + 0x89, 0x51, 0x0c, /* mov %edx,0xc(%ecx) */ + 0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ + 0x83, 0xc1, 0x10, /* add $0x10,%ecx */ + 0x48, /* dec %eax */ + 0x89, 0x0d, 0,0,0,0, /* mov %ecx,DMAPTR */ + 0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ + 0x74, 0x01, /* je +1 */ + 0xc3, /* ret */ + 0xff, 0x25, 0,0,0,0 /* jmp *NOTIFY */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 2, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 25, 0x0, (int)&tnl->vertex[3]); + FIXUP(dfn->code, 36, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 46, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 51, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 60, 0x0, (int)&tnl->notify); + break; + } + case 6: { + static char temp[] = { + 0x57, /* push %edi */ + 0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ + 0x8b, 0x44, 0x24, 0x8, /* mov 0x8(%esp,1),%eax */ + 0x8b, 0x54, 0x24, 0xc, /* mov 0xc(%esp,1),%edx */ + 0x8b, 0x4c, 0x24, 0x10, /* mov 0x10(%esp,1),%ecx */ + 0x89, 0x07, /* mov %eax,(%edi) */ + 0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ + 0x89, 0x4f, 0x08, /* mov %ecx,0x8(%edi) */ + 0xa1, 0, 0, 0, 0, /* mov VERTEX[3],%eax */ + 0x8b, 0x15, 0, 0, 0, 0, /* mov VERTEX[4],%edx */ + 0x8b, 0x0d, 0, 0, 0, 0, /* mov VERTEX[5],%ecx */ + 0x89, 0x47, 0x0c, /* mov %eax,0xc(%edi) */ + 0x89, 0x57, 0x10, /* mov %edx,0x10(%edi) */ + 0x89, 0x4f, 0x14, /* mov %ecx,0x14(%edi) */ + 0x83, 0xc7, 0x18, /* add $0x18,%edi */ + 0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ + 0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ + 0x48, /* dec %eax */ + 0x5f, /* pop %edi */ + 0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ + 0x74, 0x01, /* je +1 */ + 0xc3, /* ret */ + 0xff, 0x25, 0,0,0,0, /* jmp *NOTIFY */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 3, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 28, 0x0, (int)&tnl->vertex[3]); + FIXUP(dfn->code, 34, 0x0, (int)&tnl->vertex[4]); + FIXUP(dfn->code, 40, 0x0, (int)&tnl->vertex[5]); + FIXUP(dfn->code, 57, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 63, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 70, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 79, 0x0, (int)&tnl->notify); + break; + } + default: { + /* Repz convenient as it's possible to emit code for any size + * vertex with little tweaking. Might as well read vertsize + * though, and have only one of these. + */ + static char temp[] = { + 0x57, /* push %edi */ + 0x56, /* push %esi */ + 0xbe, 0, 0, 0, 0, /* mov $VERTEX+3,%esi */ + 0x8b, 0x3d, 0, 0, 0, 0, /* mov DMAPTR,%edi */ + 0x8b, 0x44, 0x24, 0x0c, /* mov 0x0c(%esp,1),%eax */ + 0x8b, 0x54, 0x24, 0x10, /* mov 0x10(%esp,1),%edx */ + 0x8b, 0x4c, 0x24, 0x14, /* mov 0x14(%esp,1),%ecx */ + 0x89, 0x07, /* mov %eax,(%edi) */ + 0x89, 0x57, 0x04, /* mov %edx,0x4(%edi) */ + 0x89, 0x4f, 0x08, /* mov %ecx,0x8(%edi) */ + 0x83, 0xc7, 0x0c, /* add $0xc,%edi */ + 0xb9, 0, 0, 0, 0, /* mov $VERTSIZE-3,%ecx */ + 0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ + 0xa1, 0, 0, 0, 0, /* mov COUNTER,%eax */ + 0x89, 0x3d, 0, 0, 0, 0, /* mov %edi,DMAPTR */ + 0x48, /* dec %eax */ + 0xa3, 0, 0, 0, 0, /* mov %eax,COUNTER */ + 0x5e, /* pop %esi */ + 0x5f, /* pop %edi */ + 0x74, 0x01, /* je +1 */ + 0xc3, /* ret */ + 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 3, 0x0, (int)&tnl->vertex[3]); + FIXUP(dfn->code, 9, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 37, 0x0, tnl->vertex_size-3); + FIXUP(dfn->code, 44, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 50, 0x0, (int)&tnl->dmaptr); + FIXUP(dfn->code, 56, 0x0, (int)&tnl->counter); + FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); + break; + } + } + + insert_at_head( &tnl->dfn_cache.Vertex3f, dfn ); + dfn->key = key; + return dfn; +} + + + +struct dynfn *tnl_makeX86Vertex3fv( TNLcontext *tnl, int key ) +{ + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + switch (tnl->vertex_size) { + case 6: { + static char temp[] = { + 0xa1, 0x00, 0x00, 0, 0, /* mov 0x0,%eax */ + 0x8b, 0x4c, 0x24, 0x04, /* mov 0x4(%esp,1),%ecx */ + 0x8b, 0x11, /* mov (%ecx),%edx */ + 0x89, 0x10, /* mov %edx,(%eax) */ + 0x8b, 0x51, 0x04, /* mov 0x4(%ecx),%edx */ + 0x8b, 0x49, 0x08, /* mov 0x8(%ecx),%ecx */ + 0x89, 0x50, 0x04, /* mov %edx,0x4(%eax) */ + 0x89, 0x48, 0x08, /* mov %ecx,0x8(%eax) */ + 0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ + 0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ + 0x89, 0x50, 0x0c, /* mov %edx,0xc(%eax) */ + 0x89, 0x48, 0x10, /* mov %ecx,0x10(%eax) */ + 0x8b, 0x15, 0x24, 0, 0, 0, /* mov 0x24,%edx */ + 0x89, 0x50, 0x14, /* mov %edx,0x14(%eax) */ + 0x83, 0xc0, 0x18, /* add $0x18,%eax */ + 0xa3, 0x00, 0x00, 0, 0, /* mov %eax,0x0 */ + 0xa1, 0x04, 0x00, 0, 0, /* mov 0x4,%eax */ + 0x48, /* dec %eax */ + 0xa3, 0x04, 0x00, 0, 0, /* mov %eax,0x4 */ + 0x74, 0x01, /* je 2a4 <.f11> */ + 0xc3, /* ret */ + 0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr); + FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]); + FIXUP(dfn->code, 33, 0x00000020, (int)&tnl->vertex[4]); + FIXUP(dfn->code, 45, 0x00000024, (int)&tnl->vertex[5]); + FIXUP(dfn->code, 56, 0x00000000, (int)&tnl->dmaptr); + FIXUP(dfn->code, 61, 0x00000004, (int)&tnl->counter); + FIXUP(dfn->code, 67, 0x00000004, (int)&tnl->counter); + FIXUP(dfn->code, 76, 0x00000008, (int)&tnl->notify); + break; + } + + + case 8: { + static char temp[] = { + 0xa1, 0x00, 0x00, 0, 0, /* mov 0x0,%eax */ + 0x8b, 0x4c, 0x24, 0x04, /* mov 0x4(%esp,1),%ecx */ + 0x8b, 0x11, /* mov (%ecx),%edx */ + 0x89, 0x10, /* mov %edx,(%eax) */ + 0x8b, 0x51, 0x04, /* mov 0x4(%ecx),%edx */ + 0x8b, 0x49, 0x08, /* mov 0x8(%ecx),%ecx */ + 0x89, 0x50, 0x04, /* mov %edx,0x4(%eax) */ + 0x89, 0x48, 0x08, /* mov %ecx,0x8(%eax) */ + 0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ + 0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ + 0x89, 0x50, 0x0c, /* mov %edx,0xc(%eax) */ + 0x89, 0x48, 0x10, /* mov %ecx,0x10(%eax) */ + 0x8b, 0x15, 0x1c, 0, 0, 0, /* mov 0x1c,%edx */ + 0x8b, 0x0d, 0x20, 0, 0, 0, /* mov 0x20,%ecx */ + 0x89, 0x50, 0x14, /* mov %edx,0x14(%eax) */ + 0x89, 0x48, 0x18, /* mov %ecx,0x18(%eax) */ + 0x8b, 0x15, 0x24, 0, 0, 0, /* mov 0x24,%edx */ + 0x89, 0x50, 0x1c, /* mov %edx,0x1c(%eax) */ + 0x83, 0xc0, 0x20, /* add $0x20,%eax */ + 0xa3, 0x00, 0x00, 0, 0, /* mov %eax,0x0 */ + 0xa1, 0x04, 0x00, 0, 0, /* mov 0x4,%eax */ + 0x48, /* dec %eax */ + 0xa3, 0x04, 0x00, 0, 0, /* mov %eax,0x4 */ + 0x74, 0x01, /* je 2a4 <.f11> */ + 0xc3, /* ret */ + 0xff, 0x25, 0x08, 0, 0, 0, /* jmp *0x8 */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 1, 0x00000000, (int)&tnl->dmaptr); + FIXUP(dfn->code, 27, 0x0000001c, (int)&tnl->vertex[3]); + FIXUP(dfn->code, 33, 0x00000020, (int)&tnl->vertex[4]); + FIXUP(dfn->code, 45, 0x0000001c, (int)&tnl->vertex[5]); + FIXUP(dfn->code, 51, 0x00000020, (int)&tnl->vertex[6]); + FIXUP(dfn->code, 63, 0x00000024, (int)&tnl->vertex[7]); + FIXUP(dfn->code, 74, 0x00000000, (int)&tnl->dmaptr); + FIXUP(dfn->code, 79, 0x00000004, (int)&tnl->counter); + FIXUP(dfn->code, 85, 0x00000004, (int)&tnl->counter); + FIXUP(dfn->code, 94, 0x00000008, (int)&tnl->notify); + break; + } + + + + default: { + /* Repz convenient as it's possible to emit code for any size + * vertex with little tweaking. Might as well read vertsize + * though, and have only one of these. + */ + static char temp[] = { + 0x8b, 0x54, 0x24, 0x04, /* mov 0x4(%esp,1),%edx */ + 0x57, /* push %edi */ + 0x56, /* push %esi */ + 0x8b, 0x3d, 1,1,1,1, /* mov DMAPTR,%edi */ + 0x8b, 0x02, /* mov (%edx),%eax */ + 0x8b, 0x4a, 0x04, /* mov 0x4(%edx),%ecx */ + 0x8b, 0x72, 0x08, /* mov 0x8(%edx),%esi */ + 0x89, 0x07, /* mov %eax,(%edi) */ + 0x89, 0x4f, 0x04, /* mov %ecx,0x4(%edi) */ + 0x89, 0x77, 0x08, /* mov %esi,0x8(%edi) */ + 0x83, 0xc7, 0x0c, /* add $0xc,%edi */ + 0xb9, 0x06, 0x00, 0x00, 0x00, /* mov $VERTSIZE-3,%ecx */ + 0xbe, 0x58, 0x00, 0x00, 0x00, /* mov $VERTEX[3],%esi */ + 0xf3, 0xa5, /* repz movsl %ds:(%esi),%es:(%edi)*/ + 0x89, 0x3d, 1, 1, 1, 1, /* mov %edi,DMAPTR */ + 0xa1, 2, 2, 2, 2, /* mov COUNTER,%eax */ + 0x5e, /* pop %esi */ + 0x5f, /* pop %edi */ + 0x48, /* dec %eax */ + 0xa3, 2, 2, 2, 2, /* mov %eax,COUNTER */ + 0x74, 0x01, /* je +1 */ + 0xc3, /* ret */ + 0xff, 0x25, 0, 0, 0, 0 /* jmp NOTIFY */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 8, 0x01010101, (int)&tnl->dmaptr); + FIXUP(dfn->code, 32, 0x00000006, tnl->vertex_size-3); + FIXUP(dfn->code, 37, 0x00000058, (int)&tnl->vertex[3]); + FIXUP(dfn->code, 45, 0x01010101, (int)&tnl->dmaptr); + FIXUP(dfn->code, 50, 0x02020202, (int)&tnl->counter); + FIXUP(dfn->code, 58, 0x02020202, (int)&tnl->counter); + FIXUP(dfn->code, 67, 0x0, (int)&tnl->notify); + break; + } + } + + insert_at_head( &tnl->dfn_cache.Vertex3fv, dfn ); + dfn->key = key; + return dfn; +} + + +struct dynfn *tnl_makeX86Attr4fv( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0xba, 0, 0, 0, 0, /* mov $DEST,%edx */ + 0x8b, 0x08, /* mov (%eax),%ecx */ + 0x89, 0x0a, /* mov %ecx,(%edx) */ + 0x8b, 0x48, 0x04, /* mov 0x4(%eax),%ecx */ + 0x89, 0x4a, 0x04, /* mov %ecx,0x4(%edx) */ + 0x8b, 0x48, 0x08, /* mov 0x8(%eax),%ecx */ + 0x89, 0x4a, 0x08, /* mov %ecx,0x8(%edx) */ + 0x8b, 0x48, 0x0a, /* mov 0xa(%eax),%ecx */ + 0x89, 0x4a, 0x0a, /* mov %ecx,0xa(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.Normal3fv, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); + return dfn; +} + +struct dynfn *tnl_makeX86Attr4f( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0x89, 0x02, /* mov %eax,(%edx) */ + 0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ + 0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ + 0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ + 0x89, 0x42, 0x08, /* mov %eax,0x8(%edx) */ + 0x8b, 0x44, 0x24, 0x10, /* mov 0x10(%esp,1),%eax */ + 0x89, 0x42, 0x0a, /* mov %eax,0xa(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); + return dfn; +} + + +struct dynfn *tnl_makeX86Attr3fv( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0xba, 0, 0, 0, 0, /* mov $DEST,%edx */ + 0x8b, 0x08, /* mov (%eax),%ecx */ + 0x89, 0x0a, /* mov %ecx,(%edx) */ + 0x8b, 0x48, 0x04, /* mov 0x4(%eax),%ecx */ + 0x89, 0x4a, 0x04, /* mov %ecx,0x4(%edx) */ + 0x8b, 0x48, 0x08, /* mov 0x8(%eax),%ecx */ + 0x89, 0x4a, 0x08, /* mov %ecx,0x8(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.Normal3fv, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 5, 0x0, (int)tnl->normalptr); + return dfn; +} + +struct dynfn *tnl_makeX86Attr3f( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0x89, 0x02, /* mov %eax,(%edx) */ + 0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ + 0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ + 0x8b, 0x44, 0x24, 0x0c, /* mov 0xc(%esp,1),%eax */ + 0x89, 0x42, 0x08, /* mov %eax,0x8(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 1, 0x12345678, (int)tnl->normalptr); + return dfn; +} + +struct dynfn *tnl_makeX86Attr4ubv( TNLcontext *tnl, int key ) +{ + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + insert_at_head( &tnl->dfn_cache.Color4ubv, dfn ); + dfn->key = key; + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + if (key & TNL_CP_VC_FRMT_PKCOLOR) { + static char temp[] = { + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x00, /* mov (%eax),%eax */ + 0x89, 0x02, /* mov %eax,(%edx) */ + 0xc3, /* ret */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 5, 0x12345678, (int)tnl->ubytecolorptr); + return dfn; + } + else { + static char temp[] = { + 0x53, /* push %ebx */ + 0xba, 0x00, 0x00, 0x00, 0x00, /* mov $0x0,%edx */ + 0x31, 0xc0, /* xor %eax,%eax */ + 0x31, 0xc9, /* xor %ecx,%ecx */ + 0x8b, 0x5c, 0x24, 0x08, /* mov 0x8(%esp,1), %ebx */ + 0x8b, 0x1b, /* mov (%ebx), %ebx */ + 0x88, 0xd8, /* mov %bl, %al */ + 0x88, 0xf9, /* mov %bh, %cl */ + 0x8b, 0x04, 0x82, /* mov (%edx,%eax,4),%eax */ + 0x8b, 0x0c, 0x8a, /* mov (%edx,%ecx,4),%ecx */ + 0xa3, 0xaf, 0xbe, 0xad, 0xde, /* mov %eax,0xdeadbeaf */ + 0x89, 0x0d, 0xaf, 0xbe, 0xad, 0xde, /* mov %ecx,0xdeadbeaf */ + 0x31, 0xc0, /* xor %eax,%eax */ + 0x31, 0xc9, /* xor %ecx,%ecx */ + 0xc1, 0xeb, 0x10, /* shr $0x10, %ebx */ + 0x88, 0xd8, /* mov %bl, %al */ + 0x88, 0xf9, /* mov %bh, %cl */ + 0x8b, 0x04, 0x82, /* mov (%edx,%eax,4),%eax */ + 0x8b, 0x0c, 0x8a, /* mov (%edx,%ecx,4),%ecx */ + 0xa3, 0xaf, 0xbe, 0xad, 0xde, /* mov %eax,0xdeadbeaf */ + 0x89, 0x0d, 0xaf, 0xbe, 0xad, 0xde, /* mov %ecx,0xdeadbeaf */ + 0x5b, /* pop %ebx */ + 0xc3, /* ret */ + }; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 2, 0x00000000, (int)_mesa_ubyte_to_float_color_tab); + FIXUP(dfn->code, 27, 0xdeadbeaf, (int)tnl->floatcolorptr); + FIXUP(dfn->code, 33, 0xdeadbeaf, (int)tnl->floatcolorptr+4); + FIXUP(dfn->code, 55, 0xdeadbeaf, (int)tnl->floatcolorptr+8); + FIXUP(dfn->code, 61, 0xdeadbeaf, (int)tnl->floatcolorptr+12); + return dfn; + } +} + +struct dynfn *tnl_makeX86Attr4ub( TNLcontext *tnl, int key ) +{ + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + if (key & TNL_CP_VC_FRMT_PKCOLOR) { + /* XXX push/pop */ + static char temp[] = { + 0x53, /* push %ebx */ + 0x8b, 0x44, 0x24, 0x08, /* mov 0x8(%esp,1),%eax */ + 0x8b, 0x54, 0x24, 0x0c, /* mov 0xc(%esp,1),%edx */ + 0x8b, 0x4c, 0x24, 0x10, /* mov 0x10(%esp,1),%ecx */ + 0x8b, 0x5c, 0x24, 0x14, /* mov 0x14(%esp,1),%ebx */ + 0xa2, 0, 0, 0, 0, /* mov %al,DEST */ + 0x88, 0x15, 0, 0, 0, 0, /* mov %dl,DEST+1 */ + 0x88, 0x0d, 0, 0, 0, 0, /* mov %cl,DEST+2 */ + 0x88, 0x1d, 0, 0, 0, 0, /* mov %bl,DEST+3 */ + 0x5b, /* pop %ebx */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + insert_at_head( &tnl->dfn_cache.Color4ub, dfn ); + dfn->key = key; + + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 18, 0x0, (int)tnl->ubytecolorptr); + FIXUP(dfn->code, 24, 0x0, (int)tnl->ubytecolorptr+1); + FIXUP(dfn->code, 30, 0x0, (int)tnl->ubytecolorptr+2); + FIXUP(dfn->code, 36, 0x0, (int)tnl->ubytecolorptr+3); + return dfn; + } + else + return 0; +} + + + +struct dynfn *tnl_makeX86Attr2fv( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x08, /* mov (%eax),%ecx */ + 0x8b, 0x40, 0x04, /* mov 0x4(%eax),%eax */ + 0x89, 0x0a, /* mov %ecx,(%edx) */ + 0x89, 0x42, 0x04, /* mov %eax,0x4(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); + return dfn; +} + +struct dynfn *tnl_makeX86Attr2f( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0x8b, 0x4c, 0x24, 0x08, /* mov 0x8(%esp,1),%ecx */ + 0x89, 0x02, /* mov %eax,(%edx) */ + 0x89, 0x4a, 0x04, /* mov %ecx,0x4(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); + return dfn; +} + + +struct dynfn *tnl_makeX86Attr1fv( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x08, /* mov (%eax),%ecx */ + 0x89, 0x0a, /* mov %ecx,(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 5, 0x12345678, (int)tnl->texcoordptr[0]); + return dfn; +} + +struct dynfn *tnl_makeX86Attr1f( TNLcontext *tnl, int key ) +{ + static char temp[] = { + 0xba, 0x78, 0x56, 0x34, 0x12, /* mov $DEST,%edx */ + 0x8b, 0x44, 0x24, 0x04, /* mov 0x4(%esp,1),%eax */ + 0x89, 0x02, /* mov %eax,(%edx) */ + 0xc3, /* ret */ + }; + + struct dynfn *dfn = MALLOC_STRUCT( dynfn ); + + if (TNL_DEBUG & DEBUG_CODEGEN) + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); + + insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn ); + dfn->key = key; + dfn->code = ALIGN_MALLOC( sizeof(temp), 16 ); + memcpy (dfn->code, temp, sizeof(temp)); + FIXUP(dfn->code, 1, 0x12345678, (int)tnl->texcoordptr[0]); + return dfn; +} + + + +void _tnl_InitX86Codegen( struct dfn_generators *gen ) +{ + gen->Attr1f = tnl_makeX86Attr1f; + gen->Attr1fv = tnl_makeX86Attr1fv; + gen->Attr2f = tnl_makeX86Attr2f; + gen->Attr2fv = tnl_makeX86Attr2fv; + gen->Attr3f = tnl_makeX86Attr3f; + gen->Attr3fv = tnl_makeX86Attr3fv; + gen->Attr4f = tnl_makeX86Attr4f; + gen->Attr4fv = tnl_makeX86Attr4fv; + gen->Attr4ub = tnl_makeX86Attr4ub; + gen->Attr4ubv = tnl_makeX86Attr4ubv; + gen->Vertex3f = tnl_makeX86Vertex3f; + gen->Vertex3fv = tnl_makeX86Vertex3fv; +} + + +#else + +void _tnl_InitX86Codegen( struct dfn_generators *gen ) +{ + (void) gen; +} + +#endif diff --git a/xc/extras/Mesa/src/tnl/tnl.h b/xc/extras/Mesa/src/tnl/tnl.h index dc2af3946..349a8c7d6 100644 --- a/xc/extras/Mesa/src/tnl/tnl.h +++ b/xc/extras/Mesa/src/tnl/tnl.h @@ -1,4 +1,3 @@ -/* $Id: tnl.h,v 1.1.1.1 2002/10/22 13:06:18 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #ifndef _TNL_H diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd.c b/xc/extras/Mesa/src/tnl_dd/t_dd.c index 967bab66a..731da5c32 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd.c +++ b/xc/extras/Mesa/src/tnl_dd/t_dd.c @@ -1,4 +1,3 @@ -/* $Id: t_dd.c,v 1.1.1.1 2002/10/22 13:07:01 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp.h b/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp.h index 99a818b4e..d9f709389 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_dmatmp.h @@ -1,4 +1,3 @@ -/* $Id: t_dd_dmatmp.h,v 1.1.1.1 2002/10/22 13:07:01 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -240,17 +239,25 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, currentsz--; dmasz--; - if (currentsz < 8) - currentsz = dmasz; - - for ( ; j + 1 < count; j += nr - 1 ) { - nr = MIN2( currentsz, count - j ); - EMIT_VERTS( ctx, j, nr ); + if (currentsz < 8) { + NEW_BUFFER(); currentsz = dmasz; } - if (start < count - 1 && (flags & PRIM_END)) + if (j + 1 < count) { + for ( ; j + 1 < count; j += nr - 1 ) { + nr = MIN2( currentsz, count - j ); + EMIT_VERTS( ctx, j, nr ); + currentsz = dmasz; + } + + if (start < count - 1 && (flags & PRIM_END)) + EMIT_VERTS( ctx, start, 1 ); + } + else if (start + 1 < count && (flags & PRIM_END)) { + EMIT_VERTS( ctx, start+1, 1 ); EMIT_VERTS( ctx, start, 1 ); + } FINISH; diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_rendertmp.h b/xc/extras/Mesa/src/tnl_dd/t_dd_rendertmp.h index 7a05a65f5..fc00e7693 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_rendertmp.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_rendertmp.h @@ -1,4 +1,3 @@ -/* $Id: t_dd_rendertmp.h,v 1.1.1.1 2002/10/22 13:07:01 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_tritmp.h b/xc/extras/Mesa/src/tnl_dd/t_dd_tritmp.h index 8cd4a6f3f..cc47798d5 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_tritmp.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_tritmp.h @@ -1,4 +1,3 @@ -/* $Id: t_dd_tritmp.h,v 1.1.1.1 2002/10/22 13:06:59 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_unfilled.h b/xc/extras/Mesa/src/tnl_dd/t_dd_unfilled.h index b41525bb1..46415ea5f 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_unfilled.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_unfilled.h @@ -1,4 +1,3 @@ -/* $Id: t_dd_unfilled.h,v 1.1.1.1 2002/10/22 13:06:59 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #if HAVE_RGBA diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_vb.c b/xc/extras/Mesa/src/tnl_dd/t_dd_vb.c index 179ae8d26..4a742bcbb 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_vb.c +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_vb.c @@ -1,4 +1,3 @@ -/* $Id: t_dd_vb.c,v 1.1.1.1 2002/10/22 13:07:02 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ #include "math/m_translate.h" @@ -195,22 +194,78 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) LOCALVARS GLuint format = GET_VERTEX_FORMAT(); - if (format == TINY_VERTEX_FORMAT) { - fprintf(stderr, "x %f y %f z %f\n", v->v.x, v->v.y, v->v.z); - fprintf(stderr, "r %d g %d b %d a %d\n", + fprintf(stderr, "(%x) ", format); + + switch (format) { +#if HAVE_TINY_VERTICES + case TINY_VERTEX_FORMAT: + fprintf(stderr, "xyz %.4f,%.4f,%.4f rgba %x:%x:%x:%x\n", + v->v.x, v->v.y, v->v.z, v->tv.color.red, v->tv.color.green, v->tv.color.blue, v->tv.color.alpha); - } - else { - fprintf(stderr, "x %f y %f z %f oow %f\n", - v->v.x, v->v.y, v->v.z, v->v.w); - fprintf(stderr, "r %d g %d b %d a %d\n", + break; +#endif +#if HAVE_NOTEX_VERTICES + case NOTEX_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x spec %x:%x:%x:%x\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.specular.red, + v->v.specular.green, + v->v.specular.blue, + v->v.specular.alpha); + break; +#endif +#if HAVE_TEX0_VERTICES + case TEX0_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.u0, + v->v.v0); + break; +#endif +#if HAVE_TEX1_VERTICES + case TEX1_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x st %.4f,%.4f st %.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, + v->v.color.red, + v->v.color.green, + v->v.color.blue, + v->v.color.alpha, + v->v.u0, + v->v.v0, + v->v.u1, + v->v.u2); + break; +#endif +#if HAVE_PTEX_VERTICES + case PROJ_TEX1_VERTEX_FORMAT: + fprintf(stderr, "xyzw %.4f,%.4f,%.4f,%.4f rgba %x:%x:%x:%x stq %.4f,%.4f,%.4f stq %.4f,%.4f,%.4f\n", + v->v.x, v->v.y, v->v.z, v->v.w, v->v.color.red, v->v.color.green, v->v.color.blue, - v->v.color.alpha); + v->v.color.alpha, + v->pv.u0, + v->pv.v0, + v->pv.q0, + v->pv.u1, + v->pv.v1, + v->pv.q1); + break; +#endif + default: + fprintf(stderr, "???\n"); + break; } fprintf(stderr, "\n"); diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_vbtmp.h b/xc/extras/Mesa/src/tnl_dd/t_dd_vbtmp.h index 16bd770bb..0fc1a64e2 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_vbtmp.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_vbtmp.h @@ -1,8 +1,7 @@ -/* $Id: t_dd_vbtmp.h,v 1.1.1.1 2002/10/22 13:07:00 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ @@ -125,7 +124,7 @@ static void TAG(emit)( GLcontext *ctx, { LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - GLfloat (*tc0)[4], (*tc1)[4], *fog; + GLfloat (*tc0)[4], (*tc1)[4], (*fog)[4]; GLfloat (*tc2)[4], (*tc3)[4]; GLubyte (*col)[4], (*spec)[4]; GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride; @@ -148,8 +147,8 @@ static void TAG(emit)( GLcontext *ctx, coord_stride = VB->ClipPtr->stride; } else { - coord = VB->ProjectedClipPtr->data; - coord_stride = VB->ProjectedClipPtr->stride; + coord = VB->NdcPtr->data; + coord_stride = VB->NdcPtr->stride; } if (DO_TEX3) { @@ -210,13 +209,13 @@ static void TAG(emit)( GLcontext *ctx, fog_stride = VB->FogCoordPtr->stride; } else { - GLfloat tmp = 0; + static GLfloat tmp[4] = {0, 0, 0, 0}; fog = &tmp; fog_stride = 0; } } - if (VB->importable_data) { + if (VB->importable_data || (DO_SPEC && !spec_stride) || (DO_FOG && !fog_stride)) { /* May have nonstandard strides: */ if (start) { @@ -234,7 +233,8 @@ static void TAG(emit)( GLcontext *ctx, if (DO_SPEC) STRIDE_4UB(spec, start * spec_stride); if (DO_FOG) - STRIDE_F(fog, start * fog_stride); + /*STRIDE_F(fog, start * fog_stride);*/ + fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride); } for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { @@ -268,8 +268,9 @@ static void TAG(emit)( GLcontext *ctx, STRIDE_4UB(spec, spec_stride); } if (DO_FOG) { - v->v.specular.alpha = fog[0] * 255.0; - STRIDE_F(fog, fog_stride); + v->v.specular.alpha = fog[0][0] * 255.0; + /*STRIDE_F(fog, fog_stride);*/ + fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride); } if (DO_TEX0) { v->v.u0 = tc0[0][0]; @@ -367,7 +368,7 @@ static void TAG(emit)( GLcontext *ctx, v->v.specular.blue = spec[i][2]; } if (DO_FOG) { - v->v.specular.alpha = fog[i] * 255.0; + v->v.specular.alpha = fog[i][0] * 255.0; } if (DO_TEX0) { v->v.u0 = tc0[i][0]; @@ -420,8 +421,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte (*col)[4]; GLuint col_stride; - GLfloat (*coord)[4] = VB->ProjectedClipPtr->data; - GLuint coord_stride = VB->ProjectedClipPtr->stride; + GLfloat (*coord)[4] = VB->NdcPtr->data; + GLuint coord_stride = VB->NdcPtr->stride; GLfloat *v = (GLfloat *)dest; const GLubyte *mask = VB->ClipMask; const GLfloat *s = GET_VIEWPORT_MAT(); @@ -674,8 +675,8 @@ static void TAG(interp)( GLcontext *ctx, INTERP_F( t, dst->pv.v0, out->pv.v0, in->pv.v0 ); INTERP_F( t, dst->pv.q0, out->pv.q0, in->pv.q0 ); } else { - GLfloat wout = VB->ProjectedClipPtr->data[eout][3]; - GLfloat win = VB->ProjectedClipPtr->data[ein][3]; + GLfloat wout = VB->NdcPtr->data[eout][3]; + GLfloat win = VB->NdcPtr->data[ein][3]; GLfloat qout = out->pv.w / wout; GLfloat qin = in->pv.w / win; GLfloat qdst, rqdst; @@ -708,7 +709,7 @@ static void TAG(interp)( GLcontext *ctx, } } else if (DO_PTEX) { - dst->pv.q0 = 0.0; /* must be a valid float on radeon */ + dst->pv.q1 = 0.0; /* must be a valid float on radeon */ } if (DO_TEX2) { if (DO_PTEX) { diff --git a/xc/extras/Mesa/src/tnl_dd/t_dd_vertex.h b/xc/extras/Mesa/src/tnl_dd/t_dd_vertex.h index 51639b5f6..d45dd09fb 100644 --- a/xc/extras/Mesa/src/tnl_dd/t_dd_vertex.h +++ b/xc/extras/Mesa/src/tnl_dd/t_dd_vertex.h @@ -1,4 +1,3 @@ -/* $Id: t_dd_vertex.h,v 1.1.1.1 2002/10/22 13:07:00 alanh Exp $ */ /* * Mesa 3-D graphics library @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> */ typedef struct { diff --git a/xc/extras/Mesa/src/varray.c b/xc/extras/Mesa/src/varray.c index f400f9ef5..03052898a 100644 --- a/xc/extras/Mesa/src/varray.c +++ b/xc/extras/Mesa/src/varray.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.3 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -23,9 +23,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef PC_HEADER -#include "all.h" -#else #include "glheader.h" #include "context.h" #include "enable.h" @@ -39,7 +36,6 @@ #include "mtypes.h" #include "varray.h" #include "math/m_translate.h" -#endif @@ -49,40 +45,41 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (size<2 || size>4) { + if (size < 2 || size > 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); return; } - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glVertexPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) - fprintf(stderr, "glVertexPointer( sz %d type %s stride %d )\n", size, - _mesa_lookup_enum_by_nr( type ), - stride); + _mesa_debug(ctx, "glVertexPointer( sz %d type %s stride %d )\n", size, + _mesa_lookup_enum_by_nr( type ), stride); - ctx->Array.Vertex.StrideB = stride; - if (!stride) { - switch (type) { + /* always need to check that <type> is legal */ + switch (type) { case GL_SHORT: - ctx->Array.Vertex.StrideB = size*sizeof(GLshort); + ctx->Array.Vertex.StrideB = size * sizeof(GLshort); break; case GL_INT: - ctx->Array.Vertex.StrideB = size*sizeof(GLint); + ctx->Array.Vertex.StrideB = size * sizeof(GLint); break; case GL_FLOAT: - ctx->Array.Vertex.StrideB = size*sizeof(GLfloat); + ctx->Array.Vertex.StrideB = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Vertex.StrideB = size*sizeof(GLdouble); + ctx->Array.Vertex.StrideB = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); return; - } } + + if (stride) + ctx->Array.Vertex.StrideB = stride; + ctx->Array.Vertex.Size = size; ctx->Array.Vertex.Type = type; ctx->Array.Vertex.Stride = stride; @@ -103,39 +100,39 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) - fprintf(stderr, "glNormalPointer( type %s stride %d )\n", - _mesa_lookup_enum_by_nr( type ), - stride); + _mesa_debug(ctx, "glNormalPointer( type %s stride %d )\n", + _mesa_lookup_enum_by_nr( type ), stride); - ctx->Array.Normal.StrideB = stride; - if (!stride) { - switch (type) { + switch (type) { case GL_BYTE: - ctx->Array.Normal.StrideB = 3*sizeof(GLbyte); + ctx->Array.Normal.StrideB = 3 * sizeof(GLbyte); break; case GL_SHORT: - ctx->Array.Normal.StrideB = 3*sizeof(GLshort); + ctx->Array.Normal.StrideB = 3 * sizeof(GLshort); break; case GL_INT: - ctx->Array.Normal.StrideB = 3*sizeof(GLint); + ctx->Array.Normal.StrideB = 3 * sizeof(GLint); break; case GL_FLOAT: - ctx->Array.Normal.StrideB = 3*sizeof(GLfloat); + ctx->Array.Normal.StrideB = 3 * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Normal.StrideB = 3*sizeof(GLdouble); + ctx->Array.Normal.StrideB = 3 * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); return; - } } + if (stride) + ctx->Array.Normal.StrideB = stride; + + ctx->Array.Normal.Size = 3; ctx->Array.Normal.Type = type; ctx->Array.Normal.Stride = stride; ctx->Array.Normal.Ptr = (void *) ptr; @@ -154,7 +151,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (size<3 || size>4) { + if (size < 3 || size > 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); return; } @@ -164,48 +161,48 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) - fprintf(stderr, "glColorPointer( sz %d type %s stride %d )\n", size, - _mesa_lookup_enum_by_nr( type ), - stride); + _mesa_debug(ctx, "glColorPointer( sz %d type %s stride %d )\n", size, + _mesa_lookup_enum_by_nr( type ), stride); - ctx->Array.Color.StrideB = stride; - if (!stride) { - switch (type) { + switch (type) { case GL_BYTE: - ctx->Array.Color.StrideB = size*sizeof(GLbyte); + ctx->Array.Color.StrideB = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: - ctx->Array.Color.StrideB = size*sizeof(GLubyte); + ctx->Array.Color.StrideB = size * sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.Color.StrideB = size*sizeof(GLshort); + ctx->Array.Color.StrideB = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: - ctx->Array.Color.StrideB = size*sizeof(GLushort); + ctx->Array.Color.StrideB = size * sizeof(GLushort); break; case GL_INT: - ctx->Array.Color.StrideB = size*sizeof(GLint); + ctx->Array.Color.StrideB = size * sizeof(GLint); break; case GL_UNSIGNED_INT: - ctx->Array.Color.StrideB = size*sizeof(GLuint); + ctx->Array.Color.StrideB = size * sizeof(GLuint); break; case GL_FLOAT: - ctx->Array.Color.StrideB = size*sizeof(GLfloat); + ctx->Array.Color.StrideB = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.Color.StrideB = size*sizeof(GLdouble); + ctx->Array.Color.StrideB = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); return; - } } + + if (stride) + ctx->Array.Color.StrideB = stride; + ctx->Array.Color.Size = size; ctx->Array.Color.Type = type; ctx->Array.Color.Stride = stride; ctx->Array.Color.Ptr = (void *) ptr; ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_COLOR; + ctx->Array.NewState |= _NEW_ARRAY_COLOR0; if (ctx->Driver.ColorPointer) ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); @@ -219,14 +216,12 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" ); return; } - ctx->Array.FogCoord.StrideB = stride; - if (!stride) { - switch (type) { + switch (type) { case GL_FLOAT: ctx->Array.FogCoord.StrideB = sizeof(GLfloat); break; @@ -236,8 +231,12 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) default: _mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" ); return; - } } + + if (stride) + ctx->Array.FogCoord.StrideB = stride; + + ctx->Array.FogCoord.Size = 1; ctx->Array.FogCoord.Type = type; ctx->Array.FogCoord.Stride = stride; ctx->Array.FogCoord.Ptr = (void *) ptr; @@ -255,14 +254,12 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); return; } - ctx->Array.Index.StrideB = stride; - if (!stride) { - switch (type) { + switch (type) { case GL_UNSIGNED_BYTE: ctx->Array.Index.StrideB = sizeof(GLubyte); break; @@ -281,8 +278,12 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) default: _mesa_error( ctx, GL_INVALID_ENUM, "glIndexPointer(type)" ); return; - } } + + if (stride) + ctx->Array.Index.StrideB = stride; + + ctx->Array.Index.Size = 1; ctx->Array.Index.Type = type; ctx->Array.Index.Stride = stride; ctx->Array.Index.Ptr = (void *) ptr; @@ -302,57 +303,57 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size != 3 && size != 4) { - _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); + _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(size)" ); return; } - if (stride<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glColorPointer(stride)" ); + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glSecondaryColorPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) - fprintf(stderr, "glColorPointer( sz %d type %s stride %d )\n", size, - _mesa_lookup_enum_by_nr( type ), - stride); + _mesa_debug(ctx, "glSecondaryColorPointer( sz %d type %s stride %d )\n", + size, _mesa_lookup_enum_by_nr( type ), stride); - ctx->Array.SecondaryColor.StrideB = stride; - if (!stride) { - switch (type) { + switch (type) { case GL_BYTE: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLbyte); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLbyte); break; case GL_UNSIGNED_BYTE: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLubyte); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLubyte); break; case GL_SHORT: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLshort); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLshort); break; case GL_UNSIGNED_SHORT: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLushort); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLushort); break; case GL_INT: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLint); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLint); break; case GL_UNSIGNED_INT: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLuint); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLuint); break; case GL_FLOAT: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLfloat); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.SecondaryColor.StrideB = size*sizeof(GLdouble); + ctx->Array.SecondaryColor.StrideB = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type)" ); return; - } } + + if (stride) + ctx->Array.SecondaryColor.StrideB = stride; + ctx->Array.SecondaryColor.Size = 3; /* hardwire */ ctx->Array.SecondaryColor.Type = type; ctx->Array.SecondaryColor.Stride = stride; ctx->Array.SecondaryColor.Ptr = (void *) ptr; ctx->NewState |= _NEW_ARRAY; - ctx->Array.NewState |= _NEW_ARRAY_SECONDARYCOLOR; + ctx->Array.NewState |= _NEW_ARRAY_COLOR1; if (ctx->Driver.SecondaryColorPointer) ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); @@ -361,48 +362,48 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, void -_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); GLuint texUnit = ctx->Array.ActiveTexture; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (size<1 || size>4) { + if (size < 1 || size > 4) { _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" ); return; } - if (stride<0) { + if (stride < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(stride)" ); return; } if (MESA_VERBOSE&(VERBOSE_VARRAY|VERBOSE_API)) - fprintf(stderr, "glTexCoordPointer( unit %u sz %d type %s stride %d )\n", - texUnit, - size, - _mesa_lookup_enum_by_nr( type ), - stride); - - ctx->Array.TexCoord[texUnit].StrideB = stride; - if (!stride) { - switch (type) { + _mesa_debug(ctx, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n", + texUnit, size, _mesa_lookup_enum_by_nr( type ), stride); + + /* always need to check that <type> is legal */ + switch (type) { case GL_SHORT: - ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLshort); + ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLshort); break; case GL_INT: - ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLint); + ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLint); break; case GL_FLOAT: - ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLfloat); + ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLfloat); break; case GL_DOUBLE: - ctx->Array.TexCoord[texUnit].StrideB = size*sizeof(GLdouble); + ctx->Array.TexCoord[texUnit].StrideB = size * sizeof(GLdouble); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); return; - } } + + if (stride) + ctx->Array.TexCoord[texUnit].StrideB = stride; + ctx->Array.TexCoord[texUnit].Size = size; ctx->Array.TexCoord[texUnit].Type = type; ctx->Array.TexCoord[texUnit].Stride = stride; @@ -410,17 +411,13 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_TEXCOORD(texUnit); -/* fprintf(stderr, "%s ptr %p\n", __FUNCTION__, ptr); */ - if (ctx->Driver.TexCoordPointer) ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); } - - void -_mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) +_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr) { GET_CURRENT_CONTEXT(ctx); const GLboolean *ptr = (GLboolean *)vptr; @@ -441,7 +438,65 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) } +void _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= VERT_ATTRIB_MAX) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(index)"); + return; + } + if (size < 1 || size > 4) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size)"); + return; + } + + if (stride < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(stride)"); + return; + } + + if (type == GL_UNSIGNED_BYTE && size != 4) { + _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerNV(size!=4)"); + return; + } + + /* check for valid 'type' and compute StrideB right away */ + switch (type) { + case GL_UNSIGNED_BYTE: + ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLubyte); + break; + case GL_SHORT: + ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLshort); + break; + case GL_FLOAT: + ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLfloat); + break; + case GL_DOUBLE: + ctx->Array.VertexAttrib[index].StrideB = size * sizeof(GLdouble); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerNV(type)" ); + return; + } + + if (stride) + ctx->Array.VertexAttrib[index].StrideB = stride; + + ctx->Array.VertexAttrib[index].Stride = stride; + ctx->Array.VertexAttrib[index].Size = size; + ctx->Array.VertexAttrib[index].Type = type; + ctx->Array.VertexAttrib[index].Ptr = (void *) ptr; + + ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); + + if (ctx->Driver.VertexAttribPointer) + ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); +} void @@ -499,8 +554,6 @@ _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr) - - void _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) { @@ -704,7 +757,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glLockArrays %d %d\n", first, count); + _mesa_debug(ctx, "glLockArrays %d %d\n", first, count); if (first == 0 && count > 0 && count <= (GLint) ctx->Const.MaxArrayLockSize) { @@ -731,7 +784,7 @@ _mesa_UnlockArraysEXT( void ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "glUnlockArrays\n"); + _mesa_debug(ctx, "glUnlockArrays\n"); ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; @@ -741,3 +794,41 @@ _mesa_UnlockArraysEXT( void ) if (ctx->Driver.UnlockArraysEXT) ctx->Driver.UnlockArraysEXT( ctx ); } + + + +/* GL_EXT_multi_draw_arrays */ +/* Somebody forgot to spec the first and count parameters as const! <sigh> */ +void +_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + (ctx->Exec->DrawArrays)(mode, first[i], count[i]); + } + } +} + + +/* GL_EXT_multi_draw_arrays */ +void +_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + (ctx->Exec->DrawElements)(mode, count[i], type, indices[i]); + } + } +} diff --git a/xc/extras/Mesa/src/varray.h b/xc/extras/Mesa/src/varray.h index 3aaf50739..67558794e 100644 --- a/xc/extras/Mesa/src/varray.h +++ b/xc/extras/Mesa/src/varray.h @@ -1,10 +1,8 @@ -/* $Id: varray.h,v 1.1.1.5 2002/10/22 13:05:55 alanh Exp $ */ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -96,14 +94,28 @@ _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr); extern void _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr); + extern void _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); extern void +_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer); + + +extern void _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); +extern void +_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount ); + +extern void +_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount ); + #endif diff --git a/xc/extras/Mesa/src/vtxfmt.c b/xc/extras/Mesa/src/vtxfmt.c index 43abb9889..d7b18e4c1 100644 --- a/xc/extras/Mesa/src/vtxfmt.c +++ b/xc/extras/Mesa/src/vtxfmt.c @@ -1,8 +1,7 @@ -/* $Id: vtxfmt.c,v 1.1.1.1 2002/10/22 13:05:49 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -24,13 +23,14 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> - * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * Gareth Hughes */ #include "glheader.h" #include "api_loopback.h" #include "context.h" +#include "imports.h" #include "mtypes.h" #include "state.h" #include "vtxfmt.h" @@ -54,18 +54,16 @@ ASSERT( tnl->Current ); \ ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ \ - /* Save the swapped function's dispatch entry so it can be \ - * restored later. \ - */ \ + /* Save the swapped function's dispatch entry so it can be */ \ + /* restored later. */ \ tnl->Swapped[tnl->SwapCount][0] = (void *)&(ctx->Exec->FUNC); \ tnl->Swapped[tnl->SwapCount][1] = (void *)TAG(FUNC); \ tnl->SwapCount++; \ \ if ( 0 ) \ - fprintf( stderr, " swapping gl" #FUNC"...\n" ); \ + _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \ \ - /* Install the tnl function pointer. \ - */ \ + /* Install the tnl function pointer. */ \ ctx->Exec->FUNC = tnl->Current->FUNC; \ } @@ -126,18 +124,17 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt ) tab->Vertex3fv = vfmt->Vertex3fv; tab->Vertex4f = vfmt->Vertex4f; tab->Vertex4fv = vfmt->Vertex4fv; + tab->CallList = vfmt->CallList; tab->Begin = vfmt->Begin; tab->End = vfmt->End; - -/* tab->NewList = vfmt->NewList; */ - tab->CallList = vfmt->CallList; - + tab->VertexAttrib4fNV = vfmt->VertexAttrib4fNV; tab->Rectf = vfmt->Rectf; tab->DrawArrays = vfmt->DrawArrays; tab->DrawElements = vfmt->DrawElements; tab->DrawRangeElements = vfmt->DrawRangeElements; tab->EvalMesh1 = vfmt->EvalMesh1; tab->EvalMesh2 = vfmt->EvalMesh2; + assert(tab->EvalMesh2); } diff --git a/xc/extras/Mesa/src/vtxfmt.h b/xc/extras/Mesa/src/vtxfmt.h index 14ab79e7d..6f6006bd2 100644 --- a/xc/extras/Mesa/src/vtxfmt.h +++ b/xc/extras/Mesa/src/vtxfmt.h @@ -1,10 +1,9 @@ -/* $Id: vtxfmt.h,v 1.1.1.1 2002/10/22 13:05:49 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,8 +23,8 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell <keithw@valinux.com> - * Gareth Hughes <gareth@valinux.com> + * Keith Whitwell <keith@tungstengraphics.com> + * Gareth Hughes */ #ifndef _VTXFMT_H_ diff --git a/xc/extras/Mesa/src/vtxfmt_tmp.h b/xc/extras/Mesa/src/vtxfmt_tmp.h index ca11e772c..0900d6e3f 100644 --- a/xc/extras/Mesa/src/vtxfmt_tmp.h +++ b/xc/extras/Mesa/src/vtxfmt_tmp.h @@ -1,10 +1,9 @@ -/* $Id: vtxfmt_tmp.h,v 1.1.1.1 2002/10/22 13:05:07 alanh Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.0.1 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -24,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef PRE_LOOPBACK @@ -34,109 +33,109 @@ static void TAG(ArrayElement)( GLint i ) { PRE_LOOPBACK( ArrayElement ); - glArrayElement( i ); + _glapi_Dispatch->ArrayElement( i ); } -static void TAG(Color3f)( GLfloat a, GLfloat b, GLfloat c ) +static void TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b ) { PRE_LOOPBACK( Color3f ); - glColor3f( a, b, c ); + _glapi_Dispatch->Color3f( r, g, b ); } static void TAG(Color3fv)( const GLfloat *v ) { PRE_LOOPBACK( Color3fv ); - glColor3fv( v ); + _glapi_Dispatch->Color3fv( v ); } -static void TAG(Color3ub)( GLubyte a, GLubyte b, GLubyte c ) +static void TAG(Color3ub)( GLubyte r, GLubyte g, GLubyte b ) { PRE_LOOPBACK( Color3ub ); - glColor3ub( a, b, c ); + _glapi_Dispatch->Color3ub( r, g, b ); } static void TAG(Color3ubv)( const GLubyte *v ) { PRE_LOOPBACK( Color3ubv ); - glColor3ubv( v ); + _glapi_Dispatch->Color3ubv( v ); } -static void TAG(Color4f)( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +static void TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a ) { PRE_LOOPBACK( Color4f ); - glColor4f( a, b, c, d ); + _glapi_Dispatch->Color4f( r, g, b, a ); } static void TAG(Color4fv)( const GLfloat *v ) { PRE_LOOPBACK( Color4fv ); - glColor4fv( v ); + _glapi_Dispatch->Color4fv( v ); } -static void TAG(Color4ub)( GLubyte a, GLubyte b, GLubyte c, GLubyte d ) +static void TAG(Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a ) { PRE_LOOPBACK( Color4ub ); - glColor4ub( a, b, c, d ); + _glapi_Dispatch->Color4ub( r, g, b, a ); } static void TAG(Color4ubv)( const GLubyte *v ) { PRE_LOOPBACK( Color4ubv ); - glColor4ubv( v ); + _glapi_Dispatch->Color4ubv( v ); } -static void TAG(EdgeFlag)( GLboolean a ) +static void TAG(EdgeFlag)( GLboolean e ) { PRE_LOOPBACK( EdgeFlag ); - glEdgeFlag( a ); + _glapi_Dispatch->EdgeFlag( e ); } static void TAG(EdgeFlagv)( const GLboolean *v ) { PRE_LOOPBACK( EdgeFlagv ); - glEdgeFlagv( v ); + _glapi_Dispatch->EdgeFlagv( v ); } -static void TAG(EvalCoord1f)( GLfloat a ) +static void TAG(EvalCoord1f)( GLfloat s ) { PRE_LOOPBACK( EvalCoord1f ); - glEvalCoord1f( a ); + _glapi_Dispatch->EvalCoord1f( s ); } static void TAG(EvalCoord1fv)( const GLfloat *v ) { PRE_LOOPBACK( EvalCoord1fv ); - glEvalCoord1fv( v ); + _glapi_Dispatch->EvalCoord1fv( v ); } -static void TAG(EvalCoord2f)( GLfloat a, GLfloat b ) +static void TAG(EvalCoord2f)( GLfloat s, GLfloat t ) { PRE_LOOPBACK( EvalCoord2f ); - glEvalCoord2f( a, b ); + _glapi_Dispatch->EvalCoord2f( s, t ); } static void TAG(EvalCoord2fv)( const GLfloat *v ) { PRE_LOOPBACK( EvalCoord2fv ); - glEvalCoord2fv( v ); + _glapi_Dispatch->EvalCoord2fv( v ); } -static void TAG(EvalPoint1)( GLint a ) +static void TAG(EvalPoint1)( GLint i ) { PRE_LOOPBACK( EvalPoint1 ); - glEvalPoint1( a ); + _glapi_Dispatch->EvalPoint1( i ); } -static void TAG(EvalPoint2)( GLint a, GLint b ) +static void TAG(EvalPoint2)( GLint i, GLint j ) { PRE_LOOPBACK( EvalPoint2 ); - glEvalPoint2( a, b ); + _glapi_Dispatch->EvalPoint2( i, j ); } -static void TAG(FogCoordfEXT)( GLfloat a ) +static void TAG(FogCoordfEXT)( GLfloat f ) { PRE_LOOPBACK( FogCoordfEXT ); - _glapi_Dispatch->FogCoordfEXT( a ); + _glapi_Dispatch->FogCoordfEXT( f ); } static void TAG(FogCoordfvEXT)( const GLfloat *v ) @@ -145,90 +144,90 @@ static void TAG(FogCoordfvEXT)( const GLfloat *v ) _glapi_Dispatch->FogCoordfvEXT( v ); } -static void TAG(Indexi)( GLint a ) +static void TAG(Indexi)( GLint i ) { PRE_LOOPBACK( Indexi ); - glIndexi( a ); + _glapi_Dispatch->Indexi( i ); } static void TAG(Indexiv)( const GLint *v ) { PRE_LOOPBACK( Indexiv ); - glIndexiv( v ); + _glapi_Dispatch->Indexiv( v ); } static void TAG(Materialfv)( GLenum face, GLenum pname, const GLfloat *v ) { PRE_LOOPBACK( Materialfv ); - glMaterialfv( face, pname, v ); + _glapi_Dispatch->Materialfv( face, pname, v ); } static void TAG(MultiTexCoord1fARB)( GLenum target, GLfloat a ) { PRE_LOOPBACK( MultiTexCoord1fARB ); - glMultiTexCoord1fARB( target, a ); + _glapi_Dispatch->MultiTexCoord1fARB( target, a ); } static void TAG(MultiTexCoord1fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord1fvARB ); - glMultiTexCoord1fvARB( target, tc ); + _glapi_Dispatch->MultiTexCoord1fvARB( target, tc ); } -static void TAG(MultiTexCoord2fARB)( GLenum target, GLfloat a, GLfloat b ) +static void TAG(MultiTexCoord2fARB)( GLenum target, GLfloat s, GLfloat t ) { PRE_LOOPBACK( MultiTexCoord2fARB ); - glMultiTexCoord2fARB( target, a, b ); + _glapi_Dispatch->MultiTexCoord2fARB( target, s, t ); } static void TAG(MultiTexCoord2fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord2fvARB ); - glMultiTexCoord2fvARB( target, tc ); + _glapi_Dispatch->MultiTexCoord2fvARB( target, tc ); } -static void TAG(MultiTexCoord3fARB)( GLenum target, GLfloat a, - GLfloat b, GLfloat c ) +static void TAG(MultiTexCoord3fARB)( GLenum target, GLfloat s, + GLfloat t, GLfloat r ) { PRE_LOOPBACK( MultiTexCoord3fARB ); - glMultiTexCoord3fARB( target, a, b, c ); + _glapi_Dispatch->MultiTexCoord3fARB( target, s, t, r ); } static void TAG(MultiTexCoord3fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord3fvARB ); - glMultiTexCoord3fvARB( target, tc ); + _glapi_Dispatch->MultiTexCoord3fvARB( target, tc ); } -static void TAG(MultiTexCoord4fARB)( GLenum target, GLfloat a, - GLfloat b, GLfloat c, GLfloat d ) +static void TAG(MultiTexCoord4fARB)( GLenum target, GLfloat s, + GLfloat t, GLfloat r, GLfloat q ) { PRE_LOOPBACK( MultiTexCoord4fARB ); - glMultiTexCoord4fARB( target, a, b, c, d ); + _glapi_Dispatch->MultiTexCoord4fARB( target, s, t, r, q ); } static void TAG(MultiTexCoord4fvARB)( GLenum target, const GLfloat *tc ) { PRE_LOOPBACK( MultiTexCoord4fvARB ); - glMultiTexCoord4fvARB( target, tc ); + _glapi_Dispatch->MultiTexCoord4fvARB( target, tc ); } -static void TAG(Normal3f)( GLfloat a, GLfloat b, GLfloat c ) +static void TAG(Normal3f)( GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( Normal3f ); - glNormal3f( a, b, c ); + _glapi_Dispatch->Normal3f( x, y, z ); } static void TAG(Normal3fv)( const GLfloat *v ) { PRE_LOOPBACK( Normal3fv ); - glNormal3fv( v ); + _glapi_Dispatch->Normal3fv( v ); } -static void TAG(SecondaryColor3fEXT)( GLfloat a, GLfloat b, GLfloat c ) +static void TAG(SecondaryColor3fEXT)( GLfloat r, GLfloat g, GLfloat b ) { PRE_LOOPBACK( SecondaryColor3fEXT ); - _glapi_Dispatch->SecondaryColor3fEXT( a, b, c ); + _glapi_Dispatch->SecondaryColor3fEXT( r, g, b ); } static void TAG(SecondaryColor3fvEXT)( const GLfloat *v ) @@ -237,10 +236,10 @@ static void TAG(SecondaryColor3fvEXT)( const GLfloat *v ) _glapi_Dispatch->SecondaryColor3fvEXT( v ); } -static void TAG(SecondaryColor3ubEXT)( GLubyte a, GLubyte b, GLubyte c ) +static void TAG(SecondaryColor3ubEXT)( GLubyte r, GLubyte g, GLubyte b ) { PRE_LOOPBACK( SecondaryColor3ubEXT ); - _glapi_Dispatch->SecondaryColor3ubEXT( a, b, c ); + _glapi_Dispatch->SecondaryColor3ubEXT( r, g, b ); } static void TAG(SecondaryColor3ubvEXT)( const GLubyte *v ) @@ -249,125 +248,125 @@ static void TAG(SecondaryColor3ubvEXT)( const GLubyte *v ) _glapi_Dispatch->SecondaryColor3ubvEXT( v ); } -static void TAG(TexCoord1f)( GLfloat a ) +static void TAG(TexCoord1f)( GLfloat s ) { PRE_LOOPBACK( TexCoord1f ); - glTexCoord1f( a ); + _glapi_Dispatch->TexCoord1f( s ); } static void TAG(TexCoord1fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord1fv ); - glTexCoord1fv( tc ); + _glapi_Dispatch->TexCoord1fv( tc ); } -static void TAG(TexCoord2f)( GLfloat a, GLfloat b ) +static void TAG(TexCoord2f)( GLfloat s, GLfloat t ) { PRE_LOOPBACK( TexCoord2f ); - glTexCoord2f( a, b ); + _glapi_Dispatch->TexCoord2f( s, t ); } static void TAG(TexCoord2fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord2fv ); - glTexCoord2fv( tc ); + _glapi_Dispatch->TexCoord2fv( tc ); } -static void TAG(TexCoord3f)( GLfloat a, GLfloat b, GLfloat c ) +static void TAG(TexCoord3f)( GLfloat s, GLfloat t, GLfloat r ) { PRE_LOOPBACK( TexCoord3f ); - glTexCoord3f( a, b, c ); + _glapi_Dispatch->TexCoord3f( s, t, r ); } static void TAG(TexCoord3fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord3fv ); - glTexCoord3fv( tc ); + _glapi_Dispatch->TexCoord3fv( tc ); } -static void TAG(TexCoord4f)( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +static void TAG(TexCoord4f)( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) { PRE_LOOPBACK( TexCoord4f ); - glTexCoord4f( a, b, c, d ); + _glapi_Dispatch->TexCoord4f( s, t, r, q ); } static void TAG(TexCoord4fv)( const GLfloat *tc ) { PRE_LOOPBACK( TexCoord4fv ); - glTexCoord4fv( tc ); + _glapi_Dispatch->TexCoord4fv( tc ); } -static void TAG(Vertex2f)( GLfloat a, GLfloat b ) +static void TAG(Vertex2f)( GLfloat x, GLfloat y ) { PRE_LOOPBACK( Vertex2f ); - glVertex2f( a, b ); + _glapi_Dispatch->Vertex2f( x, y ); } -static void TAG(Vertex2fv)( const GLfloat *obj ) +static void TAG(Vertex2fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex2fv ); - glVertex2fv( obj ); + _glapi_Dispatch->Vertex2fv( v ); } -static void TAG(Vertex3f)( GLfloat a, GLfloat b, GLfloat c ) +static void TAG(Vertex3f)( GLfloat x, GLfloat y, GLfloat z ) { PRE_LOOPBACK( Vertex3f ); - glVertex3f( a, b, c ); + _glapi_Dispatch->Vertex3f( x, y, z ); } -static void TAG(Vertex3fv)( const GLfloat *obj ) +static void TAG(Vertex3fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex3fv ); - glVertex3fv( obj ); + _glapi_Dispatch->Vertex3fv( v ); } -static void TAG(Vertex4f)( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +static void TAG(Vertex4f)( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { PRE_LOOPBACK( Vertex4f ); - glVertex4f( a, b, c, d ); + _glapi_Dispatch->Vertex4f( x, y, z, w ); } -static void TAG(Vertex4fv)( const GLfloat *obj ) +static void TAG(Vertex4fv)( const GLfloat *v ) { PRE_LOOPBACK( Vertex4fv ); - glVertex4fv( obj ); + _glapi_Dispatch->Vertex4fv( v ); } static void TAG(CallList)( GLuint i ) { PRE_LOOPBACK( CallList ); - glCallList( i ); + _glapi_Dispatch->CallList( i ); } static void TAG(Begin)( GLenum mode ) { PRE_LOOPBACK( Begin ); - glBegin( mode ); + _glapi_Dispatch->Begin( mode ); } static void TAG(End)( void ) { PRE_LOOPBACK( End ); - glEnd(); + _glapi_Dispatch->End(); } static void TAG(Rectf)( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { PRE_LOOPBACK( Rectf ); - glRectf( x1, y1, x2, y2 ); + _glapi_Dispatch->Rectf( x1, y1, x2, y2 ); } static void TAG(DrawArrays)( GLenum mode, GLint start, GLsizei count ) { PRE_LOOPBACK( DrawArrays ); - glDrawArrays( mode, start, count ); + _glapi_Dispatch->DrawArrays( mode, start, count ); } static void TAG(DrawElements)( GLenum mode, GLsizei count, GLenum type, const void *indices ) { PRE_LOOPBACK( DrawElements ); - glDrawElements( mode, count, type, indices ); + _glapi_Dispatch->DrawElements( mode, count, type, indices ); } static void TAG(DrawRangeElements)( GLenum mode, GLuint start, @@ -375,20 +374,32 @@ static void TAG(DrawRangeElements)( GLenum mode, GLuint start, GLenum type, const void *indices ) { PRE_LOOPBACK( DrawRangeElements ); - glDrawRangeElements( mode, start, end, count, type, indices ); + _glapi_Dispatch->DrawRangeElements( mode, start, end, count, type, indices ); } static void TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) { PRE_LOOPBACK( EvalMesh1 ); - glEvalMesh1( mode, i1, i2 ); + _glapi_Dispatch->EvalMesh1( mode, i1, i2 ); } static void TAG(EvalMesh2)( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { PRE_LOOPBACK( EvalMesh2 ); - glEvalMesh2( mode, i1, i2, j1, j2 ); + _glapi_Dispatch->EvalMesh2( mode, i1, i2, j1, j2 ); +} + +static void TAG(VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + PRE_LOOPBACK( VertexAttrib4fNV ); + _glapi_Dispatch->VertexAttrib4fNV( index, x, y, z, w ); +} + +static void TAG(VertexAttrib4fvNV)( GLuint index, const GLfloat *v ) +{ + PRE_LOOPBACK( VertexAttrib4fNV ); + _glapi_Dispatch->VertexAttrib4fvNV( index, v ); } @@ -446,12 +457,14 @@ static GLvertexformat TAG(vtxfmt) = { TAG(CallList), TAG(Begin), TAG(End), + TAG(VertexAttrib4fNV), + TAG(VertexAttrib4fvNV), TAG(Rectf), TAG(DrawArrays), TAG(DrawElements), TAG(DrawRangeElements), TAG(EvalMesh1), - TAG(EvalMesh2), + TAG(EvalMesh2) }; #undef TAG |