diff options
author | dfr <dfr> | 2000-06-13 15:33:04 +0000 |
---|---|---|
committer | dfr <dfr> | 2000-06-13 15:33:04 +0000 |
commit | a7d68dd330d54fe061a05b308718f57b442faa66 (patch) | |
tree | 1b20e362ebd871524068a6f241cb00996c349625 /xc/extras/Mesa/src | |
parent | ee5a915c97aac09db82aa65f01f0c70491217b68 (diff) |
Merge trunk into bsd-1-0-1-branch.bsd-1-0-1-20000613bsd-1-0-1-branch
Diffstat (limited to 'xc/extras/Mesa/src')
70 files changed, 19286 insertions, 8232 deletions
diff --git a/xc/extras/Mesa/src/FX/fxapi.c b/xc/extras/Mesa/src/FX/fxapi.c index 0b96cf439..6d680bcb9 100644 --- a/xc/extras/Mesa/src/FX/fxapi.c +++ b/xc/extras/Mesa/src/FX/fxapi.c @@ -623,7 +623,7 @@ #if defined(FX) #include "fxdrv.h" -fxMesaContext fxMesaCurrentCtx=NULL; +static fxMesaContext fxMesaCurrentCtx=NULL; /* * Status of 3Dfx hardware initialization @@ -694,22 +694,11 @@ void GLAPIENTRY fxMesaSetNearFar(GLfloat n, GLfloat f) /* - * The extension GL_FXMESA_global_texture_lod_bias - */ -void GLAPIENTRY glGlobalTextureLODBiasFXMESA(GLfloat biasVal) -{ - grTexLodBiasValue(GR_TMU0,biasVal); - - if(fxMesaCurrentCtx->haveTwoTMUs) - grTexLodBiasValue(GR_TMU1,biasVal); -} - - -/* * The 3Dfx Global Palette extension for GLQuake. * More a trick than a real extesion, use the shared global * palette extension. */ +extern void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *pal); /* silence warning */ void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *pal) { fxMesaContext fxMesa =fxMesaCurrentCtx; @@ -866,6 +855,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, GLcontext *ctx = 0; /*FX_GrContext_t glideContext = 0;*/ char *errorstr; + GLboolean useBGR; + char *system = NULL; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxMesaCreateContext() Start\n"); @@ -890,8 +881,10 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, case FXMESA_DEPTH_SIZE: i++; depthSize=attribList[i]; - if(depthSize) + if(depthSize) { aux=1; + depthSize = 16; + } break; case FXMESA_STENCIL_SIZE: i++; @@ -924,10 +917,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, if(depthSize && alphaBuffer) alphaBuffer=0; - if(verbose) - fprintf(stderr,"Mesa fx Voodoo Device Driver v0.30\nWritten by David Bucciarelli (davibu@tin.it.it)\n"); - - if((type=fxQueryHardware()) < 0) { + if ((type=fxQueryHardware()) < 0) { fprintf(stderr,"fx Driver: ERROR no Voodoo1/2 Graphics or Voodoo Rush !\n"); return NULL; } @@ -950,10 +940,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, else fxMesa->haveTwoTMUs=GL_FALSE; - fxMesa->haveDoubleBuffer=doubleBuffer; fxMesa->haveAlphaBuffer=alphaBuffer; fxMesa->haveGlobalPaletteTexture=GL_FALSE; - fxMesa->haveZBuffer=depthSize ? 1 : 0; fxMesa->verbose=verbose; fxMesa->board=glbCurrentBoard; @@ -971,28 +959,83 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, goto errorhandler; } - /* Pixel tables are use during pixel read-back */ + /* + * Pixel tables are use during pixel read-back + * Either initialize them for RGB or BGR order. + */ #if FXMESA_USE_ARGB - fxInitPixelTables(fxMesa, GL_FALSE); /* Force RGB pixel order */ + useBGR = GL_FALSE; /* Force RGB pixel order */ + system = "FXMESA_USE_ARGB"; #else if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) { - /* jk991130 - GROSS HACK!!! - Voodoo 3s don't use BGR!! - * the only way to tell if it's a Voodoo 3 at this stage of the - * ballgame (no Glide 3.x for linux *yet*) is to query the # of TMUs + /* jk991130 - Voodoo 3s don't use BGR. Query the # of TMUs * as Voodoo3s have 2 TMUs on board, Banshee has only 1 - * Thanks to Joseph Kain for that one + * bk000413 - another suggestion from Joseph Kain is using + * VendorID 0x121a for all 3dfx boards + * DeviceID VG 1/V2 2/VB 3/V3 5 + * For now we cehck for known BGR devices, and presume + * everything else to be a V3/RGB. */ - if (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx == 2) { - fxInitPixelTables(fxMesa, GL_FALSE); /* use RGB pixel order (Voodoo3) */ + GrVoodooConfig_t *voodoo; + voodoo = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; + + if (voodoo->nTexelfx == 1) { + /* Voodoo1 or Banshee */ + useBGR = GL_TRUE; + system = "Voodoo1"; + } + else if (voodoo->nTexelfx == 2 && + voodoo->fbiRev == 260 && + voodoo->tmuConfig[0].tmuRev == 4 && + (voodoo->tmuConfig[0].tmuRam == 2 || + voodoo->tmuConfig[0].tmuRam == 4)) { + /* Voodoo 2 */ + useBGR = GL_TRUE; + system = "Voodoo2"; + } + else if (voodoo->nTexelfx == 2 && + voodoo->fbiRev == 2 && + voodoo->tmuConfig[0].tmuRev == 1 && + voodoo->tmuConfig[0].tmuRam == 4) { + /* Quantum3D Obsidian 50/100 */ + useBGR = GL_TRUE; + system = "Quantum3D Obsidian"; + } + else + /* Brian + * (voodoo->nTexelfx == 2 && + * voodoo->fbiRev == 0 && + * voodoo->tmuConfig[0].tmuRev == 148441048 && + * voodoo->tmuConfig[0].tmuRam == 3) + * Bernd + * (voodoo->nTexelfx == 2 && + * voodoo->fbiRev == 69634 && + * voodoo->tmuConfig[0].tmuRev == 69634 && + * voodoo->tmuConfig[0].tmuRam == 2 ) + */ + { + /* Presumed Voodoo3 */ + useBGR = GL_FALSE; + system = "Voodoo3"; } - else { - fxInitPixelTables(fxMesa, GL_TRUE); /* use BGR pixel order on Voodoo1/2 */ + if (getenv("MESA_FX_INFO")) { + printf("Voodoo: Texelfx: %d / FBI Rev.: %d / TMU Rev.: %d / TMU RAM: %d\n", + voodoo->nTexelfx, + voodoo->fbiRev, + voodoo->tmuConfig[0].tmuRev, + voodoo->tmuConfig[0].tmuRam ); } } else { - fxInitPixelTables(fxMesa, GL_FALSE); /* use RGB pixel order otherwise */ + useBGR = GL_FALSE; /* use RGB pixel order otherwise */ + system = "non-voodoo"; } -#endif +#endif /*FXMESA_USE_ARGB*/ + + if (getenv("MESA_FX_INFO")) + printf("Voodoo pixel order: %s (%s)\n", useBGR ? "BGR" : "RGB", system); + + fxInitPixelTables(fxMesa, useBGR); fxMesa->width=FX_grSstScreenWidth(); fxMesa->height=FX_grSstScreenHeight(); @@ -1011,7 +1054,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, fxMesa->needClip = 0; if(verbose) - fprintf(stderr,"Glide screen size: %dx%d\n", + fprintf(stderr,"Voodoo Glide screen size: %dx%d\n", (int)FX_grSstScreenWidth(),(int)FX_grSstScreenHeight()); fxMesa->glVis=gl_create_visual(GL_TRUE, /* RGB mode */ @@ -1046,7 +1089,7 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, fxMesa->glBuffer=gl_create_framebuffer(fxMesa->glVis, GL_FALSE, /* no software depth */ fxMesa->glVis->StencilBits > 0, - fxMesa->glVis->AccumBits > 0, + fxMesa->glVis->AccumRedBits > 0, fxMesa->glVis->AlphaBits > 0 ); if (!fxMesa->glBuffer) { errorstr = "gl_create_framebuffer"; @@ -1221,6 +1264,25 @@ void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext fxMesa) } +#if 0 +static void QueryCounters(void) +{ + static GLuint prevPassed = 0; + static GLuint prevFailed = 0; + GLuint failed, passed; + GrSstPerfStats_t st; + + FX_grSstPerfStats(&st); + failed = st.zFuncFail - st.aFuncFail - st.chromaFail; + passed = st.pixelsIn - failed; + printf("failed: %d passed: %d\n", failed - prevFailed, passed - prevPassed); + + prevPassed = passed; + prevFailed = failed; +} +#endif + + /* * Swap front/back buffers for current context if double buffered. */ @@ -1233,7 +1295,7 @@ void GLAPIENTRY fxMesaSwapBuffers(void) if(fxMesaCurrentCtx) { FLUSH_VB( fxMesaCurrentCtx->glCtx, "swap buffers" ); - if(fxMesaCurrentCtx->haveDoubleBuffer) { + if (fxMesaCurrentCtx->glVis->DBflag) { grBufferSwap(fxMesaCurrentCtx->swapInterval); @@ -1263,40 +1325,45 @@ int GLAPIENTRY fxQueryHardware(void) fprintf(stderr,"fxmesa: fxQueryHardware() Start\n"); } - if(!glbGlideInitialized) { + if (!glbGlideInitialized) { grGlideInit(); - if(FX_grSstQueryHardware(&glbHWConfig)) { + if (FX_grSstQueryHardware(&glbHWConfig)) { grSstSelect(glbCurrentBoard); - glb3DfxPresent=1; + glb3DfxPresent = 1; - if(getenv("MESA_FX_INFO")) { + if (getenv("MESA_FX_INFO")) { char buf[80]; FX_grGlideGetVersion(buf); - fprintf(stderr,"Using Glide V%s\n",""); - fprintf(stderr,"Number of boards: %d\n",glbHWConfig.num_sst); - - if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_VOODOO) { - fprintf(stderr,"Framebuffer RAM: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect ? - (glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam*2) : - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.fbRam); - fprintf(stderr,"Number of TMUs: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.nTexelfx); - fprintf(stderr,"SLI detected: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig.sliDetect); - } else if(glbHWConfig.SSTs[glbCurrentBoard].type==GR_SSTTYPE_SST96) { - fprintf(stderr,"Framebuffer RAM: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.fbRam); - fprintf(stderr,"Number of TMUs: %d\n", - glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config.nTexelfx); + fprintf(stderr, "Voodoo Using Glide V%s\n", buf); + fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst); + + if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_VOODOO) { + GrVoodooConfig_t *voodoo; + voodoo = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.VoodooConfig; + + fprintf(stderr, "Voodoo Framebuffer RAM: %d\n", + voodoo->sliDetect ? (voodoo->fbRam*2) : voodoo->fbRam); + fprintf(stderr, "Voodoo Number of TMUs: %d\n", voodoo->nTexelfx); + fprintf(stderr, "Voodoo fbRam: %d\n", voodoo->fbRam); + fprintf(stderr, "Voodoo fbiRev: %d\n", voodoo->fbiRev); + + fprintf(stderr,"Voodoo SLI detected: %d\n", voodoo->sliDetect); + } + else if (glbHWConfig.SSTs[glbCurrentBoard].type == GR_SSTTYPE_SST96) { + GrSst96Config_t *sst96; + sst96 = &glbHWConfig.SSTs[glbCurrentBoard].sstBoard.SST96Config; + fprintf(stderr, "Voodoo Framebuffer RAM: %d\n", sst96->fbRam); + fprintf(stderr, "Voodoo Number of TMUs: %d\n", sst96->nTexelfx); } } - } else - glb3DfxPresent=0; + } + else { + glb3DfxPresent = 0; + } - glbGlideInitialized=1; + glbGlideInitialized = 1; #if defined(__WIN32__) onexit((_onexit_t)cleangraphics); @@ -1308,17 +1375,11 @@ int GLAPIENTRY fxQueryHardware(void) #endif } - if(!glb3DfxPresent) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxQueryHardware() End (-1)\n"); - } - return(-1); - } - if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxQueryHardware() End (voodooo)\n"); } - return(glbHWConfig.SSTs[glbCurrentBoard].type); + + return glbHWConfig.SSTs[glbCurrentBoard].type; } @@ -1327,8 +1388,8 @@ int GLAPIENTRY fxQueryHardware(void) */ void GLAPIENTRY fxCloseHardware(void) { - if(glbGlideInitialized) { - if(getenv("MESA_FX_INFO")) { + if (glbGlideInitialized) { + if (getenv("MESA_FX_INFO")) { GrSstPerfStats_t st; FX_grSstPerfStats(&st); @@ -1340,9 +1401,9 @@ void GLAPIENTRY fxCloseHardware(void) fprintf(stderr," # pixels drawn (including buffer clears and LFB writes): %u\n",(unsigned)st.pixelsOut); } - if(glbTotNumCtx==0) { + if (glbTotNumCtx == 0) { grGlideShutdown(); - glbGlideInitialized=0; + glbGlideInitialized = 0; } } } @@ -1354,7 +1415,7 @@ void GLAPIENTRY fxCloseHardware(void) /* * Need this to provide at least one external definition. */ - +extern int gl_fx_dummy_function_api(void); int gl_fx_dummy_function_api(void) { return 0; diff --git a/xc/extras/Mesa/src/FX/fxdd.c b/xc/extras/Mesa/src/FX/fxdd.c index b44ec4dbe..59a4bec93 100644 --- a/xc/extras/Mesa/src/FX/fxdd.c +++ b/xc/extras/Mesa/src/FX/fxdd.c @@ -52,6 +52,7 @@ #if defined(FX) +#include <dlfcn.h> #include "image.h" #include "types.h" #include "fxdrv.h" @@ -102,34 +103,20 @@ void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder) /***** Miscellaneous functions *****/ /**********************************************************************/ -/* Enalbe/Disable dithering */ -static void fxDDDither(GLcontext *ctx, GLboolean enable) -{ - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDDither()\n"); - } - - if (enable) { - FX_grDitherMode(GR_DITHER_4x4); - } else { - FX_grDitherMode(GR_DITHER_DISABLE); - } -} - /* Return buffer size information */ static void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = FX_CONTEXT(ctx); - if (MESA_VERBOSE&VERBOSE_DRIVER) { + if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDBufferSize(...) Start\n"); } - *width=fxMesa->width; - *height=fxMesa->height; + *width = fxMesa->width; + *height = fxMesa->height; - if (MESA_VERBOSE&VERBOSE_DRIVER) { + if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDBufferSize(...) End\n"); } } @@ -139,15 +126,13 @@ static void fxDDBufferSize(GLcontext *ctx, GLuint *width, GLuint *height) static void fxDDSetColor(GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = FX_CONTEXT(ctx); GLubyte col[4]; ASSIGN_4V( col, red, green, blue, alpha ); - - if (MESA_VERBOSE&VERBOSE_DRIVER) { + if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDSetColor(%d,%d,%d,%d)\n",red,green,blue,alpha); } - - fxMesa->color=FXCOLOR4(col); + fxMesa->color = FXCOLOR4(col); } @@ -155,19 +140,14 @@ static void fxDDSetColor(GLcontext *ctx, GLubyte red, GLubyte green, static void fxDDClearColor(GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = FX_CONTEXT(ctx); GLubyte col[4]; - - - ASSIGN_4V( col, red, green, blue, 255 ); - - if (MESA_VERBOSE&VERBOSE_DRIVER) { + if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDClearColor(%d,%d,%d,%d)\n",red,green,blue,alpha); } - - fxMesa->clearC=FXCOLOR4( col ); - fxMesa->clearA=alpha; + fxMesa->clearC = FXCOLOR4( col ); + fxMesa->clearA = alpha; } @@ -177,8 +157,18 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); - const FxU16 clearD = (FxU16) (ctx->Depth.Clear * 0xffff); - GLbitfield softwareMask = mask & (DD_STENCIL_BIT | DD_ACCUM_BIT); + const FxU32 clearD = (FxU32) (ctx->Depth.Clear * fxMesa->depthClear); + const FxU32 clearS = (FxU32) (ctx->Stencil.Clear); + GLbitfield softwareMask = mask & (DD_ACCUM_BIT); + + /* we can't clear accum buffers */ + mask &= ~(DD_ACCUM_BIT); + + if ((mask & DD_STENCIL_BIT) && !fxMesa->haveHwStencil) { + /* software stencil buffer */ + mask &= ~(DD_STENCIL_BIT); + softwareMask |= DD_STENCIL_BIT; + } if (MESA_VERBOSE & VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDClear(%d,%d,%d,%d)\n", (int) x, (int) y, @@ -186,21 +176,40 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all, } if (colorMask != 0xffffffff) { - /* do color buffer clears in software */ + /* do masked color buffer clears in software */ softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT); } + + /* disable stencil ops if enabled (it screws up clearing) */ + if (ctx->Stencil.Enabled) + FX_grDisable(GR_STENCIL_MODE_EXT); + + if (fxMesa->haveHwStencil) { + if (mask & DD_STENCIL_BIT) { + FX_grStencilMask(0xff); + /* set stencil ref value = desired clear value */ + FX_grStencilFunc(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff); + } + else { + FX_grStencilMask(0x00); + } + } + /* * This could probably be done fancier but doing each possible case * explicitly is less error prone. */ - switch (mask) { + switch (mask & ~DD_STENCIL_BIT) { case DD_BACK_LEFT_BIT | DD_DEPTH_BIT: /* back buffer & depth */ FX_grDepthMask(FXTRUE); FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); if (!ctx->Depth.Mask) { FX_grDepthMask(FXFALSE); } @@ -211,75 +220,114 @@ static GLbitfield fxDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all, * This is a work-around/ */ /* clear depth */ + FX_grDepthMask(FXTRUE); FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); FX_grColorMask(FXFALSE,FXFALSE); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); /* clear front */ FX_grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); break; case DD_BACK_LEFT_BIT: /* back buffer only */ FX_grDepthMask(FXFALSE); FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask) { - FX_grDepthMask(FXFALSE); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (ctx->Depth.Mask) { + FX_grDepthMask(FXTRUE); } break; case DD_FRONT_LEFT_BIT: /* front buffer only */ FX_grDepthMask(FXFALSE); FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask) { - FX_grDepthMask(FXFALSE); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (ctx->Depth.Mask) { + FX_grDepthMask(FXTRUE); } break; case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT: /* front and back */ FX_grDepthMask(FXFALSE); FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); - if (!ctx->Depth.Mask) { - FX_grDepthMask(FXFALSE); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (ctx->Depth.Mask) { + FX_grDepthMask(FXTRUE); } break; case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT: /* clear front */ FX_grDepthMask(FXFALSE); FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); /* clear back and depth */ FX_grDepthMask(FXTRUE); FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); if (!ctx->Depth.Mask) { FX_grDepthMask(FXFALSE); } break; case DD_DEPTH_BIT: /* just the depth buffer */ + FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); FX_grColorMask(FXFALSE,FXFALSE); - FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, - (FxU16)(ctx->Depth.Clear*0xffff)); + FX_grDepthMask(FXTRUE); + if (mask & DD_STENCIL_BIT) + FX_grBufferClearExt(fxMesa->clearC, fxMesa->clearA, clearD, clearS); + else + FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD); FX_grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); + if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT) + FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); break; default: /* error */ ; } + if (ctx->Stencil.Enabled) { + /* restore stencil state to as it was before the clear */ + FX_grEnable(GR_STENCIL_MODE_EXT); + FX_grStencilMask(ctx->Stencil.WriteMask); + FX_grStencilFunc(ctx->Stencil.Function - GL_NEVER, + ctx->Stencil.Ref, ctx->Stencil.ValueMask); + } + return softwareMask; } /* Set the buffer used for drawing */ /* XXX support for separate read/draw buffers hasn't been tested */ -static GLboolean fxDDSetDrawBuffer(GLcontext *ctx, GLenum mode ) +static GLboolean fxDDSetDrawBuffer(GLcontext *ctx, GLenum mode) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; @@ -297,6 +345,10 @@ static GLboolean fxDDSetDrawBuffer(GLcontext *ctx, GLenum mode ) FX_grRenderBuffer(fxMesa->currentFB); return GL_TRUE; } + else if (mode == GL_NONE) { + FX_grColorMask(FXFALSE,FXFALSE); + return GL_TRUE; + } else { return GL_FALSE; } @@ -326,6 +378,58 @@ static void fxDDSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer, } +/* + * These functions just set new-state flags. The exact state + * values will be evaluated later. + */ +static void +fxDDStencilFunc(GLcontext *ctx, GLenum func, GLint ref, GLuint mask) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + (void) func; (void) ref; (void) mask; + fxMesa->new_state |= FX_NEW_STENCIL; + ctx->Driver.RenderStart = fxSetupFXUnits; +} + +static void +fxDDStencilMask(GLcontext *ctx, GLuint mask) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + (void) mask; + fxMesa->new_state |= FX_NEW_STENCIL; + ctx->Driver.RenderStart = fxSetupFXUnits; +} + +static void +fxDDStencilOp(GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + (void) sfail; (void) zfail; (void) zpass; + fxMesa->new_state |= FX_NEW_STENCIL; + ctx->Driver.RenderStart = fxSetupFXUnits; +} + +static void +fxDDDepthFunc(GLcontext *ctx, GLenum func) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + (void) func; + fxMesa->new_state |= FX_NEW_DEPTH; + ctx->Driver.RenderStart = fxSetupFXUnits; +} + +static void +fxDDDepthMask(GLcontext *ctx, GLboolean mask) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + (void) mask; + fxMesa->new_state |= FX_NEW_DEPTH; + ctx->Driver.RenderStart = fxSetupFXUnits; +} + + + + #ifdef XF86DRI /* test if window coord (px,py) is visible */ static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py) @@ -342,10 +446,12 @@ static GLboolean inClipRects(fxMesaContext fxMesa, int px, int py) #endif -static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) + +static GLboolean +bitmap_R5G6B5(GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GrLfbInfo_t info; @@ -463,7 +569,7 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py, + (winX + px); for (row = 0; row < height; row++) { - const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image( finalUnpack, + const GLubyte *src = (const GLubyte *) _mesa_image_address( finalUnpack, bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); if (finalUnpack->LsbFirst) { /* least significan bit first */ @@ -515,6 +621,303 @@ static GLboolean fxDDDrawBitMap(GLcontext *ctx, GLint px, GLint py, return GL_TRUE; } + +static GLboolean +bitmap_R8G8B8A8(GLcontext *ctx, GLint px, GLint py, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) +{ + fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + GrLfbInfo_t info; + GrLfbWriteMode_t mode; + /*FxU16 color;*/ + GLuint color; + const struct gl_pixelstore_attrib *finalUnpack; + struct gl_pixelstore_attrib scissoredUnpack; + + /* check if there's any raster operations enabled which we can't handle */ + if (ctx->RasterMask & (ALPHATEST_BIT | + BLEND_BIT | + DEPTH_BIT | + FOG_BIT | + LOGIC_OP_BIT | + SCISSOR_BIT | + STENCIL_BIT | + MASKING_BIT | + ALPHABUF_BIT | + MULTI_DRAW_BIT)) + return GL_FALSE; + + if (ctx->Scissor.Enabled) { + /* This is a bit tricky, but by carefully adjusting the px, py, + * width, height, skipPixels and skipRows values we can do + * scissoring without special code in the rendering loop. + */ + + /* we'll construct a new pixelstore struct */ + finalUnpack = &scissoredUnpack; + scissoredUnpack = *unpack; + if (scissoredUnpack.RowLength == 0) + scissoredUnpack.RowLength = width; + + /* clip left */ + if (px < ctx->Scissor.X) { + scissoredUnpack.SkipPixels += (ctx->Scissor.X - px); + width -= (ctx->Scissor.X - px); + px = ctx->Scissor.X; + } + /* clip right */ + if (px + width >= ctx->Scissor.X + ctx->Scissor.Width) { + width -= (px + width - (ctx->Scissor.X + ctx->Scissor.Width)); + } + /* clip bottom */ + if (py < ctx->Scissor.Y) { + scissoredUnpack.SkipRows += (ctx->Scissor.Y - py); + height -= (ctx->Scissor.Y - py); + py = ctx->Scissor.Y; + } + /* clip top */ + if (py + height >= ctx->Scissor.Y + ctx->Scissor.Height) { + height -= (py + height - (ctx->Scissor.Y + ctx->Scissor.Height)); + } + + if (width <= 0 || height <= 0) + return GL_TRUE; /* totally scissored away */ + } + else { + finalUnpack = unpack; + } + + /* compute pixel value */ + { + GLint r = (GLint) (ctx->Current.RasterColor[0] * 255.0f); + GLint g = (GLint) (ctx->Current.RasterColor[1] * 255.0f); + GLint b = (GLint) (ctx->Current.RasterColor[2] * 255.0f); + GLint a = (GLint) (ctx->Current.RasterColor[3] * 255.0f); + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + color = PACK_BGRA32(r, g, b, a); + else + color = PACK_RGBA32(r, g, b, a); + } + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_8888; + else + mode = GR_LFBWRITEMODE_888; + + info.size = sizeof(info); + if (!FX_grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { +#ifndef FX_SILENT + fprintf(stderr,"fx Driver: error locking the linear frame buffer\n"); +#endif + return GL_TRUE; + } + +#ifdef XF86DRI +#define INSIDE(c, x, y) inClipRects((c), (x), (y)) +#else +#define INSIDE(c, x, y) (1) +#endif + + { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + GLint dstStride; + GLuint *dst; + GLint row; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + dstStride = fxMesa->screen_width; + dst = (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + px); + } + else { + dstStride = info.strideInBytes / 4; + dst = (GLuint *) info.lfbPtr + (winY - py) * dstStride + (winX + px); + } + + /* compute dest address of bottom-left pixel in bitmap */ + for (row = 0; row < height; row++) { + const GLubyte *src = (const GLubyte *) _mesa_image_address( finalUnpack, + bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); + if (finalUnpack->LsbFirst) { + /* least significan bit first */ + GLubyte mask = 1U << (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col=0; col<width; col++) { + if (*src & mask) { + if (INSIDE(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 128U) { + src++; + mask = 1U; + } + else { + mask = mask << 1; + } + } + if (mask != 1) + src++; + } + else { + /* most significan bit first */ + GLubyte mask = 128U >> (finalUnpack->SkipPixels & 0x7); + GLint col; + for (col=0; col<width; col++) { + if (*src & mask) { + if (INSIDE(fxMesa, winX + px + col, winY - py - row)) + dst[col] = color; + } + if (mask == 1U) { + src++; + mask = 128U; + } + else { + mask = mask >> 1; + } + } + if (mask != 128) + src++; + } + dst -= dstStride; + } + } + +#undef INSIDE + + FX_grLfbUnlock(GR_LFB_WRITE_ONLY,fxMesa->currentFB); + return GL_TRUE; +} + + +static GLboolean +readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *packing, + GLvoid *dstImage ) +{ + if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) { + return GL_FALSE; /* can't do this */ + } + else { + fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + GrLfbInfo_t info; + GLboolean result = GL_FALSE; + + BEGIN_BOARD_LOCK(); + info.size=sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; +#ifdef XF86DRI + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); +#else + const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ +#endif + const GLushort *src = (const GLushort *) info.lfbPtr + + (winY - y) * srcStride + (winX + x); + GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage, + width, height, format, type, 0, 0, 0); + GLint dstStride = _mesa_image_row_stride(packing, width, format, type); + + if (format == GL_RGB && type == GL_UNSIGNED_BYTE) { + /* convert 5R6G5B into 8R8G8B */ + GLint row, col; + const GLint halfWidth = width >> 1; + const GLint extraPixel = (width & 1); + for (row = 0; row < height; row++) { + GLubyte *d = dst; + for (col = 0; col < halfWidth; col++) { + const GLuint pixel = ((const GLuint *) src)[col]; + const GLint pixel0 = pixel & 0xffff; + const GLint pixel1 = pixel >> 16; + *d++ = FX_PixelToR[pixel0]; + *d++ = FX_PixelToG[pixel0]; + *d++ = FX_PixelToB[pixel0]; + *d++ = FX_PixelToR[pixel1]; + *d++ = FX_PixelToG[pixel1]; + *d++ = FX_PixelToB[pixel1]; + } + if (extraPixel) { + GLushort pixel = src[width-1]; + *d++ = FX_PixelToR[pixel]; + *d++ = FX_PixelToG[pixel]; + *d++ = FX_PixelToB[pixel]; + } + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + else if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { + /* convert 5R6G5B into 8R8G8B8A */ + GLint row, col; + const GLint halfWidth = width >> 1; + const GLint extraPixel = (width & 1); + for (row = 0; row < height; row++) { + GLubyte *d = dst; + for (col = 0; col < halfWidth; col++) { + const GLuint pixel = ((const GLuint *) src)[col]; + const GLint pixel0 = pixel & 0xffff; + const GLint pixel1 = pixel >> 16; + *d++ = FX_PixelToR[pixel0]; + *d++ = FX_PixelToG[pixel0]; + *d++ = FX_PixelToB[pixel0]; + *d++ = 255; + *d++ = FX_PixelToR[pixel1]; + *d++ = FX_PixelToG[pixel1]; + *d++ = FX_PixelToB[pixel1]; + *d++ = 255; + } + if (extraPixel) { + const GLushort pixel = src[width-1]; + *d++ = FX_PixelToR[pixel]; + *d++ = FX_PixelToG[pixel]; + *d++ = FX_PixelToB[pixel]; + *d++ = 255; + } + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + else if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { + /* directly memcpy 5R6G5B pixels into client's buffer */ + const GLint widthInBytes = width * 2; + GLint row; + for (row = 0; row < height; row++) { + MEMCPY(dst, src, widthInBytes); + dst += dstStride; + src -= srcStride; + } + result = GL_TRUE; + } + else { + result = GL_FALSE; + } + + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); + return result; + } +} + + + static void fxDDFinish(GLcontext *ctx) { FX_grFlush(); @@ -568,7 +971,7 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) } } /* now make the GL_RENDERER string */ - sprintf(buffer, "Mesa DRI %s 20000224", hardware); + sprintf(buffer, "Mesa DRI %s 20000608", hardware); return buffer; } case GL_VENDOR: @@ -625,6 +1028,19 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) int fxDDInitFxMesaContext( fxMesaContext fxMesa ) { + /* Get Glide3vn function pointers */ + { + void *handle; + handle = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); + if (!handle) + return 0; + grStencilFuncPtr = dlsym(handle, "grStencilFunc"); + grStencilMaskPtr = dlsym(handle, "grStencilMask"); + grStencilOpPtr = dlsym(handle, "grStencilOp"); + grBufferClearExtPtr = dlsym(handle, "grBufferClearExt"); + /* call dlclose()? */ + } + FX_setupGrVertexLayout(); @@ -651,6 +1067,8 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) else fxMesa->verbose=GL_FALSE; + fxMesa->depthClear = FX_grGetInteger(FX_ZDEPTH_MAX); + fxMesa->color=0xffffffff; fxMesa->clearC=0; fxMesa->clearA=0; @@ -661,7 +1079,6 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->stats.memTexUpload=0; fxMesa->tmuSrc=FX_TMU_NONE; - fxMesa->lastUnitsMode=FX_UM_NONE; fxTMInit(fxMesa); /* FX units setup */ @@ -676,16 +1093,19 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->unitsState.blendSrcFuncAlpha=GR_BLEND_ONE; fxMesa->unitsState.blendDstFuncAlpha=GR_BLEND_ZERO; + /* fxMesa->unitsState.depthTestEnabled =GL_FALSE; fxMesa->unitsState.depthMask =GL_TRUE; fxMesa->unitsState.depthTestFunc =GR_CMP_LESS; + */ FX_grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE); - if(fxMesa->haveDoubleBuffer) { - fxMesa->currentFB=GR_BUFFER_BACKBUFFER; + if (fxMesa->glVis->DBflag) { + fxMesa->currentFB = GR_BUFFER_BACKBUFFER; FX_grRenderBuffer(GR_BUFFER_BACKBUFFER); - } else { - fxMesa->currentFB=GR_BUFFER_FRONTBUFFER; + } + else { + fxMesa->currentFB = GR_BUFFER_FRONTBUFFER; FX_grRenderBuffer(GR_BUFFER_FRONTBUFFER); } @@ -701,7 +1121,7 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) return 0; } - if(fxMesa->haveZBuffer) + if (fxMesa->glVis->DepthBits > 0) FX_grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); #if (!FXMESA_USE_ARGB) @@ -714,7 +1134,7 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1; fxMesa->glCtx->NewState|=NEW_DRVSTATE1; fxMesa->new_state = NEW_ALL; - + fxDDSetupInit(); fxDDCvaInit(); fxDDClipInit(); @@ -744,6 +1164,10 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->glCtx->PipelineStage, fxMesa->glCtx->NrPipelineStages); + /* this little bit ensures that all Glide state gets initialized */ + fxMesa->new_state = NEW_ALL; + fxMesa->glCtx->Driver.RenderStart = fxSetupFXUnits; + /* Run the config file */ gl_context_initialize( fxMesa->glCtx ); @@ -768,10 +1192,8 @@ void fxDDInitExtensions( GLcontext *ctx ) gl_extensions_disable(ctx, "GL_EXT_blend_minmax"); gl_extensions_disable(ctx, "GL_EXT_blend_subtract"); gl_extensions_disable(ctx, "GL_EXT_blend_color"); - gl_extensions_disable(ctx, "GL_EXT_paletted_texture"); gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0); - gl_extensions_add(ctx, DEFAULT_ON, "GL_FXMESA_global_texture_lod_bias", 0); if (!fxMesa->haveTwoTMUs) gl_extensions_disable(ctx, "GL_EXT_texture_env_add"); @@ -816,8 +1238,7 @@ static GLboolean fxIsInHardware(GLcontext *ctx) if (!ctx->Hint.AllowDrawMem) return GL_TRUE; /* you'll take it and like it */ - if((ctx->RasterMask & STENCIL_BIT) || - ((ctx->Color.BlendEnabled) && (ctx->Color.BlendEquation!=GL_FUNC_ADD_EXT)) || + if(((ctx->Color.BlendEnabled) && (ctx->Color.BlendEquation!=GL_FUNC_ADD_EXT)) || ((ctx->Color.ColorLogicOpEnabled) && (ctx->Color.LogicOp!=GL_COPY)) || (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) || (!((ctx->Color.ColorMask[RCOMP]==ctx->Color.ColorMask[GCOMP]) && @@ -838,17 +1259,26 @@ static GLboolean fxIsInHardware(GLcontext *ctx) return GL_FALSE; } - if((ctx->Texture.ReallyEnabled & TEXTURE0_2D) && - (ctx->Texture.Unit[0].EnvMode==GL_BLEND)) { - return GL_FALSE; + if (ctx->Texture.ReallyEnabled & TEXTURE0_2D) { + if (ctx->Texture.Unit[0].EnvMode == GL_BLEND && + (ctx->Texture.ReallyEnabled & TEXTURE1_2D || + ctx->Texture.Unit[0].EnvColor[0] != 0 || + ctx->Texture.Unit[0].EnvColor[1] != 0 || + ctx->Texture.Unit[0].EnvColor[2] != 0 || + ctx->Texture.Unit[0].EnvColor[3] != 1)) { + return GL_FALSE; + } + if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0) + return GL_FALSE; } - if((ctx->Texture.ReallyEnabled & TEXTURE1_2D) && - (ctx->Texture.Unit[1].EnvMode==GL_BLEND)) { - return GL_FALSE; + if (ctx->Texture.ReallyEnabled & TEXTURE1_2D) { + if (ctx->Texture.Unit[1].EnvMode == GL_BLEND) + return GL_FALSE; + if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0) + return GL_FALSE; } - if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_TEXTURE)) fprintf(stderr, "fxMesa: fxIsInHardware, envmode is %s/%s\n", gl_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode), @@ -892,6 +1322,9 @@ static GLboolean fxIsInHardware(GLcontext *ctx) } } + if (ctx->Stencil.Enabled && !fxMesa->haveHwStencil) + return GL_FALSE; + return GL_TRUE; } @@ -943,58 +1376,68 @@ static void fxDDReducedPrimitiveChange(GLcontext *ctx, GLenum prim) } } + void fxSetupDDPointers(GLcontext *ctx) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxSetupDDPointers()\n"); - } + fxMesaContext fxMesa = FX_CONTEXT(ctx); - ctx->Driver.UpdateState=fxDDUpdateDDPointers; + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxSetupDDPointers()\n"); + } + ctx->Driver.UpdateState = fxDDUpdateDDPointers; + ctx->Driver.ClearIndex = NULL; + ctx->Driver.ClearColor = fxDDClearColor; + ctx->Driver.Clear = fxDDClear; + ctx->Driver.Index = NULL; + ctx->Driver.Color = fxDDSetColor; + ctx->Driver.SetDrawBuffer = fxDDSetDrawBuffer; + ctx->Driver.SetReadBuffer = fxDDSetReadBuffer; + ctx->Driver.GetBufferSize = fxDDBufferSize; + ctx->Driver.Finish = fxDDFinish; + ctx->Driver.Flush = NULL; + ctx->Driver.GetString = fxDDGetString; + ctx->Driver.NearFar = fxDDSetNearFar; + ctx->Driver.GetParameteri = fxDDGetParameteri; ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan; ctx->Driver.WriteDepthPixels=fxDDWriteDepthPixels; ctx->Driver.ReadDepthSpan=fxDDReadDepthSpan; ctx->Driver.ReadDepthPixels=fxDDReadDepthPixels; - ctx->Driver.GetString=fxDDGetString; - - ctx->Driver.Dither=fxDDDither; - - ctx->Driver.NearFar=fxDDSetNearFar; - - ctx->Driver.GetParameteri=fxDDGetParameteri; - - ctx->Driver.ClearIndex=NULL; - ctx->Driver.ClearColor=fxDDClearColor; - ctx->Driver.Clear=fxDDClear; - - ctx->Driver.Index=NULL; - ctx->Driver.Color=fxDDSetColor; - - ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer; - ctx->Driver.SetReadBuffer=fxDDSetReadBuffer; - ctx->Driver.GetBufferSize=fxDDBufferSize; - - ctx->Driver.Bitmap=fxDDDrawBitMap; - ctx->Driver.DrawPixels=NULL; - - ctx->Driver.Finish=fxDDFinish; - ctx->Driver.Flush=NULL; + if (ctx->Visual->RedBits == 8 && + ctx->Visual->GreenBits == 8 && + ctx->Visual->BlueBits == 8 && + ctx->Visual->AlphaBits == 8) { + ctx->Driver.Bitmap = bitmap_R8G8B8A8; + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = NULL; + } + else { + ctx->Driver.Bitmap = bitmap_R5G6B5; + ctx->Driver.DrawPixels = NULL; + ctx->Driver.ReadPixels = readpixels_R5G6B5; + } ctx->Driver.RenderStart=NULL; ctx->Driver.RenderFinish=NULL; + ctx->Driver.TexImage2D = fxDDTexImage2D; + ctx->Driver.TexSubImage2D = fxDDTexSubImage2D; + ctx->Driver.GetTexImage = fxDDGetTexImage; ctx->Driver.TexEnv=fxDDTexEnv; - ctx->Driver.TexImage=fxDDTexImg; - ctx->Driver.TexSubImage=fxDDTexSubImg; ctx->Driver.TexParameter=fxDDTexParam; ctx->Driver.BindTexture=fxDDTexBind; ctx->Driver.DeleteTexture=fxDDTexDel; ctx->Driver.UpdateTexturePalette=fxDDTexPalette; - ctx->Driver.UseGlobalTexturePalette=fxDDTexUseGlbPalette; ctx->Driver.RectFunc=NULL; + if (fxMesa->haveHwStencil) { + ctx->Driver.StencilFunc = fxDDStencilFunc; + ctx->Driver.StencilMask = fxDDStencilMask; + ctx->Driver.StencilOp = fxDDStencilOp; + } + ctx->Driver.AlphaFunc=fxDDAlphaFunc; ctx->Driver.BlendFunc=fxDDBlendFunc; ctx->Driver.DepthFunc=fxDDDepthFunc; @@ -1031,6 +1474,7 @@ void fxSetupDDPointers(GLcontext *ctx) } + #else diff --git a/xc/extras/Mesa/src/FX/fxddspan.c b/xc/extras/Mesa/src/FX/fxddspan.c index ec5513480..2c53da8d3 100644 --- a/xc/extras/Mesa/src/FX/fxddspan.c +++ b/xc/extras/Mesa/src/FX/fxddspan.c @@ -46,33 +46,193 @@ /* fxdd.c - 3Dfx VooDoo Mesa span and pixel functions */ -#ifdef HAVE_CONFIG_H -#include "conf.h" -#endif +#include "fxdrv.h" -#if defined(FX) -#include "fxdrv.h" -#ifdef _MSC_VER -#ifdef _WIN32 -#pragma warning( disable : 4090 4022 ) -/* 4101 : "different 'const' qualifier" - * 4022 : "pointer mistmatch for actual parameter 'n' +/* + * Examine the cliprects to generate an array of flags to indicate + * which pixels in a span are visible. Note: (x,y) is a screen + * coordinate. */ -#endif -#endif +static void +generate_vismask(const fxMesaContext fxMesa, GLint x, GLint y, GLint n, + GLubyte vismask[]) +{ + GLboolean initialized = GL_FALSE; + GLint i, j; + + /* turn on flags for all visible pixels */ + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + + if (y >= rect->y1 && y < rect->y2) { + if (x >= rect->x1 && x + n <= rect->x2) { + /* common case, whole span inside cliprect */ + MEMSET(vismask, 1, n); + return; + } + if (x < rect->x2 && x + n >= rect->x1) { + /* some of the span is inside the rect */ + GLint start, end; + if (!initialized) { + MEMSET(vismask, 0, n); + initialized = GL_TRUE; + } + if (x < rect->x1) + start = rect->x1 - x; + else + start = 0; + if (x + n > rect->x2) + end = rect->x2 - x; + else + end = n; + assert(start >= 0); + assert(end <= n); + for (j = start; j < end; j++) + vismask[j] = 1; + } + } + } +} -#if !defined(FXMESA_USE_ARGB) +/* + * Examine cliprects and determine if the given screen pixel is visible. + */ +static GLboolean +visible_pixel(const fxMesaContext fxMesa, int scrX, int scrY) +{ + int i; + for (i = 0; i < fxMesa->numClipRects; i++) { + const XF86DRIClipRectPtr rect = &fxMesa->pClipRects[i]; + if (scrX >= rect->x1 && + scrX < rect->x2 && + scrY >= rect->y1 && + scrY < rect->y2) + return GL_TRUE; + } + return GL_FALSE; +} -#if defined(FX_GLIDE3) && defined(XF86DRI) + +typedef enum { FBS_READ, FBS_WRITE } FBS_DIRECTION; +/* + * Read or write a single span from the frame buffer. + * Input Parameters: + * fxMesa: The context + * target_buffer: Which buffer to read from. + * xpos, ypos: Starting Coordinates. + * xlength: Length of the span. + * data_size: Size of data elements: 1, 2, or 4. + * buffer: Pointer to the buffer to read + * to or write from. This needs + * to be turned into a pointer. + * direction: Read or Write. + */ +static void +rw_fb_span(fxMesaContext fxMesa, + GrBuffer_t target_buffer, + FxU32 xpos, + FxU32 ypos, + FxU32 xlength, + FxU32 data_size, + void *buffer, + FBS_DIRECTION direction) +{ + GrLfbInfo_t info; + BEGIN_BOARD_LOCK(); + info.size=sizeof(info); + + if (grLfbLock(direction == FBS_READ ? GR_LFB_READ_ONLY : GR_LFB_WRITE_ONLY, + target_buffer, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; +#ifdef XF86DRI + /* stride in data elements */ + const GLint srcStride = + (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) + : (info.strideInBytes / data_size); +#else + /* stride in data elements */ + const GLint srcStride = info.strideInBytes / data_size; +#endif + GLushort *data16 = (GLushort *) info.lfbPtr + + (winY - ypos) * srcStride + + (winX + xpos); + GLubyte *target16 = (GLubyte *) buffer; + GLubyte *data8 = (GLubyte *) data16; + GLubyte *target8 = (GLubyte *) buffer; + GLuint *data32 = (GLuint *) data16; + GLuint *target32 = (GLuint *) buffer; + GLuint i, j; + + for (i = j = 0; i < xlength; i += 1, j += 1) { + switch (data_size) { + case 1: + switch (direction) { + case FBS_READ: + *target8++ = *data8++; + break; + case FBS_WRITE: + *data8++ = *target8++; + break; + } + break; + case 2: + switch (direction) { + case FBS_READ: + *target16++ = *data16++; + break; + case FBS_WRITE: + *data16++ = *target16++; + break; + } + break; + case 4: + switch (direction) { + case FBS_READ: + *target32++ = *data32++; + break; + case FBS_WRITE: + *data32++ = *target32++; + break; + } + break; + } + } + grLfbUnlock(direction == FBS_READ ? GR_LFB_READ_ONLY : GR_LFB_WRITE_ONLY, + target_buffer); + } + END_BOARD_LOCK(); +} + +static FxBool +fb_point_is_clipped(fxMesaContext fxMesa, + FxU32 dst_x, FxU32 dst_y) +{ + int i; + for (i=0; i<fxMesa->numClipRects; i++) { + if ((dst_x>=fxMesa->pClipRects[i].x1) && + (dst_x<fxMesa->pClipRects[i].x2) && + (dst_y>=fxMesa->pClipRects[i].y1) && + (dst_y<fxMesa->pClipRects[i].y2)) { + return GL_FALSE; + } + } + return GL_TRUE; +} static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, - FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, - FxU32 src_width, FxU32 src_height, FxI32 src_stride, - void *src_data) + FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, + FxU32 src_width, FxU32 src_height, FxI32 src_stride, + void *src_data) { int i, x, w, srcElt; void *data; @@ -80,12 +240,12 @@ static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, if (src_width==1 && src_height==1) { /* Easy case writing a point */ for (i=0; i<fxMesa->numClipRects; i++) { if ((dst_x>=fxMesa->pClipRects[i].x1) && - (dst_x<fxMesa->pClipRects[i].x2) && - (dst_y>=fxMesa->pClipRects[i].y1) && - (dst_y<fxMesa->pClipRects[i].y2)) { - FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, - 1, 1, src_stride, src_data); - return GL_TRUE; + (dst_x<fxMesa->pClipRects[i].x2) && + (dst_y>=fxMesa->pClipRects[i].y1) && + (dst_y<fxMesa->pClipRects[i].y2)) { + FX_grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, + 1, 1, src_stride, src_data); + return GL_TRUE; } } } else if (src_height==1) { /* Writing a span */ @@ -97,20 +257,20 @@ static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, } for (i=0; i<fxMesa->numClipRects; i++) { if (dst_y>=fxMesa->pClipRects[i].y1 && dst_y<fxMesa->pClipRects[i].y2) { - if (dst_x<fxMesa->pClipRects[i].x1) { - x=fxMesa->pClipRects[i].x1; - data=((char*)src_data)+srcElt*(dst_x-x); - w=src_width-(x-dst_x); - } else { - x=dst_x; - data=src_data; - w=src_width; - } - if (x+w>fxMesa->pClipRects[i].x2) { - w=fxMesa->pClipRects[i].x2-x; - } - FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, 1, - src_stride, data); + if (dst_x<fxMesa->pClipRects[i].x1) { + x=fxMesa->pClipRects[i].x1; + data=((char*)src_data)+srcElt*(x - dst_x); + w=src_width-(x-dst_x); + } else { + x=dst_x; + data=src_data; + w=src_width; + } + if (x+w>fxMesa->pClipRects[i].x2) { + w=fxMesa->pClipRects[i].x2-x; + } + FX_grLfbWriteRegion(dst_buffer, x, dst_y, src_format, w, 1, + src_stride, data); } } } else { /* Punt on the case of arbitrary rectangles */ @@ -119,88 +279,42 @@ static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, return GL_TRUE; } -#else - -#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ - FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) - -#endif /* KW: Rearranged the args in the call to grLfbWriteRegion(). */ -#define LFB_WRITE_SPAN_MESA(dst_buffer, \ - dst_x, \ - dst_y, \ - src_width, \ - src_stride, \ - src_data) \ - writeRegionClipped(fxMesa, dst_buffer, \ - dst_x, \ - dst_y, \ - GR_LFB_SRC_FMT_8888, \ - src_width, \ - 1, \ - src_stride, \ - src_data) \ - - -#else /* !defined(FXMESA_USE_RGBA) */ - -#define writeRegionClipped(fxm,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \ - FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) - - -#define MESACOLOR_TO_ARGB(c) ( \ - ( ((unsigned int)(c[ACOMP]))<<24 ) | \ - ( ((unsigned int)(c[RCOMP]))<<16 ) | \ - ( ((unsigned int)(c[GCOMP]))<<8 ) | \ - ( (unsigned int)(c[BCOMP])) ) - -inline void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer, - FxU32 dst_x, - FxU32 dst_y, - FxU32 src_width, - FxI32 src_stride, - void *src_data ) -{ - /* Covert to ARGB */ - GLubyte (*rgba)[4] = src_data; - GLuint argb[MAX_WIDTH]; - int i; - - for (i = 0; i < src_width; i++) - { - argb[i] = MESACOLOR_TO_ARGB(rgba[i]); - } - writeRegionClipped( /*fxMesa,*/ NULL, dst_buffer, - dst_x, - dst_y, - GR_LFB_SRC_FMT_8888, - src_width, - 1, - src_stride, - (void*)argb); -} - -#endif /* !defined(FXMESA_USE_RGBA) */ +#define LFB_WRITE_SPAN_MESA(dst_buffer, \ + dst_x, \ + dst_y, \ + src_width, \ + src_stride, \ + src_data) \ + writeRegionClipped(fxMesa, dst_buffer, \ + dst_x, \ + dst_y, \ + GR_LFB_SRC_FMT_8888, \ + src_width, \ + 1, \ + src_stride, \ + src_data) \ -/************************************************************************/ -/***** Span functions *****/ -/************************************************************************/ -static void fxDDWriteRGBASpan(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgba[][4], const GLubyte mask[]) +/* + * 16bpp span/pixel functions + */ + +static void +write_R5G6B5_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; GLint bottom=fxMesa->height+fxMesa->y_offset-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n"); + fprintf(stderr,"fxmesa: fxDDWriteRGBASpan(...)\n"); } x+=fxMesa->x_offset; @@ -213,7 +327,7 @@ static void fxDDWriteRGBASpan(const GLcontext *ctx, } else { if (span > 0) { LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+i-span, bottom-y, - /* GR_LFB_SRC_FMT_8888,*/ span, /*1,*/ 0, (void *) rgba[i-span] ); + /* GR_LFB_SRC_FMT_8888,*/ span, /*1,*/ 0, (void *) rgba[i-span] ); span = 0; } } @@ -221,16 +335,16 @@ static void fxDDWriteRGBASpan(const GLcontext *ctx, if (span > 0) LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+n-span, bottom-y, - /* GR_LFB_SRC_FMT_8888, */ span, /*1,*/ 0, (void *) rgba[n-span] ); + /* GR_LFB_SRC_FMT_8888, */ span, /*1,*/ 0, (void *) rgba[n-span] ); } else LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x, bottom-y,/* GR_LFB_SRC_FMT_8888,*/ - n,/* 1,*/ 0, (void *) rgba ); + n,/* 1,*/ 0, (void *) rgba ); } -static void fxDDWriteRGBSpan(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte rgb[][3], const GLubyte mask[]) +static void +write_R5G6B5_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgb[][3], const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; @@ -238,7 +352,7 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx, GLubyte rgba[MAX_WIDTH][4]; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n"); + fprintf(stderr,"fxmesa: fxDDWriteRGBSpan()\n"); } x+=fxMesa->x_offset; @@ -255,7 +369,7 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx, } else { if (span > 0) { LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+i-span, bottom-y, - /*GR_LFB_SRC_FMT_8888,*/ span,/* 1,*/ 0, (void *) rgba ); + /*GR_LFB_SRC_FMT_8888,*/ span,/* 1,*/ 0, (void *) rgba ); span = 0; } } @@ -263,7 +377,7 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx, if (span > 0) LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x+n-span, bottom-y, - /*GR_LFB_SRC_FMT_8888,*/ span,/* 1,*/ 0, (void *) rgba ); + /*GR_LFB_SRC_FMT_8888,*/ span,/* 1,*/ 0, (void *) rgba ); } else { for (i=0;i<n;i++) { rgba[i][RCOMP]=rgb[i][0]; @@ -273,14 +387,14 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx, } LFB_WRITE_SPAN_MESA( fxMesa->currentFB, x, bottom-y,/* GR_LFB_SRC_FMT_8888,*/ - n,/* 1,*/ 0, (void *) rgba ); + n,/* 1,*/ 0, (void *) rgba ); } } -static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte mask[]) +static void +write_R5G6B5_mono_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; @@ -288,7 +402,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, GLuint data[MAX_WIDTH]; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n"); + fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n"); } x+=fxMesa->x_offset; @@ -302,8 +416,8 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, } else { if (span > 0) { writeRegionClipped(fxMesa, fxMesa->currentFB, x+i-span, bottom-y, - GR_LFB_SRC_FMT_8888, span, 1, 0, - (void *) data ); + GR_LFB_SRC_FMT_8888, span, 1, 0, + (void *) data ); span = 0; } } @@ -311,95 +425,129 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, if (span > 0) writeRegionClipped(fxMesa, fxMesa->currentFB, x+n-span, bottom-y, - GR_LFB_SRC_FMT_8888, span, 1, 0, - (void *) data ); + GR_LFB_SRC_FMT_8888, span, 1, 0, + (void *) data ); } else { for (i=0;i<n;i++) { data[i]=(GLuint) fxMesa->color; } writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888, - n, 1, 0, (void *) data ); + n, 1, 0, (void *) data ); } } -static void fxDDReadRGBASpan(const GLcontext *ctx, - GLuint n, GLint x, GLint y, GLubyte rgba[][4]) +/* + * Read a span of 16-bit RGB pixels. Note, we don't worry about cliprects + * since OpenGL says obscured pixels have undefined values. + */ +static void +read_R5G6B5_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte rgba[][4]) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - GLushort data[MAX_WIDTH]; - GLuint i; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; - - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadRGBASpan(...)\n"); - } - - assert(n < MAX_WIDTH); - - x+=fxMesa->x_offset; - FX_grLfbReadRegion( fxMesa->currentFB, x, bottom-y, n, 1, 0, data); + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbInfo_t info; + BEGIN_BOARD_LOCK(); + info.size=sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->currentFB, + GR_LFBWRITEMODE_ANY, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winX = fxMesa->x_offset; + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; +#ifdef XF86DRI + const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + ? (fxMesa->screen_width) : (info.strideInBytes / 2); +#else + const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */ +#endif + const GLushort *data16 = (const GLushort *) info.lfbPtr + + (winY - y) * srcStride + + (winX + x); + const GLuint *data32 = (const GLuint *) data16; + GLuint i, j; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = j = 0; i < n; i += 2, j++) { + GLuint pixel = data32[j]; + GLuint pixel0 = pixel & 0xffff; + GLuint pixel1 = pixel >> 16; + rgba[i][RCOMP] = FX_PixelToR[pixel0]; + rgba[i][GCOMP] = FX_PixelToG[pixel0]; + rgba[i][BCOMP] = FX_PixelToB[pixel0]; + rgba[i][ACOMP] = 255; + rgba[i+1][RCOMP] = FX_PixelToR[pixel1]; + rgba[i+1][GCOMP] = FX_PixelToG[pixel1]; + rgba[i+1][BCOMP] = FX_PixelToB[pixel1]; + rgba[i+1][ACOMP] = 255; + } + if (extraPixel) { + GLushort pixel = data16[n]; + rgba[n][RCOMP] = FX_PixelToR[pixel]; + rgba[n][GCOMP] = FX_PixelToG[pixel]; + rgba[n][BCOMP] = FX_PixelToB[pixel]; + rgba[n][ACOMP] = 255; + } - for (i=0;i<n;i++) { - GLushort pixel = data[i]; - rgba[i][RCOMP] = FX_PixelToR[pixel]; - rgba[i][GCOMP] = FX_PixelToG[pixel]; - rgba[i][BCOMP] = FX_PixelToB[pixel]; - rgba[i][ACOMP] = 255; + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); } + END_BOARD_LOCK(); } -/************************************************************************/ -/***** Pixel functions *****/ -/************************************************************************/ -static void fxDDWriteRGBAPixels(const GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[]) +static void +write_R5G6B5_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; GLint bottom=fxMesa->height+fxMesa->y_offset-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n"); + fprintf(stderr,"fxmesa: fxDDWriteRGBAPixels(...)\n"); } for(i=0;i<n;i++) if(mask[i]) - LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i]+fxMesa->x_offset, bottom-y[i], - 1, 1, (void *)rgba[i]); + LFB_WRITE_SPAN_MESA(fxMesa->currentFB, x[i]+fxMesa->x_offset, bottom-y[i], + 1, 1, (void *)rgba[i]); } -static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[]) + +static void +write_R5G6B5_mono_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; GLint bottom=fxMesa->height+fxMesa->y_offset-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n"); + fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n"); } for(i=0;i<n;i++) if(mask[i]) writeRegionClipped(fxMesa, fxMesa->currentFB,x[i]+fxMesa->x_offset,bottom-y[i], - GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color); + GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color); } -static void fxDDReadRGBAPixels(const GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[]) +static void +read_R5G6B5_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->y_delta-1; + GLint bottom=fxMesa->height+fxMesa->y_offset-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n"); + fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n"); } for(i=0;i<n;i++) { @@ -415,19 +563,663 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx, } -/************************************************************************/ -/***** Depth functions *****/ -/************************************************************************/ +/* + * 24bpp span/pixel functions + */ + +static void +write_R8G8B8_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgb[][3], const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_888; + else + mode = GR_LFBWRITEMODE_888; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + /*GLint dstStride = fxMesa->screen_width * 3;*/ + GLint dstStride = info.strideInBytes / 1; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 1; + GLuint *dst32 = (GLuint *) dst; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + dst32[i] = PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); + } + } + } + else { + /* back buffer */ + GLint dstStride = info.strideInBytes; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + GLuint *dst32 = (GLuint *) dst; + if (mask) { + GLuint i; + for (i = 0; i < n; i++) { + if (mask[i]) { + dst32[i] = PACK_RGBA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); + } + } + } + else { + GLuint i; + for (i = 0; i < n; i++) { + dst32[i] = PACK_RGBA32(rgb[i][2], rgb[i][1], rgb[i][0], 255); + } + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +} + + + +static void +write_R8G8B8_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_8888; + else + mode = GR_LFBWRITEMODE_888 /*565*/; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + /* XXX have to do cliprect clipping! */ + GLint dstStride = fxMesa->screen_width * 4; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + GLuint *dst32 = (GLuint *) dst; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3]); + } + } + } + else { + /* back buffer */ + GLint dstStride = info.strideInBytes; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + if (mask) { + const GLuint *src32 = (const GLuint *) rgba; + GLuint *dst32 = (GLuint *) dst; + GLuint i; + for (i = 0; i < n; i++) { + if (mask[i]) { + dst32[i] = src32[i]; + } + } + } + else { + /* no mask, write all pixels */ + MEMCPY(dst, rgba, 4 * n); + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +} + + +static void +write_R8G8B8_mono_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GLubyte rgba[MAX_WIDTH][4]; + GLuint *data = (GLuint *) rgba; + GLuint i; + + /* XXX this is a simple-minded implementation but good enough for now */ + for (i = 0; i < n; i++) { + data[i] = (GLuint) fxMesa->color; + } + write_R8G8B8_rgba_span(ctx, n, x, y, (const GLubyte (*)[4]) rgba, mask); +} + + +static void +read_R8G8B8_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte rgba[][4]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (1 || fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + mode = GR_LFBWRITEMODE_8888; + } + else { + mode = GR_LFBWRITEMODE_565; /*888*/ /*565*/; + } + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->currentFB, + mode, /*GR_LFBWRITEMODE_ANY,*/ + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + GLint srcStride = fxMesa->screen_width * 4; + const GLubyte *src = (const GLubyte *) info.lfbPtr + + (winY - y) * srcStride + (winX + x) * 4; + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][0] = src[i * 4 + 2]; + rgba[i][1] = src[i * 4 + 1]; + rgba[i][2] = src[i * 4 + 0]; + rgba[i][3] = src[i * 4 + 3]; + } + } + else { + /* back buffer */ + GLint srcStride = /*info.strideInBytes;*/ 8192 / 2; /* XXX a hack! */ + const GLubyte *src = (const GLubyte *) info.lfbPtr + + (winY - y) * srcStride + (winX + x) * 4; + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][0] = src[i * 4 + 2]; + rgba[i][1] = src[i * 4 + 1]; + rgba[i][2] = src[i * 4 + 0]; + rgba[i][3] = src[i * 4 + 3]; + } + } + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +} + + +static void +write_R8G8B8_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[]) +{ +#if 00 + GLuint i; + for (i = 0; i < n; i++) { + write_R8G8B8_rgba_span(ctx, 1, x[i], y[i], rgba + i, mask + i); + } + +#else + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_8888; + else + mode = GR_LFBWRITEMODE_888 /*565*/; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + GLuint i; + for (i = 0; i < n; i++) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { + GLint dstStride = fxMesa->screen_width * 4; + GLubyte *dst = (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; + GLuint *dst32 = (GLuint *) dst; + *dst32 = PACK_BGRA32(rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3]); + } + } + } + else { + /* back buffer */ + GLuint i; + for (i = 0; i < n; i++) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { + GLint dstStride = info.strideInBytes; + GLubyte *dst = (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; + GLuint *dst32 = (GLuint *) dst; + const GLuint *src32 = (const GLuint *) rgba; + *dst32 = src32[i]; + } + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +#endif +} + + +static void +write_R8G8B8_mono_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[]) +{ +} + + +static void +read_R8G8B8_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[]) +{ + printf("read_R8G8B8_pixels %d\n", n); +} + + + +/* + * 32bpp span/pixel functions + */ + +static void +write_R8G8B8A8_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgb[][3], const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_8888; + else + mode = GR_LFBWRITEMODE_888 /*565*/; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + GLint dstStride = fxMesa->screen_width * 4; + GLubyte * dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + GLuint *dst32 = (GLuint *) dst; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + dst32[i] = PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); + } + } + } + else { + /* back buffer */ + GLint dstStride = info.strideInBytes; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + if (mask) { + GLuint *dst32 = (GLuint *) dst; + GLuint i; + for (i = 0; i < n; i++) { + if (mask[i]) { + dst32[i] = PACK_RGBA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); + } + } + } + else { + GLuint *dst32 = (GLuint *) dst; + GLuint i; + for (i = 0; i < n; i++) { + dst32[i] = PACK_RGBA32(rgb[i][0], rgb[i][1], rgb[i][2], 255); + } + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +} + + +/* + *XXX test of grLfbWriteRegion in 32bpp mode. Doesn't seem to work! + */ +#if 0 +static void +write_R8G8B8A8_rgb_span2(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgb[][3], const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLint x2 = fxMesa->x_offset +x; + GLint y2 = bottom - y; + + FX_grLfbWriteRegion(fxMesa->currentFB, x2, y2, GR_LFB_SRC_FMT_888, + n, 1, 0, rgb); +} +#endif + + +static void +write_R8G8B8A8_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte rgba[][4], const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_8888; + else + mode = GR_LFBWRITEMODE_888 /*565*/; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + GLint dstStride = fxMesa->screen_width * 4; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + GLuint *dst32 = (GLuint *) dst; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + generate_vismask(fxMesa, scrX, scrY, n, visMask); + for (i = 0; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1], rgba[i][2], rgba[i][3]); + } + } + } + else { + /* back buffer */ + GLint dstStride = 8192; /* XXX a hack info.strideInBytes; */ + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + if (mask) { + const GLuint *src32 = (const GLuint *) rgba; + GLuint *dst32 = (GLuint *) dst; + GLuint i; + for (i = 0; i < n; i++) { + if (mask[i]) { + dst32[i] = src32[i]; + } + } + } + else { + /* no mask, write all pixels */ + MEMCPY(dst, rgba, 4 * n); + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + } + else { + info.strideInBytes = -1; + } + END_BOARD_LOCK(); +} + + +static void +write_R8G8B8A8_mono_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLubyte mask[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GLubyte rgba[MAX_WIDTH][4]; + GLuint *data = (GLuint *) rgba; + GLuint i; + + /* XXX this is a simple-minded implementation but good enough for now */ + for (i = 0; i < n; i++) { + data[i] = (GLuint) fxMesa->color; + } + write_R8G8B8A8_rgba_span(ctx, n, x, y, (const GLubyte (*)[4]) rgba, mask); +} + + +static void +read_R8G8B8A8_span(const GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte rgba[][4]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + mode = GR_LFBWRITEMODE_8888; + } + else { + mode = GR_LFBWRITEMODE_8888; /*565;*/ + } + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + GLint srcStride = fxMesa->screen_width; + const GLuint *src32 = (const GLuint *) info.lfbPtr + + (winY - y) * srcStride + (winX + x); + GLuint i; + for (i = 0; i < n; i++) { + const GLuint p = src32[i]; + rgba[i][0] = (p >> 16) & 0xff; + rgba[i][1] = (p >> 8) & 0xff; + rgba[i][2] = (p >> 0) & 0xff; + rgba[i][3] = (p >> 24) & 0xff; + } + } + else { + /* back buffer */ + GLint srcStride = 1024; /* XXX a hack */ + const GLuint *src32 = (const GLuint *) info.lfbPtr + + (winY - y) * srcStride + (winX + x); + GLuint i; + for (i = 0; i < n; i++) { + GLuint p = src32[i]; + rgba[i][0] = (p >> 16) & 0xff; + rgba[i][1] = (p >> 8) & 0xff; + rgba[i][2] = (p >> 0) & 0xff; + rgba[i][3] = (p >> 24) & 0xff; + } + } + grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB); + } + else + info.strideInBytes = -1; + END_BOARD_LOCK(); +} + + +static void +write_R8G8B8A8_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[]) +{ +#if 00 + GLuint i; + for (i = 0; i < n; i++) { + write_R8G8B8A8_rgba_span(ctx, 1, x[i], y[i], rgba + i, mask + i); + } + +#else + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbWriteMode_t mode; + GrLfbInfo_t info; + + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) + mode = GR_LFBWRITEMODE_8888; + else + mode = GR_LFBWRITEMODE_888 /*565*/; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + fxMesa->currentFB, + mode, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) { + GLuint i; + for (i = 0; i < n; i++) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { + GLint dstStride = fxMesa->screen_width * 4; + GLubyte *dst = (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; + GLuint *dst32 = (GLuint *) dst; + *dst32 = PACK_BGRA32(rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3]); + } + } + } + else { + /* back buffer */ + GLuint i; + for (i = 0; i < n; i++) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x[i]; + const GLint scrY = winY - y[i]; + if (mask[i] && visible_pixel(fxMesa, scrX, scrY)) { + GLint dstStride = info.strideInBytes; + GLubyte *dst = (GLubyte *) info.lfbPtr + scrY * dstStride + scrX * 4; + GLuint *dst32 = (GLuint *) dst; + const GLuint *src32 = (const GLuint *) rgba; + *dst32 = src32[i]; + } + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, fxMesa->currentFB); + } + END_BOARD_LOCK(); +#endif +} + + +static void +write_R8G8B8A8_mono_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[]) +{ + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLuint i; + GLuint color = fxMesa->color; + for (i = 0; i < n; i++) { + if (mask[i]) { + write_R8G8B8A8_rgba_span(ctx, 1, x[i], y[i], + (const GLubyte (*)[4]) &color, mask + i); + } + } +} + + + +static void +read_R8G8B8A8_pixels(const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[]) +{ + GLuint i; + for (i = 0; i < n; i++) { + if (mask[i]) { + read_R8G8B8A8_span(ctx, 1, x[i], y[i], rgba + i); + } + } + printf("read_R8G8B8A8_pixels %d\n", n); +} + + + +/* + * Depth buffer read/write functions. + */ void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth depth[], const GLubyte mask[]) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n"); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n"); } x += fxMesa->x_offset; @@ -436,14 +1228,77 @@ void fxDDWriteDepthSpan(GLcontext *ctx, GLint i; for (i = 0; i < n; i++) { if (mask[i]) { - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom-y, - GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &depth[i]); + GLshort d16; + GLuint d32; + switch (depth_size) { + case 16: + d16 = depth[i]; + writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom - y, + GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &d16); + break; + case 32: + if (!fb_point_is_clipped(fxMesa, x+i, bottom-y)) { + if (stencil_size > 0) { + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + x + i, bottom - y, + 1, + sizeof(GLdepth), + &d32, + FBS_READ); + d32 = depth[i] & 0xFF000000; + break; + } else { + d32 = depth[i]; + } + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + x + i, bottom - y, + 1, + sizeof(GLdepth), + &d32, + FBS_WRITE); + } + } } } - } - else { - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom-y, - GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth); + } else { + GLushort depth16[MAX_WIDTH]; + GLint i; + GLuint d32; + switch (depth_size) { + case 16: + for (i = 0; i < n; i++) { + depth16[i] = depth[i]; + } + writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom - y, + GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth16); + break; + case 32: + for (i = 0; i < n; i++) { + if (fb_point_is_clipped(fxMesa, x+i, bottom-y)) { + if (stencil_size > 0) { + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + x + i, bottom - y, + 1, + sizeof(GLdepth), + &d32, + FBS_READ); + d32 = (d32 & 0xFF0000) | (depth[i] & 0x00FFFFFF); + } else { + d32 = depth[i]; + } + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + x + i, bottom - y, + 1, + sizeof(GLdepth), + &d32, + FBS_WRITE); + } + } + } } } @@ -451,15 +1306,39 @@ void fxDDWriteDepthSpan(GLcontext *ctx, void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[]) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLushort depth16[MAX_WIDTH]; + GLuint i; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n"); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n"); } - x+=fxMesa->x_offset; - FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth); + x += fxMesa->x_offset; + switch (depth_size) { + case 16: + FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16); + for (i = 0; i < n; i++) { + depth[i] = depth16[i]; + } + break; + case 32: + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + x, bottom - y, + n, + sizeof(GLdepth), + depth, + FBS_READ); + if (stencil_size > 0) { + for (i = 0; i < n; i++) { + depth[i] &= 0xFFFFFF; + } + } + } } @@ -468,20 +1347,56 @@ void fxDDWriteDepthPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLdepth depth[], const GLubyte mask[]) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; GLuint i; + GLuint d32; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n"); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n"); } for (i = 0; i < n; i++) { if (mask[i]) { int xpos = x[i] + fxMesa->x_offset; int ypos = bottom - y[i]; - writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, - GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &depth[i]); + GLushort d16 = depth[i]; + switch (depth_size) { + case 16: + writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos, + GR_LFB_SRC_FMT_ZA16, 1, 1, 0, + (void *) &d16); + break; + case 32: + if (!fb_point_is_clipped(fxMesa, xpos, ypos)) { + if (stencil_size > 0) { + /* + * Should I sign extend this? I don't + * believe so, since GLdepth is unsigned. + */ + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d32, + FBS_READ); + d32 = (d32 &~ 0xFF000000) | (depth[i] & 0x00FFFFFF); + } else { + d32 = depth[i]; + } + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d32, + FBS_WRITE); + } + break; + } } } } @@ -490,60 +1405,420 @@ void fxDDWriteDepthPixels(GLcontext *ctx, void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[]) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - GLint bottom=fxMesa->height+fxMesa->y_offset-1; + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; GLuint i; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n"); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n"); } - for (i = 0; i < n; i++) { int xpos = x[i] + fxMesa->x_offset; int ypos = bottom - y[i]; - FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,xpos,ypos,1,1,0,&depth[i]); + GLushort d16; + GLuint d32; + GLuint depth_size = fxMesa->glVis->DepthBits; + GLuint stencil_size = fxMesa->glVis->StencilBits; + + assert((depth_size == 16) || (depth_size == 32)); + switch (depth_size) { + case 16: + FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER, xpos, ypos, 1, 1, 0, &d16); + depth[i] = d16; + break; + case 32: + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + depth_size/8, + &d32, + FBS_READ); + /* + * Get rid of the stencil bits. Should I sign + * extend this? I don't believe so, since GLdepth + * is unsigned. + */ + if (stencil_size > 0) { + d32 &= 0xFFFFFF; + } + depth[i] = d32; + break; + default: + assert(0); + } } } +/* + * Stencil buffer read/write functions. + */ +#define DEPTH_VALUE_TO_STENCIL_VALUE(d) (((d) >> 24) & 0xFF) +#define STENCIL_VALUE_TO_DEPTH_VALUE(s,d) \ + ((((s) & 0xFF) << 24) | ((d) & 0xFFFFFF)) +#define ASSEMBLE_STENCIL_VALUE(os, ns, mask) \ + (((os) &~ (mask)) | ((ns) & (mask))) -/************************************************************************/ +#if 00 +/* + * Read a horizontal span of stencil values from the stencil buffer. + */ +void +fxDDReadStencilSpan( GLcontext *ctx, + GLuint n, + GLint x, + GLint y, + GLstencil stencil[] ) +{ + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + int xpos = x + fxMesa->x_offset; + int ypos = bottom - y; + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDReadStencilSpan(...)\n"); + } -void fxSetupDDSpanPointers(GLcontext *ctx) -{ - ctx->Driver.WriteRGBASpan =fxDDWriteRGBASpan; - ctx->Driver.WriteRGBSpan =fxDDWriteRGBSpan; - ctx->Driver.WriteMonoRGBASpan =fxDDWriteMonoRGBASpan; - ctx->Driver.WriteRGBAPixels =fxDDWriteRGBAPixels; - ctx->Driver.WriteMonoRGBAPixels =fxDDWriteMonoRGBAPixels; + for (i = 0; i < n; i++, ypos += 1) { + GLuint d; + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d, + FBS_READ); + stencil[i] = DEPTH_VALUE_TO_STENCIL_VALUE(d); + } +} - ctx->Driver.WriteCI8Span =NULL; - ctx->Driver.WriteCI32Span =NULL; - ctx->Driver.WriteMonoCISpan =NULL; - ctx->Driver.WriteCI32Pixels =NULL; - ctx->Driver.WriteMonoCIPixels =NULL; +/* + * Write a horizontal span of stencil values into the stencil buffer. + * If mask is NULL, write all stencil values. + * Else, only write stencil[i] if mask[i] is non-zero. + */ +void +fxDDWriteStencilSpan( GLcontext *ctx, + GLuint n, + GLint x, + GLint y, + const GLstencil stencil[], + const GLubyte mask[] ) +{ + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + int xpos = x + fxMesa->x_offset; + int ypos = bottom - y; - ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan; - ctx->Driver.ReadRGBAPixels =fxDDReadRGBAPixels; + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDWriteStencilSpan(...)\n"); + } - ctx->Driver.ReadCI32Span =NULL; - ctx->Driver.ReadCI32Pixels =NULL; + for (i = 0; i < n; i++, ypos += 1) { + GLdepth d; + GLstencil ns; + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d, + FBS_READ); + /* + * Find the old stencil value, and strip off the bits + * we are going to write. + */ + ns = ASSEMBLE_STENCIL_VALUE(DEPTH_VALUE_TO_STENCIL_VALUE(d), + stencil[i], + mask[i]); + /* + * Now, assemble the new StenDepth value, with the old + * depth value, the old stencil value in the bits + * where mask is 0, and the new stencil value in the bits + * where mask is 1. + */ + d = STENCIL_VALUE_TO_DEPTH_VALUE(ns, d); + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d, + FBS_WRITE); + } } +/* Write an array of stencil values into the stencil buffer. + * If mask is NULL, write all stencil values. + * Else, only write stencil[i] if mask[i] is non-zero. + */ +void +fxDDReadStencilPixels( GLcontext *ctx, + GLuint n, + const GLint x[], + const GLint y[], + GLstencil stencil[]) +{ + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; -#else + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDReadStencilPixels(...)\n"); + } + for (i = 0; i < n; i++) { + int xpos = x[i] + fxMesa->x_offset; + int ypos = bottom - y[i]; + GLuint d; + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d, + FBS_READ); + stencil[i] = DEPTH_VALUE_TO_STENCIL_VALUE(d); + } +} /* - * Need this to provide at least one external definition. + * Read an array of stencil values from the stencil buffer. */ +void +fxDDWriteStencilPixels( GLcontext *ctx, + GLuint n, + const GLint x[], + const GLint y[], + const GLstencil stencil[], + const GLstencil mask[]) +{ + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + GLint bottom = fxMesa->height + fxMesa->y_offset - 1; + GLuint i; + + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDWriteStencilPixels(...)\n"); + } + + for (i = 0; i < n; i++) { + int xpos = x[i] + fxMesa->x_offset; + int ypos = bottom - y[i]; + GLuint d; + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d, + FBS_READ); + d = STENCIL_VALUE_TO_DEPTH_VALUE(stencil[i], d); + rw_fb_span(fxMesa, + GR_BUFFER_AUXBUFFER, + xpos, ypos, + 1, + sizeof(GLdepth), + &d, + FBS_WRITE); + } +} +#endif /* disable fxddStencil* funcs */ + + +#define EXTRACT_S_FROM_ZS(zs) (((zs) >> 24) & 0xFF) +#define EXTRACT_Z_FROM_ZS(zs) ((zs) & 0xffffff) +#define BUILD_ZS(z, s) (((s) << 24) | (z)) + +static void write_stencil_span(GLcontext *ctx, GLuint n, GLint x, GLint y, + const GLstencil stencil[], + const GLubyte mask[] ) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbInfo_t info; + int s; + void *d; + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_WRITE_ONLY, + GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_Z32, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + const GLint scrX = winX + x; + const GLint scrY = winY - y; + + GLint dstStride = info.strideInBytes; + GLubyte *dst = (GLubyte *) info.lfbPtr + + (winY - y) * dstStride + (winX + x) * 4; + GLuint *dst32 = (GLuint *) dst; + GLubyte visMask[MAX_WIDTH]; + GLuint i; + generate_vismask(fxMesa, scrX, scrY, n, visMask); + s = dstStride; + d = dst32; + for (i = 0; i < n; i++) { + if (visMask[i] && (!mask || mask[i])) { + GLuint zs = dst32[i]; + GLuint z = EXTRACT_Z_FROM_ZS(zs); + zs = BUILD_ZS(z, stencil[i]); + dst32[i] = /*zs;*/ stencil[i]; + } + } + grLfbUnlock(GR_LFB_WRITE_ONLY, GR_BUFFER_AUXBUFFER); + } + else { + s = -1; + d = 0; + } + END_BOARD_LOCK(); + /* + printf("write stencil span %d %p\n", s, d); + printf("info: size=%d lfbPtr=%p stride=%x writeMode=%x origin=%x\n", + info.size, info.lfbPtr, info.strideInBytes, info.writeMode, info.origin); + */ +} + + +static void +read_stencil_span(GLcontext *ctx, GLuint n, GLint x, GLint y, + GLstencil stencil[]) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + GrLfbInfo_t info; + /* + int s; + void *d; + */ + + BEGIN_BOARD_LOCK(); + info.size = sizeof(info); + if (grLfbLock(GR_LFB_READ_ONLY, + GR_BUFFER_AUXBUFFER, + GR_LFBWRITEMODE_Z32, + GR_ORIGIN_UPPER_LEFT, + FXFALSE, + &info)) { + const GLint winY = fxMesa->y_offset + fxMesa->height - 1; + const GLint winX = fxMesa->x_offset; + GLint srcStride = /*info.strideInBytes;*/ 8192 ; /* XXX a hack! */ + const GLubyte *src = (const GLubyte *) info.lfbPtr + + (winY - y) * srcStride + (winX + x) * 4; + const GLuint *src32 = (const GLuint *) src; + GLuint i; + /* + s = srcStride; + d = src32; + */ + for (i = 0; i < n; i++) { + stencil[i] = EXTRACT_S_FROM_ZS(src32[i]); + } + grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_AUXBUFFER); + } + END_BOARD_LOCK(); + /* + printf("read stencil span %d %p\n", s, d); + printf("info: size=%d lfbPtr=%p stride=%x writeMode=%x origin=%x\n", + info.size, info.lfbPtr, info.strideInBytes, info.writeMode, info.origin); + */ +} + + +static void +write_stencil_pixels( GLcontext *ctx, GLuint n, + const GLint x[], const GLint y[], + const GLstencil stencil[], const GLubyte mask[]) +{ + /* XXX optimize this */ + GLuint i; + for (i = 0; i < n; i++) { + if (mask[i]) { + write_stencil_span(ctx, 1, x[i], y[i], stencil + i, mask + i); + } + } +} -int gl_fx_dummy_function_span(void) + +static void +read_stencil_pixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], + GLstencil stencil[]) { - return 0; + /* XXX optimize this */ + GLuint i; + for (i = 0; i < n; i++) { + read_stencil_span(ctx, 1, x[i], y[i], stencil + i); + } } -#endif /* FX */ + + +void fxSetupDDSpanPointers(GLcontext *ctx) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + + if (ctx->Visual->RedBits == 5 && + ctx->Visual->GreenBits == 6 && + ctx->Visual->BlueBits == 5 && + ctx->Visual->AlphaBits == 0) { + /* 16bpp mode */ + ctx->Driver.WriteRGBASpan = write_R5G6B5_rgba_span; + ctx->Driver.WriteRGBSpan = write_R5G6B5_rgb_span; + ctx->Driver.WriteMonoRGBASpan = write_R5G6B5_mono_span; + ctx->Driver.WriteRGBAPixels = write_R5G6B5_pixels; + ctx->Driver.WriteMonoRGBAPixels = write_R5G6B5_mono_pixels; + ctx->Driver.ReadRGBASpan = read_R5G6B5_span; + ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels; + } + else if (ctx->Visual->RedBits == 8 && + ctx->Visual->GreenBits == 8 && + ctx->Visual->BlueBits == 8 && + ctx->Visual->AlphaBits == 0) { + /* 24bpp mode */ + ctx->Driver.WriteRGBASpan = write_R8G8B8_rgba_span; + ctx->Driver.WriteRGBSpan = write_R8G8B8_rgb_span; + ctx->Driver.WriteMonoRGBASpan = write_R8G8B8_mono_span; + ctx->Driver.WriteRGBAPixels = write_R8G8B8_pixels; + ctx->Driver.WriteMonoRGBAPixels = write_R8G8B8_mono_pixels; + ctx->Driver.ReadRGBASpan = read_R8G8B8_span; + ctx->Driver.ReadRGBAPixels = read_R8G8B8_pixels; + } + else if (ctx->Visual->RedBits == 8 && + ctx->Visual->GreenBits == 8 && + ctx->Visual->BlueBits == 8 && + ctx->Visual->AlphaBits == 8) { + /* 32bpp mode */ + ctx->Driver.WriteRGBASpan = write_R8G8B8A8_rgba_span; + ctx->Driver.WriteRGBSpan = write_R8G8B8A8_rgb_span; + ctx->Driver.WriteMonoRGBASpan = write_R8G8B8A8_mono_span; + ctx->Driver.WriteRGBAPixels = write_R8G8B8A8_pixels; + ctx->Driver.WriteMonoRGBAPixels = write_R8G8B8A8_mono_pixels; + ctx->Driver.ReadRGBASpan = read_R8G8B8A8_span; + ctx->Driver.ReadRGBAPixels = read_R8G8B8A8_pixels; + } + else { + abort(); + } + + if (fxMesa->haveHwStencil) { + ctx->Driver.WriteStencilSpan = write_stencil_span; + ctx->Driver.ReadStencilSpan = read_stencil_span; + ctx->Driver.WriteStencilPixels = write_stencil_pixels; + ctx->Driver.ReadStencilPixels = read_stencil_pixels; + } + + ctx->Driver.WriteCI8Span = NULL; + ctx->Driver.WriteCI32Span = NULL; + ctx->Driver.WriteMonoCISpan = NULL; + ctx->Driver.WriteCI32Pixels = NULL; + ctx->Driver.WriteMonoCIPixels = NULL; + ctx->Driver.ReadCI32Span = NULL; + ctx->Driver.ReadCI32Pixels = NULL; +} diff --git a/xc/extras/Mesa/src/FX/fxddtex.c b/xc/extras/Mesa/src/FX/fxddtex.c index 71d1e97ad..69ceebaa9 100644 --- a/xc/extras/Mesa/src/FX/fxddtex.c +++ b/xc/extras/Mesa/src/FX/fxddtex.c @@ -50,6 +50,9 @@ #if defined(FX) #include "fxdrv.h" +#include "image.h" +#include "texutil.h" + void fxPrintTextureData(tfxTexInfo *ti) { @@ -63,17 +66,18 @@ void fxPrintTextureData(tfxTexInfo *ti) } else fprintf(stderr, "\tName: UNNAMED\n"); fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed); - fprintf(stderr, "\tTMU: %d\n", ti->whichTMU); + fprintf(stderr, "\tTMU: %ld\n", ti->whichTMU); fprintf(stderr, "\t%s\n", (ti->isInTM)?"In TMU":"Not in TMU"); if (ti->tm[0]) - fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr, - ti->tm[0]->endAddr); + fprintf(stderr, "\tMem0: %x-%x\n", (unsigned) ti->tm[0]->startAddr, + (unsigned) ti->tm[0]->endAddr); if (ti->tm[1]) - fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr, - ti->tm[1]->endAddr); + fprintf(stderr, "\tMem1: %x-%x\n", (unsigned) ti->tm[1]->startAddr, + (unsigned) ti->tm[1]->endAddr); fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel); - fprintf(stderr, "\tFilters: min %d min %d\n", ti->minFilt, ti->maxFilt); - fprintf(stderr, "\tClamps: s %d t %d\n", ti->sClamp, ti->tClamp); + fprintf(stderr, "\tFilters: min %d min %d\n", + (int) ti->minFilt, (int) ti->maxFilt); + fprintf(stderr, "\tClamps: s %d t %d\n", (int) ti->sClamp, (int) ti->tClamp); fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale); fprintf(stderr, "\tInt Scales: s %d t %d\n", ti->int_sScale/0x800000, ti->int_tScale/0x800000); @@ -86,14 +90,14 @@ void fxPrintTextureData(tfxTexInfo *ti) /*************************** Texture Mapping ****************************/ /************************************************************************/ -void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj) +static void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; tfxTexInfo *ti; - fxTMMoveOutTM(fxMesa,tObj); /* TO DO: SLOW but easy to write */ - ti=fxTMGetTexInfo(tObj); + if (ti->isInTM) fxTMMoveOutTM(fxMesa,tObj); /* TO DO: SLOW but easy to write */ + ti->validated=GL_FALSE; fxMesa->new_state|=FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; @@ -128,7 +132,6 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa) ti->LODblend=FXFALSE; for(i=0;i<MAX_TEXTURE_LEVELS;i++) { - ti->mipmapLevel[i].used=GL_FALSE; ti->mipmapLevel[i].data=NULL; } @@ -160,7 +163,7 @@ void fxDDTexBind(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj) ctx->Driver.RenderStart = fxSetupFXUnits; } -void fxDDTexEnv(GLcontext *ctx, GLenum pname, const GLfloat *param) +void fxDDTexEnv(GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; @@ -171,6 +174,16 @@ void fxDDTexEnv(GLcontext *ctx, GLenum pname, const GLfloat *param) fprintf(stderr,"fxmesa: texenv(%x)\n",pname); } + /* apply any lod biasing right now */ + if (pname==GL_TEXTURE_LOD_BIAS_EXT) { + FX_grTexLodBiasValue(GR_TMU0,*param); + + if(fxMesa->haveTwoTMUs) { + FX_grTexLodBiasValue(GR_TMU1,*param); + } + + } + fxMesa->new_state|=FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; } @@ -312,124 +325,154 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxTexInfo *ti=fxTMGetTexInfo(tObj); + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxTexInfo *ti = fxTMGetTexInfo(tObj); - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexDel(%d,%p)\n", tObj->Name, ti); } - if(!ti) + if (!ti) return; - fxTMFreeTexture(fxMesa,tObj); + fxTMFreeTexture(fxMesa, tObj); FREE(ti); - tObj->DriverData=NULL; + tObj->DriverData = NULL; - ctx->NewState|=NEW_TEXTURING; + ctx->NewState |= NEW_TEXTURING; } -void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) -{ - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - int i; - FxU32 r,g,b,a; - tfxTexInfo *ti; - if(tObj) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n",tObj->Name,(GLuint)tObj->DriverData); - } - if(tObj->Palette.Format!=GL_RGBA) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette format in texpalette()\n"); -#endif - return; - } - - if(tObj->Palette.Size>256) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette size in texpalette()\n"); -#endif - return; - } - - if (!tObj->DriverData) - tObj->DriverData=fxAllocTexObjData(fxMesa); - - ti=fxTMGetTexInfo(tObj); - - for(i=0;i<tObj->Palette.Size;i++) { - r=tObj->Palette.Table[i*4]; - g=tObj->Palette.Table[i*4+1]; - b=tObj->Palette.Table[i*4+2]; - a=tObj->Palette.Table[i*4+3]; - ti->palette.data[i]=(a<<24)|(r<<16)|(g<<8)|b; - } +/* + * Convert a gl_color_table texture palette to Glide's format. + */ +static void +convertPalette(FxU32 data[256], const struct gl_color_table *table) +{ + const GLubyte *tableUB = (const GLubyte *) table->Table; + GLint width = table->Size; + FxU32 r, g, b, a; + GLint i; + + ASSERT(table->TableType == GL_UNSIGNED_BYTE); + + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < width; i++) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = tableUB[i]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_LUMINANCE: + for (i = 0; i < width; i++) { + r = tableUB[i]; + g = tableUB[i]; + b = tableUB[i]; + a = 255; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_ALPHA: + for (i = 0; i < width; i++) { + r = g = b = 255; + a = tableUB[i]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < width; i++) { + r = g = b = tableUB[i*2+0]; + a = tableUB[i*2+1]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_RGB: + for (i = 0; i < width; i++) { + r = tableUB[i*3+0]; + g = tableUB[i*3+1]; + b = tableUB[i*3+2]; + a = 255; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + case GL_RGBA: + for (i = 0; i < width; i++) { + r = tableUB[i*4+0]; + g = tableUB[i*4+1]; + b = tableUB[i*4+2]; + a = tableUB[i*4+3]; + data[i] = (a << 24) | (r << 16) | (g << 8) | b; + } + break; + } +} - fxTexInvalidate(ctx,tObj); - } else { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n"); - } - if(ctx->Texture.Palette.Format!=GL_RGBA) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette format in texpalette()\n"); -#endif - return; - } - if(ctx->Texture.Palette.Size>256) { -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: unsupported palette size in texpalette()\n"); -#endif - return; +void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + + if (tObj) { + /* per-texture palette */ + tfxTexInfo *ti; + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n", + tObj->Name, (GLuint) tObj->DriverData); } - - for(i=0;i<ctx->Texture.Palette.Size;i++) { - r=ctx->Texture.Palette.Table[i*4]; - g=ctx->Texture.Palette.Table[i*4+1]; - b=ctx->Texture.Palette.Table[i*4+2]; - a=ctx->Texture.Palette.Table[i*4+3]; - fxMesa->glbPalette.data[i]=(a<<24)|(r<<16)|(g<<8)|b; + if (!tObj->DriverData) + tObj->DriverData = fxAllocTexObjData(fxMesa); + ti = fxTMGetTexInfo(tObj); + convertPalette(ti->palette.data, &tObj->Palette); + fxTexInvalidate(ctx, tObj); + } + else { + /* global texture palette */ + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexPalette(global)\n"); } - - fxMesa->new_state|=FX_NEW_TEXTURING; + convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette); + fxMesa->new_state |= FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; } } + void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = FX_CONTEXT(ctx); if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDTexUseGlbPalette(%d)\n",state); } - if(state) { - fxMesa->haveGlobalPaletteTexture=1; + if (state) { + fxMesa->haveGlobalPaletteTexture = 1; - FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE,&(fxMesa->glbPalette)); + FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette)); if (fxMesa->haveTwoTMUs) - FX_grTexDownloadTable(GR_TMU1,GR_TEXTABLE_PALETTE,&(fxMesa->glbPalette)); - } else { - fxMesa->haveGlobalPaletteTexture=0; + FX_grTexDownloadTable(GR_TMU1, GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette)); + } + else { + fxMesa->haveGlobalPaletteTexture = 0; - if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) && - (ctx->Texture.Unit[0].Current!=NULL)) { - struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current; + if ((ctx->Texture.Unit[0].Current == ctx->Texture.Unit[0].CurrentD[2]) && + (ctx->Texture.Unit[0].Current != NULL)) { + struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current; if (!tObj->DriverData) - tObj->DriverData=fxAllocTexObjData(fxMesa); + tObj->DriverData = fxAllocTexObjData(fxMesa); - fxTexInvalidate(ctx,tObj); + fxTexInvalidate(ctx, tObj); } } } + static int logbase2(int n) { GLint i = 1; @@ -453,209 +496,68 @@ static int logbase2(int n) /* Need different versions for different cpus. */ -#define INT_TRICK(l2) (0x800000 * l2) - - -int fxTexGetInfo(int w, int h, GrLOD_t *lodlevel, GrAspectRatio_t *ar, +#define INT_TRICK(l2) (0x800000 * (l2)) +int fxTexGetInfo(int w, int h, GrLOD_t *lodlevel, + GrAspectRatio_t *aspectratio, float *sscale, float *tscale, int *i_sscale, int *i_tscale, int *wscale, int *hscale) { - - static GrLOD_t lod[9]={GR_LOD_256,GR_LOD_128,GR_LOD_64,GR_LOD_32, - GR_LOD_16,GR_LOD_8,GR_LOD_4,GR_LOD_2,GR_LOD_1}; - - int logw,logh,ws,hs; - GrLOD_t l; - GrAspectRatio_t aspectratio; - float s,t; - int is,it; + int logw, logh, ar, l, is, it, ws, hs; + float s, t; logw=logbase2(w); logh=logbase2(h); - - switch(logw-logh) { - case 0: - aspectratio=GR_ASPECT_1x1; - l=lod[8-logw]; - s=t=256.0f; - is=it=INT_TRICK(8); - ws=hs=1; - break; - case 1: - aspectratio=GR_ASPECT_2x1; - l=lod[8-logw]; - s=256.0f; - t=128.0f; - is=INT_TRICK(8);it=INT_TRICK(7); - ws=1; - hs=1; - break; - case 2: - aspectratio=GR_ASPECT_4x1; - l=lod[8-logw]; - s=256.0f; - t=64.0f; - is=INT_TRICK(8);it=INT_TRICK(6); - ws=1; - hs=1; - break; - case 3: - aspectratio=GR_ASPECT_8x1; - l=lod[8-logw]; - s=256.0f; - t=32.0f; - is=INT_TRICK(8);it=INT_TRICK(5); - ws=1; - hs=1; - break; - case 4: - aspectratio=GR_ASPECT_8x1; - l=lod[8-logw]; - s=256.0f; - t=32.0f; - is=INT_TRICK(8);it=INT_TRICK(5); - ws=1; - hs=2; - break; - case 5: - aspectratio=GR_ASPECT_8x1; - l=lod[8-logw]; - s=256.0f; - t=32.0f; - is=INT_TRICK(8);it=INT_TRICK(5); + ar=logw-logh; + /* Hardware only allows a maximum aspect ratio of 8x1, so handle + |ar|>3 by scaling the image and using an 8x1 aspect ratio */ + if (ar>=0) { + l=logw; + s=256.0; + is=INT_TRICK(8); ws=1; - hs=4; - break; - case 6: - aspectratio=GR_ASPECT_8x1; - l=lod[8-logw]; - s=256.0f; - t=32.0f; - is=INT_TRICK(8);it=INT_TRICK(5); - ws=1; - hs=8; - break; - case 7: - aspectratio=GR_ASPECT_8x1; - l=lod[8-logw]; - s=256.0f; - t=32.0f; - is=INT_TRICK(8);it=INT_TRICK(5); - ws=1; - hs=16; - break; - case 8: - aspectratio=GR_ASPECT_8x1; - l=lod[8-logw]; - s=256.0f; - t=32.0f; - is=INT_TRICK(8);it=INT_TRICK(5); - ws=1; - hs=32; - break; - case -1: - aspectratio=GR_ASPECT_1x2; - l=lod[8-logh]; - s=128.0f; - t=256.0f; - is=INT_TRICK(7);it=INT_TRICK(8); - ws=1; - hs=1; - break; - case -2: - aspectratio=GR_ASPECT_1x4; - l=lod[8-logh]; - s=64.0f; - t=256.0f; - is=INT_TRICK(6);it=INT_TRICK(8); - ws=1; - hs=1; - break; - case -3: - aspectratio=GR_ASPECT_1x8; - l=lod[8-logh]; - s=32.0f; - t=256.0f; - is=INT_TRICK(5);it=INT_TRICK(8); - ws=1; - hs=1; - break; - case -4: - aspectratio=GR_ASPECT_1x8; - l=lod[8-logh]; - s=32.0f; - t=256.0f; - is=INT_TRICK(5);it=INT_TRICK(8); - ws=2; - hs=1; - break; - case -5: - aspectratio=GR_ASPECT_1x8; - l=lod[8-logh]; - s=32.0f; - t=256.0f; - is=INT_TRICK(5);it=INT_TRICK(8); - ws=4; - hs=1; - break; - case -6: - aspectratio=GR_ASPECT_1x8; - l=lod[8-logh]; - s=32.0f; - t=256.0f; - is=INT_TRICK(5);it=INT_TRICK(8); - ws=8; - hs=1; - break; - case -7: - aspectratio=GR_ASPECT_1x8; - l=lod[8-logh]; - s=32.0f; - t=256.0f; - is=INT_TRICK(5);it=INT_TRICK(8); - ws=16; - hs=1; - break; - case -8: - aspectratio=GR_ASPECT_1x8; - l=lod[8-logh]; - s=32.0f; - t=256.0f; - is=INT_TRICK(5);it=INT_TRICK(8); - ws=32; + if (ar<3) { + t=256>>ar; + it=INT_TRICK(8-ar); + hs=1; + } else { + t=32.0; + it=INT_TRICK(5); + hs=1<<(ar-3); + } + } else { + l=logh; + t=256.0; + it=INT_TRICK(8); hs=1; - break; - default: - return 0; - break; + if (-ar<3) { + s=256>>-ar; + is=INT_TRICK(8+ar); + ws=1; + } else { + s=32.0; + is=INT_TRICK(5); + ws=1<<(-ar-3); + } } - - if(lodlevel) - (*lodlevel)=l; - - if(ar) - (*ar)=aspectratio; - - if(sscale) - (*sscale)=s; - - if(tscale) - (*tscale)=t; - - if(wscale) - (*wscale)=ws; - - if(hscale) - (*hscale)=hs; - - if (i_sscale) - *i_sscale = is; - - if (i_tscale) - *i_tscale = it; - - + if (ar<-3) ar=-3; + if (ar>3) ar=3; + + /* The above numbers are calculated sensibly and work for Glide3, but + we change them to the whacky glide2 values if needed. */ +#ifdef FX_GLIDE3 + if (lodlevel) *lodlevel=l; + if (aspectratio) *aspectratio=ar; +#else + if (lodlevel) *lodlevel=8-l; + if (aspectratio) *aspectratio=3-ar; +#endif + if (sscale) *sscale=s; + if (tscale) *tscale=t; + if (wscale) *wscale=ws; + if (hscale) *hscale=hs; + if (i_sscale) *i_sscale = is; + if (i_tscale) *i_tscale = it; return 1; } @@ -666,752 +568,506 @@ int fxTexGetInfo(int w, int h, GrLOD_t *lodlevel, GrAspectRatio_t *ar, void fxTexGetFormat(GLenum glformat, GrTextureFormat_t *tfmt, GLint *ifmt) { switch(glformat) { - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - if(tfmt) - (*tfmt)=GR_TEXFMT_INTENSITY_8; - if(ifmt) - (*ifmt)=GL_LUMINANCE; - break; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - if(tfmt) - (*tfmt)=GR_TEXFMT_ALPHA_INTENSITY_88; - if(ifmt) - (*ifmt)=GL_LUMINANCE_ALPHA; - break; - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - if(tfmt) - (*tfmt)=GR_TEXFMT_ALPHA_8; - if(ifmt) - (*ifmt)=GL_INTENSITY; - break; - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - if(tfmt) - (*tfmt)=GR_TEXFMT_ALPHA_8; - if(ifmt) - (*ifmt)=GL_ALPHA; - break; - case 3: - case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - if(tfmt) - (*tfmt)=GR_TEXFMT_RGB_565; - if(ifmt) - (*ifmt)=GL_RGB; - break; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - if(tfmt) - (*tfmt)=GR_TEXFMT_ARGB_4444; - if(ifmt) - (*ifmt)=GL_RGBA; - break; - case GL_RGB5_A1: - if(tfmt) - (*tfmt)=GR_TEXFMT_ARGB_1555; - if(ifmt) - (*ifmt)=GL_RGBA; - break; - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - if(tfmt) - (*tfmt)=GR_TEXFMT_P_8; - if(ifmt) - (*ifmt)=GL_RGBA; - break; - default: - fprintf(stderr,"fx Driver: unsupported internalFormat in fxTexGetFormat()\n"); - fxCloseHardware(); - exit(-1); - break; + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + if(tfmt) + (*tfmt)=GR_TEXFMT_INTENSITY_8; + if(ifmt) + (*ifmt)=GL_LUMINANCE; + break; + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + if(tfmt) + (*tfmt)=GR_TEXFMT_ALPHA_INTENSITY_88; + if(ifmt) + (*ifmt)=GL_LUMINANCE_ALPHA; + break; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + if(tfmt) + (*tfmt)=GR_TEXFMT_ALPHA_8; + if(ifmt) + (*ifmt)=GL_INTENSITY; + break; + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + if(tfmt) + (*tfmt)=GR_TEXFMT_ALPHA_8; + if(ifmt) + (*ifmt)=GL_ALPHA; + break; + case 3: + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + if(tfmt) + (*tfmt)=GR_TEXFMT_RGB_565; + if(ifmt) + (*ifmt)=GL_RGB; + break; + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + if(tfmt) + (*tfmt)=GR_TEXFMT_ARGB_8888; + if(ifmt) + (*ifmt)=GL_RGB; + break; + case 4: + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + if(tfmt) + (*tfmt)=GR_TEXFMT_ARGB_4444; + if(ifmt) + (*ifmt)=GL_RGBA; + break; + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + if(tfmt) + (*tfmt)=GR_TEXFMT_ARGB_8888; + if(ifmt) + (*ifmt)=GL_RGBA; + break; + case GL_RGB5_A1: + if(tfmt) + (*tfmt)=GR_TEXFMT_ARGB_1555; + if(ifmt) + (*ifmt)=GL_RGBA; + break; + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + if(tfmt) + (*tfmt)=GR_TEXFMT_P_8; + if(ifmt) + (*ifmt)=GL_RGBA; /* XXX why is this RGBA? */ + break; + default: + fprintf(stderr, + "fx Driver: unsupported internalFormat in fxTexGetFormat()\n"); + fxCloseHardware(); + exit(-1); + break; } } -static int fxIsTexSupported(GLenum target, GLint internalFormat, - const struct gl_texture_image *image) +static GLboolean fxIsTexSupported(GLenum target, GLint internalFormat, + const struct gl_texture_image *image) { - if(target!=GL_TEXTURE_2D) - return GL_FALSE; - - switch(internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - case 3: - case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB5_A1: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - break; - default: - return GL_FALSE; - } - - if(image->Width>256) - return GL_FALSE; - - if(image->Height>256) + if(target != GL_TEXTURE_2D) return GL_FALSE; if(!fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL)) return GL_FALSE; + if (image->Border > 0) + return GL_FALSE; + return GL_TRUE; } -static void fxTexBuildImageMap(const struct gl_texture_image *image, - GLint internalFormat, unsigned short **dest, - GLboolean *istranslate) -{ - unsigned short *src; - unsigned char *data; - int x,y,w,h,wscale,hscale,idx; - - fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL, - &wscale,&hscale); - w=image->Width*wscale; - h=image->Height*hscale; - - data=image->Data; - switch(internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - /* Optimized for GLQuake */ - - if(wscale==hscale==1) { - (*istranslate)=GL_FALSE; - - (*dest)=(unsigned short *)data; - } else { - unsigned char *srcb; - - (*istranslate)=GL_TRUE; - - if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned char)*w*h))) { - fprintf(stderr,"fx Driver: out of memory !\n"); - fxCloseHardware(); - exit(-1); - } - } else - src=(*dest); - - srcb=(unsigned char *)src; - - for(y=0;y<h;y++) - for(x=0;x<w;x++) { - idx=(x/wscale+(y/hscale)*(w/wscale)); - srcb[x+y*w]=data[idx]; - } - } - break; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - (*istranslate)=GL_TRUE; - - if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) { - fprintf(stderr,"fx Driver: out of memory !\n"); - fxCloseHardware(); - exit(-1); - } - } else - src=(*dest); - - if(wscale==hscale==1) { - int i=0; - int lenght=h*w; - unsigned short a,l; - - while(i++<lenght) { - l=*data++; - a=*data++; - - *src++=(a << 8) | l; - } - } else { - unsigned short a,l; - for(y=0;y<h;y++) - for(x=0;x<w;x++) { - idx=(x/wscale+(y/hscale)*(w/wscale))*2; - l=data[idx]; - a=data[idx+1]; - - src[x+y*w]=(a << 8) | l; - } - } - break; - case 3: - case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - (*istranslate)=GL_TRUE; - - if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) { - fprintf(stderr,"fx Driver: out of memory !\n"); - fxCloseHardware(); - exit(-1); - } - } else - src=(*dest); - - if(wscale==hscale==1) { - int i=0; - int lenght=h*w; - unsigned int r,g,b; - - while(i++<lenght) { - r=*data++; - g=*data++; - b=*data++; - - *src++=((0xf8 & r) << (11-3)) | - ((0xfc & g) << (5-3+1)) | - ((0xf8 & b) >> 3); - } - } else { - unsigned int r,g,b; - - for(y=0;y<h;y++) - for(x=0;x<w;x++) { - idx=(x/wscale+(y/hscale)*(w/wscale))*3; - r=data[idx]; - g=data[idx+1]; - b=data[idx+2]; - - src[x+y*w]=((0xf8 & r) << (11-3)) | - ((0xfc & g) << (5-3+1)) | - ((0xf8 & b) >> 3); - } - } - break; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - (*istranslate)=GL_TRUE; - - if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) { - fprintf(stderr,"fx Driver: out of memory !\n"); - fxCloseHardware(); - exit(-1); - } - } else - src=(*dest); - - if(wscale==hscale==1) { - int i=0; - int lenght=h*w; - unsigned int r,g,b,a; - - while(i++<lenght) { - r=*data++; - g=*data++; - b=*data++; - a=*data++; - - *src++=((0xf0 & a) << 8) | - ((0xf0 & r) << 4) | - (0xf0 & g) | - ((0xf0 & b) >> 4); - } - } else { - unsigned int r,g,b,a; - - for(y=0;y<h;y++) - for(x=0;x<w;x++) { - idx=(x/wscale+(y/hscale)*(w/wscale))*4; - r=data[idx]; - g=data[idx+1]; - b=data[idx+2]; - a=data[idx+3]; - - src[x+y*w]=((0xf0 & a) << 8) | - ((0xf0 & r) << 4) | - (0xf0 & g) | - ((0xf0 & b) >> 4); - } - } - break; - case GL_RGB5_A1: - (*istranslate)=GL_TRUE; - - if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) { - fprintf(stderr,"fx Driver: out of memory !\n"); - fxCloseHardware(); - exit(-1); - } - } else - src=(*dest); - - if(wscale==hscale==1) { - int i=0; - int lenght=h*w; - unsigned r,g,b,a; - - while(i++<lenght) { - r=*data++; - g=*data++; - b=*data++; - a=*data++; - *src++=((0x80 & a) << 8) | - ((0xf8 & r) << 7) | - ((0xf8 & g) << 2) | - ((0xf8 & b) >> 3); - } - } else { - unsigned r,g,b,a; - - for(y=0;y<h;y++) - for(x=0;x<w;x++) { - idx=(x/wscale+(y/hscale)*(w/wscale))*4; - r=data[idx]; - g=data[idx+1]; - b=data[idx+2]; - a=data[idx+3]; - - src[x+y*w]=((0x80 & a) << 8) | - ((0xf8 & r) << 7) | - ((0xf8 & g) << 2) | - ((0xf8 & b) >> 3); - } - } - break; - default: - fprintf(stderr,"fx Driver: wrong internalFormat in texbuildimagemap()\n"); - fxCloseHardware(); - exit(-1); - break; - } -} +/**********************************************************************/ +/**** NEW TEXTURE IMAGE FUNCTIONS ****/ +/**********************************************************************/ -void fxDDTexImg(GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, GLint level, GLint internalFormat, - const struct gl_texture_image *image) +GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxTexInfo *ti; + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr, - "fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n", - tObj->Name, level, target, internalFormat, image->Width, - image->Height); - } - - if(target!=GL_TEXTURE_2D) - return; + if (target != GL_TEXTURE_2D) + return GL_FALSE; - if (!tObj->DriverData) - tObj->DriverData=fxAllocTexObjData(fxMesa); + if (!texObj->DriverData) + texObj->DriverData = fxAllocTexObjData(fxMesa); - ti=fxTMGetTexInfo(tObj); - - if(fxIsTexSupported(target,internalFormat,image)) { + if (fxIsTexSupported(target, texImage->IntFormat, texImage)) { GrTextureFormat_t gldformat; - tfxMipMapLevel *mml=&ti->mipmapLevel[level]; + tfxTexInfo *ti = fxTMGetTexInfo(texObj); + tfxMipMapLevel *mml = &ti->mipmapLevel[level]; + GLint dstWidth, dstHeight, wScale, hScale, texelSize, dstStride; + MesaIntTexFormat intFormat; + + fxTexGetFormat(texImage->IntFormat, &gldformat, NULL); - fxTexGetFormat(internalFormat,&gldformat,NULL); + fxTexGetInfo(texImage->Width, texImage->Height, NULL,NULL,NULL,NULL, + NULL,NULL, &wScale, &hScale); - if(mml->used) { - if((mml->glideFormat==gldformat) && - (mml->width==image->Width) && - (mml->height==image->Height)) { - fxTexBuildImageMap(image,internalFormat,&(mml->data), - &(mml->translated)); - - if(ti->validated && ti->isInTM) - fxTMReloadMipMapLevel(fxMesa,tObj,level); - else - fxTexInvalidate(ctx,tObj); - - return; - } else { - if(mml->translated) - FREE(mml->data); - mml->data=NULL; - } + dstWidth = texImage->Width * wScale; + dstHeight = texImage->Height * hScale; + + switch (texImage->IntFormat) { + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + texelSize = 1; + intFormat = MESA_I8; + break; + case 1: + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + texelSize = 1; + intFormat = MESA_L8; + break; + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + texelSize = 1; + intFormat = MESA_A8; + break; + case GL_COLOR_INDEX: + case GL_COLOR_INDEX1_EXT: + case GL_COLOR_INDEX2_EXT: + case GL_COLOR_INDEX4_EXT: + case GL_COLOR_INDEX8_EXT: + case GL_COLOR_INDEX12_EXT: + case GL_COLOR_INDEX16_EXT: + texelSize = 1; + intFormat = MESA_C8; + break; + case 2: + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + texelSize = 2; + intFormat = MESA_A8_L8; + break; + case 3: + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + texelSize = 2; + intFormat = MESA_R5_G6_B5; + break; + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + texelSize = 4; + intFormat = MESA_A8_R8_G8_B8; + break; + case 4: + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + texelSize = 2; + intFormat = MESA_A4_R4_G4_B4; + break; + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + texelSize = 4; + intFormat = MESA_A8_R8_G8_B8; + break; + case GL_RGB5_A1: + texelSize = 2; + intFormat = MESA_A1_R5_G5_B5; + break; + default: + gl_problem(NULL, "tdfx driver: texbuildimagemap() bad format"); + return GL_FALSE; } - mml->glideFormat=gldformat; - mml->width=image->Width; - mml->height=image->Height; - mml->used=GL_TRUE; - - fxTexBuildImageMap(image,internalFormat,&(mml->data), - &(mml->translated)); + _mesa_set_teximage_component_sizes(intFormat, texImage); + + /*printf("teximage:\n");*/ + /* allocate new storage for texture image, if needed */ + if (!mml->data || mml->glideFormat != gldformat || + mml->width != dstWidth || mml->height != dstHeight) { + if (mml->data) + FREE(mml->data); + mml->data = MALLOC(dstWidth * dstHeight * texelSize); + if (!mml->data) + return GL_FALSE; + mml->texelSize = texelSize; + mml->glideFormat = gldformat; + mml->width = dstWidth; + mml->height = dstHeight; + fxTexInvalidate(ctx, texObj); + } - fxTexInvalidate(ctx,tObj); - } -#ifndef FX_SILENT - else - fprintf(stderr,"fx Driver: unsupported texture in fxDDTexImg()\n"); -#endif -} + dstStride = dstWidth * texelSize; -static void fxTexBuildSubImageMap(const struct gl_texture_image *image, - GLint internalFormat, - GLint xoffset, GLint yoffset, GLint width, GLint height, - unsigned short *destimg) -{ - fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL, - NULL,NULL); - - switch(internalFormat) { - case GL_INTENSITY: - case GL_INTENSITY4: - case GL_INTENSITY8: - case GL_INTENSITY12: - case GL_INTENSITY16: - case 1: - case GL_LUMINANCE: - case GL_LUMINANCE4: - case GL_LUMINANCE8: - case GL_LUMINANCE12: - case GL_LUMINANCE16: - case GL_ALPHA: - case GL_ALPHA4: - case GL_ALPHA8: - case GL_ALPHA12: - case GL_ALPHA16: - case GL_COLOR_INDEX: - case GL_COLOR_INDEX1_EXT: - case GL_COLOR_INDEX2_EXT: - case GL_COLOR_INDEX4_EXT: - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX12_EXT: - case GL_COLOR_INDEX16_EXT: - { - - int y; - unsigned char *bsrc,*bdst; - - bsrc=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)); - bdst=((unsigned char *)destimg)+(yoffset*image->Width+xoffset); - - for(y=0;y<height;y++) { - MEMCPY(bdst,bsrc,width); - bsrc += image->Width; - bdst += image->Width; - } - } - break; - case 2: - case GL_LUMINANCE_ALPHA: - case GL_LUMINANCE4_ALPHA4: - case GL_LUMINANCE6_ALPHA2: - case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: - { - int x,y; - unsigned char *src; - unsigned short *dst,a,l; - int simgw,dimgw; - - src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*2); - dst=destimg+(yoffset*image->Width+xoffset); - - simgw=(image->Width-width)*2; - dimgw=image->Width-width; - for(y=0;y<height;y++) { - for(x=0;x<width;x++) { - l=*src++; - a=*src++; - *dst++=(a << 8) | l; - } - - src += simgw; - dst += dimgw; - } + /* store the texture image */ + if (!_mesa_convert_teximage(intFormat, dstWidth, dstHeight, mml->data, + dstStride, + texImage->Width, texImage->Height, + format, type, pixels, packing)) { + return GL_FALSE; } - break; - case 3: - case GL_RGB: - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - { - int x,y; - unsigned char *src; - unsigned short *dst,r,g,b; - int simgw,dimgw; - - src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*3); - dst=destimg+(yoffset*image->Width+xoffset); - simgw=(image->Width-width)*3; - dimgw=image->Width-width; - for(y=0;y<height;y++) { - for(x=0;x<width;x++) { - r=*src++; - g=*src++; - b=*src++; - *dst++=((0xf8 & r) << (11-3)) | - ((0xfc & g) << (5-3+1)) | - ((0xf8 & b) >> 3); - } - - src += simgw; - dst += dimgw; - } + if (ti->validated && ti->isInTM) { + /*printf("reloadmipmaplevels\n");*/ + fxTMReloadMipMapLevel(fxMesa, texObj, level); } - break; - case 4: - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - { - int x,y; - unsigned char *src; - unsigned short *dst,r,g,b,a; - int simgw,dimgw; - - src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*4); - dst=destimg+(yoffset*image->Width+xoffset); - - simgw=(image->Width-width)*4; - dimgw=image->Width-width; - for(y=0;y<height;y++) { - for(x=0;x<width;x++) { - r=*src++; - g=*src++; - b=*src++; - a=*src++; - *dst++=((0xf0 & a) << 8) | - ((0xf0 & r) << 4) | - (0xf0 & g) | - ((0xf0 & b) >> 4); - } - - src += simgw; - dst += dimgw; - } + else { + /*printf("invalidate2\n");*/ + fxTexInvalidate(ctx,texObj); } - break; - case GL_RGB5_A1: - { - int x,y; - unsigned char *src; - unsigned short *dst,r,g,b,a; - int simgw,dimgw; - - src=(unsigned char *)(image->Data+(yoffset*image->Width+xoffset)*4); - dst=destimg+(yoffset*image->Width+xoffset); - - simgw=(image->Width-width)*4; - dimgw=image->Width-width; - for(y=0;y<height;y++) { - for(x=0;x<width;x++) { - r=*src++; - g=*src++; - b=*src++; - a=*src++; - *dst++= - ((0x80 & a) << 8) | - ((0xf8 & r) << 7) | - ((0xf8 & g) << 2) | - ((0xf8 & b) >> 3); - } - - src += simgw; - dst += dimgw; - } - } - break; - default: - fprintf(stderr,"fx Driver: wrong internalFormat in fxTexBuildSubImageMap()\n"); - fxCloseHardware(); - exit(-1); - break; + + *retainInternalCopy = GL_FALSE; + return GL_TRUE; + } + else { + gl_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n"); + return GL_FALSE; } } - -void fxDDTexSubImg(GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, GLint level, - GLint xoffset, GLint yoffset, GLint width, GLint height, - GLint internalFormat, const struct gl_texture_image *image) + +GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; tfxTexInfo *ti; - GrTextureFormat_t gldformat; - int wscale,hscale; + GLint wscale, hscale, dstStride; tfxMipMapLevel *mml; + GLboolean result; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr, - "fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n", - tObj->Name, level, target, internalFormat, image->Width, - image->Height); - } + if (target != GL_TEXTURE_2D) + return GL_FALSE; - if(target!=GL_TEXTURE_2D) - return; + if (!texObj->DriverData) + return GL_FALSE; - if (!tObj->DriverData) - return; + ti = fxTMGetTexInfo(texObj); + mml = &ti->mipmapLevel[level]; - ti=fxTMGetTexInfo(tObj); - mml=&ti->mipmapLevel[level]; + fxTexGetInfo( texImage->Width, texImage->Height, NULL,NULL,NULL,NULL, + NULL,NULL, &wscale, &hscale); - fxTexGetFormat(internalFormat,&gldformat,NULL); + assert(mml->data); /* must have an existing texture image! */ - if(mml->glideFormat!=gldformat) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: ti->info.format!=format in fxDDTexSubImg()\n"); - } - fxDDTexImg(ctx,target,tObj,level,internalFormat,image); + switch (mml->glideFormat) { + case GR_TEXFMT_INTENSITY_8: + dstStride = mml->width; + result = _mesa_convert_texsubimage(MESA_I8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ALPHA_8: + dstStride = mml->width; + result = _mesa_convert_texsubimage(MESA_A8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_P_8: + dstStride = mml->width; + result = _mesa_convert_texsubimage(MESA_C8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ALPHA_INTENSITY_88: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_A8_L8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_RGB_565: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_R5_G6_B5, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ARGB_4444: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_A4_R4_G4_B4, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ARGB_8888: + dstStride = mml->width * 4; + result = _mesa_convert_texsubimage(MESA_A8_R8_G8_B8, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + case GR_TEXFMT_ARGB_1555: + dstStride = mml->width * 2; + result = _mesa_convert_texsubimage(MESA_A1_R5_G5_B5, xoffset, yoffset, + mml->width, mml->height, mml->data, + dstStride, width, height, + texImage->Width, texImage->Height, + format, type, pixels, packing); + break; + default: + gl_problem(NULL, "tdfx driver: fxTexBuildSubImageMap() bad format"); + result = GL_FALSE; + } - return; + if (!result) { + return GL_FALSE; } - fxTexGetInfo(image->Width,image->Height,NULL,NULL,NULL,NULL,NULL,NULL,&wscale,&hscale); + if (ti->validated && ti->isInTM) + fxTMReloadSubMipMapLevel(fxMesa, texObj, level, yoffset, height); + else + fxTexInvalidate(ctx, texObj); - if((wscale!=1) || (hscale!=1)) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: (wscale!=1) || (hscale!=1) in fxDDTexSubImg()\n"); - } - fxDDTexImg(ctx,target,tObj,level,internalFormat,image); + return GL_TRUE; +} - return; + +static void PrintTexture(int w, int h, int c, const GLubyte *data) +{ + int i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + if (c==2) + printf("%02x %02x ", data[0], data[1]); + else if (c==3) + printf("%02x %02x %02x ", data[0], data[1], data[2]); + data += c; + } + printf("\n"); } +} - if(mml->translated) - fxTexBuildSubImageMap(image,internalFormat,xoffset,yoffset, - width,height,mml->data); - if(ti->validated && ti->isInTM) - fxTMReloadSubMipMapLevel(fxMesa,tObj,level,yoffset,height); - else - fxTexInvalidate(ctx,tObj); +GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum *formatOut, GLenum *typeOut, + GLboolean *freeImageOut ) +{ + tfxTexInfo *ti; + tfxMipMapLevel *mml; + + if (target != GL_TEXTURE_2D) + return NULL; + + if (!texObj->DriverData) + return NULL; + + ti = fxTMGetTexInfo(texObj); + mml = &ti->mipmapLevel[level]; + if (mml->data) { + MesaIntTexFormat mesaFormat; + GLenum glFormat; + struct gl_texture_image *texImage = texObj->Image[level]; + GLint srcStride; + + GLubyte *data = (GLubyte *) MALLOC(texImage->Width * texImage->Height * 4); + if (!data) + return NULL; + + switch (mml->glideFormat) { + case GR_TEXFMT_INTENSITY_8: + mesaFormat = MESA_I8; + glFormat = GL_INTENSITY; + srcStride = mml->width; + break; + case GR_TEXFMT_ALPHA_INTENSITY_88: + mesaFormat = MESA_A8_L8; + glFormat = GL_LUMINANCE_ALPHA; + srcStride = mml->width; + break; + case GR_TEXFMT_ALPHA_8: + mesaFormat = MESA_A8; + glFormat = GL_ALPHA; + srcStride = mml->width; + break; + case GR_TEXFMT_RGB_565: + mesaFormat = MESA_R5_G6_B5; + glFormat = GL_RGB; + srcStride = mml->width * 2; + break; + case GR_TEXFMT_ARGB_8888: + mesaFormat = MESA_A8_R8_G8_B8; + glFormat = GL_RGBA; + srcStride = mml->width * 4; + break; + case GR_TEXFMT_ARGB_4444: + mesaFormat = MESA_A4_R4_G4_B4; + glFormat = GL_RGBA; + srcStride = mml->width * 2; + break; + case GR_TEXFMT_ARGB_1555: + mesaFormat = MESA_A1_R5_G5_B5; + glFormat = GL_RGBA; + srcStride = mml->width * 2; + break; + case GR_TEXFMT_P_8: + mesaFormat = MESA_C8; + glFormat = GL_COLOR_INDEX; + srcStride = mml->width; + break; + default: + gl_problem(NULL, "Bad glideFormat in fxDDGetTexImage"); + return NULL; + } + _mesa_unconvert_teximage(mesaFormat, mml->width, mml->height, mml->data, + srcStride, texImage->Width, texImage->Height, + glFormat, data); + *formatOut = glFormat; + *typeOut = GL_UNSIGNED_BYTE; + *freeImageOut = GL_TRUE; + return data; + } + else { + return NULL; + } } diff --git a/xc/extras/Mesa/src/FX/fxdrv.h b/xc/extras/Mesa/src/FX/fxdrv.h index e12a3244f..eea75fc56 100644 --- a/xc/extras/Mesa/src/FX/fxdrv.h +++ b/xc/extras/Mesa/src/FX/fxdrv.h @@ -50,14 +50,10 @@ * you turn debugging on/off from the debugger. */ -#ifndef XFree86Server -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include <assert.h> -#else +#ifdef XFree86Server #include "GL/xf86glx.h" +#else +#include "glheader.h" #endif @@ -87,8 +83,8 @@ typedef struct tfxMesaContext *fxMesaContext; -#if defined(MESA_DEBUG) && 0 extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * ); +#if defined(MESA_DEBUG) && 0 #define grDrawTriangle fx_sanity_triangle #endif @@ -166,6 +162,7 @@ typedef struct { #endif #endif + #define FX_VB_COLOR(fxm, color) \ do { \ if (sizeof(GLint) == 4*sizeof(GLubyte)) { \ @@ -187,9 +184,9 @@ typedef struct { } #if FX_USE_PARGB -#define GOURAUD2(v, c) { \ - GLubyte *col = c; \ - v->argb=MESACOLOR2PARGB(col); \ +#define GOURAUD2(v, c) { \ + GLubyte *col = c; \ + v->argb=MESACOLOR2PARGB(col); \ } #else #define GOURAUD2(v, c) { \ @@ -230,13 +227,13 @@ typedef struct { #define FX_UM_E0_MODULATE 0x00000002 #define FX_UM_E0_DECAL 0x00000004 #define FX_UM_E0_BLEND 0x00000008 -#define FX_UM_E0_ADD 0x00000010 +#define FX_UM_E0_ADD 0x00000010 #define FX_UM_E1_REPLACE 0x00000020 #define FX_UM_E1_MODULATE 0x00000040 #define FX_UM_E1_DECAL 0x00000080 #define FX_UM_E1_BLEND 0x00000100 -#define FX_UM_E1_ADD 0x00000200 +#define FX_UM_E1_ADD 0x00000200 #define FX_UM_E_ENVMODE 0x000003ff @@ -261,6 +258,20 @@ typedef struct { #define FX_UM_ALPHA_ITERATED 0x04000000 #define FX_UM_ALPHA_CONSTANT 0x08000000 + +#define PACK_BGRA32(R, G, B, A) \ + ( (((GLuint) (R)) << 16) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) ) | \ + (((GLuint) (A)) << 24) ) + +#define PACK_RGBA32(R, G, B, A) \ + ( (((GLuint) (R)) ) | \ + (((GLuint) (G)) << 8) | \ + (((GLuint) (B)) << 16) | \ + (((GLuint) (A)) << 24) ) + + typedef void (*tfxRenderVBFunc)(GLcontext *); /* @@ -272,11 +283,10 @@ typedef struct MemRange_t { } MemRange; typedef struct { - GLsizei width, height; - GLint glideFormat; - - unsigned short *data; - GLboolean translated, used; + GLsizei width, height; /* image size */ + GLint texelSize; /* How many bytes to a texel */ + GrTextureFormat_t glideFormat; /* Glide image format */ + unsigned short *data; /* Glide-formated texture image */ } tfxMipMapLevel; typedef struct tfxTexInfo_t { @@ -345,27 +355,20 @@ extern tfxLineClipFunc fxLineClipTab[0x8]; typedef struct { /* Alpha test */ - GLboolean alphaTestEnabled; GrCmpFnc_t alphaTestFunc; GrAlpha_t alphaTestRefValue; /* Blend function */ - GLboolean blendEnabled; GrAlphaBlendFnc_t blendSrcFuncRGB; GrAlphaBlendFnc_t blendDstFuncRGB; GrAlphaBlendFnc_t blendSrcFuncAlpha; GrAlphaBlendFnc_t blendDstFuncAlpha; - - /* Depth test */ - - GLboolean depthTestEnabled; - GLboolean depthMask; - GrCmpFnc_t depthTestFunc; } tfxUnitsState; + /* Flags for render_index. */ #define FX_OFFSET 0x1 @@ -386,6 +389,7 @@ typedef struct { #define FX_NEW_SCISSOR 0x20 #define FX_NEW_COLOR_MASK 0x40 #define FX_NEW_CULL 0x80 +#define FX_NEW_STENCIL 0x100 /* FX struct stored in VB->driver_data. */ @@ -427,8 +431,6 @@ extern GLubyte FX_PixelToB[0x10000]; struct tfxMesaContext { - GuTexPalette glbPalette; - GLcontext *glCtx; /* the core Mesa context */ GLvisual *glVis; /* describes the color buffer */ GLframebuffer *glBuffer; /* the ancillary buffers */ @@ -439,6 +441,7 @@ struct tfxMesaContext { GrBuffer_t currentFB; GLboolean bgrOrder; + GLuint depthClear; GrColor_t color; GrColor_t clearC; GrAlpha_t clearA; @@ -448,6 +451,8 @@ struct tfxMesaContext { tfxUnitsState unitsState; tfxUnitsState restoreUnitsState; /* saved during multipass */ + GuTexPalette glbPalette; + GLuint tmu_source[FX_NUM_TMU]; GLuint tex_dest[MAX_TEXTURE_UNITS]; GLuint setupindex; @@ -471,7 +476,6 @@ struct tfxMesaContext { GLuint texBindNumber; GLint tmuSrc; - GLuint lastUnitsMode; GLuint freeTexMem[FX_NUM_TMU]; MemRange *tmPool; MemRange *tmFree[FX_NUM_TMU]; @@ -506,8 +510,7 @@ struct tfxMesaContext { GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */ GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */ GLboolean haveAlphaBuffer; - GLboolean haveZBuffer; - GLboolean haveDoubleBuffer; + GLboolean haveHwStencil; GLboolean haveGlobalPaletteTexture; GLint swapInterval; GLint maxPendingSwapBuffers; @@ -534,6 +537,7 @@ typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint); extern GrHwConfiguration glbHWConfig; extern int glbCurrentBoard; +extern void fxPrintSetupFlags( const char *msg, GLuint flags ); extern void fxSetupFXUnits(GLcontext *); extern void fxSetupDDPointers(GLcontext *); extern void fxDDSetNearFar(GLcontext *, GLfloat, GLfloat); @@ -567,24 +571,34 @@ extern void fxUpdateDDSpanPointers(GLcontext *); extern void fxSetupDDSpanPointers(GLcontext *); extern void fxPrintTextureData(tfxTexInfo *ti); -extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *); -extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *, - GLint, GLint, const struct gl_texture_image *); +extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); +extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage); +extern GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum *formatOut, GLenum *typeOut, + GLboolean *freeImageOut ); +extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *); extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *, GLenum, const GLfloat *); extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *); extern void fxDDTexDel(GLcontext *, struct gl_texture_object *); extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *); -extern void fxDDTexuseGlbPalette(GLcontext *, GLboolean); -extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *, GLint, - GLint, GLint, GLint, GLint, GLint, const struct gl_texture_image *); extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean); extern void fxDDEnable(GLcontext *, GLenum, GLboolean); extern void fxDDAlphaFunc(GLcontext *, GLenum, GLclampf); extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum); -extern void fxDDDepthMask(GLcontext *, GLboolean); -extern void fxDDDepthFunc(GLcontext *, GLenum); extern void fxDDRegisterVB( struct vertex_buffer *VB ); extern void fxDDUnregisterVB( struct vertex_buffer *VB ); @@ -619,6 +633,7 @@ extern void fxDDInitExtensions( GLcontext *ctx ); #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData)) extern void fxTMInit(fxMesaContext ctx); extern void fxTMClose(fxMesaContext ctx); +extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx); extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint); extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *); #define fxTMMoveOutTM_NoLock fxTMMoveOutTM diff --git a/xc/extras/Mesa/src/FX/fxglidew.c b/xc/extras/Mesa/src/FX/fxglidew.c index 790e5c923..f01644a60 100644 --- a/xc/extras/Mesa/src/FX/fxglidew.c +++ b/xc/extras/Mesa/src/FX/fxglidew.c @@ -55,6 +55,13 @@ #include <stdlib.h> #include <string.h> + +grStencilFunc_t grStencilFuncPtr = NULL; +grStencilMask_t grStencilMaskPtr = NULL; +grStencilOp_t grStencilOpPtr = NULL; +grBufferClearExt_t grBufferClearExtPtr = NULL; + + FxI32 FX_grGetInteger_NoLock(FxU32 pname) { #if !defined(FX_GLIDE3) @@ -71,6 +78,8 @@ FxI32 FX_grGetInteger_NoLock(FxU32 pname) case FX_TEXTURE_ALIGN: /* This is a guess from reading the glide3 docs */ return 8; + case FX_ZDEPTH_MAX: + return 0xFFFF; default: if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n"); @@ -90,6 +99,12 @@ FxI32 FX_grGetInteger_NoLock(FxU32 pname) case FX_TEXTURE_ALIGN: grname = pname; break; + case FX_ZDEPTH_MAX: { + int zvals[2]; + + grGet(GR_ZDEPTH_MIN_MAX, 8, zvals); + return zvals[0]; + } default: if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n"); @@ -154,7 +169,17 @@ extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) { FxBool FX_grSstControl(FxU32 code) { #if defined(FX_GLIDE3) - (void) code; + /* The glide 3 sources call for grEnable/grDisable to be called in exchange + * for grSstControl. */ + switch(code) { + case GR_CONTROL_ACTIVATE: + grEnable(GR_PASSTHRU); + break; + case GR_CONTROL_DEACTIVATE: + grDisable(GR_PASSTHRU); + break; + } + /* Appearently GR_CONTROL_RESIZE can be ignored. */ return 1; /* OK? */ #else FxU32 result; @@ -225,12 +250,12 @@ void FX_grGlideGetVersion(char *buf) void FX_grSstPerfStats(GrSstPerfStats_t *st) { - /* ToDo */ - st->pixelsIn = 0; - st->chromaFail = 0; - st->zFuncFail = 0; - st->aFuncFail = 0; - st->pixelsOut = 0; + FxI32 n; + grGet(GR_STATS_PIXELS_IN, 4, &n); st->pixelsIn = n; + grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); st->chromaFail = n; + grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); st->zFuncFail = n; + grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); st->aFuncFail = n; + grGet(GR_STATS_PIXELS_OUT, 4, &n); st->pixelsOut = n; } void FX_grAADrawLine(GrVertex *a,GrVertex *b) @@ -385,6 +410,10 @@ int FX_grSstQueryHardware(GrHwConfiguration *c) return i; } + +#endif /* FX_GLIDE3 */ + +/* It appears to me that this function is needed either way. */ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, @@ -403,6 +432,7 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, nColBuffers, nAuxBuffers ); + /* fprintf(stderr, "grSstWinOpen( win %d res %d ref %d fmt %d\n" " org %d ncol %d naux %d )\n" @@ -415,13 +445,13 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, nColBuffers, nAuxBuffers, i); + */ END_BOARD_LOCK(); return i; } -#endif #else /* diff --git a/xc/extras/Mesa/src/FX/fxglidew.h b/xc/extras/Mesa/src/FX/fxglidew.h index 28556d8c5..4ad2942af 100644 --- a/xc/extras/Mesa/src/FX/fxglidew.h +++ b/xc/extras/Mesa/src/FX/fxglidew.h @@ -47,7 +47,51 @@ #define __FX_GLIDE_WARPER__ #include <glide.h> +#include <g3ext.h> +/* + * These are glide extension definitions. These are not + * defined in glide.h. They should really be defined in + * g3ext.h, but they are not. + */ +#if 0 +FX_ENTRY void FX_CALL +grStencilFunc(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); + +FX_ENTRY void FX_CALL +grStencilMask(GrStencil_t write_mask); + +FX_ENTRY void FX_CALL +grStencilOp( + GrStencilOp_t stencil_fail, + GrStencilOp_t depth_fail, + GrStencilOp_t depth_pass); + +FX_ENTRY void FX_CALL +grBufferClearExt( + GrColor_t color, + GrAlpha_t alpha, + FxU32 depth, + GrStencil_t stencil); +#endif + + +typedef void (*grStencilFunc_t)(GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask); +typedef void (*grStencilMask_t)(GrStencil_t write_mask); +typedef void (*grStencilOp_t)(GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass); +typedef void (*grBufferClearExt_t)(GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil); + +extern grStencilFunc_t grStencilFuncPtr; +extern grStencilMask_t grStencilMaskPtr; +extern grStencilOp_t grStencilOpPtr; +extern grBufferClearExt_t grBufferClearExtPtr; + + +FX_ENTRY void FX_CALL +grEnable(GrEnableMode_t mode); + +FX_ENTRY void FX_CALL +grEnable(GrEnableMode_t mode); /* * General context: */ @@ -74,12 +118,13 @@ #define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS #define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN #endif +#define FX_ZDEPTH_MAX 0x100 /* * Genral warper functions for Glide2/Glide3: */ -extern FxI32 FX_grGetInteger(FxU32 pname); extern FxI32 FX_grGetInteger_NoLock(FxU32 pname); +extern FxI32 FX_grGetInteger(FxU32 pname); /* * Glide2 emulation on Glide3: @@ -253,7 +298,6 @@ typedef struct #endif - /* * Glide2 functions for Glide3 */ @@ -567,6 +611,55 @@ extern void FX_grDrawPolygonVertexList(int n, GrVertex *v); END_CLIP_LOOP(); \ } while (0) +#define FX_grBufferClearExt(c, a, d, s) \ + do { \ + BEGIN_CLIP_LOOP(); \ + (*grBufferClearExtPtr)(c, a, d, s); \ + END_CLIP_LOOP(); \ + } while (0) + +/* + * Enable/Disable + */ +#define FX_grEnable(m) \ + do { \ + BEGIN_BOARD_LOCK(); \ + grEnable(m); \ + END_BOARD_LOCK(); \ + } while (0) + +#define FX_grDisable(m) \ + do { \ + BEGIN_BOARD_LOCK(); \ + grDisable(m); \ + END_BOARD_LOCK(); \ + } while (0) + +/* + * Stencil operations. + */ +#define FX_grStencilFunc(fnc, ref, mask) \ + do { \ + BEGIN_BOARD_LOCK(); \ + (*grStencilFuncPtr)((fnc), (ref), (mask)); \ + END_BOARD_LOCK(); \ + } while (0) + +#define FX_grStencilMask(write_mask) \ + do { \ + BEGIN_BOARD_LOCK(); \ + (*grStencilMaskPtr)(write_mask); \ + END_BOARD_LOCK(); \ + } while (0) + + +#define FX_grStencilOp(stencil_fail, depth_fail, depth_pass) \ + do { \ + BEGIN_BOARD_LOCK(); \ + (*grStencilOpPtr)((stencil_fail), (depth_fail), (depth_pass)); \ + END_BOARD_LOCK(); \ + } while (0) + #define FX_grDepthMask(m) \ do { \ BEGIN_BOARD_LOCK(); \ @@ -821,9 +914,18 @@ extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info); #define FX_grGlideShutdown() \ do { \ - BEGIN_CLIP_LOOP(); \ + BEGIN_BOARD_LOCK(); \ grGlideShutdown(); \ - END_CLIP_LOOP(); \ + END_BOARD_LOCK(); \ + } while (0) + +#define FX_grTexLodBiasValue_NoLock(t, v) grTexLodBiasValue(t, v) + +#define FX_grTexLodBiasValue(t, v) \ + do { \ + BEGIN_BOARD_LOCK(); \ + grTexLodBiasValue(t, v); \ + END_BOARD_LOCK(); \ } while (0) #define FX_grGlideInit_NoLock grGlideInit diff --git a/xc/extras/Mesa/src/FX/fxsetup.c b/xc/extras/Mesa/src/FX/fxsetup.c index 8707aed1d..f07a2ecec 100644 --- a/xc/extras/Mesa/src/FX/fxsetup.c +++ b/xc/extras/Mesa/src/FX/fxsetup.c @@ -62,16 +62,11 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset); static void fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj0, struct gl_texture_object *tObj1); -static void fxSetupTexture_NoLock(GLcontext *ctx); -static void fxSetupTexture(GLcontext *ctx); -static void fxSetupBlend(GLcontext *ctx); -static void fxSetupDepthTest(GLcontext *ctx); -static void fxSetupScissor(GLcontext *ctx); -static void fxSetupCull(GLcontext *ctx); static void gl_print_fx_state_flags( const char *msg, GLuint flags); -static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint); static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint ); + + static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj) { tfxTexInfo *ti=fxTMGetTexInfo(tObj); @@ -183,7 +178,7 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx, GLuint envmode=0; GLuint ifmt=0; - if((ctx->Light.ShadeModel==GL_SMOOTH) || + if((ctx->Light.ShadeModel==GL_SMOOTH) || 1 || (ctx->Point.SmoothFlag) || (ctx->Line.SmoothFlag) || (ctx->Polygon.SmoothFlag)) @@ -191,11 +186,13 @@ static GLuint fxGetTexSetConfiguration(GLcontext *ctx, else unitsmode|=FX_UM_ALPHA_CONSTANT; - if(ctx->Light.ShadeModel==GL_SMOOTH) + if(ctx->Light.ShadeModel==GL_SMOOTH || 1) unitsmode|=FX_UM_COLOR_ITERATED; else unitsmode|=FX_UM_COLOR_CONSTANT; + + /* OpenGL Feeds Texture 0 into Texture 1 Glide Feeds Texture 1 into Texture 0 @@ -476,11 +473,6 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) else unitsmode=fxGetTexSetConfiguration(ctx,NULL,tObj); - if(fxMesa->lastUnitsMode==unitsmode) - return; - - fxMesa->lastUnitsMode=unitsmode; - fxMesa->stw_hint_state = 0; FX_grHints_NoLock(GR_HINT_STWHINT,0); @@ -555,9 +547,8 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) FXTRUE); ctx->Driver.MultipassFunc = fxMultipassBlend; #else -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: GL_BLEND not yet supported\n"); -#endif + if (MESA_VERBOSE&VERBOSE_DRIVER) + fprintf(stderr,"fx Driver: GL_BLEND not yet supported\n"); #endif break; case GL_REPLACE: @@ -588,9 +579,9 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) FXFALSE); break; default: -#ifndef FX_SILENT - fprintf(stderr,"fx Driver: %x Texture.EnvMode not yet supported\n",ctx->Texture.Unit[textureset].EnvMode); -#endif + if (MESA_VERBOSE&VERBOSE_DRIVER) + fprintf(stderr, "fx Driver: %x Texture.EnvMode not yet supported\n", + ctx->Texture.Unit[textureset].EnvMode); break; } @@ -599,7 +590,8 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset) } } -static void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset) { +static void fxSetupTextureSingleTMU(GLcontext *ctx, GLuint textureset) +{ BEGIN_BOARD_LOCK(); fxSetupTextureSingleTMU_NoLock(ctx, textureset); END_BOARD_LOCK(); @@ -764,11 +756,6 @@ static void fxSetupTextureDoubleTMU_NoLock(GLcontext *ctx) unitsmode=fxGetTexSetConfiguration(ctx,tObj0,tObj1); - if(fxMesa->lastUnitsMode==unitsmode) - return; - - fxMesa->lastUnitsMode=unitsmode; - fxMesa->stw_hint_state |= GR_STWHINT_ST_DIFF_TMU1; FX_grHints_NoLock(GR_HINT_STWHINT, fxMesa->stw_hint_state); @@ -1030,7 +1017,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx) fprintf(stderr,"fxmesa: fxSetupTextureNone(...)\n"); } - if((ctx->Light.ShadeModel==GL_SMOOTH) || + if((ctx->Light.ShadeModel==GL_SMOOTH) || 1 || (ctx->Point.SmoothFlag) || (ctx->Line.SmoothFlag) || (ctx->Polygon.SmoothFlag)) @@ -1038,7 +1025,7 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx) else locala=GR_COMBINE_LOCAL_CONSTANT; - if(ctx->Light.ShadeModel==GL_SMOOTH) + if(ctx->Light.ShadeModel==GL_SMOOTH || 1) localc=GR_COMBINE_LOCAL_ITERATED; else localc=GR_COMBINE_LOCAL_CONSTANT; @@ -1054,8 +1041,6 @@ static void fxSetupTextureNone_NoLock(GLcontext *ctx) localc, GR_COMBINE_OTHER_NONE, FXFALSE); - - fxMesa->lastUnitsMode=FX_UM_NONE; } /************************************************************************/ @@ -1106,7 +1091,8 @@ static void fxSetupTexture_NoLock(GLcontext *ctx) } } -static void fxSetupTexture(GLcontext *ctx) { +static void fxSetupTexture(GLcontext *ctx) +{ BEGIN_BOARD_LOCK(); fxSetupTexture_NoLock(ctx); END_BOARD_LOCK(); @@ -1239,15 +1225,19 @@ void fxDDBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor) static void fxSetupBlend(GLcontext *ctx) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxUnitsState *us=&fxMesa->unitsState; + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxUnitsState *us = &fxMesa->unitsState; - if(us->blendEnabled) - FX_grAlphaBlendFunction(us->blendSrcFuncRGB,us->blendDstFuncRGB, - us->blendSrcFuncAlpha,us->blendDstFuncAlpha); + assert(us->blendEnabled == ctx->Color.BlendEnabled); + + if (us->blendEnabled) + FX_grAlphaBlendFunction(us->blendSrcFuncRGB, us->blendDstFuncRGB, + us->blendSrcFuncAlpha, us->blendDstFuncAlpha); else - FX_grAlphaBlendFunction(GR_BLEND_ONE,GR_BLEND_ZERO,GR_BLEND_ONE,GR_BLEND_ZERO); + FX_grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, + GR_BLEND_ONE, GR_BLEND_ZERO); } + /************************************************************************/ /************************** Alpha Test SetUp ****************************/ @@ -1255,8 +1245,8 @@ static void fxSetupBlend(GLcontext *ctx) void fxDDAlphaFunc(GLcontext *ctx, GLenum func, GLclampf ref) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxUnitsState *us=&fxMesa->unitsState; + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxUnitsState *us = &fxMesa->unitsState; GrCmpFnc_t newfunc; switch(func) { @@ -1316,81 +1306,118 @@ static void fxSetupAlphaTest(GLcontext *ctx) FX_grAlphaTestFunction(GR_CMP_ALWAYS); } -/************************************************************************/ -/************************** Depth Test SetUp ****************************/ -/************************************************************************/ -void fxDDDepthFunc(GLcontext *ctx, GLenum func) +/* + * Evaluate all depth-test state and make the Glide calls. + */ +static void +fxSetupDepthTest(GLcontext *ctx) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxUnitsState *us=&fxMesa->unitsState; - GrCmpFnc_t dfunc; - - switch(func) { - case GL_NEVER: - dfunc=GR_CMP_NEVER; - break; - case GL_LESS: - dfunc=GR_CMP_LESS; - break; - case GL_GEQUAL: - dfunc=GR_CMP_GEQUAL; - break; - case GL_LEQUAL: - dfunc=GR_CMP_LEQUAL; - break; - case GL_GREATER: - dfunc=GR_CMP_GREATER; - break; - case GL_NOTEQUAL: - dfunc=GR_CMP_NOTEQUAL; - break; - case GL_EQUAL: - dfunc=GR_CMP_EQUAL; - break; - case GL_ALWAYS: - dfunc=GR_CMP_ALWAYS; - break; - default: - fprintf(stderr,"fx Driver: internal error in fxDDDepthFunc()\n"); - fxCloseHardware(); - exit(-1); - break; + if (ctx->Depth.Test) { + GrCmpFnc_t dfunc; + switch (ctx->Depth.Func) { + case GL_NEVER: + dfunc = GR_CMP_NEVER; + break; + case GL_LESS: + dfunc = GR_CMP_LESS; + break; + case GL_GEQUAL: + dfunc = GR_CMP_GEQUAL; + break; + case GL_LEQUAL: + dfunc = GR_CMP_LEQUAL; + break; + case GL_GREATER: + dfunc = GR_CMP_GREATER; + break; + case GL_NOTEQUAL: + dfunc = GR_CMP_NOTEQUAL; + break; + case GL_EQUAL: + dfunc = GR_CMP_EQUAL; + break; + case GL_ALWAYS: + dfunc = GR_CMP_ALWAYS; + break; + default: + gl_problem(ctx, "bad depth mode in fxSetupDepthTest"); + dfunc = GR_CMP_ALWAYS; + } + FX_grDepthBufferFunction(dfunc); + FX_grDepthMask(ctx->Depth.Mask); } - - if(dfunc!=us->depthTestFunc) { - us->depthTestFunc=dfunc; - fxMesa->new_state |= FX_NEW_DEPTH; - ctx->Driver.RenderStart = fxSetupFXUnits; + else { + /* depth test always passes, don't update Z buffer */ + FX_grDepthBufferFunction(GR_CMP_ALWAYS); + FX_grDepthMask(FXFALSE); } - } -void fxDDDepthMask(GLcontext *ctx, GLboolean flag) -{ - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxUnitsState *us=&fxMesa->unitsState; - if(flag!=us->depthMask) { - us->depthMask=flag; - fxMesa->new_state |= FX_NEW_DEPTH; - ctx->Driver.RenderStart = fxSetupFXUnits; +/* + * Evaluate all stencil state and make the Glide calls. + */ +static GrStencil_t +fxConvertGLStencilOp(GLenum op) +{ + switch (op) { + case GL_KEEP: + return GR_STENCILOP_KEEP; + case GL_ZERO: + return GR_STENCILOP_ZERO; + case GL_REPLACE: + return GR_STENCILOP_REPLACE; + case GL_INCR: + return GR_STENCILOP_INCR_CLAMP; + case GL_DECR: + return GR_STENCILOP_DECR_CLAMP; + case GL_INVERT: + return GR_STENCILOP_INVERT; + default: + gl_problem(NULL, "bad stencil op in fxConvertGLStencilOp"); } + return GR_STENCILOP_KEEP; /* never get, silence compiler warning */ } -static void fxSetupDepthTest(GLcontext *ctx) +/* + * This function is called just before any rendering is done. + * It will validate the stencil parameters. + */ +static void +fxSetupStencilTest(GLcontext *ctx) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxUnitsState *us=&fxMesa->unitsState; + if (ctx->Stencil.Enabled) { + GrStencil_t sfail = fxConvertGLStencilOp(ctx->Stencil.FailFunc); + GrStencil_t zfail = fxConvertGLStencilOp(ctx->Stencil.ZFailFunc); + GrStencil_t zpass = fxConvertGLStencilOp(ctx->Stencil.ZPassFunc); + FX_grStencilOp(sfail, zfail, zpass); + FX_grStencilFunc(ctx->Stencil.Function - GL_NEVER, + ctx->Stencil.Ref, ctx->Stencil.ValueMask); + FX_grStencilMask(ctx->Stencil.WriteMask); + FX_grEnable(GR_STENCIL_MODE_EXT); + } + else { + FX_grDisable(GR_STENCIL_MODE_EXT); + } +} - if(us->depthTestEnabled) - FX_grDepthBufferFunction(us->depthTestFunc); - else - FX_grDepthBufferFunction(GR_CMP_ALWAYS); - FX_grDepthMask(us->depthMask); +/* + * Set the state so that stencil is either enabled or disabled. + * This is called from Mesa only. Glide is invoked at + * setup time, not now. + */ +static void +fxDDEnableStencil(GLcontext *ctx, GLboolean state) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + (void) state; + fxMesa->new_state |= FX_NEW_STENCIL; + ctx->Driver.RenderStart = fxSetupFXUnits; } + /************************************************************************/ /**************************** Color Mask SetUp **************************/ /************************************************************************/ @@ -1410,14 +1437,20 @@ static void fxSetupColorMask(GLcontext *ctx) { fxMesaContext fxMesa = FX_CONTEXT(ctx); - FX_grColorMask(ctx->Color.ColorMask[RCOMP] || - ctx->Color.ColorMask[GCOMP] || - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); + if (ctx->Color.DrawBuffer == GL_NONE) { + FX_grColorMask(FXFALSE, FXFALSE); + } + else { + FX_grColorMask(ctx->Color.ColorMask[RCOMP] || + ctx->Color.ColorMask[GCOMP] || + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer); + } } + /************************************************************************/ /**************************** Fog Mode SetUp ****************************/ /************************************************************************/ @@ -1582,59 +1615,71 @@ static void fxSetupCull(GLcontext *ctx) void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxUnitsState *us=&fxMesa->unitsState; + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxUnitsState *us = &fxMesa->unitsState; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDEnable(...)\n"); + fprintf(stderr,"fxmesa: fxDDEnable(...)\n"); } switch(cap) { - case GL_ALPHA_TEST: - if(state!=us->alphaTestEnabled) { - us->alphaTestEnabled=state; - fxMesa->new_state |= FX_NEW_ALPHA; + case GL_ALPHA_TEST: + if(state!=us->alphaTestEnabled) { + us->alphaTestEnabled=state; + fxMesa->new_state |= FX_NEW_ALPHA; + ctx->Driver.RenderStart = fxSetupFXUnits; + } + break; + case GL_BLEND: + if(state!=us->blendEnabled) { + us->blendEnabled=state; + fxMesa->new_state |= FX_NEW_BLEND; + ctx->Driver.RenderStart = fxSetupFXUnits; + } + break; + case GL_DEPTH_TEST: + fxMesa->new_state |= FX_NEW_DEPTH; ctx->Driver.RenderStart = fxSetupFXUnits; - } - break; - case GL_BLEND: - if(state!=us->blendEnabled) { - us->blendEnabled=state; - fxMesa->new_state |= FX_NEW_BLEND; + break; + case GL_DITHER: + if (state) + FX_grDitherMode(GR_DITHER_4x4); + else + FX_grDitherMode(GR_DITHER_DISABLE); + break; + case GL_SCISSOR_TEST: + fxMesa->new_state |= FX_NEW_SCISSOR; ctx->Driver.RenderStart = fxSetupFXUnits; - } - break; - case GL_DEPTH_TEST: - if(state!=us->depthTestEnabled) { - us->depthTestEnabled=state; - fxMesa->new_state |= FX_NEW_DEPTH; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + fxDDTexUseGlbPalette(ctx, state); + break; + case GL_FOG: + fxMesa->new_state |= FX_NEW_FOG; ctx->Driver.RenderStart = fxSetupFXUnits; - } - break; - case GL_SCISSOR_TEST: - fxMesa->new_state |= FX_NEW_SCISSOR; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_FOG: - fxMesa->new_state |= FX_NEW_FOG; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_CULL_FACE: - fxMesa->new_state |= FX_NEW_CULL; - ctx->Driver.RenderStart = fxSetupFXUnits; - break; - case GL_LINE_SMOOTH: - case GL_POINT_SMOOTH: - case GL_POLYGON_SMOOTH: - case GL_TEXTURE_2D: + break; + case GL_CULL_FACE: + fxMesa->new_state |= FX_NEW_CULL; + ctx->Driver.RenderStart = fxSetupFXUnits; + break; + case GL_LINE_SMOOTH: + case GL_LINE_STIPPLE: + case GL_POINT_SMOOTH: + case GL_POLYGON_SMOOTH: + case GL_TEXTURE_2D: fxMesa->new_state |= FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; break; - default: - ; /* XXX no-op??? */ + case GL_STENCIL_TEST: + fxMesa->new_state |= FX_NEW_STENCIL; + ctx->Driver.RenderStart = fxSetupFXUnits; + break; + default: + ; /* no-op */ } } + #if 0 /* Multipass to do GL_BLEND texture functions @@ -1663,11 +1708,17 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass) } fxDDDepthMask(ctx, FALSE); } + /* + * Disable stencil as well. + */ + if (ctx->Stencil.Enabled) { + fxDDEnableStencil(ctx, GL_FALSE); + } /* Enable Cc*Ct mode */ - /* ??? Set the Constant Color ??? */ + /* XXX Set the Constant Color ? */ fxDDEnable(ctx, GL_BLEND, GL_TRUE); - fxDDBlendFunc(ctx, ???, ???); - fxSetupTextureSingleTMU(ctx, ???); + fxDDBlendFunc(ctx, XXX, XXX); + fxSetupTextureSingleTMU(ctx, XXX); fxSetupBlend(ctx); fxSetupDepthTest(ctx); break; @@ -1675,10 +1726,11 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass) case 2: /* Reset everything back to normal */ fxMesa->unitsState = fxMesa->restoreUnitsState; - fxMesa->setupdone &= ???; - fxSetupTextureSingleTMU(ctx, ???); + fxMesa->setupdone &= XXX; + fxSetupTextureSingleTMU(ctx, XXX); fxSetupBlend(ctx); fxSetupDepthTest(ctx); + fxSetupStencilText(ctx); break; } @@ -1724,13 +1776,15 @@ static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass ) case GL_ALWAYS: break; default: - fxDDDepthFunc( ctx, GL_EQUAL ); + /*fxDDDepthFunc( ctx, GL_EQUAL );*/ + FX_grDepthBufferFunction(GR_CMP_EQUAL); break; } - fxDDDepthMask( ctx, GL_FALSE ); + /*fxDDDepthMask( ctx, GL_FALSE ); */ + FX_grDepthMask(FXFALSE); } - + fxDDEnableStencil(ctx, GL_FALSE); if (ctx->Texture.Unit[1].EnvMode == GL_MODULATE) { fxDDEnable( ctx, GL_BLEND, GL_TRUE ); fxDDBlendFunc( ctx, GL_DST_COLOR, GL_ZERO ); @@ -1750,6 +1804,7 @@ static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass ) fxSetupTextureSingleTMU( ctx, 0 ); fxSetupBlend( ctx ); fxSetupDepthTest( ctx ); + fxSetupStencilTest( ctx ); break; } @@ -1807,10 +1862,13 @@ void fxSetupFXUnits( GLcontext *ctx ) if (newstate & FX_NEW_ALPHA) fxSetupAlphaTest(ctx); - + if (newstate & FX_NEW_DEPTH) fxSetupDepthTest(ctx); + if (newstate & FX_NEW_STENCIL) + fxSetupStencilTest(ctx); + if (newstate & FX_NEW_FOG) fxSetupFog(ctx); @@ -1822,14 +1880,11 @@ void fxSetupFXUnits( GLcontext *ctx ) if (newstate & FX_NEW_CULL) fxSetupCull(ctx); - fxMesa->new_state = 0; /* ctx->Driver.RenderStart = 0; */ } } - - #else diff --git a/xc/extras/Mesa/src/FX/fxtexman.c b/xc/extras/Mesa/src/FX/fxtexman.c index 87f309adc..5066efa55 100644 --- a/xc/extras/Mesa/src/FX/fxtexman.c +++ b/xc/extras/Mesa/src/FX/fxtexman.c @@ -146,10 +146,10 @@ static void fxTMUInit(fxMesaContext fxMesa, int tmu) end=FX_grTexMaxAddress(tmu); if(fxMesa->verbose) { - fprintf(stderr,"%s configuration:",(tmu==FX_TMU0) ? "TMU0" : "TMU1"); - fprintf(stderr," Lower texture memory address (%u)\n",(unsigned int)start); - fprintf(stderr," Higher texture memory address (%u)\n",(unsigned int)end); - fprintf(stderr," Splitting Texture memory in 2b blocks:\n"); + fprintf(stderr,"Voodoo %s configuration:",(tmu==FX_TMU0) ? "TMU0" : "TMU1"); + fprintf(stderr,"Voodoo Lower texture memory address (%u)\n",(unsigned int)start); + fprintf(stderr,"Voodoo Higher texture memory address (%u)\n",(unsigned int)end); + fprintf(stderr,"Voodoo Splitting Texture memory in 2b blocks:\n"); } fxMesa->freeTexMem[tmu]=end-start; @@ -162,7 +162,7 @@ static void fxTMUInit(fxMesaContext fxMesa, int tmu) else blockend=blockstart+FX_2MB_SPLIT; if(fxMesa->verbose) - fprintf(stderr," %07u-%07u\n", + fprintf(stderr,"Voodoo %07u-%07u\n", (unsigned int)blockstart,(unsigned int)blockend); tmn=fxTMNewRangeNode(fxMesa, blockstart, blockend); @@ -545,12 +545,8 @@ void fxTMReloadSubMipMapLevel(fxMesaContext fxMesa, fxTexGetInfo(ti->mipmapLevel[0].width, ti->mipmapLevel[0].height, &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if((ti->info.format==GR_TEXFMT_INTENSITY_8) || - (ti->info.format==GR_TEXFMT_P_8) || - (ti->info.format==GR_TEXFMT_ALPHA_8)) - data=ti->mipmapLevel[level].data+((yoffset*ti->mipmapLevel[level].width)>>1); - else - data=ti->mipmapLevel[level].data+yoffset*ti->mipmapLevel[level].width; + data=ti->mipmapLevel[level].data + + yoffset*ti->mipmapLevel[level].width*ti->mipmapLevel[level].texelSize; switch(tmu) { case FX_TMU0: @@ -651,12 +647,11 @@ void fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj) fxTMMoveOutTM(fxMesa, tObj); - for(i=0; i<MAX_TEXTURE_LEVELS; i++) { - if (ti->mipmapLevel[i].used && - ti->mipmapLevel[i].translated) + for (i=0; i<MAX_TEXTURE_LEVELS; i++) { + if (ti->mipmapLevel[i].data) { FREE(ti->mipmapLevel[i].data); - - (void)ti->mipmapLevel[i].data; + ti->mipmapLevel[i].data = NULL; + } } switch (ti->whichTMU) { case FX_TMU0: diff --git a/xc/extras/Mesa/src/FX/fxtritmp.h b/xc/extras/Mesa/src/FX/fxtritmp.h index 06df4dcd0..6411d167a 100644 --- a/xc/extras/Mesa/src/FX/fxtritmp.h +++ b/xc/extras/Mesa/src/FX/fxtritmp.h @@ -66,7 +66,9 @@ static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit; GLubyte (*color)[4] = VB->Color[facing]->data; if (IND & FX_FLAT) { - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); } else { GOURAUD2(v1,color[e1]); GOURAUD2(v2,color[e2]); @@ -103,7 +105,9 @@ static void TAG(fx_tri)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint } else if (IND & FX_FLAT) { GLubyte (*color)[4] = VB->Color[0]->data; - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); } if (IND & FX_FRONT_BACK) { @@ -168,7 +172,10 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, GLuint facing = (c<0.0) ^ ctx->Polygon.FrontBit; GLubyte (*color)[4] = VB->Color[facing]->data; if (IND & FX_FLAT) { - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); + GOURAUD2(v4,color[pv]); } else { GOURAUD2(v1,color[e1]); GOURAUD2(v2,color[e2]); @@ -206,7 +213,10 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, } else if (IND & FX_FLAT) { GLubyte (*color)[4] = VB->Color[0]->data; - FX_VB_COLOR(fxMesa, color[pv]); + GOURAUD2(v1,color[pv]); + GOURAUD2(v2,color[pv]); + GOURAUD2(v3,color[pv]); + GOURAUD2(v4,color[pv]); } if (IND & FX_FRONT_BACK) { @@ -249,9 +259,10 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, } } -#define DRAW_LINE(tmp0, tmp1, width) \ - do { \ - GrVertex verts[4]; \ +#define DRAW_LINE(tmp0, tmp1, width) \ + do { \ + const float xoff = 0.125, yoff = 0.125; \ + GrVertex verts[4]; \ float dx, dy, wx, wy; \ \ dx = tmp0->x - tmp1->x; \ @@ -270,17 +281,17 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, verts[2] = *tmp1; \ verts[3] = *tmp1; \ \ - verts[0].x = tmp0->x - wx; \ - verts[0].y = tmp0->y - wy; \ + verts[0].x = tmp0->x - wx + xoff; \ + verts[0].y = tmp0->y - wy + yoff; \ \ - verts[1].x = tmp0->x + wx; \ - verts[1].y = tmp0->y + wy; \ + verts[1].x = tmp0->x + wx + xoff; \ + verts[1].y = tmp0->y + wy + yoff; \ \ - verts[2].x = tmp1->x + wx; \ - verts[2].y = tmp1->y + wy; \ + verts[2].x = tmp1->x + wx + xoff; \ + verts[2].y = tmp1->y + wy + yoff; \ \ - verts[3].x = tmp1->x - wx; \ - verts[3].y = tmp1->y - wy; \ + verts[3].x = tmp1->x - wx + xoff; \ + verts[3].y = tmp1->y - wy + yoff; \ \ FX_grDrawPolygonVertexList(4, verts); \ } while (0) @@ -291,28 +302,20 @@ static void TAG(fx_line)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint pv) fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; struct vertex_buffer *VB=ctx->VB; fxVertex *gWin = FX_DRIVER_DATA(VB)->verts; - GLubyte (* const color)[4] = VB->Color[0]->data; + GLubyte (* const color)[4] = VB->ColorPtr->data; GrVertex *v1 = (GrVertex *)gWin[e1].f; GrVertex *v2 = (GrVertex *)gWin[e2].f; GLfloat w = ctx->Line.Width*.5; - if (IND & FX_FLAT) - { - FX_VB_COLOR(fxMesa, color[pv]); - if (IND & FX_ANTIALIAS) -#if FX_USE_PARGB - { - GLuint v1argb = v1->argb; - GLuint v2argb = v2->argb; - v1->argb = (color[pv][ACOMP] << 24) | (v1argb & 0x00FFFFFF); - v2->argb = (color[pv][ACOMP] << 24) | (v2argb & 0x00FFFFFF); - } -#else - v1->a = v2->a = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][3]); -#endif + if (IND & FX_FLAT) { + v1->r = v2->r = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][0]); + v1->g = v2->g = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][1]); + v1->b = v2->b = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][2]); + v1->a = v2->a = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][3]); } else if (IND & FX_TWOSIDE) { + /* XXX use signed area of the polygon to determine front/back color choice */ GOURAUD2(v1,color[e1]); GOURAUD2(v2,color[e2]); } @@ -331,8 +334,7 @@ static void TAG(fx_line)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint pv) else DRAW_LINE(v1,v2,w); - if (IND & FX_FRONT_BACK) - { + if (IND & FX_FRONT_BACK) { FX_grColorMask(ctx->Color.ColorMask[RCOMP] || ctx->Color.ColorMask[GCOMP] || ctx->Color.ColorMask[BCOMP], diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c new file mode 100644 index 000000000..62b18f9e6 --- /dev/null +++ b/xc/extras/Mesa/src/OSmesa/osmesa.c @@ -0,0 +1,1637 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Off-Screen Mesa rendering / Rendering into client memory space + * + * Note on thread safety: this driver is thread safe. All + * functions are reentrant. The notion of current context is + * managed by the core gl_make_current() and gl_get_current_context() + * functions. Those functions are thread-safe. + */ + + +#ifdef PC_HEADER +#include "all.h" +#else +#include "glheader.h" +#include "GL/osmesa.h" +#include "context.h" +#include "depth.h" +#include "mem.h" +#include "matrix.h" +#include "types.h" +#include "vb.h" +#include "extensions.h" +#endif + + +/* + * This is the OS/Mesa context struct. + * Notice how it includes a GLcontext. By doing this we're mimicking + * C++ inheritance/derivation. + * Later, we can cast a GLcontext pointer into an OSMesaContext pointer + * or vice versa. + */ +struct osmesa_context { + GLcontext gl_ctx; /* The core GL/Mesa context */ + GLvisual *gl_visual; /* Describes the buffers */ + GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */ + GLenum format; /* either GL_RGBA or GL_COLOR_INDEX */ + void *buffer; /* the image buffer */ + GLint width, height; /* size of image buffer */ + GLuint pixel; /* current color index or RGBA pixel value */ + GLuint clearpixel; /* pixel for clearing the color buffer */ + GLint rowlength; /* number of pixels per row */ + GLint userRowLength; /* user-specified number of pixels per row */ + GLint rshift, gshift; /* bit shifts for RGBA formats */ + GLint bshift, ashift; + GLint rind, gind, bind; /* index offsets for RGBA formats */ + void *rowaddr[MAX_HEIGHT]; /* address of first pixel in each image row */ + GLboolean yup; /* TRUE -> Y increases upward */ + /* FALSE -> Y increases downward */ +}; + + + +/* A forward declaration: */ +static void osmesa_update_state( GLcontext *ctx ); + + + +/**********************************************************************/ +/***** Public Functions *****/ +/**********************************************************************/ + + +/* + * Create an Off-Screen Mesa rendering context. The only attribute needed is + * an RGBA vs Color-Index mode flag. + * + * Input: format - either GL_RGBA or GL_COLOR_INDEX + * sharelist - specifies another OSMesaContext with which to share + * display lists. NULL indicates no sharing. + * Return: an OSMesaContext or 0 if error + */ +OSMesaContext GLAPIENTRY +OSMesaCreateContext( GLenum format, OSMesaContext sharelist ) +{ + OSMesaContext osmesa; + GLint rshift, gshift, bshift, ashift; + GLint rind, gind, bind; + GLint indexBits, alphaBits; + GLboolean rgbmode; + GLboolean swalpha; + GLuint i4 = 1; + GLubyte *i1 = (GLubyte *) &i4; + GLint little_endian = *i1; + + swalpha = GL_FALSE; + rind = gind = bind = 0; + if (format==OSMESA_COLOR_INDEX) { + indexBits = 8; + rshift = gshift = bshift = ashift = 0; + rgbmode = GL_FALSE; + } + else if (format==OSMESA_RGBA) { + indexBits = 0; + alphaBits = 8; + if (little_endian) { + rshift = 0; + gshift = 8; + bshift = 16; + ashift = 24; + } + else { + rshift = 24; + gshift = 16; + bshift = 8; + ashift = 0; + } + rgbmode = GL_TRUE; + } + else if (format==OSMESA_BGRA) { + indexBits = 0; + alphaBits = 8; + if (little_endian) { + ashift = 0; + rshift = 8; + gshift = 16; + bshift = 24; + } + else { + bshift = 24; + gshift = 16; + rshift = 8; + ashift = 0; + } + rgbmode = GL_TRUE; + } + else if (format==OSMESA_ARGB) { + indexBits = 0; + alphaBits = 8; + if (little_endian) { + bshift = 0; + gshift = 8; + rshift = 16; + ashift = 24; + } + else { + ashift = 24; + rshift = 16; + gshift = 8; + bshift = 0; + } + rgbmode = GL_TRUE; + } + else if (format==OSMESA_RGB) { + indexBits = 0; + alphaBits = 0; + bshift = 0; + gshift = 8; + rshift = 16; + ashift = 24; + bind = 2; + gind = 1; + rind = 0; + rgbmode = GL_TRUE; + swalpha = GL_TRUE; + } + else if (format==OSMESA_BGR) { + indexBits = 0; + alphaBits = 0; + bshift = 0; + gshift = 8; + rshift = 16; + ashift = 24; + bind = 0; + gind = 1; + rind = 2; + rgbmode = GL_TRUE; + swalpha = GL_TRUE; + } + else { + return NULL; + } + + + osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context); + if (osmesa) { + osmesa->gl_visual = gl_create_visual( rgbmode, + swalpha, /* software alpha */ + GL_FALSE, /* double buffer */ + GL_FALSE, /* stereo */ + DEFAULT_SOFTWARE_DEPTH_BITS, + STENCIL_BITS, + rgbmode ? ACCUM_BITS : 0, + indexBits, + 8, 8, 8, alphaBits ); + if (!osmesa->gl_visual) { + FREE(osmesa); + return NULL; + } + + if (!_mesa_initialize_context(&osmesa->gl_ctx, + osmesa->gl_visual, + sharelist ? &sharelist->gl_ctx + : (GLcontext *) NULL, + (void *) osmesa, GL_TRUE )) { + _mesa_destroy_visual( osmesa->gl_visual ); + FREE(osmesa); + return NULL; + } + gl_extensions_enable(&(osmesa->gl_ctx),"GL_HP_occlusion_test"); + gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map"); + + osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual, + osmesa->gl_visual->DepthBits > 0, + osmesa->gl_visual->StencilBits > 0, + osmesa->gl_visual->AccumRedBits > 0, + osmesa->gl_visual->AlphaBits > 0 ); + + if (!osmesa->gl_buffer) { + gl_destroy_visual( osmesa->gl_visual ); + gl_free_context_data( &osmesa->gl_ctx ); + FREE(osmesa); + return NULL; + } + osmesa->format = format; + osmesa->buffer = NULL; + osmesa->width = 0; + osmesa->height = 0; + osmesa->pixel = 0; + osmesa->clearpixel = 0; + osmesa->userRowLength = 0; + osmesa->rowlength = 0; + osmesa->yup = GL_TRUE; + osmesa->rshift = rshift; + osmesa->gshift = gshift; + osmesa->bshift = bshift; + osmesa->ashift = ashift; + osmesa->rind = rind; + osmesa->gind = gind; + osmesa->bind = bind; + } + return osmesa; +} + + + +/* + * Destroy an Off-Screen Mesa rendering context. + * + * Input: ctx - the context to destroy + */ +void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ) +{ + if (ctx) { + gl_destroy_visual( ctx->gl_visual ); + gl_destroy_framebuffer( ctx->gl_buffer ); + gl_free_context_data( &ctx->gl_ctx ); + FREE( ctx ); + } +} + + + +/* + * Recompute the values of the context's rowaddr array. + */ +static void compute_row_addresses( OSMesaContext ctx ) +{ + GLint i; + + if (ctx->yup) { + /* Y=0 is bottom line of window */ + if (ctx->format==OSMESA_COLOR_INDEX) { + /* 1-byte CI mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + i * ctx->rowlength; + } + } + else { + if ((ctx->format==OSMESA_RGB) || (ctx->format==OSMESA_BGR)) { + /* 3-byte RGB mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + (i * (ctx->rowlength*3)); + } + } else { + /* 4-byte RGBA mode */ + GLuint *origin = (GLuint *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + i * ctx->rowlength; + } + } + } + } + else { + /* Y=0 is top line of window */ + if (ctx->format==OSMESA_COLOR_INDEX) { + /* 1-byte CI mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + (ctx->height-i-1) * ctx->rowlength; + } + } + else { + if ((ctx->format==OSMESA_RGB) || (ctx->format==OSMESA_BGR)) { + /* 3-byte RGB mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + ((ctx->height-i-1) * (ctx->rowlength*3)); + } + } else { + /* 4-byte RGBA mode */ + GLuint *origin = (GLuint *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + (ctx->height-i-1) * ctx->rowlength; + } + } + } + } +} + + +/* + * Bind an OSMesaContext to an image buffer. The image buffer is just a + * block of memory which the client provides. Its size must be at least + * as large as width*height*sizeof(type). Its address should be a multiple + * of 4 if using RGBA mode. + * + * Image data is stored in the order of glDrawPixels: row-major order + * with the lower-left image pixel stored in the first array position + * (ie. bottom-to-top). + * + * Since the only type initially supported is GL_UNSIGNED_BYTE, if the + * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA + * value. If the context is in color indexed mode, each pixel will be + * stored as a 1-byte value. + * + * If the context's viewport hasn't been initialized yet, it will now be + * initialized to (0,0,width,height). + * + * Input: ctx - the rendering context + * buffer - the image buffer memory + * type - data type for pixel components, only GL_UNSIGNED_BYTE + * supported now + * width, height - size of image buffer in pixels, at least 1 + * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, + * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1, + * width>internal limit or height>internal limit. + */ +GLboolean GLAPIENTRY +OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, + GLsizei width, GLsizei height ) +{ + if (!ctx || !buffer || type!=GL_UNSIGNED_BYTE + || width<1 || height<1 || width>MAX_WIDTH || height>MAX_HEIGHT) { + return GL_FALSE; + } + + osmesa_update_state( &ctx->gl_ctx ); + gl_make_current( &ctx->gl_ctx, ctx->gl_buffer ); + + ctx->buffer = buffer; + ctx->width = width; + ctx->height = height; + if (ctx->userRowLength) + ctx->rowlength = ctx->userRowLength; + else + ctx->rowlength = width; + + compute_row_addresses( ctx ); + + /* init viewport */ + 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; + ctx->gl_ctx.Scissor.Height = height; + } + + return GL_TRUE; +} + + + +OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) +{ + GLcontext *ctx = gl_get_current_context(); + if (ctx) + return (OSMesaContext) ctx; + else + return NULL; +} + + + +void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value ) +{ + OSMesaContext ctx = OSMesaGetCurrentContext(); + + switch (pname) { + case OSMESA_ROW_LENGTH: + if (value<0) { + gl_error( &ctx->gl_ctx, GL_INVALID_VALUE, + "OSMesaPixelStore(value)" ); + return; + } + ctx->userRowLength = value; + ctx->rowlength = value; + break; + case OSMESA_Y_UP: + ctx->yup = value ? GL_TRUE : GL_FALSE; + break; + default: + gl_error( &ctx->gl_ctx, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" ); + return; + } + + compute_row_addresses( ctx ); +} + + +void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value ) +{ + OSMesaContext ctx = OSMesaGetCurrentContext(); + + switch (pname) { + case OSMESA_WIDTH: + *value = ctx->width; + return; + case OSMESA_HEIGHT: + *value = ctx->height; + return; + case OSMESA_FORMAT: + *value = ctx->format; + return; + case OSMESA_TYPE: + *value = GL_UNSIGNED_BYTE; + return; + case OSMESA_ROW_LENGTH: + *value = ctx->rowlength; + return; + case OSMESA_Y_UP: + *value = ctx->yup; + return; + default: + gl_error(&ctx->gl_ctx, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)"); + return; + } +} + +/* + * Return the depth buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * bytesPerValue - bytes per depth value (2 or 4) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + */ +GLboolean GLAPIENTRY +OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, + GLint *bytesPerValue, void **buffer ) +{ + if ((!c->gl_buffer) || (!c->gl_buffer->DepthBuffer)) { + *width = 0; + *height = 0; + *bytesPerValue = 0; + *buffer = 0; + return GL_FALSE; + } + else { + *width = c->gl_buffer->Width; + *height = c->gl_buffer->Height; + *bytesPerValue = sizeof(GLdepth); + *buffer = c->gl_buffer->DepthBuffer; + return GL_TRUE; + } +} + +/* + * Return the color buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * format - the pixel format (OSMESA_FORMAT) + * buffer - pointer to color buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + */ +GLboolean GLAPIENTRY +OSMesaGetColorBuffer( OSMesaContext c, GLint *width, + GLint *height, GLint *format, void **buffer ) +{ + if (!c->buffer) { + *width = 0; + *height = 0; + *format = 0; + *buffer = 0; + return GL_FALSE; + } + else { + *width = c->width; + *height = c->height; + *format = c->format; + *buffer = c->buffer; + return GL_TRUE; + } +} + +/**********************************************************************/ +/*** Device Driver Functions ***/ +/**********************************************************************/ + + +/* + * Useful macros: + */ +#define PACK_RGBA(R,G,B,A) ( ((R) << osmesa->rshift) \ + | ((G) << osmesa->gshift) \ + | ((B) << osmesa->bshift) \ + | ((A) << osmesa->ashift) ) + +#define PACK_RGBA2(R,G,B,A) ( ((R) << rshift) \ + | ((G) << gshift) \ + | ((B) << bshift) \ + | ((A) << ashift) ) + +#define UNPACK_RED(P) (((P) >> osmesa->rshift) & 0xff) +#define UNPACK_GREEN(P) (((P) >> osmesa->gshift) & 0xff) +#define UNPACK_BLUE(P) (((P) >> osmesa->bshift) & 0xff) +#define UNPACK_ALPHA(P) (((P) >> osmesa->ashift) & 0xff) + +#define PIXELADDR1(X,Y) ((GLubyte *) osmesa->rowaddr[Y] + (X)) +#define PIXELADDR3(X,Y) ((GLubyte *) osmesa->rowaddr[Y] + ((X)*3)) +#define PIXELADDR4(X,Y) ((GLuint *) osmesa->rowaddr[Y] + (X)) + + + + +static GLboolean set_draw_buffer( GLcontext *ctx, GLenum mode ) +{ + (void) ctx; + if (mode==GL_FRONT_LEFT) { + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + +static void set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +{ + /* separate read buffer not supported */ + ASSERT(buffer == ctx->DrawBuffer); + ASSERT(mode == GL_FRONT_LEFT); +} + + +static void clear_index( GLcontext *ctx, GLuint index ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->clearpixel = index; +} + + + +static void clear_color( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->clearpixel = PACK_RGBA( r, g, b, a ); +} + + + +static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; + + /* we can't handle color or index masking */ + if (*colorMask != 0xffffffff || ctx->Color.IndexMask != 0xffffffff) + return mask; + + /* sanity check - we only have a front-left buffer */ + ASSERT((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_LEFT_BIT | DD_BACK_RIGHT_BIT)) == 0); + + if (mask & DD_FRONT_LEFT_BIT) { + if (osmesa->format==OSMESA_COLOR_INDEX) { + if (all) { + /* Clear whole CI buffer */ + MEMSET(osmesa->buffer, osmesa->clearpixel, + osmesa->rowlength * osmesa->height); + } + else { + /* Clear part of CI buffer */ + GLint i, j; + for (i=0;i<height;i++) { + GLubyte *ptr1 = PIXELADDR1( x, (y+i) ); + for (j=0;j<width;j++) { + *ptr1++ = osmesa->clearpixel; + } + } + } + } + else if ((osmesa->format==OSMESA_RGB)||(osmesa->format==OSMESA_BGR)) { + GLubyte rval = UNPACK_RED(osmesa->clearpixel); + GLubyte gval = UNPACK_GREEN(osmesa->clearpixel); + GLubyte bval = UNPACK_BLUE(osmesa->clearpixel); + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + if (all) { + GLuint i, n; + GLubyte *ptr3 = (GLubyte *) osmesa->buffer; + /* Clear whole RGB buffer */ + n = osmesa->rowlength * osmesa->height; + for (i=0;i<n;i++) { + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + ptr3 += 3; + } + } + else { + /* Clear part of RGB buffer */ + GLint i, j; + for (i=0;i<height;i++) { + GLubyte *ptr3 = PIXELADDR3( x, (y+i) ); + for (j=0;j<width;j++) { + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + ptr3 += 3; + } + } + } + } + else { + if (all) { + /* Clear whole RGBA buffer */ + GLuint i, n, *ptr4; + n = osmesa->rowlength * osmesa->height; + ptr4 = (GLuint *) osmesa->buffer; + if (osmesa->clearpixel) { + for (i=0;i<n;i++) { + *ptr4++ = osmesa->clearpixel; + } + } + else { + BZERO(ptr4, n * sizeof(GLuint)); + } + } + else { + /* Clear part of RGBA buffer */ + GLint i, j; + for (i=0;i<height;i++) { + GLuint *ptr4 = PIXELADDR4( x, (y+i) ); + for (j=0;j<width;j++) { + *ptr4++ = osmesa->clearpixel; + } + } + } + } + } + /* have Mesa clear all other buffers */ + return mask & (~DD_FRONT_LEFT_BIT); +} + + + +static void set_index( GLcontext *ctx, GLuint index ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->pixel = index; +} + + + +static void set_color( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->pixel = PACK_RGBA( r, g, b, a ); +} + + + +static void buffer_size( GLcontext *ctx, GLuint *width, GLuint *height ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + *width = osmesa->width; + *height = osmesa->height; +} + + +/**********************************************************************/ +/***** Read/write spans/arrays of RGBA pixels *****/ +/**********************************************************************/ + +/* Write RGBA pixels to an RGBA (or permuted) buffer. */ +static void write_rgba_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4( x, y ); + GLuint i; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + if (mask) { + for (i=0;i<n;i++,ptr4++) { + if (mask[i]) { + *ptr4 = PACK_RGBA2( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); + } + } + } + else { + for (i=0;i<n;i++,ptr4++) { + *ptr4 = PACK_RGBA2( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); + } + } +} + + +/* Write RGBA pixels to an RGBA buffer. This is the fastest span-writer. */ +static void write_rgba_span_rgba( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4( x, y ); + const GLuint *rgba4 = (const GLuint *) rgba; + GLuint i; + if (mask) { + for (i=0;i<n;i++) { + if (mask[i]) { + ptr4[i] = rgba4[i]; + } + } + } + else { + MEMCPY( ptr4, rgba4, n * 4 ); + } +} + + +/* Write RGB pixels to an RGBA (or permuted) buffer. */ +static void write_rgb_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgb[][3], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4( x, y ); + GLuint i; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + if (mask) { + for (i=0;i<n;i++,ptr4++) { + if (mask[i]) { + *ptr4 = PACK_RGBA2( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], 255 ); + } + } + } + else { + for (i=0;i<n;i++,ptr4++) { + *ptr4 = PACK_RGBA2( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], 255); + } + } +} + + + +static void write_monocolor_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4(x,y); + GLuint i; + for (i=0;i<n;i++,ptr4++) { + if (mask[i]) { + *ptr4 = osmesa->pixel; + } + } +} + + + +static void write_rgba_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + for (i=0;i<n;i++) { + if (mask[i]) { + GLuint *ptr4 = PIXELADDR4(x[i],y[i]); + *ptr4 = PACK_RGBA2( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); + } + } +} + + + +static void write_monocolor_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLuint *ptr4 = PIXELADDR4(x[i],y[i]); + *ptr4 = osmesa->pixel; + } + } +} + + +static void read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLuint *ptr4 = PIXELADDR4(x,y); + for (i=0;i<n;i++) { + GLuint pixel = *ptr4++; + rgba[i][RCOMP] = UNPACK_RED(pixel); + rgba[i][GCOMP] = UNPACK_GREEN(pixel); + rgba[i][BCOMP] = UNPACK_BLUE(pixel); + rgba[i][ACOMP] = UNPACK_ALPHA(pixel); + } +} + + +/* Read RGBA pixels from an RGBA buffer */ +static void read_rgba_span_rgba( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4(x,y); + MEMCPY( rgba, ptr4, n * 4 * sizeof(GLubyte) ); +} + + +static void read_rgba_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLuint *ptr4 = PIXELADDR4(x[i],y[i]); + GLuint pixel = *ptr4; + rgba[i][RCOMP] = UNPACK_RED(pixel); + rgba[i][GCOMP] = UNPACK_GREEN(pixel); + rgba[i][BCOMP] = UNPACK_BLUE(pixel); + rgba[i][ACOMP] = UNPACK_ALPHA(pixel); + } + } +} + +/**********************************************************************/ +/***** 3 byte RGB pixel support funcs *****/ +/**********************************************************************/ + +/* Write RGBA pixels to an RGB or BGR buffer. */ +static void write_rgba_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr3 = PIXELADDR3( x, y); + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + if (mask) { + for (i=0;i<n;i++,ptr3+=3) { + if (mask[i]) { + ptr3[rind] = rgba[i][RCOMP]; + ptr3[gind] = rgba[i][GCOMP]; + ptr3[bind] = rgba[i][BCOMP]; + } + } + } + else { + for (i=0;i<n;i++,ptr3+=3) { + ptr3[rind] = rgba[i][RCOMP]; + ptr3[gind] = rgba[i][GCOMP]; + ptr3[bind] = rgba[i][BCOMP]; + } + } +} + +/* Write RGB pixels to an RGB or BGR buffer. */ +static void write_rgb_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgb[][3], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr3 = PIXELADDR3( x, y); + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + if (mask) { + for (i=0;i<n;i++,ptr3+=3) { + if (mask[i]) { + ptr3[rind] = rgb[i][RCOMP]; + ptr3[gind] = rgb[i][GCOMP]; + ptr3[bind] = rgb[i][BCOMP]; + } + } + } + else { + for (i=0;i<n;i++,ptr3+=3) { + ptr3[rind] = rgb[i][RCOMP]; + ptr3[gind] = rgb[i][GCOMP]; + ptr3[bind] = rgb[i][BCOMP]; + } + } +} + + +static void write_monocolor_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + GLubyte rval = UNPACK_RED(osmesa->pixel); + GLubyte gval = UNPACK_GREEN(osmesa->pixel); + GLubyte bval = UNPACK_BLUE(osmesa->pixel); + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + GLubyte *ptr3 = PIXELADDR3( x, y); + GLuint i; + for (i=0;i<n;i++,ptr3+=3) { + if (mask[i]) { + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + } + } +} + +static void write_rgba_pixels3( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); + ptr3[rind] = rgba[i][RCOMP]; + ptr3[gind] = rgba[i][GCOMP]; + ptr3[bind] = rgba[i][BCOMP]; + } + } +} + +static void write_monocolor_pixels3( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + GLubyte rval = UNPACK_RED(osmesa->pixel); + GLubyte gval = UNPACK_GREEN(osmesa->pixel); + GLubyte bval = UNPACK_BLUE(osmesa->pixel); + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + } + } +} + +static void read_rgba_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + const GLubyte *ptr3 = PIXELADDR3( x, y); + for (i=0;i<n;i++,ptr3+=3) { + rgba[i][RCOMP] = ptr3[rind]; + rgba[i][GCOMP] = ptr3[gind]; + rgba[i][BCOMP] = ptr3[bind]; + rgba[i][ACOMP] = 0; + } +} + +static void read_rgba_pixels3( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + for (i=0;i<n;i++) { + if (mask[i]) { + const GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); + rgba[i][RCOMP] = ptr3[rind]; + rgba[i][GCOMP] = ptr3[gind]; + rgba[i][BCOMP] = ptr3[bind]; + rgba[i][ACOMP] = 0; + } + } +} + + +/**********************************************************************/ +/***** Read/write spans/arrays of CI pixels *****/ +/**********************************************************************/ + +/* Write 32-bit color index to buffer */ +static void write_index32_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLuint index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr1 = PIXELADDR1(x,y); + GLuint i; + if (mask) { + for (i=0;i<n;i++,ptr1++) { + if (mask[i]) { + *ptr1 = (GLubyte) index[i]; + } + } + } + else { + for (i=0;i<n;i++,ptr1++) { + *ptr1 = (GLubyte) index[i]; + } + } +} + + +/* Write 8-bit color index to buffer */ +static void write_index8_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr1 = PIXELADDR1(x,y); + GLuint i; + if (mask) { + for (i=0;i<n;i++,ptr1++) { + if (mask[i]) { + *ptr1 = (GLubyte) index[i]; + } + } + } + else { + MEMCPY( ptr1, index, n ); + } +} + + +static void write_monoindex_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr1 = PIXELADDR1(x,y); + GLuint i; + for (i=0;i<n;i++,ptr1++) { + if (mask[i]) { + *ptr1 = (GLubyte) osmesa->pixel; + } + } +} + + +static void write_index_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLuint index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); + *ptr1 = (GLubyte) index[i]; + } + } +} + + +static void write_monoindex_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); + *ptr1 = (GLubyte) osmesa->pixel; + } + } +} + + +static void read_index_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + const GLubyte *ptr1 = PIXELADDR1(x,y); + for (i=0;i<n;i++,ptr1++) { + index[i] = (GLuint) *ptr1; + } +} + + +static void read_index_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLuint index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i] ) { + const GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); + index[i] = (GLuint) *ptr1; + } + } +} + + + +/**********************************************************************/ +/***** Optimized line rendering *****/ +/**********************************************************************/ + + +/* + * Draw a flat-shaded, RGB line into an osmesa buffer. + */ +static void flat_rgba_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); + +#define INTERP_XY 1 +#define CLIP_HACK 1 +#define PLOT(X,Y) { GLuint *ptr4 = PIXELADDR4(X,Y); *ptr4 = pixel; } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, Z-less, RGB line into an osmesa buffer. + */ +static void flat_rgba_z_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); + +#define INTERP_XY 1 +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + if (Z < *zPtr) { \ + GLuint *ptr4 = PIXELADDR4(X,Y); \ + *ptr4 = pixel; \ + *zPtr = Z; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, alpha-blended, RGB line into an osmesa buffer. + */ +static void flat_blend_rgba_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + struct vertex_buffer *VB = ctx->VB; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint avalue = VB->ColorPtr->data[pvert][3]; + GLint msavalue = 255 - avalue; + GLint rvalue = VB->ColorPtr->data[pvert][0]*avalue; + GLint gvalue = VB->ColorPtr->data[pvert][1]*avalue; + GLint bvalue = VB->ColorPtr->data[pvert][2]*avalue; + +#define INTERP_XY 1 +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + { GLuint *ptr4 = PIXELADDR4(X,Y); \ + GLuint pixel = 0; \ + pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift);\ + pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift);\ + pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift);\ + *ptr4 = pixel; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. + */ +static void flat_blend_rgba_z_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + struct vertex_buffer *VB = ctx->VB; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint avalue = VB->ColorPtr->data[pvert][3]; + GLint msavalue = 256 - avalue; + GLint rvalue = VB->ColorPtr->data[pvert][0]*avalue; + GLint gvalue = VB->ColorPtr->data[pvert][1]*avalue; + GLint bvalue = VB->ColorPtr->data[pvert][2]*avalue; + +#define INTERP_XY 1 +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + if (Z < *zPtr) { \ + GLuint *ptr4 = PIXELADDR4(X,Y); \ + GLuint pixel = 0; \ + pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ + pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ + pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ + *ptr4 = pixel; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. + */ +static void flat_blend_rgba_z_line_write( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + struct vertex_buffer *VB = ctx->VB; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint avalue = VB->ColorPtr->data[pvert][3]; + GLint msavalue = 256 - avalue; + GLint rvalue = VB->ColorPtr->data[pvert][0]*avalue; + GLint gvalue = VB->ColorPtr->data[pvert][1]*avalue; + GLint bvalue = VB->ColorPtr->data[pvert][2]*avalue; + +#define INTERP_XY 1 +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + if (Z < *zPtr) { \ + GLuint *ptr4 = PIXELADDR4(X,Y); \ + GLuint pixel = 0; \ + pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ + pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ + pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ + *ptr4 = pixel; \ + *zPtr = Z; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Analyze context state to see if we can provide a fast line drawing + * function, like those in lines.c. Otherwise, return NULL. + */ +static line_func choose_line_function( GLcontext *ctx ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + if (ctx->Line.SmoothFlag) return NULL; + if (ctx->Texture.Enabled) return NULL; + if (ctx->Light.ShadeModel!=GL_FLAT) return NULL; + + if (ctx->Line.Width==1.0F + && ctx->Line.StippleFlag==GL_FALSE) { + + if (ctx->RasterMask==DEPTH_BIT + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_rgba_z_line; + default: + return NULL; + } + } + + if (ctx->RasterMask==0) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_rgba_line; + default: + return NULL; + } + } + + if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA + && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendSrcA==GL_SRC_ALPHA + && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_blend_rgba_z_line_write; + default: + return NULL; + } + } + + if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_FALSE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA + && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendSrcA==GL_SRC_ALPHA + && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_blend_rgba_z_line; + default: + return NULL; + } + } + + if (ctx->RasterMask==BLEND_BIT + && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA + && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendSrcA==GL_SRC_ALPHA + && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_blend_rgba_line; + default: + return NULL; + } + } + + } + return NULL; +} + + +/**********************************************************************/ +/***** Optimized triangle rendering *****/ +/**********************************************************************/ + + +/* + * Smooth-shaded, z-less triangle, RGBA color. + */ +static void smooth_rgba_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint v2, GLuint pv ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + (void) pv; + +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define INTERP_RGB 1 +#define INTERP_ALPHA 1 +#define INNER_LOOP( LEFT, RIGHT, Y ) \ +{ \ + GLint i, len = RIGHT-LEFT; \ + GLuint *img = PIXELADDR4(LEFT,Y); \ + for (i=0;i<len;i++,img++) { \ + GLdepth z = FixedToDepth(ffz); \ + if (z < zRow[i]) { \ + *img = PACK_RGBA2( FixedToInt(ffr), FixedToInt(ffg), \ + FixedToInt(ffb), FixedToInt(ffa) ); \ + zRow[i] = z; \ + } \ + ffr += fdrdx; ffg += fdgdx; ffb += fdbdx; ffa += fdadx;\ + ffz += fdzdx; \ + } \ +} +#ifdef WIN32 +#include "..\tritemp.h" +#else +#include "tritemp.h" +#endif +} + + + + +/* + * Flat-shaded, z-less triangle, RGBA color. + */ +static void flat_rgba_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint v2, GLuint pv ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define SETUP_CODE \ + GLubyte r = VB->ColorPtr->data[pv][0]; \ + GLubyte g = VB->ColorPtr->data[pv][1]; \ + GLubyte b = VB->ColorPtr->data[pv][2]; \ + GLubyte a = VB->ColorPtr->data[pv][3]; \ + GLuint pixel = PACK_RGBA(r,g,b,a); + +#define INNER_LOOP( LEFT, RIGHT, Y ) \ +{ \ + GLint i, len = RIGHT-LEFT; \ + GLuint *img = PIXELADDR4(LEFT,Y); \ + for (i=0;i<len;i++,img++) { \ + GLdepth z = FixedToDepth(ffz); \ + if (z < zRow[i]) { \ + *img = pixel; \ + zRow[i] = z; \ + } \ + ffz += fdzdx; \ + } \ +} +#ifdef WIN32 +#include "..\tritemp.h" +#else +#include "tritemp.h" +#endif +} + + + +/* + * Return pointer to an accelerated triangle function if possible. + */ +static triangle_func choose_triangle_function( GLcontext *ctx ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + if ((osmesa->format==OSMESA_RGB)||(osmesa->format==OSMESA_BGR)) return NULL; + + if (ctx->Polygon.SmoothFlag) return NULL; + if (ctx->Polygon.StippleFlag) return NULL; + if (ctx->Texture.Enabled) return NULL; + + if (ctx->RasterMask==DEPTH_BIT + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && osmesa->format!=OSMESA_COLOR_INDEX) { + if (ctx->Light.ShadeModel==GL_SMOOTH) { + return smooth_rgba_z_triangle; + } + else { + return flat_rgba_z_triangle; + } + } + return NULL; +} + + + +static const GLubyte *get_string( GLcontext *ctx, GLenum name ) +{ + (void) ctx; + switch (name) { + case GL_RENDERER: + return (const GLubyte *) "Mesa OffScreen"; + default: + return NULL; + } +} + + +static void osmesa_update_state( GLcontext *ctx ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + ASSERT((void *) osmesa == (void *) ctx->DriverCtx); + + ctx->Driver.GetString = get_string; + ctx->Driver.UpdateState = osmesa_update_state; + + ctx->Driver.SetDrawBuffer = set_draw_buffer; + ctx->Driver.SetReadBuffer = set_read_buffer; + ctx->Driver.Color = set_color; + ctx->Driver.Index = set_index; + ctx->Driver.ClearIndex = clear_index; + ctx->Driver.ClearColor = clear_color; + ctx->Driver.Clear = clear; + + ctx->Driver.GetBufferSize = buffer_size; + + ctx->Driver.PointsFunc = NULL; + ctx->Driver.LineFunc = choose_line_function( ctx ); + ctx->Driver.TriangleFunc = choose_triangle_function( ctx ); + + + /* RGB(A) span/pixel functions */ + if ((osmesa->format==OSMESA_RGB) || (osmesa->format==OSMESA_BGR)) { + /* 3 bytes / pixel in frame buffer */ + ctx->Driver.WriteRGBASpan = write_rgba_span3; + ctx->Driver.WriteRGBSpan = write_rgb_span3; + ctx->Driver.WriteRGBAPixels = write_rgba_pixels3; + ctx->Driver.WriteMonoRGBASpan = write_monocolor_span3; + ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels3; + ctx->Driver.ReadRGBASpan = read_rgba_span3; + ctx->Driver.ReadRGBAPixels = read_rgba_pixels3; + } + else { + /* 4 bytes / pixel in frame buffer */ + if (osmesa->format==OSMESA_RGBA + && RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) + ctx->Driver.WriteRGBASpan = write_rgba_span_rgba; + else + ctx->Driver.WriteRGBASpan = write_rgba_span; + ctx->Driver.WriteRGBSpan = write_rgb_span; + ctx->Driver.WriteRGBAPixels = write_rgba_pixels; + ctx->Driver.WriteMonoRGBASpan = write_monocolor_span; + ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels; + if (osmesa->format==OSMESA_RGBA + && RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) + ctx->Driver.ReadRGBASpan = read_rgba_span_rgba; + else + ctx->Driver.ReadRGBASpan = read_rgba_span; + ctx->Driver.ReadRGBAPixels = read_rgba_pixels; + } + + /* CI span/pixel functions */ + ctx->Driver.WriteCI32Span = write_index32_span; + ctx->Driver.WriteCI8Span = write_index8_span; + ctx->Driver.WriteMonoCISpan = write_monoindex_span; + ctx->Driver.WriteCI32Pixels = write_index_pixels; + ctx->Driver.WriteMonoCIPixels = write_monoindex_pixels; + ctx->Driver.ReadCI32Span = read_index_span; + ctx->Driver.ReadCI32Pixels = read_index_pixels; +} diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index 16fb2f622..d613c0a83 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -47,7 +47,9 @@ #include "context.h" #include "config.h" #include "macros.h" +#include "mmath.h" #include "types.h" +#include "xfonts.h" #include "xmesaP.h" @@ -70,6 +72,7 @@ /* Silence compiler warnings */ +extern void Fake_glXDummyFunc( void ); void Fake_glXDummyFunc( void ) { (void) kernel8; @@ -226,7 +229,9 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint depth_size, GLint stencil_size, - GLint accum_size, GLint level ) + GLint accumRedSize, GLint accumGreenSize, + GLint accumBlueSize, GLint accumAlphaSize, + GLint level ) { GLboolean ximageFlag = GL_TRUE; XMesaVisual xmvis; @@ -269,7 +274,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, && (v->gl_visual->AlphaBits > 0) == alphaFlag && (v->gl_visual->DepthBits >= depth_size || depth_size == 0) && (v->gl_visual->StencilBits >= stencil_size || stencil_size == 0) - && (v->gl_visual->AccumBits >= accum_size || accum_size == 0)) { + && (v->gl_visual->AccumRedBits >= accumRedSize || accumRedSize == 0) + && (v->gl_visual->AccumGreenBits >= accumGreenSize || accumGreenSize == 0) + && (v->gl_visual->AccumBlueBits >= accumBlueSize || accumBlueSize == 0) + && (v->gl_visual->AccumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) { /* now either compare XVisualInfo pointers or visual IDs */ if ((!comparePointers && v->visinfo->visualid == vinfo->visualid) || (comparePointers && v->vishandle == vinfo)) { @@ -287,7 +295,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag, stereoFlag, ximageFlag, - depth_size, stencil_size, accum_size, level ); + depth_size, stencil_size, + accumRedSize, accumBlueSize, + accumBlueSize, accumAlphaSize, 0, level, + GLX_NONE_EXT ); if (xmvis) { VisualTable[NumVisuals] = xmvis; NumVisuals++; @@ -299,6 +310,11 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* * Create a GLX visual from a regular XVisualInfo. + * This is called when Fake GLX is given an XVisualInfo which wasn't + * returned by glXChooseVisual. Since this is the first time we're + * considering this visual we'll take a guess at reasonable values + * for depth buffer size, stencil size, accum size, etc. + * This is the best we can do with a client-side emulation of GLX. */ static XMesaVisual create_glx_visual( Display *dpy, XVisualInfo *visinfo ) @@ -315,7 +331,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* stereo */ 0, /* depth bits */ 0, /* stencil bits */ - 0, /* accum bits */ + 0,0,0,0, /* accum bits */ vislevel /* level */ ); } @@ -328,9 +344,12 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* alpha */ GL_TRUE, /* double */ GL_FALSE, /* stereo */ - 8*sizeof(GLdepth), - 8*sizeof(GLstencil), - 8*sizeof(GLaccum), + DEFAULT_SOFTWARE_DEPTH_BITS, + 8 * sizeof(GLstencil), + 8 * sizeof(GLaccum), /* r */ + 8 * sizeof(GLaccum), /* g */ + 8 * sizeof(GLaccum), /* b */ + 8 * sizeof(GLaccum), /* a */ 0 /* level */ ); } @@ -436,21 +455,6 @@ static int transparent_pixel( XMesaVisual glxvis ) /* - * Return number of bits set in n. - */ -static int bitcount( unsigned long n ) -{ - int bits; - for (bits=0; n>0; n=n>>1) { - if (n&1) { - bits++; - } - } - return bits; -} - - -/* * Try to get an X visual which matches the given arguments. */ static XVisualInfo *get_visual( Display *dpy, int scr, @@ -483,9 +487,9 @@ static XVisualInfo *get_visual( Display *dpy, int scr, * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel. */ if (vis && depth > 24 && (xclass==TrueColor || xclass==DirectColor)) { - if (bitcount(vis->red_mask) <= 8 - && bitcount(vis->green_mask) <= 8 - && bitcount(vis->blue_mask) <= 8) { + if (_mesa_bitcount((GLuint) vis->red_mask ) <= 8 && + _mesa_bitcount((GLuint) vis->green_mask) <= 8 && + _mesa_bitcount((GLuint) vis->blue_mask ) <= 8) { return vis; } else { @@ -860,11 +864,15 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) GLboolean stereo_flag = GL_FALSE; GLint depth_size = 0; GLint stencil_size = 0; - GLint accum_size = 0; + GLint accumRedSize = 0; + GLint accumGreenSize = 0; + GLint accumBlueSize = 0; + GLint accumAlphaSize = 0; int level = 0; int visual_type = DONT_CARE; int trans_type = DONT_CARE; int trans_value = DONT_CARE; + GLint caveat = DONT_CARE; parselist = list; @@ -927,13 +935,31 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) stencil_size = *parselist++; break; case GLX_ACCUM_RED_SIZE: + parselist++; + { + GLint size = *parselist++; + accumRedSize = MAX2( accumRedSize, size ); + } + break; case GLX_ACCUM_GREEN_SIZE: + parselist++; + { + GLint size = *parselist++; + accumGreenSize = MAX2( accumGreenSize, size ); + } + break; case GLX_ACCUM_BLUE_SIZE: + parselist++; + { + GLint size = *parselist++; + accumBlueSize = MAX2( accumBlueSize, size ); + } + break; case GLX_ACCUM_ALPHA_SIZE: parselist++; { GLint size = *parselist++; - accum_size = MAX2( accum_size, size ); + accumAlphaSize = MAX2( accumAlphaSize, size ); } break; @@ -961,6 +987,14 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) parselist++; break; + /* + * GLX_EXT_visual_info extension + */ + case GLX_VISUAL_CAVEAT_EXT: + parselist++; + caveat = *parselist++; /* ignored for now */ + break; + case None: break; default: @@ -990,7 +1024,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) else { /* Get a color index visual */ vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type ); - accum_size = 0; + accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0; } } else { @@ -1013,9 +1047,33 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) } if (vis) { + /* Note: we're not exactly obeying the glXChooseVisual rules here. + * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the + * largest depth buffer size, which is 32bits/value. However, we + * return 16 to maintain performance with earlier versions of Mesa. + */ + if (depth_size == 1) + depth_size = DEFAULT_SOFTWARE_DEPTH_BITS; + else if (depth_size > 24) + depth_size = 31; + else if (depth_size > 16) + depth_size = 24; + /* we only support one size of stencil and accum buffers. */ + if (stencil_size > 0) + stencil_size = STENCIL_BITS; + if (accumRedSize > 0) + accumRedSize = ACCUM_BITS; + if (accumGreenSize > 0) + accumGreenSize = ACCUM_BITS; + if (accumBlueSize > 0) + accumBlueSize = ACCUM_BITS; + if (accumAlphaSize > 0) + accumAlphaSize = ACCUM_BITS; if (!save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag, - stereo_flag, - depth_size, stencil_size, accum_size, level )) + stereo_flag, depth_size, stencil_size, + accumRedSize, accumGreenSize, + accumBlueSize, accumAlphaSize, + level )) return NULL; } @@ -1227,6 +1285,7 @@ Fake_glXQueryExtension( Display *dpy, int *errorb, int *event ) } +extern void _kw_ungrab_all( Display *dpy ); void _kw_ungrab_all( Display *dpy ) { XUngrabPointer( dpy, CurrentTime ); @@ -1372,15 +1431,16 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, *value = glxvis->gl_visual->StencilBits; return 0; case GLX_ACCUM_RED_SIZE: + *value = glxvis->gl_visual->AccumRedBits; + return 0; case GLX_ACCUM_GREEN_SIZE: + *value = glxvis->gl_visual->AccumGreenBits; + return 0; case GLX_ACCUM_BLUE_SIZE: - *value = glxvis->gl_visual->AccumBits; + *value = glxvis->gl_visual->AccumBlueBits; return 0; case GLX_ACCUM_ALPHA_SIZE: - if (glxvis->gl_visual->AlphaBits > 0) - *value = glxvis->gl_visual->AccumBits; - else - *value = 0; + *value = glxvis->gl_visual->AccumAlphaBits; return 0; /* @@ -1438,6 +1498,17 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, return 0; /* + * GLX_EXT_visual_info extension + */ + case GLX_VISUAL_CAVEAT_EXT: + /* test for zero, just in case */ + if (glxvis->VisualCaveat > 0) + *value = glxvis->VisualCaveat; + else + *value = GLX_NONE_EXT; + return 0; + + /* * Extensions */ default: @@ -1472,10 +1543,10 @@ static const char *get_extensions( void ) #ifdef FX const char *fx = getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address"; + 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"; } #endif - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address"; + 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"; } @@ -1544,7 +1615,7 @@ Fake_glXGetClientString( Display *dpy, int name ) * GLX 1.3 and later */ -static GLXFBConfig +static GLXFBConfig * Fake_glXChooseFBConfig( Display *dpy, int screen, const int *attribList, int *nitems ) { @@ -1568,6 +1639,16 @@ Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, } +static GLXFBConfig * +Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements ) +{ + (void) dpy; + (void) screen; + (void) nelements; + return 0; +} + + static XVisualInfo * Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { @@ -1742,9 +1823,7 @@ Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) -extern void Fake_glXUseXFont( Font font, int first, int count, int listbase ); - - +extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); struct _glxapi_table *_mesa_GetGLXDispatchTable(void) { static struct _glxapi_table glx; @@ -1799,6 +1878,7 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) glx.DestroyWindow = Fake_glXDestroyWindow; /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/ glx.GetFBConfigAttrib = Fake_glXGetFBConfigAttrib; + glx.GetFBConfigs = Fake_glXGetFBConfigs; glx.GetSelectedEvent = Fake_glXGetSelectedEvent; glx.GetVisualFromFBConfig = Fake_glXGetVisualFromFBConfig; glx.MakeContextCurrent = Fake_glXMakeContextCurrent; diff --git a/xc/extras/Mesa/src/X/xfonts.c b/xc/extras/Mesa/src/X/xfonts.c index c71e65324..2a1aca33c 100644 --- a/xc/extras/Mesa/src/X/xfonts.c +++ b/xc/extras/Mesa/src/X/xfonts.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -43,8 +43,10 @@ #include "GL/xmesa.h" #include "context.h" #include "mem.h" +#include "xfonts.h" #include "xmesaP.h" + /* Some debugging info. */ #ifdef DEBUG @@ -372,7 +374,7 @@ bm_height); glEndList (); } - free (bm); + FREE(bm); XFreeFontInfo( NULL, fs, 0 ); XFreeGC (dpy, gc); @@ -385,6 +387,8 @@ bm_height); glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); } + +extern void xmesa_xfonts_dummy( void ); void xmesa_xfonts_dummy( void ) { /* silence unused var warnings */ diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c index 56e6fcad7..92aad010c 100644 --- a/xc/extras/Mesa/src/X/xmesa1.c +++ b/xc/extras/Mesa/src/X/xmesa1.c @@ -64,6 +64,7 @@ #include "GL/xmesa.h" #include "xmesaP.h" #include "context.h" +#include "extensions.h" #include "matrix.h" #include "mem.h" #include "types.h" @@ -72,6 +73,11 @@ #endif +#ifndef GLX_NONE_EXT +#define GLX_NONE_EXT 0x8000 +#endif + + /* * Current X/Mesa context pointer: */ @@ -418,7 +424,7 @@ static void free_xmesa_buffer(int client, XMesaBuffer buffer) } -/* Copy X color table stuff from on XMesaBuffer to another. */ +/* Copy X color table stuff from one XMesaBuffer to another. */ static void copy_colortable_info(XMesaBuffer dst, const XMesaBuffer src) { MEMCPY(dst->color_table, src->color_table, sizeof(src->color_table)); @@ -1349,10 +1355,11 @@ static GLboolean initialize_visual_and_buffer( int client, /* * Convert an RGBA color to a pixel value. */ -unsigned long xmesa_color_to_pixel( XMesaContext xmesa, - GLubyte r, GLubyte g, GLubyte b, GLubyte a) +unsigned long +xmesa_color_to_pixel( XMesaContext xmesa, GLubyte r, GLubyte g, GLubyte b, GLubyte a, + GLuint pixelFormat) { - switch (xmesa->pixelformat) { + switch (pixelFormat) { case PF_INDEX: return 0; case PF_TRUECOLOR: @@ -1408,21 +1415,29 @@ unsigned long xmesa_color_to_pixel( XMesaContext xmesa, /* * Create a new X/Mesa visual. - * Input: display - the X display - * visinfo - the XVisualInfo - * rgb_flag - TRUE=RGB(A) mode, FALSE=CI mode - * alpha_flag - need alpha planes? - * db_flag - TRUE=double bufferd, FALSE=single - * stereo_flag - true/false - * ximage_flag - TRUE=use XImage for back buffer, FALSE=use Pixmap - * depth_size - requested min bits per depth buffer value - * stencil_size - requested min bits per stencil buffer value - * accum_size - requested min bits per accum buffer value (per channel) - * level - 0=normal, 1=overaly, -1=underlay, etc. - * Return: New XMesaVisual or NULL if something goes wrong + * Input: display - X11 display + * visinfo - an XVisualInfo pointer + * rgb_flag - GL_TRUE = RGB mode, + * GL_FALSE = color index mode + * alpha_flag - alpha buffer requested? + * db_flag - GL_TRUE = double-buffered, + * GL_FALSE = single buffered + * stereo_flag - stereo visual? + * ximage_flag - GL_TRUE = use an XImage for back buffer, + * GL_FALSE = use an off-screen pixmap for back buffer + * depth_size - requested bits/depth values, or zero + * stencil_size - requested bits/stencil values, or zero + * accum_red_size - requested bits/red accum values, or zero + * accum_green_size - requested bits/green accum values, or zero + * accum_blue_size - requested bits/blue accum values, or zero + * accum_alpha_size - requested bits/alpha accum values, or zero + * num_samples - number of samples/pixel if multisampling, or zero + * level - visual level, usually 0 + * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT + * Return; a new XMesaVisual or 0 if error. */ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, - XMesaVisualInfo visinfo, + XMesaVisualInfo visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, @@ -1430,8 +1445,13 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, - GLint accum_size, - GLint level ) + GLint accum_red_size, + GLint accum_green_size, + GLint accum_blue_size, + GLint accum_alpha_size, + GLint num_samples, + GLint level, + GLint visualCaveat ) { char *gamma; XMesaVisual v; @@ -1506,6 +1526,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, v->ximage_flag = ximage_flag; v->level = level; + v->VisualCaveat = visualCaveat; (void) initialize_visual_and_buffer( 0, v, NULL, rgb_flag, 0, 0 ); @@ -1532,11 +1553,15 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, } } - v->gl_visual = gl_create_visual( rgb_flag, alpha_flag, db_flag, stereo_flag, - depth_size, stencil_size, accum_size, - v->index_bits, - red_bits, green_bits, - blue_bits, alpha_bits ); + v->gl_visual = _mesa_create_visual( rgb_flag, db_flag, stereo_flag, + red_bits, green_bits, + blue_bits, alpha_bits, + v->index_bits, + depth_size, + stencil_size, + accum_red_size, accum_green_size, + accum_blue_size, accum_alpha_size, + 0 ); if (!v->gl_visual) { #ifndef XFree86Server FREE(v->visinfo); @@ -1557,7 +1582,7 @@ void XMesaSetVisualDisplay( XMesaDisplay *dpy, XMesaVisual v ) void XMesaDestroyVisual( XMesaVisual v ) { - gl_destroy_visual( v->gl_visual ); + _mesa_destroy_visual( v->gl_visual ); #ifndef XFree86Server FREE(v->visinfo); #endif @@ -1594,6 +1619,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list return NULL; } + gl_extensions_enable(c->gl_ctx, "GL_HP_occlusion_test"); + gl_extensions_enable(c->gl_ctx, "GL_ARB_texture_cube_map"); + if (CHECK_BYTE_ORDER(v)) { c->swapbytes = GL_FALSE; } @@ -1750,7 +1778,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, b->gl_buffer = gl_create_framebuffer( v->gl_visual, v->gl_visual->DepthBits > 0, v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits > 0, v->gl_visual->AlphaBits > 0 ); if (!b->gl_buffer) { free_xmesa_buffer(client, b); @@ -1778,9 +1806,9 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, if (v->gl_visual->DBflag) { attribs[numAttribs++] = FXMESA_DOUBLEBUFFER; } - if (v->gl_visual->AccumBits > 0) { + if (v->gl_visual->AccumRedBits > 0) { attribs[numAttribs++] = FXMESA_ACCUM_SIZE; - attribs[numAttribs++] = v->gl_visual->AccumBits; + attribs[numAttribs++] = v->gl_visual->AccumRedBits; } if (v->gl_visual->StencilBits > 0) { attribs[numAttribs++] = FXMESA_STENCIL_SIZE; @@ -1897,7 +1925,9 @@ XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, b->gl_buffer = gl_create_framebuffer( v->gl_visual, v->gl_visual->DepthBits > 0, v->gl_visual->StencilBits > 0, - v->gl_visual->AccumBits > 0, + v->gl_visual->AccumRedBits + + v->gl_visual->AccumGreenBits + + v->gl_visual->AccumBlueBits > 0, v->gl_visual->AlphaBits > 0 ); if (!b->gl_buffer) { free_xmesa_buffer(client, b); @@ -2041,13 +2071,14 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, * can be different for different windows. */ c->pixel = xmesa_color_to_pixel( c, c->red, c->green, - c->blue, c->alpha ); + c->blue, c->alpha, c->pixelformat ); XMesaSetForeground( c->display, c->xm_buffer->gc1, c->pixel ); c->clearpixel = xmesa_color_to_pixel( c, c->clearcolor[0], c->clearcolor[1], c->clearcolor[2], - c->clearcolor[3] ); + c->clearcolor[3], + c->xm_visual->undithered_pf); XMesaSetForeground(c->display, c->xm_buffer->cleargc, c->clearpixel); } @@ -2147,13 +2178,13 @@ GLboolean XMesaSetFXmode( GLint mode ) if (XMesa) { if (mode == XMESA_FX_WINDOW) { if (XMesa->xm_buffer->FXisHackUsable) { - grSstControl(GR_CONTROL_DEACTIVATE); + FX_grSstControl(GR_CONTROL_DEACTIVATE); XMesa->xm_buffer->FXwindowHack = GL_TRUE; return GL_TRUE; } } else if (mode == XMESA_FX_FULLSCREEN) { - grSstControl(GR_CONTROL_ACTIVATE); + FX_grSstControl(GR_CONTROL_ACTIVATE); XMesa->xm_buffer->FXwindowHack = GL_FALSE; return GL_TRUE; } @@ -2253,7 +2284,7 @@ static void FXgetImage( XMesaBuffer b ) (pixbuf[x] & 0xf800) >> 8, (pixbuf[x] & 0x07e0) >> 3, (pixbuf[x] & 0x001f) << 3, - 0xff)); + 0xff, XMesa->pixelformat)); } } } @@ -2435,7 +2466,7 @@ GLboolean XMesaGetBackBuffer( XMesaBuffer b, GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height, GLint *bytesPerValue, void **buffer ) { - if ((!b->gl_buffer) || (!b->gl_buffer->Depth)) { + if ((!b->gl_buffer) || (!b->gl_buffer->DepthBuffer)) { *width = 0; *height = 0; *bytesPerValue = 0; @@ -2446,7 +2477,7 @@ GLboolean XMesaGetDepthBuffer( XMesaBuffer b, GLint *width, GLint *height, *width = b->gl_buffer->Width; *height = b->gl_buffer->Height; *bytesPerValue = sizeof(GLdepth); - *buffer = b->gl_buffer->Depth; + *buffer = b->gl_buffer->DepthBuffer; return GL_TRUE; } } diff --git a/xc/extras/Mesa/src/X/xmesa2.c b/xc/extras/Mesa/src/X/xmesa2.c index 75340eb43..77b8d4b05 100644 --- a/xc/extras/Mesa/src/X/xmesa2.c +++ b/xc/extras/Mesa/src/X/xmesa2.c @@ -36,8 +36,12 @@ #include "drawpix.h" #include "mem.h" #include "state.h" +#include "depth.h" +#include "macros.h" +#include "vb.h" #include "types.h" #include "xmesaP.h" +#include "extensions.h" @@ -347,7 +351,8 @@ static void clear_color( GLcontext *ctx, xmesa->clearcolor[1] = g; xmesa->clearcolor[2] = b; xmesa->clearcolor[3] = a; - xmesa->clearpixel = xmesa_color_to_pixel( xmesa, r, g, b, a ); + xmesa->clearpixel = xmesa_color_to_pixel( xmesa, r, g, b, a, + xmesa->xm_visual->undithered_pf ); XMesaSetForeground( xmesa->display, xmesa->xm_buffer->cleargc, xmesa->clearpixel ); } @@ -430,7 +435,7 @@ static void set_color( GLcontext *ctx, xmesa->green = g; xmesa->blue = b; xmesa->alpha = a; - xmesa->pixel = xmesa_color_to_pixel( xmesa, r, g, b, a );; + xmesa->pixel = xmesa_color_to_pixel( xmesa, r, g, b, a, xmesa->pixelformat );; XMesaSetForeground( xmesa->display, xmesa->xm_buffer->gc1, xmesa->pixel ); } @@ -713,7 +718,7 @@ clear_16bit_ximage( GLcontext *ctx, GLboolean all, } -/* Optimized code provided by Nozomi Ytow <nozomi@biol.tsukuba.ac.jp> */ +/* Optimized code provided by Nozomi Ytow <noz@xfree86.org> */ static void clear_24bit_ximage( GLcontext *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height ) @@ -731,14 +736,31 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, } if (all) { - register GLint n = xmesa->xm_buffer->width * xmesa->xm_buffer->height; - register bgr_t *ptr3 = (bgr_t *) xmesa->xm_buffer->backimage->data; if (r==g && g==b) { /* same value for all three components (gray) */ - MEMSET(ptr3, r, 3 * n); + const GLint w3 = xmesa->xm_buffer->width * 3; + const GLint h = xmesa->xm_buffer->height; + GLint i; + for (i = 0; i < h; i++) { + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_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; + GLint i, j; + for (i = 0; i < h; i++) { + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + for (j = 0; j < w; j++) { + ptr3->r = r; + ptr3->g = g; + ptr3->b = b; + ptr3++; + } + } +#if 0 /* this code doesn't work for all window widths */ register GLuint *ptr4 = (GLuint *) ptr3; register GLuint px; GLuint pixel4[3]; @@ -805,6 +827,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, case 0: break; } +#endif } } else { @@ -819,6 +842,17 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, } else { /* non-gray clear color */ + GLint i, j; + for (j = 0; j < height; j++) { + bgr_t *ptr3 = PIXELADDR3( xmesa->xm_buffer, x, y+j ); + for (i = 0; i < width; i++) { + ptr3->r = r; + ptr3->g = g; + ptr3->b = b; + ptr3++; + } + } +#if 0 /* this code might not always (seems ptr3 always == ptr4) */ GLint j; GLuint pixel4[3]; pixel4[0] = clearPixel | (clearPixel << 24); @@ -889,6 +923,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, break; } } +#endif } } } @@ -2342,9 +2377,24 @@ static void write_span_5R6G5B_ximage( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - for (i=0;i<n;i++) { - ptr[i] = PACK_5R6G5B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + GLuint p0, p1; + p0 = PACK_5R6G5B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); + p1 = PACK_5R6G5B(rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP]); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + ptr[n] = PACK_5R6G5B(rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]); + } +#else + for (i = 0; i < n; i++) { + ptr[i] = PACK_5R6G5B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); } +#endif } } @@ -2366,9 +2416,24 @@ static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - for (i=0;i<n;i++,x++) { - PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2, x += 2) { + GLuint p0, p1; + PACK_TRUEDITHER( p0, x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); + PACK_TRUEDITHER( p1, x+1, y, rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP] ); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + PACK_TRUEDITHER( ptr[n], x+n, y, rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]); } +#else + for (i = 0; i < n; i++, x++) { + PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); + } +#endif } } @@ -2390,9 +2455,24 @@ static void write_span_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ) } else { /* draw all pixels */ +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + GLuint p0, p1; + p0 = PACK_5R6G5B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); + p1 = PACK_5R6G5B(rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP]); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + ptr[n] = PACK_5R6G5B(rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]); + } +#else for (i=0;i<n;i++) { ptr[i] = PACK_5R6G5B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } +#endif } } @@ -2414,9 +2494,24 @@ static void write_span_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ) } else { /* draw all pixels */ +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2, x += 2) { + GLuint p0, p1; + PACK_TRUEDITHER( p0, x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); + PACK_TRUEDITHER( p1, x+1, y, rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP] ); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + PACK_TRUEDITHER( ptr[n], x+n, y, rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]); + } +#else for (i=0;i<n;i++,x++) { PACK_TRUEDITHER( ptr[i], x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } +#endif } } @@ -4280,7 +4375,6 @@ static void read_color_span( const GLcontext *ctx, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaBuffer source; - register GLuint i; if (xmesa->use_read_buffer) source = xmesa->xm_read_buffer; @@ -4288,10 +4382,11 @@ static void read_color_span( const GLcontext *ctx, source = xmesa->xm_buffer; if (source->buffer) { + /* Read from Pixmap or Window */ XMesaImage *span = NULL; int error; #ifdef XFree86Server - span = XMesaCreateImage(GET_VISUAL_DEPTH(xmesa->xm_visual), n, 1, NULL); + span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL); span->data = (char *)MALLOC(span->height * span->bytes_per_line); error = (!span->data); (*xmesa->display->GetImage)(source->buffer, @@ -4307,18 +4402,17 @@ static void read_color_span( const GLcontext *ctx, switch (xmesa->pixelformat) { case PF_TRUECOLOR: case PF_TRUEDITHER: - case PF_5R6G5B: - case PF_DITHER_5R6G5B: { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); - GLubyte *pixelToR = xmesa->xm_visual->PixelToR; - GLubyte *pixelToG = xmesa->xm_visual->PixelToG; - GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; + GLuint i; for (i=0;i<n;i++) { unsigned long p; p = XMesaGetPixel( span, i, 0 ); @@ -4329,9 +4423,31 @@ static void read_color_span( const GLcontext *ctx, } } break; + case PF_5R6G5B: + case PF_DITHER_5R6G5B: + { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; + GLuint i; + for (i=0;i<n;i++) { + unsigned long p = XMesaGetPixel( span, i, 0 ); + /* fast, but not quite accurate + rgba[i][RCOMP] = ((p >> 8) & 0xf8); + rgba[i][GCOMP] = ((p >> 3) & 0xfc); + rgba[i][BCOMP] = ((p << 3) & 0xff); + */ + rgba[i][RCOMP] = pixelToR[p >> 11]; + rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p & 0x1f]; + rgba[i][ACOMP] = 255; + } + } + break; case PF_8A8B8G8R: { - GLuint *ptr4 = (GLuint *) span->data; + const GLuint *ptr4 = (GLuint *) span->data; + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); @@ -4343,7 +4459,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B: { - GLuint *ptr4 = (GLuint *) span->data; + const GLuint *ptr4 = (GLuint *) span->data; + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); @@ -4355,7 +4472,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B24: { - bgr_t *ptr3 = (bgr_t *) span->data; + const bgr_t *ptr3 = (bgr_t *) span->data; + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = ptr3[i].r; rgba[i][GCOMP] = ptr3[i].g; @@ -4367,6 +4485,7 @@ static void read_color_span( const GLcontext *ctx, case PF_HPCR: { GLubyte *ptr1 = (GLubyte *) span->data; + GLuint i; for (i=0;i<n;i++) { GLubyte p = *ptr1++; rgba[i][RCOMP] = p & 0xE0; @@ -4384,7 +4503,8 @@ static void read_color_span( const GLcontext *ctx, GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { - GLubyte *ptr1 = (GLubyte *) span->data; + const GLubyte *ptr1 = (GLubyte *) span->data; + GLuint i; for (i=0;i<n;i++) { unsigned long p = *ptr1++; rgba[i][RCOMP] = rTable[p]; @@ -4394,9 +4514,9 @@ static void read_color_span( const GLcontext *ctx, } } else { + GLuint i; for (i=0;i<n;i++) { - unsigned long p; - p = XMesaGetPixel( span, i, 0 ); + unsigned long p = XMesaGetPixel( span, i, 0 ); rgba[i][RCOMP] = rTable[p]; rgba[i][GCOMP] = gTable[p]; rgba[i][BCOMP] = bTable[p]; @@ -4408,6 +4528,7 @@ static void read_color_span( const GLcontext *ctx, case PF_1BIT: { int bitFlip = xmesa->xm_visual->bitFlip; + GLuint i; for (i=0;i<n;i++) { unsigned long p; p = XMesaGetPixel( span, i, 0 ) ^ bitFlip; @@ -4425,6 +4546,7 @@ static void read_color_span( const GLcontext *ctx, } else { /* return black pixels */ + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = 0; } @@ -4434,22 +4556,22 @@ static void read_color_span( const GLcontext *ctx, } } else if (source->backimage) { + /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_TRUECOLOR: case PF_TRUEDITHER: - case PF_5R6G5B: - case PF_DITHER_5R6G5B: { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); - GLubyte *pixelToR = xmesa->xm_visual->PixelToR; - GLubyte *pixelToG = xmesa->xm_visual->PixelToG; - GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; XMesaImage *img = source->backimage; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++) { unsigned long p; @@ -4461,9 +4583,58 @@ static void read_color_span( const GLcontext *ctx, } } break; + case PF_5R6G5B: + case PF_DITHER_5R6G5B: + { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; + const GLushort *ptr2 = PIXELADDR2( source, x, y ); + const GLuint *ptr4 = (const GLuint *) ptr2; + GLuint i; +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + const GLuint p = *ptr4++; + const GLuint p0 = p & 0xffff; + const GLuint p1 = p >> 16; + /* fast, but not quite accurate + rgba[i][RCOMP] = ((p >> 8) & 0xf8); + rgba[i][GCOMP] = ((p >> 3) & 0xfc); + rgba[i][BCOMP] = ((p << 3) & 0xff); + */ + rgba[i][RCOMP] = pixelToR[p0 >> 11]; + rgba[i][GCOMP] = pixelToG[(p0 >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p0 & 0x1f]; + rgba[i][ACOMP] = 255; + rgba[i+1][RCOMP] = pixelToR[p1 >> 11]; + rgba[i+1][GCOMP] = pixelToG[(p1 >> 5) & 0x3f]; + rgba[i+1][BCOMP] = pixelToB[p1 & 0x1f]; + rgba[i+1][ACOMP] = 255; + } + if (extraPixel) { + GLushort p = ptr2[n]; + rgba[n][RCOMP] = pixelToR[p >> 11]; + rgba[n][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[n][BCOMP] = pixelToB[p & 0x1f]; + rgba[n][ACOMP] = 255; + } +#else + for (i = 0; i < n; i++) { + const GLushort p = ptr2[i]; + rgba[i][RCOMP] = pixelToR[p >> 11]; + rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p & 0x1f]; + rgba[i][ACOMP] = 255; + } +#endif + } + break; case PF_8A8B8G8R: { - GLuint *ptr4 = PIXELADDR4( source, x, y ); + const GLuint *ptr4 = PIXELADDR4( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); @@ -4475,7 +4646,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B: { - GLuint *ptr4 = PIXELADDR4( source, x, y ); + const GLuint *ptr4 = PIXELADDR4( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); @@ -4487,7 +4659,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B24: { - bgr_t *ptr3 = PIXELADDR3( source, x, y ); + const bgr_t *ptr3 = PIXELADDR3( source, x, y ); + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = ptr3[i].r; rgba[i][GCOMP] = ptr3[i].g; @@ -4498,7 +4671,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_HPCR: { - GLubyte *ptr1 = PIXELADDR1( source, x, y ); + const GLubyte *ptr1 = PIXELADDR1( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLubyte p = *ptr1++; rgba[i][RCOMP] = p & 0xE0; @@ -4512,11 +4686,12 @@ static void read_color_span( const GLcontext *ctx, case PF_LOOKUP: case PF_GRAYSCALE: { - GLubyte *rTable = source->pixel_to_r; - GLubyte *gTable = source->pixel_to_g; - GLubyte *bTable = source->pixel_to_b; + const GLubyte *rTable = source->pixel_to_r; + const GLubyte *gTable = source->pixel_to_g; + const GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { GLubyte *ptr1 = PIXELADDR1( source, x, y ); + GLuint i; for (i=0;i<n;i++) { unsigned long p = *ptr1++; rgba[i][RCOMP] = rTable[p]; @@ -4527,10 +4702,10 @@ static void read_color_span( const GLcontext *ctx, } else { XMesaImage *img = source->backimage; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++,x++) { - unsigned long p; - p = XMesaGetPixel( img, x, y ); + unsigned long p = XMesaGetPixel( img, x, y ); rgba[i][RCOMP] = rTable[p]; rgba[i][GCOMP] = gTable[p]; rgba[i][BCOMP] = bTable[p]; @@ -4543,6 +4718,7 @@ static void read_color_span( const GLcontext *ctx, { XMesaImage *img = source->backimage; int bitFlip = xmesa->xm_visual->bitFlip; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++,x++) { unsigned long p; @@ -4936,7 +5112,6 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name ) } - static void update_span_funcs( GLcontext *ctx ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; diff --git a/xc/extras/Mesa/src/X/xmesa3.c b/xc/extras/Mesa/src/X/xmesa3.c index ba98c5e1d..c7e4c21c8 100644 --- a/xc/extras/Mesa/src/X/xmesa3.c +++ b/xc/extras/Mesa/src/X/xmesa3.c @@ -66,7 +66,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, GLuint first, GLuint last ) register int x, y; const GLubyte *color = VB->ColorPtr->data[i]; unsigned long pixel = xmesa_color_to_pixel( xmesa, - color[0], color[1], color[2], color[3] ); + color[0], color[1], color[2], color[3], xmesa->pixelformat); XMesaSetForeground( dpy, gc, pixel ); x = (GLint) VB->Win.data[i][0]; y = FLIP( xmesa->xm_buffer, (GLint) VB->Win.data[i][1] ); @@ -131,7 +131,8 @@ static void flat_pixmap_line( GLcontext *ctx, unsigned long pixel; if (xmesa->xm_visual->gl_visual->RGBAflag) { const GLubyte *color = VB->ColorPtr->data[pv]; - pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3] ); + pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3], + xmesa->pixelformat ); } else { pixel = VB->IndexPtr->data[pv]; @@ -353,6 +354,7 @@ static void flat_TRUECOLOR_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ @@ -375,6 +377,7 @@ static void flat_8A8B8G8R_z_line( GLcontext *ctx, GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) @@ -400,6 +403,7 @@ static void flat_8R8G8B_z_line( GLcontext *ctx, GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) @@ -424,6 +428,7 @@ static void flat_8R8G8B24_z_line( GLcontext *ctx, const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) @@ -451,6 +456,7 @@ static void flat_5R6G5B_z_line( GLcontext *ctx, GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) @@ -474,6 +480,7 @@ static void flat_DITHER_5R6G5B_z_line( GLcontext *ctx, const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) @@ -500,6 +507,7 @@ static void flat_DITHER8_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -526,6 +534,7 @@ static void flat_LOOKUP8_z_line( GLcontext *ctx, pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -552,6 +561,7 @@ static void flat_HPCR_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -670,6 +680,7 @@ line_func xmesa_get_line_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/xc/extras/Mesa/src/X/xmesa4.c b/xc/extras/Mesa/src/X/xmesa4.c index 844447595..195a531f0 100644 --- a/xc/extras/Mesa/src/X/xmesa4.c +++ b/xc/extras/Mesa/src/X/xmesa4.c @@ -66,8 +66,9 @@ static void flat_pixmap_triangle( GLcontext *ctx, unsigned long pixel; if (xmesa->xm_visual->gl_visual->RGBAflag) { pixel = xmesa_color_to_pixel( xmesa, - VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], - VB->ColorPtr->data[pv][2], VB->ColorPtr->data[pv][3] ); + VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], + VB->ColorPtr->data[pv][2], VB->ColorPtr->data[pv][3], + xmesa->pixelformat ); } else { pixel = VB->IndexPtr->data[pv]; @@ -97,6 +98,7 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx, XMesaImage *img = xmesa->xm_buffer->backimage; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -129,6 +131,7 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint @@ -161,6 +164,7 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint @@ -193,6 +197,7 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE bgr_t @@ -228,6 +233,7 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx, XMesaImage *img = xmesa->xm_buffer->backimage; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -259,6 +265,7 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort @@ -267,7 +274,7 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, { \ GLint i, len = RIGHT-LEFT; \ for (i=0;i<len;i++) { \ - GLdepth z = FixedToDepth(ffz); \ + DEPTH_TYPE z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ pRow[i] = PACK_5R6G5B( FixedToInt(ffr), FixedToInt(ffg), \ FixedToInt(ffb) ); \ @@ -291,6 +298,7 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort @@ -323,6 +331,7 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -357,6 +366,7 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx, XMesaImage *img = xmesa->xm_buffer->backimage; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -390,6 +400,7 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -423,6 +434,7 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -455,6 +467,7 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2]); @@ -483,6 +496,7 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, GLuint v0, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -513,6 +527,7 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -544,6 +559,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -575,6 +591,7 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \ @@ -602,6 +619,7 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #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) @@ -612,7 +630,7 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { \ GLint i, len = RIGHT-LEFT; \ for (i=0;i<len;i++) { \ - GLdepth z = FixedToDepth(ffz); \ + DEPTH_TYPE z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ zRow[i] = z; \ @@ -633,6 +651,7 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #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) @@ -640,7 +659,7 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, { \ GLint i, len = RIGHT-LEFT; \ for (i=0;i<len;i++) { \ - GLdepth z = FixedToDepth(ffz); \ + DEPTH_TYPE z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ PACK_TRUEDITHER(pRow[i], LEFT+i, Y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ @@ -661,6 +680,7 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #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) @@ -693,6 +713,7 @@ static void flat_DITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ FLAT_DITHER_SETUP( VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); @@ -722,6 +743,7 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #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) @@ -753,6 +775,7 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #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) @@ -1432,6 +1455,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: @@ -1463,6 +1487,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/xc/extras/Mesa/src/X/xmesaP.h b/xc/extras/Mesa/src/X/xmesaP.h index 9b79f4314..987877509 100644 --- a/xc/extras/Mesa/src/X/xmesaP.h +++ b/xc/extras/Mesa/src/X/xmesaP.h @@ -85,6 +85,7 @@ struct xmesa_visual { GLint BitsPerPixel; /* True bits per pixel for XImages */ GLint level; /* 0=normal, 1=overlay, etc */ + GLint VisualCaveat; /* for GLX_EXT_visual_rating extension */ GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */ @@ -510,8 +511,9 @@ static int const kernel1[16] = { * External functions: */ -extern unsigned long xmesa_color_to_pixel( XMesaContext xmesa, - GLubyte r, GLubyte g, GLubyte b, GLubyte a ); +extern unsigned long +xmesa_color_to_pixel( XMesaContext xmesa, GLubyte r, GLubyte g, GLubyte b, GLubyte a, + GLuint pixelFormat ); extern void xmesa_alloc_back_buffer( XMesaBuffer b ); diff --git a/xc/extras/Mesa/src/X86/glapi_x86.S b/xc/extras/Mesa/src/X86/glapi_x86.S index a9566ea46..3afd50e0a 100644 --- a/xc/extras/Mesa/src/X86/glapi_x86.S +++ b/xc/extras/Mesa/src/X86/glapi_x86.S @@ -1,37 +1,4 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* - * X86-optimized dispatch code contibuted by Josh Vanderhoof - * - * This file will be machine-generated from the gl.spec file at some point - * in the future. - */ - - +/* DO NOT EDIT - This file generated automatically with glx86asm.py script */ #include "assyntax.h" #include "glapioffsets.h" @@ -51,45 +18,22 @@ #define GLOBL_FN(x) GLOBL x #endif -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Accum)) -GL_PREFIX(Accum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Accum)) - JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AlphaFunc)) -GL_PREFIX(AlphaFunc): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AlphaFunc)) - JMP(GL_OFFSET(_gloffset_AlphaFunc)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Begin)) -GL_PREFIX(Begin): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Begin)) - JMP(GL_OFFSET(_gloffset_Begin)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Bitmap)) -GL_PREFIX(Bitmap): +GLOBL_FN(GL_PREFIX(NewList)) +GL_PREFIX(NewList): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Bitmap)) - JMP(GL_OFFSET(_gloffset_Bitmap)) + JZ(GLNAME(_glapi_fallback_NewList)) + JMP(GL_OFFSET(_gloffset_NewList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFunc)) -GL_PREFIX(BlendFunc): +GLOBL_FN(GL_PREFIX(EndList)) +GL_PREFIX(EndList): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendFunc)) - JMP(GL_OFFSET(_gloffset_BlendFunc)) + JZ(GLNAME(_glapi_fallback_EndList)) + JMP(GL_OFFSET(_gloffset_EndList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CallList)) @@ -108,60 +52,44 @@ GL_PREFIX(CallLists): JMP(GL_OFFSET(_gloffset_CallLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Clear)) -GL_PREFIX(Clear): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Clear)) - JMP(GL_OFFSET(_gloffset_Clear)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearAccum)) -GL_PREFIX(ClearAccum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearAccum)) - JMP(GL_OFFSET(_gloffset_ClearAccum)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearColor)) -GL_PREFIX(ClearColor): +GLOBL_FN(GL_PREFIX(DeleteLists)) +GL_PREFIX(DeleteLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearColor)) - JMP(GL_OFFSET(_gloffset_ClearColor)) + JZ(GLNAME(_glapi_fallback_DeleteLists)) + JMP(GL_OFFSET(_gloffset_DeleteLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearDepth)) -GL_PREFIX(ClearDepth): +GLOBL_FN(GL_PREFIX(GenLists)) +GL_PREFIX(GenLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearDepth)) - JMP(GL_OFFSET(_gloffset_ClearDepth)) + JZ(GLNAME(_glapi_fallback_GenLists)) + JMP(GL_OFFSET(_gloffset_GenLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearIndex)) -GL_PREFIX(ClearIndex): +GLOBL_FN(GL_PREFIX(ListBase)) +GL_PREFIX(ListBase): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearIndex)) - JMP(GL_OFFSET(_gloffset_ClearIndex)) + JZ(GLNAME(_glapi_fallback_ListBase)) + JMP(GL_OFFSET(_gloffset_ListBase)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearStencil)) -GL_PREFIX(ClearStencil): +GLOBL_FN(GL_PREFIX(Begin)) +GL_PREFIX(Begin): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearStencil)) - JMP(GL_OFFSET(_gloffset_ClearStencil)) + JZ(GLNAME(_glapi_fallback_Begin)) + JMP(GL_OFFSET(_gloffset_Begin)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClipPlane)) -GL_PREFIX(ClipPlane): +GLOBL_FN(GL_PREFIX(Bitmap)) +GL_PREFIX(Bitmap): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClipPlane)) - JMP(GL_OFFSET(_gloffset_ClipPlane)) + JZ(GLNAME(_glapi_fallback_Bitmap)) + JMP(GL_OFFSET(_gloffset_Bitmap)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3b)) @@ -172,6 +100,14 @@ GL_PREFIX(Color3b): JMP(GL_OFFSET(_gloffset_Color3b)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3bv)) +GL_PREFIX(Color3bv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3bv)) + JMP(GL_OFFSET(_gloffset_Color3bv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3d)) GL_PREFIX(Color3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -180,6 +116,14 @@ GL_PREFIX(Color3d): JMP(GL_OFFSET(_gloffset_Color3d)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3dv)) +GL_PREFIX(Color3dv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3dv)) + JMP(GL_OFFSET(_gloffset_Color3dv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3f)) GL_PREFIX(Color3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -188,6 +132,14 @@ GL_PREFIX(Color3f): JMP(GL_OFFSET(_gloffset_Color3f)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3fv)) +GL_PREFIX(Color3fv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3fv)) + JMP(GL_OFFSET(_gloffset_Color3fv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3i)) GL_PREFIX(Color3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -196,6 +148,14 @@ GL_PREFIX(Color3i): JMP(GL_OFFSET(_gloffset_Color3i)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3iv)) +GL_PREFIX(Color3iv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3iv)) + JMP(GL_OFFSET(_gloffset_Color3iv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3s)) GL_PREFIX(Color3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -204,6 +164,14 @@ GL_PREFIX(Color3s): JMP(GL_OFFSET(_gloffset_Color3s)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3sv)) +GL_PREFIX(Color3sv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3sv)) + JMP(GL_OFFSET(_gloffset_Color3sv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ub)) GL_PREFIX(Color3ub): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -212,6 +180,14 @@ GL_PREFIX(Color3ub): JMP(GL_OFFSET(_gloffset_Color3ub)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3ubv)) +GL_PREFIX(Color3ubv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3ubv)) + JMP(GL_OFFSET(_gloffset_Color3ubv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ui)) GL_PREFIX(Color3ui): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -220,6 +196,14 @@ GL_PREFIX(Color3ui): JMP(GL_OFFSET(_gloffset_Color3ui)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3uiv)) +GL_PREFIX(Color3uiv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3uiv)) + JMP(GL_OFFSET(_gloffset_Color3uiv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3us)) GL_PREFIX(Color3us): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -228,6 +212,14 @@ GL_PREFIX(Color3us): JMP(GL_OFFSET(_gloffset_Color3us)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3usv)) +GL_PREFIX(Color3usv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3usv)) + JMP(GL_OFFSET(_gloffset_Color3usv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4b)) GL_PREFIX(Color4b): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -236,6 +228,14 @@ GL_PREFIX(Color4b): JMP(GL_OFFSET(_gloffset_Color4b)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4bv)) +GL_PREFIX(Color4bv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4bv)) + JMP(GL_OFFSET(_gloffset_Color4bv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4d)) GL_PREFIX(Color4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -244,6 +244,14 @@ GL_PREFIX(Color4d): JMP(GL_OFFSET(_gloffset_Color4d)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4dv)) +GL_PREFIX(Color4dv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4dv)) + JMP(GL_OFFSET(_gloffset_Color4dv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4f)) GL_PREFIX(Color4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -252,6 +260,14 @@ GL_PREFIX(Color4f): JMP(GL_OFFSET(_gloffset_Color4f)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4fv)) +GL_PREFIX(Color4fv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4fv)) + JMP(GL_OFFSET(_gloffset_Color4fv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4i)) GL_PREFIX(Color4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -260,6 +276,14 @@ GL_PREFIX(Color4i): JMP(GL_OFFSET(_gloffset_Color4i)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4iv)) +GL_PREFIX(Color4iv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4iv)) + JMP(GL_OFFSET(_gloffset_Color4iv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4s)) GL_PREFIX(Color4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -268,6 +292,14 @@ GL_PREFIX(Color4s): JMP(GL_OFFSET(_gloffset_Color4s)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4sv)) +GL_PREFIX(Color4sv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4sv)) + JMP(GL_OFFSET(_gloffset_Color4sv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ub)) GL_PREFIX(Color4ub): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -276,6 +308,14 @@ GL_PREFIX(Color4ub): JMP(GL_OFFSET(_gloffset_Color4ub)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4ubv)) +GL_PREFIX(Color4ubv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4ubv)) + JMP(GL_OFFSET(_gloffset_Color4ubv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ui)) GL_PREFIX(Color4ui): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -284,2260 +324,2260 @@ GL_PREFIX(Color4ui): JMP(GL_OFFSET(_gloffset_Color4ui)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4us)) -GL_PREFIX(Color4us): +GLOBL_FN(GL_PREFIX(Color4uiv)) +GL_PREFIX(Color4uiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4us)) - JMP(GL_OFFSET(_gloffset_Color4us)) + JZ(GLNAME(_glapi_fallback_Color4uiv)) + JMP(GL_OFFSET(_gloffset_Color4uiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3bv)) -GL_PREFIX(Color3bv): +GLOBL_FN(GL_PREFIX(Color4us)) +GL_PREFIX(Color4us): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3bv)) - JMP(GL_OFFSET(_gloffset_Color3bv)) + JZ(GLNAME(_glapi_fallback_Color4us)) + JMP(GL_OFFSET(_gloffset_Color4us)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3dv)) -GL_PREFIX(Color3dv): +GLOBL_FN(GL_PREFIX(Color4usv)) +GL_PREFIX(Color4usv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3dv)) - JMP(GL_OFFSET(_gloffset_Color3dv)) + JZ(GLNAME(_glapi_fallback_Color4usv)) + JMP(GL_OFFSET(_gloffset_Color4usv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3fv)) -GL_PREFIX(Color3fv): +GLOBL_FN(GL_PREFIX(EdgeFlag)) +GL_PREFIX(EdgeFlag): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3fv)) - JMP(GL_OFFSET(_gloffset_Color3fv)) + JZ(GLNAME(_glapi_fallback_EdgeFlag)) + JMP(GL_OFFSET(_gloffset_EdgeFlag)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3iv)) -GL_PREFIX(Color3iv): +GLOBL_FN(GL_PREFIX(EdgeFlagv)) +GL_PREFIX(EdgeFlagv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3iv)) - JMP(GL_OFFSET(_gloffset_Color3iv)) + JZ(GLNAME(_glapi_fallback_EdgeFlagv)) + JMP(GL_OFFSET(_gloffset_EdgeFlagv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3sv)) -GL_PREFIX(Color3sv): +GLOBL_FN(GL_PREFIX(End)) +GL_PREFIX(End): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3sv)) - JMP(GL_OFFSET(_gloffset_Color3sv)) + JZ(GLNAME(_glapi_fallback_End)) + JMP(GL_OFFSET(_gloffset_End)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3ubv)) -GL_PREFIX(Color3ubv): +GLOBL_FN(GL_PREFIX(Indexd)) +GL_PREFIX(Indexd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3ubv)) - JMP(GL_OFFSET(_gloffset_Color3ubv)) + JZ(GLNAME(_glapi_fallback_Indexd)) + JMP(GL_OFFSET(_gloffset_Indexd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3uiv)) -GL_PREFIX(Color3uiv): +GLOBL_FN(GL_PREFIX(Indexdv)) +GL_PREFIX(Indexdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3uiv)) - JMP(GL_OFFSET(_gloffset_Color3uiv)) + JZ(GLNAME(_glapi_fallback_Indexdv)) + JMP(GL_OFFSET(_gloffset_Indexdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3usv)) -GL_PREFIX(Color3usv): +GLOBL_FN(GL_PREFIX(Indexf)) +GL_PREFIX(Indexf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3usv)) - JMP(GL_OFFSET(_gloffset_Color3usv)) + JZ(GLNAME(_glapi_fallback_Indexf)) + JMP(GL_OFFSET(_gloffset_Indexf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4bv)) -GL_PREFIX(Color4bv): +GLOBL_FN(GL_PREFIX(Indexfv)) +GL_PREFIX(Indexfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4bv)) - JMP(GL_OFFSET(_gloffset_Color4bv)) + JZ(GLNAME(_glapi_fallback_Indexfv)) + JMP(GL_OFFSET(_gloffset_Indexfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4dv)) -GL_PREFIX(Color4dv): +GLOBL_FN(GL_PREFIX(Indexi)) +GL_PREFIX(Indexi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4dv)) - JMP(GL_OFFSET(_gloffset_Color4dv)) + JZ(GLNAME(_glapi_fallback_Indexi)) + JMP(GL_OFFSET(_gloffset_Indexi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4fv)) -GL_PREFIX(Color4fv): +GLOBL_FN(GL_PREFIX(Indexiv)) +GL_PREFIX(Indexiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4fv)) - JMP(GL_OFFSET(_gloffset_Color4fv)) + JZ(GLNAME(_glapi_fallback_Indexiv)) + JMP(GL_OFFSET(_gloffset_Indexiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4iv)) -GL_PREFIX(Color4iv): +GLOBL_FN(GL_PREFIX(Indexs)) +GL_PREFIX(Indexs): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4iv)) - JMP(GL_OFFSET(_gloffset_Color4iv)) + JZ(GLNAME(_glapi_fallback_Indexs)) + JMP(GL_OFFSET(_gloffset_Indexs)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4sv)) -GL_PREFIX(Color4sv): +GLOBL_FN(GL_PREFIX(Indexsv)) +GL_PREFIX(Indexsv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4sv)) - JMP(GL_OFFSET(_gloffset_Color4sv)) + JZ(GLNAME(_glapi_fallback_Indexsv)) + JMP(GL_OFFSET(_gloffset_Indexsv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4ubv)) -GL_PREFIX(Color4ubv): +GLOBL_FN(GL_PREFIX(Normal3b)) +GL_PREFIX(Normal3b): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4ubv)) - JMP(GL_OFFSET(_gloffset_Color4ubv)) + JZ(GLNAME(_glapi_fallback_Normal3b)) + JMP(GL_OFFSET(_gloffset_Normal3b)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4uiv)) -GL_PREFIX(Color4uiv): +GLOBL_FN(GL_PREFIX(Normal3bv)) +GL_PREFIX(Normal3bv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4uiv)) - JMP(GL_OFFSET(_gloffset_Color4uiv)) + JZ(GLNAME(_glapi_fallback_Normal3bv)) + JMP(GL_OFFSET(_gloffset_Normal3bv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4usv)) -GL_PREFIX(Color4usv): +GLOBL_FN(GL_PREFIX(Normal3d)) +GL_PREFIX(Normal3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4usv)) - JMP(GL_OFFSET(_gloffset_Color4usv)) + JZ(GLNAME(_glapi_fallback_Normal3d)) + JMP(GL_OFFSET(_gloffset_Normal3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorMask)) -GL_PREFIX(ColorMask): +GLOBL_FN(GL_PREFIX(Normal3dv)) +GL_PREFIX(Normal3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorMask)) - JMP(GL_OFFSET(_gloffset_ColorMask)) + JZ(GLNAME(_glapi_fallback_Normal3dv)) + JMP(GL_OFFSET(_gloffset_Normal3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorMaterial)) -GL_PREFIX(ColorMaterial): +GLOBL_FN(GL_PREFIX(Normal3f)) +GL_PREFIX(Normal3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorMaterial)) - JMP(GL_OFFSET(_gloffset_ColorMaterial)) + JZ(GLNAME(_glapi_fallback_Normal3f)) + JMP(GL_OFFSET(_gloffset_Normal3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyPixels)) -GL_PREFIX(CopyPixels): +GLOBL_FN(GL_PREFIX(Normal3fv)) +GL_PREFIX(Normal3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyPixels)) - JMP(GL_OFFSET(_gloffset_CopyPixels)) + JZ(GLNAME(_glapi_fallback_Normal3fv)) + JMP(GL_OFFSET(_gloffset_Normal3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullFace)) -GL_PREFIX(CullFace): +GLOBL_FN(GL_PREFIX(Normal3i)) +GL_PREFIX(Normal3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullFace)) - JMP(GL_OFFSET(_gloffset_CullFace)) + JZ(GLNAME(_glapi_fallback_Normal3i)) + JMP(GL_OFFSET(_gloffset_Normal3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthFunc)) -GL_PREFIX(DepthFunc): +GLOBL_FN(GL_PREFIX(Normal3iv)) +GL_PREFIX(Normal3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthFunc)) - JMP(GL_OFFSET(_gloffset_DepthFunc)) + JZ(GLNAME(_glapi_fallback_Normal3iv)) + JMP(GL_OFFSET(_gloffset_Normal3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthMask)) -GL_PREFIX(DepthMask): +GLOBL_FN(GL_PREFIX(Normal3s)) +GL_PREFIX(Normal3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthMask)) - JMP(GL_OFFSET(_gloffset_DepthMask)) + JZ(GLNAME(_glapi_fallback_Normal3s)) + JMP(GL_OFFSET(_gloffset_Normal3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthRange)) -GL_PREFIX(DepthRange): +GLOBL_FN(GL_PREFIX(Normal3sv)) +GL_PREFIX(Normal3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthRange)) - JMP(GL_OFFSET(_gloffset_DepthRange)) + JZ(GLNAME(_glapi_fallback_Normal3sv)) + JMP(GL_OFFSET(_gloffset_Normal3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteLists)) -GL_PREFIX(DeleteLists): +GLOBL_FN(GL_PREFIX(RasterPos2d)) +GL_PREFIX(RasterPos2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteLists)) - JMP(GL_OFFSET(_gloffset_DeleteLists)) + JZ(GLNAME(_glapi_fallback_RasterPos2d)) + JMP(GL_OFFSET(_gloffset_RasterPos2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Disable)) -GL_PREFIX(Disable): +GLOBL_FN(GL_PREFIX(RasterPos2dv)) +GL_PREFIX(RasterPos2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Disable)) - JMP(GL_OFFSET(_gloffset_Disable)) + JZ(GLNAME(_glapi_fallback_RasterPos2dv)) + JMP(GL_OFFSET(_gloffset_RasterPos2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawBuffer)) -GL_PREFIX(DrawBuffer): +GLOBL_FN(GL_PREFIX(RasterPos2f)) +GL_PREFIX(RasterPos2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawBuffer)) - JMP(GL_OFFSET(_gloffset_DrawBuffer)) + JZ(GLNAME(_glapi_fallback_RasterPos2f)) + JMP(GL_OFFSET(_gloffset_RasterPos2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawElements)) -GL_PREFIX(DrawElements): +GLOBL_FN(GL_PREFIX(RasterPos2fv)) +GL_PREFIX(RasterPos2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawElements)) - JMP(GL_OFFSET(_gloffset_DrawElements)) + JZ(GLNAME(_glapi_fallback_RasterPos2fv)) + JMP(GL_OFFSET(_gloffset_RasterPos2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawPixels)) -GL_PREFIX(DrawPixels): +GLOBL_FN(GL_PREFIX(RasterPos2i)) +GL_PREFIX(RasterPos2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawPixels)) - JMP(GL_OFFSET(_gloffset_DrawPixels)) + JZ(GLNAME(_glapi_fallback_RasterPos2i)) + JMP(GL_OFFSET(_gloffset_RasterPos2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Enable)) -GL_PREFIX(Enable): +GLOBL_FN(GL_PREFIX(RasterPos2iv)) +GL_PREFIX(RasterPos2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Enable)) - JMP(GL_OFFSET(_gloffset_Enable)) + JZ(GLNAME(_glapi_fallback_RasterPos2iv)) + JMP(GL_OFFSET(_gloffset_RasterPos2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(End)) -GL_PREFIX(End): +GLOBL_FN(GL_PREFIX(RasterPos2s)) +GL_PREFIX(RasterPos2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_End)) - JMP(GL_OFFSET(_gloffset_End)) + JZ(GLNAME(_glapi_fallback_RasterPos2s)) + JMP(GL_OFFSET(_gloffset_RasterPos2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EndList)) -GL_PREFIX(EndList): +GLOBL_FN(GL_PREFIX(RasterPos2sv)) +GL_PREFIX(RasterPos2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EndList)) - JMP(GL_OFFSET(_gloffset_EndList)) + JZ(GLNAME(_glapi_fallback_RasterPos2sv)) + JMP(GL_OFFSET(_gloffset_RasterPos2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1d)) -GL_PREFIX(EvalCoord1d): +GLOBL_FN(GL_PREFIX(RasterPos3d)) +GL_PREFIX(RasterPos3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1d)) - JMP(GL_OFFSET(_gloffset_EvalCoord1d)) + JZ(GLNAME(_glapi_fallback_RasterPos3d)) + JMP(GL_OFFSET(_gloffset_RasterPos3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1f)) -GL_PREFIX(EvalCoord1f): +GLOBL_FN(GL_PREFIX(RasterPos3dv)) +GL_PREFIX(RasterPos3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1f)) - JMP(GL_OFFSET(_gloffset_EvalCoord1f)) + JZ(GLNAME(_glapi_fallback_RasterPos3dv)) + JMP(GL_OFFSET(_gloffset_RasterPos3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1dv)) -GL_PREFIX(EvalCoord1dv): +GLOBL_FN(GL_PREFIX(RasterPos3f)) +GL_PREFIX(RasterPos3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1dv)) - JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) + JZ(GLNAME(_glapi_fallback_RasterPos3f)) + JMP(GL_OFFSET(_gloffset_RasterPos3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1fv)) -GL_PREFIX(EvalCoord1fv): +GLOBL_FN(GL_PREFIX(RasterPos3fv)) +GL_PREFIX(RasterPos3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1fv)) - JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) + JZ(GLNAME(_glapi_fallback_RasterPos3fv)) + JMP(GL_OFFSET(_gloffset_RasterPos3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2d)) -GL_PREFIX(EvalCoord2d): +GLOBL_FN(GL_PREFIX(RasterPos3i)) +GL_PREFIX(RasterPos3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2d)) - JMP(GL_OFFSET(_gloffset_EvalCoord2d)) + JZ(GLNAME(_glapi_fallback_RasterPos3i)) + JMP(GL_OFFSET(_gloffset_RasterPos3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2f)) -GL_PREFIX(EvalCoord2f): +GLOBL_FN(GL_PREFIX(RasterPos3iv)) +GL_PREFIX(RasterPos3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2f)) - JMP(GL_OFFSET(_gloffset_EvalCoord2f)) + JZ(GLNAME(_glapi_fallback_RasterPos3iv)) + JMP(GL_OFFSET(_gloffset_RasterPos3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2dv)) -GL_PREFIX(EvalCoord2dv): +GLOBL_FN(GL_PREFIX(RasterPos3s)) +GL_PREFIX(RasterPos3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2dv)) - JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) + JZ(GLNAME(_glapi_fallback_RasterPos3s)) + JMP(GL_OFFSET(_gloffset_RasterPos3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2fv)) -GL_PREFIX(EvalCoord2fv): +GLOBL_FN(GL_PREFIX(RasterPos3sv)) +GL_PREFIX(RasterPos3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2fv)) - JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) + JZ(GLNAME(_glapi_fallback_RasterPos3sv)) + JMP(GL_OFFSET(_gloffset_RasterPos3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalPoint1)) -GL_PREFIX(EvalPoint1): +GLOBL_FN(GL_PREFIX(RasterPos4d)) +GL_PREFIX(RasterPos4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalPoint1)) - JMP(GL_OFFSET(_gloffset_EvalPoint1)) + JZ(GLNAME(_glapi_fallback_RasterPos4d)) + JMP(GL_OFFSET(_gloffset_RasterPos4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalPoint2)) -GL_PREFIX(EvalPoint2): +GLOBL_FN(GL_PREFIX(RasterPos4dv)) +GL_PREFIX(RasterPos4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalPoint2)) - JMP(GL_OFFSET(_gloffset_EvalPoint2)) + JZ(GLNAME(_glapi_fallback_RasterPos4dv)) + JMP(GL_OFFSET(_gloffset_RasterPos4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalMesh1)) -GL_PREFIX(EvalMesh1): +GLOBL_FN(GL_PREFIX(RasterPos4f)) +GL_PREFIX(RasterPos4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalMesh1)) - JMP(GL_OFFSET(_gloffset_EvalMesh1)) + JZ(GLNAME(_glapi_fallback_RasterPos4f)) + JMP(GL_OFFSET(_gloffset_RasterPos4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlag)) -GL_PREFIX(EdgeFlag): +GLOBL_FN(GL_PREFIX(RasterPos4fv)) +GL_PREFIX(RasterPos4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlag)) - JMP(GL_OFFSET(_gloffset_EdgeFlag)) + JZ(GLNAME(_glapi_fallback_RasterPos4fv)) + JMP(GL_OFFSET(_gloffset_RasterPos4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagv)) -GL_PREFIX(EdgeFlagv): +GLOBL_FN(GL_PREFIX(RasterPos4i)) +GL_PREFIX(RasterPos4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagv)) - JMP(GL_OFFSET(_gloffset_EdgeFlagv)) + JZ(GLNAME(_glapi_fallback_RasterPos4i)) + JMP(GL_OFFSET(_gloffset_RasterPos4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalMesh2)) -GL_PREFIX(EvalMesh2): +GLOBL_FN(GL_PREFIX(RasterPos4iv)) +GL_PREFIX(RasterPos4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalMesh2)) - JMP(GL_OFFSET(_gloffset_EvalMesh2)) + JZ(GLNAME(_glapi_fallback_RasterPos4iv)) + JMP(GL_OFFSET(_gloffset_RasterPos4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FeedbackBuffer)) -GL_PREFIX(FeedbackBuffer): +GLOBL_FN(GL_PREFIX(RasterPos4s)) +GL_PREFIX(RasterPos4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FeedbackBuffer)) - JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) + JZ(GLNAME(_glapi_fallback_RasterPos4s)) + JMP(GL_OFFSET(_gloffset_RasterPos4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Finish)) -GL_PREFIX(Finish): +GLOBL_FN(GL_PREFIX(RasterPos4sv)) +GL_PREFIX(RasterPos4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Finish)) - JMP(GL_OFFSET(_gloffset_Finish)) + JZ(GLNAME(_glapi_fallback_RasterPos4sv)) + JMP(GL_OFFSET(_gloffset_RasterPos4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Flush)) -GL_PREFIX(Flush): +GLOBL_FN(GL_PREFIX(Rectd)) +GL_PREFIX(Rectd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Flush)) - JMP(GL_OFFSET(_gloffset_Flush)) + JZ(GLNAME(_glapi_fallback_Rectd)) + JMP(GL_OFFSET(_gloffset_Rectd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogf)) -GL_PREFIX(Fogf): +GLOBL_FN(GL_PREFIX(Rectdv)) +GL_PREFIX(Rectdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogf)) - JMP(GL_OFFSET(_gloffset_Fogf)) + JZ(GLNAME(_glapi_fallback_Rectdv)) + JMP(GL_OFFSET(_gloffset_Rectdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogi)) -GL_PREFIX(Fogi): +GLOBL_FN(GL_PREFIX(Rectf)) +GL_PREFIX(Rectf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogi)) - JMP(GL_OFFSET(_gloffset_Fogi)) + JZ(GLNAME(_glapi_fallback_Rectf)) + JMP(GL_OFFSET(_gloffset_Rectf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogfv)) -GL_PREFIX(Fogfv): +GLOBL_FN(GL_PREFIX(Rectfv)) +GL_PREFIX(Rectfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogfv)) - JMP(GL_OFFSET(_gloffset_Fogfv)) + JZ(GLNAME(_glapi_fallback_Rectfv)) + JMP(GL_OFFSET(_gloffset_Rectfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogiv)) -GL_PREFIX(Fogiv): +GLOBL_FN(GL_PREFIX(Recti)) +GL_PREFIX(Recti): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogiv)) - JMP(GL_OFFSET(_gloffset_Fogiv)) + JZ(GLNAME(_glapi_fallback_Recti)) + JMP(GL_OFFSET(_gloffset_Recti)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FrontFace)) -GL_PREFIX(FrontFace): +GLOBL_FN(GL_PREFIX(Rectiv)) +GL_PREFIX(Rectiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FrontFace)) - JMP(GL_OFFSET(_gloffset_FrontFace)) + JZ(GLNAME(_glapi_fallback_Rectiv)) + JMP(GL_OFFSET(_gloffset_Rectiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Frustum)) -GL_PREFIX(Frustum): +GLOBL_FN(GL_PREFIX(Rects)) +GL_PREFIX(Rects): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Frustum)) - JMP(GL_OFFSET(_gloffset_Frustum)) + JZ(GLNAME(_glapi_fallback_Rects)) + JMP(GL_OFFSET(_gloffset_Rects)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenLists)) -GL_PREFIX(GenLists): +GLOBL_FN(GL_PREFIX(Rectsv)) +GL_PREFIX(Rectsv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenLists)) - JMP(GL_OFFSET(_gloffset_GenLists)) + JZ(GLNAME(_glapi_fallback_Rectsv)) + JMP(GL_OFFSET(_gloffset_Rectsv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetBooleanv)) -GL_PREFIX(GetBooleanv): +GLOBL_FN(GL_PREFIX(TexCoord1d)) +GL_PREFIX(TexCoord1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetBooleanv)) - JMP(GL_OFFSET(_gloffset_GetBooleanv)) + JZ(GLNAME(_glapi_fallback_TexCoord1d)) + JMP(GL_OFFSET(_gloffset_TexCoord1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetClipPlane)) -GL_PREFIX(GetClipPlane): +GLOBL_FN(GL_PREFIX(TexCoord1dv)) +GL_PREFIX(TexCoord1dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetClipPlane)) - JMP(GL_OFFSET(_gloffset_GetClipPlane)) + JZ(GLNAME(_glapi_fallback_TexCoord1dv)) + JMP(GL_OFFSET(_gloffset_TexCoord1dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetDoublev)) -GL_PREFIX(GetDoublev): +GLOBL_FN(GL_PREFIX(TexCoord1f)) +GL_PREFIX(TexCoord1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetDoublev)) - JMP(GL_OFFSET(_gloffset_GetDoublev)) + JZ(GLNAME(_glapi_fallback_TexCoord1f)) + JMP(GL_OFFSET(_gloffset_TexCoord1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetError)) -GL_PREFIX(GetError): +GLOBL_FN(GL_PREFIX(TexCoord1fv)) +GL_PREFIX(TexCoord1fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetError)) - JMP(GL_OFFSET(_gloffset_GetError)) + JZ(GLNAME(_glapi_fallback_TexCoord1fv)) + JMP(GL_OFFSET(_gloffset_TexCoord1fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFloatv)) -GL_PREFIX(GetFloatv): +GLOBL_FN(GL_PREFIX(TexCoord1i)) +GL_PREFIX(TexCoord1i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFloatv)) - JMP(GL_OFFSET(_gloffset_GetFloatv)) + JZ(GLNAME(_glapi_fallback_TexCoord1i)) + JMP(GL_OFFSET(_gloffset_TexCoord1i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetIntegerv)) -GL_PREFIX(GetIntegerv): +GLOBL_FN(GL_PREFIX(TexCoord1iv)) +GL_PREFIX(TexCoord1iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetIntegerv)) - JMP(GL_OFFSET(_gloffset_GetIntegerv)) + JZ(GLNAME(_glapi_fallback_TexCoord1iv)) + JMP(GL_OFFSET(_gloffset_TexCoord1iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetLightfv)) -GL_PREFIX(GetLightfv): +GLOBL_FN(GL_PREFIX(TexCoord1s)) +GL_PREFIX(TexCoord1s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetLightfv)) - JMP(GL_OFFSET(_gloffset_GetLightfv)) + JZ(GLNAME(_glapi_fallback_TexCoord1s)) + JMP(GL_OFFSET(_gloffset_TexCoord1s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetLightiv)) -GL_PREFIX(GetLightiv): +GLOBL_FN(GL_PREFIX(TexCoord1sv)) +GL_PREFIX(TexCoord1sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetLightiv)) - JMP(GL_OFFSET(_gloffset_GetLightiv)) + JZ(GLNAME(_glapi_fallback_TexCoord1sv)) + JMP(GL_OFFSET(_gloffset_TexCoord1sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapdv)) -GL_PREFIX(GetMapdv): +GLOBL_FN(GL_PREFIX(TexCoord2d)) +GL_PREFIX(TexCoord2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapdv)) - JMP(GL_OFFSET(_gloffset_GetMapdv)) + JZ(GLNAME(_glapi_fallback_TexCoord2d)) + JMP(GL_OFFSET(_gloffset_TexCoord2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapfv)) -GL_PREFIX(GetMapfv): +GLOBL_FN(GL_PREFIX(TexCoord2dv)) +GL_PREFIX(TexCoord2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapfv)) - JMP(GL_OFFSET(_gloffset_GetMapfv)) + JZ(GLNAME(_glapi_fallback_TexCoord2dv)) + JMP(GL_OFFSET(_gloffset_TexCoord2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapiv)) -GL_PREFIX(GetMapiv): +GLOBL_FN(GL_PREFIX(TexCoord2f)) +GL_PREFIX(TexCoord2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapiv)) - JMP(GL_OFFSET(_gloffset_GetMapiv)) + JZ(GLNAME(_glapi_fallback_TexCoord2f)) + JMP(GL_OFFSET(_gloffset_TexCoord2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMaterialfv)) -GL_PREFIX(GetMaterialfv): +GLOBL_FN(GL_PREFIX(TexCoord2fv)) +GL_PREFIX(TexCoord2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMaterialfv)) - JMP(GL_OFFSET(_gloffset_GetMaterialfv)) + JZ(GLNAME(_glapi_fallback_TexCoord2fv)) + JMP(GL_OFFSET(_gloffset_TexCoord2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMaterialiv)) -GL_PREFIX(GetMaterialiv): +GLOBL_FN(GL_PREFIX(TexCoord2i)) +GL_PREFIX(TexCoord2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMaterialiv)) - JMP(GL_OFFSET(_gloffset_GetMaterialiv)) + JZ(GLNAME(_glapi_fallback_TexCoord2i)) + JMP(GL_OFFSET(_gloffset_TexCoord2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapfv)) -GL_PREFIX(GetPixelMapfv): +GLOBL_FN(GL_PREFIX(TexCoord2iv)) +GL_PREFIX(TexCoord2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapfv)) - JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) + JZ(GLNAME(_glapi_fallback_TexCoord2iv)) + JMP(GL_OFFSET(_gloffset_TexCoord2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) -GL_PREFIX(GetPixelMapuiv): +GLOBL_FN(GL_PREFIX(TexCoord2s)) +GL_PREFIX(TexCoord2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapuiv)) - JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) + JZ(GLNAME(_glapi_fallback_TexCoord2s)) + JMP(GL_OFFSET(_gloffset_TexCoord2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapusv)) -GL_PREFIX(GetPixelMapusv): +GLOBL_FN(GL_PREFIX(TexCoord2sv)) +GL_PREFIX(TexCoord2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapusv)) - JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) + JZ(GLNAME(_glapi_fallback_TexCoord2sv)) + JMP(GL_OFFSET(_gloffset_TexCoord2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPolygonStipple)) -GL_PREFIX(GetPolygonStipple): +GLOBL_FN(GL_PREFIX(TexCoord3d)) +GL_PREFIX(TexCoord3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPolygonStipple)) - JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) + JZ(GLNAME(_glapi_fallback_TexCoord3d)) + JMP(GL_OFFSET(_gloffset_TexCoord3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetString)) -GL_PREFIX(GetString): +GLOBL_FN(GL_PREFIX(TexCoord3dv)) +GL_PREFIX(TexCoord3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetString)) - JMP(GL_OFFSET(_gloffset_GetString)) + JZ(GLNAME(_glapi_fallback_TexCoord3dv)) + JMP(GL_OFFSET(_gloffset_TexCoord3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexEnvfv)) -GL_PREFIX(GetTexEnvfv): +GLOBL_FN(GL_PREFIX(TexCoord3f)) +GL_PREFIX(TexCoord3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexEnvfv)) - JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) + JZ(GLNAME(_glapi_fallback_TexCoord3f)) + JMP(GL_OFFSET(_gloffset_TexCoord3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexEnviv)) -GL_PREFIX(GetTexEnviv): +GLOBL_FN(GL_PREFIX(TexCoord3fv)) +GL_PREFIX(TexCoord3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexEnviv)) - JMP(GL_OFFSET(_gloffset_GetTexEnviv)) + JZ(GLNAME(_glapi_fallback_TexCoord3fv)) + JMP(GL_OFFSET(_gloffset_TexCoord3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGeniv)) -GL_PREFIX(GetTexGeniv): +GLOBL_FN(GL_PREFIX(TexCoord3i)) +GL_PREFIX(TexCoord3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGeniv)) - JMP(GL_OFFSET(_gloffset_GetTexGeniv)) + JZ(GLNAME(_glapi_fallback_TexCoord3i)) + JMP(GL_OFFSET(_gloffset_TexCoord3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGendv)) -GL_PREFIX(GetTexGendv): +GLOBL_FN(GL_PREFIX(TexCoord3iv)) +GL_PREFIX(TexCoord3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGendv)) - JMP(GL_OFFSET(_gloffset_GetTexGendv)) + JZ(GLNAME(_glapi_fallback_TexCoord3iv)) + JMP(GL_OFFSET(_gloffset_TexCoord3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGenfv)) -GL_PREFIX(GetTexGenfv): +GLOBL_FN(GL_PREFIX(TexCoord3s)) +GL_PREFIX(TexCoord3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGenfv)) - JMP(GL_OFFSET(_gloffset_GetTexGenfv)) + JZ(GLNAME(_glapi_fallback_TexCoord3s)) + JMP(GL_OFFSET(_gloffset_TexCoord3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexImage)) -GL_PREFIX(GetTexImage): +GLOBL_FN(GL_PREFIX(TexCoord3sv)) +GL_PREFIX(TexCoord3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexImage)) - JMP(GL_OFFSET(_gloffset_GetTexImage)) + JZ(GLNAME(_glapi_fallback_TexCoord3sv)) + JMP(GL_OFFSET(_gloffset_TexCoord3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) -GL_PREFIX(GetTexLevelParameterfv): +GLOBL_FN(GL_PREFIX(TexCoord4d)) +GL_PREFIX(TexCoord4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexLevelParameterfv)) - JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) + JZ(GLNAME(_glapi_fallback_TexCoord4d)) + JMP(GL_OFFSET(_gloffset_TexCoord4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) -GL_PREFIX(GetTexLevelParameteriv): +GLOBL_FN(GL_PREFIX(TexCoord4dv)) +GL_PREFIX(TexCoord4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexLevelParameteriv)) - JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) + JZ(GLNAME(_glapi_fallback_TexCoord4dv)) + JMP(GL_OFFSET(_gloffset_TexCoord4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexParameterfv)) -GL_PREFIX(GetTexParameterfv): +GLOBL_FN(GL_PREFIX(TexCoord4f)) +GL_PREFIX(TexCoord4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexParameterfv)) - JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) + JZ(GLNAME(_glapi_fallback_TexCoord4f)) + JMP(GL_OFFSET(_gloffset_TexCoord4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexParameteriv)) -GL_PREFIX(GetTexParameteriv): +GLOBL_FN(GL_PREFIX(TexCoord4fv)) +GL_PREFIX(TexCoord4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexParameteriv)) - JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) + JZ(GLNAME(_glapi_fallback_TexCoord4fv)) + JMP(GL_OFFSET(_gloffset_TexCoord4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Hint)) -GL_PREFIX(Hint): +GLOBL_FN(GL_PREFIX(TexCoord4i)) +GL_PREFIX(TexCoord4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Hint)) - JMP(GL_OFFSET(_gloffset_Hint)) + JZ(GLNAME(_glapi_fallback_TexCoord4i)) + JMP(GL_OFFSET(_gloffset_TexCoord4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexd)) -GL_PREFIX(Indexd): +GLOBL_FN(GL_PREFIX(TexCoord4iv)) +GL_PREFIX(TexCoord4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexd)) - JMP(GL_OFFSET(_gloffset_Indexd)) + JZ(GLNAME(_glapi_fallback_TexCoord4iv)) + JMP(GL_OFFSET(_gloffset_TexCoord4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexdv)) -GL_PREFIX(Indexdv): +GLOBL_FN(GL_PREFIX(TexCoord4s)) +GL_PREFIX(TexCoord4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexdv)) - JMP(GL_OFFSET(_gloffset_Indexdv)) + JZ(GLNAME(_glapi_fallback_TexCoord4s)) + JMP(GL_OFFSET(_gloffset_TexCoord4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexf)) -GL_PREFIX(Indexf): +GLOBL_FN(GL_PREFIX(TexCoord4sv)) +GL_PREFIX(TexCoord4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexf)) - JMP(GL_OFFSET(_gloffset_Indexf)) + JZ(GLNAME(_glapi_fallback_TexCoord4sv)) + JMP(GL_OFFSET(_gloffset_TexCoord4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexfv)) -GL_PREFIX(Indexfv): +GLOBL_FN(GL_PREFIX(Vertex2d)) +GL_PREFIX(Vertex2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexfv)) - JMP(GL_OFFSET(_gloffset_Indexfv)) + JZ(GLNAME(_glapi_fallback_Vertex2d)) + JMP(GL_OFFSET(_gloffset_Vertex2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexi)) -GL_PREFIX(Indexi): +GLOBL_FN(GL_PREFIX(Vertex2dv)) +GL_PREFIX(Vertex2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexi)) - JMP(GL_OFFSET(_gloffset_Indexi)) + JZ(GLNAME(_glapi_fallback_Vertex2dv)) + JMP(GL_OFFSET(_gloffset_Vertex2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexiv)) -GL_PREFIX(Indexiv): +GLOBL_FN(GL_PREFIX(Vertex2f)) +GL_PREFIX(Vertex2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexiv)) - JMP(GL_OFFSET(_gloffset_Indexiv)) + JZ(GLNAME(_glapi_fallback_Vertex2f)) + JMP(GL_OFFSET(_gloffset_Vertex2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexs)) -GL_PREFIX(Indexs): +GLOBL_FN(GL_PREFIX(Vertex2fv)) +GL_PREFIX(Vertex2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexs)) - JMP(GL_OFFSET(_gloffset_Indexs)) + JZ(GLNAME(_glapi_fallback_Vertex2fv)) + JMP(GL_OFFSET(_gloffset_Vertex2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexsv)) -GL_PREFIX(Indexsv): +GLOBL_FN(GL_PREFIX(Vertex2i)) +GL_PREFIX(Vertex2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexsv)) - JMP(GL_OFFSET(_gloffset_Indexsv)) + JZ(GLNAME(_glapi_fallback_Vertex2i)) + JMP(GL_OFFSET(_gloffset_Vertex2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexMask)) -GL_PREFIX(IndexMask): +GLOBL_FN(GL_PREFIX(Vertex2iv)) +GL_PREFIX(Vertex2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexMask)) - JMP(GL_OFFSET(_gloffset_IndexMask)) + JZ(GLNAME(_glapi_fallback_Vertex2iv)) + JMP(GL_OFFSET(_gloffset_Vertex2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InitNames)) -GL_PREFIX(InitNames): +GLOBL_FN(GL_PREFIX(Vertex2s)) +GL_PREFIX(Vertex2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InitNames)) - JMP(GL_OFFSET(_gloffset_InitNames)) + JZ(GLNAME(_glapi_fallback_Vertex2s)) + JMP(GL_OFFSET(_gloffset_Vertex2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsEnabled)) -GL_PREFIX(IsEnabled): +GLOBL_FN(GL_PREFIX(Vertex2sv)) +GL_PREFIX(Vertex2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsEnabled)) - JMP(GL_OFFSET(_gloffset_IsEnabled)) + JZ(GLNAME(_glapi_fallback_Vertex2sv)) + JMP(GL_OFFSET(_gloffset_Vertex2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsList)) -GL_PREFIX(IsList): +GLOBL_FN(GL_PREFIX(Vertex3d)) +GL_PREFIX(Vertex3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsList)) - JMP(GL_OFFSET(_gloffset_IsList)) + JZ(GLNAME(_glapi_fallback_Vertex3d)) + JMP(GL_OFFSET(_gloffset_Vertex3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightf)) -GL_PREFIX(Lightf): +GLOBL_FN(GL_PREFIX(Vertex3dv)) +GL_PREFIX(Vertex3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightf)) - JMP(GL_OFFSET(_gloffset_Lightf)) + JZ(GLNAME(_glapi_fallback_Vertex3dv)) + JMP(GL_OFFSET(_gloffset_Vertex3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lighti)) -GL_PREFIX(Lighti): +GLOBL_FN(GL_PREFIX(Vertex3f)) +GL_PREFIX(Vertex3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lighti)) - JMP(GL_OFFSET(_gloffset_Lighti)) + JZ(GLNAME(_glapi_fallback_Vertex3f)) + JMP(GL_OFFSET(_gloffset_Vertex3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightfv)) -GL_PREFIX(Lightfv): +GLOBL_FN(GL_PREFIX(Vertex3fv)) +GL_PREFIX(Vertex3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightfv)) - JMP(GL_OFFSET(_gloffset_Lightfv)) + JZ(GLNAME(_glapi_fallback_Vertex3fv)) + JMP(GL_OFFSET(_gloffset_Vertex3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightiv)) -GL_PREFIX(Lightiv): +GLOBL_FN(GL_PREFIX(Vertex3i)) +GL_PREFIX(Vertex3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightiv)) - JMP(GL_OFFSET(_gloffset_Lightiv)) + JZ(GLNAME(_glapi_fallback_Vertex3i)) + JMP(GL_OFFSET(_gloffset_Vertex3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModelf)) -GL_PREFIX(LightModelf): +GLOBL_FN(GL_PREFIX(Vertex3iv)) +GL_PREFIX(Vertex3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModelf)) - JMP(GL_OFFSET(_gloffset_LightModelf)) + JZ(GLNAME(_glapi_fallback_Vertex3iv)) + JMP(GL_OFFSET(_gloffset_Vertex3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModeli)) -GL_PREFIX(LightModeli): +GLOBL_FN(GL_PREFIX(Vertex3s)) +GL_PREFIX(Vertex3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModeli)) - JMP(GL_OFFSET(_gloffset_LightModeli)) + JZ(GLNAME(_glapi_fallback_Vertex3s)) + JMP(GL_OFFSET(_gloffset_Vertex3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModelfv)) -GL_PREFIX(LightModelfv): +GLOBL_FN(GL_PREFIX(Vertex3sv)) +GL_PREFIX(Vertex3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModelfv)) - JMP(GL_OFFSET(_gloffset_LightModelfv)) + JZ(GLNAME(_glapi_fallback_Vertex3sv)) + JMP(GL_OFFSET(_gloffset_Vertex3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModeliv)) -GL_PREFIX(LightModeliv): +GLOBL_FN(GL_PREFIX(Vertex4d)) +GL_PREFIX(Vertex4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModeliv)) - JMP(GL_OFFSET(_gloffset_LightModeliv)) + JZ(GLNAME(_glapi_fallback_Vertex4d)) + JMP(GL_OFFSET(_gloffset_Vertex4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LineWidth)) -GL_PREFIX(LineWidth): +GLOBL_FN(GL_PREFIX(Vertex4dv)) +GL_PREFIX(Vertex4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LineWidth)) - JMP(GL_OFFSET(_gloffset_LineWidth)) + JZ(GLNAME(_glapi_fallback_Vertex4dv)) + JMP(GL_OFFSET(_gloffset_Vertex4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LineStipple)) -GL_PREFIX(LineStipple): +GLOBL_FN(GL_PREFIX(Vertex4f)) +GL_PREFIX(Vertex4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LineStipple)) - JMP(GL_OFFSET(_gloffset_LineStipple)) + JZ(GLNAME(_glapi_fallback_Vertex4f)) + JMP(GL_OFFSET(_gloffset_Vertex4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListBase)) -GL_PREFIX(ListBase): +GLOBL_FN(GL_PREFIX(Vertex4fv)) +GL_PREFIX(Vertex4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListBase)) - JMP(GL_OFFSET(_gloffset_ListBase)) + JZ(GLNAME(_glapi_fallback_Vertex4fv)) + JMP(GL_OFFSET(_gloffset_Vertex4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadIdentity)) -GL_PREFIX(LoadIdentity): +GLOBL_FN(GL_PREFIX(Vertex4i)) +GL_PREFIX(Vertex4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadIdentity)) - JMP(GL_OFFSET(_gloffset_LoadIdentity)) + JZ(GLNAME(_glapi_fallback_Vertex4i)) + JMP(GL_OFFSET(_gloffset_Vertex4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadMatrixd)) -GL_PREFIX(LoadMatrixd): +GLOBL_FN(GL_PREFIX(Vertex4iv)) +GL_PREFIX(Vertex4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadMatrixd)) - JMP(GL_OFFSET(_gloffset_LoadMatrixd)) + JZ(GLNAME(_glapi_fallback_Vertex4iv)) + JMP(GL_OFFSET(_gloffset_Vertex4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadMatrixf)) -GL_PREFIX(LoadMatrixf): +GLOBL_FN(GL_PREFIX(Vertex4s)) +GL_PREFIX(Vertex4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadMatrixf)) - JMP(GL_OFFSET(_gloffset_LoadMatrixf)) + JZ(GLNAME(_glapi_fallback_Vertex4s)) + JMP(GL_OFFSET(_gloffset_Vertex4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadName)) -GL_PREFIX(LoadName): +GLOBL_FN(GL_PREFIX(Vertex4sv)) +GL_PREFIX(Vertex4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadName)) - JMP(GL_OFFSET(_gloffset_LoadName)) + JZ(GLNAME(_glapi_fallback_Vertex4sv)) + JMP(GL_OFFSET(_gloffset_Vertex4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LogicOp)) -GL_PREFIX(LogicOp): +GLOBL_FN(GL_PREFIX(ClipPlane)) +GL_PREFIX(ClipPlane): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LogicOp)) - JMP(GL_OFFSET(_gloffset_LogicOp)) + JZ(GLNAME(_glapi_fallback_ClipPlane)) + JMP(GL_OFFSET(_gloffset_ClipPlane)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map1d)) -GL_PREFIX(Map1d): +GLOBL_FN(GL_PREFIX(ColorMaterial)) +GL_PREFIX(ColorMaterial): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map1d)) - JMP(GL_OFFSET(_gloffset_Map1d)) + JZ(GLNAME(_glapi_fallback_ColorMaterial)) + JMP(GL_OFFSET(_gloffset_ColorMaterial)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map1f)) -GL_PREFIX(Map1f): +GLOBL_FN(GL_PREFIX(CullFace)) +GL_PREFIX(CullFace): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map1f)) - JMP(GL_OFFSET(_gloffset_Map1f)) + JZ(GLNAME(_glapi_fallback_CullFace)) + JMP(GL_OFFSET(_gloffset_CullFace)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map2d)) -GL_PREFIX(Map2d): +GLOBL_FN(GL_PREFIX(Fogf)) +GL_PREFIX(Fogf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map2d)) - JMP(GL_OFFSET(_gloffset_Map2d)) + JZ(GLNAME(_glapi_fallback_Fogf)) + JMP(GL_OFFSET(_gloffset_Fogf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map2f)) -GL_PREFIX(Map2f): +GLOBL_FN(GL_PREFIX(Fogfv)) +GL_PREFIX(Fogfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map2f)) - JMP(GL_OFFSET(_gloffset_Map2f)) + JZ(GLNAME(_glapi_fallback_Fogfv)) + JMP(GL_OFFSET(_gloffset_Fogfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid1d)) -GL_PREFIX(MapGrid1d): +GLOBL_FN(GL_PREFIX(Fogi)) +GL_PREFIX(Fogi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid1d)) - JMP(GL_OFFSET(_gloffset_MapGrid1d)) + JZ(GLNAME(_glapi_fallback_Fogi)) + JMP(GL_OFFSET(_gloffset_Fogi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid1f)) -GL_PREFIX(MapGrid1f): +GLOBL_FN(GL_PREFIX(Fogiv)) +GL_PREFIX(Fogiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid1f)) - JMP(GL_OFFSET(_gloffset_MapGrid1f)) + JZ(GLNAME(_glapi_fallback_Fogiv)) + JMP(GL_OFFSET(_gloffset_Fogiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid2d)) -GL_PREFIX(MapGrid2d): +GLOBL_FN(GL_PREFIX(FrontFace)) +GL_PREFIX(FrontFace): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid2d)) - JMP(GL_OFFSET(_gloffset_MapGrid2d)) + JZ(GLNAME(_glapi_fallback_FrontFace)) + JMP(GL_OFFSET(_gloffset_FrontFace)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid2f)) -GL_PREFIX(MapGrid2f): +GLOBL_FN(GL_PREFIX(Hint)) +GL_PREFIX(Hint): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid2f)) - JMP(GL_OFFSET(_gloffset_MapGrid2f)) + JZ(GLNAME(_glapi_fallback_Hint)) + JMP(GL_OFFSET(_gloffset_Hint)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialf)) -GL_PREFIX(Materialf): +GLOBL_FN(GL_PREFIX(Lightf)) +GL_PREFIX(Lightf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialf)) - JMP(GL_OFFSET(_gloffset_Materialf)) + JZ(GLNAME(_glapi_fallback_Lightf)) + JMP(GL_OFFSET(_gloffset_Lightf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materiali)) -GL_PREFIX(Materiali): +GLOBL_FN(GL_PREFIX(Lightfv)) +GL_PREFIX(Lightfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materiali)) - JMP(GL_OFFSET(_gloffset_Materiali)) + JZ(GLNAME(_glapi_fallback_Lightfv)) + JMP(GL_OFFSET(_gloffset_Lightfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialfv)) -GL_PREFIX(Materialfv): +GLOBL_FN(GL_PREFIX(Lighti)) +GL_PREFIX(Lighti): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialfv)) - JMP(GL_OFFSET(_gloffset_Materialfv)) + JZ(GLNAME(_glapi_fallback_Lighti)) + JMP(GL_OFFSET(_gloffset_Lighti)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialiv)) -GL_PREFIX(Materialiv): +GLOBL_FN(GL_PREFIX(Lightiv)) +GL_PREFIX(Lightiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialiv)) - JMP(GL_OFFSET(_gloffset_Materialiv)) + JZ(GLNAME(_glapi_fallback_Lightiv)) + JMP(GL_OFFSET(_gloffset_Lightiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MatrixMode)) -GL_PREFIX(MatrixMode): +GLOBL_FN(GL_PREFIX(LightModelf)) +GL_PREFIX(LightModelf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MatrixMode)) - JMP(GL_OFFSET(_gloffset_MatrixMode)) + JZ(GLNAME(_glapi_fallback_LightModelf)) + JMP(GL_OFFSET(_gloffset_LightModelf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultMatrixd)) -GL_PREFIX(MultMatrixd): +GLOBL_FN(GL_PREFIX(LightModelfv)) +GL_PREFIX(LightModelfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultMatrixd)) - JMP(GL_OFFSET(_gloffset_MultMatrixd)) + JZ(GLNAME(_glapi_fallback_LightModelfv)) + JMP(GL_OFFSET(_gloffset_LightModelfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultMatrixf)) -GL_PREFIX(MultMatrixf): +GLOBL_FN(GL_PREFIX(LightModeli)) +GL_PREFIX(LightModeli): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultMatrixf)) - JMP(GL_OFFSET(_gloffset_MultMatrixf)) + JZ(GLNAME(_glapi_fallback_LightModeli)) + JMP(GL_OFFSET(_gloffset_LightModeli)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NewList)) -GL_PREFIX(NewList): +GLOBL_FN(GL_PREFIX(LightModeliv)) +GL_PREFIX(LightModeliv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NewList)) - JMP(GL_OFFSET(_gloffset_NewList)) + JZ(GLNAME(_glapi_fallback_LightModeliv)) + JMP(GL_OFFSET(_gloffset_LightModeliv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3b)) -GL_PREFIX(Normal3b): +GLOBL_FN(GL_PREFIX(LineStipple)) +GL_PREFIX(LineStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3b)) - JMP(GL_OFFSET(_gloffset_Normal3b)) + JZ(GLNAME(_glapi_fallback_LineStipple)) + JMP(GL_OFFSET(_gloffset_LineStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3bv)) -GL_PREFIX(Normal3bv): +GLOBL_FN(GL_PREFIX(LineWidth)) +GL_PREFIX(LineWidth): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3bv)) - JMP(GL_OFFSET(_gloffset_Normal3bv)) + JZ(GLNAME(_glapi_fallback_LineWidth)) + JMP(GL_OFFSET(_gloffset_LineWidth)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3d)) -GL_PREFIX(Normal3d): +GLOBL_FN(GL_PREFIX(Materialf)) +GL_PREFIX(Materialf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3d)) - JMP(GL_OFFSET(_gloffset_Normal3d)) + JZ(GLNAME(_glapi_fallback_Materialf)) + JMP(GL_OFFSET(_gloffset_Materialf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3dv)) -GL_PREFIX(Normal3dv): +GLOBL_FN(GL_PREFIX(Materialfv)) +GL_PREFIX(Materialfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3dv)) - JMP(GL_OFFSET(_gloffset_Normal3dv)) + JZ(GLNAME(_glapi_fallback_Materialfv)) + JMP(GL_OFFSET(_gloffset_Materialfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3f)) -GL_PREFIX(Normal3f): +GLOBL_FN(GL_PREFIX(Materiali)) +GL_PREFIX(Materiali): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3f)) - JMP(GL_OFFSET(_gloffset_Normal3f)) + JZ(GLNAME(_glapi_fallback_Materiali)) + JMP(GL_OFFSET(_gloffset_Materiali)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3fv)) -GL_PREFIX(Normal3fv): +GLOBL_FN(GL_PREFIX(Materialiv)) +GL_PREFIX(Materialiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3fv)) - JMP(GL_OFFSET(_gloffset_Normal3fv)) + JZ(GLNAME(_glapi_fallback_Materialiv)) + JMP(GL_OFFSET(_gloffset_Materialiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3i)) -GL_PREFIX(Normal3i): +GLOBL_FN(GL_PREFIX(PointSize)) +GL_PREFIX(PointSize): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3i)) - JMP(GL_OFFSET(_gloffset_Normal3i)) + JZ(GLNAME(_glapi_fallback_PointSize)) + JMP(GL_OFFSET(_gloffset_PointSize)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3iv)) -GL_PREFIX(Normal3iv): +GLOBL_FN(GL_PREFIX(PolygonMode)) +GL_PREFIX(PolygonMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3iv)) - JMP(GL_OFFSET(_gloffset_Normal3iv)) + JZ(GLNAME(_glapi_fallback_PolygonMode)) + JMP(GL_OFFSET(_gloffset_PolygonMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3s)) -GL_PREFIX(Normal3s): +GLOBL_FN(GL_PREFIX(PolygonStipple)) +GL_PREFIX(PolygonStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3s)) - JMP(GL_OFFSET(_gloffset_Normal3s)) + JZ(GLNAME(_glapi_fallback_PolygonStipple)) + JMP(GL_OFFSET(_gloffset_PolygonStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3sv)) -GL_PREFIX(Normal3sv): +GLOBL_FN(GL_PREFIX(Scissor)) +GL_PREFIX(Scissor): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3sv)) - JMP(GL_OFFSET(_gloffset_Normal3sv)) + JZ(GLNAME(_glapi_fallback_Scissor)) + JMP(GL_OFFSET(_gloffset_Scissor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Ortho)) -GL_PREFIX(Ortho): +GLOBL_FN(GL_PREFIX(ShadeModel)) +GL_PREFIX(ShadeModel): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Ortho)) - JMP(GL_OFFSET(_gloffset_Ortho)) + JZ(GLNAME(_glapi_fallback_ShadeModel)) + JMP(GL_OFFSET(_gloffset_ShadeModel)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PassThrough)) -GL_PREFIX(PassThrough): +GLOBL_FN(GL_PREFIX(TexParameterf)) +GL_PREFIX(TexParameterf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PassThrough)) - JMP(GL_OFFSET(_gloffset_PassThrough)) + JZ(GLNAME(_glapi_fallback_TexParameterf)) + JMP(GL_OFFSET(_gloffset_TexParameterf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapfv)) -GL_PREFIX(PixelMapfv): +GLOBL_FN(GL_PREFIX(TexParameterfv)) +GL_PREFIX(TexParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapfv)) - JMP(GL_OFFSET(_gloffset_PixelMapfv)) + JZ(GLNAME(_glapi_fallback_TexParameterfv)) + JMP(GL_OFFSET(_gloffset_TexParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapuiv)) -GL_PREFIX(PixelMapuiv): +GLOBL_FN(GL_PREFIX(TexParameteri)) +GL_PREFIX(TexParameteri): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapuiv)) - JMP(GL_OFFSET(_gloffset_PixelMapuiv)) + JZ(GLNAME(_glapi_fallback_TexParameteri)) + JMP(GL_OFFSET(_gloffset_TexParameteri)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapusv)) -GL_PREFIX(PixelMapusv): +GLOBL_FN(GL_PREFIX(TexParameteriv)) +GL_PREFIX(TexParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapusv)) - JMP(GL_OFFSET(_gloffset_PixelMapusv)) + JZ(GLNAME(_glapi_fallback_TexParameteriv)) + JMP(GL_OFFSET(_gloffset_TexParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelStoref)) -GL_PREFIX(PixelStoref): +GLOBL_FN(GL_PREFIX(TexImage1D)) +GL_PREFIX(TexImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelStoref)) - JMP(GL_OFFSET(_gloffset_PixelStoref)) + JZ(GLNAME(_glapi_fallback_TexImage1D)) + JMP(GL_OFFSET(_gloffset_TexImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelStorei)) -GL_PREFIX(PixelStorei): +GLOBL_FN(GL_PREFIX(TexImage2D)) +GL_PREFIX(TexImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelStorei)) - JMP(GL_OFFSET(_gloffset_PixelStorei)) + JZ(GLNAME(_glapi_fallback_TexImage2D)) + JMP(GL_OFFSET(_gloffset_TexImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTransferf)) -GL_PREFIX(PixelTransferf): +GLOBL_FN(GL_PREFIX(TexEnvf)) +GL_PREFIX(TexEnvf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTransferf)) - JMP(GL_OFFSET(_gloffset_PixelTransferf)) + JZ(GLNAME(_glapi_fallback_TexEnvf)) + JMP(GL_OFFSET(_gloffset_TexEnvf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTransferi)) -GL_PREFIX(PixelTransferi): +GLOBL_FN(GL_PREFIX(TexEnvfv)) +GL_PREFIX(TexEnvfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTransferi)) - JMP(GL_OFFSET(_gloffset_PixelTransferi)) + JZ(GLNAME(_glapi_fallback_TexEnvfv)) + JMP(GL_OFFSET(_gloffset_TexEnvfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelZoom)) -GL_PREFIX(PixelZoom): +GLOBL_FN(GL_PREFIX(TexEnvi)) +GL_PREFIX(TexEnvi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelZoom)) - JMP(GL_OFFSET(_gloffset_PixelZoom)) + JZ(GLNAME(_glapi_fallback_TexEnvi)) + JMP(GL_OFFSET(_gloffset_TexEnvi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointSize)) -GL_PREFIX(PointSize): +GLOBL_FN(GL_PREFIX(TexEnviv)) +GL_PREFIX(TexEnviv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointSize)) - JMP(GL_OFFSET(_gloffset_PointSize)) + JZ(GLNAME(_glapi_fallback_TexEnviv)) + JMP(GL_OFFSET(_gloffset_TexEnviv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonMode)) -GL_PREFIX(PolygonMode): +GLOBL_FN(GL_PREFIX(TexGend)) +GL_PREFIX(TexGend): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonMode)) - JMP(GL_OFFSET(_gloffset_PolygonMode)) + JZ(GLNAME(_glapi_fallback_TexGend)) + JMP(GL_OFFSET(_gloffset_TexGend)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonStipple)) -GL_PREFIX(PolygonStipple): +GLOBL_FN(GL_PREFIX(TexGendv)) +GL_PREFIX(TexGendv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonStipple)) - JMP(GL_OFFSET(_gloffset_PolygonStipple)) + JZ(GLNAME(_glapi_fallback_TexGendv)) + JMP(GL_OFFSET(_gloffset_TexGendv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopAttrib)) -GL_PREFIX(PopAttrib): +GLOBL_FN(GL_PREFIX(TexGenf)) +GL_PREFIX(TexGenf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopAttrib)) - JMP(GL_OFFSET(_gloffset_PopAttrib)) + JZ(GLNAME(_glapi_fallback_TexGenf)) + JMP(GL_OFFSET(_gloffset_TexGenf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopMatrix)) -GL_PREFIX(PopMatrix): +GLOBL_FN(GL_PREFIX(TexGenfv)) +GL_PREFIX(TexGenfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopMatrix)) - JMP(GL_OFFSET(_gloffset_PopMatrix)) + JZ(GLNAME(_glapi_fallback_TexGenfv)) + JMP(GL_OFFSET(_gloffset_TexGenfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopName)) -GL_PREFIX(PopName): +GLOBL_FN(GL_PREFIX(TexGeni)) +GL_PREFIX(TexGeni): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopName)) - JMP(GL_OFFSET(_gloffset_PopName)) + JZ(GLNAME(_glapi_fallback_TexGeni)) + JMP(GL_OFFSET(_gloffset_TexGeni)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushAttrib)) -GL_PREFIX(PushAttrib): +GLOBL_FN(GL_PREFIX(TexGeniv)) +GL_PREFIX(TexGeniv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushAttrib)) - JMP(GL_OFFSET(_gloffset_PushAttrib)) + JZ(GLNAME(_glapi_fallback_TexGeniv)) + JMP(GL_OFFSET(_gloffset_TexGeniv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushMatrix)) -GL_PREFIX(PushMatrix): +GLOBL_FN(GL_PREFIX(FeedbackBuffer)) +GL_PREFIX(FeedbackBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushMatrix)) - JMP(GL_OFFSET(_gloffset_PushMatrix)) + JZ(GLNAME(_glapi_fallback_FeedbackBuffer)) + JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushName)) -GL_PREFIX(PushName): +GLOBL_FN(GL_PREFIX(SelectBuffer)) +GL_PREFIX(SelectBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushName)) - JMP(GL_OFFSET(_gloffset_PushName)) + JZ(GLNAME(_glapi_fallback_SelectBuffer)) + JMP(GL_OFFSET(_gloffset_SelectBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2d)) -GL_PREFIX(RasterPos2d): +GLOBL_FN(GL_PREFIX(RenderMode)) +GL_PREFIX(RenderMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2d)) - JMP(GL_OFFSET(_gloffset_RasterPos2d)) + JZ(GLNAME(_glapi_fallback_RenderMode)) + JMP(GL_OFFSET(_gloffset_RenderMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2f)) -GL_PREFIX(RasterPos2f): +GLOBL_FN(GL_PREFIX(InitNames)) +GL_PREFIX(InitNames): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2f)) - JMP(GL_OFFSET(_gloffset_RasterPos2f)) + JZ(GLNAME(_glapi_fallback_InitNames)) + JMP(GL_OFFSET(_gloffset_InitNames)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2i)) -GL_PREFIX(RasterPos2i): +GLOBL_FN(GL_PREFIX(LoadName)) +GL_PREFIX(LoadName): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2i)) - JMP(GL_OFFSET(_gloffset_RasterPos2i)) + JZ(GLNAME(_glapi_fallback_LoadName)) + JMP(GL_OFFSET(_gloffset_LoadName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2s)) -GL_PREFIX(RasterPos2s): +GLOBL_FN(GL_PREFIX(PassThrough)) +GL_PREFIX(PassThrough): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2s)) - JMP(GL_OFFSET(_gloffset_RasterPos2s)) + JZ(GLNAME(_glapi_fallback_PassThrough)) + JMP(GL_OFFSET(_gloffset_PassThrough)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3d)) -GL_PREFIX(RasterPos3d): +GLOBL_FN(GL_PREFIX(PopName)) +GL_PREFIX(PopName): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3d)) - JMP(GL_OFFSET(_gloffset_RasterPos3d)) + JZ(GLNAME(_glapi_fallback_PopName)) + JMP(GL_OFFSET(_gloffset_PopName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3f)) -GL_PREFIX(RasterPos3f): +GLOBL_FN(GL_PREFIX(PushName)) +GL_PREFIX(PushName): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3f)) - JMP(GL_OFFSET(_gloffset_RasterPos3f)) + JZ(GLNAME(_glapi_fallback_PushName)) + JMP(GL_OFFSET(_gloffset_PushName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3i)) -GL_PREFIX(RasterPos3i): +GLOBL_FN(GL_PREFIX(DrawBuffer)) +GL_PREFIX(DrawBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3i)) - JMP(GL_OFFSET(_gloffset_RasterPos3i)) + JZ(GLNAME(_glapi_fallback_DrawBuffer)) + JMP(GL_OFFSET(_gloffset_DrawBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3s)) -GL_PREFIX(RasterPos3s): +GLOBL_FN(GL_PREFIX(Clear)) +GL_PREFIX(Clear): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3s)) - JMP(GL_OFFSET(_gloffset_RasterPos3s)) + JZ(GLNAME(_glapi_fallback_Clear)) + JMP(GL_OFFSET(_gloffset_Clear)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4d)) -GL_PREFIX(RasterPos4d): +GLOBL_FN(GL_PREFIX(ClearAccum)) +GL_PREFIX(ClearAccum): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4d)) - JMP(GL_OFFSET(_gloffset_RasterPos4d)) + JZ(GLNAME(_glapi_fallback_ClearAccum)) + JMP(GL_OFFSET(_gloffset_ClearAccum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4f)) -GL_PREFIX(RasterPos4f): +GLOBL_FN(GL_PREFIX(ClearIndex)) +GL_PREFIX(ClearIndex): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4f)) - JMP(GL_OFFSET(_gloffset_RasterPos4f)) + JZ(GLNAME(_glapi_fallback_ClearIndex)) + JMP(GL_OFFSET(_gloffset_ClearIndex)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4i)) -GL_PREFIX(RasterPos4i): +GLOBL_FN(GL_PREFIX(ClearColor)) +GL_PREFIX(ClearColor): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4i)) - JMP(GL_OFFSET(_gloffset_RasterPos4i)) + JZ(GLNAME(_glapi_fallback_ClearColor)) + JMP(GL_OFFSET(_gloffset_ClearColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4s)) -GL_PREFIX(RasterPos4s): +GLOBL_FN(GL_PREFIX(ClearStencil)) +GL_PREFIX(ClearStencil): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4s)) - JMP(GL_OFFSET(_gloffset_RasterPos4s)) + JZ(GLNAME(_glapi_fallback_ClearStencil)) + JMP(GL_OFFSET(_gloffset_ClearStencil)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2dv)) -GL_PREFIX(RasterPos2dv): +GLOBL_FN(GL_PREFIX(ClearDepth)) +GL_PREFIX(ClearDepth): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2dv)) - JMP(GL_OFFSET(_gloffset_RasterPos2dv)) + JZ(GLNAME(_glapi_fallback_ClearDepth)) + JMP(GL_OFFSET(_gloffset_ClearDepth)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2fv)) -GL_PREFIX(RasterPos2fv): +GLOBL_FN(GL_PREFIX(StencilMask)) +GL_PREFIX(StencilMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2fv)) - JMP(GL_OFFSET(_gloffset_RasterPos2fv)) + JZ(GLNAME(_glapi_fallback_StencilMask)) + JMP(GL_OFFSET(_gloffset_StencilMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2iv)) -GL_PREFIX(RasterPos2iv): +GLOBL_FN(GL_PREFIX(ColorMask)) +GL_PREFIX(ColorMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2iv)) - JMP(GL_OFFSET(_gloffset_RasterPos2iv)) + JZ(GLNAME(_glapi_fallback_ColorMask)) + JMP(GL_OFFSET(_gloffset_ColorMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2sv)) -GL_PREFIX(RasterPos2sv): +GLOBL_FN(GL_PREFIX(DepthMask)) +GL_PREFIX(DepthMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2sv)) - JMP(GL_OFFSET(_gloffset_RasterPos2sv)) + JZ(GLNAME(_glapi_fallback_DepthMask)) + JMP(GL_OFFSET(_gloffset_DepthMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3dv)) -GL_PREFIX(RasterPos3dv): +GLOBL_FN(GL_PREFIX(IndexMask)) +GL_PREFIX(IndexMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3dv)) - JMP(GL_OFFSET(_gloffset_RasterPos3dv)) + JZ(GLNAME(_glapi_fallback_IndexMask)) + JMP(GL_OFFSET(_gloffset_IndexMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3fv)) -GL_PREFIX(RasterPos3fv): +GLOBL_FN(GL_PREFIX(Accum)) +GL_PREFIX(Accum): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3fv)) - JMP(GL_OFFSET(_gloffset_RasterPos3fv)) + JZ(GLNAME(_glapi_fallback_Accum)) + JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3iv)) -GL_PREFIX(RasterPos3iv): +GLOBL_FN(GL_PREFIX(Disable)) +GL_PREFIX(Disable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3iv)) - JMP(GL_OFFSET(_gloffset_RasterPos3iv)) + JZ(GLNAME(_glapi_fallback_Disable)) + JMP(GL_OFFSET(_gloffset_Disable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3sv)) -GL_PREFIX(RasterPos3sv): +GLOBL_FN(GL_PREFIX(Enable)) +GL_PREFIX(Enable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3sv)) - JMP(GL_OFFSET(_gloffset_RasterPos3sv)) + JZ(GLNAME(_glapi_fallback_Enable)) + JMP(GL_OFFSET(_gloffset_Enable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4dv)) -GL_PREFIX(RasterPos4dv): +GLOBL_FN(GL_PREFIX(Finish)) +GL_PREFIX(Finish): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4dv)) - JMP(GL_OFFSET(_gloffset_RasterPos4dv)) + JZ(GLNAME(_glapi_fallback_Finish)) + JMP(GL_OFFSET(_gloffset_Finish)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4fv)) -GL_PREFIX(RasterPos4fv): +GLOBL_FN(GL_PREFIX(Flush)) +GL_PREFIX(Flush): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4fv)) - JMP(GL_OFFSET(_gloffset_RasterPos4fv)) + JZ(GLNAME(_glapi_fallback_Flush)) + JMP(GL_OFFSET(_gloffset_Flush)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4iv)) -GL_PREFIX(RasterPos4iv): +GLOBL_FN(GL_PREFIX(PopAttrib)) +GL_PREFIX(PopAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4iv)) - JMP(GL_OFFSET(_gloffset_RasterPos4iv)) + JZ(GLNAME(_glapi_fallback_PopAttrib)) + JMP(GL_OFFSET(_gloffset_PopAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4sv)) -GL_PREFIX(RasterPos4sv): +GLOBL_FN(GL_PREFIX(PushAttrib)) +GL_PREFIX(PushAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4sv)) - JMP(GL_OFFSET(_gloffset_RasterPos4sv)) + JZ(GLNAME(_glapi_fallback_PushAttrib)) + JMP(GL_OFFSET(_gloffset_PushAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadBuffer)) -GL_PREFIX(ReadBuffer): +GLOBL_FN(GL_PREFIX(Map1d)) +GL_PREFIX(Map1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadBuffer)) - JMP(GL_OFFSET(_gloffset_ReadBuffer)) + JZ(GLNAME(_glapi_fallback_Map1d)) + JMP(GL_OFFSET(_gloffset_Map1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadPixels)) -GL_PREFIX(ReadPixels): +GLOBL_FN(GL_PREFIX(Map1f)) +GL_PREFIX(Map1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadPixels)) - JMP(GL_OFFSET(_gloffset_ReadPixels)) + JZ(GLNAME(_glapi_fallback_Map1f)) + JMP(GL_OFFSET(_gloffset_Map1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectd)) -GL_PREFIX(Rectd): +GLOBL_FN(GL_PREFIX(Map2d)) +GL_PREFIX(Map2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectd)) - JMP(GL_OFFSET(_gloffset_Rectd)) + JZ(GLNAME(_glapi_fallback_Map2d)) + JMP(GL_OFFSET(_gloffset_Map2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectdv)) -GL_PREFIX(Rectdv): +GLOBL_FN(GL_PREFIX(Map2f)) +GL_PREFIX(Map2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectdv)) - JMP(GL_OFFSET(_gloffset_Rectdv)) + JZ(GLNAME(_glapi_fallback_Map2f)) + JMP(GL_OFFSET(_gloffset_Map2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectf)) -GL_PREFIX(Rectf): +GLOBL_FN(GL_PREFIX(MapGrid1d)) +GL_PREFIX(MapGrid1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectf)) - JMP(GL_OFFSET(_gloffset_Rectf)) + JZ(GLNAME(_glapi_fallback_MapGrid1d)) + JMP(GL_OFFSET(_gloffset_MapGrid1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectfv)) -GL_PREFIX(Rectfv): +GLOBL_FN(GL_PREFIX(MapGrid1f)) +GL_PREFIX(MapGrid1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectfv)) - JMP(GL_OFFSET(_gloffset_Rectfv)) + JZ(GLNAME(_glapi_fallback_MapGrid1f)) + JMP(GL_OFFSET(_gloffset_MapGrid1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Recti)) -GL_PREFIX(Recti): +GLOBL_FN(GL_PREFIX(MapGrid2d)) +GL_PREFIX(MapGrid2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Recti)) - JMP(GL_OFFSET(_gloffset_Recti)) + JZ(GLNAME(_glapi_fallback_MapGrid2d)) + JMP(GL_OFFSET(_gloffset_MapGrid2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectiv)) -GL_PREFIX(Rectiv): +GLOBL_FN(GL_PREFIX(MapGrid2f)) +GL_PREFIX(MapGrid2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectiv)) - JMP(GL_OFFSET(_gloffset_Rectiv)) + JZ(GLNAME(_glapi_fallback_MapGrid2f)) + JMP(GL_OFFSET(_gloffset_MapGrid2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rects)) -GL_PREFIX(Rects): +GLOBL_FN(GL_PREFIX(EvalCoord1d)) +GL_PREFIX(EvalCoord1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rects)) - JMP(GL_OFFSET(_gloffset_Rects)) + JZ(GLNAME(_glapi_fallback_EvalCoord1d)) + JMP(GL_OFFSET(_gloffset_EvalCoord1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectsv)) -GL_PREFIX(Rectsv): +GLOBL_FN(GL_PREFIX(EvalCoord1dv)) +GL_PREFIX(EvalCoord1dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectsv)) - JMP(GL_OFFSET(_gloffset_Rectsv)) + JZ(GLNAME(_glapi_fallback_EvalCoord1dv)) + JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RenderMode)) -GL_PREFIX(RenderMode): +GLOBL_FN(GL_PREFIX(EvalCoord1f)) +GL_PREFIX(EvalCoord1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RenderMode)) - JMP(GL_OFFSET(_gloffset_RenderMode)) + JZ(GLNAME(_glapi_fallback_EvalCoord1f)) + JMP(GL_OFFSET(_gloffset_EvalCoord1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rotated)) -GL_PREFIX(Rotated): +GLOBL_FN(GL_PREFIX(EvalCoord1fv)) +GL_PREFIX(EvalCoord1fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rotated)) - JMP(GL_OFFSET(_gloffset_Rotated)) + JZ(GLNAME(_glapi_fallback_EvalCoord1fv)) + JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rotatef)) -GL_PREFIX(Rotatef): +GLOBL_FN(GL_PREFIX(EvalCoord2d)) +GL_PREFIX(EvalCoord2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rotatef)) - JMP(GL_OFFSET(_gloffset_Rotatef)) + JZ(GLNAME(_glapi_fallback_EvalCoord2d)) + JMP(GL_OFFSET(_gloffset_EvalCoord2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SelectBuffer)) -GL_PREFIX(SelectBuffer): +GLOBL_FN(GL_PREFIX(EvalCoord2dv)) +GL_PREFIX(EvalCoord2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SelectBuffer)) - JMP(GL_OFFSET(_gloffset_SelectBuffer)) + JZ(GLNAME(_glapi_fallback_EvalCoord2dv)) + JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scaled)) -GL_PREFIX(Scaled): +GLOBL_FN(GL_PREFIX(EvalCoord2f)) +GL_PREFIX(EvalCoord2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scaled)) - JMP(GL_OFFSET(_gloffset_Scaled)) + JZ(GLNAME(_glapi_fallback_EvalCoord2f)) + JMP(GL_OFFSET(_gloffset_EvalCoord2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scalef)) -GL_PREFIX(Scalef): +GLOBL_FN(GL_PREFIX(EvalCoord2fv)) +GL_PREFIX(EvalCoord2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scalef)) - JMP(GL_OFFSET(_gloffset_Scalef)) + JZ(GLNAME(_glapi_fallback_EvalCoord2fv)) + JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scissor)) -GL_PREFIX(Scissor): +GLOBL_FN(GL_PREFIX(EvalMesh1)) +GL_PREFIX(EvalMesh1): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scissor)) - JMP(GL_OFFSET(_gloffset_Scissor)) + JZ(GLNAME(_glapi_fallback_EvalMesh1)) + JMP(GL_OFFSET(_gloffset_EvalMesh1)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ShadeModel)) -GL_PREFIX(ShadeModel): +GLOBL_FN(GL_PREFIX(EvalPoint1)) +GL_PREFIX(EvalPoint1): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ShadeModel)) - JMP(GL_OFFSET(_gloffset_ShadeModel)) + JZ(GLNAME(_glapi_fallback_EvalPoint1)) + JMP(GL_OFFSET(_gloffset_EvalPoint1)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilFunc)) -GL_PREFIX(StencilFunc): +GLOBL_FN(GL_PREFIX(EvalMesh2)) +GL_PREFIX(EvalMesh2): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilFunc)) - JMP(GL_OFFSET(_gloffset_StencilFunc)) + JZ(GLNAME(_glapi_fallback_EvalMesh2)) + JMP(GL_OFFSET(_gloffset_EvalMesh2)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilMask)) -GL_PREFIX(StencilMask): +GLOBL_FN(GL_PREFIX(EvalPoint2)) +GL_PREFIX(EvalPoint2): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilMask)) - JMP(GL_OFFSET(_gloffset_StencilMask)) + JZ(GLNAME(_glapi_fallback_EvalPoint2)) + JMP(GL_OFFSET(_gloffset_EvalPoint2)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilOp)) -GL_PREFIX(StencilOp): +GLOBL_FN(GL_PREFIX(AlphaFunc)) +GL_PREFIX(AlphaFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilOp)) - JMP(GL_OFFSET(_gloffset_StencilOp)) + JZ(GLNAME(_glapi_fallback_AlphaFunc)) + JMP(GL_OFFSET(_gloffset_AlphaFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1d)) -GL_PREFIX(TexCoord1d): +GLOBL_FN(GL_PREFIX(BlendFunc)) +GL_PREFIX(BlendFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1d)) - JMP(GL_OFFSET(_gloffset_TexCoord1d)) + JZ(GLNAME(_glapi_fallback_BlendFunc)) + JMP(GL_OFFSET(_gloffset_BlendFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1f)) -GL_PREFIX(TexCoord1f): +GLOBL_FN(GL_PREFIX(LogicOp)) +GL_PREFIX(LogicOp): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1f)) - JMP(GL_OFFSET(_gloffset_TexCoord1f)) + JZ(GLNAME(_glapi_fallback_LogicOp)) + JMP(GL_OFFSET(_gloffset_LogicOp)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1i)) -GL_PREFIX(TexCoord1i): +GLOBL_FN(GL_PREFIX(StencilFunc)) +GL_PREFIX(StencilFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1i)) - JMP(GL_OFFSET(_gloffset_TexCoord1i)) + JZ(GLNAME(_glapi_fallback_StencilFunc)) + JMP(GL_OFFSET(_gloffset_StencilFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1s)) -GL_PREFIX(TexCoord1s): +GLOBL_FN(GL_PREFIX(StencilOp)) +GL_PREFIX(StencilOp): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1s)) - JMP(GL_OFFSET(_gloffset_TexCoord1s)) + JZ(GLNAME(_glapi_fallback_StencilOp)) + JMP(GL_OFFSET(_gloffset_StencilOp)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2d)) -GL_PREFIX(TexCoord2d): +GLOBL_FN(GL_PREFIX(DepthFunc)) +GL_PREFIX(DepthFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2d)) - JMP(GL_OFFSET(_gloffset_TexCoord2d)) + JZ(GLNAME(_glapi_fallback_DepthFunc)) + JMP(GL_OFFSET(_gloffset_DepthFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2f)) -GL_PREFIX(TexCoord2f): +GLOBL_FN(GL_PREFIX(PixelZoom)) +GL_PREFIX(PixelZoom): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2f)) - JMP(GL_OFFSET(_gloffset_TexCoord2f)) + JZ(GLNAME(_glapi_fallback_PixelZoom)) + JMP(GL_OFFSET(_gloffset_PixelZoom)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2s)) -GL_PREFIX(TexCoord2s): +GLOBL_FN(GL_PREFIX(PixelTransferf)) +GL_PREFIX(PixelTransferf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2s)) - JMP(GL_OFFSET(_gloffset_TexCoord2s)) + JZ(GLNAME(_glapi_fallback_PixelTransferf)) + JMP(GL_OFFSET(_gloffset_PixelTransferf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2i)) -GL_PREFIX(TexCoord2i): +GLOBL_FN(GL_PREFIX(PixelTransferi)) +GL_PREFIX(PixelTransferi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2i)) - JMP(GL_OFFSET(_gloffset_TexCoord2i)) + JZ(GLNAME(_glapi_fallback_PixelTransferi)) + JMP(GL_OFFSET(_gloffset_PixelTransferi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3d)) -GL_PREFIX(TexCoord3d): +GLOBL_FN(GL_PREFIX(PixelStoref)) +GL_PREFIX(PixelStoref): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3d)) - JMP(GL_OFFSET(_gloffset_TexCoord3d)) + JZ(GLNAME(_glapi_fallback_PixelStoref)) + JMP(GL_OFFSET(_gloffset_PixelStoref)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3f)) -GL_PREFIX(TexCoord3f): +GLOBL_FN(GL_PREFIX(PixelStorei)) +GL_PREFIX(PixelStorei): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3f)) - JMP(GL_OFFSET(_gloffset_TexCoord3f)) + JZ(GLNAME(_glapi_fallback_PixelStorei)) + JMP(GL_OFFSET(_gloffset_PixelStorei)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3i)) -GL_PREFIX(TexCoord3i): +GLOBL_FN(GL_PREFIX(PixelMapfv)) +GL_PREFIX(PixelMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3i)) - JMP(GL_OFFSET(_gloffset_TexCoord3i)) + JZ(GLNAME(_glapi_fallback_PixelMapfv)) + JMP(GL_OFFSET(_gloffset_PixelMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3s)) -GL_PREFIX(TexCoord3s): +GLOBL_FN(GL_PREFIX(PixelMapuiv)) +GL_PREFIX(PixelMapuiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3s)) - JMP(GL_OFFSET(_gloffset_TexCoord3s)) + JZ(GLNAME(_glapi_fallback_PixelMapuiv)) + JMP(GL_OFFSET(_gloffset_PixelMapuiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4d)) -GL_PREFIX(TexCoord4d): +GLOBL_FN(GL_PREFIX(PixelMapusv)) +GL_PREFIX(PixelMapusv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4d)) - JMP(GL_OFFSET(_gloffset_TexCoord4d)) + JZ(GLNAME(_glapi_fallback_PixelMapusv)) + JMP(GL_OFFSET(_gloffset_PixelMapusv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4f)) -GL_PREFIX(TexCoord4f): +GLOBL_FN(GL_PREFIX(ReadBuffer)) +GL_PREFIX(ReadBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4f)) - JMP(GL_OFFSET(_gloffset_TexCoord4f)) + JZ(GLNAME(_glapi_fallback_ReadBuffer)) + JMP(GL_OFFSET(_gloffset_ReadBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4i)) -GL_PREFIX(TexCoord4i): +GLOBL_FN(GL_PREFIX(CopyPixels)) +GL_PREFIX(CopyPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4i)) - JMP(GL_OFFSET(_gloffset_TexCoord4i)) + JZ(GLNAME(_glapi_fallback_CopyPixels)) + JMP(GL_OFFSET(_gloffset_CopyPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4s)) -GL_PREFIX(TexCoord4s): +GLOBL_FN(GL_PREFIX(ReadPixels)) +GL_PREFIX(ReadPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4s)) - JMP(GL_OFFSET(_gloffset_TexCoord4s)) + JZ(GLNAME(_glapi_fallback_ReadPixels)) + JMP(GL_OFFSET(_gloffset_ReadPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1dv)) -GL_PREFIX(TexCoord1dv): +GLOBL_FN(GL_PREFIX(DrawPixels)) +GL_PREFIX(DrawPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1dv)) - JMP(GL_OFFSET(_gloffset_TexCoord1dv)) + JZ(GLNAME(_glapi_fallback_DrawPixels)) + JMP(GL_OFFSET(_gloffset_DrawPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1fv)) -GL_PREFIX(TexCoord1fv): +GLOBL_FN(GL_PREFIX(GetBooleanv)) +GL_PREFIX(GetBooleanv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1fv)) - JMP(GL_OFFSET(_gloffset_TexCoord1fv)) + JZ(GLNAME(_glapi_fallback_GetBooleanv)) + JMP(GL_OFFSET(_gloffset_GetBooleanv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1iv)) -GL_PREFIX(TexCoord1iv): +GLOBL_FN(GL_PREFIX(GetClipPlane)) +GL_PREFIX(GetClipPlane): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1iv)) - JMP(GL_OFFSET(_gloffset_TexCoord1iv)) + JZ(GLNAME(_glapi_fallback_GetClipPlane)) + JMP(GL_OFFSET(_gloffset_GetClipPlane)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1sv)) -GL_PREFIX(TexCoord1sv): +GLOBL_FN(GL_PREFIX(GetDoublev)) +GL_PREFIX(GetDoublev): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1sv)) - JMP(GL_OFFSET(_gloffset_TexCoord1sv)) + JZ(GLNAME(_glapi_fallback_GetDoublev)) + JMP(GL_OFFSET(_gloffset_GetDoublev)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2dv)) -GL_PREFIX(TexCoord2dv): +GLOBL_FN(GL_PREFIX(GetError)) +GL_PREFIX(GetError): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2dv)) - JMP(GL_OFFSET(_gloffset_TexCoord2dv)) + JZ(GLNAME(_glapi_fallback_GetError)) + JMP(GL_OFFSET(_gloffset_GetError)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2fv)) -GL_PREFIX(TexCoord2fv): +GLOBL_FN(GL_PREFIX(GetFloatv)) +GL_PREFIX(GetFloatv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2fv)) - JMP(GL_OFFSET(_gloffset_TexCoord2fv)) + JZ(GLNAME(_glapi_fallback_GetFloatv)) + JMP(GL_OFFSET(_gloffset_GetFloatv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2iv)) -GL_PREFIX(TexCoord2iv): +GLOBL_FN(GL_PREFIX(GetIntegerv)) +GL_PREFIX(GetIntegerv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2iv)) - JMP(GL_OFFSET(_gloffset_TexCoord2iv)) + JZ(GLNAME(_glapi_fallback_GetIntegerv)) + JMP(GL_OFFSET(_gloffset_GetIntegerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2sv)) -GL_PREFIX(TexCoord2sv): +GLOBL_FN(GL_PREFIX(GetLightfv)) +GL_PREFIX(GetLightfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2sv)) - JMP(GL_OFFSET(_gloffset_TexCoord2sv)) + JZ(GLNAME(_glapi_fallback_GetLightfv)) + JMP(GL_OFFSET(_gloffset_GetLightfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3dv)) -GL_PREFIX(TexCoord3dv): +GLOBL_FN(GL_PREFIX(GetLightiv)) +GL_PREFIX(GetLightiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3dv)) - JMP(GL_OFFSET(_gloffset_TexCoord3dv)) + JZ(GLNAME(_glapi_fallback_GetLightiv)) + JMP(GL_OFFSET(_gloffset_GetLightiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3fv)) -GL_PREFIX(TexCoord3fv): +GLOBL_FN(GL_PREFIX(GetMapdv)) +GL_PREFIX(GetMapdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3fv)) - JMP(GL_OFFSET(_gloffset_TexCoord3fv)) + JZ(GLNAME(_glapi_fallback_GetMapdv)) + JMP(GL_OFFSET(_gloffset_GetMapdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3iv)) -GL_PREFIX(TexCoord3iv): +GLOBL_FN(GL_PREFIX(GetMapfv)) +GL_PREFIX(GetMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3iv)) - JMP(GL_OFFSET(_gloffset_TexCoord3iv)) + JZ(GLNAME(_glapi_fallback_GetMapfv)) + JMP(GL_OFFSET(_gloffset_GetMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3sv)) -GL_PREFIX(TexCoord3sv): +GLOBL_FN(GL_PREFIX(GetMapiv)) +GL_PREFIX(GetMapiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3sv)) - JMP(GL_OFFSET(_gloffset_TexCoord3sv)) + JZ(GLNAME(_glapi_fallback_GetMapiv)) + JMP(GL_OFFSET(_gloffset_GetMapiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4dv)) -GL_PREFIX(TexCoord4dv): +GLOBL_FN(GL_PREFIX(GetMaterialfv)) +GL_PREFIX(GetMaterialfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4dv)) - JMP(GL_OFFSET(_gloffset_TexCoord4dv)) + JZ(GLNAME(_glapi_fallback_GetMaterialfv)) + JMP(GL_OFFSET(_gloffset_GetMaterialfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4fv)) -GL_PREFIX(TexCoord4fv): +GLOBL_FN(GL_PREFIX(GetMaterialiv)) +GL_PREFIX(GetMaterialiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4fv)) - JMP(GL_OFFSET(_gloffset_TexCoord4fv)) + JZ(GLNAME(_glapi_fallback_GetMaterialiv)) + JMP(GL_OFFSET(_gloffset_GetMaterialiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4iv)) -GL_PREFIX(TexCoord4iv): +GLOBL_FN(GL_PREFIX(GetPixelMapfv)) +GL_PREFIX(GetPixelMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4iv)) - JMP(GL_OFFSET(_gloffset_TexCoord4iv)) + JZ(GLNAME(_glapi_fallback_GetPixelMapfv)) + JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4sv)) -GL_PREFIX(TexCoord4sv): +GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) +GL_PREFIX(GetPixelMapuiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4sv)) - JMP(GL_OFFSET(_gloffset_TexCoord4sv)) + JZ(GLNAME(_glapi_fallback_GetPixelMapuiv)) + JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGend)) -GL_PREFIX(TexGend): +GLOBL_FN(GL_PREFIX(GetPixelMapusv)) +GL_PREFIX(GetPixelMapusv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGend)) - JMP(GL_OFFSET(_gloffset_TexGend)) + JZ(GLNAME(_glapi_fallback_GetPixelMapusv)) + JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGendv)) -GL_PREFIX(TexGendv): +GLOBL_FN(GL_PREFIX(GetPolygonStipple)) +GL_PREFIX(GetPolygonStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGendv)) - JMP(GL_OFFSET(_gloffset_TexGendv)) + JZ(GLNAME(_glapi_fallback_GetPolygonStipple)) + JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGenf)) -GL_PREFIX(TexGenf): +GLOBL_FN(GL_PREFIX(GetString)) +GL_PREFIX(GetString): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGenf)) - JMP(GL_OFFSET(_gloffset_TexGenf)) + JZ(GLNAME(_glapi_fallback_GetString)) + JMP(GL_OFFSET(_gloffset_GetString)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGenfv)) -GL_PREFIX(TexGenfv): +GLOBL_FN(GL_PREFIX(GetTexEnvfv)) +GL_PREFIX(GetTexEnvfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGenfv)) - JMP(GL_OFFSET(_gloffset_TexGenfv)) + JZ(GLNAME(_glapi_fallback_GetTexEnvfv)) + JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGeni)) -GL_PREFIX(TexGeni): +GLOBL_FN(GL_PREFIX(GetTexEnviv)) +GL_PREFIX(GetTexEnviv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGeni)) - JMP(GL_OFFSET(_gloffset_TexGeni)) + JZ(GLNAME(_glapi_fallback_GetTexEnviv)) + JMP(GL_OFFSET(_gloffset_GetTexEnviv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGeniv)) -GL_PREFIX(TexGeniv): +GLOBL_FN(GL_PREFIX(GetTexGendv)) +GL_PREFIX(GetTexGendv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGeniv)) - JMP(GL_OFFSET(_gloffset_TexGeniv)) + JZ(GLNAME(_glapi_fallback_GetTexGendv)) + JMP(GL_OFFSET(_gloffset_GetTexGendv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvf)) -GL_PREFIX(TexEnvf): +GLOBL_FN(GL_PREFIX(GetTexGenfv)) +GL_PREFIX(GetTexGenfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvf)) - JMP(GL_OFFSET(_gloffset_TexEnvf)) + JZ(GLNAME(_glapi_fallback_GetTexGenfv)) + JMP(GL_OFFSET(_gloffset_GetTexGenfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvfv)) -GL_PREFIX(TexEnvfv): +GLOBL_FN(GL_PREFIX(GetTexGeniv)) +GL_PREFIX(GetTexGeniv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvfv)) - JMP(GL_OFFSET(_gloffset_TexEnvfv)) + JZ(GLNAME(_glapi_fallback_GetTexGeniv)) + JMP(GL_OFFSET(_gloffset_GetTexGeniv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvi)) -GL_PREFIX(TexEnvi): +GLOBL_FN(GL_PREFIX(GetTexImage)) +GL_PREFIX(GetTexImage): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvi)) - JMP(GL_OFFSET(_gloffset_TexEnvi)) + JZ(GLNAME(_glapi_fallback_GetTexImage)) + JMP(GL_OFFSET(_gloffset_GetTexImage)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnviv)) -GL_PREFIX(TexEnviv): +GLOBL_FN(GL_PREFIX(GetTexParameterfv)) +GL_PREFIX(GetTexParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnviv)) - JMP(GL_OFFSET(_gloffset_TexEnviv)) + JZ(GLNAME(_glapi_fallback_GetTexParameterfv)) + JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage1D)) -GL_PREFIX(TexImage1D): +GLOBL_FN(GL_PREFIX(GetTexParameteriv)) +GL_PREFIX(GetTexParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage1D)) - JMP(GL_OFFSET(_gloffset_TexImage1D)) + JZ(GLNAME(_glapi_fallback_GetTexParameteriv)) + JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage2D)) -GL_PREFIX(TexImage2D): +GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) +GL_PREFIX(GetTexLevelParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage2D)) - JMP(GL_OFFSET(_gloffset_TexImage2D)) + JZ(GLNAME(_glapi_fallback_GetTexLevelParameterfv)) + JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameterf)) -GL_PREFIX(TexParameterf): +GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) +GL_PREFIX(GetTexLevelParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameterf)) - JMP(GL_OFFSET(_gloffset_TexParameterf)) + JZ(GLNAME(_glapi_fallback_GetTexLevelParameteriv)) + JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameterfv)) -GL_PREFIX(TexParameterfv): +GLOBL_FN(GL_PREFIX(IsEnabled)) +GL_PREFIX(IsEnabled): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameterfv)) - JMP(GL_OFFSET(_gloffset_TexParameterfv)) + JZ(GLNAME(_glapi_fallback_IsEnabled)) + JMP(GL_OFFSET(_gloffset_IsEnabled)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameteri)) -GL_PREFIX(TexParameteri): +GLOBL_FN(GL_PREFIX(IsList)) +GL_PREFIX(IsList): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameteri)) - JMP(GL_OFFSET(_gloffset_TexParameteri)) + JZ(GLNAME(_glapi_fallback_IsList)) + JMP(GL_OFFSET(_gloffset_IsList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameteriv)) -GL_PREFIX(TexParameteriv): +GLOBL_FN(GL_PREFIX(DepthRange)) +GL_PREFIX(DepthRange): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameteriv)) - JMP(GL_OFFSET(_gloffset_TexParameteriv)) + JZ(GLNAME(_glapi_fallback_DepthRange)) + JMP(GL_OFFSET(_gloffset_DepthRange)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Translated)) -GL_PREFIX(Translated): +GLOBL_FN(GL_PREFIX(Frustum)) +GL_PREFIX(Frustum): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Translated)) - JMP(GL_OFFSET(_gloffset_Translated)) + JZ(GLNAME(_glapi_fallback_Frustum)) + JMP(GL_OFFSET(_gloffset_Frustum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Translatef)) -GL_PREFIX(Translatef): +GLOBL_FN(GL_PREFIX(LoadIdentity)) +GL_PREFIX(LoadIdentity): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Translatef)) - JMP(GL_OFFSET(_gloffset_Translatef)) + JZ(GLNAME(_glapi_fallback_LoadIdentity)) + JMP(GL_OFFSET(_gloffset_LoadIdentity)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2d)) -GL_PREFIX(Vertex2d): +GLOBL_FN(GL_PREFIX(LoadMatrixf)) +GL_PREFIX(LoadMatrixf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2d)) - JMP(GL_OFFSET(_gloffset_Vertex2d)) + JZ(GLNAME(_glapi_fallback_LoadMatrixf)) + JMP(GL_OFFSET(_gloffset_LoadMatrixf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2dv)) -GL_PREFIX(Vertex2dv): +GLOBL_FN(GL_PREFIX(LoadMatrixd)) +GL_PREFIX(LoadMatrixd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2dv)) - JMP(GL_OFFSET(_gloffset_Vertex2dv)) + JZ(GLNAME(_glapi_fallback_LoadMatrixd)) + JMP(GL_OFFSET(_gloffset_LoadMatrixd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2f)) -GL_PREFIX(Vertex2f): +GLOBL_FN(GL_PREFIX(MatrixMode)) +GL_PREFIX(MatrixMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2f)) - JMP(GL_OFFSET(_gloffset_Vertex2f)) + JZ(GLNAME(_glapi_fallback_MatrixMode)) + JMP(GL_OFFSET(_gloffset_MatrixMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2fv)) -GL_PREFIX(Vertex2fv): +GLOBL_FN(GL_PREFIX(MultMatrixf)) +GL_PREFIX(MultMatrixf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2fv)) - JMP(GL_OFFSET(_gloffset_Vertex2fv)) + JZ(GLNAME(_glapi_fallback_MultMatrixf)) + JMP(GL_OFFSET(_gloffset_MultMatrixf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2i)) -GL_PREFIX(Vertex2i): +GLOBL_FN(GL_PREFIX(MultMatrixd)) +GL_PREFIX(MultMatrixd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2i)) - JMP(GL_OFFSET(_gloffset_Vertex2i)) + JZ(GLNAME(_glapi_fallback_MultMatrixd)) + JMP(GL_OFFSET(_gloffset_MultMatrixd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2iv)) -GL_PREFIX(Vertex2iv): +GLOBL_FN(GL_PREFIX(Ortho)) +GL_PREFIX(Ortho): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2iv)) - JMP(GL_OFFSET(_gloffset_Vertex2iv)) + JZ(GLNAME(_glapi_fallback_Ortho)) + JMP(GL_OFFSET(_gloffset_Ortho)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2s)) -GL_PREFIX(Vertex2s): +GLOBL_FN(GL_PREFIX(PopMatrix)) +GL_PREFIX(PopMatrix): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2s)) - JMP(GL_OFFSET(_gloffset_Vertex2s)) + JZ(GLNAME(_glapi_fallback_PopMatrix)) + JMP(GL_OFFSET(_gloffset_PopMatrix)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2sv)) -GL_PREFIX(Vertex2sv): +GLOBL_FN(GL_PREFIX(PushMatrix)) +GL_PREFIX(PushMatrix): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2sv)) - JMP(GL_OFFSET(_gloffset_Vertex2sv)) + JZ(GLNAME(_glapi_fallback_PushMatrix)) + JMP(GL_OFFSET(_gloffset_PushMatrix)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3d)) -GL_PREFIX(Vertex3d): +GLOBL_FN(GL_PREFIX(Rotated)) +GL_PREFIX(Rotated): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3d)) - JMP(GL_OFFSET(_gloffset_Vertex3d)) + JZ(GLNAME(_glapi_fallback_Rotated)) + JMP(GL_OFFSET(_gloffset_Rotated)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3dv)) -GL_PREFIX(Vertex3dv): +GLOBL_FN(GL_PREFIX(Rotatef)) +GL_PREFIX(Rotatef): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3dv)) - JMP(GL_OFFSET(_gloffset_Vertex3dv)) + JZ(GLNAME(_glapi_fallback_Rotatef)) + JMP(GL_OFFSET(_gloffset_Rotatef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3f)) -GL_PREFIX(Vertex3f): +GLOBL_FN(GL_PREFIX(Scaled)) +GL_PREFIX(Scaled): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3f)) - JMP(GL_OFFSET(_gloffset_Vertex3f)) + JZ(GLNAME(_glapi_fallback_Scaled)) + JMP(GL_OFFSET(_gloffset_Scaled)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3fv)) -GL_PREFIX(Vertex3fv): +GLOBL_FN(GL_PREFIX(Scalef)) +GL_PREFIX(Scalef): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3fv)) - JMP(GL_OFFSET(_gloffset_Vertex3fv)) + JZ(GLNAME(_glapi_fallback_Scalef)) + JMP(GL_OFFSET(_gloffset_Scalef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3i)) -GL_PREFIX(Vertex3i): +GLOBL_FN(GL_PREFIX(Translated)) +GL_PREFIX(Translated): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3i)) - JMP(GL_OFFSET(_gloffset_Vertex3i)) + JZ(GLNAME(_glapi_fallback_Translated)) + JMP(GL_OFFSET(_gloffset_Translated)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3iv)) -GL_PREFIX(Vertex3iv): +GLOBL_FN(GL_PREFIX(Translatef)) +GL_PREFIX(Translatef): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3iv)) - JMP(GL_OFFSET(_gloffset_Vertex3iv)) + JZ(GLNAME(_glapi_fallback_Translatef)) + JMP(GL_OFFSET(_gloffset_Translatef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3s)) -GL_PREFIX(Vertex3s): +GLOBL_FN(GL_PREFIX(Viewport)) +GL_PREFIX(Viewport): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3s)) - JMP(GL_OFFSET(_gloffset_Vertex3s)) + JZ(GLNAME(_glapi_fallback_Viewport)) + JMP(GL_OFFSET(_gloffset_Viewport)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3sv)) -GL_PREFIX(Vertex3sv): +GLOBL_FN(GL_PREFIX(ArrayElement)) +GL_PREFIX(ArrayElement): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3sv)) - JMP(GL_OFFSET(_gloffset_Vertex3sv)) + JZ(GLNAME(_glapi_fallback_ArrayElement)) + JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4d)) -GL_PREFIX(Vertex4d): +GLOBL_FN(GL_PREFIX(ColorPointer)) +GL_PREFIX(ColorPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4d)) - JMP(GL_OFFSET(_gloffset_Vertex4d)) + JZ(GLNAME(_glapi_fallback_ColorPointer)) + JMP(GL_OFFSET(_gloffset_ColorPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4dv)) -GL_PREFIX(Vertex4dv): +GLOBL_FN(GL_PREFIX(DisableClientState)) +GL_PREFIX(DisableClientState): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4dv)) - JMP(GL_OFFSET(_gloffset_Vertex4dv)) + JZ(GLNAME(_glapi_fallback_DisableClientState)) + JMP(GL_OFFSET(_gloffset_DisableClientState)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4f)) -GL_PREFIX(Vertex4f): +GLOBL_FN(GL_PREFIX(DrawArrays)) +GL_PREFIX(DrawArrays): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4f)) - JMP(GL_OFFSET(_gloffset_Vertex4f)) + JZ(GLNAME(_glapi_fallback_DrawArrays)) + JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4fv)) -GL_PREFIX(Vertex4fv): +GLOBL_FN(GL_PREFIX(DrawElements)) +GL_PREFIX(DrawElements): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4fv)) - JMP(GL_OFFSET(_gloffset_Vertex4fv)) + JZ(GLNAME(_glapi_fallback_DrawElements)) + JMP(GL_OFFSET(_gloffset_DrawElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4i)) -GL_PREFIX(Vertex4i): +GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) +GL_PREFIX(EdgeFlagPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4i)) - JMP(GL_OFFSET(_gloffset_Vertex4i)) + JZ(GLNAME(_glapi_fallback_EdgeFlagPointer)) + JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4iv)) -GL_PREFIX(Vertex4iv): +GLOBL_FN(GL_PREFIX(EnableClientState)) +GL_PREFIX(EnableClientState): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4iv)) - JMP(GL_OFFSET(_gloffset_Vertex4iv)) + JZ(GLNAME(_glapi_fallback_EnableClientState)) + JMP(GL_OFFSET(_gloffset_EnableClientState)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4s)) -GL_PREFIX(Vertex4s): +GLOBL_FN(GL_PREFIX(GetPointerv)) +GL_PREFIX(GetPointerv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4s)) - JMP(GL_OFFSET(_gloffset_Vertex4s)) + JZ(GLNAME(_glapi_fallback_GetPointerv)) + JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4sv)) -GL_PREFIX(Vertex4sv): +GLOBL_FN(GL_PREFIX(IndexPointer)) +GL_PREFIX(IndexPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4sv)) - JMP(GL_OFFSET(_gloffset_Vertex4sv)) + JZ(GLNAME(_glapi_fallback_IndexPointer)) + JMP(GL_OFFSET(_gloffset_IndexPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Viewport)) -GL_PREFIX(Viewport): +GLOBL_FN(GL_PREFIX(InterleavedArrays)) +GL_PREFIX(InterleavedArrays): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Viewport)) - JMP(GL_OFFSET(_gloffset_Viewport)) + JZ(GLNAME(_glapi_fallback_InterleavedArrays)) + JMP(GL_OFFSET(_gloffset_InterleavedArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreTexturesResident)) -GL_PREFIX(AreTexturesResident): +GLOBL_FN(GL_PREFIX(NormalPointer)) +GL_PREFIX(NormalPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AreTexturesResident)) - JMP(GL_OFFSET(_gloffset_AreTexturesResident)) + JZ(GLNAME(_glapi_fallback_NormalPointer)) + JMP(GL_OFFSET(_gloffset_NormalPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ArrayElement)) -GL_PREFIX(ArrayElement): +GLOBL_FN(GL_PREFIX(TexCoordPointer)) +GL_PREFIX(TexCoordPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ArrayElement)) - JMP(GL_OFFSET(_gloffset_ArrayElement)) + JZ(GLNAME(_glapi_fallback_TexCoordPointer)) + JMP(GL_OFFSET(_gloffset_TexCoordPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindTexture)) -GL_PREFIX(BindTexture): +GLOBL_FN(GL_PREFIX(VertexPointer)) +GL_PREFIX(VertexPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BindTexture)) - JMP(GL_OFFSET(_gloffset_BindTexture)) + JZ(GLNAME(_glapi_fallback_VertexPointer)) + JMP(GL_OFFSET(_gloffset_VertexPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorPointer)) -GL_PREFIX(ColorPointer): +GLOBL_FN(GL_PREFIX(PolygonOffset)) +GL_PREFIX(PolygonOffset): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorPointer)) - JMP(GL_OFFSET(_gloffset_ColorPointer)) + JZ(GLNAME(_glapi_fallback_PolygonOffset)) + JMP(GL_OFFSET(_gloffset_PolygonOffset)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage1D)) @@ -2572,44 +2612,44 @@ GL_PREFIX(CopyTexSubImage2D): JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteTextures)) -GL_PREFIX(DeleteTextures): +GLOBL_FN(GL_PREFIX(TexSubImage1D)) +GL_PREFIX(TexSubImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteTextures)) - JMP(GL_OFFSET(_gloffset_DeleteTextures)) + JZ(GLNAME(_glapi_fallback_TexSubImage1D)) + JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DisableClientState)) -GL_PREFIX(DisableClientState): +GLOBL_FN(GL_PREFIX(TexSubImage2D)) +GL_PREFIX(TexSubImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DisableClientState)) - JMP(GL_OFFSET(_gloffset_DisableClientState)) + JZ(GLNAME(_glapi_fallback_TexSubImage2D)) + JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawArrays)) -GL_PREFIX(DrawArrays): +GLOBL_FN(GL_PREFIX(AreTexturesResident)) +GL_PREFIX(AreTexturesResident): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawArrays)) - JMP(GL_OFFSET(_gloffset_DrawArrays)) + JZ(GLNAME(_glapi_fallback_AreTexturesResident)) + JMP(GL_OFFSET(_gloffset_AreTexturesResident)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) -GL_PREFIX(EdgeFlagPointer): +GLOBL_FN(GL_PREFIX(BindTexture)) +GL_PREFIX(BindTexture): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagPointer)) - JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) + JZ(GLNAME(_glapi_fallback_BindTexture)) + JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EnableClientState)) -GL_PREFIX(EnableClientState): +GLOBL_FN(GL_PREFIX(DeleteTextures)) +GL_PREFIX(DeleteTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EnableClientState)) - JMP(GL_OFFSET(_gloffset_EnableClientState)) + JZ(GLNAME(_glapi_fallback_DeleteTextures)) + JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenTextures)) @@ -2620,20 +2660,20 @@ GL_PREFIX(GenTextures): JMP(GL_OFFSET(_gloffset_GenTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPointerv)) -GL_PREFIX(GetPointerv): +GLOBL_FN(GL_PREFIX(IsTexture)) +GL_PREFIX(IsTexture): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPointerv)) - JMP(GL_OFFSET(_gloffset_GetPointerv)) + JZ(GLNAME(_glapi_fallback_IsTexture)) + JMP(GL_OFFSET(_gloffset_IsTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexPointer)) -GL_PREFIX(IndexPointer): +GLOBL_FN(GL_PREFIX(PrioritizeTextures)) +GL_PREFIX(PrioritizeTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexPointer)) - JMP(GL_OFFSET(_gloffset_IndexPointer)) + JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) + JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexub)) @@ -2652,38 +2692,6 @@ GL_PREFIX(Indexubv): JMP(GL_OFFSET(_gloffset_Indexubv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InterleavedArrays)) -GL_PREFIX(InterleavedArrays): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InterleavedArrays)) - JMP(GL_OFFSET(_gloffset_InterleavedArrays)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsTexture)) -GL_PREFIX(IsTexture): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsTexture)) - JMP(GL_OFFSET(_gloffset_IsTexture)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NormalPointer)) -GL_PREFIX(NormalPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NormalPointer)) - JMP(GL_OFFSET(_gloffset_NormalPointer)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonOffset)) -GL_PREFIX(PolygonOffset): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonOffset)) - JMP(GL_OFFSET(_gloffset_PolygonOffset)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopClientAttrib)) GL_PREFIX(PopClientAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2692,14 +2700,6 @@ GL_PREFIX(PopClientAttrib): JMP(GL_OFFSET(_gloffset_PopClientAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PrioritizeTextures)) -GL_PREFIX(PrioritizeTextures): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) - JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushClientAttrib)) GL_PREFIX(PushClientAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2708,84 +2708,84 @@ GL_PREFIX(PushClientAttrib): JMP(GL_OFFSET(_gloffset_PushClientAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoordPointer)) -GL_PREFIX(TexCoordPointer): +GLOBL_FN(GL_PREFIX(BlendColor)) +GL_PREFIX(BlendColor): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoordPointer)) - JMP(GL_OFFSET(_gloffset_TexCoordPointer)) + JZ(GLNAME(_glapi_fallback_BlendColor)) + JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage1D)) -GL_PREFIX(TexSubImage1D): +GLOBL_FN(GL_PREFIX(BlendEquation)) +GL_PREFIX(BlendEquation): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage1D)) - JMP(GL_OFFSET(_gloffset_TexSubImage1D)) + JZ(GLNAME(_glapi_fallback_BlendEquation)) + JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage2D)) -GL_PREFIX(TexSubImage2D): +GLOBL_FN(GL_PREFIX(DrawRangeElements)) +GL_PREFIX(DrawRangeElements): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage2D)) - JMP(GL_OFFSET(_gloffset_TexSubImage2D)) + JZ(GLNAME(_glapi_fallback_DrawRangeElements)) + JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexPointer)) -GL_PREFIX(VertexPointer): +GLOBL_FN(GL_PREFIX(ColorTable)) +GL_PREFIX(ColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexPointer)) - JMP(GL_OFFSET(_gloffset_VertexPointer)) + JZ(GLNAME(_glapi_fallback_ColorTable)) + JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) -GL_PREFIX(CopyTexSubImage3D): +GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) +GL_PREFIX(ColorTableParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) - JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) + JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) + JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawRangeElements)) -GL_PREFIX(DrawRangeElements): +GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) +GL_PREFIX(ColorTableParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawRangeElements)) - JMP(GL_OFFSET(_gloffset_DrawRangeElements)) + JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) + JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage3D)) -GL_PREFIX(TexImage3D): +GLOBL_FN(GL_PREFIX(CopyColorTable)) +GL_PREFIX(CopyColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage3D)) - JMP(GL_OFFSET(_gloffset_TexImage3D)) + JZ(GLNAME(_glapi_fallback_CopyColorTable)) + JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage3D)) -GL_PREFIX(TexSubImage3D): +GLOBL_FN(GL_PREFIX(GetColorTable)) +GL_PREFIX(GetColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage3D)) - JMP(GL_OFFSET(_gloffset_TexSubImage3D)) + JZ(GLNAME(_glapi_fallback_GetColorTable)) + JMP(GL_OFFSET(_gloffset_GetColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendColor)) -GL_PREFIX(BlendColor): +GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) +GL_PREFIX(GetColorTableParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendColor)) - JMP(GL_OFFSET(_gloffset_BlendColor)) + JZ(GLNAME(_glapi_fallback_GetColorTableParameterfv)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendEquation)) -GL_PREFIX(BlendEquation): +GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) +GL_PREFIX(GetColorTableParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendEquation)) - JMP(GL_OFFSET(_gloffset_BlendEquation)) + JZ(GLNAME(_glapi_fallback_GetColorTableParameteriv)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorSubTable)) @@ -2796,28 +2796,12 @@ GL_PREFIX(ColorSubTable): JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTable)) -GL_PREFIX(ColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) - JMP(GL_OFFSET(_gloffset_ColorTable)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) -GL_PREFIX(ColorTableParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) - JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) -GL_PREFIX(ColorTableParameteriv): +GLOBL_FN(GL_PREFIX(CopyColorSubTable)) +GL_PREFIX(CopyColorSubTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) - JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) + JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) + JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter1D)) @@ -2868,22 +2852,6 @@ GL_PREFIX(ConvolutionParameteriv): JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorSubTable)) -GL_PREFIX(CopyColorSubTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) - JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorTable)) -GL_PREFIX(CopyColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorTable)) - JMP(GL_OFFSET(_gloffset_CopyColorTable)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D)) GL_PREFIX(CopyConvolutionFilter1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2900,30 +2868,6 @@ GL_PREFIX(CopyConvolutionFilter2D): JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTable)) -GL_PREFIX(GetColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTable)) - JMP(GL_OFFSET(_gloffset_GetColorTable)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) -GL_PREFIX(GetColorTableParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfv)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) -GL_PREFIX(GetColorTableParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameteriv)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionFilter)) GL_PREFIX(GetConvolutionFilter): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2948,6 +2892,22 @@ GL_PREFIX(GetConvolutionParameteriv): JMP(GL_OFFSET(_gloffset_GetConvolutionParameteriv)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetSeparableFilter)) +GL_PREFIX(GetSeparableFilter): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetSeparableFilter)) + JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SeparableFilter2D)) +GL_PREFIX(SeparableFilter2D): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) + JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogram)) GL_PREFIX(GetHistogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2996,14 +2956,6 @@ GL_PREFIX(GetMinmaxParameteriv): JMP(GL_OFFSET(_gloffset_GetMinmaxParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSeparableFilter)) -GL_PREFIX(GetSeparableFilter): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSeparableFilter)) - JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Histogram)) GL_PREFIX(Histogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3020,6 +2972,14 @@ GL_PREFIX(Minmax): JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ResetHistogram)) +GL_PREFIX(ResetHistogram): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ResetHistogram)) + JMP(GL_OFFSET(_gloffset_ResetHistogram)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetMinmax)) GL_PREFIX(ResetMinmax): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3028,20 +2988,28 @@ GL_PREFIX(ResetMinmax): JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResetHistogram)) -GL_PREFIX(ResetHistogram): +GLOBL_FN(GL_PREFIX(TexImage3D)) +GL_PREFIX(TexImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetHistogram)) - JMP(GL_OFFSET(_gloffset_ResetHistogram)) + JZ(GLNAME(_glapi_fallback_TexImage3D)) + JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SeparableFilter2D)) -GL_PREFIX(SeparableFilter2D): +GLOBL_FN(GL_PREFIX(TexSubImage3D)) +GL_PREFIX(TexSubImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) - JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) + JZ(GLNAME(_glapi_fallback_TexSubImage3D)) + JMP(GL_OFFSET(_gloffset_TexSubImage3D)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) +GL_PREFIX(CopyTexSubImage3D): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) + JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ActiveTextureARB)) @@ -3316,11 +3284,115 @@ GL_PREFIX(MultiTexCoord4svARB): JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) +GL_PREFIX(LoadTransposeMatrixfARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixfARB)) + JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) +GL_PREFIX(LoadTransposeMatrixdARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixdARB)) + JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) +GL_PREFIX(MultTransposeMatrixfARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_MultTransposeMatrixfARB)) + JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) +GL_PREFIX(MultTransposeMatrixdARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_MultTransposeMatrixdARB)) + JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SampleCoverageARB)) +GL_PREFIX(SampleCoverageARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SampleCoverageARB)) + JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SamplePassARB)) +GL_PREFIX(SamplePassARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SamplePassARB)) + JMP(GL_OFFSET(_gloffset_SamplePassARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB)) +GL_PREFIX(CompressedTexImage3DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexImage3DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB)) +GL_PREFIX(CompressedTexImage2DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexImage2DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB)) +GL_PREFIX(CompressedTexImage1DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexImage1DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB)) +GL_PREFIX(CompressedTexSubImage3DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexSubImage3DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB)) +GL_PREFIX(CompressedTexSubImage2DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexSubImage2DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB)) +GL_PREFIX(CompressedTexSubImage1DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexSubImage1DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB)) +GL_PREFIX(GetCompressedTexImageARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetCompressedTexImageARB)) + JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendColorEXT)) GL_PREFIX(BlendColorEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendColor)) + JZ(GLNAME(_glapi_fallback_BlendColorEXT)) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 @@ -3336,7 +3408,7 @@ GLOBL_FN(GL_PREFIX(TexImage3DEXT)) GL_PREFIX(TexImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage3D)) + JZ(GLNAME(_glapi_fallback_TexImage3DEXT)) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 @@ -3344,18 +3416,10 @@ GLOBL_FN(GL_PREFIX(TexSubImage3DEXT)) GL_PREFIX(TexSubImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage3D)) + JZ(GLNAME(_glapi_fallback_TexSubImage3DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) -GL_PREFIX(CopyTexSubImage3DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) - JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS)) GL_PREFIX(GetTexFilterFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3372,19 +3436,11 @@ GL_PREFIX(TexFilterFuncSGIS): JMP(GL_OFFSET(_gloffset_TexFilterFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) -GL_PREFIX(CopyTexSubImage1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage1D)) - JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage1DEXT)) GL_PREFIX(TexSubImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage1D)) + JZ(GLNAME(_glapi_fallback_TexSubImage1DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 @@ -3392,7 +3448,7 @@ GLOBL_FN(GL_PREFIX(TexSubImage2DEXT)) GL_PREFIX(TexSubImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage2D)) + JZ(GLNAME(_glapi_fallback_TexSubImage2DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 @@ -3400,7 +3456,7 @@ GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT)) GL_PREFIX(CopyTexImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage1D)) + JZ(GLNAME(_glapi_fallback_CopyTexImage1DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 @@ -3408,18 +3464,34 @@ GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT)) GL_PREFIX(CopyTexImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage2D)) + JZ(GLNAME(_glapi_fallback_CopyTexImage2DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) +GL_PREFIX(CopyTexSubImage1DEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage1DEXT)) + JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT)) GL_PREFIX(CopyTexSubImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage2D)) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage2DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) +GL_PREFIX(CopyTexSubImage3DEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage3DEXT)) + JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramEXT)) GL_PREFIX(GetHistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3472,7 +3544,7 @@ GLOBL_FN(GL_PREFIX(HistogramEXT)) GL_PREFIX(HistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Histogram)) + JZ(GLNAME(_glapi_fallback_HistogramEXT)) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 @@ -3480,7 +3552,7 @@ GLOBL_FN(GL_PREFIX(MinmaxEXT)) GL_PREFIX(MinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Minmax)) + JZ(GLNAME(_glapi_fallback_MinmaxEXT)) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 @@ -3488,7 +3560,7 @@ GLOBL_FN(GL_PREFIX(ResetHistogramEXT)) GL_PREFIX(ResetHistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetHistogram)) + JZ(GLNAME(_glapi_fallback_ResetHistogramEXT)) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 @@ -3496,7 +3568,7 @@ GLOBL_FN(GL_PREFIX(ResetMinmaxEXT)) GL_PREFIX(ResetMinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetMinmax)) + JZ(GLNAME(_glapi_fallback_ResetMinmaxEXT)) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 @@ -3504,7 +3576,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT)) GL_PREFIX(ConvolutionFilter1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter1D)) + JZ(GLNAME(_glapi_fallback_ConvolutionFilter1DEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 @@ -3512,7 +3584,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT)) GL_PREFIX(ConvolutionFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter2D)) + JZ(GLNAME(_glapi_fallback_ConvolutionFilter2DEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 @@ -3520,7 +3592,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT)) GL_PREFIX(ConvolutionParameterfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterf)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameterfEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 @@ -3528,7 +3600,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT)) GL_PREFIX(ConvolutionParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterfv)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameterfvEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 @@ -3536,7 +3608,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT)) GL_PREFIX(ConvolutionParameteriEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteri)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameteriEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 @@ -3544,7 +3616,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT)) GL_PREFIX(ConvolutionParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteriv)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameterivEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 @@ -3552,7 +3624,7 @@ GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT)) GL_PREFIX(CopyConvolutionFilter1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter1D)) + JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter1DEXT)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 @@ -3560,7 +3632,7 @@ GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT)) GL_PREFIX(CopyConvolutionFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter2D)) + JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter2DEXT)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 @@ -3600,15 +3672,23 @@ GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT)) GL_PREFIX(SeparableFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) + JZ(GLNAME(_glapi_fallback_SeparableFilter2DEXT)) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ColorTableSGI)) +GL_PREFIX(ColorTableSGI): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ColorTableSGI)) + JMP(GL_OFFSET(_gloffset_ColorTable)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI)) GL_PREFIX(ColorTableParameterfvSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) + JZ(GLNAME(_glapi_fallback_ColorTableParameterfvSGI)) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 @@ -3616,23 +3696,15 @@ GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI)) GL_PREFIX(ColorTableParameterivSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) + JZ(GLNAME(_glapi_fallback_ColorTableParameterivSGI)) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableSGI)) -GL_PREFIX(ColorTableSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) - JMP(GL_OFFSET(_gloffset_ColorTable)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorTableSGI)) GL_PREFIX(CopyColorTableSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorTable)) + JZ(GLNAME(_glapi_fallback_CopyColorTableSGI)) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 @@ -3660,493 +3732,324 @@ GL_PREFIX(GetColorTableParameterivSGI): JMP(GL_OFFSET(_gloffset_GetColorTableParameterivSGI)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenTexturesEXT)) -GL_PREFIX(GenTexturesEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenSGIX)) +GL_PREFIX(PixelTexGenSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenTexturesEXT)) - JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenSGIX)) + JMP(GL_OFFSET(_gloffset_PixelTexGenSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) -GL_PREFIX(DeleteTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteTextures)) - JMP(GL_OFFSET(_gloffset_DeleteTextures)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindTextureEXT)) -GL_PREFIX(BindTextureEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BindTexture)) - JMP(GL_OFFSET(_gloffset_BindTexture)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) -GL_PREFIX(PrioritizeTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) - JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) -GL_PREFIX(AreTexturesResidentEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) +GL_PREFIX(PixelTexGenParameteriSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AreTexturesResidentEXT)) - JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameteriSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsTextureEXT)) -GL_PREFIX(IsTextureEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS)) +GL_PREFIX(PixelTexGenParameterivSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsTextureEXT)) - JMP(GL_OFFSET(_gloffset_IsTextureEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameterivSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameterivSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendEquationEXT)) -GL_PREFIX(BlendEquationEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) +GL_PREFIX(PixelTexGenParameterfSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendEquation)) - JMP(GL_OFFSET(_gloffset_BlendEquation)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexPointerEXT)) -GL_PREFIX(VertexPointerEXT): - JMP(GLNAME(_glapi_fallback_VertexPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NormalPointerEXT)) -GL_PREFIX(NormalPointerEXT): - JMP(GLNAME(_glapi_fallback_NormalPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorPointerEXT)) -GL_PREFIX(ColorPointerEXT): - JMP(GLNAME(_glapi_fallback_ColorPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexPointerEXT)) -GL_PREFIX(IndexPointerEXT): - JMP(GLNAME(_glapi_fallback_IndexPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) -GL_PREFIX(TexCoordPointerEXT): - JMP(GLNAME(_glapi_fallback_TexCoordPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) -GL_PREFIX(EdgeFlagPointerEXT): - JMP(GLNAME(_glapi_fallback_EdgeFlagPointerEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPointervEXT)) -GL_PREFIX(GetPointervEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS)) +GL_PREFIX(PixelTexGenParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPointerv)) - JMP(GL_OFFSET(_gloffset_GetPointerv)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfvSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfvSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ArrayElementEXT)) -GL_PREFIX(ArrayElementEXT): +GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) +GL_PREFIX(GetPixelTexGenParameterivSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ArrayElement)) - JMP(GL_OFFSET(_gloffset_ArrayElement)) + JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterivSGIS)) + JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawArraysEXT)) -GL_PREFIX(DrawArraysEXT): +GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) +GL_PREFIX(GetPixelTexGenParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawArrays)) - JMP(GL_OFFSET(_gloffset_DrawArrays)) + JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterfvSGIS)) + JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfEXT)) -GL_PREFIX(PointParameterfEXT): +GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) +GL_PREFIX(TexImage4DSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfEXT)) - JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) + JZ(GLNAME(_glapi_fallback_TexImage4DSGIS)) + JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) -GL_PREFIX(PointParameterfvEXT): +GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) +GL_PREFIX(TexSubImage4DSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfvEXT)) - JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) + JZ(GLNAME(_glapi_fallback_TexSubImage4DSGIS)) + JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(HintPGI)) -GL_PREFIX(HintPGI): +GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) +GL_PREFIX(AreTexturesResidentEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_HintPGI)) - JMP(GL_OFFSET(_gloffset_HintPGI)) + JZ(GLNAME(_glapi_fallback_AreTexturesResidentEXT)) + JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableEXT)) -GL_PREFIX(ColorTableEXT): +GLOBL_FN(GL_PREFIX(BindTextureEXT)) +GL_PREFIX(BindTextureEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) - JMP(GL_OFFSET(_gloffset_ColorTable)) + JZ(GLNAME(_glapi_fallback_BindTextureEXT)) + JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) -GL_PREFIX(ColorSubTableEXT): +GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) +GL_PREFIX(DeleteTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorSubTable)) - JMP(GL_OFFSET(_gloffset_ColorSubTable)) + JZ(GLNAME(_glapi_fallback_DeleteTexturesEXT)) + JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableEXT)) -GL_PREFIX(GetColorTableEXT): +GLOBL_FN(GL_PREFIX(GenTexturesEXT)) +GL_PREFIX(GenTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableEXT)) - JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) + JZ(GLNAME(_glapi_fallback_GenTexturesEXT)) + JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) -GL_PREFIX(GetColorTableParameterfvEXT): +GLOBL_FN(GL_PREFIX(IsTextureEXT)) +GL_PREFIX(IsTextureEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfvEXT)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) + JZ(GLNAME(_glapi_fallback_IsTextureEXT)) + JMP(GL_OFFSET(_gloffset_IsTextureEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) -GL_PREFIX(GetColorTableParameterivEXT): +GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) +GL_PREFIX(PrioritizeTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterivEXT)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) + JZ(GLNAME(_glapi_fallback_PrioritizeTexturesEXT)) + JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LockArraysEXT)) -GL_PREFIX(LockArraysEXT): +GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) +GL_PREFIX(DetailTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LockArraysEXT)) - JMP(GL_OFFSET(_gloffset_LockArraysEXT)) + JZ(GLNAME(_glapi_fallback_DetailTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) -GL_PREFIX(UnlockArraysEXT): +GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) +GL_PREFIX(GetDetailTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_UnlockArraysEXT)) - JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) + JZ(GLNAME(_glapi_fallback_GetDetailTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFuncSeparateINGR)) -GL_PREFIX(BlendFuncSeparateINGR): +GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) +GL_PREFIX(SharpenTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendFuncSeparateEXT)) - JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) -GL_PREFIX(WindowPos2iMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2iMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) -GL_PREFIX(WindowPos2sMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2sMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) -GL_PREFIX(WindowPos2fMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2fMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) -GL_PREFIX(WindowPos2dMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2dMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) -GL_PREFIX(WindowPos2ivMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2ivMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) -GL_PREFIX(WindowPos2svMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2svMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) -GL_PREFIX(WindowPos2fvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2fvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) -GL_PREFIX(WindowPos2dvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2dvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) -GL_PREFIX(WindowPos3iMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3iMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) -GL_PREFIX(WindowPos3sMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3sMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) -GL_PREFIX(WindowPos3fMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3fMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) -GL_PREFIX(WindowPos3dMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3dMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) -GL_PREFIX(WindowPos3ivMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3ivMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) -GL_PREFIX(WindowPos3svMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3svMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) -GL_PREFIX(WindowPos3fvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3fvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) -GL_PREFIX(WindowPos3dvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3dvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) -GL_PREFIX(WindowPos4iMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4iMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) -GL_PREFIX(WindowPos4sMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4sMESA)) + JZ(GLNAME(_glapi_fallback_SharpenTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) -GL_PREFIX(WindowPos4fMESA): +GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) +GL_PREFIX(GetSharpenTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4fMESA)) - JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) -GL_PREFIX(WindowPos4dMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4dMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) -GL_PREFIX(WindowPos4ivMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4ivMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) -GL_PREFIX(WindowPos4svMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4svMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) -GL_PREFIX(WindowPos4fvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4fvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) -GL_PREFIX(WindowPos4dvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4dvMESA)) + JZ(GLNAME(_glapi_fallback_GetSharpenTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) -GL_PREFIX(ResizeBuffersMESA): +GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) +GL_PREFIX(SampleMaskSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResizeBuffersMESA)) - JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) + JZ(GLNAME(_glapi_fallback_SampleMaskSGIS)) + JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) -GL_PREFIX(LoadTransposeMatrixdARB): +GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) +GL_PREFIX(SamplePatternSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixdARB)) - JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) + JZ(GLNAME(_glapi_fallback_SamplePatternSGIS)) + JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) -GL_PREFIX(LoadTransposeMatrixfARB): +GLOBL_FN(GL_PREFIX(ArrayElementEXT)) +GL_PREFIX(ArrayElementEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixfARB)) - JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) + JZ(GLNAME(_glapi_fallback_ArrayElementEXT)) + JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) -GL_PREFIX(MultTransposeMatrixdARB): +GLOBL_FN(GL_PREFIX(ColorPointerEXT)) +GL_PREFIX(ColorPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultTransposeMatrixdARB)) - JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) + JZ(GLNAME(_glapi_fallback_ColorPointerEXT)) + JMP(GL_OFFSET(_gloffset_ColorPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) -GL_PREFIX(MultTransposeMatrixfARB): +GLOBL_FN(GL_PREFIX(DrawArraysEXT)) +GL_PREFIX(DrawArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultTransposeMatrixfARB)) - JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) + JZ(GLNAME(_glapi_fallback_DrawArraysEXT)) + JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) -GL_PREFIX(PixelTexGenParameterfSGIS): +GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) +GL_PREFIX(EdgeFlagPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfSGIS)) - JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) + JZ(GLNAME(_glapi_fallback_EdgeFlagPointerEXT)) + JMP(GL_OFFSET(_gloffset_EdgeFlagPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) -GL_PREFIX(PixelTexGenParameteriSGIS): +GLOBL_FN(GL_PREFIX(GetPointervEXT)) +GL_PREFIX(GetPointervEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameteriSGIS)) - JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) + JZ(GLNAME(_glapi_fallback_GetPointervEXT)) + JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) -GL_PREFIX(GetPixelTexGenParameterfvSGIS): +GLOBL_FN(GL_PREFIX(IndexPointerEXT)) +GL_PREFIX(IndexPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterfvSGIS)) - JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) + JZ(GLNAME(_glapi_fallback_IndexPointerEXT)) + JMP(GL_OFFSET(_gloffset_IndexPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) -GL_PREFIX(GetPixelTexGenParameterivSGIS): +GLOBL_FN(GL_PREFIX(NormalPointerEXT)) +GL_PREFIX(NormalPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterivSGIS)) - JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) + JZ(GLNAME(_glapi_fallback_NormalPointerEXT)) + JMP(GL_OFFSET(_gloffset_NormalPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) -GL_PREFIX(TexImage4DSGIS): +GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) +GL_PREFIX(TexCoordPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage4DSGIS)) - JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) + JZ(GLNAME(_glapi_fallback_TexCoordPointerEXT)) + JMP(GL_OFFSET(_gloffset_TexCoordPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) -GL_PREFIX(TexSubImage4DSGIS): +GLOBL_FN(GL_PREFIX(VertexPointerEXT)) +GL_PREFIX(VertexPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage4DSGIS)) - JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) + JZ(GLNAME(_glapi_fallback_VertexPointerEXT)) + JMP(GL_OFFSET(_gloffset_VertexPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) -GL_PREFIX(DetailTexFuncSGIS): +GLOBL_FN(GL_PREFIX(BlendEquationEXT)) +GL_PREFIX(BlendEquationEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DetailTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_BlendEquationEXT)) + JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) -GL_PREFIX(GetDetailTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) +GL_PREFIX(SpriteParameterfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetDetailTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameterfSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) -GL_PREFIX(GetSharpenTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) +GL_PREFIX(SpriteParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSharpenTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameterfvSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) -GL_PREFIX(SharpenTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) +GL_PREFIX(SpriteParameteriSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SharpenTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameteriSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) -GL_PREFIX(SampleMaskSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) +GL_PREFIX(SpriteParameterivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleMaskSGIS)) - JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameterivSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) -GL_PREFIX(SamplePatternSGIS): +GLOBL_FN(GL_PREFIX(PointParameterfEXT)) +GL_PREFIX(PointParameterfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePatternSGIS)) - JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) + JZ(GLNAME(_glapi_fallback_PointParameterfEXT)) + JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) -GL_PREFIX(SpriteParameterfSGIX): +GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) +GL_PREFIX(PointParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterfSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) + JZ(GLNAME(_glapi_fallback_PointParameterfvEXT)) + JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) -GL_PREFIX(SpriteParameteriSGIX): +GLOBL_FN(GL_PREFIX(PointParameterfSGIS)) +GL_PREFIX(PointParameterfSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameteriSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) + JZ(GLNAME(_glapi_fallback_PointParameterfSGIS)) + JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) -GL_PREFIX(SpriteParameterfvSGIX): +GLOBL_FN(GL_PREFIX(PointParameterfvSGIS)) +GL_PREFIX(PointParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterfvSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) + JZ(GLNAME(_glapi_fallback_PointParameterfvSGIS)) + JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) -GL_PREFIX(SpriteParameterivSGIX): +GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) +GL_PREFIX(GetInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterivSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) + JZ(GLNAME(_glapi_fallback_GetInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX)) @@ -4157,20 +4060,12 @@ GL_PREFIX(InstrumentsBufferSGIX): JMP(GL_OFFSET(_gloffset_InstrumentsBufferSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) -GL_PREFIX(StartInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StartInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) -GL_PREFIX(StopInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) +GL_PREFIX(PollInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StopInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) + JZ(GLNAME(_glapi_fallback_PollInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX)) @@ -4181,20 +4076,20 @@ GL_PREFIX(ReadInstrumentsSGIX): JMP(GL_OFFSET(_gloffset_ReadInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) -GL_PREFIX(PollInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) +GL_PREFIX(StartInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PollInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) + JZ(GLNAME(_glapi_fallback_StartInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) -GL_PREFIX(GetInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) +GL_PREFIX(StopInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) + JZ(GLNAME(_glapi_fallback_StopInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FrameZoomSGIX)) @@ -4205,6 +4100,14 @@ GL_PREFIX(FrameZoomSGIX): JMP(GL_OFFSET(_gloffset_FrameZoomSGIX)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) +GL_PREFIX(TagSampleBufferSGIX): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_TagSampleBufferSGIX)) + JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX)) GL_PREFIX(ReferencePlaneSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4221,14 +4124,62 @@ GL_PREFIX(FlushRasterSGIX): JMP(GL_OFFSET(_gloffset_FlushRasterSGIX)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) +GL_PREFIX(ColorSubTableEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ColorSubTableEXT)) + JMP(GL_OFFSET(_gloffset_ColorSubTable)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT)) GL_PREFIX(CopyColorSubTableEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) + JZ(GLNAME(_glapi_fallback_CopyColorSubTableEXT)) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(HintPGI)) +GL_PREFIX(HintPGI): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_HintPGI)) + JMP(GL_OFFSET(_gloffset_HintPGI)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ColorTableEXT)) +GL_PREFIX(ColorTableEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ColorTableEXT)) + JMP(GL_OFFSET(_gloffset_ColorTable)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetColorTableEXT)) +GL_PREFIX(GetColorTableEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetColorTableEXT)) + JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) +GL_PREFIX(GetColorTableParameterivEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetColorTableParameterivEXT)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) +GL_PREFIX(GetColorTableParameterfvEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetColorTableParameterfvEXT)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX)) GL_PREFIX(GetListParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4293,44 +4244,36 @@ GL_PREFIX(IndexFuncEXT): JMP(GL_OFFSET(_gloffset_IndexFuncEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) -GL_PREFIX(CullParameterdvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullParameterdvEXT)) - JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) -GL_PREFIX(CullParameterfvEXT): +GLOBL_FN(GL_PREFIX(LockArraysEXT)) +GL_PREFIX(LockArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullParameterfvEXT)) - JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) + JZ(GLNAME(_glapi_fallback_LockArraysEXT)) + JMP(GL_OFFSET(_gloffset_LockArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleCoverageARB)) -GL_PREFIX(SampleCoverageARB): +GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) +GL_PREFIX(UnlockArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleCoverageARB)) - JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) + JZ(GLNAME(_glapi_fallback_UnlockArraysEXT)) + JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePassARB)) -GL_PREFIX(SamplePassARB): +GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) +GL_PREFIX(CullParameterdvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePassARB)) - JMP(GL_OFFSET(_gloffset_SamplePassARB)) + JZ(GLNAME(_glapi_fallback_CullParameterdvEXT)) + JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) -GL_PREFIX(TagSampleBufferSGIX): +GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) +GL_PREFIX(CullParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TagSampleBufferSGIX)) - JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) + JZ(GLNAME(_glapi_fallback_CullParameterfvEXT)) + JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX)) @@ -4477,6 +4420,14 @@ GL_PREFIX(LightEnviSGIX): JMP(GL_OFFSET(_gloffset_LightEnviSGIX)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT)) +GL_PREFIX(DrawRangeElementsEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_DrawRangeElementsEXT)) + JMP(GL_OFFSET(_gloffset_DrawRangeElements)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordfEXT)) GL_PREFIX(FogCoordfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4549,14 +4500,6 @@ GL_PREFIX(VertexWeightPointerEXT): JMP(GL_OFFSET(_gloffset_VertexWeightPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) -GL_PREFIX(VertexArrayRangeNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexArrayRangeNV)) - JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV)) GL_PREFIX(FlushVertexArrayRangeNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4565,6 +4508,14 @@ GL_PREFIX(FlushVertexArrayRangeNV): JMP(GL_OFFSET(_gloffset_FlushVertexArrayRangeNV)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) +GL_PREFIX(VertexArrayRangeNV): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_VertexArrayRangeNV)) + JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterfvNV)) GL_PREFIX(CombinerParameterfvNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4668,4 +4619,229 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): JZ(GLNAME(_glapi_fallback_GetFinalCombinerInputParameterivNV)) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterivNV)) +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) +GL_PREFIX(ResizeBuffersMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ResizeBuffersMESA)) + JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) +GL_PREFIX(WindowPos2dMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2dMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) +GL_PREFIX(WindowPos2dvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2dvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) +GL_PREFIX(WindowPos2fMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2fMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) +GL_PREFIX(WindowPos2fvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2fvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) +GL_PREFIX(WindowPos2iMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2iMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) +GL_PREFIX(WindowPos2ivMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2ivMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) +GL_PREFIX(WindowPos2sMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2sMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) +GL_PREFIX(WindowPos2svMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2svMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) +GL_PREFIX(WindowPos3dMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3dMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) +GL_PREFIX(WindowPos3dvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3dvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) +GL_PREFIX(WindowPos3fMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3fMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) +GL_PREFIX(WindowPos3fvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3fvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) +GL_PREFIX(WindowPos3iMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3iMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) +GL_PREFIX(WindowPos3ivMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3ivMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) +GL_PREFIX(WindowPos3sMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3sMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) +GL_PREFIX(WindowPos3svMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3svMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) +GL_PREFIX(WindowPos4dMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4dMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) +GL_PREFIX(WindowPos4dvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4dvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) +GL_PREFIX(WindowPos4fMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4fMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) +GL_PREFIX(WindowPos4fvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4fvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) +GL_PREFIX(WindowPos4iMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4iMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) +GL_PREFIX(WindowPos4ivMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4ivMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) +GL_PREFIX(WindowPos4sMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4sMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) +GL_PREFIX(WindowPos4svMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4svMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(TbufferMask3DFX)) +GL_PREFIX(TbufferMask3DFX): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_TbufferMask3DFX)) + JMP(GL_OFFSET(_gloffset_TbufferMask3DFX)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SampleMaskEXT)) +GL_PREFIX(SampleMaskEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SampleMaskEXT)) + JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SamplePatternEXT)) +GL_PREFIX(SamplePatternEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SamplePatternEXT)) + JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) + + #endif /* __WIN32__ */ diff --git a/xc/extras/Mesa/src/X86/vertex_3dnow.S b/xc/extras/Mesa/src/X86/vertex_3dnow.S index f93db21c1..2c0060362 100644 --- a/xc/extras/Mesa/src/X86/vertex_3dnow.S +++ b/xc/extras/Mesa/src/X86/vertex_3dnow.S @@ -11,7 +11,7 @@ -/*#define MAT_SX 0 /* accessed by REGIND !! */ +/*#define MAT_SX 0 accessed by REGIND !! */ #define MAT_SY 20 #define MAT_SZ 40 #define MAT_TX 48 diff --git a/xc/extras/Mesa/src/X86/x86.c b/xc/extras/Mesa/src/X86/x86.c index 223cf61c8..1b24811d4 100644 --- a/xc/extras/Mesa/src/X86/x86.c +++ b/xc/extras/Mesa/src/X86/x86.c @@ -28,17 +28,14 @@ */ -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - +#include "glheader.h" #include "context.h" #include "types.h" #include "vertices.h" #include "xform.h" #include "x86.h" +#ifdef USE_X86_ASM extern void _ASMAPI gl_v16_x86_cliptest_points4(GLfloat *first_vert, GLfloat *last_vert, GLubyte *or_mask, @@ -51,7 +48,7 @@ extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest, const GLfloat *src, GLuint src_stride, GLuint count); - +#endif #define XFORM_ARGS GLvector4f *to_vec, \ @@ -85,8 +82,7 @@ extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest, gl_transform_tab[cma][vsize][MATRIX_3D] \ = gl_##pfx##_transform_points##vsize##_3d_##masked; -void gl_init_x86_asm_transforms( void ) -{ + #ifdef USE_X86_ASM DECLARE_XFORM_GROUP( x86, 2, raw ) DECLARE_XFORM_GROUP( x86, 3, raw ) @@ -100,8 +96,12 @@ void gl_init_x86_asm_transforms( void ) GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ); +#endif + - +void gl_init_x86_asm_transforms( void ) +{ +#ifdef USE_X86_ASM ASSIGN_XFORM_GROUP( x86, 0, 2, raw ) ASSIGN_XFORM_GROUP( x86, 0, 3, raw ) ASSIGN_XFORM_GROUP( x86, 0, 4, raw ) @@ -110,6 +110,7 @@ void gl_init_x86_asm_transforms( void ) ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked ) ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked ) + /* XXX this function has been found to cause FP overflow exceptions */ gl_clip_tab[4] = gl_x86_cliptest_points4; #ifdef DEBUG diff --git a/xc/extras/Mesa/src/alphabuf.c b/xc/extras/Mesa/src/alphabuf.c index 50bc80d4b..6f2332407 100644 --- a/xc/extras/Mesa/src/alphabuf.c +++ b/xc/extras/Mesa/src/alphabuf.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -60,7 +60,7 @@ alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf ) { GLint bytes = buf->Width * buf->Height * sizeof(GLubyte); - ASSERT(ctx->Visual->SoftwareAlpha); + ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); if (buf->FrontLeftAlpha) { FREE( buf->FrontLeftAlpha ); @@ -122,7 +122,8 @@ alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf ) /* * Allocate a new front and back alpha buffer. */ -void gl_alloc_alpha_buffers( GLcontext *ctx ) +void +_mesa_alloc_alpha_buffers( GLcontext *ctx ) { alloc_alpha_buffers( ctx, ctx->DrawBuffer ); if (ctx->ReadBuffer != ctx->DrawBuffer) { @@ -134,12 +135,13 @@ void gl_alloc_alpha_buffers( GLcontext *ctx ) /* * Clear all the alpha buffers */ -void gl_clear_alpha_buffers( GLcontext *ctx ) +void +_mesa_clear_alpha_buffers( GLcontext *ctx ) { const GLubyte aclear = (GLint) (ctx->Color.ClearColor[3] * 255.0F); GLuint bufferBit; - ASSERT(ctx->Visual->SoftwareAlpha); + ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); ASSERT(ctx->Color.ColorMask[ACOMP]); /* loop over four possible alpha buffers */ @@ -183,8 +185,9 @@ void gl_clear_alpha_buffers( GLcontext *ctx ) -void gl_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - CONST GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ) { GLubyte *aptr = ALPHA_DRAW_ADDR( x, y ); GLuint i; @@ -205,8 +208,9 @@ void gl_write_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } -void gl_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, - GLubyte alpha, const GLubyte mask[] ) +void +_mesa_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte alpha, const GLubyte mask[] ) { GLubyte *aptr = ALPHA_DRAW_ADDR( x, y ); GLuint i; @@ -227,9 +231,10 @@ void gl_write_mono_alpha_span( GLcontext *ctx, GLuint n, GLint x, GLint y, } -void gl_write_alpha_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - CONST GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_write_alpha_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[] ) { GLuint i; @@ -250,9 +255,10 @@ void gl_write_alpha_pixels( GLcontext *ctx, } -void gl_write_mono_alpha_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte alpha, const GLubyte mask[] ) +void +_mesa_write_mono_alpha_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte alpha, const GLubyte mask[] ) { GLuint i; @@ -274,8 +280,9 @@ void gl_write_mono_alpha_pixels( GLcontext *ctx, -void gl_read_alpha_span( GLcontext *ctx, - GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) +void +_mesa_read_alpha_span( GLcontext *ctx, + GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) { GLubyte *aptr = ALPHA_READ_ADDR( x, y ); GLuint i; @@ -285,9 +292,10 @@ void gl_read_alpha_span( GLcontext *ctx, } -void gl_read_alpha_pixels( GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ) +void +_mesa_read_alpha_pixels( GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) { GLuint i; for (i=0;i<n;i++) { diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c index 53f59765d..2e750ffdb 100644 --- a/xc/extras/Mesa/src/attrib.c +++ b/xc/extras/Mesa/src/attrib.c @@ -103,7 +103,7 @@ _mesa_PushAttrib(GLbitfield mask) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushAttrib"); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPushAttrib %x\n", mask); + fprintf(stderr, "glPushAttrib %x\n", (int)mask); if (ctx->AttribStackDepth>=MAX_ATTRIB_STACK_DEPTH) { gl_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" ); @@ -166,6 +166,9 @@ _mesa_PushAttrib(GLbitfield mask) attr->ClipPlane[i] = ctx->Transform.ClipEnabled[i]; } attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; + attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; + attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; + attr->Separable2D = ctx->Pixel.Separable2DEnabled; attr->CullFace = ctx->Polygon.CullFlag; attr->DepthTest = ctx->Depth.Test; attr->Dither = ctx->Color.DitherFlag; @@ -176,6 +179,8 @@ _mesa_PushAttrib(GLbitfield mask) attr->Lighting = ctx->Light.Enabled; attr->LineSmooth = ctx->Line.SmoothFlag; attr->LineStipple = ctx->Line.StippleFlag; + attr->Histogram = ctx->Pixel.HistogramEnabled; + attr->MinMax = ctx->Pixel.MinMaxEnabled; attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; attr->Map1Color4 = ctx->Eval.Map1Color4; @@ -197,6 +202,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; attr->Normalize = ctx->Transform.Normalize; + attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; @@ -422,21 +428,43 @@ _mesa_PopAttrib(void) GLubyte oldAlphaRef = ctx->Color.AlphaRef; GLenum oldBlendSrc = ctx->Color.BlendSrcRGB; GLenum oldBlendDst = ctx->Color.BlendDstRGB; + GLenum oldLogicOp = ctx->Color.LogicOp; MEMCPY( &ctx->Color, attr->data, sizeof(struct gl_colorbuffer_attrib) ); if (ctx->Color.DrawBuffer != oldDrawBuffer) { _mesa_DrawBuffer( ctx->Color.DrawBuffer); } - if ((ctx->Color.AlphaFunc != oldAlphaFunc || - ctx->Color.AlphaRef != oldAlphaRef) && - ctx->Driver.AlphaFunc) - (*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc, - ctx->Color.AlphaRef / 255.0F); if ((ctx->Color.BlendSrcRGB != oldBlendSrc || - ctx->Color.BlendSrcRGB != oldBlendDst) && + ctx->Color.BlendDstRGB != oldBlendDst) && ctx->Driver.BlendFunc) (*ctx->Driver.BlendFunc)( ctx, ctx->Color.BlendSrcRGB, ctx->Color.BlendDstRGB); + if (ctx->Color.LogicOp != oldLogicOp && + ctx->Driver.LogicOpcode) { + ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp ); + } + if (ctx->Visual->RGBAflag) { + GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); + GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); + GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); + GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F); + (*ctx->Driver.ClearColor)( ctx, r, g, b, a ); + if ((ctx->Color.AlphaFunc != oldAlphaFunc || + ctx->Color.AlphaRef != oldAlphaRef) && + ctx->Driver.AlphaFunc) + (*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc, + ctx->Color.AlphaRef / 255.0F); + if (ctx->Driver.ColorMask) { + (*ctx->Driver.ColorMask)(ctx, + ctx->Color.ColorMask[0], + ctx->Color.ColorMask[1], + ctx->Color.ColorMask[2], + ctx->Color.ColorMask[3]); + } + } + else { + (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex); + } } break; case GL_CURRENT_BIT: @@ -482,6 +510,9 @@ _mesa_PopAttrib(void) TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); + TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, GL_CONVOLUTION_1D); + TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, GL_CONVOLUTION_2D); + TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, GL_SEPARABLE_2D); TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG); TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING); TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH); @@ -508,6 +539,7 @@ _mesa_PopAttrib(void) TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT); + TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT); TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, GL_POLYGON_OFFSET_LINE); @@ -634,6 +666,11 @@ _mesa_PopAttrib(void) (*ctx->Driver.Enable)( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag ); (*ctx->Driver.Enable)( ctx, GL_LINE_STIPPLE, ctx->Line.StippleFlag ); } + if (ctx->Driver.LineStipple) + (*ctx->Driver.LineStipple)(ctx, ctx->Line.StippleFactor, + ctx->Line.StipplePattern); + if (ctx->Driver.LineWidth) + (*ctx->Driver.LineWidth)(ctx, ctx->Line.Width); break; case GL_LIST_BIT: MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) ); @@ -670,6 +707,8 @@ _mesa_PopAttrib(void) break; case GL_POLYGON_STIPPLE_BIT: MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); + if (ctx->Driver.PolygonStipple) + ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); break; case GL_SCISSOR_BIT: MEMCPY( &ctx->Scissor, attr->data, diff --git a/xc/extras/Mesa/src/bitmap.c b/xc/extras/Mesa/src/bitmap.c index 563dff9af..eefee932f 100644 --- a/xc/extras/Mesa/src/bitmap.c +++ b/xc/extras/Mesa/src/bitmap.c @@ -53,7 +53,7 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, { struct pixel_buffer *PB = ctx->PB; GLint row, col; - GLint pz; + GLdepth fragZ; ASSERT(ctx->RenderMode == GL_RENDER); @@ -68,16 +68,16 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, g = (GLint) (ctx->Current.RasterColor[1] * 255.0F); b = (GLint) (ctx->Current.RasterColor[2] * 255.0F); a = (GLint) (ctx->Current.RasterColor[3] * 255.0F); - PB_SET_COLOR( ctx, PB, r, g, b, a ); + PB_SET_COLOR( PB, r, g, b, a ); } else { - PB_SET_INDEX( ctx, PB, ctx->Current.RasterIndex ); + PB_SET_INDEX( PB, ctx->Current.RasterIndex ); } - pz = (GLint) ( ctx->Current.RasterPos[2] * DEPTH_SCALE ); + fragZ = (GLdepth) ( ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); for (row=0; row<height; row++) { - const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image( unpack, + const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); if (unpack->LsbFirst) { @@ -85,7 +85,7 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, GLubyte mask = 1U << (unpack->SkipPixels & 0x7); for (col=0; col<width; col++) { if (*src & mask) { - PB_WRITE_PIXEL( PB, px+col, py+row, pz ); + PB_WRITE_PIXEL( PB, px+col, py+row, fragZ ); } if (mask == 128U) { src++; @@ -107,7 +107,7 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); for (col=0; col<width; col++) { if (*src & mask) { - PB_WRITE_PIXEL( PB, px+col, py+row, pz ); + PB_WRITE_PIXEL( PB, px+col, py+row, fragZ ); } if (mask == 1U) { src++; @@ -167,6 +167,8 @@ _mesa_Bitmap( GLsizei width, GLsizei height, gl_reduced_prim_change( ctx, GL_BITMAP ); } + ctx->OcclusionResult = GL_TRUE; + if (ctx->Driver.Bitmap) { /* let device driver try to render the bitmap */ completed = (*ctx->Driver.Bitmap)( ctx, x, y, width, height, diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c index 63b93435a..e15014dfe 100644 --- a/xc/extras/Mesa/src/colortab.c +++ b/xc/extras/Mesa/src/colortab.c @@ -32,28 +32,20 @@ #include "context.h" #include "image.h" #include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "span.h" #endif /* - * Return GL_TRUE if k is a power of two, else return GL_FALSE. + * Given an internalFormat token passed to glColorTable, + * return the corresponding base format. + * Return -1 if invalid token. */ -static GLboolean -power_of_two( GLint k ) -{ - GLint i, m = 1; - for (i=0; i<32; i++) { - if (k == m) - return GL_TRUE; - m = m << 1; - } - return GL_FALSE; -} - - static GLint -decode_internal_format( GLint format ) +base_colortab_format( GLenum format ) { switch (format) { case GL_ALPHA: @@ -62,14 +54,12 @@ decode_internal_format( GLint format ) case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; - case 1: case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; - case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: @@ -84,7 +74,6 @@ decode_internal_format( GLint format ) case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; - case 3: case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: @@ -94,7 +83,6 @@ decode_internal_format( GLint format ) case GL_RGB12: case GL_RGB16: return GL_RGB; - case 4: case GL_RGBA: case GL_RGBA2: case GL_RGBA4: @@ -110,97 +98,333 @@ decode_internal_format( GLint format ) } +void +_mesa_init_colortable( struct gl_color_table *p ) +{ + p->TableType = GL_UNSIGNED_BYTE; + /* allocate a width=1 table by default */ + p->Table = CALLOC(4 * sizeof(GLubyte)); + if (p->Table) { + GLubyte *t = (GLubyte *) p->Table; + t[0] = 255; + t[1] = 255; + t[2] = 255; + t[3] = 255; + } + p->Size = 1; + p->IntFormat = GL_RGBA; + p->Format = GL_RGBA; + p->RedSize = 8; + p->GreenSize = 8; + p->BlueSize = 8; + p->AlphaSize = 8; + p->IntensitySize = 0; + p->LuminanceSize = 0; +} + + + +void +_mesa_free_colortable_data( struct gl_color_table *p ) +{ + if (p->Table) { + FREE(p->Table); + p->Table = NULL; + } +} + + +/* + * Examine table's format and set the component sizes accordingly. + */ +static void +set_component_sizes( struct gl_color_table *table ) +{ + switch (table->Format) { + case GL_ALPHA: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + case GL_LUMINANCE: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 8; + break; + case GL_LUMINANCE_ALPHA: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 8; + break; + case GL_INTENSITY: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 8; + table->LuminanceSize = 0; + break; + case GL_RGB: + table->RedSize = 8; + table->GreenSize = 8; + table->BlueSize = 8; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + case GL_RGBA: + table->RedSize = 8; + table->GreenSize = 8; + table->BlueSize = 8; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + default: + gl_problem(NULL, "unexpected format in set_component_sizes"); + } +} + + + void _mesa_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, - const GLvoid *table ) + const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_object *texObj; - struct gl_color_table *palette; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; GLboolean proxy = GL_FALSE; + GLint baseFormat; + GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; + GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; + GLboolean floatTable = GL_FALSE; + GLint comps; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable"); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->CurrentD[1]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->CurrentD[2]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->CurrentD[3]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_PROXY_TEXTURE_1D: texObj = ctx->Texture.Proxy1D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_2D: texObj = ctx->Texture.Proxy2D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_3D: texObj = ctx->Texture.Proxy3D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - texObj = NULL; - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.ColorTableScale[0]; + gScale = ctx->Pixel.ColorTableScale[1]; + bScale = ctx->Pixel.ColorTableScale[2]; + aScale = ctx->Pixel.ColorTableScale[3]; + rBias = ctx->Pixel.ColorTableBias[0]; + gBias = ctx->Pixel.ColorTableBias[1]; + bBias = ctx->Pixel.ColorTableBias[2]; + aBias = ctx->Pixel.ColorTableBias[3]; + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + proxy = GL_TRUE; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.PCCTscale[0]; + gScale = ctx->Pixel.PCCTscale[1]; + bScale = ctx->Pixel.PCCTscale[2]; + aScale = ctx->Pixel.PCCTscale[3]; + rBias = ctx->Pixel.PCCTbias[0]; + gBias = ctx->Pixel.PCCTbias[1]; + bBias = ctx->Pixel.PCCTbias[2]; + aBias = ctx->Pixel.PCCTbias[3]; + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + proxy = GL_TRUE; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.PCMCTscale[0]; + gScale = ctx->Pixel.PCMCTscale[1]; + bScale = ctx->Pixel.PCMCTscale[2]; + aScale = ctx->Pixel.PCMCTscale[3]; + rBias = ctx->Pixel.PCMCTbias[0]; + gBias = ctx->Pixel.PCMCTbias[1]; + bBias = ctx->Pixel.PCMCTbias[2]; + aBias = ctx->Pixel.PCMCTbias[3]; + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + proxy = GL_TRUE; break; default: gl_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } - assert(palette); + assert(table); - if (!gl_is_legal_format_and_type(format, type)) { + if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)"); return; } - if (decode_internal_format(internalFormat) < 0) { - gl_error( ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)" ); + baseFormat = base_colortab_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); return; } - if (width < 1 || width > MAX_TEXTURE_PALETTE_SIZE || !power_of_two(width)) { - gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)"); + if (width < 1 || width > ctx->Const.MaxColorTableSize + || _mesa_bitcount(width) != 1) { + if (width > ctx->Const.MaxColorTableSize) + gl_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)"); + else + gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)"); if (proxy) { - palette->Size = 0; - palette->IntFormat = (GLenum) 0; - palette->Format = (GLenum) 0; + table->Size = 0; + table->IntFormat = (GLenum) 0; + table->Format = (GLenum) 0; } return; } - palette->Size = width; - palette->IntFormat = internalFormat; - palette->Format = (GLenum) decode_internal_format(internalFormat); + table->Size = width; + table->IntFormat = internalFormat; + table->Format = (GLenum) baseFormat; + set_component_sizes(table); + + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ + if (!proxy) { - _mesa_unpack_ubyte_color_span(ctx, width, palette->Format, - palette->Table, /* dest */ - format, type, table, - &ctx->Unpack, GL_FALSE); - } - if (texObj) { - /* per-texture object palette */ - if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); + /* free old table, if any */ + if (table->Table) { + FREE(table->Table); } - } - else { - /* shared texture palette */ + if (floatTable) { + GLubyte tableUB[MAX_COLOR_TABLE_SIZE * 4]; + GLfloat *tableF; + GLuint i; + + _mesa_unpack_ubyte_color_span(ctx, width, table->Format, + tableUB, /* dest */ + format, type, data, + &ctx->Unpack, GL_TRUE); + + table->TableType = GL_FLOAT; + table->Table = MALLOC(comps * width * sizeof(GLfloat)); + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + + /* Apply scale and bias and convert GLubyte values to GLfloats + * in [0, 1]. Store results in the tableF[]. + */ + rScale /= 255.0; + gScale /= 255.0; + bScale /= 255.0; + aScale /= 255.0; + tableF = (GLfloat *) table->Table; + + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * rScale + rBias; + } + break; + case GL_LUMINANCE: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * rScale + rBias; + } + break; + case GL_ALPHA: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * aScale + aBias; + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < width; i++) { + tableF[i*2+0] = tableUB[i*2+0] * rScale + rBias; + tableF[i*2+1] = tableUB[i*2+1] * aScale + aBias; + } + break; + case GL_RGB: + for (i = 0; i < width; i++) { + tableF[i*3+0] = tableUB[i*3+0] * rScale + rBias; + tableF[i*3+1] = tableUB[i*3+1] * gScale + gBias; + tableF[i*3+2] = tableUB[i*3+2] * bScale + bBias; + } + break; + case GL_RGBA: + for (i = 0; i < width; i++) { + tableF[i*4+0] = tableUB[i*4+0] * rScale + rBias; + tableF[i*4+1] = tableUB[i*4+1] * gScale + gBias; + tableF[i*4+2] = tableUB[i*4+2] * bScale + bBias; + tableF[i*4+3] = tableUB[i*4+3] * aScale + aBias; + } + break; + default: + gl_problem(ctx, "Bad format in _mesa_ColorTable"); + return; + } + } + else { + /* store GLubyte table */ + table->TableType = GL_UNSIGNED_BYTE; + table->Table = MALLOC(comps * width * sizeof(GLubyte)); + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + _mesa_unpack_ubyte_color_span(ctx, width, table->Format, + table->Table, /* dest */ + format, type, data, + &ctx->Unpack, GL_TRUE); + } /* floatTable */ + } /* proxy */ + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* texture object palette, texObj==NULL means the shared palette */ if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } } @@ -210,42 +434,49 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, void _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, - const GLvoid *table ) + const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_object *texObj; - struct gl_color_table *palette; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; GLint comps; - GLubyte *dest; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable"); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->CurrentD[1]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->CurrentD[2]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->CurrentD[3]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - texObj = NULL; - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; break; default: gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); return; } - assert(palette); + assert(table); - if (!gl_is_legal_format_and_type(format, type)) { + if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)"); return; } @@ -255,196 +486,619 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, return; } - comps = gl_components_in_format(format); - assert(comps > 0); /* error should be caught sooner */ + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ - if (start + count > palette->Size) { + if (start + count > table->Size) { gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); return; } - dest = palette->Table + start * comps * sizeof(GLubyte); - _mesa_unpack_ubyte_color_span(ctx, count, palette->Format, dest, - format, type, table, - &ctx->Unpack, GL_FALSE); - if (texObj) { - /* per-texture object palette */ - if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); - } + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable"); + return; + } + + if (table->TableType == GL_UNSIGNED_BYTE) { + GLubyte *dest = (GLubyte *) table->Table + start * comps * sizeof(GLubyte); + _mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest, + format, type, data, &ctx->Unpack, GL_TRUE); } else { - /* shared texture palette */ + GLfloat *dest = (GLfloat *) table->Table + start * comps * sizeof(GLfloat); + ASSERT(table->TableType == GL_FLOAT); + _mesa_unpack_float_color_span(ctx, count, table->Format, dest, + format, type, data, &ctx->Unpack, + GL_FALSE, GL_TRUE); + } + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* per-texture object palette */ if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } } +/* XXX not tested */ +void +_mesa_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GLubyte data[MAX_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable"); + + /* Select buffer to read from */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, + ctx->Pixel.DriverReadBuffer ); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, + ctx->Color.DriverDrawBuffer ); + + _mesa_ColorTable(target, internalformat, width, + GL_RGBA, GL_UNSIGNED_BYTE, data); +} + + + +/* XXX not tested */ +void +_mesa_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GLubyte data[MAX_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable"); + + /* Select buffer to read from */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, + ctx->Pixel.DriverReadBuffer ); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, + ctx->Color.DriverDrawBuffer ); + + _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_UNSIGNED_BYTE, data); +} + + + void _mesa_GetColorTable( GLenum target, GLenum format, - GLenum type, GLvoid *table ) + GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_color_table *palette; - GLubyte rgba[MAX_TEXTURE_PALETTE_SIZE][4]; + struct gl_color_table *table = NULL; + GLubyte rgba[MAX_COLOR_TABLE_SIZE][4]; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable"); switch (target) { case GL_TEXTURE_1D: - palette = &texUnit->CurrentD[1]->Palette; + table = &texUnit->CurrentD[1]->Palette; break; case GL_TEXTURE_2D: - palette = &texUnit->CurrentD[2]->Palette; + table = &texUnit->CurrentD[2]->Palette; break; case GL_TEXTURE_3D: - palette = &texUnit->CurrentD[3]->Palette; + table = &texUnit->CurrentD[3]->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; break; default: gl_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } - assert(palette); + assert(table); - switch (palette->Format) { + switch (table->Format) { case GL_ALPHA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = 0; - rgba[i][GCOMP] = 0; - rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = palette->Table[i]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = tableUB[i]; + } } break; case GL_LUMINANCE: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i]; - rgba[i][GCOMP] = palette->Table[i]; - rgba[i][BCOMP] = palette->Table[i]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][ACOMP] = 255; + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = 255; + } } break; case GL_LUMINANCE_ALPHA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*2+0]; - rgba[i][GCOMP] = palette->Table[i*2+0]; - rgba[i][BCOMP] = palette->Table[i*2+0]; - rgba[i][ACOMP] = palette->Table[i*2+1]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*2+0]; + rgba[i][GCOMP] = tableUB[i*2+0]; + rgba[i][BCOMP] = tableUB[i*2+0]; + rgba[i][ACOMP] = tableUB[i*2+1]; + } } break; case GL_INTENSITY: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i]; - rgba[i][GCOMP] = palette->Table[i]; - rgba[i][BCOMP] = palette->Table[i]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = tableUB[i]; + } } break; case GL_RGB: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*3+0]; - rgba[i][GCOMP] = palette->Table[i*3+1]; - rgba[i][BCOMP] = palette->Table[i*3+2]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * 255.0F); + rgba[i][ACOMP] = 255; + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*3+0]; + rgba[i][GCOMP] = tableUB[i*3+1]; + rgba[i][BCOMP] = tableUB[i*3+2]; + rgba[i][ACOMP] = 255; + } } break; case GL_RGBA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*4+0]; - rgba[i][GCOMP] = palette->Table[i*4+1]; - rgba[i][BCOMP] = palette->Table[i*4+2]; - rgba[i][ACOMP] = palette->Table[i*4+3]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*4+0]; + rgba[i][GCOMP] = tableUB[i*4+1]; + rgba[i][BCOMP] = tableUB[i*4+2]; + rgba[i][ACOMP] = tableUB[i*4+3]; + } } break; default: - gl_problem(ctx, "bad palette format in glGetColorTable"); + gl_problem(ctx, "bad table format in glGetColorTable"); return; } - gl_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba, - format, type, table, &ctx->Pack, GL_FALSE); + _mesa_pack_rgba_span(ctx, table->Size, (const GLubyte (*)[]) rgba, + format, type, data, &ctx->Pack, GL_FALSE); +} + + + +void +_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); - (void) format; - (void) type; - (void) table; + switch (target) { + case GL_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.ColorTableScale[0] = params[0]; + ctx->Pixel.ColorTableScale[1] = params[1]; + ctx->Pixel.ColorTableScale[2] = params[2]; + ctx->Pixel.ColorTableScale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.ColorTableBias[0] = params[0]; + ctx->Pixel.ColorTableBias[1] = params[1]; + ctx->Pixel.ColorTableBias[2] = params[2]; + ctx->Pixel.ColorTableBias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCCTscale[0] = params[0]; + ctx->Pixel.PCCTscale[1] = params[1]; + ctx->Pixel.PCCTscale[2] = params[2]; + ctx->Pixel.PCCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCCTbias[0] = params[0]; + ctx->Pixel.PCCTbias[1] = params[1]; + ctx->Pixel.PCCTbias[2] = params[2]; + ctx->Pixel.PCCTbias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCMCTscale[0] = params[0]; + ctx->Pixel.PCMCTscale[1] = params[1]; + ctx->Pixel.PCMCTscale[2] = params[2]; + ctx->Pixel.PCMCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCMCTbias[0] = params[0]; + ctx->Pixel.PCMCTbias[1] = params[1]; + ctx->Pixel.PCMCTbias[2] = params[2]; + ctx->Pixel.PCMCTbias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); + return; + } } void -_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) +_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { - GLint iparams[10]; - _mesa_GetColorTableParameteriv( target, pname, iparams ); - *params = (GLfloat) iparams[0]; + GLfloat fparams[4]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + /* four values */ + fparams[0] = (GLfloat) params[0]; + fparams[1] = (GLfloat) params[1]; + fparams[2] = (GLfloat) params[2]; + fparams[3] = (GLfloat) params[3]; + } + else { + /* one values */ + fparams[0] = (GLfloat) params[0]; + } + _mesa_ColorTableParameterfv(target, pname, fparams); } void -_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_color_table *palette; + struct gl_color_table *table = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter"); + ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameterfv"); switch (target) { case GL_TEXTURE_1D: - palette = &texUnit->CurrentD[1]->Palette; + table = &texUnit->CurrentD[1]->Palette; break; case GL_TEXTURE_2D: - palette = &texUnit->CurrentD[2]->Palette; + table = &texUnit->CurrentD[2]->Palette; break; case GL_TEXTURE_3D: - palette = &texUnit->CurrentD[3]->Palette; + table = &texUnit->CurrentD[3]->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.ColorTableScale[0]; + params[1] = ctx->Pixel.ColorTableScale[1]; + params[2] = ctx->Pixel.ColorTableScale[2]; + params[3] = ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.ColorTableBias[0]; + params[1] = ctx->Pixel.ColorTableBias[1]; + params[2] = ctx->Pixel.ColorTableBias[2]; + params[3] = ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCCTscale[0]; + params[1] = ctx->Pixel.PCCTscale[1]; + params[2] = ctx->Pixel.PCCTscale[2]; + params[3] = ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCCTbias[0]; + params[1] = ctx->Pixel.PCCTbias[1]; + params[2] = ctx->Pixel.PCCTbias[2]; + params[3] = ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCMCTscale[0]; + params[1] = ctx->Pixel.PCMCTscale[1]; + params[2] = ctx->Pixel.PCMCTscale[2]; + params[3] = ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCMCTbias[0]; + params[1] = ctx->Pixel.PCMCTbias[1]; + params[2] = ctx->Pixel.PCMCTbias[2]; + params[3] = ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; break; default: - gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); return; } + assert(table); + switch (pname) { case GL_COLOR_TABLE_FORMAT: - *params = palette->IntFormat; + *params = table->IntFormat; break; case GL_COLOR_TABLE_WIDTH: - *params = palette->Size; + *params = table->Size; break; case GL_COLOR_TABLE_RED_SIZE: - *params = 8; + *params = table->RedSize; break; case GL_COLOR_TABLE_GREEN_SIZE: - *params = 8; + *params = table->GreenSize; break; case GL_COLOR_TABLE_BLUE_SIZE: - *params = 8; + *params = table->BlueSize; break; case GL_COLOR_TABLE_ALPHA_SIZE: - *params = 8; + *params = table->AlphaSize; break; case GL_COLOR_TABLE_LUMINANCE_SIZE: - *params = 8; + *params = table->LuminanceSize; break; case GL_COLOR_TABLE_INTENSITY_SIZE: - *params = 8; + *params = table->IntensitySize; break; default: - gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter" ); + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" ); return; } } + +void +_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_color_table *table = NULL; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameteriv"); + + switch (target) { + case GL_TEXTURE_1D: + table = &texUnit->CurrentD[1]->Palette; + break; + case GL_TEXTURE_2D: + table = &texUnit->CurrentD[2]->Palette; + break; + case GL_TEXTURE_3D: + table = &texUnit->CurrentD[3]->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableScale[0]; + params[1] = (GLint) ctx->Pixel.ColorTableScale[1]; + params[2] = (GLint) ctx->Pixel.ColorTableScale[2]; + params[3] = (GLint) ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableBias[0]; + params[1] = (GLint) ctx->Pixel.ColorTableBias[1]; + params[2] = (GLint) ctx->Pixel.ColorTableBias[2]; + params[3] = (GLint) ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCMCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCMCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCMCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCMCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); + return; + } + + assert(table); + + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + *params = table->IntFormat; + break; + case GL_COLOR_TABLE_WIDTH: + *params = table->Size; + break; + case GL_COLOR_TABLE_RED_SIZE: + *params = table->RedSize; + break; + case GL_COLOR_TABLE_GREEN_SIZE: + *params = table->GreenSize; + break; + case GL_COLOR_TABLE_BLUE_SIZE: + *params = table->BlueSize; + break; + case GL_COLOR_TABLE_ALPHA_SIZE: + *params = table->AlphaSize; + break; + case GL_COLOR_TABLE_LUMINANCE_SIZE: + *params = table->LuminanceSize; + break; + case GL_COLOR_TABLE_INTENSITY_SIZE: + *params = table->IntensitySize; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" ); + return; + } +} diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h index 595f02830..3ff5e5f78 100644 --- a/xc/extras/Mesa/src/config.h +++ b/xc/extras/Mesa/src/config.h @@ -51,6 +51,9 @@ /* Maximum texture matrix stack depth: */ #define MAX_TEXTURE_STACK_DEPTH 10 +/* Maximum color matrix stack depth: */ +#define MAX_COLOR_STACK_DEPTH 4 + /* Maximum attribute stack depth: */ #define MAX_ATTRIB_STACK_DEPTH 16 @@ -92,8 +95,8 @@ #define MAX_LINE_WIDTH 10.0 #define LINE_WIDTH_GRANULARITY 0.1 -/* Max texture palette size */ -#define MAX_TEXTURE_PALETTE_SIZE 256 +/* Max texture palette / color table size */ +#define MAX_COLOR_TABLE_SIZE 256 /* Number of texture levels */ #define MAX_TEXTURE_LEVELS 12 @@ -111,6 +114,16 @@ /* Subpixel precision for antialiasing, window coordinate snapping */ #define SUB_PIXEL_BITS 4 +/* Size of histogram tables */ +#define HISTOGRAM_TABLE_SIZE 256 + +/* Max convolution filter sizes */ +#define MAX_CONVOLUTION_WIDTH 5 +#define MAX_CONVOLUTION_HEIGHT 5 + +/* GL_ARB_texture_compression */ +#define MAX_COMPRESSED_TEXTURE_FORMATS 25 + /* @@ -125,26 +138,12 @@ /* - * Bits per depth buffer value: 16 or 32 + * Bits per depth buffer value: 16 or 32 (GLushort or GLuint) + * gl_create_visual() can select any depth in [0, 32]. */ -#ifdef MESAD3D - /* Mesa / Direct3D driver only */ - extern float g_DepthScale, g_MaxDepth; -# define DEPTH_BITS 32 -# define DEPTH_SCALE g_DepthScale -# define MAX_DEPTH g_MaxDepth -#else -# define DEPTH_BITS 16 -# if DEPTH_BITS==16 -# define MAX_DEPTH 0xffff -# define DEPTH_SCALE 65535.0F -# elif DEPTH_BITS==32 -# define MAX_DEPTH 0x3fffffff -# define DEPTH_SCALE ((GLfloat) MAX_DEPTH) -# else -# error "illegal number of depth bits" -# endif -#endif +#define DEFAULT_SOFTWARE_DEPTH_BITS 16 +#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort + /* @@ -190,7 +189,7 @@ * VB_MAX vertices. (This only happens when mixed primitives are * sharing the vb). */ -#define VB_MAX_CLIPPED_VERTS (2 * (6 + MAX_CLIP_PLANES)) +#define VB_MAX_CLIPPED_VERTS ((2 * (6 + MAX_CLIP_PLANES))+1) #define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS) diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index 48e92df60..0138ae6b3 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -31,6 +31,7 @@ #include "accum.h" #include "alphabuf.h" #include "clip.h" +#include "colortab.h" #include "context.h" #include "cva.h" #include "depth.h" @@ -85,215 +86,110 @@ struct immediate *_mesa_CurrentInput = NULL; #endif - - /**********************************************************************/ -/***** Profiling functions *****/ +/***** GL Visual allocation/destruction *****/ /**********************************************************************/ -#ifdef PROFILE - -#include <sys/times.h> -#include <sys/param.h> - /* - * Return system time in seconds. - * NOTE: this implementation may not be very portable! + * Allocate a new GLvisual object. + * Input: rgbFlag - GL_TRUE=RGB(A) mode, GL_FALSE=Color Index mode + * dbFlag - double buffering? + * stereoFlag - stereo buffer? + * depthBits - requested bits per depth buffer value + * Any value in [0, 32] is acceptable but the actual + * depth type will be GLushort or GLuint as needed. + * stencilBits - requested minimum bits per stencil buffer value + * accumBits - requested minimum bits per accum buffer component + * indexBits - number of bits per pixel if rgbFlag==GL_FALSE + * red/green/blue/alphaBits - number of bits per color component + * in frame buffer for RGB(A) mode. + * We always use 8 in core Mesa though. + * Return: pointer to new GLvisual or NULL if requested parameters can't + * be met. */ -GLdouble gl_time( void ) +GLvisual * +_mesa_create_visual( GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ) { - static GLdouble prev_time = 0.0; - static GLdouble time; - struct tms tm; - clock_t clk; - - clk = times(&tm); - -#ifdef CLK_TCK - time = (double)clk / (double)CLK_TCK; -#else - time = (double)clk / (double)HZ; -#endif - - if (time>prev_time) { - prev_time = time; - return time; - } - else { - return prev_time; + GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); + if (vis) { + if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, + redBits, greenBits, blueBits, alphaBits, + indexBits, depthBits, stencilBits, + accumRedBits, accumGreenBits, + accumBlueBits, accumAlphaBits, + numSamples )) { + FREE(vis); + return NULL; + } } + return vis; } + /* - * Reset the timing/profiling counters + * Initialize the fields of the given GLvisual. + * Input: see _mesa_create_visual() above. + * Return: GL_TRUE = success + * GL_FALSE = failure. */ -static void init_timings( GLcontext *ctx ) +GLboolean +_mesa_initialize_visual( GLvisual *vis, + GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ) { - ctx->BeginEndCount = 0; - ctx->BeginEndTime = 0.0; - ctx->VertexCount = 0; - ctx->VertexTime = 0.0; - ctx->PointCount = 0; - ctx->PointTime = 0.0; - ctx->LineCount = 0; - ctx->LineTime = 0.0; - ctx->PolygonCount = 0; - ctx->PolygonTime = 0.0; - ctx->ClearCount = 0; - ctx->ClearTime = 0.0; - ctx->SwapCount = 0; - ctx->SwapTime = 0.0; -} + assert(vis); + /* This is to catch bad values from device drivers not updated for + * Mesa 3.3. Some device drivers just passed 1. That's a REALLY + * bad value now (a 1-bit depth buffer!?!). + */ + assert(depthBits == 0 || depthBits > 1); -/* - * Print the accumulated timing/profiling data. - */ -static void print_timings( GLcontext *ctx ) -{ - GLdouble beginendrate; - GLdouble vertexrate; - GLdouble pointrate; - GLdouble linerate; - GLdouble polygonrate; - GLdouble overhead; - GLdouble clearrate; - GLdouble swaprate; - GLdouble avgvertices; - - if (ctx->BeginEndTime>0.0) { - beginendrate = ctx->BeginEndCount / ctx->BeginEndTime; - } - else { - beginendrate = 0.0; - } - if (ctx->VertexTime>0.0) { - vertexrate = ctx->VertexCount / ctx->VertexTime; - } - else { - vertexrate = 0.0; - } - if (ctx->PointTime>0.0) { - pointrate = ctx->PointCount / ctx->PointTime; - } - else { - pointrate = 0.0; - } - if (ctx->LineTime>0.0) { - linerate = ctx->LineCount / ctx->LineTime; - } - else { - linerate = 0.0; - } - if (ctx->PolygonTime>0.0) { - polygonrate = ctx->PolygonCount / ctx->PolygonTime; - } - else { - polygonrate = 0.0; - } - if (ctx->ClearTime>0.0) { - clearrate = ctx->ClearCount / ctx->ClearTime; - } - else { - clearrate = 0.0; - } - if (ctx->SwapTime>0.0) { - swaprate = ctx->SwapCount / ctx->SwapTime; - } - else { - swaprate = 0.0; + if (depthBits < 0 || depthBits > 32) { + return GL_FALSE; } - - if (ctx->BeginEndCount>0) { - avgvertices = (GLdouble) ctx->VertexCount / (GLdouble) ctx->BeginEndCount; + if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) { + return GL_FALSE; } - else { - avgvertices = 0.0; - } - - overhead = ctx->BeginEndTime - ctx->VertexTime - ctx->PointTime - - ctx->LineTime - ctx->PolygonTime; - - - printf(" Count Time (s) Rate (/s) \n"); - printf("--------------------------------------------------------\n"); - printf("glBegin/glEnd %7d %8.3f %10.3f\n", - ctx->BeginEndCount, ctx->BeginEndTime, beginendrate); - printf(" vertexes transformed %7d %8.3f %10.3f\n", - ctx->VertexCount, ctx->VertexTime, vertexrate ); - printf(" points rasterized %7d %8.3f %10.3f\n", - ctx->PointCount, ctx->PointTime, pointrate ); - printf(" lines rasterized %7d %8.3f %10.3f\n", - ctx->LineCount, ctx->LineTime, linerate ); - printf(" polygons rasterized %7d %8.3f %10.3f\n", - ctx->PolygonCount, ctx->PolygonTime, polygonrate ); - printf(" overhead %8.3f\n", overhead ); - printf("glClear %7d %8.3f %10.3f\n", - ctx->ClearCount, ctx->ClearTime, clearrate ); - printf("SwapBuffers %7d %8.3f %10.3f\n", - ctx->SwapCount, ctx->SwapTime, swaprate ); - printf("\n"); - - printf("Average number of vertices per begin/end: %8.3f\n", avgvertices ); -} -#endif - - - - - -/**********************************************************************/ -/***** GL Visual allocation/destruction *****/ -/**********************************************************************/ - - -/* - * Allocate a new GLvisual object. - * Input: rgbFlag - GL_TRUE=RGB(A) mode, GL_FALSE=Color Index mode - * alphaFlag - alloc software alpha buffers? - * dbFlag - double buffering? - * stereoFlag - stereo buffer? - * depthFits - requested minimum bits per depth buffer value - * stencilFits - requested minimum bits per stencil buffer value - * accumFits - requested minimum bits per accum buffer component - * indexFits - number of bits per pixel if rgbFlag==GL_FALSE - * red/green/blue/alphaFits - number of bits per color component - * in frame buffer for RGB(A) mode. - * Return: pointer to new GLvisual or NULL if requested parameters can't - * be met. - */ -GLvisual *gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ) -{ - GLvisual *vis; - - if (depthBits > (GLint) (8*sizeof(GLdepth))) { - /* can't meet depth buffer requirements */ - return NULL; + if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) { + return GL_FALSE; } - if (stencilBits > (GLint) (8*sizeof(GLstencil))) { - /* can't meet stencil buffer requirements */ - return NULL; + if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) { + return GL_FALSE; } - if (accumBits > (GLint) (8*sizeof(GLaccum))) { - /* can't meet accum buffer requirements */ - return NULL; + if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) { + return GL_FALSE; } - - vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); - if (!vis) { - return NULL; + if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) { + return GL_FALSE; } vis->RGBAflag = rgbFlag; @@ -302,23 +198,75 @@ GLvisual *gl_create_visual( GLboolean rgbFlag, vis->RedBits = redBits; vis->GreenBits = greenBits; vis->BlueBits = blueBits; - vis->AlphaBits = alphaFlag ? 8*sizeof(GLubyte) : alphaBits; + vis->AlphaBits = alphaBits; + + vis->IndexBits = indexBits; + vis->DepthBits = depthBits; + vis->AccumRedBits = (accumRedBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->AccumGreenBits = (accumGreenBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->AccumBlueBits = (accumBlueBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->AccumAlphaBits = (accumAlphaBits > 0) ? (8 * sizeof(GLaccum)) : 0; + vis->StencilBits = (stencilBits > 0) ? (8 * sizeof(GLstencil)) : 0; + + if (depthBits == 0) { + /* Special case. Even if we don't have a depth buffer we need + * good values for DepthMax for Z vertex transformation purposes. + */ + vis->DepthMax = 1; + vis->DepthMaxF = 1.0F; + } + else if (depthBits < 32) { + vis->DepthMax = (1 << depthBits) - 1; + vis->DepthMaxF = (GLfloat) vis->DepthMax; + } + else { + /* Special case since shift values greater than or equal to the + * number of bits in the left hand expression's type are + * undefined. + */ + vis->DepthMax = 0xffffffff; + vis->DepthMaxF = (GLfloat) vis->DepthMax; + } - vis->IndexBits = indexBits; - vis->DepthBits = (depthBits>0) ? 8*sizeof(GLdepth) : 0; - vis->AccumBits = (accumBits>0) ? 8*sizeof(GLaccum) : 0; - vis->StencilBits = (stencilBits>0) ? 8*sizeof(GLstencil) : 0; + return GL_TRUE; +} - vis->SoftwareAlpha = alphaFlag; - return vis; +/* This function should no longer be used. Use _mesa_create_visual() instead */ +GLvisual * +gl_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint depthBits, + GLint stencilBits, + GLint accumBits, + GLint indexBits, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits ) +{ + (void) alphaFlag; + return _mesa_create_visual(rgbFlag, dbFlag, stereoFlag, + redBits, greenBits, blueBits, alphaBits, + indexBits, depthBits, stencilBits, + accumBits, accumBits, accumBits, accumBits, 0); } +void +_mesa_destroy_visual( GLvisual *vis ) +{ + FREE(vis); +} -void gl_destroy_visual( GLvisual *vis ) + +/* obsolete */ +void +gl_destroy_visual( GLvisual *vis ) { - FREE( vis ); + _mesa_destroy_visual(vis); } @@ -340,18 +288,38 @@ void gl_destroy_visual( GLvisual *vis ) * Return: pointer to new GLframebuffer struct or NULL if error. */ -GLframebuffer *gl_create_framebuffer( GLvisual *visual, - GLboolean softwareDepth, - GLboolean softwareStencil, - GLboolean softwareAccum, - GLboolean softwareAlpha ) +GLframebuffer * +gl_create_framebuffer( GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ) { - GLframebuffer *buffer; - - buffer = CALLOC_STRUCT(gl_frame_buffer); - if (!buffer) { - return NULL; + GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer); + assert(visual); + if (buffer) { + _mesa_initialize_framebuffer(buffer, visual, + softwareDepth, softwareStencil, + softwareAccum, softwareAlpha ); } + return buffer; +} + + +/* + * Initialize a GLframebuffer object. + * Input: See gl_create_framebuffer() above. + */ +void +_mesa_initialize_framebuffer( GLframebuffer *buffer, + GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ) +{ + assert(buffer); + assert(visual); /* sanity checks */ if (softwareDepth ) { @@ -362,7 +330,9 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual, } if (softwareAccum) { assert(visual->RGBAflag); - assert(visual->AccumBits > 0); + assert(visual->AccumRedBits > 0); + assert(visual->AccumGreenBits > 0); + assert(visual->AccumBlueBits > 0); } if (softwareAlpha) { assert(visual->RGBAflag); @@ -374,20 +344,18 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual, buffer->UseSoftwareStencilBuffer = softwareStencil; buffer->UseSoftwareAccumBuffer = softwareAccum; buffer->UseSoftwareAlphaBuffers = softwareAlpha; - - return buffer; } - /* * Free a framebuffer struct and its buffers. */ -void gl_destroy_framebuffer( GLframebuffer *buffer ) +void +gl_destroy_framebuffer( GLframebuffer *buffer ) { if (buffer) { - if (buffer->Depth) { - FREE( buffer->Depth ); + if (buffer->DepthBuffer) { + FREE( buffer->DepthBuffer ); } if (buffer->Accum) { FREE( buffer->Accum ); @@ -424,7 +392,8 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock); /* * This function just calls all the various one-time-init functions in Mesa. */ -static void one_time_init( void ) +static void +one_time_init( void ) { static GLboolean alreadyCalled = GL_FALSE; _glthread_LOCK_MUTEX(OneTimeLock); @@ -440,7 +409,7 @@ static void one_time_init( void ) gl_init_clip(); gl_init_eval(); _mesa_init_fog(); - gl_init_math(); + _mesa_init_math(); gl_init_lists(); gl_init_shade(); gl_init_texture(); @@ -471,7 +440,8 @@ static void one_time_init( void ) /* * Allocate and initialize a shared context state structure. */ -static struct gl_shared_state *alloc_shared_state( void ) +static struct gl_shared_state * +alloc_shared_state( void ) { GLuint d; struct gl_shared_state *ss; @@ -496,6 +466,14 @@ static struct gl_shared_state *alloc_shared_state( void ) ss->DefaultD[d]->RefCount++; /* don't free if not in use */ } + ss->DefaultCubeMap = gl_alloc_texture_object(ss, 0, 6); + if (!ss->DefaultCubeMap) { + outOfMemory = GL_TRUE; + } + else { + ss->DefaultCubeMap->RefCount++; + } + if (!ss->DisplayList || !ss->TexObjects || outOfMemory) { /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) @@ -508,6 +486,8 @@ static struct gl_shared_state *alloc_shared_state( void ) gl_free_texture_object(ss, ss->DefaultD[2]); if (ss->DefaultD[3]) gl_free_texture_object(ss, ss->DefaultD[3]); + if (ss->DefaultCubeMap) + gl_free_texture_object(ss, ss->DefaultCubeMap); FREE(ss); return NULL; } @@ -520,7 +500,8 @@ static struct gl_shared_state *alloc_shared_state( void ) /* * Deallocate a shared state context and all children structures. */ -static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) +static void +free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) { /* Free display lists */ while (1) { @@ -553,7 +534,8 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) * Initialize the nth light. Note that the defaults for light 0 are * different than the other lights. */ -static void init_light( struct gl_light *l, GLuint n ) +static void +init_light( struct gl_light *l, GLuint n ) { make_empty_list( l ); @@ -580,7 +562,8 @@ static void init_light( struct gl_light *l, GLuint n ) -static void init_lightmodel( struct gl_lightmodel *lm ) +static void +init_lightmodel( struct gl_lightmodel *lm ) { ASSIGN_4V( lm->Ambient, 0.2, 0.2, 0.2, 1.0 ); lm->LocalViewer = GL_FALSE; @@ -589,7 +572,8 @@ static void init_lightmodel( struct gl_lightmodel *lm ) } -static void init_material( struct gl_material *m ) +static void +init_material( struct gl_material *m ) { ASSIGN_4V( m->Ambient, 0.2, 0.2, 0.2, 1.0 ); ASSIGN_4V( m->Diffuse, 0.8, 0.8, 0.8, 1.0 ); @@ -603,7 +587,8 @@ static void init_material( struct gl_material *m ) -static void init_texture_unit( GLcontext *ctx, GLuint unit ) +static void +init_texture_unit( GLcontext *ctx, GLuint unit ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -627,10 +612,12 @@ static void init_texture_unit( GLcontext *ctx, GLuint unit ) texUnit->CurrentD[1] = ctx->Shared->DefaultD[1]; texUnit->CurrentD[2] = ctx->Shared->DefaultD[2]; texUnit->CurrentD[3] = ctx->Shared->DefaultD[3]; + texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; } -static void init_fallback_arrays( GLcontext *ctx ) +static void +init_fallback_arrays( GLcontext *ctx ) { struct gl_client_array *cl; GLuint i; @@ -680,7 +667,8 @@ static void init_fallback_arrays( GLcontext *ctx ) /* Initialize a 1-D evaluator map */ -static void init_1d_map( struct gl_1d_map *map, int n, const float *initial ) +static void +init_1d_map( struct gl_1d_map *map, int n, const float *initial ) { map->Order = 1; map->u1 = 0.0; @@ -695,7 +683,8 @@ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial ) /* Initialize a 2-D evaluator map */ -static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) +static void +init_2d_map( struct gl_2d_map *map, int n, const float *initial ) { map->Uorder = 1; map->Vorder = 1; @@ -712,22 +701,11 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) } -static void init_color_table( struct gl_color_table *p ) -{ - p->Table[0] = 255; - p->Table[1] = 255; - p->Table[2] = 255; - p->Table[3] = 255; - p->Size = 1; - p->IntFormat = GL_RGBA; - p->Format = GL_RGBA; -} - - /* * Initialize the attribute groups in a GLcontext. */ -static void init_attrib_groups( GLcontext *ctx ) +static void +init_attrib_groups( GLcontext *ctx ) { GLuint i, j; @@ -736,6 +714,7 @@ static void init_attrib_groups( GLcontext *ctx ) /* Constants, may be overriden by device drivers */ ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; ctx->Const.MaxTextureSize = 1 << (MAX_TEXTURE_LEVELS - 1); + ctx->Const.MaxCubeTextureSize = ctx->Const.MaxTextureSize; ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; ctx->Const.SubPixelBits = SUB_PIXEL_BITS; @@ -750,13 +729,17 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; ctx->Const.LineWidthGranularity = LINE_WIDTH_GRANULARITY; ctx->Const.NumAuxBuffers = NUM_AUX_BUFFERS; + ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; + ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; + ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; + ctx->Const.NumCompressedTextureFormats = 0; /* Modelview matrix */ gl_matrix_ctr( &ctx->ModelView ); gl_matrix_alloc_inv( &ctx->ModelView ); ctx->ModelViewStackDepth = 0; - for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { gl_matrix_ctr( &ctx->ModelViewStack[i] ); gl_matrix_alloc_inv( &ctx->ModelViewStack[i] ); } @@ -773,7 +756,7 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */ ctx->NearFarStack[0][1] = 0.0; /* sense mathematically. */ - for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) { gl_matrix_ctr( &ctx->ProjectionStack[i] ); gl_matrix_alloc_inv( &ctx->ProjectionStack[i] ); } @@ -782,11 +765,18 @@ static void init_attrib_groups( GLcontext *ctx ) for (i=0; i<MAX_TEXTURE_UNITS; i++) { gl_matrix_ctr( &ctx->TextureMatrix[i] ); ctx->TextureStackDepth[i] = 0; - for (j = 0 ; j < MAX_TEXTURE_STACK_DEPTH ; j++) { + for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) { ctx->TextureStack[i][j].inv = 0; } } + /* Color matrix */ + gl_matrix_ctr(&ctx->ColorMatrix); + ctx->ColorStackDepth = 0; + for (j = 0; j < MAX_COLOR_STACK_DEPTH - 1; j++) { + gl_matrix_ctr(&ctx->ColorStack[j]); + } + /* Accumulate buffer group */ ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 ); @@ -845,6 +835,7 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Depth.Clear = 1.0; ctx->Depth.Func = GL_LESS; ctx->Depth.Mask = GL_TRUE; + ctx->Depth.OcclusionTest = GL_FALSE; /* Evaluators group */ ctx->Eval.Map1Color4 = GL_FALSE; @@ -920,11 +911,38 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Hint.LineSmooth = GL_DONT_CARE; ctx->Hint.PolygonSmooth = GL_DONT_CARE; ctx->Hint.Fog = GL_DONT_CARE; - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; ctx->Hint.StrictLighting = GL_TRUE; + ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; + ctx->Hint.TextureCompression = GL_DONT_CARE; + + /* Histogram group */ + ctx->Histogram.Width = 0; + ctx->Histogram.Format = GL_RGBA; + ctx->Histogram.Sink = GL_FALSE; + ctx->Histogram.RedSize = 0xffffffff; + ctx->Histogram.GreenSize = 0xffffffff; + ctx->Histogram.BlueSize = 0xffffffff; + ctx->Histogram.AlphaSize = 0xffffffff; + ctx->Histogram.LuminanceSize = 0xffffffff; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + /* Min/Max group */ + ctx->MinMax.Format = GL_RGBA; + ctx->MinMax.Sink = GL_FALSE; + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; + + /* Pipeline */ gl_pipeline_init( ctx ); @@ -1022,6 +1040,29 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Pixel.MapGtoG[0] = 0.0; ctx->Pixel.MapBtoB[0] = 0.0; ctx->Pixel.MapAtoA[0] = 0.0; + ctx->Pixel.HistogramEnabled = GL_FALSE; + ctx->Pixel.MinMaxEnabled = GL_FALSE; + ctx->Pixel.PixelTextureEnabled = GL_FALSE; + ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0); + ctx->Pixel.ColorTableEnabled = GL_FALSE; + ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE; + ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE; + ctx->Pixel.Convolution1DEnabled = GL_FALSE; + ctx->Pixel.Convolution2DEnabled = GL_FALSE; + ctx->Pixel.Separable2DEnabled = GL_FALSE; + for (i = 0; i < 3; i++) { + ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0); + ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE; + ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0); + } + ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); /* Point group */ ctx->Point.SmoothFlag = GL_FALSE; @@ -1077,7 +1118,7 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Texture.Enabled = 0; for (i=0; i<MAX_TEXTURE_UNITS; i++) init_texture_unit( ctx, i ); - init_color_table(&ctx->Texture.Palette); + _mesa_init_colortable(&ctx->Texture.Palette); /* Transformation group */ ctx->Transform.MatrixMode = GL_MODELVIEW; @@ -1100,8 +1141,8 @@ static void init_attrib_groups( GLcontext *ctx ) #define Sz 10 #define Tz 14 - ctx->Viewport.WindowMap.m[Sz] = 0.5 * DEPTH_SCALE; - ctx->Viewport.WindowMap.m[Tz] = 0.5 * DEPTH_SCALE; + ctx->Viewport.WindowMap.m[Sz] = 0.5 * ctx->Visual->DepthMaxF; + ctx->Viewport.WindowMap.m[Tz] = 0.5 * ctx->Visual->DepthMaxF; #undef Sz #undef Tz @@ -1185,6 +1226,23 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->AttribStackDepth = 0; ctx->ClientAttribStackDepth = 0; + /* Display list */ + ctx->CallDepth = 0; + ctx->ExecuteFlag = GL_TRUE; + ctx->CompileFlag = GL_FALSE; + ctx->CurrentListPtr = NULL; + ctx->CurrentBlock = NULL; + ctx->CurrentListNum = 0; + ctx->CurrentPos = 0; + + /* Color tables */ + _mesa_init_colortable(&ctx->ColorTable); + _mesa_init_colortable(&ctx->ProxyColorTable); + _mesa_init_colortable(&ctx->PostConvolutionColorTable); + _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable); + _mesa_init_colortable(&ctx->PostColorMatrixColorTable); + _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); + /* Miscellaneous */ ctx->NewState = NEW_ALL; ctx->RenderMode = GL_RENDER; @@ -1196,18 +1254,11 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->NeedEyeNormals = GL_FALSE; ctx->vb_proj_matrix = &ctx->ModelProjectMatrix; - /* Display list */ - ctx->CallDepth = 0; - ctx->ExecuteFlag = GL_TRUE; - ctx->CompileFlag = GL_FALSE; - ctx->CurrentListPtr = NULL; - ctx->CurrentBlock = NULL; - ctx->CurrentListNum = 0; - ctx->CurrentPos = 0; - ctx->ErrorValue = (GLenum) GL_NO_ERROR; ctx->CatchSignals = GL_TRUE; + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; /* For debug/development only */ ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE; @@ -1231,7 +1282,8 @@ static void init_attrib_groups( GLcontext *ctx ) * the allocations clean up and return GL_FALSE. * Return: GL_TRUE=success, GL_FALSE=failure */ -static GLboolean alloc_proxy_textures( GLcontext *ctx ) +static GLboolean +alloc_proxy_textures( GLcontext *ctx ) { GLboolean out_of_memory; GLint i; @@ -1256,9 +1308,9 @@ static GLboolean alloc_proxy_textures( GLcontext *ctx ) out_of_memory = GL_FALSE; for (i=0;i<MAX_TEXTURE_LEVELS;i++) { - ctx->Texture.Proxy1D->Image[i] = gl_alloc_texture_image(); - ctx->Texture.Proxy2D->Image[i] = gl_alloc_texture_image(); - ctx->Texture.Proxy3D->Image[i] = gl_alloc_texture_image(); + ctx->Texture.Proxy1D->Image[i] = _mesa_alloc_texture_image(); + ctx->Texture.Proxy2D->Image[i] = _mesa_alloc_texture_image(); + ctx->Texture.Proxy3D->Image[i] = _mesa_alloc_texture_image(); if (!ctx->Texture.Proxy1D->Image[i] || !ctx->Texture.Proxy2D->Image[i] || !ctx->Texture.Proxy3D->Image[i]) { @@ -1268,13 +1320,13 @@ static GLboolean alloc_proxy_textures( GLcontext *ctx ) if (out_of_memory) { for (i=0;i<MAX_TEXTURE_LEVELS;i++) { if (ctx->Texture.Proxy1D->Image[i]) { - gl_free_texture_image(ctx->Texture.Proxy1D->Image[i]); + _mesa_free_texture_image(ctx->Texture.Proxy1D->Image[i]); } if (ctx->Texture.Proxy2D->Image[i]) { - gl_free_texture_image(ctx->Texture.Proxy2D->Image[i]); + _mesa_free_texture_image(ctx->Texture.Proxy2D->Image[i]); } if (ctx->Texture.Proxy3D->Image[i]) { - gl_free_texture_image(ctx->Texture.Proxy3D->Image[i]); + _mesa_free_texture_image(ctx->Texture.Proxy3D->Image[i]); } } gl_free_texture_object(NULL, ctx->Texture.Proxy1D); @@ -1292,12 +1344,15 @@ static GLboolean alloc_proxy_textures( GLcontext *ctx ) /* * Initialize a GLcontext struct. */ -GLboolean gl_initialize_context_data( GLcontext *ctx, - GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ) +GLboolean +_mesa_initialize_context( GLcontext *ctx, + GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ) { + GLuint dispatchSize; + (void) direct; /* not used */ /* misc one-time initializations */ @@ -1360,10 +1415,6 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT; } -#ifdef PROFILE - init_timings( ctx ); -#endif - if (!alloc_proxy_textures(ctx)) { free_shared_state(ctx, ctx->Shared); FREE(ctx->VB); @@ -1372,9 +1423,27 @@ GLboolean gl_initialize_context_data( 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); + + /* 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 + * Mesa we do this to accomodate different versions of libGL and various + * DRI drivers. + */ + dispatchSize = MAX2(_glapi_get_dispatch_table_size(), + sizeof(struct _glapi_table) / sizeof(void *)); + /* setup API dispatch tables */ - ctx->Exec = CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); - ctx->Save = CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); + ctx->Exec = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*)); + ctx->Save = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*)); if (!ctx->Exec || !ctx->Save) { free_shared_state(ctx, ctx->Shared); FREE(ctx->VB); @@ -1383,8 +1452,8 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, FREE(ctx->Exec); FREE(ctx); } - _mesa_init_exec_table( ctx->Exec ); - _mesa_init_dlist_table( ctx->Save ); + _mesa_init_exec_table(ctx->Exec, dispatchSize); + _mesa_init_dlist_table(ctx->Save, dispatchSize); ctx->CurrentDispatch = ctx->Exec; return GL_TRUE; @@ -1399,18 +1468,18 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, * driver_ctx - pointer to device driver's context state struct * Return: pointer to a new gl_context struct or NULL if error. */ -GLcontext *gl_create_context( GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ) +GLcontext * +gl_create_context( GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ) { GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) ); if (!ctx) { return NULL; } - if (gl_initialize_context_data(ctx, visual, share_list, - driver_ctx, direct)) { + if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) { return ctx; } else { @@ -1425,34 +1494,35 @@ GLcontext *gl_create_context( GLvisual *visual, * Free the data associated with the given context. * But don't free() the GLcontext struct itself! */ -void gl_free_context_data( GLcontext *ctx ) +void +gl_free_context_data( GLcontext *ctx ) { - GLuint i; struct gl_shine_tab *s, *tmps; + GLuint i, j; /* if we're destroying the current context, unbind it first */ if (ctx == gl_get_current_context()) { gl_make_current(NULL, NULL); } -#ifdef PROFILE - if (getenv("MESA_PROFILE")) { - print_timings( ctx ); - } -#endif - gl_matrix_dtr( &ctx->ModelView ); - for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { gl_matrix_dtr( &ctx->ModelViewStack[i] ); } gl_matrix_dtr( &ctx->ProjectionMatrix ); - for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) { gl_matrix_dtr( &ctx->ProjectionStack[i] ); } + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + gl_matrix_dtr( &ctx->TextureMatrix[i] ); + for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) { + gl_matrix_dtr( &ctx->TextureStack[i][j] ); + } + } FREE( ctx->PB ); - if(ctx->input != ctx->VB->IM) + if (ctx->input != ctx->VB->IM) gl_immediate_free( ctx->input ); gl_vb_free( ctx->VB ); @@ -1515,6 +1585,11 @@ void gl_free_context_data( GLcontext *ctx ) if (ctx->EvalMap.Map2Texture4.Points) FREE( ctx->EvalMap.Map2Texture4.Points ); + _mesa_free_colortable_data( &ctx->ColorTable ); + _mesa_free_colortable_data( &ctx->PostConvolutionColorTable ); + _mesa_free_colortable_data( &ctx->PostColorMatrixColorTable ); + _mesa_free_colortable_data( &ctx->Texture.Palette ); + /* Free cache of immediate buffers. */ while (ctx->nr_im_queued-- > 0) { struct immediate * next = ctx->freed_im_queue->next; @@ -1532,7 +1607,8 @@ void gl_free_context_data( GLcontext *ctx ) /* * Destroy a GLcontext structure. */ -void gl_destroy_context( GLcontext *ctx ) +void +gl_destroy_context( GLcontext *ctx ) { if (ctx) { gl_free_context_data(ctx); @@ -1546,7 +1622,8 @@ void gl_destroy_context( GLcontext *ctx ) * Called by the driver after both the context and driver are fully * initialized. Currently just reads the config file. */ -void gl_context_initialize( GLcontext *ctx ) +void +gl_context_initialize( GLcontext *ctx ) { gl_read_config_file( ctx ); } @@ -1559,7 +1636,8 @@ void gl_context_initialize( GLcontext *ctx ) * dst - destination context * mask - bitwise OR of GL_*_BIT flags */ -void gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) +void +gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) { if (mask & GL_ACCUM_BUFFER_BIT) { MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) ); @@ -1767,7 +1845,7 @@ _mesa_get_dispatch(GLcontext *ctx) void gl_problem( const GLcontext *ctx, const char *s ) { fprintf( stderr, "Mesa implementation error: %s\n", s ); - fprintf( stderr, "Report to mesa-bugs@mesa3d.org\n" ); + fprintf( stderr, "Report to Mesa bug database at www.mesa3d.org\n" ); (void) ctx; } diff --git a/xc/extras/Mesa/src/context.h b/xc/extras/Mesa/src/context.h index 535ac238e..51c4aaba3 100644 --- a/xc/extras/Mesa/src/context.h +++ b/xc/extras/Mesa/src/context.h @@ -56,20 +56,62 @@ * the colorbuffer, depth buffer, stencil buffer and accum buffer which will * be used by the GL context and framebuffer. */ -extern GLvisual *gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ); - -extern void gl_destroy_visual( GLvisual *vis ); +extern GLvisual * +_mesa_create_visual( GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ); + +extern GLboolean +_mesa_initialize_visual( GLvisual *v, + GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ); + +/* this function is obsolete */ +extern GLvisual * +gl_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint depthBits, + GLint stencilBits, + GLint accumBits, + GLint indexBits, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits ); + + +extern void +_mesa_destroy_visual( GLvisual *vis ); + +/*obsolete */ extern void gl_destroy_visual( GLvisual *vis ); + /* @@ -77,13 +119,23 @@ extern void gl_destroy_visual( GLvisual *vis ); * It bundles up the depth buffer, stencil buffer and accum buffers into a * single entity. */ -extern GLframebuffer *gl_create_framebuffer( GLvisual *visual, - GLboolean softwareDepth, - GLboolean softwareStencil, - GLboolean softwareAccum, - GLboolean softwareAlpha ); +extern GLframebuffer * +gl_create_framebuffer( GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ); + +extern void +_mesa_initialize_framebuffer( GLframebuffer *fb, + GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ); -extern void gl_destroy_framebuffer( GLframebuffer *buffer ); +extern void +gl_destroy_framebuffer( GLframebuffer *buffer ); @@ -91,36 +143,46 @@ extern void gl_destroy_framebuffer( GLframebuffer *buffer ); * Create/destroy a GLcontext. A GLcontext is like a GLX context. It * contains the rendering state. */ -extern GLcontext *gl_create_context( GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct); +extern GLcontext * +gl_create_context( GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct); + +extern GLboolean +_mesa_initialize_context( GLcontext *ctx, + GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ); -extern GLboolean gl_initialize_context_data( GLcontext *ctx, - GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ); +extern void +gl_free_context_data( GLcontext *ctx ); -extern void gl_free_context_data( GLcontext *ctx ); +extern void +gl_destroy_context( GLcontext *ctx ); -extern void gl_destroy_context( GLcontext *ctx ); +extern void +gl_context_initialize( GLcontext *ctx ); -extern void gl_context_initialize( GLcontext *ctx ); +extern void +gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); -extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); +extern void +gl_make_current( GLcontext *ctx, GLframebuffer *buffer ); -extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer ); +extern void +gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); -extern void gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ); +extern GLcontext * +gl_get_current_context(void); -extern GLcontext *gl_get_current_context(void); /* @@ -141,7 +203,7 @@ do { \ extern struct immediate *_mesa_CurrentInput; -#define GET_CURRENT_CONTEXT(C) GLcontext *C = _glapi_Context +#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context #define GET_IMMEDIATE struct immediate *IM = _mesa_CurrentInput @@ -168,35 +230,26 @@ _mesa_get_dispatch(GLcontext *ctx); * Miscellaneous */ -extern void gl_problem( const GLcontext *ctx, const char *s ); - -extern void gl_warning( const GLcontext *ctx, const char *s ); - -extern void gl_error( GLcontext *ctx, GLenum error, const char *s ); - -extern void gl_compile_error( GLcontext *ctx, GLenum error, const char *s ); - +extern void +gl_problem( const GLcontext *ctx, const char *s ); +extern void +gl_warning( const GLcontext *ctx, const char *s ); extern void -_mesa_Finish( void ); +gl_error( GLcontext *ctx, GLenum error, const char *s ); extern void -_mesa_Flush( void ); +gl_compile_error( GLcontext *ctx, GLenum error, const char *s ); extern void -_mesa_init_no_op_table(struct _glapi_table *exec); +_mesa_Finish( void ); extern void -_mesa_init_exec_table(struct _glapi_table *exec); - - +_mesa_Flush( void ); -#ifdef PROFILE -extern GLdouble gl_time( void ); -#endif #endif diff --git a/xc/extras/Mesa/src/copypix.c b/xc/extras/Mesa/src/copypix.c index a77086ccf..e76c170f6 100644 --- a/xc/extras/Mesa/src/copypix.c +++ b/xc/extras/Mesa/src/copypix.c @@ -32,13 +32,16 @@ #include "copypix.h" #include "depth.h" #include "feedback.h" +#include "imaging.h" #include "macros.h" #include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -83,6 +86,7 @@ static void copy_rgba_pixels( GLcontext *ctx, GLubyte *saveReadAlpha; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; + GLboolean applyTransferOps; /* Determine if copy should be done bottom-to-top or top-to-bottom */ if (srcy < desty) { @@ -103,7 +107,7 @@ static void copy_rgba_pixels( GLcontext *ctx, if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMax); for (i=0;i<width;i++) { zspan[i] = z; } @@ -156,6 +160,15 @@ static void copy_rgba_pixels( GLcontext *ctx, p = NULL; } + applyTransferOps = ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled; + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { if (overlapping) { MEMCPY(rgba, p, width * sizeof(GLubyte) * 4); @@ -188,12 +201,70 @@ static void copy_rgba_pixels( GLcontext *ctx, ctx->ReadBuffer->Alpha = saveReadAlpha; } - if (ctx->Pixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_rgba( ctx, width, rgba ); + if (applyTransferOps) { + const GLfloat scale = (1.0F / 255.0F); + GLfloat rgbaFloat[MAX_WIDTH][4]; + GLuint k; + /* convert ubyte 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; + } + /* scale & bias */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, width, rgbaFloat); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba(ctx, width, rgbaFloat); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, width, rgbaFloat); + } + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, width, rgbaFloat); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, width, rgbaFloat); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, width, (CONST GLfloat (*)[4]) rgbaFloat); + } + /* update min/max */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, width, (CONST GLfloat (*)[4]) rgbaFloat); + } + /* clamp to [0,1] and convert float back to ubyte */ + for (k = 0; k < width; k++) { + GLint r = (GLint) (rgbaFloat[k][RCOMP] * 255.0F); + GLint g = (GLint) (rgbaFloat[k][GCOMP] * 255.0F); + GLint b = (GLint) (rgbaFloat[k][BCOMP] * 255.0F); + GLint a = (GLint) (rgbaFloat[k][ACOMP] * 255.0F); + rgba[k][RCOMP] = (GLubyte) CLAMP(r, 0, 255); + rgba[k][GCOMP] = (GLubyte) CLAMP(g, 0, 255); + rgba[k][BCOMP] = (GLubyte) CLAMP(b, 0, 255); + rgba[k][ACOMP] = (GLubyte) CLAMP(a, 0, 255); + } } - if (ctx->Pixel.MapColorFlag) { - gl_map_rgba( ctx, width, rgba ); + + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } } + if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) { (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy, (const GLubyte (*)[4])rgba, NULL ); @@ -244,7 +315,7 @@ static void copy_ci_pixels( GLcontext *ctx, if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMax); for (i=0;i<width;i++) { zspan[i] = z; } @@ -298,10 +369,10 @@ static void copy_ci_pixels( GLcontext *ctx, } if (shift_or_offset) { - gl_shift_and_offset_ci( ctx, width, indexes ); + _mesa_shift_and_offset_ci( ctx, width, indexes ); } if (ctx->Pixel.MapColorFlag) { - gl_map_ci( ctx, width, indexes ); + _mesa_map_ci( ctx, width, indexes ); } if (zoom) { @@ -335,7 +406,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; - if (!ctx->ReadBuffer->Depth || !ctx->DrawBuffer->Depth) { + if (!ctx->ReadBuffer->DepthBuffer || !ctx->DrawBuffer->DepthBuffer) { gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } @@ -401,7 +472,7 @@ 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] = (GLint) (CLAMP( d, 0.0F, 1.0F ) * DEPTH_SCALE); + zspan[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->Visual->DepthMax); } if (ctx->Visual->RGBAflag) { @@ -473,7 +544,7 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } p = psten; for (j = 0; j < height; j++, ssy += stepy) { - gl_read_stencil_span( ctx, width, srcx, ssy, p ); + _mesa_read_stencil_span( ctx, width, srcx, ssy, p ); p += width; } p = psten; @@ -491,21 +562,21 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, p += width; } else { - gl_read_stencil_span( ctx, width, srcx, sy, stencil ); + _mesa_read_stencil_span( ctx, width, srcx, sy, stencil ); } if (shift_or_offset) { - gl_shift_and_offset_stencil( ctx, width, stencil ); + _mesa_shift_and_offset_stencil( ctx, width, stencil ); } if (ctx->Pixel.MapStencilFlag) { - gl_map_stencil( ctx, width, stencil ); + _mesa_map_stencil( ctx, width, stencil ); } if (zoom) { gl_write_zoomed_stencil_span( ctx, width, destx, dy, stencil, desty ); } else { - gl_write_stencil_span( ctx, width, destx, dy, stencil ); + _mesa_write_stencil_span( ctx, width, destx, dy, stencil ); } } @@ -542,6 +613,14 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, destx = (GLint) (ctx->Current.RasterPos[0] + 0.5F); desty = (GLint) (ctx->Current.RasterPos[1] + 0.5F); + ctx->OcclusionResult = GL_TRUE; + + if (ctx->Driver.CopyPixels && + (*ctx->Driver.CopyPixels)( ctx, srcx, srcy, width, height, + destx, desty, type )) { + return; + } + if (type == GL_COLOR && ctx->Visual->RGBAflag) { copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty ); } diff --git a/xc/extras/Mesa/src/dd.h b/xc/extras/Mesa/src/dd.h index 25a82a546..ad389df4a 100644 --- a/xc/extras/Mesa/src/dd.h +++ b/xc/extras/Mesa/src/dd.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -390,6 +390,8 @@ struct dd_function_table { /*** *** For supporting hardware Z buffers: *** Either ALL or NONE of these functions must be implemented! + *** NOTE that Each depth value is a 32-bit GLuint. If the depth + *** buffer is less than 32 bits deep then the extra upperbits are zero. ***/ void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, @@ -431,13 +433,11 @@ struct dd_function_table { * Else, only write stencil[i] if mask[i] is non-zero. */ - void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLstencil stencil[] ); /* Read a horizontal span of stencil values from the stencil buffer. */ - void (*WriteStencilPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLstencil stencil[], @@ -454,18 +454,10 @@ struct dd_function_table { */ - /*** - *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions: + *** glDraw/Read/CopyPixels and glBitmap functions: ***/ - points_func PointsFunc; - line_func LineFunc; - triangle_func TriangleFunc; - quad_func QuadFunc; - rect_func RectFunc; - - GLboolean (*DrawPixels)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -477,6 +469,25 @@ struct dd_function_table { * must do the job. */ + GLboolean (*ReadPixels)( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + GLvoid *dest ); + /* Called by glReadPixels. + * Return GL_TRUE if operation completed, else return GL_FALSE. + * This function must respect all glPixelTransfer settings. + */ + + GLboolean (*CopyPixels)( GLcontext *ctx, + GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type ); + /* Do a glCopyPixels. Return GL_TRUE if operation completed, else + * return GL_FALSE. This function must respect all rasterization + * state, glPixelTransfer, glPixelZoom, etc. + */ + GLboolean (*Bitmap)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, @@ -484,78 +495,17 @@ struct dd_function_table { /* This is called by glBitmap. Works the same as DrawPixels, above. */ - void (*RenderStart)( GLcontext *ctx ); - void (*RenderFinish)( GLcontext *ctx ); - /* KW: These replace Begin and End, and have more relaxed semantics. - * They are called prior-to and after one or more vb flush, and are - * thus decoupled from the gl_begin/gl_end pairs, which are possibly - * more frequent. If a begin/end pair covers >1 vertex buffer, these - * are called at most once for the pair. (a bit broken at present) - */ - - void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end ); - /* This function, if not NULL, is called whenever new window coordinates - * are put in the vertex buffer. The vertices in question are those n - * such that start <= n < end. - * The device driver can convert the window coords to its own specialized - * format. The 3Dfx driver uses this. - * - * Note: Deprecated in favour of RegisterPipelineStages, below. - */ - - - render_func *RenderVBClippedTab; - render_func *RenderVBCulledTab; - render_func *RenderVBRawTab; - /* These function tables allow the device driver to rasterize an - * entire begin/end group of primitives at once. See the - * gl_render_vb() function in vbrender.c for more details. - */ - - - void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive ); - /* If registered, this will be called when rendering transitions between - * points, lines and triangles. It is not called on transitions between - * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between - * triangles and quads or triangles and polygons. - */ - - GLuint TriangleCaps; - /* Holds a list of the reasons why we might normally want to call - * render_triangle, but which are in fact implemented by the - * driver. The FX driver sets this to DD_TRI_CULL, and will soon - * implement DD_TRI_OFFSET. - */ - - - GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno ); - /* Driver may request additional render passes by returning GL_TRUE - * when this function is called. This function will be called - * after the first pass, and passes will be made until the function - * returns GL_FALSE. If no function is registered, only one pass - * is made. - * - * This function will be first invoked with passno == 1. - */ /*** *** Texture mapping functions: ***/ - void (*TexEnv)( GLcontext *ctx, GLenum pname, const GLfloat *param ); - /* - * Called whenever glTexEnv*() is called. - * Pname will be one of GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR. - * If pname is GL_TEXTURE_ENV_MODE then param will be one - * of GL_MODULATE, GL_BLEND, GL_DECAL, or GL_REPLACE. - */ - void (*TexImage)( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image ); - /* - * Called whenever a texture object's image is changed. + /* XXX this function is obsolete */ + /* Called whenever a texture object's image is changed. * texObject is the number of the texture object being changed. * level indicates the mipmap level. * internalFormat is the format in which the texture is to be stored. @@ -569,70 +519,310 @@ struct dd_function_table { GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image ); - /* - * Called from glTexSubImage() to define a sub-region of a texture. + /* XXX this function is obsolete */ + /* Called from glTexSubImage() to define a sub-region of a texture. + */ + + + GLboolean (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ); + GLboolean (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ); + GLboolean (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ); + /* Called by glTexImage1/2/3D. + * Will not be called if any glPixelTransfer operations are enabled. + * Arguments: + * <target>, <level>, <format>, <type> and <pixels> are user specified. + * <packing> indicates the image packing of pixels. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, depth, border and internalFormat information. + * <retainInternalCopy> is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. If GL_FALSE is returned, this function will be + * called a second time after the texture image has been unpacked into + * GLubytes. It may be easier for the driver to handle then. + */ + + GLboolean (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /* Called by glTexSubImage1/2/3D. + * Will not be called if any glPixelTransfer operations are enabled. + * Arguments: + * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>, + * <depth>, <format>, <type> and <pixels> are user specified. + * <packing> indicates the image packing of pixels. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, border and internalFormat information. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. If GL_FALSE is returned, then TexImage1/2/3D will + * be called with the complete texture image. + */ + + GLboolean (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLint border ); + GLboolean (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border ); + /* Called by glCopyTexImage1D and glCopyTexImage2D. + * Will not be called if any glPixelTransfer operations are enabled. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + GLboolean (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, + GLint x, GLint y, GLsizei width ); + GLboolean (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + GLboolean (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + /* Called by glCopyTexSubImage1/2/3D. + * Will not be called if any glPixelTransfer operations are enabled. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + GLvoid *(*GetTexImage)( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum *formatOut, GLenum *typeOut, + GLboolean *freeImageOut ); + /* Called by glGetTexImage or by core Mesa when a texture image + * is needed for software fallback rendering. + * Return the address of the texture image or NULL if failure. + * The image must be tightly packed (i.e. row stride = image width) + * Return the image's format and type in formatOut and typeOut. + * The format and type must be values which are accepted by glTexImage. + * Set the freeImageOut flag if the returned image should be deallocated + * with FREE() when finished. + * The size of the image can be deduced from the target and level. + * Core Mesa will perform any image format/type conversions that are needed. + */ + + GLboolean (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, + GLint level, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + GLboolean (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, + GLint level, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + GLboolean (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, + GLint level, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + /* Called by glCompressedTexImage1/2/3D. + * Arguments: + * <target>, <level>, <internalFormat>, <data> are user specified. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, depth, border and internalFormat information. + * <retainInternalCopy> is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + GLboolean (*CompressedTexSubImage1D)( 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 ); + GLboolean (*CompressedTexSubImage2D)( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*CompressedTexSubImage3D)( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, + GLsizei width, GLint height, + GLint depth, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /* Called by glCompressedTexSubImage1/2/3D. + * Arguments: + * <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>, + * <imageSize>, and <data> are user specified. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, depth, border and internalFormat information. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target, + GLint lod, void *image, + const struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /* Called by glGetCompressedTexImageARB. + * <target>, <lod>, <image> are specified by user. + * <texObj> is the source texture object. + * <texImage> is the source texture image. + */ + + void (*TexEnv)( GLcontext *ctx, GLenum target, GLenum pname, + const GLfloat *param ); + /* Called by glTexEnv*(). */ void (*TexParameter)( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, + struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ); - /* - * Called whenever glTexParameter*() is called. - * target is GL_TEXTURE_1D or GL_TEXTURE_2D - * texObject is the texture object to modify - * pname is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, - * GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_BORDER_COLOR. - * params is dependant on pname. See man glTexParameter. + /* Called by glTexParameter*(). + * <target> is user specified + * <texObj> the texture object to modify + * <pname> is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, + * GL_TEXTURE_WRAP_[STR], or GL_TEXTURE_BORDER_COLOR. + * <params> is user specified. */ void (*BindTexture)( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ); - /* - * Called whenever glBindTexture() is called. This specifies which - * texture is to be the current one. No dirty flags will be set. + /* Called by glBindTexture(). */ void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); - /* - * Called when a texture object is about to be deallocated. Driver + /* Called when a texture object is about to be deallocated. Driver * should free anything attached to the DriverData pointers. */ - void (*UpdateTexturePalette)( GLcontext *ctx, - struct gl_texture_object *tObj ); - /* - * Called when the texture's color lookup table is changed. - * If tObj is NULL then the shared texture palette ctx->Texture.Palette - * was changed. + GLboolean (*IsTextureResident)( GLcontext *ctx, + struct gl_texture_object *t ); + /* Called by glAreTextureResident(). */ - void (*UseGlobalTexturePalette)( GLcontext *ctx, GLboolean state ); - /* - * Called via glEnable/Disable(GL_SHARED_TEXTURE_PALETTE_EXT) + void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, + GLclampf priority ); + /* Called by glPrioritizeTextures(). */ void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber ); - /* - * Called by glActiveTextureARB to set current texture unit. + /* Called by glActiveTextureARB to set current texture unit. */ + void (*UpdateTexturePalette)( GLcontext *ctx, + struct gl_texture_object *tObj ); + /* Called when the texture's color lookup table is changed. + * If tObj is NULL then the shared texture palette ctx->Texture.Palette + * is to be updated. + */ - GLboolean (*IsTextureResident)( GLcontext *ctx, - struct gl_texture_object *t ); - /* - * Allows the driver to implement the AreTexturesResident tests without - * knowing about Mesa's internal hash tables for textures. + + + /*** + *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions: + ***/ + + points_func PointsFunc; + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; + rect_func RectFunc; + + + /*** + *** Transformation/Rendering functions + ***/ + + void (*RenderStart)( GLcontext *ctx ); + void (*RenderFinish)( GLcontext *ctx ); + /* KW: These replace Begin and End, and have more relaxed semantics. + * They are called prior-to and after one or more vb flush, and are + * thus decoupled from the gl_begin/gl_end pairs, which are possibly + * more frequent. If a begin/end pair covers >1 vertex buffer, these + * are called at most once for the pair. (a bit broken at present) + */ + + void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end ); + /* This function, if not NULL, is called whenever new window coordinates + * are put in the vertex buffer. The vertices in question are those n + * such that start <= n < end. + * The device driver can convert the window coords to its own specialized + * format. The 3Dfx driver uses this. + * + * Note: Deprecated in favour of RegisterPipelineStages, below. */ - void (*PrioritizeTexture)( GLcontext *ctx, - struct gl_texture_object *t, - GLclampf priority ); - /* - * Notify driver of priority change for a texture. + render_func *RenderVBClippedTab; + render_func *RenderVBCulledTab; + render_func *RenderVBRawTab; + /* These function tables allow the device driver to rasterize an + * entire begin/end group of primitives at once. See the + * gl_render_vb() function in vbrender.c for more details. */ + void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive ); + /* If registered, this will be called when rendering transitions between + * points, lines and triangles. It is not called on transitions between + * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between + * triangles and quads or triangles and polygons. + */ + GLuint TriangleCaps; + /* Holds a list of the reasons why we might normally want to call + * render_triangle, but which are in fact implemented by the + * driver. The FX driver sets this to DD_TRI_CULL, and will soon + * implement DD_TRI_OFFSET. + */ + GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno ); + /* Driver may request additional render passes by returning GL_TRUE + * when this function is called. This function will be called + * after the first pass, and passes will be made until the function + * returns GL_FALSE. If no function is registered, only one pass + * is made. + * + * This function will be first invoked with passno == 1. + */ /*** *** NEW in Mesa 3.x @@ -704,7 +894,11 @@ struct dd_function_table { void (*Lightfv)(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params, GLint nparams ); void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); + void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); + void (*LineWidth)(GLcontext *ctx, GLfloat width); + void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); + void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); void (*ShadeModel)(GLcontext *ctx, GLenum mode); void (*ClearStencil)(GLcontext *ctx, GLint s); diff --git a/xc/extras/Mesa/src/ddsample.c b/xc/extras/Mesa/src/ddsample.c index 364b091eb..31e4811b1 100644 --- a/xc/extras/Mesa/src/ddsample.c +++ b/xc/extras/Mesa/src/ddsample.c @@ -51,6 +51,13 @@ * the core Mesa library. */ +/* + * XXX XXX + * THIS FILE IS VERY OUT OF DATE! LOOK AT OSmesa/osmesa.c FOR A BETTER + * EXAMPLE DRIVER! + */ + + #ifdef PC_HEADER #include "all.h" @@ -240,10 +247,20 @@ static void dither( GLcontext *ctx, GLboolean enable ) /* - * Set the current drawing/reading buffer, return GL_TRUE or GL_FALSE - * for success/failure. + * Set the current reading buffer. + */ +static void set_read_buffer( GLcontext *ctx, GLframebuffer *bufer, + GLenum mode ) +{ + struct foo_mesa_context *foo = (struct foo_mesa_context *) ctx->DriverCtx; + setup_DD_pointers( ctx ); +} + + +/* + * Set the destination/draw buffer. */ -static GLboolean set_buffer( GLcontext *ctx, GLenum mode ) +static GLboolean set_draw_buffer( GLcontext *ctx, GLenum mode ) { struct foo_mesa_context *foo = (struct foo_mesa_context *) ctx->DriverCtx; setup_DD_pointers( ctx ); @@ -311,8 +328,8 @@ static void fast_points_function( GLcontext *ctx, GLuint first, GLuint last ) for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { int x, y; - x = (GLint) VB->Win[i][0]; - y = FLIP( (GLint) VB->Win[i][1] ); + x = (GLint) VB->Win.data[i][0]; + y = FLIP( (GLint) VB->Win.data[i][1] ); WriteRGBAPixel( x, y, VB->ColorPtr->data[i] ); } } @@ -332,10 +349,10 @@ static void fast_line_function( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv pixel = VB->ColorPtr->data[pv]; - x0 = (int) VB->Win[v0][0]; - y0 = FLIP( (int) VB->Win[v0][1] ); - x1 = (int) VB->Win[v1][0]; - y1 = FLIP( (int) VB->Win[v1][1] ); + x0 = (int) VB->Win.data[v0][0]; + y0 = FLIP( (int) VB->Win.data[v0][1] ); + x1 = (int) VB->Win.data[v1][0]; + y1 = FLIP( (int) VB->Win.data[v1][1] ); /* Draw line from (x0,y0) to (x1,y1) with current pixel color/index */ } @@ -615,7 +632,8 @@ static void setup_DD_pointers( GLcontext *ctx ) ctx->Driver.Index = set_index; ctx->Driver.Color = set_color; - ctx->Driver.SetBuffer = set_buffer; + ctx->Driver.SetDrawBuffer = set_draw_buffer; + ctx->Driver.SetReadBuffer = set_read_buffer; ctx->Driver.GetBufferSize = get_buffer_size; ctx->Driver.PointsFunc = fast_points_function; @@ -730,7 +748,11 @@ FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual, return NULL; } - b->gl_buffer = gl_create_framebuffer( visual->gl_visual ); + b->gl_buffer = gl_create_framebuffer( visual->gl_visual, + visual->gl_visual->DepthBits > 0, + visual->gl_visual->StencilBits > 0, + visual->gl_visual->AccumBits > 0, + visual->gl_visual->AlphaBits > 0 ); b->the_window = your_window_id; /* other stuff */ @@ -769,7 +791,7 @@ FooMesaContext FooMesaCreateContext( FooMesaVisual visual, /* and then, finally let the context examine your initializations */ - gl_context_initialize( c->gl_ctx ); + _mesa_initialize_context( c->gl_ctx ); return c; diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c index d491db47c..f9fc902f2 100644 --- a/xc/extras/Mesa/src/dlist.c +++ b/xc/extras/Mesa/src/dlist.c @@ -1,3 +1,4 @@ +/* $Id: dlist.c,v 1.10.12.1 2000/06/13 15:33:05 dfr Exp $ */ /* * Mesa 3-D graphics library @@ -58,6 +59,7 @@ #include "mem.h" #include "pipeline.h" #include "pixel.h" +#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "readpix.h" @@ -140,7 +142,17 @@ typedef enum { OPCODE_COLOR_MASK, OPCODE_COLOR_MATERIAL, OPCODE_COLOR_TABLE, + OPCODE_COLOR_TABLE_PARAMETER_FV, + OPCODE_COLOR_TABLE_PARAMETER_IV, OPCODE_COLOR_SUB_TABLE, + OPCODE_CONVOLUTION_FILTER_1D, + OPCODE_CONVOLUTION_FILTER_2D, + OPCODE_CONVOLUTION_PARAMETER_I, + OPCODE_CONVOLUTION_PARAMETER_IV, + OPCODE_CONVOLUTION_PARAMETER_F, + OPCODE_CONVOLUTION_PARAMETER_FV, + OPCODE_COPY_COLOR_SUB_TABLE, + OPCODE_COPY_COLOR_TABLE, OPCODE_COPY_PIXELS, OPCODE_COPY_TEX_IMAGE1D, OPCODE_COPY_TEX_IMAGE2D, @@ -166,6 +178,7 @@ typedef enum { OPCODE_FRUSTUM, OPCODE_HINT, OPCODE_HINT_PGI, + OPCODE_HISTOGRAM, OPCODE_INDEX_MASK, OPCODE_INIT_NAMES, OPCODE_LIGHT, @@ -182,6 +195,7 @@ typedef enum { OPCODE_MAPGRID1, OPCODE_MAPGRID2, OPCODE_MATRIX_MODE, + OPCODE_MIN_MAX, OPCODE_MULT_MATRIX, OPCODE_ORTHO, OPCODE_PASSTHROUGH, @@ -203,6 +217,8 @@ typedef enum { OPCODE_RASTER_POS, OPCODE_RECTF, OPCODE_READ_BUFFER, + OPCODE_RESET_HISTOGRAM, + OPCODE_RESET_MIN_MAX, OPCODE_SCALE, OPCODE_SCISSOR, OPCODE_SELECT_TEXTURE_SGIS, @@ -226,6 +242,16 @@ typedef enum { /* GL_ARB_multitexture */ OPCODE_ACTIVE_TEXTURE, OPCODE_CLIENT_ACTIVE_TEXTURE, + /* GL_SGIX/SGIS_pixel_texture */ + OPCODE_PIXEL_TEXGEN_SGIX, + OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, + /* GL_ARB_texture_compression */ + OPCODE_COMPRESSED_TEX_IMAGE_1D, + OPCODE_COMPRESSED_TEX_IMAGE_2D, + OPCODE_COMPRESSED_TEX_IMAGE_3D, + OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, + OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, + OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_VERTEX_CASSETTE, /* render prebuilt vertex buffer */ @@ -365,6 +391,14 @@ void gl_destroy_list( GLcontext *ctx, GLuint list ) FREE( n[6].data ); n += InstSize[n[0].opcode]; break; + case OPCODE_CONVOLUTION_FILTER_1D: + FREE( n[6].data ); + n += InstSize[n[0].opcode]; + break; + case OPCODE_CONVOLUTION_FILTER_2D: + FREE( n[7].data ); + n += InstSize[n[0].opcode]; + break; case OPCODE_POLYGON_STIPPLE: FREE( n[1].data ); n += InstSize[n[0].opcode]; @@ -393,6 +427,30 @@ void gl_destroy_list( GLcontext *ctx, GLuint list ) FREE(n[11].data); n += InstSize[n[0].opcode]; break; + case OPCODE_COMPRESSED_TEX_IMAGE_1D: + FREE(n[7].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_IMAGE_2D: + FREE(n[8].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_IMAGE_3D: + FREE(n[9].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: + FREE(n[7].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: + FREE(n[9].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: + FREE(n[11].data); + n += InstSize[n[0].opcode]; + break; case OPCODE_CONTINUE: n = (Node *) n[1].next; FREE( block ); @@ -500,8 +558,18 @@ void gl_init_lists( void ) InstSize[OPCODE_COLOR_MASK] = 5; InstSize[OPCODE_COLOR_MATERIAL] = 3; InstSize[OPCODE_COLOR_TABLE] = 7; + InstSize[OPCODE_COLOR_TABLE_PARAMETER_FV] = 7; + InstSize[OPCODE_COLOR_TABLE_PARAMETER_IV] = 7; InstSize[OPCODE_COLOR_SUB_TABLE] = 7; + InstSize[OPCODE_CONVOLUTION_FILTER_1D] = 7; + InstSize[OPCODE_CONVOLUTION_FILTER_2D] = 8; + InstSize[OPCODE_CONVOLUTION_PARAMETER_I] = 4; + InstSize[OPCODE_CONVOLUTION_PARAMETER_IV] = 7; + InstSize[OPCODE_CONVOLUTION_PARAMETER_F] = 4; + InstSize[OPCODE_CONVOLUTION_PARAMETER_FV] = 7; InstSize[OPCODE_COPY_PIXELS] = 6; + InstSize[OPCODE_COPY_COLOR_SUB_TABLE] = 6; + InstSize[OPCODE_COPY_COLOR_TABLE] = 6; InstSize[OPCODE_COPY_TEX_IMAGE1D] = 8; InstSize[OPCODE_COPY_TEX_IMAGE2D] = 9; InstSize[OPCODE_COPY_TEX_SUB_IMAGE1D] = 7; @@ -526,6 +594,7 @@ void gl_init_lists( void ) InstSize[OPCODE_FRUSTUM] = 7; InstSize[OPCODE_HINT] = 3; InstSize[OPCODE_HINT_PGI] = 3; + InstSize[OPCODE_HISTOGRAM] = 5; InstSize[OPCODE_INDEX_MASK] = 2; InstSize[OPCODE_INIT_NAMES] = 1; InstSize[OPCODE_LIGHT] = 7; @@ -542,6 +611,7 @@ void gl_init_lists( void ) InstSize[OPCODE_MAPGRID1] = 4; InstSize[OPCODE_MAPGRID2] = 7; InstSize[OPCODE_MATRIX_MODE] = 2; + InstSize[OPCODE_MIN_MAX] = 4; InstSize[OPCODE_MULT_MATRIX] = 17; InstSize[OPCODE_ORTHO] = 7; InstSize[OPCODE_PASSTHROUGH] = 2; @@ -563,6 +633,8 @@ void gl_init_lists( void ) InstSize[OPCODE_RASTER_POS] = 5; InstSize[OPCODE_RECTF] = 5; InstSize[OPCODE_READ_BUFFER] = 2; + InstSize[OPCODE_RESET_HISTOGRAM] = 2; + InstSize[OPCODE_RESET_MIN_MAX] = 2; InstSize[OPCODE_SCALE] = 4; InstSize[OPCODE_SCISSOR] = 5; InstSize[OPCODE_STENCIL_FUNC] = 4; @@ -585,6 +657,16 @@ void gl_init_lists( void ) InstSize[OPCODE_ERROR] = 3; InstSize[OPCODE_VERTEX_CASSETTE] = 9; InstSize[OPCODE_END_OF_LIST] = 1; + /* GL_SGIX/SGIS_pixel_texture */ + InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2; + InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3; + /* GL_ARB_texture_compression */ + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8; + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9; + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_3D] = 10; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12; /* GL_ARB_multitexture */ InstSize[OPCODE_ACTIVE_TEXTURE] = 2; InstSize[OPCODE_CLIENT_ACTIVE_TEXTURE] = 2; @@ -976,6 +1058,66 @@ static void save_ColorTable( GLenum target, GLenum internalFormat, } + +static void +save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); + FLUSH_VB(ctx, "dlist"); + + n = alloc_instruction( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].f = params[0]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + } + + if (ctx->ExecuteFlag) { + (*ctx->Exec->ColorTableParameterfv)( target, pname, params ); + } +} + + +static void +save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); + FLUSH_VB(ctx, "dlist"); + + n = alloc_instruction( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = params[0]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + n[4].i = params[1]; + n[5].i = params[2]; + n[6].i = params[3]; + } + } + + if (ctx->ExecuteFlag) { + (*ctx->Exec->ColorTableParameteriv)( target, pname, params ); + } +} + + + static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table) @@ -1003,6 +1145,199 @@ static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, } +static void +save_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 6 ); + if (n) { + n[1].e = target; + n[2].i = start; + n[3].i = x; + n[4].i = y; + n[5].i = width; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CopyColorSubTable)(target, start, x, y, width); + } +} + + +static void +save_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_COPY_COLOR_TABLE, 6 ); + if (n) { + n[1].e = target; + n[2].e = internalformat; + n[3].i = x; + n[4].i = y; + n[5].i = width; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CopyColorTable)(target, internalformat, x, y, width); + } +} + + +static void +save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, + GLenum format, GLenum type, const GLvoid *filter) +{ + GET_CURRENT_CONTEXT(ctx); + GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter, + &ctx->Unpack); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 ); + if (n) { + n[1].e = target; + n[2].e = internalFormat; + n[3].i = width; + n[4].e = format; + n[5].e = type; + n[6].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionFilter1D)( target, internalFormat, width, + format, type, filter ); + } +} + + +static void +save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *filter) +{ + GET_CURRENT_CONTEXT(ctx); + GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter, + &ctx->Unpack); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 ); + if (n) { + n[1].e = target; + n[2].e = internalFormat; + n[3].i = width; + n[4].i = height; + n[5].e = format; + n[6].e = type; + n[7].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionFilter2D)( target, internalFormat, width, height, + format, type, filter ); + } +} + + +static void +save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = param; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameteri)( target, pname, param ); + } +} + + +static void +save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = params[0]; + if (pname == GL_CONVOLUTION_BORDER_COLOR || + pname == GL_CONVOLUTION_FILTER_SCALE || + pname == GL_CONVOLUTION_FILTER_BIAS) { + n[4].i = params[1]; + n[5].i = params[2]; + n[6].i = params[3]; + } + else { + n[4].i = n[5].i = n[6].i = 0; + } + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameteriv)( target, pname, params ); + } +} + + +static void +save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].f = param; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameterf)( target, pname, param ); + } +} + + +static void +save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].f = params[0]; + if (pname == GL_CONVOLUTION_BORDER_COLOR || + pname == GL_CONVOLUTION_FILTER_SCALE || + pname == GL_CONVOLUTION_FILTER_BIAS) { + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + else { + n[4].f = n[5].f = n[6].f = 0.0F; + } + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameterfv)( target, pname, params ); + } +} + static void save_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) @@ -1455,6 +1790,26 @@ static void save_HintPGI( GLenum target, GLint mode ) } +static void +save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_HISTOGRAM, 4 ); + if (n) { + n[1].e = target; + n[2].i = width; + n[3].e = internalFormat; + n[4].b = sink; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->Histogram)( target, width, internalFormat, sink ); + } +} + + static void save_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); @@ -1928,6 +2283,25 @@ static void save_MatrixMode( GLenum mode ) } +static void +save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_MIN_MAX, 3 ); + if (n) { + n[1].e = target; + n[2].e = internalFormat; + n[3].b = sink; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->Minmax)( target, internalFormat, sink ); + } +} + + static void save_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); @@ -2176,7 +2550,8 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units ) static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { - save_PolygonOffset(factor, DEPTH_SCALE * bias); + GET_CURRENT_CONTEXT(ctx); + save_PolygonOffset(factor, ctx->Visual->DepthMaxF * bias); } @@ -2491,6 +2866,38 @@ static void save_Rectsv(const GLshort *v1, const GLshort *v2) } +static void +save_ResetHistogram(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_RESET_HISTOGRAM, 1 ); + if (n) { + n[1].e = target; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ResetHistogram)( target ); + } +} + + +static void +save_ResetMinmax(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_RESET_MIN_MAX, 1 ); + if (n) { + n[1].e = target; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ResetMinmax)( target ); + } +} + + static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GLfloat m[16]; @@ -2842,7 +3249,7 @@ static void save_TexImage2D( GLenum target, static void save_TexImage3D( GLenum target, - GLint level, GLint components, + GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, @@ -2851,7 +3258,7 @@ static void save_TexImage3D( GLenum target, GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_3D) { /* don't compile, execute immediately */ - (*ctx->Exec->TexImage3D)( target, level, components, width, + (*ctx->Exec->TexImage3D)( target, level, internalFormat, width, height, depth, border, format, type, pixels ); } else { @@ -2863,7 +3270,7 @@ static void save_TexImage3D( GLenum target, if (n) { n[1].e = target; n[2].i = level; - n[3].i = components; + n[3].i = internalFormat; n[4].i = (GLint) width; n[5].i = (GLint) height; n[6].i = (GLint) depth; @@ -2876,7 +3283,7 @@ static void save_TexImage3D( GLenum target, FREE(image); } if (ctx->ExecuteFlag) { - (*ctx->Exec->TexImage3D)( target, level, components, width, + (*ctx->Exec->TexImage3D)( target, level, internalFormat, width, height, depth, border, format, type, pixels ); } } @@ -3190,6 +3597,8 @@ static void save_ClientActiveTextureARB( GLenum target ) +/* GL_ARB_transpose_matrix */ + static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) { GLdouble tm[16]; @@ -3222,6 +3631,313 @@ static void save_MultTransposeMatrixfARB( const GLfloat m[16] ) } +static void save_PixelTexGenSGIX(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->PixelTexGenSGIX)( mode ); + } +} + + +/* GL_ARB_texture_compression */ +static void +save_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_1D) { + /* don't compile, execute immediately */ + (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat, + width, border, imageSize, data); + } + else { + Node *n; + GLvoid *image; + FLUSH_VB(ctx, "dlist"); + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 8 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].e = internalFormat; + n[4].i = (GLint) width; + n[5].i = border; + n[6].i = imageSize; + n[7].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat, + width, border, imageSize, data); + } + } +} + + +static void +save_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_2D) { + /* don't compile, execute immediately */ + (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat, + width, height, border, imageSize, data); + } + else { + Node *n; + GLvoid *image; + FLUSH_VB(ctx, "dlist"); + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 9 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].e = internalFormat; + n[4].i = (GLint) width; + n[5].i = (GLint) height; + n[6].i = border; + n[7].i = imageSize; + n[8].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat, + width, height, border, imageSize, data); + } + } +} + + +static void +save_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_3D) { + /* don't compile, execute immediately */ + (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat, + width, height, depth, border, imageSize, data); + } + else { + Node *n; + GLvoid *image; + FLUSH_VB(ctx, "dlist"); + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 10 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].e = internalFormat; + n[4].i = (GLint) width; + n[5].i = (GLint) height; + n[6].i = (GLint) depth; + n[7].i = border; + n[8].i = imageSize; + n[9].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat, + width, height, depth, border, imageSize, data); + } + } +} + + +static void +save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + Node *n; + GLvoid *image; + + GET_CURRENT_CONTEXT(ctx); + FLUSH_VB(ctx, "dlist"); + + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 8 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].i = xoffset; + n[4].i = (GLint) width; + n[5].e = format; + n[6].i = imageSize; + n[7].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexSubImage1DARB)(target, level, xoffset, + width, format, imageSize, data); + } +} + + +static void +save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + Node *n; + GLvoid *image; + + GET_CURRENT_CONTEXT(ctx); + FLUSH_VB(ctx, "dlist"); + + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 10 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].i = xoffset; + n[4].i = yoffset; + n[5].i = (GLint) width; + n[6].i = (GLint) height; + n[7].e = format; + n[8].i = imageSize; + n[9].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexSubImage2DARB)(target, level, xoffset, yoffset, + width, height, format, imageSize, data); + } +} + + +static void +save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + Node *n; + GLvoid *image; + + GET_CURRENT_CONTEXT(ctx); + FLUSH_VB(ctx, "dlist"); + + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 12 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].i = xoffset; + n[4].i = yoffset; + n[5].i = zoffset; + n[6].i = (GLint) width; + n[7].i = (GLint) height; + n[8].i = (GLint) depth; + n[9].e = format; + n[10].i = imageSize; + n[11].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexSubImage3DARB)(target, level, xoffset, yoffset, + zoffset, width, height, depth, format, imageSize, data); + } +} + + +/* GL_SGIS_pixel_texture */ + +static void save_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); + if (n) { + n[1].e = target; + n[2].i = value; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->PixelTexGenParameteriSGIS)( target, value ); + } +} + + +static void save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +static void save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + save_PixelTexGenParameteriSGIS(target, *value); +} + + +static void save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) *value); +} void gl_compile_cassette( GLcontext *ctx ) { @@ -3364,10 +4080,12 @@ static void execute_list( GLcontext *ctx, GLuint list ) (MESA_VERBOSE & VERBOSE_IMMEDIATE)) gl_print_cassette( (struct immediate *) n[1].data ); - if (0) - fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x\n", + if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) { + fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x ", IM->id, IM->Start, IM->Count, IM->BeginState); + gl_print_vert_flags("orflag", IM->OrFlag); + } gl_fixup_cassette( ctx, (struct immediate *) n[1].data ); gl_execute_cassette( ctx, (struct immediate *) n[1].data ); @@ -3387,7 +4105,7 @@ static void execute_list( GLcontext *ctx, GLuint list ) struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = _mesa_native_packing; (*ctx->Exec->Bitmap)( (GLsizei) n[1].i, (GLsizei) n[2].i, - n[3].f, n[4].f, n[5].f, n[6].f, n[7].data ); + n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data ); ctx->Unpack = save; /* restore */ } break; @@ -3458,6 +4176,26 @@ static void execute_list( GLcontext *ctx, GLuint list ) ctx->Unpack = save; /* restore */ } break; + case OPCODE_COLOR_TABLE_PARAMETER_FV: + { + GLfloat params[4]; + params[0] = n[3].f; + params[1] = n[4].f; + params[2] = n[5].f; + params[3] = n[6].f; + (*ctx->Exec->ColorTableParameterfv)( n[1].e, n[2].e, params ); + } + break; + case OPCODE_COLOR_TABLE_PARAMETER_IV: + { + GLint params[4]; + params[0] = n[3].i; + params[1] = n[4].i; + params[2] = n[5].i; + params[3] = n[6].i; + (*ctx->Exec->ColorTableParameteriv)( n[1].e, n[2].e, params ); + } + break; case OPCODE_COLOR_SUB_TABLE: { struct gl_pixelstore_attrib save = ctx->Unpack; @@ -3467,6 +4205,58 @@ static void execute_list( GLcontext *ctx, GLuint list ) ctx->Unpack = save; /* restore */ } break; + case OPCODE_CONVOLUTION_FILTER_1D: + { + struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = _mesa_native_packing; + (*ctx->Exec->ConvolutionFilter1D)( n[1].e, n[2].i, n[3].i, + n[4].e, n[5].e, n[6].data ); + ctx->Unpack = save; /* restore */ + } + break; + case OPCODE_CONVOLUTION_FILTER_2D: + { + struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = _mesa_native_packing; + (*ctx->Exec->ConvolutionFilter2D)( n[1].e, n[2].i, n[3].i, + n[4].i, n[5].e, n[6].e, n[7].data ); + ctx->Unpack = save; /* restore */ + } + break; + case OPCODE_CONVOLUTION_PARAMETER_I: + (*ctx->Exec->ConvolutionParameteri)( n[1].e, n[2].e, n[3].i ); + break; + case OPCODE_CONVOLUTION_PARAMETER_IV: + { + GLint params[4]; + params[0] = n[3].i; + params[1] = n[4].i; + params[2] = n[5].i; + params[3] = n[6].i; + (*ctx->Exec->ConvolutionParameteriv)( n[1].e, n[2].e, params ); + } + break; + case OPCODE_CONVOLUTION_PARAMETER_F: + (*ctx->Exec->ConvolutionParameterf)( n[1].e, n[2].e, n[3].f ); + break; + case OPCODE_CONVOLUTION_PARAMETER_FV: + { + GLfloat params[4]; + params[0] = n[3].f; + params[1] = n[4].f; + params[2] = n[5].f; + params[3] = n[6].f; + (*ctx->Exec->ConvolutionParameterfv)( n[1].e, n[2].e, params ); + } + break; + case OPCODE_COPY_COLOR_SUB_TABLE: + (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i, + n[3].i, n[4].i, n[5].i ); + break; + case OPCODE_COPY_COLOR_TABLE: + (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i, + n[3].i, n[4].i, n[5].i ); + break; case OPCODE_COPY_PIXELS: (*ctx->Exec->CopyPixels)( n[1].i, n[2].i, (GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e ); @@ -3549,6 +4339,9 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_HINT_PGI: (*ctx->Exec->HintPGI)( n[1].e, n[2].i ); break; + case OPCODE_HISTOGRAM: + (*ctx->Exec->Histogram)( n[1].e, n[2].i, n[3].e, n[4].b ); + break; case OPCODE_INDEX_MASK: (*ctx->Exec->IndexMask)( n[1].ui ); break; @@ -3642,6 +4435,9 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_MATRIX_MODE: (*ctx->Exec->MatrixMode)( n[1].e ); break; + case OPCODE_MIN_MAX: + (*ctx->Exec->Minmax)(n[1].e, n[2].e, n[3].b); + break; case OPCODE_MULT_MATRIX: if (sizeof(Node)==sizeof(GLfloat)) { (*ctx->Exec->MultMatrixf)( &n[1].f ); @@ -3721,6 +4517,12 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_RECTF: (*ctx->Exec->Rectf)( n[1].f, n[2].f, n[3].f, n[4].f ); break; + case OPCODE_RESET_HISTOGRAM: + (*ctx->Exec->ResetHistogram)( n[1].e ); + break; + case OPCODE_RESET_MIN_MAX: + (*ctx->Exec->ResetMinmax)( n[1].e ); + break; case OPCODE_SCALE: (*ctx->Exec->Scalef)( n[1].f, n[2].f, n[3].f ); break; @@ -3867,6 +4669,37 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_CLIENT_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ (*ctx->Exec->ClientActiveTextureARB)( n[1].e ); break; + case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */ + (*ctx->Exec->PixelTexGenSGIX)( n[1].e ); + break; + case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */ + (*ctx->Exec->PixelTexGenParameteriSGIS)( n[1].e, n[2].i ); + break; + case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */ + (*ctx->Exec->CompressedTexImage1DARB)(n[1].e, n[2].i, n[3].e, + n[4].i, n[5].i, n[6].i, n[7].data); + break; + case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */ + (*ctx->Exec->CompressedTexImage2DARB)(n[1].e, n[2].i, n[3].e, + n[4].i, n[5].i, n[6].i, n[7].i, n[8].data); + break; + case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */ + (*ctx->Exec->CompressedTexImage3DARB)(n[1].e, n[2].i, n[3].e, + n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data); + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */ + (*ctx->Exec->CompressedTexSubImage1DARB)(n[1].e, n[2].i, n[3].i, + n[4].i, n[5].e, n[6].i, n[7].data); + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */ + (*ctx->Exec->CompressedTexSubImage2DARB)(n[1].e, n[2].i, n[3].i, + n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data); + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */ + (*ctx->Exec->CompressedTexSubImage3DARB)(n[1].e, n[2].i, n[3].i, + n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, + n[9].e, n[10].i, n[11].data); + break; case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -3953,6 +4786,11 @@ _mesa_GenLists(GLsizei range ) return 0; } + /* + * Make this an atomic operation + */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); if (base) { /* reserve the list IDs by with empty/dummy lists */ @@ -3961,6 +4799,9 @@ _mesa_GenLists(GLsizei range ) _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list()); } } + + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + return base; } @@ -4149,13 +4990,13 @@ _mesa_ListBase( GLuint base ) /* - * Assign all the pointers in 'table' to point to Mesa's display list + * Assign all the pointers in <table> to point to Mesa's display list * building functions. */ void -_mesa_init_dlist_table( struct _glapi_table *table ) +_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) { - _mesa_init_no_op_table(table); + _mesa_init_no_op_table(table, tableSize); /* GL 1.0 */ table->Accum = save_Accum; @@ -4507,18 +5348,18 @@ _mesa_init_dlist_table( struct _glapi_table *table ) /* Not all are supported */ table->BlendColor = save_BlendColor; table->BlendEquation = save_BlendEquation; - table->ColorSubTable = _mesa_ColorSubTable; - table->ColorTable = _mesa_ColorTable; - table->ColorTableParameterfv = _mesa_ColorTableParameterfv; - table->ColorTableParameteriv = _mesa_ColorTableParameteriv; - table->ConvolutionFilter1D = _mesa_ConvolutionFilter1D; - table->ConvolutionFilter2D = _mesa_ConvolutionFilter2D; - table->ConvolutionParameterf = _mesa_ConvolutionParameterf; - table->ConvolutionParameterfv = _mesa_ConvolutionParameterfv; - table->ConvolutionParameteri = _mesa_ConvolutionParameteri; - table->ConvolutionParameteriv = _mesa_ConvolutionParameteriv; - table->CopyColorSubTable = _mesa_CopyColorSubTable; - table->CopyColorTable = _mesa_CopyColorTable; + table->ColorSubTable = save_ColorSubTable; + table->ColorTable = save_ColorTable; + table->ColorTableParameterfv = save_ColorTableParameterfv; + table->ColorTableParameteriv = save_ColorTableParameteriv; + table->ConvolutionFilter1D = save_ConvolutionFilter1D; + table->ConvolutionFilter2D = save_ConvolutionFilter2D; + table->ConvolutionParameterf = save_ConvolutionParameterf; + table->ConvolutionParameterfv = save_ConvolutionParameterfv; + table->ConvolutionParameteri = save_ConvolutionParameteri; + table->ConvolutionParameteriv = save_ConvolutionParameteriv; + table->CopyColorSubTable = save_CopyColorSubTable; + table->CopyColorTable = save_CopyColorTable; table->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D; table->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D; table->GetColorTable = _mesa_GetColorTable; @@ -4534,10 +5375,10 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv; table->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv; table->GetSeparableFilter = _mesa_GetSeparableFilter; - table->Histogram = _mesa_Histogram; - table->Minmax = _mesa_Minmax; - table->ResetHistogram = _mesa_ResetHistogram; - table->ResetMinmax = _mesa_ResetMinmax; + table->Histogram = save_Histogram; + table->Minmax = save_Minmax; + table->ResetHistogram = save_ResetHistogram; + table->ResetMinmax = save_ResetMinmax; table->SeparableFilter2D = _mesa_SeparableFilter2D; /* GL_EXT_texture3d */ @@ -4556,6 +5397,17 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; table->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* 15. GL_SGIX_pixel_texture */ + table->PixelTexGenSGIX = save_PixelTexGenSGIX; + + /* 15. GL_SGIS_pixel_texture */ + table->PixelTexGenParameteriSGIS = save_PixelTexGenParameteriSGIS; + table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS; + table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS; + table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS; + table->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; + table->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + /* GL_EXT_compiled_vertex_array */ table->LockArraysEXT = _mesa_LockArraysEXT; table->UnlockArraysEXT = _mesa_UnlockArraysEXT; @@ -4654,6 +5506,14 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB; table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB; + /* ARB 12. GL_ARB_texture_compression */ + table->CompressedTexImage3DARB = save_CompressedTexImage3DARB; + table->CompressedTexImage2DARB = save_CompressedTexImage2DARB; + table->CompressedTexImage1DARB = save_CompressedTexImage1DARB; + table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB; + table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB; + table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB; + table->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; } @@ -4705,6 +5565,16 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) fprintf(f,"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", + 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", + 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)); break; @@ -4788,6 +5658,7 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) ((struct immediate *) n[1].data)->id, n[2].ui, n[3].ui); + gl_print_cassette( (struct immediate *) n[1].data ); break; case OPCODE_CONTINUE: fprintf(f,"DISPLAY-LIST-CONTINUE\n"); diff --git a/xc/extras/Mesa/src/dlist.h b/xc/extras/Mesa/src/dlist.h index a5233e50c..b2aaa64c7 100644 --- a/xc/extras/Mesa/src/dlist.h +++ b/xc/extras/Mesa/src/dlist.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,15 +24,13 @@ */ - - - #ifndef DLIST_H #define DLIST_H #include "types.h" + struct display_list { union node *nodes; GLuint OrFlag; @@ -66,8 +64,7 @@ extern void _mesa_ListBase( GLuint base ); extern void _mesa_NewList( GLuint list, GLenum mode ); -extern void _mesa_init_dlist_table( struct _glapi_table *table ); - +extern void _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ); extern void gl_compile_cassette( GLcontext *ctx ); diff --git a/xc/extras/Mesa/src/drawpix.c b/xc/extras/Mesa/src/drawpix.c index f89d80a70..7fb93abcc 100644 --- a/xc/extras/Mesa/src/drawpix.c +++ b/xc/extras/Mesa/src/drawpix.c @@ -33,11 +33,14 @@ #include "feedback.h" #include "image.h" #include "macros.h" +#include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -112,24 +115,17 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } - if (ctx->NewState) { - gl_update_state(ctx); - } - - /* see if device driver can do the drawpix */ - if (ctx->Driver.DrawPixels - && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type, - unpack, pixels)) { - return GL_TRUE; - } - if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0 - && ctx->Pixel.RedBias==0.0 && ctx->Pixel.RedScale==1.0 - && ctx->Pixel.GreenBias==0.0 && ctx->Pixel.GreenScale==1.0 - && ctx->Pixel.BlueBias==0.0 && ctx->Pixel.BlueScale==1.0 - && ctx->Pixel.AlphaBias==0.0 && ctx->Pixel.AlphaScale==1.0 + && !ctx->Pixel.ScaleOrBiasRGBA + && !ctx->Pixel.ScaleOrBiasRGBApcm + && ctx->ColorMatrix.type == MATRIX_IDENTITY + && !ctx->Pixel.ColorTableEnabled + && !ctx->Pixel.PostColorMatrixColorTableEnabled + && !ctx->Pixel.MinMaxEnabled + && !ctx->Pixel.HistogramEnabled && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0 && ctx->Pixel.MapColorFlag==0 + && ctx->Texture.ReallyEnabled == 0 && unpack->Alignment==1 && !unpack->SwapBytes && !unpack->LsbFirst) { @@ -180,7 +176,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, } else { /* setup array of fragment Z value to pass to zoom function */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); GLint i; assert(drawWidth < MAX_WIDTH); for (i=0; i<drawWidth; i++) @@ -347,7 +343,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { assert(drawWidth < MAX_WIDTH); - gl_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, (const GLubyte (*)[4])rgba, NULL); @@ -361,7 +357,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { assert(drawWidth < MAX_WIDTH); - gl_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, zSpan, (void *) rgba, zoomY0); src += rowLength; @@ -418,7 +414,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, /* Fragment depth values */ if (ctx->Depth.Test || ctx->Fog.Enabled) { - GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); GLint i; for (i = 0; i < drawWidth; i++) { zspan[i] = zval; @@ -430,7 +426,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, */ for (row = 0; row < height; row++, y++) { GLuint indexes[MAX_WIDTH]; - const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack, + 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, type, source, &ctx->Unpack, GL_TRUE); @@ -455,6 +451,7 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLenum type, const GLvoid *pixels ) { const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; const GLint desty = y; GLint row, drawWidth; @@ -476,17 +473,23 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLstencil values[MAX_WIDTH]; GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; - const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack, + const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); _mesa_unpack_index_span(ctx, drawWidth, destType, values, - type, source, &ctx->Unpack, GL_TRUE); + type, source, &ctx->Unpack, GL_FALSE); + if (shift_or_offset) { + _mesa_shift_and_offset_stencil( ctx, drawWidth, values ); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil( ctx, drawWidth, values ); + } if (zoom) { gl_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y, values, desty ); } else { - gl_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); + _mesa_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); } } } @@ -545,30 +548,23 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, /* Special case: directly write 16-bit depth values */ GLint row; for (row = 0; row < height; row++, y++) { - const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack, + GLdepth zspan[MAX_WIDTH]; + const GLushort *zptr = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); - gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); + GLint i; + for (i = 0; i < width; i++) + zspan[i] = zptr[i]; + gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); } } - else if (type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint) + else if (type==GL_UNSIGNED_INT && ctx->Visual->DepthBits == 32 && !bias_or_scale && !zoom && ctx->Visual->RGBAflag) { /* Special case: directly write 32-bit depth values */ - GLint i, row; - /* Compute shift value to scale 32-bit uints down to depth values. */ - GLuint shift = 0; - GLuint max = MAX_DEPTH; - while ((max & 0x80000000) == 0) { - max = max << 1; - shift++; - } + GLint row; for (row = 0; row < height; row++, y++) { - GLdepth zspan[MAX_WIDTH]; - const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack, + const GLuint *zptr = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); - for (i=0;i<width;i++) { - zspan[i] = zptr[i] >> shift; - } - gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); + gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); } } else { @@ -576,7 +572,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row = 0; row < height; row++, y++) { GLdepth zspan[MAX_WIDTH]; - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, + const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); _mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src, &ctx->Unpack, GL_TRUE ); @@ -625,7 +621,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, /* Fragment depth values */ if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); GLint i; for (i=0;i<width;i++) { zspan[i] = z; @@ -652,10 +648,23 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, if (width > MAX_WIDTH) width = MAX_WIDTH; for (row = 0; row < height; row++, y++) { - const GLvoid *source = gl_pixel_addr_in_image(unpack, + const GLvoid *source = _mesa_image_address(unpack, pixels, width, height, format, type, 0, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba, format, type, source, unpack, GL_TRUE); + if (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) + continue; + + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } + } if (quickDraw) { (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y, @@ -690,9 +699,22 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, return; } + if (ctx->NewState) { + gl_update_state(ctx); + } + x = (GLint) (ctx->Current.RasterPos[0] + 0.5F); y = (GLint) (ctx->Current.RasterPos[1] + 0.5F); + ctx->OcclusionResult = GL_TRUE; + + /* see if device driver can do the drawpix */ + if (ctx->Driver.DrawPixels + && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type, + &ctx->Unpack, pixels)) { + return; + } + switch (format) { case GL_STENCIL_INDEX: draw_stencil_pixels( ctx, x, y, width, height, type, pixels ); diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index aff6cbb50..97554430e 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -153,6 +153,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->NewState |= NEW_FOG|NEW_RASTER_OPS; } break; + case GL_HISTOGRAM: + ctx->Pixel.HistogramEnabled = state; + break; case GL_LIGHT0: case GL_LIGHT1: case GL_LIGHT2: @@ -191,6 +194,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_LINE_SMOOTH: if (ctx->Line.SmoothFlag!=state) { ctx->Line.SmoothFlag = state; + ctx->TriangleCaps ^= DD_LINE_SMOOTH; ctx->NewState |= NEW_RASTER_OPS; } break; @@ -267,6 +271,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_MAP2_VERTEX_4: ctx->Eval.Map2Vertex4 = state; break; + case GL_MINMAX: + ctx->Pixel.MinMaxEnabled = state; + break; case GL_NORMALIZE: if (ctx->Transform.Normalize != state) { ctx->Transform.Normalize = state; @@ -327,8 +334,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) break; case GL_SHARED_TEXTURE_PALETTE_EXT: ctx->Texture.SharedPalette = state; - if (ctx->Driver.UseGlobalTexturePalette) - (*ctx->Driver.UseGlobalTexturePalette)( ctx, state ); break; case GL_STENCIL_TEST: if (state && ctx->Visual->StencilBits==0) { @@ -452,6 +457,81 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Array.EdgeFlag.Enabled = state; break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + ctx->Depth.OcclusionTest = state; + if (state) + ctx->OcclusionResult = ctx->OcclusionResultSaved; + else + ctx->OcclusionResultSaved = ctx->OcclusionResult; + ctx->NewState |= NEW_RASTER_OPS; + } + else { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + break; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + ctx->Pixel.PixelTextureEnabled = state; + break; + + /* GL_SGI_color_table */ + case GL_COLOR_TABLE_SGI: + ctx->Pixel.ColorTableEnabled = state; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + ctx->Pixel.PostConvolutionColorTableEnabled = state; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + ctx->Pixel.PostColorMatrixColorTableEnabled = state; + break; + + /* GL_EXT_convolution */ + case GL_CONVOLUTION_1D: + ctx->Pixel.Convolution1DEnabled = state; + break; + case GL_CONVOLUTION_2D: + ctx->Pixel.Convolution2DEnabled = state; + break; + case GL_SEPARABLE_2D: + ctx->Pixel.Separable2DEnabled = state; + break; + + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Visual->RGBAflag) { + const GLuint curr = ctx->Texture.CurrentUnit; + const GLuint flag = TEXTURE0_CUBE << (curr * 4); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + ctx->NewState |= NEW_TEXTURE_ENABLE; + if (state) { + texUnit->Enabled |= TEXTURE0_CUBE; + ctx->Enabled |= flag; + } + else { + texUnit->Enabled &= ~TEXTURE0_CUBE; + ctx->Enabled &= ~flag; + } + } + } + else { + if (state) + gl_error(ctx, GL_INVALID_ENUM, "glEnable"); + else + gl_error(ctx, GL_INVALID_ENUM, "glDisable"); + return; + } + break; + default: if (state) { gl_error( ctx, GL_INVALID_ENUM, "glEnable" ); @@ -516,6 +596,8 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Color.DitherFlag; case GL_FOG: return ctx->Fog.Enabled; + case GL_HISTOGRAM: + return ctx->Pixel.HistogramEnabled; case GL_LIGHTING: return ctx->Light.Enabled; case GL_LIGHT0: @@ -571,6 +653,8 @@ _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: @@ -645,6 +729,52 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; case GL_EDGE_FLAG_ARRAY: return ctx->Array.EdgeFlag.Enabled; + + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + return ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); + return GL_FALSE; + } + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + return ctx->Pixel.PixelTextureEnabled; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + return ctx->Pixel.PixelTextureEnabled; + + /* GL_SGI_color_table */ + case GL_COLOR_TABLE_SGI: + return ctx->Pixel.ColorTableEnabled; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + return ctx->Pixel.PostConvolutionColorTableEnabled; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + return ctx->Pixel.PostColorMatrixColorTableEnabled; + + /* GL_EXT_convolution */ + case GL_CONVOLUTION_1D: + return ctx->Pixel.Convolution1DEnabled; + case GL_CONVOLUTION_2D: + return ctx->Pixel.Convolution2DEnabled; + case GL_SEPARABLE_2D: + return ctx->Pixel.Separable2DEnabled; + + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); + return GL_FALSE; + } + default: gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); return GL_FALSE; diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c index 82ad25208..18ff0c0cf 100644 --- a/xc/extras/Mesa/src/extensions.c +++ b/xc/extras/Mesa/src/extensions.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -40,7 +40,7 @@ struct extension { struct extension *next, *prev; - int enabled; + GLint enabled; char name[MAX_EXT_NAMELEN+1]; void (*notify)( GLcontext *, GLboolean ); }; @@ -48,36 +48,68 @@ struct extension { static struct { int enabled; const char *name; } default_extensions[] = { + { DEFAULT_OFF, "GL_ARB_imaging" }, /* in progress */ + { DEFAULT_ON, "GL_ARB_multitexture" }, + { DEFAULT_OFF, "GL_ARB_texture_compression" }, /* in progress */ + { DEFAULT_OFF, "GL_ARB_texture_cube_map" }, /* in progress */ + { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, + { ALWAYS_ENABLED, "GL_EXT_abgr" }, { DEFAULT_ON, "GL_EXT_blend_color" }, - { DEFAULT_OFF, "ARB_imaging" }, - { DEFAULT_ON, "GL_EXT_blend_minmax" }, + { DEFAULT_ON, "GL_EXT_blend_func_separate" }, { DEFAULT_ON, "GL_EXT_blend_logic_op" }, + { DEFAULT_ON, "GL_EXT_blend_minmax" }, { DEFAULT_ON, "GL_EXT_blend_subtract" }, + { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, + { DEFAULT_OFF, "GL_EXT_convolution" }, /* in progress */ + { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, + { DEFAULT_ON, "GL_EXT_histogram" }, { DEFAULT_ON, "GL_EXT_paletted_texture" }, { DEFAULT_ON, "GL_EXT_point_parameters" }, { ALWAYS_ENABLED, "GL_EXT_polygon_offset" }, - { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, - { ALWAYS_ENABLED, "GL_EXT_texture_object" }, - { DEFAULT_ON, "GL_EXT_texture3D" }, - { ALWAYS_ENABLED, "GL_MESA_window_pos" }, - { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, - { ALWAYS_ENABLED, "GL_EXT_shared_texture_palette" }, { ALWAYS_ENABLED, "GL_EXT_rescale_normal" }, - { ALWAYS_ENABLED, "GL_EXT_abgr" }, - { ALWAYS_ENABLED, "GL_SGIS_texture_edge_clamp" }, + { DEFAULT_ON, "GL_EXT_shared_texture_palette" }, { ALWAYS_ENABLED, "GL_EXT_stencil_wrap" }, + { DEFAULT_ON, "GL_EXT_texture3D" }, + { DEFAULT_OFF, "GL_EXT_texture_compression_s3tc" }, + { DEFAULT_OFF, "GL_EXT_texture_env" }, + { DEFAULT_ON, "GL_EXT_texture_env_add" }, + { ALWAYS_ENABLED, "GL_EXT_texture_object" }, + { DEFAULT_ON, "GL_EXT_texture_lod_bias" }, + { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, + { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, + { DEFAULT_OFF, "GL_HP_occlusion_test" }, { DEFAULT_ON, "GL_INGR_blend_func_separate" }, - { DEFAULT_ON, "GL_ARB_multitexture" }, + { ALWAYS_ENABLED, "GL_MESA_window_pos" }, + { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, { ALWAYS_ENABLED, "GL_NV_texgen_reflection" }, { DEFAULT_ON, "GL_PGI_misc_hints" }, - { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, - { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, - { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, - { DEFAULT_ON, "GL_EXT_texture_env_add" }, - { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, + { DEFAULT_ON, "GL_SGI_color_matrix" }, + { DEFAULT_ON, "GL_SGI_color_table" }, + { DEFAULT_ON, "GL_SGIS_pixel_texture" }, + { DEFAULT_ON, "GL_SGIS_texture_edge_clamp" }, + { DEFAULT_ON, "GL_SGIX_pixel_texture" }, + { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" } }; +/* + * Update the boolean convenience flags in the Extensions struct. + */ +static void +update_extension_flags( GLcontext *ctx ) +{ + /* Update flags */ + ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add"); + ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias"); + ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test"); + ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map"); + ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression"); + ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc"); + ctx->Extensions.HaveTextureCompressionFXT1 = gl_extension_is_enabled(ctx, "GL_3DFX_texture_compression_FXT1"); +} + + + int gl_extensions_add( GLcontext *ctx, int state, const char *name, @@ -99,21 +131,26 @@ int gl_extensions_add( GLcontext *ctx, } -static int set_extension( GLcontext *ctx, const char *name, GLuint state ) +/* + * Either enable or disable the named extension. + */ +static int 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) break; - if (i == ctx->Extensions.ext_list) return 1; + if (i == ctx->Extensions.ext_list) + return 1; - if (i->enabled && !(i->enabled & ALWAYS_ENABLED)) - { + if (!(i->enabled & ALWAYS_ENABLED)) { if (i->notify) i->notify( ctx, state ); i->enabled = state; } + update_extension_flags(ctx); + return 0; } @@ -187,6 +224,7 @@ void gl_extensions_ctr( GLcontext *ctx ) default_extensions[i].name, 0 ); } + update_extension_flags(ctx); } diff --git a/xc/extras/Mesa/src/feedback.c b/xc/extras/Mesa/src/feedback.c index 12565b105..5d14e892e 100644 --- a/xc/extras/Mesa/src/feedback.c +++ b/xc/extras/Mesa/src/feedback.c @@ -167,7 +167,7 @@ static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv ) win[0] = VB->Win.data[v][0]; win[1] = VB->Win.data[v][1]; - win[2] = VB->Win.data[v][2] / DEPTH_SCALE; + win[2] = VB->Win.data[v][2] / ctx->Visual->DepthMaxF; win[3] = 1.0 / VB->Win.data[v][3]; if (ctx->Light.ShadeModel == GL_SMOOTH) @@ -298,12 +298,13 @@ void gl_update_hitflag( GLcontext *ctx, GLfloat z ) void gl_select_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv ) { - struct vertex_buffer *VB = ctx->VB; + const struct vertex_buffer *VB = ctx->VB; if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) { - gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE ); - gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE ); - gl_update_hitflag( ctx, VB->Win.data[v2][2] / DEPTH_SCALE ); + const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); + gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); + gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs ); } } @@ -311,21 +312,22 @@ void gl_select_triangle( GLcontext *ctx, void gl_select_line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) { - struct vertex_buffer *VB = ctx->VB; - - gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE ); - gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE ); + const struct vertex_buffer *VB = ctx->VB; + const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); + gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); } void gl_select_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; + const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; GLuint i; for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - gl_update_hitflag( ctx, VB->Win.data[i][2] / DEPTH_SCALE); + gl_update_hitflag( ctx, VB->Win.data[i][2] * zs ); } } } diff --git a/xc/extras/Mesa/src/fog.c b/xc/extras/Mesa/src/fog.c index 1aff751c4..d21711805 100644 --- a/xc/extras/Mesa/src/fog.c +++ b/xc/extras/Mesa/src/fog.c @@ -33,6 +33,7 @@ #include "macros.h" #include "mmath.h" #include "types.h" +#include "xform.h" #endif @@ -84,6 +85,8 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLenum m; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFog"); + switch (pname) { case GL_FOG_MODE: m = (GLenum) (GLint) *params; @@ -105,23 +108,9 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) } break; case GL_FOG_START: -#if 0 - /* Prior to OpenGL 1.1, this was an error */ - if (*params<0.0F) { - gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_START)" ); - return; - } -#endif ctx->Fog.Start = *params; break; case GL_FOG_END: -#if 0 - /* Prior to OpenGL 1.1, this was an error */ - if (*params<0.0F) { - gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_END)" ); - return; - } -#endif ctx->Fog.End = *params; break; case GL_FOG_INDEX: @@ -149,9 +138,13 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side, GLubyte flag ); +typedef void (*fog_coord_func)( struct vertex_buffer *VB, + const GLvector4f *from, + GLubyte flag ); static fog_func fog_ci_tab[2]; static fog_func fog_rgba_tab[2]; +static fog_coord_func make_fog_coord_tab[2]; /* * Compute the fogged color for an array of vertices. @@ -209,6 +202,71 @@ _mesa_fog_vertices( struct vertex_buffer *VB ) } } + +static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d ) +{ + d->type = 0; + + if (ctx->FogMode==FOG_FRAGMENT) + { + d->type = PIPE_IMMEDIATE|PIPE_PRECALC; + d->inputs = VERT_OBJ_ANY; + d->outputs = VERT_FOG_COORD; + } +} + + +static void gl_make_fog_coords( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + + /* If full eye coords weren't required, just calculate the eye Z + * values. + */ + if (!ctx->NeedEyeCoords) { + GLfloat *m = ctx->ModelView.m; + GLfloat plane[4]; + + plane[0] = m[2]; + plane[1] = m[6]; + plane[2] = m[10]; + plane[3] = m[14]; + + gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye, + 2, /* fill z coordinates */ + VB->ObjPtr, + plane, + 0 ); + + make_fog_coord_tab[0]( VB, &VB->Eye, 0 ); + } + else + { + make_fog_coord_tab[0]( VB, VB->EyePtr, 0 ); + } +} + + +/* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this + * stage for the default PIPE_OP_FOG pipeline stage. + */ +struct gl_pipeline_stage gl_fog_coord_stage = { + "build fog coordinates", + PIPE_OP_FOG, + PIPE_PRECALC|PIPE_IMMEDIATE, + 0, + NEW_FOG, + NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW, + 0, 0, + 0, 0, 0, + check_fog_coords, + gl_make_fog_coords +}; + + + + + /* * Apply fog to an array of RGBA pixels. * Input: n - number of pixels diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index 6c5f3ef9f..21b5b639a 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -57,6 +57,28 @@ #endif +static GLenum +pixel_texgen_mode(const GLcontext *ctx) +{ + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_RGBA; + } + else { + return GL_RGB; + } + } + else { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_ALPHA; + } + else { + return GL_NONE; + } + } +} + + void _mesa_GetBooleanv( GLenum pname, GLboolean *params ) @@ -74,10 +96,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumRedBits); + break; case GL_ACCUM_GREEN_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumGreenBits); + break; case GL_ACCUM_BLUE_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumBlueBits); + break; case GL_ACCUM_ALPHA_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumBits); + *params = INT_TO_BOOL(ctx->Visual->AccumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]); @@ -318,6 +346,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_GREEN_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; + case GL_HISTOGRAM: + *params = ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = INT_TO_BOOL( ctx->Visual->IndexBits ); break; @@ -539,6 +570,9 @@ _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]); @@ -611,7 +645,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Pixel.MapStoSsize); break; case GL_POINT_SIZE: - *params = FLOAT_TO_BOOL(ctx->Point.Size ); + *params = FLOAT_TO_BOOL(ctx->Point.UserSize); break; case GL_POINT_SIZE_GRANULARITY: *params = FLOAT_TO_BOOL(ctx->Const.PointSizeGranularity ); @@ -747,13 +781,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Const.SubPixelBits); break; case GL_TEXTURE_1D: - *params = _mesa_IsEnabled(GL_TEXTURE_1D ); + *params = _mesa_IsEnabled(GL_TEXTURE_1D); break; case GL_TEXTURE_2D: - *params = _mesa_IsEnabled(GL_TEXTURE_2D ); + *params = _mesa_IsEnabled(GL_TEXTURE_2D); break; case GL_TEXTURE_3D: - *params = _mesa_IsEnabled(GL_TEXTURE_3D ); + *params = _mesa_IsEnabled(GL_TEXTURE_3D); break; case GL_TEXTURE_BINDING_1D: *params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name); @@ -763,7 +797,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_TEXTURE_BINDING_3D: *params = INT_TO_BOOL(textureUnit->CurrentD[3]->Name); - break; + break; case GL_TEXTURE_ENV_COLOR: { params[0] = FLOAT_TO_BOOL(textureUnit->EnvColor[0]); @@ -908,6 +942,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Array.EdgeFlag.Stride); break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = ctx->Const.MaxTextureUnits; break; @@ -918,6 +953,51 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *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.HaveTextureCubeMap) + *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = INT_TO_BOOL(ctx->Const.MaxCubeTextureSize); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = INT_TO_BOOL(ctx->Hint.TextureCompression); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_BOOL(GL_NICEST); @@ -934,12 +1014,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLboolean) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLboolean) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -948,8 +1028,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLboolean) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLboolean) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLboolean) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLboolean) ctx->Hint.AllowDrawMem; @@ -978,7 +1058,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ColorMatrix.m); + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(tm[i]); + } + } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { @@ -1011,8 +1098,124 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Depth.OcclusionTest) + *params = ctx->OcclusionResult; + else + *params = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLboolean) pixel_texgen_mode(ctx); + break; + + /* 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]); + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = INT_TO_BOOL(ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH); + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[3]); + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[3]); + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + case GL_MAX_CONVOLUTION_WIDTH: + *params = INT_TO_BOOL(ctx->Const.MaxConvolutionWidth); + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = INT_TO_BOOL(ctx->Const.MaxConvolutionHeight); + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[0]); + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[1]); + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[3]); + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[0]); + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[1]); + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); } } @@ -1036,10 +1239,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLdouble) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLdouble) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLdouble) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLdouble) ctx->Visual->AccumBits; + *params = (GLdouble) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = (GLdouble) ctx->Accum.ClearColor[0]; @@ -1280,6 +1489,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_GREEN_SCALE: *params = (GLdouble) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLdouble) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLdouble) ctx->Visual->IndexBits; break; @@ -1501,6 +1713,9 @@ _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]; @@ -1573,7 +1788,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: - *params = (GLdouble) ctx->Point.Size; + *params = (GLdouble) ctx->Point.UserSize; break; case GL_POINT_SIZE_GRANULARITY: *params = (GLdouble) ctx->Const.PointSizeGranularity; @@ -1870,6 +2085,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = 0.0; break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = (GLdouble) ctx->Const.MaxTextureUnits; break; @@ -1880,6 +2096,50 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLdouble) textureUnit->CurrentCubeMap->Name; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLdouble) ctx->Const.MaxCubeTextureSize; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLdouble) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: @@ -1897,12 +2157,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLdouble) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLdouble) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -1911,8 +2171,8 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLdouble) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLdouble) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLdouble) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLdouble) ctx->Hint.AllowDrawMem; @@ -1941,7 +2201,14 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ColorMatrix.m); + for (i=0;i<16;i++) { + params[i] = (GLdouble) tm[i]; + } + } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { @@ -1974,8 +2241,124 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = (GLdouble) ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + 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 { + gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLdouble) pixel_texgen_mode(ctx); + break; + + /* 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]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLdouble) (ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLdouble) MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[3]; + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLdouble) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLdouble) ctx->Const.MaxConvolutionHeight; + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[0]; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } } @@ -1999,10 +2382,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLfloat) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLfloat) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLfloat) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLfloat) ctx->Visual->AccumBits; + *params = (GLfloat) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = ctx->Accum.ClearColor[0]; @@ -2240,6 +2629,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_GREEN_SCALE: *params = (GLfloat) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLfloat) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLfloat) ctx->Visual->IndexBits; break; @@ -2461,6 +2853,9 @@ _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]; @@ -2533,7 +2928,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: - *params = (GLfloat) ctx->Point.Size; + *params = (GLfloat) ctx->Point.UserSize; break; case GL_POINT_SIZE_GRANULARITY: *params = (GLfloat) ctx->Const.PointSizeGranularity; @@ -2832,6 +3227,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = 0.0; break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = (GLfloat) ctx->Const.MaxTextureUnits; break; @@ -2842,6 +3238,51 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLfloat) textureUnit->CurrentCubeMap->Name; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLfloat) ctx->Const.MaxCubeTextureSize; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLfloat) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_FLOAT(GL_NICEST); @@ -2858,12 +3299,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLfloat) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLfloat) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -2872,8 +3313,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLfloat) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLfloat) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLfloat) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLfloat) ctx->Hint.AllowDrawMem; @@ -2902,7 +3343,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + gl_matrix_transposef(params, ctx->ColorMatrix.m); break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: gl_matrix_transposef(params, ctx->ModelView.m); @@ -2914,8 +3355,124 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) gl_matrix_transposef(params, ctx->TextureMatrix[texTransformUnit].m); break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = (GLfloat) ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + 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 { + gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLfloat) pixel_texgen_mode(ctx); + break; + + /* 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]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLfloat) (ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLfloat) MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[3]; + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLfloat) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLfloat) ctx->Const.MaxConvolutionHeight; + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[0]; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[2]; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); } } @@ -2939,10 +3496,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLint) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLint) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLint) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLint) ctx->Visual->AccumBits; + *params = (GLint) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] ); @@ -3184,6 +3747,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_GREEN_SCALE: *params = (GLint) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLint) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLint) ctx->Visual->IndexBits; break; @@ -3405,6 +3971,9 @@ _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]; @@ -3477,7 +4046,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: - *params = (GLint) ctx->Point.Size; + *params = (GLint) ctx->Point.UserSize; break; case GL_POINT_SIZE_GRANULARITY: *params = (GLint) ctx->Const.PointSizeGranularity; @@ -3774,6 +4343,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = 0; break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = ctx->Const.MaxTextureUnits; break; @@ -3784,6 +4354,51 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = textureUnit->CurrentCubeMap->Name; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = ctx->Const.MaxCubeTextureSize; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLint) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = (GL_NICEST); @@ -3793,19 +4408,19 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_STRICT_SCISSOR_HINT_PGI: case GL_FULL_STIPPLE_HINT_PGI: - *params = (GL_TRUE); + *params = GL_TRUE; break; case GL_CONSERVE_MEMORY_HINT_PGI: - *params = (GL_FALSE); + *params = GL_FALSE; break; case GL_ALWAYS_FAST_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -3814,8 +4429,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = ctx->Hint.AllowDrawMem; @@ -3828,7 +4443,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = GL_DONT_CARE; break; case GL_BACK_NORMALS_HINT_PGI: - *params = (GL_TRUE); + *params = GL_TRUE; break; case GL_NATIVE_GRAPHICS_HANDLE_PGI: *params = 0; @@ -3844,7 +4459,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ColorMatrix.m); + for (i=0;i<16;i++) { + params[i] = (GLint) tm[i]; + } + } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { @@ -3877,8 +4499,124 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = (GLint) ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + 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 { + gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLint) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = (GLint) ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = ctx->ColorStackDepth + 1; + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[3]; + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + case GL_MAX_CONVOLUTION_WIDTH: + *params = ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = ctx->Const.MaxConvolutionHeight; + break; + case GL_POST_CONVOLUTION_RED_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[0]; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } } diff --git a/xc/extras/Mesa/src/glapi.c b/xc/extras/Mesa/src/glapi.c index 5f5fc6de1..c3ac458cb 100644 --- a/xc/extras/Mesa/src/glapi.c +++ b/xc/extras/Mesa/src/glapi.c @@ -72,6 +72,18 @@ static _glthread_TSD ContextTSD; static GLuint MaxDispatchOffset = sizeof(struct _glapi_table) / sizeof(void *) - 1; static GLboolean GetSizeCalled = GL_FALSE; +/* strdup is actually not a standard ANSI C or POSIX routine + Irix will not define it if ANSI mode is in effect. */ +static char *str_dup(const char *str) +{ + char *copy; + copy = (char*) malloc(strlen(str) + 1); + if (!copy) + return NULL; + strcpy(copy, str); + return copy; +} + /* @@ -222,354 +234,6 @@ _glapi_get_version(void) } -struct name_address_offset { - const char *Name; - GLvoid *Address; - GLuint Offset; -}; - -static struct name_address_offset static_functions[1000]; - - - -/* - * Return dispatch table offset of the named static (built-in) function. - * Return -1 if function not found. - */ -static GLint -get_static_proc_offset(const char *funcName) -{ - GLuint i; - for (i = 0; static_functions[i].Name; i++) { - if (strcmp(static_functions[i].Name, funcName) == 0) { - return static_functions[i].Offset; - } - } - return -1; -} - - -/* - * Return dispatch function address the named static (built-in) function. - * Return NULL if function not found. - */ -static GLvoid * -get_static_proc_address(const char *funcName) -{ - GLint i = get_static_proc_offset(funcName); - if (i >= 0) - return static_functions[i].Address; - else - return NULL; -} - - - -/********************************************************************** - * Extension function management. - */ - - -#define MAX_EXTENSION_FUNCS 1000 - -static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; -static GLuint NumExtEntryPoints = 0; - - - -/* - * Generate a dispatch function (entrypoint) which jumps through - * the given slot number (offset) in the current dispatch table. - * We need assembly language in order to accomplish this. - */ -static void * -generate_entrypoint(GLuint functionOffset) -{ -#if defined(USE_X86_ASM) - /* - * This x86 code contributed by Josh Vanderhoof. - * - * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax - * 00 01 02 03 04 - * 5: 85 c0 testl %eax,%eax - * 05 06 - * 7: 74 06 je f <entrypoint+0xf> - * 07 08 - * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) - * 09 0a 0b 0c 0d 0e - * f: e8 fc ff ff ff call __glapi_get_dispatch - * 0f 10 11 12 13 - * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) - * 14 15 16 17 18 19 - */ - static const unsigned char temp[] = { - 0xa1, 0x00, 0x00, 0x00, 0x00, - 0x85, 0xc0, - 0x74, 0x06, - 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, - 0xe8, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 - }; - unsigned char *code = malloc(sizeof(temp)); - unsigned int next_insn; - if (code) { - memcpy(code, temp, sizeof(temp)); - - *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; - *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; - next_insn = (unsigned int)(code + 0x14); - *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; - *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; - } - return code; -#else - return NULL; -#endif -} - - - -/* - * Add a new extension function entrypoint. - * Return: GL_TRUE = success or GL_FALSE = failure - */ -GLboolean -_glapi_add_entrypoint(const char *funcName, GLuint 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 will now be out of date. - */ - assert(!GetSizeCalled); - - /* first check if the named function is already statically present */ - { - GLint index = get_static_proc_offset(funcName); - if (index >= 0) { - return (GLboolean) (index == offset); /* bad offset! */ - } - } - - { - /* 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 */ - if (ExtEntryTable[i].Offset == offset) { - return GL_TRUE; /* offsets match */ - } - else { - return GL_FALSE; /* bad offset! */ - } - } - } - - /* 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 = strdup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entrypoint; - NumExtEntryPoints++; - - if (offset > MaxDispatchOffset) - MaxDispatchOffset = offset; - - return GL_TRUE; /* success */ - } - } - - /* should never get here, but play it safe */ - 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 = strdup(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. - */ -GLint -_glapi_get_proc_offset(const char *funcName) -{ - /* search extension functions first */ - GLint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - return ExtEntryTable[i].Offset; - } - } - - /* search static functions */ - return get_static_proc_offset(funcName); -} - - - -/* - * Return entrypoint for named function. - */ -const GLvoid * -_glapi_get_proc_address(const char *funcName) -{ - /* search extension functions first */ - GLint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - return ExtEntryTable[i].Address; - } - } - - /* search static functions */ - return get_static_proc_address(funcName); -} - - - - -/* - * Return the name of the function at the given dispatch offset. - * This is only intended for debugging. - */ -const char * -_glapi_get_proc_name(GLuint offset) -{ - const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); - GLuint i; - for (i = 0; i < n; i++) { - if (static_functions[i].Offset == offset) - return static_functions[i].Name; - } - - /* search added extension functions */ - for (i = 0; i < NumExtEntryPoints; i++) { - if (ExtEntryTable[i].Offset == offset) { - return ExtEntryTable[i].Name; - } - } - return NULL; -} - - - -/* - * Make sure there are no NULL pointers in the given dispatch table. - * Intented for debugging purposes. - */ -void -_glapi_check_table(const struct _glapi_table *table) -{ - const GLuint entries = _glapi_get_dispatch_table_size(); - const void **tab = (const void **) table; - GLuint i; - for (i = 1; i < entries; i++) { - assert(tab[i]); - } - -#ifdef DEBUG - /* Do some spot checks to be sure that the dispatch table - * slots are assigned correctly. - */ - { - GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); - char *BeginFunc = (char*) &table->Begin; - GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); - assert(BeginOffset == _gloffset_Begin); - assert(BeginOffset == offset); - } - { - GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); - char *viewportFunc = (char*) &table->Viewport; - GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); - assert(viewportOffset == _gloffset_Viewport); - assert(viewportOffset == offset); - } - { - GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); - char *VertexPointerFunc = (char*) &table->VertexPointer; - GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); - assert(VertexPointerOffset == _gloffset_VertexPointer); - assert(VertexPointerOffset == offset); - } - { - GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); - char *ResetMinMaxFunc = (char*) &table->ResetMinmax; - GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); - assert(ResetMinMaxOffset == _gloffset_ResetMinmax); - assert(ResetMinMaxOffset == offset); - } - { - GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); - char *blendColorFunc = (char*) &table->BlendColor; - GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); - assert(blendColorOffset == _gloffset_BlendColor); - assert(blendColorOffset == offset); - } - { - GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); - char *istextureFunc = (char*) &table->IsTextureEXT; - GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); - assert(istextureOffset == _gloffset_IsTextureEXT); - assert(istextureOffset == offset); - } -#endif -} - - /* * For each entry in static_functions[] which use this function * we should implement a dispatch function in glapitemp.h and @@ -581,6 +245,12 @@ static int NotImplemented(void) } +struct name_address_offset { + const char *Name; + GLvoid *Address; + GLuint Offset; +}; + static struct name_address_offset static_functions[] = { /* GL 1.1 */ @@ -923,7 +593,7 @@ static struct name_address_offset static_functions[] = { { "glPushClientAttrib", (GLvoid *) glPushClientAttrib, _gloffset_PushClientAttrib }, /* 1.2 */ #ifdef GL_VERSION_1_2 -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else #define NAME(X) NotImplemented #endif @@ -967,9 +637,9 @@ static struct name_address_offset static_functions[] = { { "glCopyTexSubImage3D", (GLvoid *) NAME(glCopyTexSubImage3D), _gloffset_CopyTexSubImage3D }, #undef NAME - /* GL_ARB_multitexture */ + /* ARB 1. GL_ARB_multitexture */ #ifdef GL_ARB_multitexture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else #define NAME(X) NotImplemented #endif @@ -1009,9 +679,9 @@ static struct name_address_offset static_functions[] = { { "glMultiTexCoord4svARB", (GLvoid *) NAME(glMultiTexCoord4svARB), _gloffset_MultiTexCoord4svARB }, #undef NAME - /* GL_ARB_transpose_matrix */ + /* ARB 3. GL_ARB_transpose_matrix */ #ifdef GL_ARB_transpose_matrix -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else #define NAME(X) NotImplemented #endif @@ -1021,504 +691,1107 @@ static struct name_address_offset static_functions[] = { { "glMultTransposeMatrixfARB", (GLvoid *) NAME(glMultTransposeMatrixfARB), _gloffset_MultTransposeMatrixfARB }, #undef NAME - /* GL_ARB_multisample */ + /* ARB 5. GL_ARB_multisample */ #ifdef GL_ARB_multisample -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glSampleCoverageARB", (GLvoid *) NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB }, - { "glSamplePassARB", (GLvoid *) NAME(glSamplePassARB), _gloffset_SamplePassARB }, + { "glSamplePassARB", NAME(glSamplePassARB), _gloffset_SamplePassARB }, + { "glSampleCoverageARB", NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB }, #undef NAME + /* ARB 12. GL_ARB_texture_compression */ +#if 000 +#if defined(GL_ARB_texture_compression) && defined(_gloffset_CompressedTexImage3DARB) +#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 +#endif + /* 2. GL_EXT_blend_color */ #ifdef GL_EXT_blend_color -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glBlendColorEXT", (GLvoid *) NAME(glBlendColorEXT), _gloffset_BlendColor }, + { "glBlendColorEXT", NAME(glBlendColorEXT), _gloffset_BlendColor }, #undef NAME /* 3. GL_EXT_polygon_offset */ #ifdef GL_EXT_polygon_offset -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glPolygonOffsetEXT", (GLvoid *) NAME(glPolygonOffsetEXT), _gloffset_PolygonOffsetEXT }, + { "glPolygonOffsetEXT", NAME(glPolygonOffsetEXT), _gloffset_PolygonOffsetEXT }, #undef NAME /* 6. GL_EXT_texture3D */ #ifdef GL_EXT_texture3D -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCopyTexSubImage3DEXT", (GLvoid *) NAME(glCopyTexSubImage3DEXT), _gloffset_CopyTexSubImage3D }, - { "glTexImage3DEXT", (GLvoid *) NAME(glTexImage3DEXT), _gloffset_TexImage3D }, - { "glTexSubImage3DEXT", (GLvoid *) NAME(glTexSubImage3DEXT), _gloffset_TexSubImage3D }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetTexFilterFuncSGIS", (GLvoid *) NAME(glGetTexFilterFuncSGIS), _gloffset_GetTexFilterFuncSGIS }, - { "glTexFilterFuncSGIS", (GLvoid *) NAME(glTexFilterFuncSGIS), _gloffset_TexFilterFuncSGIS }, + { "glGetTexFilterFuncSGIS", NAME(glGetTexFilterFuncSGIS), _gloffset_GetTexFilterFuncSGIS }, + { "glTexFilterFuncSGIS", NAME(glTexFilterFuncSGIS), _gloffset_TexFilterFuncSGIS }, #undef NAME /* 9. GL_EXT_subtexture */ #ifdef GL_EXT_subtexture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glTexSubImage1DEXT", (GLvoid *) NAME(glTexSubImage1DEXT), _gloffset_TexSubImage1D }, - { "glTexSubImage2DEXT", (GLvoid *) NAME(glTexSubImage2DEXT), _gloffset_TexSubImage2D }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCopyTexImage1DEXT", (GLvoid *) NAME(glCopyTexImage1DEXT), _gloffset_CopyTexImage1D }, - { "glCopyTexImage2DEXT", (GLvoid *) NAME(glCopyTexImage2DEXT), _gloffset_CopyTexImage2D }, - { "glCopyTexSubImage1DEXT", (GLvoid *) NAME(glCopyTexSubImage1DEXT), _gloffset_CopyTexSubImage1D }, - { "glCopyTexSubImage2DEXT", (GLvoid *) NAME(glCopyTexSubImage2DEXT), _gloffset_CopyTexSubImage2D }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetHistogramEXT", (GLvoid *) NAME(glGetHistogramEXT), _gloffset_GetHistogramEXT }, - { "glGetHistogramParameterfvEXT", (GLvoid *) NAME(glGetHistogramParameterfvEXT), _gloffset_GetHistogramParameterfvEXT }, - { "glGetHistogramParameterivEXT", (GLvoid *) NAME(glGetHistogramParameterivEXT), _gloffset_GetHistogramParameterivEXT }, - { "glGetMinmaxEXT", (GLvoid *) NAME(glGetMinmaxEXT), _gloffset_GetMinmaxEXT }, - { "glGetMinmaxParameterfvEXT", (GLvoid *) NAME(glGetMinmaxParameterfvEXT), _gloffset_GetMinmaxParameterfvEXT }, - { "glGetMinmaxParameterivEXT", (GLvoid *) NAME(glGetMinmaxParameterivEXT), _gloffset_GetMinmaxParameterivEXT }, - { "glHistogramEXT", (GLvoid *) NAME(glHistogramEXT), _gloffset_Histogram }, - { "glMinmaxEXT", (GLvoid *) NAME(glMinmaxEXT), _gloffset_Minmax }, - { "glResetHistogramEXT", (GLvoid *) NAME(glResetHistogramEXT), _gloffset_ResetHistogram }, - { "glResetMinmaxEXT", (GLvoid *) NAME(glResetMinmaxEXT), _gloffset_ResetMinmax }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glConvolutionFilter1DEXT", (GLvoid *) NAME(glConvolutionFilter1DEXT), _gloffset_ConvolutionFilter1D }, - { "glConvolutionFilter2DEXT", (GLvoid *) NAME(glConvolutionFilter2DEXT), _gloffset_ConvolutionFilter2D }, - { "glConvolutionParameterfEXT", (GLvoid *) NAME(glConvolutionParameterfEXT), _gloffset_ConvolutionParameterf }, - { "glConvolutionParameterfvEXT", (GLvoid *) NAME(glConvolutionParameterfvEXT), _gloffset_ConvolutionParameterfv }, - { "glConvolutionParameteriEXT", (GLvoid *) NAME(glConvolutionParameteriEXT), _gloffset_ConvolutionParameteri }, - { "glConvolutionParameterivEXT", (GLvoid *) NAME(glConvolutionParameterivEXT), _gloffset_ConvolutionParameteriv }, - { "glCopyConvolutionFilter1DEXT", (GLvoid *) NAME(glCopyConvolutionFilter1DEXT), _gloffset_CopyConvolutionFilter1D }, - { "glCopyConvolutionFilter2DEXT", (GLvoid *) NAME(glCopyConvolutionFilter2DEXT), _gloffset_CopyConvolutionFilter2D }, - { "glGetConvolutionFilterEXT", (GLvoid *) NAME(glGetConvolutionFilterEXT), _gloffset_GetConvolutionFilterEXT }, - { "glGetConvolutionParameterivEXT", (GLvoid *) NAME(glGetConvolutionParameterivEXT), _gloffset_GetConvolutionParameterivEXT }, - { "glGetConvolutionParameterfvEXT", (GLvoid *) NAME(glGetConvolutionParameterfvEXT), _gloffset_GetConvolutionParameterfvEXT }, - { "glGetSeparableFilterEXT", (GLvoid *) NAME(glGetSeparableFilterEXT), _gloffset_GetSeparableFilterEXT }, - { "glSeparableFilter2DEXT", (GLvoid *) NAME(glSeparableFilter2DEXT), _gloffset_SeparableFilter2D }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glColorTableSGI", (GLvoid *) NAME(glColorTableSGI), _gloffset_ColorTable }, - { "glColorTableParameterfvSGI", (GLvoid *) NAME(glColorTableParameterfvSGI), _gloffset_ColorTableParameterfv }, - { "glColorTableParameterivSGI", (GLvoid *) NAME(glColorTableParameterivSGI), _gloffset_ColorTableParameteriv }, - { "glCopyColorTableSGI", (GLvoid *) NAME(glCopyColorTableSGI), _gloffset_CopyColorTable }, - { "glGetColorTableSGI", (GLvoid *) NAME(glGetColorTableSGI), _gloffset_GetColorTableSGI }, - { "glGetColorTableParameterfvSGI", (GLvoid *) NAME(glGetColorTableParameterfvSGI), _gloffset_GetColorTableParameterfvSGI }, - { "glGetColorTableParameterivSGI", (GLvoid *) NAME(glGetColorTableParameterivSGI), _gloffset_GetColorTableParameterivSGI }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glPixelTexGenParameterfSGIS", (GLvoid *) NAME(glPixelTexGenParameterfSGIS), _gloffset_PixelTexGenParameterfSGIS }, - { "glPixelTexGenParameteriSGIS", (GLvoid *) NAME(glPixelTexGenParameteriSGIS), _gloffset_PixelTexGenParameteriSGIS }, - { "glGetPixelTexGenParameterfvSGIS", (GLvoid *) NAME(glGetPixelTexGenParameterfvSGIS), _gloffset_GetPixelTexGenParameterfvSGIS }, - { "glGetPixelTexGenParameterivSGIS", (GLvoid *) NAME(glGetPixelTexGenParameterivSGIS), _gloffset_GetPixelTexGenParameterivSGIS }, + { "glPixelTexGenParameterfSGIS", NAME(glPixelTexGenParameterfSGIS), _gloffset_PixelTexGenParameterfSGIS }, + { "glPixelTexGenParameteriSGIS", NAME(glPixelTexGenParameteriSGIS), _gloffset_PixelTexGenParameteriSGIS }, + { "glGetPixelTexGenParameterfvSGIS", NAME(glGetPixelTexGenParameterfvSGIS), _gloffset_GetPixelTexGenParameterfvSGIS }, + { "glGetPixelTexGenParameterivSGIS", NAME(glGetPixelTexGenParameterivSGIS), _gloffset_GetPixelTexGenParameterivSGIS }, #undef NAME /* 16. GL_SGIS_texture4D */ #ifdef GL_SGIS_texture4D -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glTexImage4DSGIS", (GLvoid *) NAME(glTexImage4DSGIS), _gloffset_TexImage4DSGIS }, - { "glTexSubImage4DSGIS", (GLvoid *) NAME(glTexSubImage4DSGIS), _gloffset_TexSubImage4DSGIS }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glAreTexturesResidentEXT", (GLvoid *) NAME(glAreTexturesResidentEXT), _gloffset_AreTexturesResidentEXT }, - { "glBindTextureEXT", (GLvoid *) NAME(glBindTextureEXT), _gloffset_BindTexture }, - { "glDeleteTexturesEXT", (GLvoid *) NAME(glDeleteTexturesEXT), _gloffset_DeleteTextures }, - { "glGenTexturesEXT", (GLvoid *) NAME(glGenTexturesEXT), _gloffset_GenTexturesEXT }, - { "glIsTextureEXT", (GLvoid *) NAME(glIsTextureEXT), _gloffset_IsTextureEXT }, - { "glPrioritizeTexturesEXT", (GLvoid *) NAME(glPrioritizeTexturesEXT), _gloffset_PrioritizeTextures }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glDetailTexFuncSGIS", (GLvoid *) NAME(glDetailTexFuncSGIS), _gloffset_DetailTexFuncSGIS }, - { "glGetDetailTexFuncSGIS", (GLvoid *) NAME(glGetDetailTexFuncSGIS), _gloffset_GetDetailTexFuncSGIS }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetSharpenTexFuncSGIS", (GLvoid *) NAME(glGetSharpenTexFuncSGIS), _gloffset_GetSharpenTexFuncSGIS }, - { "glSharpenTexFuncSGIS", (GLvoid *) NAME(glSharpenTexFuncSGIS), _gloffset_SharpenTexFuncSGIS }, + { "glGetSharpenTexFuncSGIS", NAME(glGetSharpenTexFuncSGIS), _gloffset_GetSharpenTexFuncSGIS }, + { "glSharpenTexFuncSGIS", NAME(glSharpenTexFuncSGIS), _gloffset_SharpenTexFuncSGIS }, #undef NAME /* 25. GL_SGIS_multisample */ #ifdef GL_SGIS_multisample -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glSampleMaskSGIS", (GLvoid *) NAME(glSampleMaskSGIS), _gloffset_SampleMaskSGIS }, - { "glSamplePatternSGIS", (GLvoid *) NAME(glSamplePatternSGIS), _gloffset_SamplePatternSGIS }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glArrayElementEXT", (GLvoid *) NAME(glArrayElementEXT), _gloffset_ArrayElement }, - { "glColorPointerEXT", (GLvoid *) NAME(glColorPointerEXT), _gloffset_ColorPointerEXT }, - { "glDrawArraysEXT", (GLvoid *) NAME(glDrawArraysEXT), _gloffset_DrawArrays }, - { "glEdgeFlagPointerEXT", (GLvoid *) NAME(glEdgeFlagPointerEXT), _gloffset_EdgeFlagPointerEXT }, - { "glGetPointervEXT", (GLvoid *) NAME(glGetPointervEXT), _gloffset_GetPointerv }, - { "glIndexPointerEXT", (GLvoid *) NAME(glIndexPointerEXT), _gloffset_IndexPointerEXT }, - { "glNormalPointerEXT", (GLvoid *) NAME(glNormalPointerEXT), _gloffset_NormalPointerEXT }, - { "glTexCoordPointerEXT", (GLvoid *) NAME(glTexCoordPointerEXT), _gloffset_TexCoordPointerEXT }, - { "glVertexPointerEXT", (GLvoid *) NAME(glVertexPointerEXT), _gloffset_VertexPointerEXT }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glBlendEquationEXT", (GLvoid *) NAME(glBlendEquationEXT), _gloffset_BlendEquation }, + { "glBlendEquationEXT", NAME(glBlendEquationEXT), _gloffset_BlendEquation }, #undef NAME /* 52. GL_SGIX_sprite */ #ifdef GL_SGIX_sprite -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glSpriteParameterfSGIX", (GLvoid *) NAME(glSpriteParameterfSGIX), _gloffset_SpriteParameterfSGIX }, - { "glSpriteParameterfvSGIX", (GLvoid *) NAME(glSpriteParameterfvSGIX), _gloffset_SpriteParameterfvSGIX }, - { "glSpriteParameteriSGIX", (GLvoid *) NAME(glSpriteParameteriSGIX), _gloffset_SpriteParameteriSGIX }, - { "glSpriteParameterivSGIX", (GLvoid *) NAME(glSpriteParameterivSGIX), _gloffset_SpriteParameterivSGIX }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glPointParameterfEXT", (GLvoid *) NAME(glPointParameterfEXT), _gloffset_PointParameterfEXT }, - { "glPointParameterfvEXT", (GLvoid *) NAME(glPointParameterfvEXT), _gloffset_PointParameterfvEXT }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glInstrumentsBufferSGIX", (GLvoid *) NAME(glInstrumentsBufferSGIX), _gloffset_InstrumentsBufferSGIX }, - { "glStartInstrumentsSGIX", (GLvoid *) NAME(glStartInstrumentsSGIX), _gloffset_StartInstrumentsSGIX }, - { "glStopInstrumentsSGIX", (GLvoid *) NAME(glStopInstrumentsSGIX), _gloffset_StopInstrumentsSGIX }, - { "glReadInstrumentsSGIX", (GLvoid *) NAME(glReadInstrumentsSGIX), _gloffset_ReadInstrumentsSGIX }, - { "glPollInstrumentsSGIX", (GLvoid *) NAME(glPollInstrumentsSGIX), _gloffset_PollInstrumentsSGIX }, - { "glGetInstrumentsSGIX", (GLvoid *) NAME(glGetInstrumentsSGIX), _gloffset_GetInstrumentsSGIX }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFrameZoomSGIX", (GLvoid *) NAME(glFrameZoomSGIX), _gloffset_FrameZoomSGIX }, + { "glFrameZoomSGIX", NAME(glFrameZoomSGIX), _gloffset_FrameZoomSGIX }, #undef NAME /* 58. GL_SGIX_tag_sample_buffer */ #ifdef GL_SGIX_tag_sample_buffer -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glTagSampleBufferSGIX", (GLvoid *) NAME(glTagSampleBufferSGIX), _gloffset_TagSampleBufferSGIX }, + { "glTagSampleBufferSGIX", NAME(glTagSampleBufferSGIX), _gloffset_TagSampleBufferSGIX }, #undef NAME /* 60. GL_SGIX_reference_plane */ #ifdef GL_SGIX_reference_plane -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glReferencePlaneSGIX", (GLvoid *) NAME(glReferencePlaneSGIX), _gloffset_ReferencePlaneSGIX }, + { "glReferencePlaneSGIX", NAME(glReferencePlaneSGIX), _gloffset_ReferencePlaneSGIX }, #undef NAME /* 61. GL_SGIX_flush_raster */ #ifdef GL_SGIX_flush_raster -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFlushRasterSGIX", (GLvoid *) NAME(glFlushRasterSGIX), _gloffset_FlushRasterSGIX }, + { "glFlushRasterSGIX", NAME(glFlushRasterSGIX), _gloffset_FlushRasterSGIX }, #undef NAME /* 66. GL_HP_image_transform */ #if 0 #ifdef GL_HP_image_transform -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetImageTransformParameterfvHP", (GLvoid *) NAME(glGetImageTransformParameterfvHP), _gloffset_GetImageTransformParameterfvHP }, - { "glGetImageTransformParameterivHP", (GLvoid *) NAME(glGetImageTransformParameterivHP), _gloffset_GetImageTransformParameterivHP }, - { "glImageTransformParameterfHP", (GLvoid *) NAME(glImageTransformParameterfHP), _gloffset_ImageTransformParameterfHP }, - { "glImageTransformParameterfvHP", (GLvoid *) NAME(glImageTransformParameterfvHP), _gloffset_ImageTransformParameterfvHP }, - { "glImageTransformParameteriHP", (GLvoid *) NAME(glImageTransformParameteriHP), _gloffset_ImageTransformParameteriHP }, - { "glImageTransformParameterivHP", (GLvoid *) NAME(glImageTransformParameterivHP), _gloffset_ImageTransformParameterivHP }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glColorSubTableEXT", (GLvoid *) NAME(glColorSubTableEXT), _gloffset_ColorSubTable }, - { "glCopyColorSubTableEXT", (GLvoid *) NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glHintPGI", (GLvoid *) NAME(glHintPGI), _gloffset_HintPGI }, + { "glHintPGI", NAME(glHintPGI), _gloffset_HintPGI }, #undef NAME /* 78. GL_EXT_paletted_texture */ #ifdef GL_EXT_paletted_texture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glColorTableEXT", (GLvoid *) NAME(glColorTableEXT), _gloffset_ColorTable }, - { "glGetColorTableEXT", (GLvoid *) NAME(glGetColorTableEXT), _gloffset_GetColorTable }, - { "glGetColorTableParameterfvEXT", (GLvoid *) NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv }, - { "glGetColorTableParameterivEXT", (GLvoid *) NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetListParameterfvSGIX", (GLvoid *) NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX }, - { "glGetListParameterivSGIX", (GLvoid *) NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX }, - { "glListParameterfSGIX", (GLvoid *) NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX }, - { "glListParameterfvSGIX", (GLvoid *) NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX }, - { "glListParameteriSGIX", (GLvoid *) NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX }, - { "glListParameterivSGIX", (GLvoid *) NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glIndexMaterialEXT", (GLvoid *) NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, + { "glIndexMaterialEXT", NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, #undef NAME /* 95. GL_EXT_index_func */ #ifdef GL_EXT_index_func -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glIndexFuncEXT", (GLvoid *) NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, + { "glIndexFuncEXT", NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, #undef NAME /* 97. GL_EXT_compiled_vertex_array */ #ifdef GL_EXT_compiled_vertex_array -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glLockArraysEXT", (GLvoid *) NAME(glLockArraysEXT), _gloffset_LockArraysEXT }, - { "glUnlockArraysEXT", (GLvoid *) NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCullParameterfvEXT", (GLvoid *) NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT }, - { "glCullParameterdvEXT", (GLvoid *) NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFragmentColorMaterialSGIX", (GLvoid *) NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX }, - { "glFragmentLightfSGIX", (GLvoid *) NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX }, - { "glFragmentLightfvSGIX", (GLvoid *) NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX }, - { "glFragmentLightiSGIX", (GLvoid *) NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX }, - { "glFragmentLightivSGIX", (GLvoid *) NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX }, - { "glFragmentLightModelfSGIX", (GLvoid *) NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX }, - { "glFragmentLightModelfvSGIX", (GLvoid *) NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX }, - { "glFragmentLightModeliSGIX", (GLvoid *) NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX }, - { "glFragmentLightModelivSGIX", (GLvoid *) NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX }, - { "glFragmentMaterialfSGIX", (GLvoid *) NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX }, - { "glFragmentMaterialfvSGIX", (GLvoid *) NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX }, - { "glFragmentMaterialiSGIX", (GLvoid *) NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX }, - { "glFragmentMaterialivSGIX", (GLvoid *) NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX }, - { "glGetFragmentLightfvSGIX", (GLvoid *) NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX }, - { "glGetFragmentLightivSGIX", (GLvoid *) NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX }, - { "glGetFragmentMaterialfvSGIX", (GLvoid *) NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX }, - { "glGetFragmentMaterialivSGIX", (GLvoid *) NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX }, - { "glLightEnviSGIX", (GLvoid *) NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX }, + { "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 + + /* 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 }, + { "glSecondaryColor4bEXT", NAME(glSecondaryColor4bEXT), _gloffset_SecondaryColor4bEXT }, + { "glSecondaryColor4dEXT", NAME(glSecondaryColor4dEXT), _gloffset_SecondaryColor4dEXT }, + { "glSecondaryColor4fEXT", NAME(glSecondaryColor4fEXT), _gloffset_SecondaryColor4fEXT }, + { "glSecondaryColor4iEXT", NAME(glSecondaryColor4iEXT), _gloffset_SecondaryColor4iEXT }, + { "glSecondaryColor4sEXT", NAME(glSecondaryColor4sEXT), _gloffset_SecondaryColor4sEXT }, + { "glSecondaryColor4ubEXT", NAME(glSecondaryColor4ubEXT), _gloffset_SecondaryColor4ubEXT }, + { "glSecondaryColor4uiEXT", NAME(glSecondaryColor4uiEXT), _gloffset_SecondaryColor4uiEXT }, + { "glSecondaryColor4usEXT", NAME(glSecondaryColor4usEXT), _gloffset_SecondaryColor4usEXT }, + { "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 }, + { "glSecondaryColor4bvEXT", NAME(glSecondaryColor4bvEXT), _gloffset_SecondaryColor4bvEXT }, + { "glSecondaryColor4dvEXT", NAME(glSecondaryColor4dvEXT), _gloffset_SecondaryColor4dvEXT }, + { "glSecondaryColor4fvEXT", NAME(glSecondaryColor4fvEXT), _gloffset_SecondaryColor4fvEXT }, + { "glSecondaryColor4ivEXT", NAME(glSecondaryColor4ivEXT), _gloffset_SecondaryColor4ivEXT }, + { "glSecondaryColor4svEXT", NAME(glSecondaryColor4svEXT), _gloffset_SecondaryColor4svEXT }, + { "glSecondaryColor4ubvEXT", NAME(glSecondaryColor4ubvEXT), _gloffset_SecondaryColor4ubvEXT }, + { "glSecondaryColor4uivEXT", NAME(glSecondaryColor4uivEXT), _gloffset_SecondaryColor4uivEXT }, + { "glSecondaryColor4usvEXT", NAME(glSecondaryColor4usvEXT), _gloffset_SecondaryColor4usvEXT }, + { "glSecondaryColorPointerEXT", NAME(glSecondaryColorPointerEXT), _gloffset_SecondaryColorPointerEXT }, +#undef NAME + + /* 147. GL_EXT_texture_perturb_normal */ +#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 + + /* 148. GL_EXT_multi_draw_arrays */ +#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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFogCoordfEXT", (GLvoid *) NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, - { "glFogCoordfvEXT", (GLvoid *) NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, - { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoordPointerEXT", (GLvoid *) NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, + { "glFogCoordfEXT", NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, + { "glFogCoordfvEXT", NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, + { "glFogCoorddEXT", NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, + { "glFogCoorddEXT", NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, + { "glFogCoordPointerEXT", NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, #undef NAME +#if 000 + /* 156. GL_EXT_coordinate_frame */ +#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 + + /* 164. GL_SUN_global_alpha */ +#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 + + /* 165. GL_SUN_triangle_list */ +#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 + + /* 166. GL_SUN_vertex */ +#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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glBlendFuncSeparateEXT", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, - { "glBlendFuncSeparateINGR", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glVertexWeightfEXT", (GLvoid *) NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT }, - { "glVertexWeightfvEXT", (GLvoid *) NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT }, - { "glVertexWeightPointerEXT", (GLvoid *) NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFlushVertexArrayRangeNV", (GLvoid *) NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV }, - { "glVertexArrayRangeNV", (GLvoid *) NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCombinerParameterfvNV", (GLvoid *) NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV }, - { "glCombinerParameterfNV", (GLvoid *) NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV }, - { "glCombinerParameterivNV", (GLvoid *) NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV }, - { "glCombinerParameteriNV", (GLvoid *) NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV }, - { "glCombinerInputNV", (GLvoid *) NAME(glCombinerInputNV), _gloffset_CombinerInputNV }, - { "glCombinerOutputNV", (GLvoid *) NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV }, - { "glFinalCombinerInputNV", (GLvoid *) NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV }, - { "glGetCombinerInputParameterfvNV", (GLvoid *) NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV }, - { "glGetCombinerInputParameterivNV", (GLvoid *) NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV }, - { "glGetCombinerOutputParameterfvNV", (GLvoid *) NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV }, - { "glGetCombinerOutputParameterivNV", (GLvoid *) NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV }, - { "glGetFinalCombinerInputParameterfvNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV }, - { "glGetFinalCombinerInputParameterivNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV }, + { "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) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glResizeBuffersMESA", (GLvoid *) NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, + { "glResizeBuffersMESA", NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, #undef NAME /* 197. GL_MESA_window_pos */ #ifdef MESA_window_pos -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glWindowPos4fMESA", (GLvoid *) NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, + { "glWindowPos4fMESA", NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, #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 */ }; + + +/* + * Return dispatch table offset of the named static (built-in) function. + * Return -1 if function not found. + */ +static GLint +get_static_proc_offset(const char *funcName) +{ + GLuint i; + for (i = 0; static_functions[i].Name; i++) { + if (strcmp(static_functions[i].Name, funcName) == 0) { + return static_functions[i].Offset; + } + } + return -1; +} + + +/* + * Return dispatch function address the named static (built-in) function. + * Return NULL if function not found. + */ +static GLvoid * +get_static_proc_address(const char *funcName) +{ + GLint i = get_static_proc_offset(funcName); + if (i >= 0) + return static_functions[i].Address; + else + return NULL; +} + + + +/********************************************************************** + * Extension function management. + */ + + +#define MAX_EXTENSION_FUNCS 1000 + +static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; +static GLuint NumExtEntryPoints = 0; + + + +/* + * Generate a dispatch function (entrypoint) which jumps through + * the given slot number (offset) in the current dispatch table. + * We need assembly language in order to accomplish this. + */ +static void * +generate_entrypoint(GLuint functionOffset) +{ +#if defined(USE_X86_ASM) + /* + * This x86 code contributed by Josh Vanderhoof. + * + * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax + * 00 01 02 03 04 + * 5: 85 c0 testl %eax,%eax + * 05 06 + * 7: 74 06 je f <entrypoint+0xf> + * 07 08 + * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) + * 09 0a 0b 0c 0d 0e + * f: e8 fc ff ff ff call __glapi_get_dispatch + * 0f 10 11 12 13 + * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) + * 14 15 16 17 18 19 + */ + static const unsigned char temp[] = { + 0xa1, 0x00, 0x00, 0x00, 0x00, + 0x85, 0xc0, + 0x74, 0x06, + 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, + 0xe8, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 + }; + unsigned char *code = malloc(sizeof(temp)); + unsigned int next_insn; + if (code) { + memcpy(code, temp, sizeof(temp)); + + *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; + *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; + next_insn = (unsigned int)(code + 0x14); + *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; + *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; + } + return code; +#else + return NULL; +#endif +} + + + +/* + * Add a new extension function entrypoint. + * Return: GL_TRUE = success or GL_FALSE = failure + */ +GLboolean +_glapi_add_entrypoint(const char *funcName, GLuint offset) +{ + /* first check if the named function is already statically present */ + { + GLint index = get_static_proc_offset(funcName); + if (index >= 0) { + return (GLboolean) (index == offset); /* bad offset! */ + } + } + + { + /* 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 */ + if (ExtEntryTable[i].Offset == offset) { + return GL_TRUE; /* offsets match */ + } + 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++; + + if (offset > MaxDispatchOffset) + MaxDispatchOffset = offset; + + return GL_TRUE; /* success */ + } + } + + /* should never get here, but play it safe */ + 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. + */ +GLint +_glapi_get_proc_offset(const char *funcName) +{ + /* search extension functions first */ + GLint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + return ExtEntryTable[i].Offset; + } + } + + /* search static functions */ + return get_static_proc_offset(funcName); +} + + + +/* + * Return entrypoint for named function. + */ +const GLvoid * +_glapi_get_proc_address(const char *funcName) +{ + /* search extension functions first */ + GLint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + return ExtEntryTable[i].Address; + } + } + + /* search static functions */ + return get_static_proc_address(funcName); +} + + + + +/* + * Return the name of the function at the given dispatch offset. + * This is only intended for debugging. + */ +const char * +_glapi_get_proc_name(GLuint offset) +{ + const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); + GLuint i; + for (i = 0; i < n; i++) { + if (static_functions[i].Offset == offset) + return static_functions[i].Name; + } + + /* search added extension functions */ + for (i = 0; i < NumExtEntryPoints; i++) { + if (ExtEntryTable[i].Offset == offset) { + return ExtEntryTable[i].Name; + } + } + return NULL; +} + + + +/* + * Make sure there are no NULL pointers in the given dispatch table. + * Intented for debugging purposes. + */ +void +_glapi_check_table(const struct _glapi_table *table) +{ + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } + +#ifdef DEBUG + /* Do some spot checks to be sure that the dispatch table + * slots are assigned correctly. + */ + { + GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); + char *BeginFunc = (char*) &table->Begin; + GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); + assert(BeginOffset == _gloffset_Begin); + assert(BeginOffset == offset); + } + { + GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); + char *viewportFunc = (char*) &table->Viewport; + GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); + assert(viewportOffset == _gloffset_Viewport); + assert(viewportOffset == offset); + } + { + GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); + char *VertexPointerFunc = (char*) &table->VertexPointer; + GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); + assert(VertexPointerOffset == _gloffset_VertexPointer); + assert(VertexPointerOffset == offset); + } + { + GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); + char *ResetMinMaxFunc = (char*) &table->ResetMinmax; + GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); + assert(ResetMinMaxOffset == _gloffset_ResetMinmax); + assert(ResetMinMaxOffset == offset); + } + { + GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); + char *blendColorFunc = (char*) &table->BlendColor; + GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); + assert(blendColorOffset == _gloffset_BlendColor); + assert(blendColorOffset == offset); + } + { + GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); + char *istextureFunc = (char*) &table->IsTextureEXT; + GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); + assert(istextureOffset == _gloffset_IsTextureEXT); + assert(istextureOffset == offset); + } +#endif +} + + + + diff --git a/xc/extras/Mesa/src/glapioffsets.h b/xc/extras/Mesa/src/glapioffsets.h index 67481c8e0..b05d49e6f 100644 --- a/xc/extras/Mesa/src/glapioffsets.h +++ b/xc/extras/Mesa/src/glapioffsets.h @@ -1,4 +1,4 @@ -/* DO NOT EDIT - This file generated automatically */ +/* DO NOT EDIT - This file generated automatically by gloffsets.py script */ #ifndef _GLAPI_OFFSETS_H_ #define _GLAPI_OFFSETS_H_ @@ -555,5 +555,13 @@ #define _gloffset_GetColorTableEXT 550 #define _gloffset_GetColorTableParameterivEXT 551 #define _gloffset_GetColorTableParameterfvEXT 552 +#define _gloffset_TbufferMask3DFX 553 +#define _gloffset_CompressedTexImage3DARB 554 +#define _gloffset_CompressedTexImage2DARB 555 +#define _gloffset_CompressedTexImage1DARB 556 +#define _gloffset_CompressedTexSubImage3DARB 557 +#define _gloffset_CompressedTexSubImage2DARB 558 +#define _gloffset_CompressedTexSubImage1DARB 559 +#define _gloffset_GetCompressedTexImageARB 560 #endif diff --git a/xc/extras/Mesa/src/glapitable.h b/xc/extras/Mesa/src/glapitable.h index 9e5d121dd..94690afb2 100644 --- a/xc/extras/Mesa/src/glapitable.h +++ b/xc/extras/Mesa/src/glapitable.h @@ -1,4 +1,4 @@ -/* DO NOT EDIT - This file generated automatically */ +/* DO NOT EDIT - This file generated automatically with gltable.py script */ #ifndef _GLAPI_TABLE_H_ #define _GLAPI_TABLE_H_ @@ -443,7 +443,7 @@ struct _glapi_table void (*PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ void (*GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ void (*GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ - void (*TexImage4DSGIS)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ + void (*TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ void (*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); /* 438 */ GLboolean (*AreTexturesResidentEXT)(GLsizei n, const GLenum * textures, GLboolean * residences); /* 439 */ void (*GenTexturesEXT)(GLsizei n, GLenum * textures); /* 440 */ @@ -559,6 +559,14 @@ struct _glapi_table void (*GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ void (*GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ void (*GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ + void (*TbufferMask3DFX)(GLuint mask); /* 553 */ + void (*CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ + void (*CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ + void (*CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ + void (*CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ + void (*CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ + void (*CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ + void (*GetCompressedTexImageARB)(GLenum target, GLint level, void * img); /* 560 */ }; #endif diff --git a/xc/extras/Mesa/src/glapitemp.h b/xc/extras/Mesa/src/glapitemp.h index 7b940def6..b1b443e44 100644 --- a/xc/extras/Mesa/src/glapitemp.h +++ b/xc/extras/Mesa/src/glapitemp.h @@ -1978,180 +1978,6 @@ KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalfor -/* ARB 0. GL_ARB_multitexture */ - -KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) -{ - DISPATCH(ActiveTextureARB, (texture), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) -{ - DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) -{ - DISPATCH(MultiTexCoord1dARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord1dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) -{ - DISPATCH(MultiTexCoord1fARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord1fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) -{ - DISPATCH(MultiTexCoord1iARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord1ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) -{ - DISPATCH(MultiTexCoord1sARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord1svARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) -{ - DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord2dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) -{ - DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord2fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) -{ - DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord2ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) -{ - DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord2svARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) -{ - DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord3dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) -{ - DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord3fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) -{ - DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord3ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) -{ - DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord3svARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) -{ - DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord4dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) -{ - DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord4fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) -{ - DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord4ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) -{ - DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); -} - - - /*** *** Extension functions ***/ @@ -2448,7 +2274,7 @@ KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum target, GLint /* 16. GL_SGIS_texture4D */ -KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels) +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) { DISPATCH(TexImage4DSGIS, (target, level, internalFormat, width, height, depth, extent, border, format, type, pixels), (F, ";")); } @@ -2624,6 +2450,16 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum target, const GLfloat *p DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum target, GLfloat param) +{ + DISPATCH(PointParameterfEXT, (target, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum target, const GLfloat *param) +{ + DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); +} + /* 55. GL_SGIX_instruments */ @@ -2816,7 +2652,6 @@ KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLfloat ref) /* 97. GL_EXT_compiled_vertex_array */ - KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) { DISPATCH(LockArraysEXT, (first, count), (F, ";")); @@ -2933,6 +2768,112 @@ KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) } +/* 112. GL_EXT_draw_range_elements */ +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, %u %u %d 0x%x %p);", mode, start, end, count, type, indices)); +} + + +/* 117. GL_EXT_light_texture */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(ApplyTextureEXT)(GLenum mode) +{ + DISPATCH(ApplyTextureEXT, (mode), (F, "glApplyTextureEXT(0x%x);", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureLightEXT)(GLenum pname) +{ + DISPATCH(TextureLightEXT, (pname), (F, "glTextureLightEXT(0x%x);", pname)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureMaterialEXT)(GLenum face, GLenum mode) +{ + DISPATCH(TextureMaterialEXT, (face, mode), (F, "glTextureMaterialEXT(0x%x, 0x%x);", face, mode)); +} +#endif + + + +/* 135. GL_INTEL_texture_scissor */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(TexScissorINTEL)(GLenum target, GLclampf tlow, GLclampf thigh) +{ + DISPATCH(TexScissorINTEL, (target, tlow, thigh), (F, "glTexScissorINTEL(0x%x %g %g);", target, tlow, thigh)); +} + +KEYWORD1 void KEYWORD2 NAME(TexScissorFuncINTEL)(GLenum target, GLenum lfunc, GLenum hfunc) +{ + DISPATCH(TexScissorFuncINTEL, (target, lfunc, hfunc), (F, "glTexScissorFuncINTEL(0x%x 0x%x 0x%x);", target, tlow, thigh)); +} +#endif + + + +/* 136. GL_INTEL_parallel_arrays */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(VertexPointervINTEL)(GLint size, GLenum type, const void ** pointer) +{ + DISPATCH(VertexPointervINTEL, (size, type, pointer), (F, "glVertexPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(NormalPointervINTEL)(GLenum type, const void** pointer) +{ + DISPATCH(NormalPointervINTEL, (size, pointer), (F, "glNormalPointervINTEL(%d, %p);", size, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(ColorPointervINTEL, (size, type, pointer), (F, "glColorPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoordPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(TexCoordPointervINTEL, (size, type, pointer), (F, "glTexCoordPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} +#endif + + +/* 138. GL_EXT_pixel_transform */ +#if 0 +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameteriEXT)(GLenum target, GLenum pname, const GLint param) +{ + DISPATCH(PixelTransformParameteriEXT, (target, pname, param), (F, "glPixelTransformParameteriEXT(0x%x, 0x%x, %d);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfEXT)(GLenum target, GLenum pname, const GLfloat param) +{ + DISPATCH(PixelTransformParameterfEXT, (target, pname, param), (F, "glPixelTransformParameterfEXT(0x%x, 0x%x, %f);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(PixelTransformParameterivEXT, (target, pname, params), (F, "glPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(PixelTransformParameterfvEXT, (target, pname, params), (F, "glPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(GetPixelTransformParameterivEXT, (target, pname, params), (F, "glGetPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(GetPixelTransformParameterfvEXT, (target, pname, params), (F, "glGetPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} +#endif + + + +/* 145. GL_EXT_secondary_color */ +/* XXX todo */ + + + /* 149. GL_EXT_fog_coord */ KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) { @@ -3080,7 +3021,6 @@ KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) /* 197. GL_MESA_window_pos */ - KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) { DISPATCH(WindowPos2iMESA, (x, y), (F, ";")); @@ -3202,8 +3142,201 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble *p) } +/* 208. GL_3DFX_tbuffer */ +KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) +{ + DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(0x%x);", mask)); +} + + +/* 209. WGL_EXT_multisample */ + +KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) +{ + DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) +{ + DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); +} + + +/* ARB 1. GL_ARB_multitexture */ + +KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) +{ + DISPATCH(ActiveTextureARB, (texture), (F, ";")); +} -/* ARB 2. GL_ARB_transpose_matrix */ +KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) +{ + DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) +{ + DISPATCH(MultiTexCoord1dARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord1dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) +{ + DISPATCH(MultiTexCoord1fARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord1fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) +{ + DISPATCH(MultiTexCoord1iARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord1ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) +{ + DISPATCH(MultiTexCoord1sARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord1svARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) +{ + DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord2dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) +{ + DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord2fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) +{ + DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord2ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) +{ + DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord2svARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord3dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord3fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) +{ + DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord3ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) +{ + DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord3svARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord4dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord4fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord4ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); +} + + + +/* ARB 3. GL_ARB_transpose_matrix */ KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16]) { DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixARB(%p);", m)); @@ -3225,13 +3358,13 @@ KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16]) } -/* ARB 4. GL_ARB_multisample */ + +/* ARB 5. GL_ARB_multisample */ KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) { DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);", value, invert)); } - KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) { DISPATCH(SamplePassARB, (pass), (F, "glSamplePassARB(0x%x);", pass)); @@ -3239,6 +3372,44 @@ KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) +/* ARB 12. GL_ARB_texture_compression */ +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(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB();")); +} + +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(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB();")); +} + +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(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint lod, GLvoid *img) +{ + DISPATCH(GetCompressedTexImageARB, (target, lod, img), (F, "glGetCompressedTexImageARB();")); +} + + + #undef KEYWORD1 #undef KEYWORD2 #undef NAME diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h index 4789ec7a3..00748699d 100644 --- a/xc/extras/Mesa/src/glheader.h +++ b/xc/extras/Mesa/src/glheader.h @@ -51,6 +51,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#if defined(__linux__) && defined(__i386__) +#include <fpu_control.h> +#endif #endif #include <float.h> @@ -59,16 +62,104 @@ #include "conf.h" #endif +/* Make sure we include glext.h */ #include "GL/gl.h" #include "GL/glext.h" + /* * Put compiler/OS/assembly pragmas and macros here to avoid * cluttering other source files. */ + +/* + * XXX move as many of these pragma's and MS Windows-isms into + * the new src/glheader.h file. + */ + +#if defined(_WIN32) && !defined(__WIN32__) +# define __WIN32__ +#endif + +#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) +# pragma warning( disable : 4068 ) /* unknown pragma */ +# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ +# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ +# pragma warning( disable : 4127 ) /* conditional expression is constant */ +# if defined(MESA_MINWARN) +# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ +# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ +# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ +# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ +# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ +# endif +# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# define WGLAPI __declspec(dllexport) +# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# define WGLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# define WGLAPI __declspec(dllimport) +# endif /* _STATIC_MESA support */ +# define GLAPIENTRY __stdcall +# define GLAPIENTRYP __stdcall * +# define GLCALLBACK __stdcall +# define GLCALLBACKP __stdcall * +# if defined(__CYGWIN__) +# define GLCALLBACKPCAST * +# else +# define GLCALLBACKPCAST __stdcall * +# endif +# define GLWINAPI __stdcall +# define GLWINAPIV __cdecl +#else +/* non-Windows compilation */ +# define GLAPI extern +# define GLAPIENTRY +# define GLAPIENTRYP * +# define GLCALLBACK +# define GLCALLBACKP * +# define GLCALLBACKPCAST * +# define GLWINAPI +# define GLWINAPIV +#endif /* WIN32 / CYGWIN bracket */ + +/* compatability guard so we don't need to change client code */ + +#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) +# define CALLBACK GLCALLBACK +typedef int (GLAPIENTRY *PROC)(); +typedef void *HGLRC; +typedef void *HDC; +typedef unsigned long COLORREF; +#endif + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +# define WGL_FONT_LINES 0 +# define WGL_FONT_POLYGONS 1 +#ifndef _GNU_H_WINDOWS32_FUNCTIONS +# ifdef UNICODE +# define wglUseFontBitmaps wglUseFontBitmapsW +# define wglUseFontOutlines wglUseFontOutlinesW +# else +# define wglUseFontBitmaps wglUseFontBitmapsA +# define wglUseFontOutlines wglUseFontOutlinesA +# endif /* !UNICODE */ +#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ +typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; +typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; +typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; +#include <gl/mesa_wgl.h> +#endif + + + + /* Disable unreachable code warnings for Watcom C++ */ #ifdef __WATCOMC__ #pragma disable_message(201) diff --git a/xc/extras/Mesa/src/hint.c b/xc/extras/Mesa/src/hint.c index 210138d2b..6537bd004 100644 --- a/xc/extras/Mesa/src/hint.c +++ b/xc/extras/Mesa/src/hint.c @@ -52,78 +52,94 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode); + if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { + gl_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); + return GL_FALSE; + } + switch (target) { - case GL_FOG_HINT: - ctx->Hint.Fog = mode; - break; - case GL_LINE_SMOOTH_HINT: - ctx->Hint.LineSmooth = mode; - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - ctx->Hint.PerspectiveCorrection = mode; - break; - case GL_POINT_SMOOTH_HINT: - ctx->Hint.PointSmooth = mode; - break; - case GL_POLYGON_SMOOTH_HINT: - ctx->Hint.PolygonSmooth = mode; - break; - case GL_PREFER_DOUBLEBUFFER_HINT_PGI: - case GL_STRICT_DEPTHFUNC_HINT_PGI: - break; - case GL_STRICT_LIGHTING_HINT_PGI: - ctx->Hint.StrictLighting = mode; - break; - case GL_STRICT_SCISSOR_HINT_PGI: - case GL_FULL_STIPPLE_HINT_PGI: - case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI: - case GL_NATIVE_GRAPHICS_END_HINT_PGI: - case GL_CONSERVE_MEMORY_HINT_PGI: - case GL_RECLAIM_MEMORY_HINT_PGI: - break; - case GL_ALWAYS_FAST_HINT_PGI: - if (mode) { - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_FALSE; - ctx->Hint.AllowDrawMem = GL_FALSE; - } else { - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; - ctx->Hint.AllowDrawMem = GL_TRUE; - } - break; - case GL_ALWAYS_SOFT_HINT_PGI: - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; - ctx->Hint.AllowDrawMem = GL_TRUE; - break; - case GL_ALLOW_DRAW_OBJ_HINT_PGI: - break; - case GL_ALLOW_DRAW_WIN_HINT_PGI: - ctx->Hint.AllowDrawWin = mode; - break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - ctx->Hint.AllowDrawSpn = mode; - break; - case GL_ALLOW_DRAW_MEM_HINT_PGI: - ctx->Hint.AllowDrawMem = mode; - break; - case GL_CLIP_NEAR_HINT_PGI: - case GL_CLIP_FAR_HINT_PGI: - case GL_WIDE_LINE_HINT_PGI: - case GL_BACK_NORMALS_HINT_PGI: - case GL_NATIVE_GRAPHICS_HANDLE_PGI: - break; + case GL_FOG_HINT: + ctx->Hint.Fog = mode; + break; + case GL_LINE_SMOOTH_HINT: + ctx->Hint.LineSmooth = mode; + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + ctx->Hint.PerspectiveCorrection = mode; + break; + case GL_POINT_SMOOTH_HINT: + ctx->Hint.PointSmooth = mode; + break; + case GL_POLYGON_SMOOTH_HINT: + ctx->Hint.PolygonSmooth = mode; + break; + case GL_PREFER_DOUBLEBUFFER_HINT_PGI: + case GL_STRICT_DEPTHFUNC_HINT_PGI: + break; + case GL_STRICT_LIGHTING_HINT_PGI: + ctx->Hint.StrictLighting = mode; + break; + case GL_STRICT_SCISSOR_HINT_PGI: + case GL_FULL_STIPPLE_HINT_PGI: + case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI: + case GL_NATIVE_GRAPHICS_END_HINT_PGI: + case GL_CONSERVE_MEMORY_HINT_PGI: + case GL_RECLAIM_MEMORY_HINT_PGI: + break; + case GL_ALWAYS_FAST_HINT_PGI: + if (mode) { + ctx->Hint.AllowDrawWin = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_FALSE; + ctx->Hint.AllowDrawMem = GL_FALSE; + } else { + ctx->Hint.AllowDrawWin = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; + ctx->Hint.AllowDrawMem = GL_TRUE; + } + break; + case GL_ALWAYS_SOFT_HINT_PGI: + ctx->Hint.AllowDrawWin = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; + ctx->Hint.AllowDrawMem = GL_TRUE; + break; + case GL_ALLOW_DRAW_OBJ_HINT_PGI: + break; + case GL_ALLOW_DRAW_WIN_HINT_PGI: + ctx->Hint.AllowDrawWin = mode; + break; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + ctx->Hint.AllowDrawFrg = mode; + break; + case GL_ALLOW_DRAW_MEM_HINT_PGI: + ctx->Hint.AllowDrawMem = mode; + break; + case GL_CLIP_NEAR_HINT_PGI: + case GL_CLIP_FAR_HINT_PGI: + case GL_WIDE_LINE_HINT_PGI: + case GL_BACK_NORMALS_HINT_PGI: + case GL_NATIVE_GRAPHICS_HANDLE_PGI: + break; /* GL_EXT_clip_volume_hint */ - case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: - ctx->Hint.ClipVolumeClipping = mode; - break; + case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + ctx->Hint.ClipVolumeClipping = mode; + break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" ); - return GL_FALSE; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + ctx->Hint.TextureCompression = mode; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + } + break; + + default: + gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return GL_FALSE; } + ctx->NewState |= NEW_ALL; /* just to be safe */ if (ctx->Driver.Hint) { @@ -143,6 +159,11 @@ _mesa_HintPGI( GLenum target, GLint mode ) if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target), mode); + if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { + gl_error(ctx, GL_INVALID_ENUM, "glHintPGI(mode)"); + return; + } + switch (target) { case GL_PREFER_DOUBLEBUFFER_HINT_PGI: case GL_STRICT_DEPTHFUNC_HINT_PGI: @@ -157,7 +178,7 @@ _mesa_HintPGI( GLenum target, GLint mode ) case GL_ALWAYS_SOFT_HINT_PGI: case GL_ALLOW_DRAW_OBJ_HINT_PGI: case GL_ALLOW_DRAW_WIN_HINT_PGI: - case GL_ALLOW_DRAW_SPN_HINT_PGI: + case GL_ALLOW_DRAW_FRG_HINT_PGI: case GL_ALLOW_DRAW_MEM_HINT_PGI: case GL_CLIP_NEAR_HINT_PGI: case GL_CLIP_FAR_HINT_PGI: diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index 16c8d4921..825ce7ed5 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -30,6 +30,7 @@ #include "glheader.h" #include "context.h" #include "image.h" +#include "imaging.h" #include "macros.h" #include "mem.h" #include "mmath.h" @@ -46,7 +47,7 @@ * from within display lists we have to be sure to set the current * unpacking params to these values! */ -struct gl_pixelstore_attrib _mesa_native_packing = { +const struct gl_pixelstore_attrib _mesa_native_packing = { 1, /* Alignment */ 0, /* RowLength */ 0, /* SkipPixels */ @@ -62,7 +63,8 @@ struct gl_pixelstore_attrib _mesa_native_packing = { /* * Flip the 8 bits in each byte of the given array. */ -void gl_flip_bytes( GLubyte *p, GLuint n ) +static void +flip_bytes( GLubyte *p, GLuint n ) { register GLuint i, a, b; @@ -84,7 +86,8 @@ void gl_flip_bytes( GLubyte *p, GLuint n ) /* * Flip the order of the 2 bytes in each word in the given array. */ -void gl_swap2( GLushort *p, GLuint n ) +void +_mesa_swap2( GLushort *p, GLuint n ) { register GLuint i; @@ -98,7 +101,8 @@ void gl_swap2( GLushort *p, GLuint n ) /* * Flip the order of the 4 bytes in each word in the given array. */ -void gl_swap4( GLuint *p, GLuint n ) +void +_mesa_swap4( GLuint *p, GLuint n ) { register GLuint i, a, b; @@ -120,7 +124,7 @@ void gl_swap4( GLuint *p, GLuint n ) * Return 0 if GL_BITMAP. * Return -1 if invalid type enum. */ -GLint gl_sizeof_type( GLenum type ) +GLint _mesa_sizeof_type( GLenum type ) { switch (type) { case GL_BITMAP: @@ -146,10 +150,10 @@ GLint gl_sizeof_type( GLenum type ) /* - * Same as gl_sizeof_packed_type() but we also accept the + * Same as _mesa_sizeof_packed_type() but we also accept the * packed pixel format datatypes. */ -GLint gl_sizeof_packed_type( GLenum type ) +GLint _mesa_sizeof_packed_type( GLenum type ) { switch (type) { case GL_BITMAP: @@ -203,7 +207,7 @@ GLint gl_sizeof_packed_type( GLenum type ) * Return the number of components in a GL enum pixel type. * Return -1 if bad format. */ -GLint gl_components_in_format( GLenum format ) +GLint _mesa_components_in_format( GLenum format ) { switch (format) { case GL_COLOR_INDEX: @@ -220,6 +224,7 @@ GLint gl_components_in_format( GLenum format ) case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: return 1; case GL_LUMINANCE_ALPHA: return 2; @@ -243,9 +248,9 @@ GLint gl_components_in_format( GLenum format ) * Return bytes per pixel for given format and type * Return -1 if bad format or type. */ -GLint gl_bytes_per_pixel( GLenum format, GLenum type ) +GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) { - GLint comps = gl_components_in_format( format ); + GLint comps = _mesa_components_in_format( format ); if (comps < 0) return -1; @@ -301,7 +306,8 @@ GLint gl_bytes_per_pixel( GLenum format, GLenum type ) * Test if the given pixel format and type are legal. * Return GL_TRUE for legal, GL_FALSE for illegal. */ -GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ) +GLboolean +_mesa_is_legal_format_and_type( GLenum format, GLenum type ) { switch (format) { case GL_COLOR_INDEX: @@ -399,10 +405,11 @@ GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ) * row, column - location of pixel in the image * Return: address of pixel at (image,row,column) in image or NULL if error. */ -GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, - const GLvoid *image, GLsizei width, - GLsizei height, GLenum format, GLenum type, - GLint img, GLint row, GLint column ) +GLvoid * +_mesa_image_address( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, GLsizei width, + GLsizei height, GLenum format, GLenum type, + GLint img, GLint row, GLint column ) { GLint alignment; /* 1, 2 or 4 */ GLint pixels_per_row; @@ -437,13 +444,13 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, GLint bytes_per_image; /* Compute bytes per component */ - bytes_per_comp = gl_sizeof_packed_type( type ); + bytes_per_comp = _mesa_sizeof_packed_type( type ); if (bytes_per_comp<0) { return NULL; } /* Compute number of components per pixel */ - comp_per_pixel = gl_components_in_format( format ); + comp_per_pixel = _mesa_components_in_format( format ); if (comp_per_pixel<0 && type != GL_BITMAP) { return NULL; } @@ -462,7 +469,7 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, /* Non-BITMAP data */ GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; - bytes_per_pixel = gl_bytes_per_pixel( format, type ); + bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); /* The pixel type and format should have been error checked earlier */ assert(bytes_per_pixel > 0); @@ -489,25 +496,69 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, /* - * Unpack a 32x32 pixel polygon stipple from user memory using the - * current pixel unpack settings. + * Compute the stride between image rows (in bytes) for the given + * pixel packing parameters and image width, format and type. */ -void gl_unpack_polygon_stipple( const GLcontext *ctx, - const GLubyte *pattern, GLuint dest[32] ) +GLint +_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLenum format, GLenum type ) { - GLint i; - for (i = 0; i < 32; i++) { - GLubyte *src = (GLubyte *) gl_pixel_addr_in_image( &ctx->Unpack, pattern, - 32, 32, GL_COLOR_INDEX, GL_BITMAP, 0, i, 0 ); - dest[i] = (src[0] << 24) - | (src[1] << 16) - | (src[2] << 8) - | (src[3] ); + ASSERT(packing); + if (type == GL_BITMAP) { + /* BITMAP data */ + if (packing->RowLength == 0) { + GLint bytes = (width + 7) / 8; + return bytes; + } + else { + GLint bytes = (packing->RowLength + 7) / 8; + return bytes; + } } + else { + /* Non-BITMAP data */ + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + GLint bytesPerRow, 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); + return bytesPerRow; + } +} + + - /* Bit flipping within each byte */ - if (ctx->Unpack.LsbFirst) { - gl_flip_bytes( (GLubyte *) dest, 32 * 4 ); +/* + * Unpack a 32x32 pixel polygon stipple from user memory using the + * current pixel unpack settings. + */ +void +_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], + const struct gl_pixelstore_attrib *unpacking ) +{ + GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking ); + if (ptrn) { + /* Convert pattern from GLubytes to GLuints and handle big/little + * endian differences + */ + GLubyte *p = ptrn; + GLint i; + for (i = 0; i < 32; i++) { + dest[i] = (p[0] << 24) + | (p[1] << 16) + | (p[2] << 8) + | (p[3] ); + p += 4; + } + FREE(ptrn); } } @@ -517,24 +568,23 @@ void gl_unpack_polygon_stipple( const GLcontext *ctx, * Pack polygon stipple into user memory given current pixel packing * settings. */ -void gl_pack_polygon_stipple( const GLcontext *ctx, - const GLuint pattern[32], - GLubyte *dest ) +void +_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, + const struct gl_pixelstore_attrib *packing ) { + /* Convert pattern from GLuints to GLubytes to handle big/little + * endian differences. + */ + GLubyte ptrn[32*4]; GLint i; for (i = 0; i < 32; i++) { - GLubyte *dst = (GLubyte *) gl_pixel_addr_in_image( &ctx->Pack, dest, - 32, 32, GL_COLOR_INDEX, GL_BITMAP, 0, i, 0 ); - dst[0] = (pattern[i] >> 24) & 0xff; - dst[1] = (pattern[i] >> 16) & 0xff; - dst[2] = (pattern[i] >> 8) & 0xff; - dst[3] = (pattern[i] ) & 0xff; - - /* Bit flipping within each byte */ - if (ctx->Pack.LsbFirst) { - gl_flip_bytes( (GLubyte *) dst, 4 ); - } + ptrn[i * 4 + 0] = (GLubyte) ((pattern[i] >> 24) & 0xff); + ptrn[i * 4 + 1] = (GLubyte) ((pattern[i] >> 16) & 0xff); + ptrn[i * 4 + 2] = (GLubyte) ((pattern[i] >> 8 ) & 0xff); + ptrn[i * 4 + 3] = (GLubyte) ((pattern[i] ) & 0xff); } + + _mesa_pack_bitmap(32, 32, ptrn, dest, packing); } @@ -554,66 +604,100 @@ void gl_pack_polygon_stipple( const GLcontext *ctx, * packing - pixel packing parameters * applyTransferOps - apply scale/bias/lookup-table ops? */ -void gl_pack_rgba_span( const GLcontext *ctx, - GLuint n, CONST GLubyte rgba[][4], - GLenum format, GLenum type, GLvoid *destination, - const struct gl_pixelstore_attrib *packing, - GLboolean applyTransferOps ) +void +_mesa_pack_rgba_span( GLcontext *ctx, + GLuint n, CONST GLubyte srcRgba[][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing, + GLboolean applyTransferOps ) { - applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag); + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* Test for optimized case first */ if (!applyTransferOps && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { /* common simple case */ - MEMCPY( destination, rgba, n * 4 * sizeof(GLubyte) ); + MEMCPY( destination, srcRgba, n * 4 * sizeof(GLubyte) ); } else if (!applyTransferOps && format == GL_RGB && type == GL_UNSIGNED_BYTE) { /* common simple case */ GLint i; GLubyte *dest = (GLubyte *) destination; for (i = 0; i < n; i++) { - dest[0] = rgba[i][RCOMP]; - dest[1] = rgba[i][GCOMP]; - dest[2] = rgba[i][BCOMP]; + dest[0] = srcRgba[i][RCOMP]; + dest[1] = srcRgba[i][GCOMP]; + dest[2] = srcRgba[i][BCOMP]; dest += 3; } } else { /* general solution */ - GLfloat red[MAX_WIDTH], green[MAX_WIDTH], blue[MAX_WIDTH]; - GLfloat alpha[MAX_WIDTH], luminance[MAX_WIDTH]; + GLfloat rgba[MAX_WIDTH][4], luminance[MAX_WIDTH]; const GLfloat rscale = 1.0F / 255.0F; const GLfloat gscale = 1.0F / 255.0F; const GLfloat bscale = 1.0F / 255.0F; const GLfloat ascale = 1.0F / 255.0F; - const GLint comps = gl_components_in_format(format); + const GLint comps = _mesa_components_in_format(format); GLuint i; assert(n <= MAX_WIDTH); /* convert color components to floating point */ for (i=0;i<n;i++) { - red[i] = rgba[i][RCOMP] * rscale; - green[i] = rgba[i][GCOMP] * gscale; - blue[i] = rgba[i][BCOMP] * bscale; - alpha[i] = rgba[i][ACOMP] * ascale; + rgba[i][RCOMP] = srcRgba[i][RCOMP] * rscale; + rgba[i][GCOMP] = srcRgba[i][GCOMP] * gscale; + rgba[i][BCOMP] = srcRgba[i][BCOMP] * bscale; + rgba[i][ACOMP] = srcRgba[i][ACOMP] * ascale; } /* * Apply scale, bias and lookup-tables if enabled. */ if (applyTransferOps) { + /* scale & bias */ if (ctx->Pixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_color( ctx, n, red, green, blue, alpha ); + _mesa_scale_and_bias_rgba( ctx, n, rgba ); } + /* color map lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_color( ctx, n, red, green, blue, alpha ); + _mesa_map_rgba( ctx, n, rgba ); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + if (ctx->MinMax.Sink) + return; } } if (format==GL_LUMINANCE || format==GL_LUMINANCE_ALPHA) { for (i=0;i<n;i++) { - GLfloat sum = red[i] + green[i] + blue[i]; + GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; luminance[i] = CLAMP( sum, 0.0F, 1.0F ); } } @@ -628,19 +712,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(red[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(green[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(blue[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(alpha[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -649,49 +733,49 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(red[i]); - dst[i*3+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*3+2] = FLOAT_TO_UBYTE(blue[i]); + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(red[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(blue[i]); - dst[i*3+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*3+2] = FLOAT_TO_UBYTE(red[i]); + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(red[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(alpha[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(red[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } } break; @@ -701,19 +785,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(red[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(green[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(blue[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(alpha[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -722,48 +806,48 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_BYTE(alpha[i]); + dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(red[i]); - dst[i*3+1] = FLOAT_TO_BYTE(green[i]); - dst[i*3+2] = FLOAT_TO_BYTE(blue[i]); + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(red[i]); - dst[i*4+1] = FLOAT_TO_BYTE(green[i]); - dst[i*4+2] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+3] = FLOAT_TO_BYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(blue[i]); - dst[i*3+1] = FLOAT_TO_BYTE(green[i]); - dst[i*3+2] = FLOAT_TO_BYTE(red[i]); + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+1] = FLOAT_TO_BYTE(green[i]); - dst[i*4+2] = FLOAT_TO_BYTE(red[i]); - dst[i*4+3] = FLOAT_TO_BYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(alpha[i]); - dst[i*4+1] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+2] = FLOAT_TO_BYTE(green[i]); - dst[i*4+3] = FLOAT_TO_BYTE(red[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } } break; @@ -773,19 +857,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(red[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(green[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(blue[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(alpha[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -794,52 +878,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_USHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_USHORT(alpha[i]); + dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(red[i]); - dst[i*3+1] = FLOAT_TO_USHORT(green[i]); - dst[i*3+2] = FLOAT_TO_USHORT(blue[i]); + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(red[i]); - dst[i*4+1] = FLOAT_TO_USHORT(green[i]); - dst[i*4+2] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+3] = FLOAT_TO_USHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(blue[i]); - dst[i*3+1] = FLOAT_TO_USHORT(green[i]); - dst[i*3+2] = FLOAT_TO_USHORT(red[i]); + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+1] = FLOAT_TO_USHORT(green[i]); - dst[i*4+2] = FLOAT_TO_USHORT(red[i]); - dst[i*4+3] = FLOAT_TO_USHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(alpha[i]); - dst[i*4+1] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+2] = FLOAT_TO_USHORT(green[i]); - dst[i*4+3] = FLOAT_TO_USHORT(red[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, n * comps); + _mesa_swap2( (GLushort *) dst, n * comps); } } break; @@ -849,19 +933,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(red[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(green[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(blue[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(alpha[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -870,51 +954,51 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_SHORT(alpha[i]); + dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(red[i]); - dst[i*3+1] = FLOAT_TO_SHORT(green[i]); - dst[i*3+2] = FLOAT_TO_SHORT(blue[i]); + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(red[i]); - dst[i*4+1] = FLOAT_TO_SHORT(green[i]); - dst[i*4+2] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+3] = FLOAT_TO_SHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(blue[i]); - dst[i*3+1] = FLOAT_TO_SHORT(green[i]); - dst[i*3+2] = FLOAT_TO_SHORT(red[i]); + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+1] = FLOAT_TO_SHORT(green[i]); - dst[i*4+2] = FLOAT_TO_SHORT(red[i]); - dst[i*4+3] = FLOAT_TO_SHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(alpha[i]); - dst[i*4+1] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+2] = FLOAT_TO_SHORT(green[i]); - dst[i*4+3] = FLOAT_TO_SHORT(red[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, n * comps ); + _mesa_swap2( (GLushort *) dst, n * comps ); } } break; @@ -924,19 +1008,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(red[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(green[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(blue[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(alpha[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -945,52 +1029,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_UINT(luminance[i]); - dst[i*2+1] = FLOAT_TO_UINT(alpha[i]); + dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(red[i]); - dst[i*3+1] = FLOAT_TO_UINT(green[i]); - dst[i*3+2] = FLOAT_TO_UINT(blue[i]); + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(red[i]); - dst[i*4+1] = FLOAT_TO_UINT(green[i]); - dst[i*4+2] = FLOAT_TO_UINT(blue[i]); - dst[i*4+3] = FLOAT_TO_UINT(alpha[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(blue[i]); - dst[i*3+1] = FLOAT_TO_UINT(green[i]); - dst[i*3+2] = FLOAT_TO_UINT(red[i]); + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(blue[i]); - dst[i*4+1] = FLOAT_TO_UINT(green[i]); - dst[i*4+2] = FLOAT_TO_UINT(red[i]); - dst[i*4+3] = FLOAT_TO_UINT(alpha[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(alpha[i]); - dst[i*4+1] = FLOAT_TO_UINT(blue[i]); - dst[i*4+2] = FLOAT_TO_UINT(green[i]); - dst[i*4+3] = FLOAT_TO_UINT(red[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, n * comps ); + _mesa_swap4( (GLuint *) dst, n * comps ); } } break; @@ -1000,19 +1084,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(red[i]); + dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(green[i]); + dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(blue[i]); + dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(alpha[i]); + dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -1021,52 +1105,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_INT(luminance[i]); - dst[i*2+1] = FLOAT_TO_INT(alpha[i]); + dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(red[i]); - dst[i*3+1] = FLOAT_TO_INT(green[i]); - dst[i*3+2] = FLOAT_TO_INT(blue[i]); + dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(red[i]); - dst[i*4+1] = FLOAT_TO_INT(green[i]); - dst[i*4+2] = FLOAT_TO_INT(blue[i]); - dst[i*4+3] = FLOAT_TO_INT(alpha[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(blue[i]); - dst[i*3+1] = FLOAT_TO_INT(green[i]); - dst[i*3+2] = FLOAT_TO_INT(red[i]); + dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(blue[i]); - dst[i*4+1] = FLOAT_TO_INT(green[i]); - dst[i*4+2] = FLOAT_TO_INT(red[i]); - dst[i*4+3] = FLOAT_TO_INT(alpha[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(alpha[i]); - dst[i*4+1] = FLOAT_TO_INT(blue[i]); - dst[i*4+2] = FLOAT_TO_INT(green[i]); - dst[i*4+3] = FLOAT_TO_INT(red[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, n * comps ); + _mesa_swap4( (GLuint *) dst, n * comps ); } } break; @@ -1076,19 +1160,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = red[i]; + dst[i] = rgba[i][RCOMP]; break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = green[i]; + dst[i] = rgba[i][GCOMP]; break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = blue[i]; + dst[i] = rgba[i][BCOMP]; break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = alpha[i]; + dst[i] = rgba[i][ACOMP]; break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -1097,52 +1181,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = luminance[i]; - dst[i*2+1] = alpha[i]; + dst[i*2+1] = rgba[i][ACOMP]; } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = red[i]; - dst[i*3+1] = green[i]; - dst[i*3+2] = blue[i]; + dst[i*3+0] = rgba[i][RCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][BCOMP]; } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = red[i]; - dst[i*4+1] = green[i]; - dst[i*4+2] = blue[i]; - dst[i*4+3] = alpha[i]; + dst[i*4+0] = rgba[i][RCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][BCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = blue[i]; - dst[i*3+1] = green[i]; - dst[i*3+2] = red[i]; + dst[i*3+0] = rgba[i][BCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][RCOMP]; } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = blue[i]; - dst[i*4+1] = green[i]; - dst[i*4+2] = red[i]; - dst[i*4+3] = alpha[i]; + dst[i*4+0] = rgba[i][BCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][RCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = alpha[i]; - dst[i*4+1] = blue[i]; - dst[i*4+2] = green[i]; - dst[i*4+3] = red[i]; + dst[i*4+0] = rgba[i][ACOMP]; + dst[i*4+1] = rgba[i][BCOMP]; + dst[i*4+2] = rgba[i][GCOMP]; + dst[i*4+3] = rgba[i][RCOMP]; } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, n * comps ); + _mesa_swap4( (GLuint *) dst, n * comps ); } } break; @@ -1150,9 +1234,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 7.0F)) << 5) - | (((GLint) (green[i] * 7.0F)) << 2) - | (((GLint) (blue[i] * 3.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) ); } } break; @@ -1160,9 +1244,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 7.0F)) ) - | (((GLint) (green[i] * 7.0F)) << 3) - | (((GLint) (blue[i] * 3.0F)) << 5); + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5); } } break; @@ -1170,9 +1254,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) << 11) - | (((GLint) (green[i] * 63.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) ); } } break; @@ -1180,9 +1264,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) ) - | (((GLint) (green[i] * 63.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) << 11); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11); } } break; @@ -1190,10 +1274,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 15.0F)) << 12) - | (((GLint) (green[i] * 15.0F)) << 8) - | (((GLint) (blue[i] * 15.0F)) << 4) - | (((GLint) (alpha[i] * 15.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); } } break; @@ -1201,10 +1285,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 15.0F)) ) - | (((GLint) (green[i] * 15.0F)) << 4) - | (((GLint) (blue[i] * 15.0F)) << 8) - | (((GLint) (alpha[i] * 15.0F)) << 12); + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); } } break; @@ -1212,10 +1296,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) << 11) - | (((GLint) (green[i] * 31.0F)) << 6) - | (((GLint) (blue[i] * 31.0F)) << 1) - | (((GLint) (alpha[i] * 1.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 1) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); } } break; @@ -1223,10 +1307,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) ) - | (((GLint) (green[i] * 31.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) << 10) - | (((GLint) (alpha[i] * 1.0F)) << 15); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); } } break; @@ -1234,28 +1318,28 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 255.0F)) << 24) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (blue[i] * 255.0F)) << 8) - | (((GLuint) (alpha[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 255.0F)) << 24) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (red[i] * 255.0F)) << 8) - | (((GLuint) (alpha[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 255.0F)) << 24) - | (((GLuint) (blue[i] * 255.0F)) << 16) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (red[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) ); } } break; @@ -1263,28 +1347,28 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 255.0F)) ) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (blue[i] * 255.0F)) << 16) - | (((GLuint) (alpha[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 255.0F)) ) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (red[i] * 255.0F)) << 16) - | (((GLuint) (alpha[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 255.0F)) ) - | (((GLuint) (blue[i] * 255.0F)) << 8) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (red[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24); } } break; @@ -1292,28 +1376,28 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 1023.0F)) << 22) - | (((GLuint) (green[i] * 1023.0F)) << 12) - | (((GLuint) (blue[i] * 1023.0F)) << 2) - | (((GLuint) (alpha[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 1023.0F)) << 22) - | (((GLuint) (green[i] * 1023.0F)) << 12) - | (((GLuint) (red[i] * 1023.0F)) << 2) - | (((GLuint) (alpha[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 1023.0F)) << 22) - | (((GLuint) (blue[i] * 1023.0F)) << 12) - | (((GLuint) (green[i] * 1023.0F)) << 2) - | (((GLuint) (red[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) ); } } break; @@ -1321,38 +1405,39 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 1023.0F)) ) - | (((GLuint) (green[i] * 1023.0F)) << 10) - | (((GLuint) (blue[i] * 1023.0F)) << 20) - | (((GLuint) (alpha[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 1023.0F)) ) - | (((GLuint) (green[i] * 1023.0F)) << 10) - | (((GLuint) (red[i] * 1023.0F)) << 20) - | (((GLuint) (alpha[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 1023.0F)) ) - | (((GLuint) (blue[i] * 1023.0F)) << 10) - | (((GLuint) (green[i] * 1023.0F)) << 20) - | (((GLuint) (red[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) << 30); } } break; default: - gl_problem( ctx, "bad type in gl_pack_rgba_span" ); + gl_problem( ctx, "bad type in _mesa_pack_rgba_span" ); } } } + #define SWAP2BYTE(VALUE) \ { \ GLubyte *bytes = (GLubyte *) &(VALUE); \ @@ -1515,12 +1600,12 @@ extract_uint_indexes(GLuint n, GLuint indexes[], for (i = 0; i < n; i++) { GLfloat value = s[i]; SWAP4BYTE(value); - indexes[i] = value; + indexes[i] = (GLuint) value; } } else { for (i = 0; i < n; i++) - indexes[i] = s[i]; + indexes[i] = (GLuint) s[i]; } } break; @@ -2056,7 +2141,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], * XXX perhaps expand this to process whole images someday. */ void -_mesa_unpack_ubyte_color_span( const GLcontext *ctx, +_mesa_unpack_ubyte_color_span( GLcontext *ctx, GLuint n, GLenum dstFormat, GLubyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -2106,12 +2191,17 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, srcType == GL_UNSIGNED_INT_10_10_10_2 || srcType == GL_UNSIGNED_INT_2_10_10_10_REV); - /* this is intended for RGBA mode */ + /* this is intended for RGBA mode only */ assert(ctx->Visual->RGBAflag); applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag || - ctx->Pixel.MapColorFlag); + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* Try simple cases first */ if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) { @@ -2155,7 +2245,7 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } } else if (dstFormat == srcFormat) { - GLint comps = gl_components_in_format(srcFormat); + GLint comps = _mesa_components_in_format(srcFormat); assert(comps > 0); MEMCPY( dest, source, n * comps * sizeof(GLubyte) ); return; @@ -2163,14 +2253,14 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } + /* general solution begins here */ { - /* general solution */ GLfloat rgba[MAX_WIDTH][4]; GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstLuminanceIndex, dstIntensityIndex; - dstComponents = gl_components_in_format( dstFormat ); + dstComponents = _mesa_components_in_format( dstFormat ); /* source & dest image formats should have been error checked by now */ assert(dstComponents > 0); @@ -2183,32 +2273,26 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, extract_uint_indexes(n, indexes, srcFormat, srcType, source, unpacking); - /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); - - if (dstFormat == GL_COLOR_INDEX) { - if (applyTransferOps) { - if (ctx->Pixel.MapColorFlag) { - /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); - } - - if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { - - } + if (applyTransferOps) { + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci(ctx, n, indexes); + } + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_ci(ctx, n, indexes); } + } + if (dstFormat == GL_COLOR_INDEX) { /* convert to GLubyte and return */ - { - GLuint i; - for (i = 0; i < n; i++) { - dest[i] = (GLubyte) (indexes[i] & 0xff); - } + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLubyte) (indexes[i] & 0xff); } + return; } else { /* Convert indexes to RGBA */ - gl_map_ci_to_rgba_float(ctx, n, indexes, rgba); + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); } } else { @@ -2217,23 +2301,41 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, if (applyTransferOps) { /* scale and bias colors */ - gl_scale_and_bias_rgba_float(ctx, n, rgba); - - /* color table lookup */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, n, rgba); + } + /* color map lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_rgba_float(ctx, n, rgba); + _mesa_map_rgba(ctx, n, rgba); } } } - - /* - * XXX This is where more color table lookups, convolution, - * histograms, minmax, color matrix, etc would take place if - * implemented. - * See figure 3.7 in the OpenGL 1.2 specification for more info. - */ - + if (applyTransferOps) { + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + } /* clamp to [0,1] */ { @@ -2353,6 +2455,270 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } +void +_mesa_unpack_float_color_span( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *unpacking, + GLboolean applyTransferOps, GLboolean clamp ) +{ + ASSERT(dstFormat == GL_ALPHA || + dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE_ALPHA || + dstFormat == GL_INTENSITY || + dstFormat == GL_RGB || + dstFormat == GL_RGBA || + dstFormat == GL_COLOR_INDEX); + + ASSERT(srcFormat == GL_RED || + srcFormat == GL_GREEN || + srcFormat == GL_BLUE || + srcFormat == GL_ALPHA || + srcFormat == GL_LUMINANCE || + srcFormat == GL_LUMINANCE_ALPHA || + srcFormat == GL_INTENSITY || + srcFormat == GL_RGB || + srcFormat == GL_BGR || + srcFormat == GL_RGBA || + srcFormat == GL_BGRA || + srcFormat == GL_ABGR_EXT || + srcFormat == GL_COLOR_INDEX); + + ASSERT(srcType == GL_BITMAP || + srcType == GL_UNSIGNED_BYTE || + srcType == GL_BYTE || + srcType == GL_UNSIGNED_SHORT || + srcType == GL_SHORT || + srcType == GL_UNSIGNED_INT || + srcType == GL_INT || + srcType == GL_FLOAT || + srcType == GL_UNSIGNED_BYTE_3_3_2 || + srcType == GL_UNSIGNED_BYTE_2_3_3_REV || + srcType == GL_UNSIGNED_SHORT_5_6_5 || + srcType == GL_UNSIGNED_SHORT_5_6_5_REV || + srcType == GL_UNSIGNED_SHORT_4_4_4_4 || + srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || + srcType == GL_UNSIGNED_SHORT_5_5_5_1 || + srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || + srcType == GL_UNSIGNED_INT_8_8_8_8 || + srcType == GL_UNSIGNED_INT_8_8_8_8_REV || + srcType == GL_UNSIGNED_INT_10_10_10_2 || + srcType == GL_UNSIGNED_INT_2_10_10_10_REV); + + /* this is intended for RGBA mode only */ + assert(ctx->Visual->RGBAflag); + + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); + + /* general solution, no special cases, yet */ + { + GLfloat rgba[MAX_WIDTH][4]; + GLint dstComponents; + GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; + GLint dstLuminanceIndex, dstIntensityIndex; + + dstComponents = _mesa_components_in_format( dstFormat ); + /* source & dest image formats should have been error checked by now */ + assert(dstComponents > 0); + + /* + * Extract image data and convert to RGBA floats + */ + assert(n <= MAX_WIDTH); + if (srcFormat == GL_COLOR_INDEX) { + GLuint indexes[MAX_WIDTH]; + extract_uint_indexes(n, indexes, srcFormat, srcType, source, + unpacking); + + if (applyTransferOps) { + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci(ctx, n, indexes); + } + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + } + + if (dstFormat == GL_COLOR_INDEX) { + /* convert to GLubyte and return */ + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLubyte) (indexes[i] & 0xff); + } + return; + } + else { + /* Convert indexes to RGBA */ + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); + } + } + else { + extract_float_rgba(n, rgba, srcFormat, srcType, source, + unpacking->SwapBytes); + + if (applyTransferOps) { + /* scale and bias colors */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, n, rgba); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba(ctx, n, rgba); + } + } + } + + if (applyTransferOps) { + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + } + + /* clamp to [0,1] */ + if (clamp) { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); + rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); + rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); + } + } + + /* Now determine which color channels we need to produce. + * And determine the dest index (offset) within each color tuple. + */ + switch (dstFormat) { + case GL_ALPHA: + dstAlphaIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_LUMINANCE: + dstLuminanceIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstIntensityIndex = -1; + break; + case GL_LUMINANCE_ALPHA: + dstLuminanceIndex = 0; + dstAlphaIndex = 1; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstIntensityIndex = -1; + break; + case GL_INTENSITY: + dstIntensityIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstLuminanceIndex = -1; + break; + case GL_RGB: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RGBA: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = 3; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + default: + gl_problem(ctx, "bad dstFormat in _mesa_unpack_float_span()"); + return; + } + + /* Now pack results in teh requested dstFormat */ + if (dstRedIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstRedIndex] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + + if (dstGreenIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstGreenIndex] = rgba[i][GCOMP]; + dst += dstComponents; + } + } + + if (dstBlueIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstBlueIndex] = rgba[i][BCOMP]; + dst += dstComponents; + } + } + + if (dstAlphaIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstAlphaIndex] = rgba[i][ACOMP]; + dst += dstComponents; + } + } + + if (dstIntensityIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstIntensityIndex == 0); + assert(dstComponents == 1); + for (i = 0; i < n; i++) { + /* Intensity comes from red channel */ + dst[i] = rgba[i][RCOMP]; + } + } + + if (dstLuminanceIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstLuminanceIndex == 0); + for (i = 0; i < n; i++) { + /* Luminance comes from red channel */ + dst[0] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + } +} + + + /* * Unpack a row of color index data from a client buffer according to @@ -2415,12 +2781,11 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } - if (ctx->Pixel.MapColorFlag) { /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); + _mesa_map_ci(ctx, n, indexes); } } @@ -2515,7 +2880,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } if (ctx->Pixel.MapStencilFlag) { @@ -2643,9 +3008,10 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest, /* clamp depth values to [0,1] and convert from floats to integers */ { + const GLfloat zs = ctx->Visual->DepthMaxF; GLuint i; for (i = 0; i < n; i++) { - dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * DEPTH_SCALE); + dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * zs); } } @@ -2679,8 +3045,8 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, compsPerRow = 0; } else { - const GLint bytesPerPixel = gl_bytes_per_pixel(format, type); - const GLint components = gl_components_in_format(format); + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + const GLint components = _mesa_components_in_format(format); GLint bytesPerComp; if (bytesPerPixel <= 0 || components <= 0) return NULL; /* bad format or type. generate error later */ @@ -2703,18 +3069,18 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, dst = destBuffer; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(unpack, pixels, + const GLvoid *src = _mesa_image_address(unpack, pixels, width, height, format, type, img, row, 0); MEMCPY(dst, src, bytesPerRow); /* byte flipping/swapping */ if (flipBytes) { - gl_flip_bytes((GLubyte *) dst, bytesPerRow); + flip_bytes((GLubyte *) dst, bytesPerRow); } else if (swap2) { - gl_swap2((GLushort*) dst, compsPerRow); + _mesa_swap2((GLushort*) dst, compsPerRow); } else if (swap4) { - gl_swap4((GLuint*) dst, compsPerRow); + _mesa_swap4((GLuint*) dst, compsPerRow); } dst += bytesPerRow; } @@ -2748,9 +3114,9 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, width_in_bytes = CEILING( width, 8 ); dst = buffer; for (row = 0; row < height; row++) { - GLubyte *src = gl_pixel_addr_in_image( packing, pixels, width, height, - GL_COLOR_INDEX, GL_BITMAP, - 0, row, 0 ); + GLubyte *src = _mesa_image_address( packing, pixels, width, height, + GL_COLOR_INDEX, GL_BITMAP, + 0, row, 0 ); if (!src) { FREE(buffer); return NULL; @@ -2759,7 +3125,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, if (packing->SkipPixels == 0) { MEMCPY( dst, src, width_in_bytes ); if (packing->LsbFirst) { - gl_flip_bytes( dst, width_in_bytes ); + flip_bytes( dst, width_in_bytes ); } } else { @@ -2825,3 +3191,94 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, return buffer; } + + +/* + * Pack bitmap data. + */ +void +_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, + GLubyte *dest, const struct gl_pixelstore_attrib *packing ) +{ + GLint row, width_in_bytes; + const GLubyte *src; + + if (!source) + return; + + width_in_bytes = CEILING( width, 8 ); + src = source; + for (row = 0; row < height; row++) { + GLubyte *dst = _mesa_image_address( packing, dest, width, height, + GL_COLOR_INDEX, GL_BITMAP, + 0, row, 0 ); + if (!dst) + return; + + if (packing->SkipPixels == 0) { + MEMCPY( dst, src, width_in_bytes ); + if (packing->LsbFirst) { + flip_bytes( dst, width_in_bytes ); + } + } + else { + /* handling SkipPixels is a bit tricky (no pun intended!) */ + GLint i; + if (packing->LsbFirst) { + GLubyte srcMask = 1 << (packing->SkipPixels & 0x7); + GLubyte dstMask = 128; + const GLubyte *s = src; + GLubyte *d = dst; + *d = 0; + for (i = 0; i < width; i++) { + if (*s & srcMask) { + *d |= dstMask; + } + if (srcMask == 128) { + srcMask = 1; + s++; + } + else { + srcMask = srcMask << 1; + } + if (dstMask == 1) { + dstMask = 128; + d++; + *d = 0; + } + else { + dstMask = dstMask >> 1; + } + } + } + else { + GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7); + GLubyte dstMask = 128; + const GLubyte *s = src; + GLubyte *d = dst; + *d = 0; + for (i = 0; i < width; i++) { + if (*s & srcMask) { + *d |= dstMask; + } + if (srcMask == 1) { + srcMask = 128; + s++; + } + else { + srcMask = srcMask >> 1; + } + if (dstMask == 1) { + dstMask = 128; + d++; + *d = 0; + } + else { + dstMask = dstMask >> 1; + } + } + } + } + src += width_in_bytes; + } +} diff --git a/xc/extras/Mesa/src/image.h b/xc/extras/Mesa/src/image.h index 84f104422..65c12c53c 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.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -31,57 +31,63 @@ #include "types.h" -extern struct gl_pixelstore_attrib _mesa_native_packing; +extern const struct gl_pixelstore_attrib _mesa_native_packing; -extern void gl_flip_bytes( GLubyte *p, GLuint n ); +extern void +_mesa_swap2( GLushort *p, GLuint n ); +extern void +_mesa_swap4( GLuint *p, GLuint n ); -extern void gl_swap2( GLushort *p, GLuint n ); +extern GLint +_mesa_sizeof_type( GLenum type ); -extern void gl_swap4( GLuint *p, GLuint n ); +extern GLint +_mesa_sizeof_packed_type( GLenum type ); +extern GLint +_mesa_components_in_format( GLenum format ); -extern GLint gl_sizeof_type( GLenum type ); +extern GLint +_mesa_bytes_per_pixel( GLenum format, GLenum type ); -extern GLint gl_sizeof_packed_type( GLenum type ); +extern GLboolean +_mesa_is_legal_format_and_type( GLenum format, GLenum type ); -extern GLint gl_components_in_format( GLenum format ); -extern GLint gl_bytes_per_pixel( GLenum format, GLenum type ); +extern GLvoid * +_mesa_image_address( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, GLsizei width, + GLsizei height, GLenum format, GLenum type, + GLint img, GLint row, GLint column ); -extern GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ); - -extern GLvoid * -gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, - const GLvoid *image, GLsizei width, - GLsizei height, GLenum format, GLenum type, - GLint img, GLint row, GLint column ); +extern GLint +_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLenum format, GLenum type ); extern void -gl_unpack_polygon_stipple( const GLcontext *ctx, - const GLubyte *pattern, - GLuint dest[32] ); +_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], + const struct gl_pixelstore_attrib *unpacking ); extern void -gl_pack_polygon_stipple( const GLcontext *ctx, - const GLuint pattern[32], - GLubyte *dest ); +_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, + const struct gl_pixelstore_attrib *packing ); extern void -gl_pack_rgba_span( const GLcontext *ctx, - GLuint n, CONST GLubyte rgba[][4], - GLenum format, GLenum type, GLvoid *dest, - const struct gl_pixelstore_attrib *packing, - GLboolean applyTransferOps ); +_mesa_pack_rgba_span( GLcontext *ctx, + GLuint n, CONST GLubyte rgba[][4], + GLenum format, GLenum type, GLvoid *dest, + const struct gl_pixelstore_attrib *packing, + GLboolean applyTransferOps ); extern void -_mesa_unpack_ubyte_color_span( const GLcontext *ctx, +_mesa_unpack_ubyte_color_span( GLcontext *ctx, GLuint n, GLenum dstFormat, GLubyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -90,6 +96,15 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, extern void +_mesa_unpack_float_color_span( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *unpacking, + GLboolean applyTransferOps, GLboolean clamp ); + + +extern void _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, @@ -122,5 +137,9 @@ extern GLvoid * _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, const struct gl_pixelstore_attrib *packing ); +extern void +_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, + GLubyte *dest, const struct gl_pixelstore_attrib *packing ); + #endif diff --git a/xc/extras/Mesa/src/imaging.c b/xc/extras/Mesa/src/imaging.c index f1d912b6d..1dd37112d 100644 --- a/xc/extras/Mesa/src/imaging.c +++ b/xc/extras/Mesa/src/imaging.c @@ -24,327 +24,1594 @@ */ -/* Stub functions for GL_ARB_imaging subset */ +/* + * Histogram, Min/max and convolution for GL_ARB_imaging subset + * + */ #ifdef PC_HEADER #include "all.h" #else #include "glheader.h" +#include "context.h" +#include "image.h" #include "imaging.h" +#include "mmath.h" +#include "span.h" #endif -#define WARNING(MSG) fprintf(stderr,"Mesa warning: GL_ARB_imaging functions not implemented\n") +/**********************************************************************/ +/**** Histogram and Min/max *****/ +/**********************************************************************/ - -#if 0 -void _mesa_BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) +static void +pack_histogram( GLcontext *ctx, + GLuint n, CONST GLuint rgba[][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing ) { - (void) r; - (void) g; - (void) b; - (void) a; - WARNING("glBlendColor"); -} + const GLint comps = _mesa_components_in_format(format); + GLuint luminance[MAX_WIDTH]; -void _mesa_BlendEquation(GLenum eq) -{ - (void) eq; - WARNING("glBlendEquation"); + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { + GLuint i; + for (i = 0; i < n; i++) { + luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + } + } + +#define PACK_MACRO(TYPE) \ + { \ + GLuint i; \ + switch (format) { \ + case GL_RED: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][RCOMP]; \ + break; \ + case GL_GREEN: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][GCOMP]; \ + break; \ + case GL_BLUE: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][BCOMP]; \ + break; \ + case GL_ALPHA: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][ACOMP]; \ + break; \ + case GL_LUMINANCE: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) luminance[i]; \ + break; \ + case GL_LUMINANCE_ALPHA: \ + for (i=0;i<n;i++) { \ + dst[i*2+0] = (TYPE) luminance[i]; \ + dst[i*2+1] = (TYPE) rgba[i][ACOMP]; \ + } \ + break; \ + case GL_RGB: \ + for (i=0;i<n;i++) { \ + dst[i*3+0] = (TYPE) rgba[i][RCOMP]; \ + dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*3+2] = (TYPE) rgba[i][BCOMP]; \ + } \ + break; \ + case GL_RGBA: \ + for (i=0;i<n;i++) { \ + dst[i*4+0] = (TYPE) rgba[i][RCOMP]; \ + dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*4+2] = (TYPE) rgba[i][BCOMP]; \ + dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \ + } \ + break; \ + case GL_BGR: \ + for (i=0;i<n;i++) { \ + dst[i*3+0] = (TYPE) rgba[i][BCOMP]; \ + dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*3+2] = (TYPE) rgba[i][RCOMP]; \ + } \ + break; \ + case GL_BGRA: \ + for (i=0;i<n;i++) { \ + dst[i*4+0] = (TYPE) rgba[i][BCOMP]; \ + dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*4+2] = (TYPE) rgba[i][RCOMP]; \ + dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \ + } \ + break; \ + case GL_ABGR_EXT: \ + for (i=0;i<n;i++) { \ + dst[i*4+0] = (TYPE) rgba[i][ACOMP]; \ + dst[i*4+1] = (TYPE) rgba[i][BCOMP]; \ + dst[i*4+2] = (TYPE) rgba[i][GCOMP]; \ + dst[i*4+3] = (TYPE) rgba[i][RCOMP]; \ + } \ + break; \ + default: \ + gl_problem(ctx, "bad format in pack_histogram"); \ + } \ + } + + switch (type) { + case GL_UNSIGNED_BYTE: + { + GLubyte *dst = (GLubyte *) destination; + PACK_MACRO(GLubyte); + } + break; + case GL_BYTE: + { + GLbyte *dst = (GLbyte *) destination; + PACK_MACRO(GLbyte); + } + break; + case GL_UNSIGNED_SHORT: + { + GLushort *dst = (GLushort *) destination; + PACK_MACRO(GLushort); + if (packing->SwapBytes) { + _mesa_swap2(dst, n * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) destination; + PACK_MACRO(GLshort); + if (packing->SwapBytes) { + _mesa_swap2((GLushort *) dst, n * comps); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) destination; + PACK_MACRO(GLuint); + if (packing->SwapBytes) { + _mesa_swap4(dst, n * comps); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) destination; + PACK_MACRO(GLint); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, n * comps); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) destination; + PACK_MACRO(GLfloat); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, n * comps); + } + } + break; + default: + gl_problem(ctx, "Bad type in pack_histogram"); + } + +#undef PACK_MACRO } -void _mesa_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) + + +static void +pack_minmax( GLcontext *ctx, CONST GLfloat minmax[2][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing ) { - (void) target; - (void) start; - (void) count; - (void) format; - (void) type; - (void) data; - WARNING("glColorSubTable"); + const GLint comps = _mesa_components_in_format(format); + GLuint luminance[2]; + + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { + luminance[0] = minmax[0][RCOMP] + minmax[0][GCOMP] + minmax[0][BCOMP]; + luminance[1] = minmax[1][RCOMP] + minmax[1][GCOMP] + minmax[1][BCOMP]; + } + +#define PACK_MACRO(TYPE, CONVERSION) \ + { \ + GLuint i; \ + switch (format) { \ + case GL_RED: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][RCOMP]); \ + break; \ + case GL_GREEN: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][GCOMP]); \ + break; \ + case GL_BLUE: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][BCOMP]); \ + break; \ + case GL_ALPHA: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][ACOMP]); \ + break; \ + case GL_LUMINANCE: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (luminance[i]); \ + break; \ + case GL_LUMINANCE_ALPHA: \ + for (i=0;i<2;i++) { \ + dst[i*2+0] = CONVERSION (luminance[i]); \ + dst[i*2+1] = CONVERSION (minmax[i][ACOMP]); \ + } \ + break; \ + case GL_RGB: \ + for (i=0;i<2;i++) { \ + dst[i*3+0] = CONVERSION (minmax[i][RCOMP]); \ + dst[i*3+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*3+2] = CONVERSION (minmax[i][BCOMP]); \ + } \ + break; \ + case GL_RGBA: \ + for (i=0;i<2;i++) { \ + dst[i*4+0] = CONVERSION (minmax[i][RCOMP]); \ + dst[i*4+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*4+2] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*4+3] = CONVERSION (minmax[i][ACOMP]); \ + } \ + break; \ + case GL_BGR: \ + for (i=0;i<2;i++) { \ + dst[i*3+0] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*3+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*3+2] = CONVERSION (minmax[i][RCOMP]); \ + } \ + break; \ + case GL_BGRA: \ + for (i=0;i<2;i++) { \ + dst[i*4+0] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*4+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*4+2] = CONVERSION (minmax[i][RCOMP]); \ + dst[i*4+3] = CONVERSION (minmax[i][ACOMP]); \ + } \ + break; \ + case GL_ABGR_EXT: \ + for (i=0;i<2;i++) { \ + dst[i*4+0] = CONVERSION (minmax[i][ACOMP]); \ + dst[i*4+1] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*4+2] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*4+3] = CONVERSION (minmax[i][RCOMP]); \ + } \ + break; \ + default: \ + gl_problem(ctx, "bad format in pack_minmax"); \ + } \ + } + + switch (type) { + case GL_UNSIGNED_BYTE: + { + GLubyte *dst = (GLubyte *) destination; + PACK_MACRO(GLubyte, FLOAT_TO_UBYTE); + } + break; + case GL_BYTE: + { + GLbyte *dst = (GLbyte *) destination; + PACK_MACRO(GLbyte, FLOAT_TO_BYTE); + } + break; + case GL_UNSIGNED_SHORT: + { + GLushort *dst = (GLushort *) destination; + PACK_MACRO(GLushort, FLOAT_TO_USHORT); + if (packing->SwapBytes) { + _mesa_swap2(dst, 2 * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) destination; + PACK_MACRO(GLshort, FLOAT_TO_SHORT); + if (packing->SwapBytes) { + _mesa_swap2((GLushort *) dst, 2 * comps); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) destination; + PACK_MACRO(GLuint, FLOAT_TO_UINT); + if (packing->SwapBytes) { + _mesa_swap4(dst, 2 * comps); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) destination; + PACK_MACRO(GLint, FLOAT_TO_INT); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, 2 * comps); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) destination; + PACK_MACRO(GLfloat, (GLfloat)); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, 2 * comps); + } + } + break; + default: + gl_problem(ctx, "Bad type in pack_minmax"); + } + +#undef PACK_MACRO } -void _mesa_ColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) + +/* + * Given an internalFormat token passed to glHistogram or glMinMax, + * return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_histogram_format( GLenum format ) { - (void) target; - (void) internalformat; - (void) width; - (void) format; - (void) type; - (void) table; - WARNING("glColorTable"); + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return GL_LUMINANCE_ALPHA; + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return GL_RGB; + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return GL_RGBA; + default: + return -1; /* error */ + } } -#endif -void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) + +/* + * Given an internalFormat token passed to glConvolutionFilter + * or glSeparableFilter, return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_filter_format( GLenum format ) { - (void) target; - (void) pname; - (void) params; - WARNING("glColorTableParameterfv"); + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return GL_LUMINANCE_ALPHA; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + return GL_INTENSITY; + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return GL_RGB; + case 4: + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return GL_RGBA; + default: + return -1; /* error */ + } } -void _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) + +void +_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - (void) target; - (void) pname; - (void) params; - WARNING("glColorTableParameteriv"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_RGBA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(format)"); + return; + } + + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)"); + return; + } + + if (!values) + return; + + { + GLfloat minmax[2][4]; + minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F); + minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F); + minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F); + minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F); + minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F); + minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); + minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); + minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); + pack_minmax(ctx, (CONST GLfloat (*)[4]) minmax, + format, type, values, &ctx->Pack); + } + + if (reset) { + _mesa_ResetMinmax(GL_MINMAX); + } } -void _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +void +_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - (void) target; - (void) internalformat; - (void) width; - (void) format; - (void) type; - (void) image; - WARNING("glConvolutionFilter1D"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram"); + + if (target != GL_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_RGBA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)"); + return; + } + + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)"); + return; + } + + if (!values) + return; + + pack_histogram(ctx, ctx->Histogram.Width, + (CONST GLuint (*)[4]) ctx->Histogram.Count, + format, type, values, &ctx->Pack); + + if (reset) { + GLuint i; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + } } -void _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) + +void +_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { - (void) target; - (void) internalformat; - (void) width; - (void) height; - (void) format; - (void) type; - (void) image; - WARNING("glConvolutionFilter2D"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameterfv"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLfloat) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLfloat) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLfloat) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLfloat) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLfloat) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLfloat) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLfloat) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLfloat) ctx->Histogram.Sink; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); + } } -void _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params) + +void +_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameterf"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameteriv"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLint) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLint) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLint) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLint) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLint) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLint) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLint) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLint) ctx->Histogram.Sink; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); + } } -void _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) + +void +_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameterfv"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameterfv"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLfloat) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLfloat) ctx->MinMax.Sink; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); + } } -void _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params) + +void +_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameteri"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameteriv"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLint) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLint) ctx->MinMax.Sink; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); + } } -void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) + +void +_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameteriv"); + GLuint i; + GLboolean error = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHistogram"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); + return; + } + + if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + if (width < 0) + gl_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + else + gl_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); + return; + } + } + + if (width != 0 && _mesa_bitcount(width) != 1) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + gl_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + return; + } + } + + if (base_histogram_format(internalFormat) < 0) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); + return; + } + } + + /* reset histograms */ + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + if (error) { + ctx->Histogram.Width = 0; + ctx->Histogram.Format = 0; + ctx->Histogram.RedSize = 0; + ctx->Histogram.GreenSize = 0; + ctx->Histogram.BlueSize = 0; + ctx->Histogram.AlphaSize = 0; + ctx->Histogram.LuminanceSize = 0; + } + else { + ctx->Histogram.Width = width; + ctx->Histogram.Format = internalFormat; + ctx->Histogram.Sink = sink; + ctx->Histogram.RedSize = 0xffffffff; + ctx->Histogram.GreenSize = 0xffffffff; + ctx->Histogram.BlueSize = 0xffffffff; + ctx->Histogram.AlphaSize = 0xffffffff; + ctx->Histogram.LuminanceSize = 0xffffffff; + } } -void _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) + +void +_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { - (void) target; - (void) start; - (void) x; - (void) y; - (void) width; - WARNING("glCopyColorSubTable"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMinmax"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); + return; + } + + if (base_histogram_format(internalFormat) < 0) { + gl_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); + return; + } + + ctx->MinMax.Sink = sink; } -void _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) + +void +_mesa_ResetHistogram(GLenum target) { - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - WARNING("glCopyColorTable"); + GLuint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetHistogram"); + + if (target != GL_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); + return; + } + + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } } -void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) + +void +_mesa_ResetMinmax(GLenum target) { - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - WARNING("glCopyConvolutionFilter1D"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetMinmax"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); + return; + } + + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; } -void _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) + + +/* + * Update the min/max values from an array of fragment colors. + */ +void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) { - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - (void) height; - WARNING("glCopyConvolutionFilter2D"); + GLuint i; + for (i = 0; i < n; i++) { + /* update mins */ + if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) + ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) + ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) + ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) + ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; + + /* update maxs */ + if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) + ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) + ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) + ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) + ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; + } } -#if 0 -void _mesa_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table) + +/* + * Update the histogram values from an array of fragment colors. + */ +void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) { - (void) target; - (void) format; - (void) type; - (void) table; - WARNING("glGetColorTable"); + const GLint max = ctx->Histogram.Width - 1; + GLfloat w = (GLfloat) max; + GLuint i; + + if (ctx->Histogram.Width == 0) + return; + + for (i = 0; i < n; i++) { + GLint ri = (GLint) (rgba[i][RCOMP] * w + 0.5F); + GLint gi = (GLint) (rgba[i][GCOMP] * w + 0.5F); + GLint bi = (GLint) (rgba[i][BCOMP] * w + 0.5F); + GLint ai = (GLint) (rgba[i][ACOMP] * w + 0.5F); + ri = CLAMP(ri, 0, max); + gi = CLAMP(gi, 0, max); + bi = CLAMP(bi, 0, max); + ai = CLAMP(ai, 0, max); + ctx->Histogram.Count[ri][RCOMP]++; + ctx->Histogram.Count[gi][GCOMP]++; + ctx->Histogram.Count[bi][BCOMP]++; + ctx->Histogram.Count[ai][ACOMP]++; + } } -void _mesa_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) + + +/**********************************************************************/ +/**** Convolution *****/ +/**********************************************************************/ + +void +_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetColorTableParameterfv"); + GLenum baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter1D"); + + if (target != GL_CONVOLUTION_1D) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)"); + return; + } + + ctx->Convolution1D.Format = format; + ctx->Convolution1D.InternalFormat = internalFormat; + ctx->Convolution1D.Width = width; + ctx->Convolution1D.Height = 1; + + /* unpack filter image and apply scale and bias */ + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, + ctx->Convolution1D.Filter, + format, type, image, &ctx->Unpack, + GL_FALSE, GL_FALSE); + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[0]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[0]; + GLint i; + for (i = 0; i < width; i++) { + GLfloat r = ctx->Convolution1D.Filter[i * 4 + 0]; + GLfloat g = ctx->Convolution1D.Filter[i * 4 + 1]; + GLfloat b = ctx->Convolution1D.Filter[i * 4 + 2]; + GLfloat a = ctx->Convolution1D.Filter[i * 4 + 3]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Convolution1D.Filter[i * 4 + 0] = r; + ctx->Convolution1D.Filter[i * 4 + 1] = g; + ctx->Convolution1D.Filter[i * 4 + 2] = b; + ctx->Convolution1D.Filter[i * 4 + 3] = a; + } + } } -void _mesa_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetColorTableParameteriv"); + GLenum baseFormat; + GLint i, components; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter2D"); + + if (target != GL_CONVOLUTION_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + gl_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)"); + return; + } + + components = _mesa_components_in_format(format); + assert(components > 0); /* this should have been caught earlier */ + + ctx->Convolution2D.Format = format; + ctx->Convolution2D.InternalFormat = internalFormat; + ctx->Convolution2D.Width = width; + ctx->Convolution2D.Height = height; + + /* unpack filter image and apply scale and bias */ + for (i = 0; i < height; i++) { + const GLvoid *src = _mesa_image_address(&ctx->Unpack, image, width, + height, format, type, 0, i, 0); + GLfloat *dst = ctx->Convolution2D.Filter + i * width * components; + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst, + format, type, src, &ctx->Unpack, + GL_FALSE, GL_FALSE); + } + + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[1]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[1]; + for (i = 0; i < width * height * 4; i++) { + GLfloat r = ctx->Convolution2D.Filter[i * 4 + 0]; + GLfloat g = ctx->Convolution2D.Filter[i * 4 + 1]; + GLfloat b = ctx->Convolution2D.Filter[i * 4 + 2]; + GLfloat a = ctx->Convolution2D.Filter[i * 4 + 3]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Convolution2D.Filter[i * 4 + 0] = r; + ctx->Convolution2D.Filter[i * 4 + 1] = g; + ctx->Convolution2D.Filter[i * 4 + 2] = b; + ctx->Convolution2D.Filter[i * 4 + 3] = a; + } + } } -#endif -void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) + +void +_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { - (void) target; - (void) format; - (void) type; - (void) image; - WARNING("glGetConvolutionFilter"); + GET_CURRENT_CONTEXT(ctx); + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterf"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_MODE: + if (param == (GLfloat) GL_REDUCE || + param == (GLfloat) GL_CONSTANT_BORDER || + param == (GLfloat) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); + return; + } } -void _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) + +void +_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetConvolutionParameterfv"); + GET_CURRENT_CONTEXT(ctx); + struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterfv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params); + break; + case GL_CONVOLUTION_BORDER_MODE: + if (params[0] == (GLfloat) GL_REDUCE || + params[0] == (GLfloat) GL_CONSTANT_BORDER || + params[0] == (GLfloat) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)"); + return; + } + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); + return; + } } -void _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetConvolutionParameteriv"); + GET_CURRENT_CONTEXT(ctx); + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteri"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_MODE: + if (param == (GLint) GL_REDUCE || + param == (GLint) GL_CONSTANT_BORDER || + param == (GLint) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); + return; + } } -void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) + +void +_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { - (void) target; - (void) reset; - (void) format; - (void) types; - (void) values; - WARNING("glGetMinmax"); + GET_CURRENT_CONTEXT(ctx); + struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteriv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); + ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); + ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); + ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); + break; + case GL_CONVOLUTION_BORDER_MODE: + if (params[0] == (GLint) GL_REDUCE || + params[0] == (GLint) GL_CONSTANT_BORDER || + params[0] == (GLint) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); + return; + } + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); + return; + } } -void _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) + +void +_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { - (void) target; - (void) reset; - (void) format; - (void) type; - (void) values; - WARNING("glGetHistogram"); + GLenum baseFormat; + GLfloat rgba[MAX_CONVOLUTION_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter1D"); + + if (target != GL_CONVOLUTION_1D) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)"); + return; + } + + /* read pixels from framebuffer */ + gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLubyte (*)[4]) rgba); + + /* store as convolution filter */ + _mesa_ConvolutionFilter1D(target, internalFormat, width, + GL_RGBA, GL_UNSIGNED_BYTE, rgba); } -void _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) + +void +_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetHistogramParameterfv"); + GLenum baseFormat; + GLint i; + struct gl_pixelstore_attrib packSave; + GLfloat rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter2D"); + + if (target != GL_CONVOLUTION_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)"); + return; + } + + /* read pixels from framebuffer */ + for (i = 0; i < height; i++) { + gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i, + (GLubyte (*)[4]) rgba[i]); + } + + /* + * store as convolution filter + */ + packSave = ctx->Unpack; /* save pixel packing params */ + + ctx->Unpack.Alignment = 1; + ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH; + ctx->Unpack.SkipPixels = 0; + ctx->Unpack.SkipRows = 0; + ctx->Unpack.ImageHeight = 0; + ctx->Unpack.SkipImages = 0; + ctx->Unpack.SwapBytes = GL_FALSE; + ctx->Unpack.LsbFirst = GL_FALSE; + + _mesa_ConvolutionFilter2D(target, internalFormat, width, height, + GL_RGBA, GL_UNSIGNED_BYTE, rgba); + + ctx->Unpack = packSave; /* restore pixel packing params */ } -void _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetHistogramParameteriv"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionFilter"); + + if (target != GL_CONVOLUTION_1D && target != GL_CONVOLUTION_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); + return; + } + + (void) image; + /* XXX store image */ } -void _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) + +void +_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetMinmaxParameterfv"); + GET_CURRENT_CONTEXT(ctx); + const struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameterfv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]); + break; + case GL_CONVOLUTION_BORDER_MODE: + *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c]; + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]); + break; + case GL_CONVOLUTION_FORMAT: + *params = (GLfloat) conv->Format; + break; + case GL_CONVOLUTION_WIDTH: + *params = (GLfloat) conv->Width; + break; + case GL_CONVOLUTION_HEIGHT: + *params = (GLfloat) conv->Height; + break; + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLfloat) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLfloat) ctx->Const.MaxConvolutionHeight; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)"); + return; + } } -void _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetMinmaxParameteriv"); + GET_CURRENT_CONTEXT(ctx); + const struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameteriv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]); + params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]); + params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]); + params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]); + break; + case GL_CONVOLUTION_BORDER_MODE: + *params = (GLint) ctx->Pixel.ConvolutionBorderMode; + break; + case GL_CONVOLUTION_FILTER_SCALE: + params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0]; + params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1]; + params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2]; + params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3]; + break; + case GL_CONVOLUTION_FILTER_BIAS: + params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0]; + params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1]; + params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2]; + params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3]; + break; + case GL_CONVOLUTION_FORMAT: + *params = (GLint) conv->Format; + break; + case GL_CONVOLUTION_WIDTH: + *params = (GLint) conv->Width; + break; + case GL_CONVOLUTION_HEIGHT: + *params = (GLint) conv->Height; + break; + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLint) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLint) ctx->Const.MaxConvolutionHeight; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)"); + return; + } } -void _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) + +void +_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { - (void) target; - (void) format; - (void) type; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetSeparableFilter"); + + if (target != GL_SEPARABLE_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); + return; + } + (void) row; (void) column; (void) span; - WARNING("glGetSeperableFilter"); } -void _mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) -{ - (void) target; - (void) width; - (void) internalformat; - (void) sink; - WARNING("glHistogram"); -} -void _mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink) +void +_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { - (void) target; - (void) internalformat; - (void) sink; - WARNING("glMinmax"); -} + const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; + GLenum baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSeparableFilter2D"); -void _mesa_ResetHistogram(GLenum target) -{ - (void) target; - WARNING("glResetHistogram"); -} + if (target != GL_SEPARABLE_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); + return; + } -void _mesa_ResetMinmax(GLenum target) -{ - (void) target; - WARNING("glResetMinmax"); -} + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)"); + return; + } -void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) -{ - (void) target; - (void) internalformat; - (void) width; - (void) height; - (void) format; - (void) type; - (void) row; - (void) column; - WARNING("glSeparableFilter2D"); + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + gl_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)"); + return; + } + + ctx->Separable2D.Format = format; + ctx->Separable2D.InternalFormat = internalFormat; + ctx->Separable2D.Width = width; + ctx->Separable2D.Height = height; + + /* unpack row filter */ + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, + ctx->Separable2D.Filter, + format, type, row, &ctx->Unpack, + GL_FALSE, GL_FALSE); + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2]; + GLint i; + for (i = 0; i < width; i++) { + GLfloat r = ctx->Separable2D.Filter[i * 4 + 0]; + GLfloat g = ctx->Separable2D.Filter[i * 4 + 1]; + GLfloat b = ctx->Separable2D.Filter[i * 4 + 2]; + GLfloat a = ctx->Separable2D.Filter[i * 4 + 3]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Separable2D.Filter[i * 4 + 0] = r; + ctx->Separable2D.Filter[i * 4 + 1] = g; + ctx->Separable2D.Filter[i * 4 + 2] = b; + ctx->Separable2D.Filter[i * 4 + 3] = a; + } + } + + /* unpack column filter */ + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, + &ctx->Separable2D.Filter[colStart], + format, type, column, &ctx->Unpack, + GL_FALSE, GL_FALSE); + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2]; + GLint i; + for (i = 0; i < width; i++) { + GLfloat r = ctx->Separable2D.Filter[i * 4 + 0 + colStart]; + GLfloat g = ctx->Separable2D.Filter[i * 4 + 1 + colStart]; + GLfloat b = ctx->Separable2D.Filter[i * 4 + 2 + colStart]; + GLfloat a = ctx->Separable2D.Filter[i * 4 + 3 + colStart]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Separable2D.Filter[i * 4 + 0 + colStart] = r; + ctx->Separable2D.Filter[i * 4 + 1 + colStart] = g; + ctx->Separable2D.Filter[i * 4 + 2 + colStart] = b; + ctx->Separable2D.Filter[i * 4 + 3 + colStart] = a; + } + } } + diff --git a/xc/extras/Mesa/src/imaging.h b/xc/extras/Mesa/src/imaging.h index f376be5f6..1a4b9ccc6 100644 --- a/xc/extras/Mesa/src/imaging.h +++ b/xc/extras/Mesa/src/imaging.h @@ -32,25 +32,11 @@ #include "all.h" #else #include "glheader.h" +#include "types.h" #endif -#if 0 -extern void _mesa_BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a); - -extern void _mesa_BlendEquation(GLenum eq); - -extern void _mesa_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); - -extern void _mesa_ColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -#endif - -extern void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); - -extern void _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); - - extern void _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); extern void _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); @@ -63,22 +49,10 @@ extern void _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param extern void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); -extern void _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); - -extern void _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - extern void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -#if 0 -extern void _mesa_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table); - -extern void _mesa_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params); - -extern void _mesa_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params); -#endif - extern void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); extern void _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); @@ -109,4 +83,12 @@ extern void _mesa_ResetMinmax(GLenum target); extern void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); + +extern void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + +extern void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + + #endif diff --git a/xc/extras/Mesa/src/lines.c b/xc/extras/Mesa/src/lines.c index 1b075e25f..dd0649ba0 100644 --- a/xc/extras/Mesa/src/lines.c +++ b/xc/extras/Mesa/src/lines.c @@ -57,6 +57,8 @@ _mesa_LineWidth( GLfloat width ) ctx->TriangleCaps &= ~DD_LINE_WIDTH; if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH; ctx->NewState |= NEW_RASTER_OPS; + if (ctx->Driver.LineWidth) + (*ctx->Driver.LineWidth)(ctx, width); } } @@ -70,6 +72,9 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) ctx->Line.StippleFactor = CLAMP( factor, 1, 256 ); ctx->Line.StipplePattern = pattern; ctx->NewState |= NEW_RASTER_OPS; + + if (ctx->Driver.LineStipple) + ctx->Driver.LineStipple( ctx, factor, pattern ); } @@ -110,22 +115,13 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) static void flat_ci_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); - count = ctx->PB->count; + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); #define INTERP_XY 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -135,25 +131,14 @@ static void flat_ci_line( GLcontext *ctx, static void flat_ci_z_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLdepth *pbz = ctx->PB->z; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); - count = ctx->PB->count; + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); #define INTERP_XY 1 #define INTERP_Z 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -163,23 +148,14 @@ static void flat_ci_z_line( GLcontext *ctx, static void flat_rgba_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); - count = ctx->PB->count; + const GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); #define INTERP_XY 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -189,26 +165,15 @@ static void flat_rgba_line( GLcontext *ctx, static void flat_rgba_z_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLdepth *pbz = ctx->PB->z; - GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); - count = ctx->PB->count; + const GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); #define INTERP_XY 1 #define INTERP_Z 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -221,9 +186,11 @@ static void smooth_ci_line( GLcontext *ctx, GLint count = ctx->PB->count; GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_INDEX 1 @@ -249,9 +216,11 @@ static void smooth_ci_z_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_INDEX 1 @@ -281,6 +250,8 @@ static void smooth_rgba_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -313,6 +284,8 @@ static void smooth_rgba_z_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_RGB 1 @@ -352,9 +325,11 @@ static void general_smooth_ci_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -424,7 +399,7 @@ static void general_flat_ci_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -492,6 +467,8 @@ static void general_smooth_rgba_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -584,7 +561,7 @@ static void general_flat_rgba_line( GLcontext *ctx, GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -653,7 +630,7 @@ static void flat_textured_line( GLcontext *ctx, GLfloat *pbt = ctx->PB->t[0]; GLfloat *pbu = ctx->PB->u[0]; GLubyte *color = ctx->VB->ColorPtr->data[pv]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -716,6 +693,8 @@ static void smooth_textured_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -793,6 +772,8 @@ static void smooth_multitextured_line( GLcontext *ctx, GLubyte (*pbspec)[3] = ctx->PB->spec; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -1023,8 +1004,7 @@ void gl_set_line_function( GLcontext *ctx ) else { if (ctx->Light.ShadeModel==GL_SMOOTH) { /* Width==1, non-stippled, smooth-shaded */ - if (ctx->Depth.Test - || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) { + if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) { if (rgbmode) ctx->Driver.LineFunc = smooth_rgba_z_line; else @@ -1039,8 +1019,7 @@ void gl_set_line_function( GLcontext *ctx ) } else { /* Width==1, non-stippled, flat-shaded */ - if (ctx->Depth.Test - || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) { + if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) { if (rgbmode) ctx->Driver.LineFunc = flat_rgba_z_line; else diff --git a/xc/extras/Mesa/src/lnaatemp.h b/xc/extras/Mesa/src/lnaatemp.h index 43923e851..926ee49c3 100644 --- a/xc/extras/Mesa/src/lnaatemp.h +++ b/xc/extras/Mesa/src/lnaatemp.h @@ -22,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/lnaatemp.h,v 1.7 2000/02/18 12:18:45 tsi Exp $ */ + /* * Antialiased Line Rasterizer Template @@ -61,22 +61,25 @@ GLint dy = y1 - y0; GLint xStep, yStep; GLint z0, z1; -#ifdef INTERP_RGBA + const GLint depthBits = ctx->Visual->DepthBits; + const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; +#define FixedToDepth(F) ((F) >> fixedToDepthShift) +#if INTERP_RGBA GLfixed fr, fg, fb, fa; /* fixed-pt RGBA */ GLfixed dfr, dfg, dfb, dfa; /* fixed-pt RGBA deltas */ #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC GLfixed fsr, fsg, fsb; /* fixed-pt specular RGBA */ GLfixed dfsr, dfsg, dfsb; /* fixed-pt specular RGBA deltas */ #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX GLfixed fi, dfi; #endif -#if defined(INTERP_STUV0) || defined(INTERP_STUV1) +#if INTERP_STUV0 || INTERP_STUV1 GLfloat invw0 = VB->Win.data[vert0][3]; GLfloat invw1 = VB->Win.data[vert1][3]; #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 /* h denotes hyperbolic */ GLfloat hs0 = invw0 * VB->TexCoordPtr[0]->data[vert0][0]; GLfloat dhs = invw1 * VB->TexCoordPtr[0]->data[vert1][0] - hs0; @@ -85,7 +88,7 @@ GLfloat hu0 = 0, dhu = 0; GLfloat hv0 = invw0, dhv = invw1 - invw0; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 GLfloat hs01 = invw0 * VB->TexCoordPtr[1]->data[vert0][0]; GLfloat dhs1 = invw1 * VB->TexCoordPtr[1]->data[vert1][0] - hs01; GLfloat ht01 = invw0 * VB->TexCoordPtr[1]->data[vert0][1]; @@ -97,15 +100,18 @@ if (dx == 0 && dy == 0) return; -#if DEPTH_BITS==16 - z0 = FloatToFixed(VB->Win.data[vert0][2]); - z1 = FloatToFixed(VB->Win.data[vert1][2]); -#else - z0 = (int) VB->Win.data[vert0][2]; - z1 = (int) VB->Win.data[vert1][2]; -#endif + ctx->PB->mono = GL_FALSE; + + if (depthBits <= 16) { + z0 = FloatToFixed(VB->Win.data[vert0][2]); + z1 = FloatToFixed(VB->Win.data[vert1][2]); + } + else { + z0 = (int) VB->Win.data[vert0][2]; + z1 = (int) VB->Win.data[vert1][2]; + } -#ifdef INTERP_STUV0 +#if INTERP_STUV0 if (VB->TexCoordPtr[0]->size > 2) { hu0 = invw0 * VB->TexCoordPtr[0]->data[vert0][2]; dhu = invw1 * VB->TexCoordPtr[0]->data[vert1][2] - hu0; @@ -116,7 +122,7 @@ } #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 if (VB->TexCoordPtr[1]->size > 2) { hu01 = invw0 * VB->TexCoordPtr[1]->data[vert0][2]; dhu1 = invw1 * VB->TexCoordPtr[1]->data[vert1][2] - hu01; @@ -127,7 +133,7 @@ } #endif -#ifdef INTERP_RGBA +#if INTERP_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { fr = IntToFixed(VB->ColorPtr->data[vert0][0]); fg = IntToFixed(VB->ColorPtr->data[vert0][1]); @@ -142,7 +148,7 @@ dfr = dfg = dfb = dfa = 0; } #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { fsr = IntToFixed(VB->Specular[vert0][0]); fsg = IntToFixed(VB->Specular[vert0][1]); @@ -155,7 +161,7 @@ dfsr = dfsg = dfsb = 0; } #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { fi = IntToFixed(VB->IndexPtr->data[vert0]); } @@ -193,11 +199,10 @@ GLint i; GLint x = x0; GLfloat y = VB->Win.data[vert0][1]; - GLfloat yStep = (VB->Win.data[vert1][1] - y) / (GLfloat) dx; - GLint dz = (z1 - z0) / dx; - GLfloat invDx = 1.0F / dx; - (void) invDx; -#ifdef INTERP_RGBA + const GLfloat invDx = 1.0F / dx; + GLfloat yStep = (VB->Win.data[vert1][1] - y) * invDx; + GLint dz = (GLint) ((z1 - z0) * invDx); +#if INTERP_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { dfr = (IntToFixed(VB->ColorPtr->data[vert1][0]) - fr) * invDx; dfg = (IntToFixed(VB->ColorPtr->data[vert1][1]) - fg) * invDx; @@ -205,25 +210,31 @@ dfa = (IntToFixed(VB->ColorPtr->data[vert1][3]) - fa) * invDx; } #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { dfsr = (IntToFixed(VB->Specular[vert1][0]) - fsr) * invDx; dfsg = (IntToFixed(VB->Specular[vert1][1]) - fsg) * invDx; dfsb = (IntToFixed(VB->Specular[vert1][2]) - fsb) * invDx; } #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 dhs *= invDx; dht *= invDx; dhu *= invDx; dhv *= invDx; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 dhs1 *= invDx; dht1 *= invDx; dhu1 *= invDx; dhv1 *= invDx; #endif +#if INTERP_INDEX + if (ctx->Light.ShadeModel == GL_SMOOTH) { + dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) * invDx; + } +#endif + for (i = 0; i < dx; i++) { if (solid || (ctx->Line.StipplePattern & (1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf)))) { @@ -232,37 +243,33 @@ GLint yTopi = (GLint) yTop; GLint yBoti = (GLint) yBot; GLint iy; -#ifdef INTERP_RGBA +#if INTERP_RGBA GLubyte red = FixedToInt(fr); GLubyte green = FixedToInt(fg); GLubyte blue = FixedToInt(fb); GLubyte alpha = FixedToInt(fa); GLint coverage; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC GLubyte specRed = FixedToInt(fsr); GLubyte specGreen = FixedToInt(fsg); GLubyte specBlue = FixedToInt(fsb); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX GLuint index = FixedToInt(fi) & 0xfffffff0; GLuint coverage; #endif -#if DEPTH_BITS==16 - GLdepth z = FixedToInt(z0); -#else - GLdepth z = z0; -#endif + GLdepth z = FixedToDepth(z0); ASSERT(yBoti <= yTopi); { -#ifdef INTERP_STUV0 +#if INTERP_STUV0 GLfloat invQ = 1.0F / hv0; GLfloat s = hs0 * invQ; GLfloat t = ht0 * invQ; GLfloat u = hu0 * invQ; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 GLfloat invQ1 = 1.0F / hv01; GLfloat s1 = hs01 * invQ1; GLfloat t1 = ht01 * invQ1; @@ -270,30 +277,30 @@ #endif /* bottom pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (1.0F - (yBot - yBoti))); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (1.0F - (yBot - yBoti))); #endif PLOT(x, yBoti); yBoti++; /* top pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (yTop - yTopi)); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (yTop - yTopi)); #endif PLOT(x, yTopi); yTopi--; /* pixels between top and bottom with 100% coverage */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = alpha; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = 15; #endif for (iy = yBoti; iy <= yTopi; iy++) { @@ -307,30 +314,30 @@ x += xStep; y += yStep; z0 += dz; -#ifdef INTERP_RGBA +#if INTERP_RGBA fr += dfr; fg += dfg; fb += dfb; fa += dfa; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC fsr += dfsr; fsg += dfsg; fsb += dfsb; #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 hs0 += dhs; ht0 += dht; hu0 += dhu; hv0 += dhv; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 hs01 += dhs1; ht01 += dht1; hu01 += dhu1; hv01 += dhv1; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX fi += dfi; #endif @@ -343,11 +350,10 @@ GLint i; GLint y = y0; GLfloat x = VB->Win.data[vert0][0]; - GLfloat xStep = (VB->Win.data[vert1][0] - x) / (GLfloat) dy; - GLint dz = (z1 - z0) / dy; - GLfloat invDy = 1.0F / dy; - (void) invDy; -#ifdef INTERP_RGBA + const GLfloat invDy = 1.0F / dy; + GLfloat xStep = (VB->Win.data[vert1][0] - x) * invDy; + GLint dz = (GLint) ((z1 - z0) * invDy); +#if INTERP_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { dfr = (IntToFixed(VB->ColorPtr->data[vert1][0]) - fr) * invDy; dfg = (IntToFixed(VB->ColorPtr->data[vert1][1]) - fg) * invDy; @@ -355,28 +361,28 @@ dfa = (IntToFixed(VB->ColorPtr->data[vert1][3]) - fa) * invDy; } #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { dfsr = (IntToFixed(VB->Specular[vert1][0]) - fsr) * invDy; dfsg = (IntToFixed(VB->Specular[vert1][1]) - fsg) * invDy; dfsb = (IntToFixed(VB->Specular[vert1][2]) - fsb) * invDy; } #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 dhs *= invDy; dht *= invDy; dhu *= invDy; dhv *= invDy; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 dhs1 *= invDy; dht1 *= invDy; dhu1 *= invDy; dhv1 *= invDy; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { - dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) / dy; + dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) * invDy; } #endif for (i = 0; i < dy; i++) { @@ -386,38 +392,34 @@ GLint xRighti = (GLint) xRight; GLint xLefti = (GLint) xLeft; GLint ix; -#ifdef INTERP_RGBA +#if INTERP_RGBA GLubyte red = FixedToInt(fr); GLubyte green = FixedToInt(fg); GLubyte blue = FixedToInt(fb); GLubyte alpha = FixedToInt(fa); GLint coverage; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC GLubyte specRed = FixedToInt(fsr); GLubyte specGreen = FixedToInt(fsg); GLubyte specBlue = FixedToInt(fsb); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX GLuint index = FixedToInt(fi) & 0xfffffff0; GLuint coverage; #endif -#if DEPTH_BITS==16 - GLdepth z = FixedToInt(z0); -#else - GLdepth z = z0; -#endif + GLdepth z = FixedToDepth(z0); ASSERT(xLefti < xRight); { -#ifdef INTERP_STUV0 +#if INTERP_STUV0 GLfloat invQ = 1.0F / hv0; GLfloat s = hs0 * invQ; GLfloat t = ht0 * invQ; GLfloat u = hu0 * invQ; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 GLfloat invQ1 = 1.0F / hv01; GLfloat s1 = hs01 * invQ1; GLfloat t1 = ht01 * invQ1; @@ -425,30 +427,30 @@ #endif /* left pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (1.0F - (xLeft - xLefti))); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (1.0F - (xLeft - xLefti))); #endif PLOT(xLefti, y); xLefti++; /* right pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (xRight - xRighti)); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (xRight - xRighti)); #endif PLOT(xRighti, y) xRighti--; /* pixels between top and bottom with 100% coverage */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = alpha; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = 15; #endif for (ix = xLefti; ix <= xRighti; ix++) { @@ -461,30 +463,30 @@ x += xStep; y += yStep; z0 += dz; -#ifdef INTERP_RGBA +#if INTERP_RGBA fr += dfr; fg += dfg; fb += dfb; fa += dfa; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC fsr += dfsr; fsg += dfsg; fsb += dfsb; #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 hs0 += dhs; ht0 += dht; hu0 += dhu; hv0 += dhv; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 hs01 += dhs1; ht01 += dht1; hu01 += dhu1; hv01 += dhv1; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX fi += dfi; #endif if (!solid) diff --git a/xc/extras/Mesa/src/mem.h b/xc/extras/Mesa/src/mem.h index c0203c7c4..794aa13ef 100644 --- a/xc/extras/Mesa/src/mem.h +++ b/xc/extras/Mesa/src/mem.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -34,12 +34,14 @@ /* * Memory allocation */ -#ifdef DEBUG - -/* call Mesa memory functions */ extern void *_mesa_malloc(size_t bytes); extern void *_mesa_calloc(size_t bytes); extern void _mesa_free(void *ptr); + + +#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)) @@ -78,6 +80,15 @@ extern void _mesa_free(void *ptr); #endif +/* 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__) diff --git a/xc/extras/Mesa/src/pb.c b/xc/extras/Mesa/src/pb.c index 1e5ac03e2..78ff5d07e 100644 --- a/xc/extras/Mesa/src/pb.c +++ b/xc/extras/Mesa/src/pb.c @@ -69,10 +69,11 @@ struct pixel_buffer *gl_alloc_pb(void) int i, j; /* set non-zero fields */ pb->primitive = GL_BITMAP; + 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; @@ -115,10 +116,10 @@ static void multi_write_index_pixels( GLcontext *ctx, GLuint n, /* make copy of incoming indexes */ MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); + _mesa_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); + _mesa_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); } (*ctx->Driver.WriteCI32Pixels)( ctx, n, x, y, indexTmp, mask ); } @@ -170,20 +171,20 @@ static void multi_write_rgba_pixels( GLcontext *ctx, GLuint n, MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLubyte) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); + _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 (ctx->Color.SWmasking) { - gl_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); + _mesa_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); } (*ctx->Driver.WriteRGBAPixels)( ctx, n, x, y, (const GLubyte (*)[4])rgbaTmp, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_pixels( ctx, n, x, y, - (const GLubyte (*)[4])rgbaTmp, mask ); + _mesa_write_alpha_pixels( ctx, n, x, y, + (const GLubyte (*)[4])rgbaTmp, mask ); } } } @@ -221,10 +222,13 @@ static void add_colors( GLuint n, GLubyte rgba[][4], CONST GLubyte spec[][3] ) */ void gl_flush_pb( GLcontext *ctx ) { - struct pixel_buffer* PB = ctx->PB; + /* 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 = ctx->PB; GLubyte mask[PB_SIZE]; - if (PB->count==0) + if (PB->count == 0) goto CleanUp; /* initialize mask array and clip pixels simultaneously */ @@ -245,19 +249,9 @@ void gl_flush_pb( GLcontext *ctx ) /* * RGBA COLOR PIXELS */ - if (PB->mono && ctx->MutablePixels) { - /* Copy mono color to all pixels */ - GLuint i; - for (i=0; i<PB->count; i++) { - PB->rgba[i][RCOMP] = PB->color[RCOMP]; - PB->rgba[i][GCOMP] = PB->color[GCOMP]; - PB->rgba[i][BCOMP] = PB->color[BCOMP]; - PB->rgba[i][ACOMP] = PB->color[ACOMP]; - } - } /* If each pixel can be of a different color... */ - if (ctx->MutablePixels || !PB->mono) { + if ((ctx->RasterMask & modBits) || !PB->mono) { if (ctx->Texture.ReallyEnabled) { int texUnit; @@ -292,7 +286,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -311,21 +305,21 @@ void gl_flush_pb( GLcontext *ctx ) /* normal case: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_pixels( ctx, PB->count, PB->x, PB->y, - PB->rgba, mask); + _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 (ctx->Color.SWmasking) { - gl_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); + _mesa_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); } (*ctx->Driver.WriteRGBAPixels)( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, + _mesa_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); } } @@ -344,7 +338,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -360,30 +354,21 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->RasterMask & MULTI_DRAW_BIT) { /* Copy mono color to all pixels */ - GLuint i; - for (i=0; i<PB->count; i++) { - PB->rgba[i][RCOMP] = PB->color[RCOMP]; - PB->rgba[i][GCOMP] = PB->color[GCOMP]; - PB->rgba[i][BCOMP] = PB->color[BCOMP]; - PB->rgba[i][ACOMP] = PB->color[ACOMP]; - } multi_write_rgba_pixels( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); } else { /* normal case: write to exactly one buffer */ - - GLubyte red, green, blue, alpha; - red = PB->color[RCOMP]; - green = PB->color[GCOMP]; - blue = PB->color[BCOMP]; - alpha = PB->color[ACOMP]; + GLubyte red = PB->currentColor[RCOMP]; + GLubyte green = PB->currentColor[GCOMP]; + GLubyte blue = PB->currentColor[BCOMP]; + GLubyte alpha = PB->currentColor[ACOMP]; (*ctx->Driver.Color)( ctx, red, green, blue, alpha ); (*ctx->Driver.WriteMonoRGBAPixels)( ctx, PB->count, PB->x, PB->y, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, - PB->color[ACOMP], mask ); + _mesa_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, + PB->currentColor[ACOMP], mask ); } } /*** ALL DONE ***/ @@ -395,28 +380,18 @@ void gl_flush_pb( GLcontext *ctx ) */ /* If we may be writting pixels with different indexes... */ - if (PB->mono && ctx->MutablePixels) { - /* copy index to all pixels */ - GLuint n = PB->count, indx = PB->index; - GLuint *pbindex = PB->i; - do { - *pbindex++ = indx; - n--; - } while (n); - } - - if (ctx->MutablePixels || !PB->mono) { + if ((ctx->RasterMask & modBits) || !PB->mono) { if (ctx->Fog.Enabled && (ctx->Hint.Fog==GL_NICEST || PB->primitive==GL_BITMAP)) { - _mesa_fog_ci_pixels( ctx, PB->count, PB->z, PB->i ); + _mesa_fog_ci_pixels( ctx, PB->count, PB->z, PB->index ); } /* Scissoring already done above */ if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -427,20 +402,20 @@ void gl_flush_pb( GLcontext *ctx ) } if (ctx->RasterMask & MULTI_DRAW_BIT) { - multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + 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.SWLogicOpEnabled) { - gl_logicop_ci_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + _mesa_logicop_ci_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + _mesa_mask_index_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } (*ctx->Driver.WriteCI32Pixels)( ctx, PB->count, PB->x, PB->y, - PB->i, mask ); + PB->index, mask ); } /*** ALL DONE ***/ @@ -452,7 +427,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -463,19 +438,12 @@ void gl_flush_pb( GLcontext *ctx ) } if (ctx->RasterMask & MULTI_DRAW_BIT) { - GLuint n = PB->count, indx = PB->index; - GLuint *pbindex = PB->i; - do { - *pbindex++ = indx; - n--; - } while (n); - - multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } else { /* normal case: write to exactly one buffer */ - (*ctx->Driver.Index)( ctx, PB->index ); + (*ctx->Driver.Index)( ctx, PB->currentIndex ); (*ctx->Driver.WriteMonoCIPixels)( ctx, PB->count, PB->x, PB->y, mask ); } } @@ -483,6 +451,7 @@ void gl_flush_pb( GLcontext *ctx ) CleanUp: PB->count = 0; + PB->mono = GL_TRUE; } diff --git a/xc/extras/Mesa/src/pb.h b/xc/extras/Mesa/src/pb.h index 54fad8388..cf5fecc4b 100644 --- a/xc/extras/Mesa/src/pb.h +++ b/xc/extras/Mesa/src/pb.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,9 +24,6 @@ */ - - - #ifndef PB_H #define PB_H @@ -34,7 +31,6 @@ #include "types.h" - /* * Pixel buffer size, must be larger than MAX_WIDTH. */ @@ -42,160 +38,197 @@ struct pixel_buffer { - 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,MAX_DEPTH] */ - GLubyte rgba[PB_SIZE][4]; /* Colors */ - GLubyte spec[PB_SIZE][3]; /* Separate specular colors */ - GLuint i[PB_SIZE]; /* Index */ - 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 */ - GLint color[4]; /* Mono color, integers! */ - GLuint index; /* Mono index */ - GLuint count; /* Number of pixels in buffer */ - GLboolean mono; /* Same color or index for all pixels? */ - GLenum primitive; /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP*/ + GLenum primitive; /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP */ + GLubyte 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? */ + + 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] */ + GLubyte rgba[PB_SIZE][4]; /* Colors */ + GLubyte spec[PB_SIZE][3]; /* Separate specular colors */ + GLuint index[PB_SIZE]; /* Color indexes */ + 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( CTX, PB, R, G, B, A ) \ - if ((PB)->color[RCOMP]!=(R) || (PB)->color[GCOMP]!=(G) \ - || (PB)->color[BCOMP]!=(B) || (PB)->color[ACOMP]!=(A) \ - || !(PB)->mono) { \ - gl_flush_pb( ctx ); \ - } \ - (PB)->color[RCOMP] = R; \ - (PB)->color[GCOMP] = G; \ - (PB)->color[BCOMP] = B; \ - (PB)->color[ACOMP] = A; \ - (PB)->mono = GL_TRUE; +#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( CTX, PB, I ) \ - if ((PB)->index!=(I) || !(PB)->mono) { \ - gl_flush_pb( CTX ); \ - } \ - (PB)->index = I; \ - (PB)->mono = GL_TRUE; +#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 ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->count++; +#define PB_WRITE_PIXEL( PB, X, Y, Z ) \ +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + COPY_4UBV((PB)->rgba[count], (PB)->currentColor); \ + (PB)->index[count] = (PB)->currentIndex; \ + (PB)->count++; \ +} while (0) + + +/* + (PB)->rgba[count][0] = (PB)->currentColor[0]; \ + (PB)->rgba[count][1] = (PB)->currentColor[1]; \ + (PB)->rgba[count][2] = (PB)->currentColor[2]; \ + (PB)->rgba[count][3] = (PB)->currentColor[3]; \ + +*/ /* * "write" an RGBA pixel */ #define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, R, G, B, A ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->count++; +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (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, I ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->i[(PB)->count] = I; \ - (PB)->count++; +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (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, R, G, B, A, S, T, U ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->s[0][(PB)->count] = S; \ - (PB)->t[0][(PB)->count] = T; \ - (PB)->u[0][(PB)->count] = U; \ - (PB)->count++; +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (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, R, G, B, A, S, T, U, S1, T1, U1 ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->s[0][(PB)->count] = S; \ - (PB)->t[0][(PB)->count] = T; \ - (PB)->u[0][(PB)->count] = U; \ - (PB)->s[1][(PB)->count] = S1; \ - (PB)->t[1][(PB)->count] = T1; \ - (PB)->u[1][(PB)->count] = U1; \ - (PB)->count++; +#define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S0, T0, U0, S1, T1, U1 ) \ +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (PB)->rgba[count][RCOMP] = R; \ + (PB)->rgba[count][GCOMP] = G; \ + (PB)->rgba[count][BCOMP] = B; \ + (PB)->rgba[count][ACOMP] = A; \ + (PB)->s[0][count] = S0; \ + (PB)->t[0][count] = T0; \ + (PB)->u[0][count] = U0; \ + (PB)->s[1][count] = S1; \ + (PB)->t[1][count] = T1; \ + (PB)->u[1][count] = U1; \ + (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, R, G, B, A, \ - SR, SG, SB, S, T, U, S1, T1, U1 ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->spec[(PB)->count][RCOMP] = SR; \ - (PB)->spec[(PB)->count][GCOMP] = SG; \ - (PB)->spec[(PB)->count][BCOMP] = SB; \ - (PB)->s[0][(PB)->count] = S; \ - (PB)->t[0][(PB)->count] = T; \ - (PB)->u[0][(PB)->count] = U; \ - (PB)->s[1][(PB)->count] = S1; \ - (PB)->t[1][(PB)->count] = T1; \ - (PB)->u[1][(PB)->count] = U1; \ - (PB)->count++; + SR, SG, SB, S0, T0, U0, S1, T1, U1 ) \ +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (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; \ + (PB)->s[0][count] = S0; \ + (PB)->t[0][count] = T0; \ + (PB)->u[0][count] = U0; \ + (PB)->s[1][count] = S1; \ + (PB)->t[1][count] = T1; \ + (PB)->u[1][count] = U1; \ + (PB)->mono = GL_FALSE; \ + (PB)->count++; \ +} while (0) /* * Call this function at least every MAX_WIDTH pixels: */ -#define PB_CHECK_FLUSH( CTX, PB ) \ -do { \ - if ((PB)->count>=PB_SIZE-MAX_WIDTH) { \ - gl_flush_pb( CTX ); \ - } \ +#define PB_CHECK_FLUSH( CTX, PB ) \ +do { \ + if ((PB)->count >= PB_SIZE - MAX_WIDTH) { \ + gl_flush_pb( CTX ); \ + } \ } while(0) + extern struct pixel_buffer *gl_alloc_pb(void); extern void gl_flush_pb( GLcontext *ctx ); + #endif diff --git a/xc/extras/Mesa/src/pixel.c b/xc/extras/Mesa/src/pixel.c index fd42ba3a9..17c6eb6bb 100644 --- a/xc/extras/Mesa/src/pixel.c +++ b/xc/extras/Mesa/src/pixel.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,11 +24,6 @@ */ -/* - * glPixelStore, glPixelTransfer, glPixelMap, glPixelZoom, etc. - */ - - #ifdef PC_HEADER #include "all.h" #else @@ -561,6 +556,54 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) case GL_DEPTH_BIAS: ctx->Pixel.DepthBias = param; break; + case GL_POST_COLOR_MATRIX_RED_SCALE: + ctx->Pixel.PostColorMatrixScale[0] = param; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS: + ctx->Pixel.PostColorMatrixBias[0] = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + ctx->Pixel.PostColorMatrixScale[1] = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + ctx->Pixel.PostColorMatrixBias[1] = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + ctx->Pixel.PostColorMatrixScale[2] = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + ctx->Pixel.PostColorMatrixBias[2] = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + ctx->Pixel.PostColorMatrixScale[3] = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + ctx->Pixel.PostColorMatrixBias[3] = param; + break; + case GL_POST_CONVOLUTION_RED_SCALE: + ctx->Pixel.PostConvolutionScale[0] = param; + break; + case GL_POST_CONVOLUTION_RED_BIAS: + ctx->Pixel.PostConvolutionBias[0] = param; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE: + ctx->Pixel.PostConvolutionScale[1] = param; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS: + ctx->Pixel.PostConvolutionBias[1] = param; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE: + ctx->Pixel.PostConvolutionScale[2] = param; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS: + ctx->Pixel.PostConvolutionBias[2] = param; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE: + ctx->Pixel.PostConvolutionScale[2] = param; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS: + ctx->Pixel.PostConvolutionBias[2] = param; + break; default: gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); return; @@ -575,6 +618,20 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) else { ctx->Pixel.ScaleOrBiasRGBA = GL_FALSE; } + + if (ctx->Pixel.PostColorMatrixScale[0] != 1.0F || + ctx->Pixel.PostColorMatrixBias[0] != 0.0F || + ctx->Pixel.PostColorMatrixScale[1] != 1.0F || + ctx->Pixel.PostColorMatrixBias[1] != 0.0F || + ctx->Pixel.PostColorMatrixScale[2] != 1.0F || + ctx->Pixel.PostColorMatrixBias[2] != 0.0F || + ctx->Pixel.PostColorMatrixScale[3] != 1.0F || + ctx->Pixel.PostColorMatrixBias[3] != 0.0F) { + ctx->Pixel.ScaleOrBiasRGBApcm = GL_TRUE; + } + else { + ctx->Pixel.ScaleOrBiasRGBApcm = GL_FALSE; + } } @@ -586,60 +643,16 @@ _mesa_PixelTransferi( GLenum pname, GLint param ) - -/* - * Pixel processing functions - */ - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) -{ - GLuint i; - for (i=0;i<n;i++) { - GLfloat r = red[i] * ctx->Pixel.RedScale + ctx->Pixel.RedBias; - GLfloat g = green[i] * ctx->Pixel.GreenScale + ctx->Pixel.GreenBias; - GLfloat b = blue[i] * ctx->Pixel.BlueScale + ctx->Pixel.BlueBias; - GLfloat a = alpha[i] * ctx->Pixel.AlphaScale + ctx->Pixel.AlphaBias; - red[i] = CLAMP( r, 0.0F, 1.0F ); - green[i] = CLAMP( g, 0.0F, 1.0F ); - blue[i] = CLAMP( b, 0.0F, 1.0F ); - alpha[i] = CLAMP( a, 0.0F, 1.0F ); - } -} - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rbias = ctx->Pixel.RedBias * 255.0F; - GLfloat gbias = ctx->Pixel.GreenBias * 255.0F; - GLfloat bbias = ctx->Pixel.BlueBias * 255.0F; - GLfloat abias = ctx->Pixel.AlphaBias * 255.0F; - GLuint i; - for (i=0;i<n;i++) { - GLint r = (GLint) (rgba[i][RCOMP] * ctx->Pixel.RedScale + rbias); - GLint g = (GLint) (rgba[i][GCOMP] * ctx->Pixel.GreenScale + gbias); - GLint b = (GLint) (rgba[i][BCOMP] * ctx->Pixel.BlueScale + bbias); - GLint a = (GLint) (rgba[i][ACOMP] * ctx->Pixel.AlphaScale + abias); - rgba[i][RCOMP] = CLAMP( r, 0, 255 ); - rgba[i][GCOMP] = CLAMP( g, 0, 255 ); - rgba[i][BCOMP] = CLAMP( b, 0, 255 ); - rgba[i][ACOMP] = CLAMP( a, 0, 255 ); - } -} +/**********************************************************************/ +/***** Pixel processing functions ******/ +/**********************************************************************/ /* * Apply scale and bias factors to an array of RGBA pixels. */ -void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +void +_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { if (ctx->Pixel.RedScale != 1.0 || ctx->Pixel.RedBias != 0.0) { const GLfloat scale = ctx->Pixel.RedScale; @@ -677,32 +690,10 @@ void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[ /* - * Apply pixel mapping to an array of RGBA pixels. - */ -void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rscale = (ctx->Pixel.MapRtoRsize - 1) / 255.0F; - GLfloat gscale = (ctx->Pixel.MapGtoGsize - 1) / 255.0F; - GLfloat bscale = (ctx->Pixel.MapBtoBsize - 1) / 255.0F; - GLfloat ascale = (ctx->Pixel.MapAtoAsize - 1) / 255.0F; - GLuint i; - for (i=0;i<n;i++) { - GLint ir = (GLint) (rgba[i][RCOMP] * rscale); - GLint ig = (GLint) (rgba[i][GCOMP] * gscale); - GLint ib = (GLint) (rgba[i][BCOMP] * bscale); - GLint ia = (GLint) (rgba[i][ACOMP] * ascale); - rgba[i][RCOMP] = (GLint) (ctx->Pixel.MapRtoR[ir] * 255.0F); - rgba[i][GCOMP] = (GLint) (ctx->Pixel.MapGtoG[ig] * 255.0F); - rgba[i][BCOMP] = (GLint) (ctx->Pixel.MapBtoB[ib] * 255.0F); - rgba[i][ACOMP] = (GLint) (ctx->Pixel.MapAtoA[ia] * 255.0F); - } -} - - -/* * Apply pixel mapping to an array of floating point RGBA pixels. */ -void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +void +_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) { const GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; const GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; @@ -723,22 +714,210 @@ void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) /* - * Apply pixel mapping to an array of RGBA pixels. + * Apply the color matrix and post color matrix scaling and biasing. */ -void gl_map_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) +void +_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { - GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; - GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; - GLfloat bscale = ctx->Pixel.MapBtoBsize - 1; - GLfloat ascale = ctx->Pixel.MapAtoAsize - 1; + const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0]; + const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; + const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; + const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; + const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; + 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; GLuint i; - for (i=0;i<n;i++) { - red[i] = ctx->Pixel.MapRtoR[ (GLint) (red[i] * rscale + 0.5F) ]; - green[i] = ctx->Pixel.MapGtoG[ (GLint) (green[i] * gscale + 0.5F) ]; - blue[i] = ctx->Pixel.MapBtoB[ (GLint) (blue[i] * bscale + 0.5F) ]; - alpha[i] = ctx->Pixel.MapAtoA[ (GLint) (alpha[i] * ascale + 0.5F) ]; + for (i = 0; i < n; i++) { + const GLfloat r = rgba[i][RCOMP]; + const GLfloat g = rgba[i][GCOMP]; + const GLfloat b = rgba[i][BCOMP]; + const GLfloat a = rgba[i][ACOMP]; + rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; + rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; + rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; + rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; + } +} + + +/* + * Apply a color table lookup to an array of colors. + */ +void +_mesa_lookup_rgba(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]) +{ + ASSERT(table->TableType == GL_FLOAT); + if (!table->Table) + return; + + switch (table->Format) { + case GL_INTENSITY: + /* replace RGBA with I */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + } + break; + case GL_LUMINANCE: + /* replace RGB with L */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + break; + case GL_ALPHA: + /* replace A with A */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j]; + } + } + break; + case GL_LUMINANCE_ALPHA: + /* replace RGBA with LLLA */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLfloat luminance = lut[jL * 2 + 0] * (1.0F / 255.0F); + GLfloat alpha = lut[jA * 2 + 1] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLfloat luminance = lut[jL * 2 + 0]; + GLfloat alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + break; + case GL_RGB: + /* replace RGB with RGB */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0] * (1.0F / 255.0F); + rgba[i][GCOMP] = lut[jG * 3 + 1] * (1.0F / 255.0F); + rgba[i][BCOMP] = lut[jB * 3 + 2] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + rgba[i][BCOMP] = lut[jB * 3 + 2]; + } + } + break; + case GL_RGBA: + /* replace RGBA with RGBA */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0] * (1.0F / 255.0F); + rgba[i][GCOMP] = lut[jG * 4 + 1] * (1.0F / 255.0F); + rgba[i][BCOMP] = lut[jB * 4 + 2] * (1.0F / 255.0F); + rgba[i][ACOMP] = lut[jA * 4 + 3] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0]; + rgba[i][GCOMP] = lut[jG * 4 + 1]; + rgba[i][BCOMP] = lut[jB * 4 + 2]; + rgba[i][ACOMP] = lut[jA * 4 + 3]; + } + } + break; + default: + gl_problem(NULL, "Bad format in _mesa_lookup_rgba"); + return; } } @@ -747,7 +926,8 @@ void gl_map_color( const GLcontext *ctx, GLuint n, /* * Apply color index shift and offset to an array of pixels. */ -void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) +void +_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) { GLint shift = ctx->Pixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; @@ -774,7 +954,8 @@ void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) /* * Apply color index mapping to color indexes. */ -void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) +void +_mesa_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) { GLuint mask = ctx->Pixel.MapItoIsize - 1; GLuint i; @@ -787,8 +968,9 @@ void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) /* * Map color indexes to rgba values. */ -void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci_to_rgba_ubyte( const GLcontext *ctx, GLuint n, + const GLuint index[], GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -811,8 +993,9 @@ void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], /* * Map color indexes to float rgba values. */ -void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat rgba[][4] ) +void +_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, + const GLuint index[], GLfloat rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -835,8 +1018,9 @@ void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index /* * Map 8-bit color indexes to rgb values. */ -void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], + GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -856,27 +1040,9 @@ void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], } -void gl_map_ci_to_color( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat r[], GLfloat g[], - GLfloat b[], GLfloat a[] ) -{ - GLuint rmask = ctx->Pixel.MapItoRsize - 1; - GLuint gmask = ctx->Pixel.MapItoGsize - 1; - GLuint bmask = ctx->Pixel.MapItoBsize - 1; - GLuint amask = ctx->Pixel.MapItoAsize - 1; - GLuint i; - for (i=0;i<n;i++) { - r[i] = ctx->Pixel.MapItoR[index[i] & rmask]; - g[i] = ctx->Pixel.MapItoG[index[i] & gmask]; - b[i] = ctx->Pixel.MapItoB[index[i] & bmask]; - a[i] = ctx->Pixel.MapItoA[index[i] & amask]; - } -} - - - -void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, - GLstencil stencil[] ) +void +_mesa_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, + GLstencil stencil[] ) { GLuint i; GLint shift = ctx->Pixel.IndexShift; @@ -901,8 +1067,8 @@ void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, } - -void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) +void +_mesa_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) { GLuint mask = ctx->Pixel.MapStoSsize - 1; GLuint i; @@ -910,4 +1076,3 @@ void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ]; } } - diff --git a/xc/extras/Mesa/src/points.c b/xc/extras/Mesa/src/points.c index 48866230f..77d1e0de0 100644 --- a/xc/extras/Mesa/src/points.c +++ b/xc/extras/Mesa/src/points.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -53,10 +53,12 @@ _mesa_PointSize( GLfloat size ) return; } - if (ctx->Point.Size != size) { - ctx->Point.Size = size; + if (ctx->Point.UserSize != size) { + ctx->Point.UserSize = size; + ctx->Point.Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); ctx->TriangleCaps &= ~DD_POINT_SIZE; - if (size != 1.0) ctx->TriangleCaps |= DD_POINT_SIZE; + if (size != 1.0) + ctx->TriangleCaps |= DD_POINT_SIZE; ctx->NewState |= NEW_RASTER_OPS; } } @@ -145,20 +147,21 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) /* * CI points with size == 1.0 */ -static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLfloat *win; GLint *pbx = PB->x, *pby = PB->y; GLdepth *pbz = PB->z; - GLuint *pbi = PB->i; + GLuint *pbi = PB->index; GLuint pbcount = PB->count; GLuint i; win = &VB->Win.data[first][0]; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { pbx[pbcount] = (GLint) win[0]; pby[pbcount] = (GLint) win[1]; pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset); @@ -176,14 +179,15 @@ static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) /* * RGBA points with size == 1.0 */ -static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x, y, z; GLint red, green, blue, alpha; @@ -199,7 +203,7 @@ static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha ); } } - PB_CHECK_FLUSH(ctx,PB); + PB_CHECK_FLUSH(ctx, PB); } @@ -207,23 +211,23 @@ static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* * General CI points. */ -static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); + const GLint isize = (GLint) (ctx->Point.Size + 0.5F); GLint radius = isize >> 1; + GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; GLint ix, iy; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); if (isize & 1) { /* odd size */ @@ -240,10 +244,10 @@ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] ); + PB_SET_INDEX( PB, VB->IndexPtr->data[i] ); - for (iy=y0;iy<=y1;iy++) { - for (ix=x0;ix<=x1;ix++) { + for (iy = y0; iy <= y1; iy++) { + for (ix = x0; ix <= x1; ix++) { PB_WRITE_PIXEL( PB, ix, iy, z ); } } @@ -256,23 +260,23 @@ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) /* * General RGBA points. */ -static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); + GLint isize = (GLint) (ctx->Point.Size + 0.5F); GLint radius = isize >> 1; + GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; GLint ix, iy; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); if (isize & 1) { /* odd size */ @@ -289,14 +293,14 @@ static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_COLOR( ctx, PB, + PB_SET_COLOR( PB, VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][2], VB->ColorPtr->data[i][3] ); - for (iy=y0;iy<=y1;iy++) { - for (ix=x0;ix<=x1;ix++) { + for (iy = y0; iy <= y1; iy++) { + for (ix = x0; ix <= x1; ix++) { PB_WRITE_PIXEL( PB, ix, iy, z ); } } @@ -311,28 +315,26 @@ static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* * Textured RGBA points. */ -static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; - GLint ix, iy; - GLint isize, radius; + GLint ix, iy, radius; GLint red, green, blue, alpha; GLfloat s, t, u; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint isize = (GLint) (ctx->Point.Size + 0.5F); - isize = (GLint) - (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); - if (isize<1) { + if (isize < 1) { isize = 1; } radius = isize >> 1; @@ -388,12 +390,12 @@ static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) PB_SET_COLOR( red, green, blue, alpha ); */ - for (iy=y0;iy<=y1;iy++) { - for (ix=x0;ix<=x1;ix++) { + for (iy = y0; iy <= y1; iy++) { + for (ix = x0; ix <= x1; ix++) { PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u ); } } - PB_CHECK_FLUSH(ctx,PB); + PB_CHECK_FLUSH(ctx, PB); } } } @@ -402,29 +404,28 @@ static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* * Multitextured RGBA points. */ -static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; GLint ix, iy; - GLint isize, radius; + GLint radius; GLint red, green, blue, alpha; GLfloat s, t, u; GLfloat s1, t1, u1; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint isize = (GLint) (ctx->Point.Size + 0.5F); - isize = (GLint) - (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); - if (isize<1) { + if (isize < 1) { isize = 1; } radius = isize >> 1; @@ -505,10 +506,11 @@ static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last for (iy=y0;iy<=y1;iy++) { for (ix=x0;ix<=x1;ix++) { - PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u, s1, t1, u1 ); + PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, + s, t, u, s1, t1, u1 ); } } - PB_CHECK_FLUSH(ctx,PB); + PB_CHECK_FLUSH(ctx, PB); } } } @@ -519,35 +521,32 @@ static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last /* * Antialiased points with or without texture mapping. */ -static void antialiased_rgba_points( GLcontext *ctx, - GLuint first, GLuint last ) +static void +antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; + const GLfloat radius = ctx->Point.Size * 0.5F; + const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ + const GLfloat rmax = radius + 0.7071F; + const GLfloat rmin2 = rmin * rmin; + const GLfloat rmax2 = rmax * rmax; + const GLfloat cscale = 256.0F / (rmax2 - rmin2); GLuint i; - GLfloat radius, rmin, rmax, rmin2, rmax2, cscale; - - radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F; - rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ - rmax = radius + 0.7071F; - rmin2 = rmin*rmin; - rmax2 = rmax*rmax; - cscale = 256.0F / (rmax2-rmin2); if (ctx->Texture.ReallyEnabled) { - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint xmin, ymin, xmax, ymax; - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { + GLint x, y; GLint red, green, blue, alpha; GLfloat s, t, u; GLfloat s1, t1, u1; - xmin = (GLint) (VB->Win.data[i][0] - radius); - xmax = (GLint) (VB->Win.data[i][0] + radius); - ymin = (GLint) (VB->Win.data[i][1] - radius); - ymax = (GLint) (VB->Win.data[i][1] + radius); - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint xmin = (GLint) (VB->Win.data[i][0] - radius); + GLint xmax = (GLint) (VB->Win.data[i][0] + radius); + GLint ymin = (GLint) (VB->Win.data[i][1] - radius); + GLint ymax = (GLint) (VB->Win.data[i][1] + radius); + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); red = VB->ColorPtr->data[i][0]; green = VB->ColorPtr->data[i][1]; @@ -690,7 +689,8 @@ static void antialiased_rgba_points( GLcontext *ctx, /* * Null rasterizer for measuring transformation speed. */ -static void null_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +null_points( GLcontext *ctx, GLuint first, GLuint last ) { (void) ctx; (void) first; @@ -704,35 +704,36 @@ static void null_points( GLcontext *ctx, GLuint first, GLuint last ) /* Calculates the distance attenuation formula of a vector of points in * eye space coordinates */ -static void dist3(GLfloat *out, GLuint first, GLuint last, - const GLcontext *ctx, const GLvector4f *v) +static void +dist3(GLfloat *out, GLuint first, GLuint last, + const GLcontext *ctx, const GLvector4f *v) { GLuint stride = v->stride; - GLfloat *p = VEC_ELT(v, GLfloat, first); + const GLfloat *p = VEC_ELT(v, GLfloat, first); GLuint i; - for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) - { + for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) { GLfloat dist = GL_SQRT(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]); - out[i] = 1/(ctx->Point.Params[0]+ - dist * (ctx->Point.Params[1] + - dist * ctx->Point.Params[2])); + out[i] = 1.0F / (ctx->Point.Params[0] + + dist * (ctx->Point.Params[1] + + dist * ctx->Point.Params[2])); } } -static void dist2(GLfloat *out, GLuint first, GLuint last, - const GLcontext *ctx, const GLvector4f *v) + +static void +dist2(GLfloat *out, GLuint first, GLuint last, + const GLcontext *ctx, const GLvector4f *v) { GLuint stride = v->stride; - GLfloat *p = VEC_ELT(v, GLfloat, first); + const GLfloat *p = VEC_ELT(v, GLfloat, first); GLuint i; - for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) - { + for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) { GLfloat dist = GL_SQRT(p[0]*p[0]+p[1]*p[1]); - out[i] = 1/(ctx->Point.Params[0]+ - dist * (ctx->Point.Params[1] + - dist * ctx->Point.Params[2])); + out[i] = 1.0F / (ctx->Point.Params[0] + + dist * (ctx->Point.Params[1] + + dist * ctx->Point.Params[2])); } } @@ -750,8 +751,9 @@ static dist_func eye_dist_tab[5] = { }; -static void clip_dist(GLfloat *out, GLuint first, GLuint last, - const GLcontext *ctx, GLvector4f *clip) +static void +clip_dist(GLfloat *out, GLuint first, GLuint last, + const GLcontext *ctx, GLvector4f *clip) { /* this is never called */ gl_problem(NULL, "clip_dist() called - dead code!\n"); @@ -782,15 +784,14 @@ static void clip_dist(GLfloat *out, GLuint first, GLuint last, /* * Distance Attenuated General CI points. */ -static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, - GLuint last ) +static void +dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLfloat psize,dsize; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -799,20 +800,19 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; GLint isize, radius; + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLfloat dsize = psize * dist[i]; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); - - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); - } else { - isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F); + if (dsize >= ctx->Point.Threshold) { + isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F); + } + else { + isize = (GLint) (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) + 0.5F); } radius = isize >> 1; @@ -831,7 +831,7 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, y1 = y0 + isize - 1; } - PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] ); + PB_SET_INDEX( PB, VB->IndexPtr->data[i] ); for (iy=y0;iy<=y1;iy++) { for (ix=x0;ix<=x1;ix++) { @@ -846,16 +846,14 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, /* * Distance Attenuated General RGBA points. */ -static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, - GLuint last ) +static void +dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLubyte alpha; - GLfloat psize,dsize; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -864,15 +862,15 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; GLint isize, radius; + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLfloat dsize=psize*dist[i]; + GLubyte alpha; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); - dsize=psize*dist[i]; if (dsize >= ctx->Point.Threshold) { isize = (GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); alpha = VB->ColorPtr->data[i][3]; @@ -899,7 +897,7 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, y1 = y0 + isize - 1; } - PB_SET_COLOR( ctx, PB, + PB_SET_COLOR( PB, VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][2], @@ -918,15 +916,14 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, /* * Distance Attenuated Textured RGBA points. */ -static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, - GLuint last ) +static void +dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLfloat psize,dsize; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -935,7 +932,6 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; GLint isize, radius; @@ -943,21 +939,22 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLfloat s, t, u; GLfloat s1, t1, u1; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); - alpha=VB->ColorPtr->data[i][3]; - } else { - isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F); - dsize/=ctx->Point.Threshold; - alpha = (GLint) (VB->ColorPtr->data[i][3]* (dsize*dsize)); + GLfloat dsize = psize*dist[i]; + if(dsize >= ctx->Point.Threshold) { + isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F); + alpha = VB->ColorPtr->data[i][3]; + } + else { + isize = (GLint) (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) + 0.5F); + dsize /= ctx->Point.Threshold; + alpha = (GLint) (VB->ColorPtr->data[i][3] * (dsize * dsize)); } - if (isize<1) { + if (isize < 1) { isize = 1; } radius = isize >> 1; @@ -1066,16 +1063,14 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, /* * Distance Attenuated Antialiased points with or without texture mapping. */ -static void dist_atten_antialiased_rgba_points( GLcontext *ctx, - GLuint first, GLuint last ) +static void +dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLfloat radius, rmin, rmax, rmin2, rmax2, cscale; - GLfloat psize,dsize,alphaf; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -1085,20 +1080,22 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, if (ctx->Texture.ReallyEnabled) { for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { + GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf; GLint xmin, ymin, xmax, ymax; GLint x, y, z; GLint red, green, blue, alpha; GLfloat s, t, u; GLfloat s1, t1, u1; + GLfloat dsize = psize * dist[i]; - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F); - alphaf=1.0; - } else { - radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F); - dsize/=ctx->Point.Threshold; - alphaf=(dsize*dsize); + if (dsize >= ctx->Point.Threshold) { + radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F; + alphaf = 1.0F; + } + else { + radius = (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) * 0.5F); + dsize /= ctx->Point.Threshold; + alphaf = (dsize*dsize); } rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ rmax = radius + 0.7071F; @@ -1180,23 +1177,25 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, } } - for (y=ymin;y<=ymax;y++) { - for (x=xmin;x<=xmax;x++) { + for (y = ymin; y <= ymax; y++) { + for (x = xmin; x <= xmax; x++) { GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0]; GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1]; GLfloat dist2 = dx*dx + dy*dy; - if (dist2<rmax2) { + if (dist2 < rmax2) { alpha = VB->ColorPtr->data[i][3]; - if (dist2>=rmin2) { - GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale); + if (dist2 >= rmin2) { + GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale); /* coverage is in [0,256] */ alpha = (alpha * coverage) >> 8; } alpha = (GLint) (alpha * alphaf); if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) { - PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u, s1, t1, u1 ); + PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, + alpha, s, t, u, s1, t1, u1 ); } else { - PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u ); + PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, + s, t, u ); } } } @@ -1207,26 +1206,28 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, } else { /* Not texture mapped */ - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { + GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf; GLint xmin, ymin, xmax, ymax; GLint x, y, z; GLint red, green, blue, alpha; + GLfloat dsize = psize * dist[i]; - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F); - alphaf=1.0; - } else { - radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F); - dsize/=ctx->Point.Threshold; - alphaf=(dsize*dsize); + if (dsize >= ctx->Point.Threshold) { + radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F; + alphaf = 1.0F; + } + else { + radius = (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) * 0.5F); + dsize /= ctx->Point.Threshold; + alphaf = dsize * dsize; } rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ rmax = radius + 0.7071F; - rmin2 = rmin*rmin; - rmax2 = rmax*rmax; - cscale = 256.0F / (rmax2-rmin2); + rmin2 = rmin * rmin; + rmax2 = rmax * rmax; + cscale = 256.0F / (rmax2 - rmin2); xmin = (GLint) (VB->Win.data[i][0] - radius); xmax = (GLint) (VB->Win.data[i][0] + radius); @@ -1238,21 +1239,20 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, green = VB->ColorPtr->data[i][1]; blue = VB->ColorPtr->data[i][2]; - for (y=ymin;y<=ymax;y++) { - for (x=xmin;x<=xmax;x++) { + for (y = ymin; y <= ymax; y++) { + for (x = xmin; x <= xmax; x++) { GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0]; GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1]; - GLfloat dist2 = dx*dx + dy*dy; - if (dist2<rmax2) { + GLfloat dist2 = dx * dx + dy * dy; + if (dist2 < rmax2) { alpha = VB->ColorPtr->data[i][3]; - if (dist2>=rmin2) { - GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale); + if (dist2 >= rmin2) { + GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale); /* coverage is in [0,256] */ alpha = (alpha * coverage) >> 8; } alpha = (GLint) (alpha * alphaf); - PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha ) - ; + PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha); } } } @@ -1263,6 +1263,43 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, } +#ifdef DEBUG +void +_mesa_print_points_function(GLcontext *ctx) +{ + printf("Point Func == "); + if (ctx->Driver.PointsFunc == size1_ci_points) + printf("size1_ci_points\n"); + else if (ctx->Driver.PointsFunc == size1_rgba_points) + printf("size1_rgba_points\n"); + else if (ctx->Driver.PointsFunc == general_ci_points) + printf("general_ci_points\n"); + else if (ctx->Driver.PointsFunc == general_rgba_points) + printf("general_rgba_points\n"); + else if (ctx->Driver.PointsFunc == textured_rgba_points) + printf("textured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == multitextured_rgba_points) + printf("multitextured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == antialiased_rgba_points) + printf("antialiased_rgba_points\n"); + else if (ctx->Driver.PointsFunc == null_points) + printf("null_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_general_ci_points) + printf("dist_atten_general_ci_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_general_rgba_points) + printf("dist_atten_general_rgba_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_textured_rgba_points) + printf("dist_atten_textured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_antialiased_rgba_points) + printf("dist_atten_antialiased_rgba_points\n"); + else if (!ctx->Driver.PointsFunc) + printf("NULL\n"); + else + printf("Driver func %p\n", ctx->Driver.PointsFunc); +} +#endif + + /* * Examine the current context to determine which point drawing function * should be used. @@ -1331,5 +1368,6 @@ void gl_set_point_function( GLcontext *ctx ) ctx->Driver.PointsFunc = gl_select_points; } + /*_mesa_print_points_function(ctx);*/ } diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c index a1e01f0fd..4f4ad90a3 100644 --- a/xc/extras/Mesa/src/readpix.c +++ b/xc/extras/Mesa/src/readpix.c @@ -75,14 +75,14 @@ static void read_index_pixels( GLcontext *ctx, (*ctx->Driver.ReadCI32Span)( ctx, readWidth, x, y, index ); if (ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0) { - gl_shift_and_offset_ci( ctx, readWidth, index); + _mesa_shift_and_offset_ci( ctx, readWidth, index); } if (ctx->Pixel.MapColorFlag) { - gl_map_ci(ctx, readWidth, index); + _mesa_map_ci(ctx, readWidth, index); } - dest = gl_pixel_addr_in_image(packing, pixels, + dest = _mesa_image_address(packing, pixels, width, height, GL_COLOR_INDEX, type, 0, j, 0); switch (type) { @@ -109,7 +109,7 @@ static void read_index_pixels( GLcontext *ctx, dst[i] = (GLushort) index[i]; } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, readWidth ); + _mesa_swap2( (GLushort *) dst, readWidth ); } } break; @@ -120,7 +120,7 @@ static void read_index_pixels( GLcontext *ctx, dst[i] = (GLshort) index[i]; } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, readWidth ); + _mesa_swap2( (GLushort *) dst, readWidth ); } } break; @@ -131,7 +131,7 @@ static void read_index_pixels( GLcontext *ctx, dst[i] = (GLuint) index[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -142,7 +142,7 @@ static void read_index_pixels( GLcontext *ctx, dst[i] = (GLint) index[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -153,7 +153,7 @@ static void read_index_pixels( GLcontext *ctx, dst[i] = (GLfloat) index[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -199,36 +199,30 @@ static void read_depth_pixels( GLcontext *ctx, bias_or_scale = ctx->Pixel.DepthBias!=0.0 || ctx->Pixel.DepthScale!=1.0; - if (type==GL_UNSIGNED_SHORT && sizeof(GLdepth)==sizeof(GLushort) + if (type==GL_UNSIGNED_SHORT && ctx->Visual->DepthBits == 16 && !bias_or_scale && !packing->SwapBytes) { /* Special case: directly read 16-bit unsigned depth values. */ for (j=0;j<height;j++,y++) { - GLushort *dst = (GLushort*) gl_pixel_addr_in_image( packing, pixels, + GLdepth depth[MAX_WIDTH]; + GLushort *dst = (GLushort*) _mesa_image_address( packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); - (*ctx->Driver.ReadDepthSpan)( ctx, width, x, y, (GLdepth*) dst); + GLint i; + _mesa_read_depth_span(ctx, width, x, y, depth); + for (i = 0; i < width; i++) + dst[i] = depth[i]; } } - else if (type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint) + else if (type==GL_UNSIGNED_INT && ctx->Visual->DepthBits == 32 && !bias_or_scale && !packing->SwapBytes) { /* Special case: directly read 32-bit unsigned depth values. */ - /* Compute shift value to scale depth values up to 32-bit uints. */ - GLuint shift = 0; - GLuint max = MAX_DEPTH; - while ((max&0x80000000)==0) { - max = max << 1; - shift++; - } for (j=0;j<height;j++,y++) { - GLuint *dst = (GLuint *) gl_pixel_addr_in_image( packing, pixels, + GLdepth *dst = (GLdepth *) _mesa_image_address( packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0 ); - (*ctx->Driver.ReadDepthSpan)( ctx, width, x, y, (GLdepth*) dst); - for (i=0;i<width;i++) { - dst[i] = dst[i] << shift; - } + _mesa_read_depth_span(ctx, width, x, y, dst); } } else { - /* General case (slow) */ + /* General case (slower) */ for (j=0;j<height;j++,y++) { GLfloat depth[MAX_WIDTH]; GLvoid *dest; @@ -243,7 +237,7 @@ static void read_depth_pixels( GLcontext *ctx, } } - dest = gl_pixel_addr_in_image(packing, pixels, + dest = _mesa_image_address(packing, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, j, 0); switch (type) { @@ -270,7 +264,7 @@ static void read_depth_pixels( GLcontext *ctx, dst[i] = FLOAT_TO_USHORT( depth[i] ); } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, readWidth ); + _mesa_swap2( (GLushort *) dst, readWidth ); } } break; @@ -281,7 +275,7 @@ static void read_depth_pixels( GLcontext *ctx, dst[i] = FLOAT_TO_SHORT( depth[i] ); } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, readWidth ); + _mesa_swap2( (GLushort *) dst, readWidth ); } } break; @@ -292,7 +286,7 @@ static void read_depth_pixels( GLcontext *ctx, dst[i] = FLOAT_TO_UINT( depth[i] ); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -303,7 +297,7 @@ static void read_depth_pixels( GLcontext *ctx, dst[i] = FLOAT_TO_INT( depth[i] ); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -314,7 +308,7 @@ static void read_depth_pixels( GLcontext *ctx, dst[i] = depth[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -364,17 +358,17 @@ static void read_stencil_pixels( GLcontext *ctx, GLvoid *dest; GLstencil stencil[MAX_WIDTH]; - gl_read_stencil_span( ctx, readWidth, x, y, stencil ); + _mesa_read_stencil_span( ctx, readWidth, x, y, stencil ); if (shift_or_offset) { - gl_shift_and_offset_stencil( ctx, readWidth, stencil ); + _mesa_shift_and_offset_stencil( ctx, readWidth, stencil ); } if (ctx->Pixel.MapStencilFlag) { - gl_map_stencil( ctx, readWidth, stencil ); + _mesa_map_stencil( ctx, readWidth, stencil ); } - dest = gl_pixel_addr_in_image( packing, pixels, + dest = _mesa_image_address( packing, pixels, width, height, GL_STENCIL_INDEX, type, 0, j, 0 ); switch (type) { @@ -407,7 +401,7 @@ static void read_stencil_pixels( GLcontext *ctx, dst[i] = (GLushort) stencil[i]; } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, readWidth ); + _mesa_swap2( (GLushort *) dst, readWidth ); } } break; @@ -418,7 +412,7 @@ static void read_stencil_pixels( GLcontext *ctx, dst[i] = (GLshort) stencil[i]; } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, readWidth ); + _mesa_swap2( (GLushort *) dst, readWidth ); } } break; @@ -429,7 +423,7 @@ static void read_stencil_pixels( GLcontext *ctx, dst[i] = (GLuint) stencil[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -440,7 +434,7 @@ static void read_stencil_pixels( GLcontext *ctx, *dst++ = (GLint) stencil[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -451,7 +445,7 @@ static void read_stencil_pixels( GLcontext *ctx, dst[i] = (GLfloat) stencil[i]; } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, readWidth ); + _mesa_swap4( (GLuint *) dst, readWidth ); } } break; @@ -506,8 +500,19 @@ read_fast_rgba_pixels( GLcontext *ctx, GLvoid *pixels, const struct gl_pixelstore_attrib *packing ) { - /* can't do scale, bias or mapping */ - if (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag) + GLboolean applyTransferOps; + + applyTransferOps = ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled; + + /* can't do scale, bias, mapping, etc */ + if (applyTransferOps) return GL_FALSE; /* can't do fancy pixel packing */ @@ -564,9 +569,9 @@ read_fast_rgba_pixels( GLcontext *ctx, for (row=0; row<readHeight; row++) { (*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, (GLubyte (*)[4]) dest); - if (ctx->Visual->SoftwareAlpha) { - gl_read_alpha_span(ctx, readWidth, srcX, srcY, - (GLubyte (*)[4]) dest); + if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) { + _mesa_read_alpha_span(ctx, readWidth, srcX, srcY, + (GLubyte (*)[4]) dest); } dest += rowLength * 4; srcY++; @@ -633,7 +638,7 @@ static void read_rgba_pixels( GLcontext *ctx, return; } - if (!gl_is_legal_format_and_type(format, type)) { + if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_OPERATION, "glReadPixels(format or type)"); return; } @@ -646,14 +651,15 @@ static void read_rgba_pixels( GLcontext *ctx, gl_read_rgba_span( ctx, ctx->ReadBuffer, readWidth, x, y, rgba ); - dest = gl_pixel_addr_in_image( packing, pixels, width, height, - format, type, 0, j, 0); + dest = _mesa_image_address( packing, pixels, width, height, + format, type, 0, j, 0); - gl_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, - format, type, dest, packing, GL_TRUE ); + _mesa_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, + format, type, dest, packing, GL_TRUE ); } } else { + /* Convert color index pixels to RGBA */ GLint j; for (j=0;j<height;j++,y++) { GLubyte rgba[MAX_WIDTH][4]; @@ -663,16 +669,16 @@ static void read_rgba_pixels( GLcontext *ctx, (*ctx->Driver.ReadCI32Span)( ctx, readWidth, x, y, index ); if (ctx->Pixel.IndexShift!=0 || ctx->Pixel.IndexOffset!=0) { - gl_map_ci( ctx, readWidth, index ); + _mesa_map_ci( ctx, readWidth, index ); } - gl_map_ci_to_rgba(ctx, readWidth, index, rgba ); + _mesa_map_ci_to_rgba_ubyte(ctx, readWidth, index, rgba ); - dest = gl_pixel_addr_in_image( packing, pixels, width, height, - format, type, 0, j, 0); + dest = _mesa_image_address( packing, pixels, width, height, + format, type, 0, j, 0); - gl_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, - format, type, dest, packing, GL_TRUE ); + _mesa_pack_rgba_span( ctx, readWidth, (const GLubyte (*)[4]) rgba, + format, type, dest, packing, GL_TRUE ); } } @@ -693,15 +699,20 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, return; } + if (ctx->Driver.ReadPixels && + (*ctx->Driver.ReadPixels)(ctx, x, y, width, height, + format, type, &ctx->Pack, pixels)) + return; + switch (format) { case GL_COLOR_INDEX: - read_index_pixels( ctx, x, y, width, height, type, pixels, &ctx->Pack ); + read_index_pixels(ctx, x, y, width, height, type, pixels, &ctx->Pack); break; case GL_STENCIL_INDEX: - read_stencil_pixels( ctx, x, y, width, height, type, pixels, &ctx->Pack ); + read_stencil_pixels(ctx, x,y, width,height, type, pixels, &ctx->Pack); break; case GL_DEPTH_COMPONENT: - read_depth_pixels( ctx, x, y, width, height, type, pixels, &ctx->Pack ); + read_depth_pixels(ctx, x, y, width, height, type, pixels, &ctx->Pack); break; case GL_RED: case GL_GREEN: @@ -714,7 +725,8 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, case GL_BGR: case GL_BGRA: case GL_ABGR_EXT: - read_rgba_pixels( ctx, x, y, width, height, format, type, pixels, &ctx->Pack ); + read_rgba_pixels(ctx, x, y, width, height, + format, type, pixels, &ctx->Pack); break; default: gl_error( ctx, GL_INVALID_ENUM, "glReadPixels(format)" ); diff --git a/xc/extras/Mesa/src/span.c b/xc/extras/Mesa/src/span.c index 38f4449f1..598834047 100644 --- a/xc/extras/Mesa/src/span.c +++ b/xc/extras/Mesa/src/span.c @@ -148,10 +148,10 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n, /* make copy of incoming indexes */ MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, indexTmp, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, indexTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, indexTmp ); + _mesa_mask_index_span( ctx, n, x, y, indexTmp ); } (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask ); } @@ -176,6 +176,7 @@ void gl_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], GLuint indexIn[], GLenum primitive ) { + 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 */ @@ -189,7 +190,7 @@ void gl_write_index_span( GLcontext *ctx, } } - if ((primitive==GL_BITMAP && ctx->MutablePixels) + if ((primitive==GL_BITMAP && (ctx->RasterMask & modBits)) || (ctx->RasterMask & MULTI_DRAW_BIT)) { /* Make copy of color indexes */ MEMCPY( indexBackup, indexIn, n * sizeof(GLuint) ); @@ -218,7 +219,7 @@ void gl_write_index_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } } @@ -227,6 +228,9 @@ void gl_write_index_span( GLcontext *ctx, 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->RasterMask & MULTI_DRAW_BIT) { /* draw to zero or two or more buffers */ multi_write_index_span( ctx, n, x, y, index, mask ); @@ -234,10 +238,10 @@ void gl_write_index_span( GLcontext *ctx, else { /* normal situation: draw to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, index, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, index, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, index ); + _mesa_mask_index_span( ctx, n, x, y, index ); } /* write pixels */ @@ -278,7 +282,7 @@ void gl_write_monoindex_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } } @@ -287,6 +291,9 @@ void gl_write_monoindex_span( GLcontext *ctx, 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; @@ -305,11 +312,11 @@ void gl_write_monoindex_span( GLcontext *ctx, } if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, indexes, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, indexes ); + _mesa_mask_index_span( ctx, n, x, y, indexes ); } if (ctx->RasterMask & MULTI_DRAW_BIT) { @@ -319,10 +326,10 @@ void gl_write_monoindex_span( GLcontext *ctx, else { /* normal situation: draw to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_span( ctx, n, x, y, indexes, mask ); + _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_span( ctx, n, x, y, indexes ); + _mesa_mask_index_span( ctx, n, x, y, indexes ); } (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask ); } @@ -386,20 +393,20 @@ static void multi_write_rgba_span( GLcontext *ctx, GLuint n, MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLubyte) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgbaTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgbaTmp ); + _mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp ); } (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4]) rgbaTmp, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, - (const GLubyte (*)[4])rgbaTmp, mask ); + _mesa_write_alpha_span( ctx, n, x, y, + (const GLubyte (*)[4])rgbaTmp, mask ); } } } @@ -415,6 +422,8 @@ void gl_write_rgba_span( GLcontext *ctx, GLubyte rgbaIn[][4], GLenum primitive ) { + const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | + LOGIC_OP_BIT | TEXTURE_BIT; GLubyte mask[MAX_WIDTH]; GLboolean write_all = GL_TRUE; GLubyte rgbaBackup[MAX_WIDTH][4]; @@ -431,7 +440,7 @@ void gl_write_rgba_span( GLcontext *ctx, write_all = GL_FALSE; } - if ((primitive==GL_BITMAP && ctx->MutablePixels) + if ((primitive==GL_BITMAP && (ctx->RasterMask & modBits)) || (ctx->RasterMask & MULTI_DRAW_BIT)) { /* must make a copy of the colors since they may be modified */ MEMCPY( rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte) ); @@ -470,7 +479,7 @@ void gl_write_rgba_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -486,6 +495,9 @@ void gl_write_rgba_span( GLcontext *ctx, } } + /* if we get here, something passed the depth test */ + ctx->OcclusionResult = GL_TRUE; + if (ctx->RasterMask & MULTI_DRAW_BIT) { multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, @@ -495,7 +507,7 @@ void gl_write_rgba_span( GLcontext *ctx, /* normal: write to exactly one buffer */ /* logic op or blending */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgba, mask ); @@ -503,7 +515,7 @@ void gl_write_rgba_span( GLcontext *ctx, /* Color component masking */ if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } /* write pixels */ @@ -512,9 +524,9 @@ void gl_write_rgba_span( GLcontext *ctx, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, - (const GLubyte (*)[4]) rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, + (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } } @@ -580,7 +592,7 @@ void gl_write_monocolor_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -596,6 +608,9 @@ void gl_write_monocolor_span( GLcontext *ctx, } } + /* if we get here, something passed the depth test */ + ctx->OcclusionResult = GL_TRUE; + if (ctx->Color.DrawBuffer == GL_NONE) { /* write no pixels */ return; @@ -617,7 +632,7 @@ void gl_write_monocolor_span( GLcontext *ctx, else { /* normal: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_span( ctx, n, x, y, rgba, mask ); @@ -625,7 +640,7 @@ void gl_write_monocolor_span( GLcontext *ctx, /* Color component masking */ if (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } /* write pixels */ @@ -633,9 +648,9 @@ void gl_write_monocolor_span( GLcontext *ctx, (const GLubyte (*)[4]) rgba, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, - (const GLubyte (*)[4]) rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, + (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } } } @@ -658,8 +673,8 @@ void gl_write_monocolor_span( GLcontext *ctx, else { (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_mono_alpha_span( ctx, n, x, y, (GLubyte) color[ACOMP], - write_all ? Null : mask ); + _mesa_write_mono_alpha_span( ctx, n, x, y, (GLubyte) color[ACOMP], + write_all ? Null : mask ); } } } @@ -724,7 +739,7 @@ void gl_write_texture_span( GLcontext *ctx, if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) { /* must make a copy of the colors since they may be modified */ - MEMCPY(rgbaBackup, rgbaIn, 4 * sizeof(GLubyte)); + MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte)); rgba = rgbaBackup; } else { @@ -732,7 +747,7 @@ void gl_write_texture_span( GLcontext *ctx, } /* Texture */ - ASSERT(ctx->Texture.Enabled); + ASSERT(ctx->Texture.ReallyEnabled); gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba ); /* Add base and specular colors */ @@ -769,7 +784,7 @@ void gl_write_texture_span( GLcontext *ctx, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -785,6 +800,9 @@ void gl_write_texture_span( GLcontext *ctx, } } + /* if we get here, something passed the depth test */ + ctx->OcclusionResult = GL_TRUE; + if (ctx->RasterMask & MULTI_DRAW_BIT) { multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, write_all ? Null : mask ); @@ -792,20 +810,20 @@ void gl_write_texture_span( GLcontext *ctx, else { /* normal: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _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 (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } } } @@ -848,7 +866,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) { /* must make a copy of the colors since they may be modified */ - MEMCPY(rgbaBackup, rgbaIn, 4 * sizeof(GLubyte)); + MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte)); rgba = rgbaBackup; } else { @@ -856,7 +874,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, } /* Texture */ - ASSERT(ctx->Texture.Enabled); + ASSERT(ctx->Texture.ReallyEnabled); ASSERT(texUnits <= MAX_TEXTURE_UNITS); for (i=0;i<texUnits;i++) { gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], lambda[i], rgba ); @@ -896,7 +914,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) { + if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) { return; } write_all = GL_FALSE; @@ -912,26 +930,30 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits, } } + /* if we get here, something passed the depth test */ + ctx->OcclusionResult = GL_TRUE; + if (ctx->RasterMask & MULTI_DRAW_BIT) { - multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, write_all ? Null : mask ); + multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, + write_all ? Null : mask ); } else { /* normal: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_span( ctx, n, x, y, rgba, mask ); + _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 (ctx->Color.SWmasking) { - gl_mask_rgba_span( ctx, n, x, y, rgba ); + _mesa_mask_rgba_span( ctx, n, x, y, rgba ); } (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba, write_all ? Null : mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, - write_all ? Null : mask ); + _mesa_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba, + write_all ? Null : mask ); } } } @@ -950,7 +972,7 @@ void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, || x + (GLint) n < 0 || x >= buffer->Width) { /* completely above, below, or right */ /* XXX maybe leave undefined? */ - MEMSET( rgba, 0, 4 * n * sizeof(GLubyte)); + BZERO(rgba, 4 * n * sizeof(GLubyte)); } else { GLint skip, length; @@ -982,8 +1004,8 @@ void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer, } (*ctx->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip ); - if (ctx->Visual->SoftwareAlpha) { - gl_read_alpha_span( ctx, length, x + skip, y, rgba + skip ); + if (buffer->UseSoftwareAlphaBuffers) { + _mesa_read_alpha_span( ctx, length, x + skip, y, rgba + skip ); } } } @@ -1001,7 +1023,7 @@ void gl_read_index_span( GLcontext *ctx, GLframebuffer *buffer, if (y < 0 || y >= buffer->Height || x + (GLint) n < 0 || x >= buffer->Width) { /* completely above, below, or right */ - MEMSET(indx, 0, n * sizeof(GLuint)); + BZERO(indx, n * sizeof(GLuint)); } else { GLint skip, length; diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c index b135a3df0..b678f1e91 100644 --- a/xc/extras/Mesa/src/state.c +++ b/xc/extras/Mesa/src/state.c @@ -63,6 +63,7 @@ #include "mmath.h" #include "pipeline.h" #include "pixel.h" +#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "quads.h" @@ -97,20 +98,17 @@ generic_noop(void) } +/* + * Set all pointers in the given dispatch table to point to a + * generic no-op function. + */ void -_mesa_init_no_op_table(struct _glapi_table *table) +_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize) { - /* Check to be sure the dispatcher's table is at least as big as Mesa's. */ - const GLuint size = sizeof(struct _glapi_table) / sizeof(void *); - assert(_glapi_get_dispatch_table_size() >= size); - - { - const GLuint n = _glapi_get_dispatch_table_size(); - GLuint i; - void **dispatch = (void **) table; - for (i = 0; i < n; i++) { - dispatch[i] = (void *) generic_noop; - } + GLuint i; + void **dispatch = (void **) table; + for (i = 0; i < tableSize; i++) { + dispatch[i] = (void *) generic_noop; } } @@ -120,10 +118,10 @@ _mesa_init_no_op_table(struct _glapi_table *table) * immediate-mode commands. */ void -_mesa_init_exec_table(struct _glapi_table *exec) +_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) { /* first initialize all dispatch slots to no-op */ - _mesa_init_no_op_table(exec); + _mesa_init_no_op_table(exec, tableSize); /* load the dispatch slots we understand */ exec->Accum = _mesa_Accum; @@ -471,7 +469,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->TexImage3D = _mesa_TexImage3D; exec->TexSubImage3D = _mesa_TexSubImage3D; - /* OpenGL 1.2 GL_ARB_imaging */ exec->BlendColor = _mesa_BlendColor; exec->BlendEquation = _mesa_BlendEquation; @@ -508,14 +505,53 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->ResetMinmax = _mesa_ResetMinmax; exec->SeparableFilter2D = _mesa_SeparableFilter2D; - /* GL_EXT_texture3d */ + /* 2. GL_EXT_blend_color */ +#if 0 + exec->BlendColorEXT = _mesa_BlendColorEXT; +#endif + + /* 3. GL_EXT_polygon_offset */ + exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; + + /* 6. GL_EXT_texture3d */ #if 0 exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D; exec->TexImage3DEXT = _mesa_TexImage3DEXT; exec->TexSubImage3DEXT = _mesa_TexSubImage3D; #endif - /* GL_EXT_paletted_texture */ + /* 11. GL_EXT_histogram */ + exec->GetHistogramEXT = _mesa_GetHistogram; + exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv; + exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv; + exec->GetMinmaxEXT = _mesa_GetMinmax; + exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv; + exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv; + + /* ?. GL_SGIX_pixel_texture */ + exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX; + + /* 15. GL_SGIS_pixel_texture */ + exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS; + exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS; + exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS; + exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS; + exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; + exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + + /* 37. GL_EXT_blend_minmax */ +#if 0 + exec->BlendEquationEXT = _mesa_BlendEquationEXT; +#endif + + /* 54. GL_EXT_point_parameters */ + exec->PointParameterfEXT = _mesa_PointParameterfEXT; + exec->PointParameterfvEXT = _mesa_PointParameterfvEXT; + + /* 77. GL_PGI_misc_hints */ + exec->HintPGI = _mesa_HintPGI; + + /* 78. GL_EXT_paletted_texture */ #if 0 exec->ColorTableEXT = _mesa_ColorTableEXT; exec->ColorSubTableEXT = _mesa_ColorSubTableEXT; @@ -524,31 +560,43 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; - /* GL_EXT_compiled_vertex_array */ + /* 97. GL_EXT_compiled_vertex_array */ exec->LockArraysEXT = _mesa_LockArraysEXT; exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; - /* GL_EXT_point_parameters */ - exec->PointParameterfEXT = _mesa_PointParameterfEXT; - exec->PointParameterfvEXT = _mesa_PointParameterfvEXT; - - /* GL_PGI_misc_hints */ - exec->HintPGI = _mesa_HintPGI; - - /* GL_EXT_polygon_offset */ - exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; + /* 173. GL_INGR_blend_func_separate */ + exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; - /* GL_EXT_blend_minmax */ -#if 0 - exec->BlendEquationEXT = _mesa_BlendEquationEXT; -#endif + /* 196. GL_MESA_resize_buffers */ + exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; - /* GL_EXT_blend_color */ -#if 0 - exec->BlendColorEXT = _mesa_BlendColorEXT; -#endif + /* 197. GL_MESA_window_pos */ + exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; + exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; + exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; + exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; + exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; + exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; + exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; + exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; + exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; + exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; + exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; + exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; + exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; + exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; + exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; + exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; + exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; + exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; + exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; + exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; + exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; + exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; + exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; + exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; - /* GL_ARB_multitexture */ + /* ARB 1. GL_ARB_multitexture */ exec->ActiveTextureARB = _mesa_ActiveTextureARB; exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB; exec->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB; @@ -584,46 +632,25 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB; exec->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB; - /* GL_INGR_blend_func_separate */ - exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; - - /* GL_MESA_window_pos */ - exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; - exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; - exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; - exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; - exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; - exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; - exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; - exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; - exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; - exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; - exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; - exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; - exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; - exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; - exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; - exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; - exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; - exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; - exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; - exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; - exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; - exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; - exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; - exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; - - /* GL_MESA_resize_buffers */ - exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; - - /* GL_ARB_transpose_matrix */ + /* ARB 3. GL_ARB_transpose_matrix */ exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB; exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB; exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB; exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB; + + /* ARB 12. GL_ARB_texture_compression */ + exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB; + exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB; + exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB; + exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB; + exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB; + exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB; + exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; + } + /**********************************************************************/ /***** State update logic *****/ /**********************************************************************/ @@ -778,8 +805,10 @@ static void update_rasterflags( GLcontext *ctx ) if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT; + if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT; - if (ctx->Visual->SoftwareAlpha && ctx->Color.ColorMask[ACOMP] + if (ctx->DrawBuffer->UseSoftwareAlphaBuffers + && ctx->Color.ColorMask[ACOMP] && ctx->Color.DrawBuffer != GL_NONE) ctx->RasterMask |= ALPHABUF_BIT; @@ -790,11 +819,14 @@ static void update_rasterflags( GLcontext *ctx ) ctx->RasterMask |= WINCLIP_BIT; } + if (ctx->Depth.OcclusionTest) + ctx->RasterMask |= OCCLUSION_BIT; + + /* If we're not drawing to exactly one color buffer set the * MULTI_DRAW_BIT flag. Also set it if we're drawing to no * buffers or the RGBA or CI mask disables all writes. */ - ctx->TriangleCaps &= ~DD_MULTIDRAW; if (ctx->Color.MultiDrawBuffer) { @@ -898,8 +930,7 @@ void gl_update_state( GLcontext *ctx ) ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1); for (i=0; i < MAX_TEXTURE_UNITS; i++) { - if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) - { + if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) { gl_matrix_analyze( &ctx->TextureMatrix[i] ); ctx->TextureMatrix[i].flags &= ~MAT_DIRTY_DEPENDENTS; @@ -913,7 +944,7 @@ void gl_update_state( GLcontext *ctx ) if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) { ctx->Texture.NeedNormals = GL_FALSE; gl_update_dirty_texobjs(ctx); - ctx->Enabled &= ~(ENABLE_TEXGEN0|ENABLE_TEXGEN1); + ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1); ctx->Texture.ReallyEnabled = 0; for (i=0; i < MAX_TEXTURE_UNITS; i++) { @@ -921,19 +952,17 @@ void gl_update_state( GLcontext *ctx ) gl_update_texture_unit( ctx, &ctx->Texture.Unit[i] ); ctx->Texture.ReallyEnabled |= - ctx->Texture.Unit[i].ReallyEnabled<<(i*4); + ctx->Texture.Unit[i].ReallyEnabled << (i * 4); if (ctx->Texture.Unit[i].GenFlags != 0) { ctx->Enabled |= ENABLE_TEXGEN0 << i; - if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS) - { + if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS) { ctx->Texture.NeedNormals = GL_TRUE; ctx->Texture.NeedEyeCoords = GL_TRUE; } - if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD) - { + if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD) { ctx->Texture.NeedEyeCoords = GL_TRUE; } } @@ -944,10 +973,9 @@ void gl_update_state( GLcontext *ctx ) ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); } - if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG)) { - + if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG | NEW_TEXTURE_ENABLE)) { - if (ctx->NewState & NEW_RASTER_OPS) { + if (ctx->NewState & (NEW_RASTER_OPS | NEW_TEXTURE_ENABLE)) { update_pixel_logic(ctx); update_pixel_masking(ctx); update_fog_mode(ctx); @@ -956,20 +984,7 @@ void gl_update_state( GLcontext *ctx ) (*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag ); } - /* Check if incoming colors can be modified during rasterization */ - if (ctx->Fog.Enabled || - ctx->Texture.Enabled || - ctx->Color.BlendEnabled || - ctx->Color.SWmasking || - ctx->Color.SWLogicOpEnabled) { - ctx->MutablePixels = GL_TRUE; - } - else { - ctx->MutablePixels = GL_FALSE; - } - /* update scissor region */ - ctx->DrawBuffer->Xmin = 0; ctx->DrawBuffer->Ymin = 0; ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1; @@ -1132,6 +1147,10 @@ void gl_update_state( GLcontext *ctx ) ctx->ModelProjectWinMatrixUptodate = 0; } + if (ctx->NewState & NEW_COLOR_MATRIX) { + gl_matrix_analyze( &ctx->ColorMatrix ); + } + /* Figure out whether we can light in object space or not. If we * can, find the current positions of the lights in object space */ diff --git a/xc/extras/Mesa/src/state.h b/xc/extras/Mesa/src/state.h index 1c1c29a6f..3b12f5dcc 100644 --- a/xc/extras/Mesa/src/state.h +++ b/xc/extras/Mesa/src/state.h @@ -30,6 +30,13 @@ #include "types.h" +extern void +_mesa_init_no_op_table(struct _glapi_table *exec, GLuint tableSize); + +extern void +_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize); + + extern void gl_update_state( GLcontext *ctx ); diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index 7248cbad9..0d25df6d8 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -49,6 +49,57 @@ */ +#ifdef DEBUG +static void PrintTexture(const struct gl_texture_image *img) +{ + int i, j, c; + GLubyte *data = img->Data; + + if (!data) { + printf("No texture data\n"); + return; + } + + switch (img->Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + case GL_COLOR_INDEX: + c = 1; + break; + case GL_LUMINANCE_ALPHA: + c = 2; + break; + case GL_RGB: + c = 3; + break; + case GL_RGBA: + c = 4; + break; + default: + gl_problem(NULL, "error in PrintTexture\n"); + return; + } + + + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { + if (c==1) + printf("%02x ", data[0]); + else if (c==2) + printf("%02x%02x ", data[0], data[1]); + else if (c==3) + 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; + } + printf("\n"); + } +} +#endif + + /* * Compute log base 2 of n. @@ -85,16 +136,24 @@ logbase2( int n ) * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. * Return -1 if invalid enum. */ -static GLint -decode_internal_format( GLint format ) +GLint +_mesa_base_tex_format( GLcontext *ctx, GLint format ) { switch (format) { + case GL_COMPRESSED_ALPHA_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; + case GL_COMPRESSED_LUMINANCE_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -102,6 +161,10 @@ decode_internal_format( GLint format ) case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; + case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: @@ -111,12 +174,31 @@ decode_internal_format( GLint format ) case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return GL_LUMINANCE_ALPHA; + case GL_COMPRESSED_INTENSITY_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; + case GL_COMPRESSED_RGB_ARB: + if (ctx && ctx->Extensions.HaveTextureCompression) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGB_FXT1_3DFX: + if (ctx && ctx->Extensions.HaveTextureCompressionFXT1) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + if (ctx && ctx->Extensions.HaveTextureCompressionS3TC) + return GL_RGB; + else + return -1; case 3: case GL_RGB: case GL_R3_G3_B2: @@ -127,6 +209,23 @@ decode_internal_format( GLint format ) case GL_RGB12: case GL_RGB16: return GL_RGB; + case GL_COMPRESSED_RGBA_ARB: + if (ctx && ctx->Extensions.HaveTextureCompression) + return GL_RGBA; + else + return -1; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + if (ctx && ctx->Extensions.HaveTextureCompressionFXT1) + return GL_RGBA; + else + return -1; + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + if (ctx && ctx->Extensions.HaveTextureCompressionS3TC) + return GL_RGBA; + else + return -1; case 4: case GL_RGBA: case GL_RGBA2: @@ -224,23 +323,30 @@ components_in_intformat( GLint format ) } - -struct gl_texture_image * -gl_alloc_texture_image( void ) -{ - return CALLOC_STRUCT(gl_texture_image); -} - - - -void -gl_free_texture_image( struct gl_texture_image *teximage ) +/* + * Return GL_TRUE if internalFormat is a compressed format, return GL_FALSE + * otherwise. + */ +static GLboolean +is_compressed_format(GLenum internalFormat) { - if (teximage->Data) { - FREE( teximage->Data ); - teximage->Data = NULL; + 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: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return GL_TRUE; + default: + return GL_FALSE; } - FREE( teximage ); } @@ -354,6 +460,217 @@ set_teximage_component_sizes( struct gl_texture_image *texImage ) } +static void +set_tex_image(struct gl_texture_object *tObj, + GLenum target, GLint level, + struct gl_texture_image *texImage) +{ + ASSERT(tObj); + ASSERT(texImage); + switch (target) { + case GL_TEXTURE_2D: + tObj->Image[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + tObj->Image[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + tObj->NegX[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + tObj->PosY[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + tObj->NegY[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + tObj->PosZ[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + tObj->NegZ[level] = texImage; + return; + default: + gl_problem(NULL, "bad target in set_tex_image()"); + return; + } +} + + +/* + * Return new gl_texture_image struct with all fields initialized to zero. + */ +struct gl_texture_image * +_mesa_alloc_texture_image( void ) +{ + return CALLOC_STRUCT(gl_texture_image); +} + + + +/* + * Initialize most fields of a gl_texture_image struct. + */ +static void +init_texture_image( struct gl_texture_image *img, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum internalFormat ) +{ + ASSERT(img); + ASSERT(!img->Data); + img->Format = (GLenum) _mesa_base_tex_format(NULL, internalFormat); + set_teximage_component_sizes( img ); + img->IntFormat = (GLenum) internalFormat; + img->Border = border; + img->Width = width; + img->Height = height; + img->Depth = depth; + img->WidthLog2 = logbase2(width - 2 * border); + if (height == 1) /* 1-D texture */ + img->HeightLog2 = 0; + else + img->HeightLog2 = logbase2(height - 2 * border); + if (depth == 1) /* 2-D texture */ + img->DepthLog2 = 0; + else + img->DepthLog2 = logbase2(depth - 2 * border); + img->Width2 = 1 << img->WidthLog2; + img->Height2 = 1 << img->HeightLog2; + img->Depth2 = 1 << img->DepthLog2; + img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); + img->IsCompressed = is_compressed_format(internalFormat); +} + + + +void +_mesa_free_texture_image( struct gl_texture_image *teximage ) +{ + if (teximage->Data) { + FREE( teximage->Data ); + teximage->Data = NULL; + } + FREE( teximage ); +} + + + +/* + * Return number of bytes of storage needed to store a compressed texture + * image. + */ +GLuint +_mesa_compressed_image_size(GLenum internalFormat, + GLint width, GLint height, GLint depth) +{ + return 0; +} + + + +/* + * Given a texture unit and a texture target, return the corresponding + * texture object. + */ +struct gl_texture_object * +_mesa_select_tex_object(GLcontext *ctx, struct gl_texture_unit *texUnit, + GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + return texUnit->CurrentD[1]; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D; + case GL_TEXTURE_2D: + return texUnit->CurrentD[2]; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D; + case GL_TEXTURE_3D: + return texUnit->CurrentD[3]; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D; + 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: + return ctx->Extensions.HaveTextureCubeMap + ? texUnit->CurrentCubeMap : NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.HaveTextureCubeMap + ? ctx->Texture.ProxyCubeMap : NULL; + default: + gl_problem(NULL, "bad target in _mesa_select_tex_object()"); + return NULL; + } +} + + +/* + * Return the texture image struct which corresponds to target and level + * for the given texture unit. + */ +struct gl_texture_image * +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level) +{ + ASSERT(texUnit); + switch (target) { + case GL_TEXTURE_1D: + return texUnit->CurrentD[1]->Image[level]; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D->Image[level]; + case GL_TEXTURE_2D: + return texUnit->CurrentD[2]->Image[level]; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D->Image[level]; + case GL_TEXTURE_3D: + return texUnit->CurrentD[3]->Image[level]; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D->Image[level]; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->Image[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->NegX[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->PosY[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->NegY[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->PosZ[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->NegZ[level]; + else + return NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return ctx->Texture.ProxyCubeMap->Image[level]; + else + return NULL; + default: + gl_problem(ctx, "bad target in _mesa_select_tex_image()"); + return NULL; + } +} + + + /* Need this to prevent an out-of-bounds memory access when using * X86 optimized code. */ @@ -366,68 +683,45 @@ set_teximage_component_sizes( struct gl_texture_image *texImage ) /* - * This is called by glTexImage[123]D in order to build a gl_texture_image - * object given the client's parameters and image data. - * - * NOTES: Width, height and depth should include the border. - * All texture image parameters should have already been error checked. + * Called by glTexImage[123]D. Fill in a texture image with data given + * by the client. All pixel transfer and unpack modes are handled here. + * NOTE: All texture image parameters should have already been error checked. */ -static struct gl_texture_image * -make_texture_image( GLcontext *ctx, GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, +static void +make_texture_image( GLcontext *ctx, + struct gl_texture_image *texImage, GLenum srcFormat, GLenum srcType, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpacking) { GLint components, numPixels; - struct gl_texture_image *texImage; - - assert(width > 0); - assert(height > 0); - assert(depth > 0); - assert(border == 0 || border == 1); - assert(pixels); - assert(unpacking); - - - /* - * Allocate and initialize the texture_image struct - */ - texImage = gl_alloc_texture_image(); - if (!texImage) - return NULL; - - texImage->Format = (GLenum) decode_internal_format(internalFormat); - set_teximage_component_sizes( texImage ); - texImage->IntFormat = (GLenum) internalFormat; - texImage->Border = border; - texImage->Width = width; - texImage->Height = height; - texImage->Depth = depth; - texImage->WidthLog2 = logbase2(width - 2 * border); - if (height == 1) /* 1-D texture */ - texImage->HeightLog2 = 0; - else - texImage->HeightLog2 = logbase2(height - 2 * border); - if (depth == 1) /* 2-D texture */ - texImage->DepthLog2 = 0; - else - texImage->DepthLog2 = logbase2(depth - 2 * border); - texImage->Width2 = 1 << texImage->WidthLog2; - texImage->Height2 = 1 << texImage->HeightLog2; - texImage->Depth2 = 1 << texImage->DepthLog2; - texImage->MaxLog2 = MAX2(texImage->WidthLog2, texImage->HeightLog2); - + GLint internalFormat, width, height, depth, border; + + ASSERT(ctx); + ASSERT(texImage); + ASSERT(!texImage->Data); + ASSERT(pixels); + ASSERT(unpacking); + + internalFormat = texImage->IntFormat; + width = texImage->Width; + height = texImage->Height; + depth = texImage->Depth; + border = texImage->Border; components = components_in_intformat(internalFormat); - numPixels = texImage->Width * texImage->Height * texImage->Depth; - texImage->Data = (GLubyte *) MALLOC(numPixels * components + EXTRA_BYTE); + ASSERT(width > 0); + ASSERT(height > 0); + ASSERT(depth > 0); + ASSERT(border == 0 || border == 1); + ASSERT(pixels); + ASSERT(unpacking); + ASSERT(components); - if (!texImage->Data) { - /* out of memory */ - gl_free_texture_image(texImage); - return NULL; - } + numPixels = width * height * depth; + texImage->Data = (GLubyte *) MALLOC(numPixels * components + EXTRA_BYTE); + if (!texImage->Data) + return; /* out of memory */ /* * OK, the texture image struct has been initialized and the texture @@ -441,15 +735,18 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, && !ctx->Pixel.IndexOffset && !ctx->Pixel.IndexShift && srcType == GL_UNSIGNED_BYTE && depth == 1) { - if (srcFormat == internalFormat) { + if (srcFormat == internalFormat || + (srcFormat == GL_LUMINANCE && internalFormat == 1) || + (srcFormat == GL_LUMINANCE_ALPHA && internalFormat == 2) || + (srcFormat == GL_RGB && internalFormat == 3) || + (srcFormat == GL_RGBA && internalFormat == 4)) { /* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE_ALPHA, etc. texture formats. */ - const GLubyte *src = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 0, 0); - const GLubyte *src1 = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 1, 0); - const GLint srcStride = src1 - src; + const GLubyte *src = (const GLubyte *) _mesa_image_address( + unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); + const GLint srcStride = _mesa_image_row_stride(unpacking, width, + srcFormat, srcType); GLubyte *dst = texImage->Data; GLint dstBytesPerRow = width * components * sizeof(GLubyte); if (srcStride == dstBytesPerRow) { @@ -463,15 +760,14 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, dst += dstBytesPerRow; } } - return texImage; /* all done */ + return; /* all done */ } else if (srcFormat == GL_RGBA && internalFormat == GL_RGB) { /* commonly used by Quake */ - const GLubyte *src = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 0, 0); - const GLubyte *src1 = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 1, 0); - const GLint srcStride = src1 - src; + const GLubyte *src = (const GLubyte *) _mesa_image_address( + unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); + const GLint srcStride = _mesa_image_row_stride(unpacking, width, + srcFormat, srcType); GLubyte *dst = texImage->Data; GLint i, j; for (i = 0; i < height; i++) { @@ -484,7 +780,7 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, } src += srcStride; } - return texImage; /* all done */ + return; /* all done */ } } @@ -500,7 +796,7 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, GLint img, row; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { - const GLvoid *source = gl_pixel_addr_in_image(unpacking, + const GLvoid *source = _mesa_image_address(unpacking, pixels, width, height, srcFormat, srcType, img, row, 0); _mesa_unpack_index_span(ctx, width, dstType, dest, srcType, source, unpacking, GL_TRUE); @@ -516,7 +812,7 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, GLint img, row; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { - const GLvoid *source = gl_pixel_addr_in_image(unpacking, + const GLvoid *source = _mesa_image_address(unpacking, pixels, width, height, srcFormat, srcType, img, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, dstFormat, dest, srcFormat, srcType, source, unpacking, GL_TRUE); @@ -524,8 +820,6 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, } } } - - return texImage; /* All done! */ } @@ -533,48 +827,19 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, /* * glTexImage[123]D can accept a NULL image pointer. In this case we * create a texture image with unspecified image contents per the OpenGL - * spec. + * spec. This function creates an empty image for the given texture image. */ -static struct gl_texture_image * -make_null_texture( GLcontext *ctx, GLenum internalFormat, - GLsizei width, GLsizei height, GLsizei depth, GLint border ) +static void +make_null_texture( struct gl_texture_image *texImage ) { GLint components; - struct gl_texture_image *texImage; GLint numPixels; - (void) ctx; - - /*internalFormat = decode_internal_format(internalFormat);*/ - components = components_in_intformat(internalFormat); - numPixels = width * height * depth; - texImage = gl_alloc_texture_image(); - if (!texImage) - return NULL; - - texImage->Format = (GLenum) decode_internal_format(internalFormat); - set_teximage_component_sizes( texImage ); - texImage->IntFormat = internalFormat; - texImage->Border = border; - texImage->Width = width; - texImage->Height = height; - texImage->Depth = depth; - texImage->WidthLog2 = logbase2(width - 2*border); - if (height==1) /* 1-D texture */ - texImage->HeightLog2 = 0; - else - texImage->HeightLog2 = logbase2(height - 2*border); - if (depth==1) /* 2-D texture */ - texImage->DepthLog2 = 0; - else - texImage->DepthLog2 = logbase2(depth - 2*border); - texImage->Width2 = 1 << texImage->WidthLog2; - texImage->Height2 = 1 << texImage->HeightLog2; - texImage->Depth2 = 1 << texImage->DepthLog2; - texImage->MaxLog2 = MAX2( texImage->WidthLog2, texImage->HeightLog2 ); + ASSERT(texImage); + ASSERT(!texImage->Data); - /* XXX should we really allocate memory for the image or let it be NULL? */ - /*texImage->Data = NULL;*/ + components = components_in_intformat(texImage->IntFormat); + numPixels = texImage->Width * texImage->Height * texImage->Depth; texImage->Data = (GLubyte *) MALLOC( numPixels * components + EXTRA_BYTE ); @@ -597,9 +862,9 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat, GLubyte *imgPtr = texImage->Data; GLint i, j, k; - for (i=0;i<height;i++) { + for (i = 0; i < texImage->Height; i++) { GLint srcRow = 7 - i % 8; - for (j=0;j<width;j++) { + for (j = 0; j < texImage->Width; j++) { GLint srcCol = j % 32; GLint texel = (message[srcRow][srcCol]=='X') ? 255 : 70; for (k=0;k<components;k++) { @@ -608,8 +873,6 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat, } } } - - return texImage; } @@ -640,7 +903,10 @@ texture_error_check( GLcontext *ctx, GLenum target, } else if (dimensions == 2) { isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D); - if (target != GL_TEXTURE_2D && !isProxy) { + if (target != GL_TEXTURE_2D && !isProxy && + !(ctx->Extensions.HaveTextureCubeMap && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { gl_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); return GL_TRUE; } @@ -658,7 +924,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* Border */ - if (border!=0 && border!=1) { + if (border != 0 && border != 1) { if (!isProxy) { char message[100]; sprintf(message, "glTexImage%dD(border)", dimensions); @@ -691,6 +957,17 @@ texture_error_check( GLcontext *ctx, GLenum target, } } + /* For cube map, width must equal height */ + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (width != height) { + if (!isProxy) { + gl_error(ctx, GL_INVALID_VALUE, "glTexImage2D(width != height)"); + } + return GL_TRUE; + } + } + /* Depth */ if (dimensions >= 3) { if (depth < 2 * border || depth > 2 + ctx->Const.MaxTextureSize @@ -703,7 +980,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* Level */ - if (level<0 || level>=ctx->Const.MaxTextureLevels) { + if (level < 0 || level >= ctx->Const.MaxTextureLevels) { if (!isProxy) { char message[100]; sprintf(message, "glTexImage%dD(level)", dimensions); @@ -712,7 +989,7 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } - iformat = decode_internal_format( internalFormat ); + iformat = _mesa_base_tex_format( ctx, internalFormat ); if (iformat < 0) { if (!isProxy) { char message[100]; @@ -722,16 +999,18 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } - if (!gl_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); - gl_error(ctx, GL_INVALID_OPERATION, message); + if (!is_compressed_format(internalFormat)) { + 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); + gl_error(ctx, GL_INVALID_OPERATION, message); + } + return GL_TRUE; } - return GL_TRUE; } /* if we get here, the parameters are OK */ @@ -763,7 +1042,15 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } else if (dimensions == 2) { - if (target != GL_TEXTURE_2D) { + if (ctx->Extensions.HaveTextureCubeMap) { + if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || + target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && + target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { gl_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } @@ -838,11 +1125,13 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } - if (!gl_is_legal_format_and_type(format, type)) { - char message[100]; - sprintf(message, "glTexSubImage%dD(format or type)", dimensions); - gl_error(ctx, GL_INVALID_ENUM, message); - return GL_TRUE; + if (!is_compressed_format(destTex->IntFormat)) { + if (!_mesa_is_legal_format_and_type(format, type)) { + char message[100]; + sprintf(message, "glTexSubImage%dD(format or type)", dimensions); + gl_error(ctx, GL_INVALID_ENUM, message); + return GL_TRUE; + } } return GL_FALSE; @@ -861,18 +1150,25 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, { GLint iformat; - if (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1/2D(target)" ); - return GL_TRUE; - } - - if (dimensions == 1 && target != GL_TEXTURE_1D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); - return GL_TRUE; + if (dimensions == 1) { + if (target != GL_TEXTURE_1D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); + return GL_TRUE; + } } - else if (dimensions == 2 && target != GL_TEXTURE_2D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); - return GL_TRUE; + else if (dimensions == 2) { + if (ctx->Extensions.HaveTextureCubeMap) { + if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || + target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && + target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } } /* Border */ @@ -903,6 +1199,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, } } + /* For cube map, width must equal height */ + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (width != height) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyTexImage2D(width != height)"); + return GL_TRUE; + } + } + /* Level */ if (level<0 || level>=ctx->Const.MaxTextureLevels) { char message[100]; @@ -911,7 +1216,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - iformat = decode_internal_format( internalFormat ); + iformat = _mesa_base_tex_format( ctx, internalFormat ); if (iformat < 0) { char message[100]; sprintf(message, "glCopyTexImage%dD(internalFormat)", dimensions); @@ -933,17 +1238,31 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *teximage; - if (dimensions == 1 && target != GL_TEXTURE_1D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); - return GL_TRUE; + if (dimensions == 1) { + if (target != GL_TEXTURE_1D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); + return GL_TRUE; + } } - else if (dimensions == 2 && target != GL_TEXTURE_2D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); - return GL_TRUE; + else if (dimensions == 2) { + if (ctx->Extensions.HaveTextureCubeMap) { + if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || + target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && + target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } } - else if (dimensions == 3 && target != GL_TEXTURE_3D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" ); - return GL_TRUE; + else if (dimensions == 3) { + if (target != GL_TEXTURE_3D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" ); + return GL_TRUE; + } } if (level < 0 || level >= ctx->Const.MaxTextureLevels) { @@ -1028,66 +1347,100 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, * Called from the API. Note that width includes the border. */ void -_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, +_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D"); if (target==GL_TEXTURE_1D) { - struct gl_texture_image *teximage; - if (texture_error_check( ctx, target, level, internalformat, - format, type, 1, width, 1, 1, border )) { - /* error in texture image was detected */ - return; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 1, width, 1, 1, border)) { + return; /* error in texture image was detected */ } - /* free current texture image, if any */ - if (texUnit->CurrentD[1]->Image[level]) { - gl_free_texture_image( texUnit->CurrentD[1]->Image[level] ); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[1]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; } - /* make new texture from source image */ + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, 1, 1, border, internalFormat); + + /* process the texture image */ if (pixels) { - teximage = make_texture_image(ctx, internalformat, width, 1, 1, - border, format, type, pixels, &ctx->Unpack); + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexImage1D) { + /* let device driver try to use raw image */ + success = (*ctx->Driver.TexImage1D)( ctx, target, level, format, + type, pixels, &ctx->Unpack, + texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + make_texture_image(ctx, texImage, format, type, + pixels, &ctx->Unpack); + if (!success && ctx->Driver.TexImage1D) { + /* let device driver try to use unpacked image */ + (*ctx->Driver.TexImage1D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } else { - teximage = make_null_texture(ctx, (GLenum) internalformat, - width, 1, 1, border); + make_null_texture(texImage); + if (ctx->Driver.TexImage1D) { + GLboolean retain; + (*ctx->Driver.TexImage1D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } } - /* install new texture image */ - texUnit->CurrentD[1]->Image[level] = teximage; - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] ); + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; - - /* tell driver about change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_1D, - texUnit->CurrentD[1], - level, internalformat, teximage ); - } } else if (target==GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check( ctx, target, level, internalformat, - format, type, 1, width, 1, 1, border )) { + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 1, width, 1, 1, border)) { + /* if error, clear all proxy texture image parameters */ if (level>=0 && level<ctx->Const.MaxTextureLevels) { MEMSET( ctx->Texture.Proxy1D->Image[level], 0, sizeof(struct gl_texture_image) ); } } else { - ctx->Texture.Proxy1D->Image[level]->Format = (GLenum) format; - set_teximage_component_sizes( ctx->Texture.Proxy1D->Image[level] ); - ctx->Texture.Proxy1D->Image[level]->IntFormat = (GLenum) internalformat; - ctx->Texture.Proxy1D->Image[level]->Border = border; - ctx->Texture.Proxy1D->Image[level]->Width = width; - ctx->Texture.Proxy1D->Image[level]->Height = 1; - ctx->Texture.Proxy1D->Image[level]->Depth = 1; + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, 1, 1, border, internalFormat); } } else { @@ -1098,67 +1451,114 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, void -_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, +_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D"); - if (target==GL_TEXTURE_2D) { - struct gl_texture_image *teximage; - if (texture_error_check( ctx, target, level, internalformat, - format, type, 2, width, height, 1, border )) { - /* error in texture image was detected */ - return; + if (target==GL_TEXTURE_2D || + (ctx->Extensions.HaveTextureCubeMap && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + 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, + format, type, 2, width, height, 1, border)) { + return; /* error in texture image was detected */ } - /* free current texture image, if any */ - if (texUnit->CurrentD[2]->Image[level]) { - gl_free_texture_image( texUnit->CurrentD[2]->Image[level] ); + 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 (!texImage) { + texImage = _mesa_alloc_texture_image(); + set_tex_image(texObj, target, level, texImage); + /*texObj->Image[level] = texImage;*/ + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; } - /* make new texture from source image */ + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, 1, border, internalFormat); + + /* process the texture image */ if (pixels) { - teximage = make_texture_image(ctx, internalformat, width, height, 1, - border, format, type, pixels, &ctx->Unpack); + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexImage2D) { + /* let device driver try to use raw image */ + success = (*ctx->Driver.TexImage2D)( ctx, target, level, format, + type, pixels, &ctx->Unpack, + texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + make_texture_image(ctx, texImage, format, type, + pixels, &ctx->Unpack); + if (!success && ctx->Driver.TexImage2D) { + /* let device driver try to use unpacked image */ + (*ctx->Driver.TexImage2D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } else { - teximage = make_null_texture(ctx, (GLenum) internalformat, - width, height, 1, border); + make_null_texture(texImage); + if (ctx->Driver.TexImage2D) { + GLboolean retain; + (*ctx->Driver.TexImage2D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } } - /* install new texture image */ - texUnit->CurrentD[2]->Image[level] = teximage; - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[2] ); - ctx->NewState |= NEW_TEXTURING; - - /* tell driver about change */ +#define OLD_DD_TEXTURE +#ifdef OLD_DD_TEXTURE + /* XXX this will be removed in the future */ if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_2D, - texUnit->CurrentD[2], - level, internalformat, teximage ); + (*ctx->Driver.TexImage)( ctx, target, texObj, level, internalFormat, + texImage ); } +#endif + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; } else if (target==GL_PROXY_TEXTURE_2D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check( ctx, target, level, internalformat, - format, type, 2, width, height, 1, border )) { + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 2, width, height, 1, border)) { + /* if error, clear all proxy texture image parameters */ if (level>=0 && level<ctx->Const.MaxTextureLevels) { MEMSET( ctx->Texture.Proxy2D->Image[level], 0, sizeof(struct gl_texture_image) ); } } else { - ctx->Texture.Proxy2D->Image[level]->Format = (GLenum) format; - set_teximage_component_sizes( ctx->Texture.Proxy2D->Image[level] ); - ctx->Texture.Proxy2D->Image[level]->IntFormat = (GLenum) internalformat; - ctx->Texture.Proxy2D->Image[level]->Border = border; - ctx->Texture.Proxy2D->Image[level]->Width = width; - ctx->Texture.Proxy2D->Image[level]->Height = height; - ctx->Texture.Proxy2D->Image[level]->Depth = 1; + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, height, 1, border, internalFormat); } } else { @@ -1174,69 +1574,101 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, * Note that width and height include the border. */ void -_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, +_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3DEXT"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3D"); if (target==GL_TEXTURE_3D_EXT) { - struct gl_texture_image *teximage; - if (texture_error_check( ctx, target, level, internalformat, - format, type, 3, width, height, depth, - border )) { - /* error in texture image was detected */ - return; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 3, width, height, depth, border)) { + return; /* error in texture image was detected */ } - /* free current texture image, if any */ - if (texUnit->CurrentD[3]->Image[level]) { - gl_free_texture_image( texUnit->CurrentD[3]->Image[level] ); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[3]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + return; + } } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, depth, + border, internalFormat); - /* make new texture from source image */ + /* process the texture image */ if (pixels) { - teximage = make_texture_image(ctx, internalformat, width, height, - depth, border, format, type, pixels, &ctx->Unpack); + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexImage3D) { + /* let device driver try to use raw image */ + success = (*ctx->Driver.TexImage3D)( ctx, target, level, format, + type, pixels, &ctx->Unpack, + texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + make_texture_image(ctx, texImage, format, type, + pixels, &ctx->Unpack); + if (!success && ctx->Driver.TexImage3D) { + /* let device driver try to use unpacked image */ + (*ctx->Driver.TexImage3D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } else { - teximage = make_null_texture(ctx, (GLenum) internalformat, - width, height, depth, border); + make_null_texture(texImage); + if (ctx->Driver.TexImage3D) { + GLboolean retain; + (*ctx->Driver.TexImage3D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } } - /* install new texture image */ - texUnit->CurrentD[3]->Image[level] = teximage; - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[3] ); + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; - - /* tell driver about change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_3D_EXT, - texUnit->CurrentD[3], - level, internalformat, teximage ); - } } - else if (target==GL_PROXY_TEXTURE_3D_EXT) { + else if (target==GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check( ctx, target, level, internalformat, - format, type, 3, width, height, depth, - border )) { + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 3, width, height, depth, border)) { + /* if error, clear all proxy texture image parameters */ if (level>=0 && level<ctx->Const.MaxTextureLevels) { MEMSET( ctx->Texture.Proxy3D->Image[level], 0, sizeof(struct gl_texture_image) ); } } else { - ctx->Texture.Proxy3D->Image[level]->Format = (GLenum) format; - set_teximage_component_sizes( ctx->Texture.Proxy3D->Image[level] ); - ctx->Texture.Proxy3D->Image[level]->IntFormat = (GLenum) internalformat; - ctx->Texture.Proxy3D->Image[level]->Border = border; - ctx->Texture.Proxy3D->Image[level]->Width = width; - ctx->Texture.Proxy3D->Image[level]->Height = height; - ctx->Texture.Proxy3D->Image[level]->Depth = depth; + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, height, depth, border, internalFormat); } } else { @@ -1247,16 +1679,106 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, void -_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, +_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { - _mesa_TexImage3D(target, level, (GLint) internalformat, width, height, + _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height, depth, border, format, type, pixels); } +/* + * Fetch a texture image from the device driver. + * Store the results in the given texture object at the given mipmap level. + */ +void +_mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj ) +{ + GLvoid *image; + GLenum imgFormat, imgType; + GLboolean freeImage; + struct gl_texture_image *texImage; + GLint destComponents, numPixels, srcBytesPerTexel; + + if (!ctx->Driver.GetTexImage) + return; + + image = (*ctx->Driver.GetTexImage)( ctx, target, level, texObj, + &imgFormat, &imgType, &freeImage); + if (!image) + return; + + texImage = texObj->Image[level]; + ASSERT(texImage); + if (!texImage) + return; + + destComponents = components_in_intformat(texImage->Format); + assert(destComponents > 0); + numPixels = texImage->Width * texImage->Height * texImage->Depth; + assert(numPixels > 0); + srcBytesPerTexel = _mesa_bytes_per_pixel(imgFormat, imgType); + assert(srcBytesPerTexel > 0); + + if (!texImage->Data) { + /* Allocate memory for the texture image data */ + texImage->Data = (GLubyte *) MALLOC(numPixels * destComponents + EXTRA_BYTE); + } + + if (imgFormat == texImage->Format && imgType == GL_UNSIGNED_BYTE) { + /* We got lucky! The driver's format and type match Mesa's format. */ + if (texImage->Data) { + MEMCPY(texImage->Data, image, numPixels * destComponents); + } + } + else { + /* Convert the texture image from the driver's format to Mesa's + * internal format. + */ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + const GLint destBytesPerRow = width * destComponents * sizeof(GLchan); + const GLint srcBytesPerRow = width * srcBytesPerTexel; + const GLenum dstType = GL_UNSIGNED_BYTE; + const GLenum dstFormat = texImage->Format; + const GLubyte *srcPtr = (const GLubyte *) image; + GLubyte *destPtr = texImage->Data; + + if (texImage->Format == GL_COLOR_INDEX) { + /* color index texture */ + GLint img, row; + assert(imgFormat == GL_COLOR_INDEX); + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + _mesa_unpack_index_span(ctx, width, dstType, destPtr, + imgType, srcPtr, &_mesa_native_packing, GL_FALSE); + destPtr += destBytesPerRow; + srcPtr += srcBytesPerRow; + } + } + } + else { + /* color texture */ + GLint img, row; + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + _mesa_unpack_ubyte_color_span(ctx, width, dstFormat, destPtr, + imgFormat, imgType, srcPtr, &_mesa_native_packing, GL_FALSE); + destPtr += destBytesPerRow; + srcPtr += srcBytesPerRow; + } + } + } + } + + if (freeImage) + FREE(image); +} + void _mesa_GetTexImage( GLenum target, GLint level, GLenum format, @@ -1264,6 +1786,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean discardImage; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage"); @@ -1272,51 +1796,91 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (gl_sizeof_type(type) <= 0) { + if (_mesa_sizeof_type(type) <= 0) { gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" ); return; } - if (gl_components_in_format(format) <= 0) { + if (_mesa_components_in_format(format) <= 0) { gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" ); return; } if (!pixels) - return; /* XXX generate an error??? */ + return; switch (target) { case GL_TEXTURE_1D: texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[1]; + texImage = texObj->Image[level]; break; case GL_TEXTURE_2D: texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[2]; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegX[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosY[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegY[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosZ[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegZ[level]; break; case GL_TEXTURE_3D: texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[3]; + texImage = texObj->Image[level]; break; default: gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(target)" ); return; } - if (texObj->Image[level] && texObj->Image[level]->Data) { - const struct gl_texture_image *texImage = texObj->Image[level]; + if (!texImage) { + /* invalid mipmap level */ + return; + } + + if (!texImage->Data) { + /* try to get the texture image from the device driver */ + _mesa_get_teximage_from_driver(ctx, target, level, texObj); + discardImage = GL_TRUE; + } + else { + discardImage = GL_FALSE; + } + + if (texImage->Data) { GLint width = texImage->Width; GLint height = texImage->Height; GLint row; for (row = 0; row < height; row++) { /* compute destination address in client memory */ - GLvoid *dest = gl_pixel_addr_in_image( &ctx->Unpack, pixels, + GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels, width, height, format, type, 0, row, 0); assert(dest); if (texImage->Format == GL_RGBA) { const GLubyte *src = texImage->Data + row * width * 4 * sizeof(GLubyte); - gl_pack_rgba_span( ctx, width, (void *) src, format, type, dest, - &ctx->Pack, GL_TRUE ); + _mesa_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src, + format, type, dest, &ctx->Pack, GL_TRUE ); } else { /* fetch RGBA row from texture image then pack it in client mem */ @@ -1379,10 +1943,16 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, default: gl_problem( ctx, "bad format in gl_GetTexImage" ); } - gl_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba, - format, type, dest, &ctx->Pack, GL_TRUE ); + _mesa_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba, + format, type, dest, &ctx->Pack, GL_TRUE ); } } + + /* if we got the teximage from the device driver we'll discard it now */ + if (discardImage) { + FREE(texImage->Data); + texImage->Data = NULL; + } } } @@ -1395,65 +1965,78 @@ _mesa_TexSubImage1D( GLenum target, GLint level, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, type)) { - /* error was detected */ - return; + return; /* error was detected */ } - destTex = texUnit->CurrentD[1]->Image[level]; - assert(destTex); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[1]; + texImage = texObj->Image[level]; + assert(texImage); if (width == 0 || !pixels) return; /* no-op, not an error */ - /* - * Replace the texture subimage - */ - { - const GLint texComponents = components_in_intformat(destTex->Format); - const GLenum texFormat = destTex->Format; - const GLint xoffsetb = xoffset + destTex->Border; - GLubyte *dst = destTex->Data + xoffsetb * texComponents; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexSubImage1D) { + success = (*ctx->Driver.TexSubImage1D)( ctx, target, level, xoffset, + width, format, type, pixels, + &ctx->Unpack, texObj, texImage ); + } + if (!success) { + /* XXX if Driver.TexSubImage1D, unpack image and try again? */ + + const GLint texComponents = components_in_intformat(texImage->Format); + const GLenum texFormat = texImage->Format; + const GLint xoffsetb = xoffset + texImage->Border; + GLboolean retain = GL_TRUE; + if (!texImage->Data) { + _mesa_get_teximage_from_driver( ctx, target, level, texObj ); + if (!texImage->Data) { + make_null_texture(texImage); + } + if (!texImage->Data) + return; /* we're really out of luck! */ + } + if (texFormat == GL_COLOR_INDEX) { /* color index texture */ - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, 1, format, type, 0, 0, 0); + GLubyte *dst = texImage->Data + xoffsetb * texComponents; + const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, + 1, format, type, 0, 0, 0); _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, - type, src, &ctx->Unpack, GL_TRUE); + type, src, &ctx->Unpack, GL_TRUE); } else { /* color texture */ - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, 1, format, type, 0, 0, 0); - _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, - format, type, src, &ctx->Unpack, GL_TRUE); + GLubyte *dst = texImage->Data + xoffsetb * texComponents; + const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, + 1, format, type, 0, 0, 0); + _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, format, + type, src, &ctx->Unpack, GL_TRUE); } - } - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] ); + if (ctx->Driver.TexImage1D) { + (*ctx->Driver.TexImage1D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, texObj, texImage, + &retain ); + } - /* - * Inform device driver of texture image change. - */ - if (ctx->Driver.TexSubImage) { - (*ctx->Driver.TexSubImage)(ctx, GL_TEXTURE_1D, texUnit->CurrentD[1], - level, xoffset, 0, width, 1, - texUnit->CurrentD[1]->Image[level]->IntFormat, - destTex ); - } - else { - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_1D, texUnit->CurrentD[1], - level, - texUnit->CurrentD[1]->Image[level]->IntFormat, - destTex ); + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; } } + + /*gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] );*/ } @@ -1465,76 +2048,104 @@ _mesa_TexSubImage2D( GLenum target, GLint level, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, type)) { - /* error was detected */ - return; + return; /* error was detected */ } - destTex = texUnit->CurrentD[2]->Image[level]; - assert(destTex); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); if (width == 0 || height == 0 || !pixels) return; /* no-op, not an error */ + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexSubImage2D) { + success = (*ctx->Driver.TexSubImage2D)( ctx, target, level, xoffset, + yoffset, width, height, format, type, + pixels, &ctx->Unpack, texObj, texImage ); + } + if (!success) { + /* XXX if Driver.TexSubImage2D, unpack image and try again? */ + + const GLint texComponents = components_in_intformat(texImage->Format); + const GLenum texFormat = texImage->Format; + const GLint xoffsetb = xoffset + texImage->Border; + const GLint yoffsetb = yoffset + texImage->Border; + const GLint srcStride = _mesa_image_row_stride(&ctx->Unpack, width, + format, type); + const GLint dstStride = texImage->Width * texComponents *sizeof(GLubyte); + GLboolean retain = GL_TRUE; + + if (!texImage->Data) { + _mesa_get_teximage_from_driver( ctx, target, level, texObj ); + if (!texImage->Data) { + make_null_texture(texImage); + } + if (!texImage->Data) + return; /* we're really out of luck! */ + } - /* - * Replace the texture subimage - */ - { - const GLint texComponents = components_in_intformat(destTex->Format); - const GLenum texFormat = destTex->Format; - const GLint xoffsetb = xoffset + destTex->Border; - const GLint yoffsetb = yoffset + destTex->Border; - GLubyte *dst = destTex->Data - + (yoffsetb * destTex->Width + xoffsetb) * texComponents; if (texFormat == GL_COLOR_INDEX) { /* color index texture */ - const GLint stride = destTex->Width * sizeof(GLubyte); + GLubyte *dst = texImage->Data + + (yoffsetb * texImage->Width + xoffsetb) * texComponents; + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, 0, 0, 0); GLint row; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, 0, row, 0); - _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, - type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, type, + (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } else { /* color texture */ - const GLint stride = destTex->Width * texComponents * sizeof(GLubyte); + GLubyte *dst = texImage->Data + + (yoffsetb * texImage->Width + xoffsetb) * texComponents; + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, 0, 0, 0); GLint row; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, 0, row, 0); - _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, - format, type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, format, + type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } - } - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[2] ); + if (ctx->Driver.TexImage2D) { + (*ctx->Driver.TexImage2D)(ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, texObj, texImage, + &retain); + } - /* - * Inform device driver of texture image change. - */ - if (ctx->Driver.TexSubImage) { - (*ctx->Driver.TexSubImage)(ctx, GL_TEXTURE_2D, texUnit->CurrentD[2], - level, xoffset, yoffset, width, height, - texUnit->CurrentD[2]->Image[level]->IntFormat, - destTex ); - } - else { - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, texUnit->CurrentD[2], - level, - texUnit->CurrentD[2]->Image[level]->IntFormat, - destTex ); + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + +#ifdef OLD_DD_TEXTURE + /* XXX this will be removed in the future */ + if (ctx->Driver.TexSubImage) { + (*ctx->Driver.TexSubImage)(ctx, target, texObj, level, + xoffset, yoffset, width, height, + texImage->IntFormat, texImage); } + else if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, texObj, + level, texImage->IntFormat, texImage ); + } +#endif } } @@ -1548,71 +2159,90 @@ _mesa_TexSubImage3D( GLenum target, GLint level, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type)) { - /* error was detected */ - return; + return; /* error was detected */ } - destTex = texUnit->CurrentD[3]->Image[level]; - assert(destTex); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[3]; + texImage = texObj->Image[level]; + assert(texImage); if (width == 0 || height == 0 || height == 0 || !pixels) return; /* no-op, not an error */ - /* - * Replace the texture subimage - */ - { - const GLint texComponents = components_in_intformat(destTex->Format); - const GLenum texFormat = destTex->Format; - const GLint xoffsetb = xoffset + destTex->Border; - const GLint yoffsetb = yoffset + destTex->Border; - const GLint zoffsetb = zoffset + destTex->Border; - GLint dstRectArea = destTex->Width * destTex->Height; - GLubyte *dst = destTex->Data - + (zoffsetb * dstRectArea + yoffsetb * destTex->Width + xoffsetb) - * texComponents; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexSubImage3D) { + success = (*ctx->Driver.TexSubImage3D)( ctx, target, level, xoffset, + yoffset, zoffset, width, height, depth, format, + type, pixels, &ctx->Unpack, texObj, texImage ); + } + if (!success) { + /* XXX if Driver.TexSubImage3D, unpack image and try again? */ + + const GLint texComponents = components_in_intformat(texImage->Format); + const GLenum texFormat = texImage->Format; + const GLint xoffsetb = xoffset + texImage->Border; + const GLint yoffsetb = yoffset + texImage->Border; + const GLint zoffsetb = zoffset + texImage->Border; + const GLint texWidth = texImage->Width; + const GLint dstRectArea = texWidth * texImage->Height; + const GLint srcStride = _mesa_image_row_stride(&ctx->Unpack, + width, format, type); + const GLint dstStride = texWidth * texComponents * sizeof(GLubyte); + GLboolean retain = GL_TRUE; if (texFormat == GL_COLOR_INDEX) { /* color index texture */ - const GLint stride = destTex->Width * sizeof(GLubyte); GLint img, row; for (img = 0; img < depth; img++) { + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, img, 0, 0); + GLubyte *dst = texImage->Data + ((zoffsetb + img) * dstRectArea + + yoffsetb * texWidth + xoffsetb) * texComponents; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, img, row, 0); _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, - type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } } else { /* color texture */ - const GLint stride = destTex->Width * texComponents * sizeof(GLubyte); GLint img, row; for (img = 0; img < depth; img++) { + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, img, 0, 0); + GLubyte *dst = texImage->Data + ((zoffsetb + img) * dstRectArea + + yoffsetb * texWidth + xoffsetb) * texComponents; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, img, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, - format, type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + format, type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } } - } - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] ); + if (ctx->Driver.TexImage3D) { + (*ctx->Driver.TexImage3D)(ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, texObj, texImage, + &retain); + } - /* - * Inform device driver of texture image change. - */ - /* XXX todo */ + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + } } @@ -1632,7 +2262,7 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, GLint stride, i; GLubyte *image, *dst; - image = MALLOC(width * height * 4 * sizeof(GLubyte)); + image = (GLubyte *) MALLOC(width * height * 4 * sizeof(GLubyte)); if (!image) return NULL; @@ -1666,15 +2296,22 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D"); - if (!copytexture_error_check(ctx, 1, target, level, internalFormat, - width, 1, border)) { + if (copytexture_error_check(ctx, 1, target, level, internalFormat, + width, 1, border)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexImage1D + || !(*ctx->Driver.CopyTexImage1D)(ctx, target, level, + internalFormat, x, y, width, border)) + { GLubyte *image = read_color_image( ctx, x, y, width, 1 ); if (!image) { gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D" ); return; } (*ctx->Exec->TexImage1D)( target, level, internalFormat, width, - border, GL_RGBA, GL_UNSIGNED_BYTE, image ); + border, GL_RGBA, GL_UNSIGNED_BYTE, image ); FREE(image); } } @@ -1689,15 +2326,22 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D"); - if (!copytexture_error_check(ctx, 2, target, level, internalFormat, - width, height, border)) { + if (copytexture_error_check(ctx, 2, target, level, internalFormat, + width, height, border)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexImage2D + || !(*ctx->Driver.CopyTexImage2D)(ctx, target, level, + internalFormat, x, y, width, height, border)) + { GLubyte *image = read_color_image( ctx, x, y, width, height ); if (!image) { gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D" ); return; } (ctx->Exec->TexImage2D)( target, level, internalFormat, width, - height, border, GL_RGBA, GL_UNSIGNED_BYTE, image ); + height, border, GL_RGBA, GL_UNSIGNED_BYTE, image ); FREE(image); } } @@ -1713,17 +2357,6 @@ copy_tex_sub_image( GLcontext *ctx, struct gl_texture_image *dest, GLint srcx, GLint srcy, GLint dstx, GLint dsty, GLint dstz ) { - static struct gl_pixelstore_attrib packing = { - 1, /* Alignment */ - 0, /* RowLength */ - 0, /* SkipPixels */ - 0, /* SkipRows */ - 0, /* ImageHeight */ - 0, /* SkipImages */ - GL_FALSE, /* SwapBytes */ - GL_FALSE /* LsbFirst */ - }; - GLint i; GLint format, components, rectarea; GLint texwidth, texheight, zoffset; @@ -1750,7 +2383,7 @@ copy_tex_sub_image( GLcontext *ctx, struct gl_texture_image *dest, dst = dest->Data + ( zoffset + (dsty+i) * texwidth + dstx) * components; _mesa_unpack_ubyte_color_span(ctx, width, format, dst, GL_RGBA, GL_UNSIGNED_BYTE, rgba, - &packing, GL_TRUE); + &_mesa_native_packing, GL_TRUE); } /* Read from draw buffer (the default) */ @@ -1768,8 +2401,14 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D"); - if (!copytexsubimage_error_check(ctx, 1, target, level, - xoffset, 0, 0, width, 1)) { + if (copytexsubimage_error_check(ctx, 1, target, level, + xoffset, 0, 0, width, 1)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexSubImage1D + || !(*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, + xoffset, x, y, width)) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1777,12 +2416,13 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, assert(teximage); if (teximage->Data) { copy_tex_sub_image(ctx, teximage, width, 1, x, y, xoffset, 0, 0); - /* tell driver about the change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_1D, - texUnit->CurrentD[1], - level, teximage->IntFormat, teximage ); - } + /* tell driver about the change */ + /* XXX this is obsolete */ + if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_1D, + texUnit->CurrentD[1], + level, teximage->IntFormat, teximage ); + } } } } @@ -1797,8 +2437,14 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D"); - if (!copytexsubimage_error_check(ctx, 2, target, level, - xoffset, yoffset, 0, width, height)) { + if (copytexsubimage_error_check(ctx, 2, target, level, + xoffset, yoffset, 0, width, height)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexSubImage2D + || !(*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, + xoffset, yoffset, x, y, width, height )) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1807,11 +2453,12 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (teximage->Data) { copy_tex_sub_image(ctx, teximage, width, height, x, y, xoffset, yoffset, 0); - /* tell driver about the change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_2D, - texUnit->CurrentD[2], - level, teximage->IntFormat, teximage ); + /* tell driver about the change */ + /* XXX this is obsolete */ + if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_2D, + texUnit->CurrentD[2], + level, teximage->IntFormat, teximage ); } } } @@ -1827,8 +2474,14 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D"); - if (!copytexsubimage_error_check(ctx, 3, target, level, - xoffset, yoffset, zoffset, width, height)) { + if (copytexsubimage_error_check(ctx, 3, target, level, + xoffset, yoffset, zoffset, width, height)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexSubImage3D + || !(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, x, y, width, height )) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1837,13 +2490,501 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (teximage->Data) { copy_tex_sub_image(ctx, teximage, width, height, x, y, xoffset, yoffset, zoffset); - /* tell driver about the change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_3D, - texUnit->CurrentD[3], - level, teximage->IntFormat, teximage ); - } + /* tell driver about the change */ + /* XXX this is obsolete */ + if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_3D, + texUnit->CurrentD[3], + level, teximage->IntFormat, teximage ); + } + } + } +} + + + +void +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage1DARB"); + + 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 */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[1]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, 1, 1, border, internalFormat); + + /* process the texture image */ + if (data) { + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (ctx->Driver.CompressedTexImage1D) { + success = (*ctx->Driver.CompressedTexImage1D)( ctx, target, level, + data, texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + GLuint imageSize = _mesa_compressed_image_size(internalFormat, + width, 1, 1); + texImage->Data = MALLOC(imageSize); + if (texImage->Data) { + MEMCPY(texImage->Data, data, imageSize); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + } + else { + make_null_texture(texImage); + if (ctx->Driver.CompressedTexImage1D) { + GLboolean retain; + (*ctx->Driver.CompressedTexImage1D)( ctx, target, level, + texImage->Data, texObj, texImage, &retain); + } + } + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; + } + else if (target == GL_PROXY_TEXTURE_1D) { + /* Proxy texture: check for errors and update proxy state */ + if (texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, 1, 1, border)) { + /* if error, clear all proxy texture image parameters */ + if (level>=0 && level<ctx->Const.MaxTextureLevels) { + MEMSET( ctx->Texture.Proxy1D->Image[level], 0, + sizeof(struct gl_texture_image) ); + } + } + else { + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, 1, 1, border, internalFormat); + } + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage1DARB(target)" ); + return; + } +} + + +void +_mesa_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage2DARB"); + + if (target==GL_TEXTURE_2D || + (ctx->Extensions.HaveTextureCubeMap && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + 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, 1, width, height, 1, border)) { + return; /* error in texture image was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[2]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, 1, border, internalFormat); + + /* process the texture image */ + if (data) { + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (ctx->Driver.CompressedTexImage2D) { + success = (*ctx->Driver.CompressedTexImage2D)( ctx, target, level, + data, texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + GLuint imageSize = _mesa_compressed_image_size(internalFormat, + width, height, 1); + texImage->Data = MALLOC(imageSize); + if (texImage->Data) { + MEMCPY(texImage->Data, data, imageSize); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } + else { + make_null_texture(texImage); + if (ctx->Driver.CompressedTexImage2D) { + GLboolean retain; + (*ctx->Driver.CompressedTexImage2D)( ctx, target, level, + texImage->Data, texObj, texImage, &retain); + } + } + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; + } + else if (target == GL_PROXY_TEXTURE_2D) { + /* Proxy texture: check for errors and update proxy state */ + if (texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, 1, 1, border)) { + /* if error, clear all proxy texture image parameters */ + if (level>=0 && level<ctx->Const.MaxTextureLevels) { + MEMSET( ctx->Texture.Proxy2D->Image[level], 0, + sizeof(struct gl_texture_image) ); + } + } + else { + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy2D->Image[level], + width, 1, 1, border, internalFormat); + } + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage2DARB(target)" ); + return; } } + +void +_mesa_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage3DARB"); + + 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, 1, width, height, depth, border)) { + return; /* error in texture image was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[3]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, depth, border, internalFormat); + + /* process the texture image */ + if (data) { + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (ctx->Driver.CompressedTexImage3D) { + success = (*ctx->Driver.CompressedTexImage3D)( ctx, target, level, + data, texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + GLuint imageSize = _mesa_compressed_image_size(internalFormat, + width, height, depth); + texImage->Data = MALLOC(imageSize); + if (texImage->Data) { + MEMCPY(texImage->Data, data, imageSize); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + } + else { + make_null_texture(texImage); + if (ctx->Driver.CompressedTexImage3D) { + GLboolean retain; + (*ctx->Driver.CompressedTexImage3D)( ctx, target, level, + texImage->Data, texObj, texImage, &retain); + } + } + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; + } + else if (target == GL_PROXY_TEXTURE_3D) { + /* Proxy texture: check for errors and update proxy state */ + if (texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, height, depth, border)) { + /* if error, clear all proxy texture image parameters */ + if (level>=0 && level<ctx->Const.MaxTextureLevels) { + MEMSET( ctx->Texture.Proxy3D->Image[level], 0, + sizeof(struct gl_texture_image) ); + } + } + else { + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy3D->Image[level], + width, 1, 1, border, internalFormat); + } + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage3DARB(target)" ); + return; + } +} + + +void +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; + + if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, + width, 1, 1, format, GL_NONE)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); + + if (width == 0 || !data) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage1D) { + success = (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, + xoffset, width, format, imageSize, data, texObj, texImage); + } + if (!success) { + /* XXX what else can we do? */ + gl_problem(ctx, "glCompressedTexSubImage1DARB failed!"); + return; + } + +} + + +void +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; + + if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, + width, height, 1, format, GL_NONE)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); + + if (width == 0 || height == 0 || !data) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage2D) { + success = (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, + xoffset, yoffset, width, height, format, + imageSize, data, texObj, texImage); + } + if (!success) { + /* XXX what else can we do? */ + gl_problem(ctx, "glCompressedTexSubImage2DARB failed!"); + return; + } +} + + +void +_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; + + if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, GL_NONE)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); + + if (width == 0 || height == 0 || depth == 0 || !data) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage3D) { + success = (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, width, height, depth, + format, imageSize, data, texObj, texImage); + } + if (!success) { + /* XXX what else can we do? */ + gl_problem(ctx, "glCompressedTexSubImage3DARB failed!"); + return; + } +} + + +void +_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB"); + + if (level < 0 || level >= ctx->Const.MaxTextureLevels) { + gl_error( ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)" ); + return; + } + + switch (target) { + case GL_TEXTURE_1D: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[1]; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_2D: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[2]; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegX[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosY[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegY[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosZ[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegZ[level]; + break; + case GL_TEXTURE_3D: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[3]; + texImage = texObj->Image[level]; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); + return; + } + + if (!texImage) { + /* invalid mipmap level */ + gl_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); + return; + } + + if (!texImage->IsCompressed) { + gl_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); + return; + } + + if (!img) + return; + + if (ctx->Driver.GetCompressedTexImage) { + (*ctx->Driver.GetCompressedTexImage)(ctx, target, level, img, texObj, + texImage); + } + else { + gl_problem(ctx, "Driver doesn't implement GetCompressedTexImage"); + } +} diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h index 167708d26..606bac31c 100644 --- a/xc/extras/Mesa/src/teximage.h +++ b/xc/extras/Mesa/src/teximage.h @@ -34,14 +34,37 @@ /*** Internal functions ***/ +extern GLint +_mesa_base_tex_format( GLcontext *ctx, GLint format ); + + extern struct gl_texture_image * -gl_alloc_texture_image( void ); +_mesa_alloc_texture_image( void ); extern void -gl_free_texture_image( struct gl_texture_image *teximage ); +_mesa_free_texture_image( struct gl_texture_image *teximage ); + + +extern GLuint +_mesa_compressed_image_size(GLenum internalFormat, + GLint width, GLint height, GLint depth); +extern struct gl_texture_object * +_mesa_select_tex_object(GLcontext *ctx, struct gl_texture_unit *texUnit, + GLenum target); + + +extern struct gl_texture_image * +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level); + + +extern void +_mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj ); + /*** API entry point functions ***/ @@ -126,5 +149,47 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data); + + +extern void +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data); + +extern void +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data); + +extern void +_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); + + #endif diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index e30032376..91876bf5b 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -28,6 +28,7 @@ #include "all.h" #else #include "glheader.h" +#include "colortab.h" #include "context.h" #include "enums.h" #include "hash.h" @@ -46,7 +47,7 @@ * table. * Input: shared - the shared GL state structure to contain the texture object * name - integer name for the texture object - * dimensions - either 1, 2 or 3 + * dimensions - either 1, 2, 3 or 6 (cube map) * Return: pointer to new texture object */ struct gl_texture_object * @@ -55,7 +56,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, { struct gl_texture_object *obj; - ASSERT(dimensions <= 3); + ASSERT(dimensions <= 3 || dimensions == 6); obj = CALLOC_STRUCT(gl_texture_object); @@ -73,13 +74,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MinMagThresh = 0.0F; - obj->Palette.Table[0] = 255; - obj->Palette.Table[1] = 255; - obj->Palette.Table[2] = 255; - obj->Palette.Table[3] = 255; - obj->Palette.Size = 1; - obj->Palette.IntFormat = GL_RGBA; - obj->Palette.Format = GL_RGBA; + _mesa_init_colortable(&obj->Palette); /* insert into linked list */ if (shared) { @@ -143,12 +138,14 @@ void gl_free_texture_object( struct gl_shared_state *shared, _mesa_HashRemove(shared->TexObjects, t->Name); } - /* free texture image */ + _mesa_free_colortable_data(&t->Palette); + + /* free texture images */ { GLuint i; for (i=0;i<MAX_TEXTURE_LEVELS;i++) { if (t->Image[i]) { - gl_free_texture_image( t->Image[i] ); + _mesa_free_texture_image( t->Image[i] ); } } } @@ -162,24 +159,26 @@ void gl_free_texture_object( struct gl_shared_state *shared, * Examine a texture object to determine if it is complete or not. * The t->Complete flag will be set to GL_TRUE or GL_FALSE accordingly. */ -void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ) +void +_mesa_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *t ) { t->Complete = GL_TRUE; /* be optimistic */ /* Always need level zero image */ - if (!t->Image[0] || !t->Image[0]->Data) { + if (!t->Image[0]) { t->Complete = GL_FALSE; return; } /* Compute number of mipmap levels */ - if (t->Dimensions==1) { + if (t->Dimensions == 1) { t->P = t->Image[0]->WidthLog2; } - else if (t->Dimensions==2) { + else if (t->Dimensions == 2 || t->Dimensions == 6) { t->P = MAX2(t->Image[0]->WidthLog2, t->Image[0]->HeightLog2); } - else if (t->Dimensions==3) { + else if (t->Dimensions == 3) { GLint max = MAX2(t->Image[0]->WidthLog2, t->Image[0]->HeightLog2); max = MAX2(max, (GLint)(t->Image[0]->DepthLog2)); t->P = max; @@ -189,7 +188,21 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur t->M = (GLfloat) (MIN2(t->MaxLevel, t->P) - t->BaseLevel); - if (t->MinFilter!=GL_NEAREST && t->MinFilter!=GL_LINEAR) { + if (t->Dimensions == 6) { + /* make sure all six level 0 images are same size */ + const GLint w = t->Image[0]->Width2; + const GLint h = t->Image[0]->Height2; + if (!t->NegX[0] || t->NegX[0]->Width2 != w || t->NegX[0]->Height2 != h || + !t->PosY[0] || t->PosY[0]->Width2 != w || t->PosY[0]->Height2 != h || + !t->NegY[0] || t->NegY[0]->Width2 != w || t->NegY[0]->Height2 != h || + !t->PosZ[0] || t->PosZ[0]->Width2 != w || t->PosZ[0]->Height2 != h || + !t->NegZ[0] || t->NegZ[0]->Width2 != w || t->NegZ[0]->Height2 != h) { + t->Complete = GL_FALSE; + return; + } + } + + if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) { /* * Mipmapping: determine if we have a complete set of mipmaps */ @@ -206,10 +219,6 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur /* Test dimension-independent attributes */ for (i = minLevel; i <= maxLevel; i++) { if (t->Image[i]) { - if (!t->Image[i]->Data) { - t->Complete = GL_FALSE; - return; - } if (t->Image[i]->Format != t->Image[0]->Format) { t->Complete = GL_FALSE; return; @@ -222,11 +231,11 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur } /* Test things which depend on number of texture image dimensions */ - if (t->Dimensions==1) { + if (t->Dimensions == 1) { /* Test 1-D mipmaps */ GLuint width = t->Image[0]->Width2; - for (i=1; i<ctx->Const.MaxTextureLevels; i++) { - if (width>1) { + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { width /= 2; } if (i >= minLevel && i <= maxLevel) { @@ -234,29 +243,25 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur t->Complete = GL_FALSE; return; } - if (!t->Image[i]->Data) { - t->Complete = GL_FALSE; - return; - } if (t->Image[i]->Width2 != width ) { t->Complete = GL_FALSE; return; } } - if (width==1) { + if (width == 1) { return; /* found smallest needed mipmap, all done! */ } } } - else if (t->Dimensions==2) { + else if (t->Dimensions == 2) { /* Test 2-D mipmaps */ GLuint width = t->Image[0]->Width2; GLuint height = t->Image[0]->Height2; - for (i=1; i<ctx->Const.MaxTextureLevels; i++) { - if (width>1) { + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { width /= 2; } - if (height>1) { + if (height > 1) { height /= 2; } if (i >= minLevel && i <= maxLevel) { @@ -278,19 +283,19 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur } } } - else if (t->Dimensions==3) { + else if (t->Dimensions == 3) { /* Test 3-D mipmaps */ GLuint width = t->Image[0]->Width2; GLuint height = t->Image[0]->Height2; GLuint depth = t->Image[0]->Depth2; - for (i=1; i<ctx->Const.MaxTextureLevels; i++) { - if (width>1) { + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { width /= 2; } - if (height>1) { + if (height > 1) { height /= 2; } - if (depth>1) { + if (depth > 1) { depth /= 2; } if (i >= minLevel && i <= maxLevel) { @@ -311,7 +316,41 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur return; } } - if (width==1 && height==1 && depth==1) { + if (width == 1 && height == 1 && depth == 1) { + return; /* found smallest needed mipmap, all done! */ + } + } + } + else if (t->Dimensions == 6) { + /* make sure 6 cube faces are consistant */ + GLuint width = t->Image[0]->Width2; + GLuint height = t->Image[0]->Height2; + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { + width /= 2; + } + if (height > 1) { + height /= 2; + } + if (i >= minLevel && i <= maxLevel) { + /* check that we have images defined */ + if (!t->Image[i] || !t->NegX[i] || + !t->PosY[i] || !t->NegY[i] || + !t->PosZ[i] || !t->NegZ[i]) { + t->Complete = GL_FALSE; + return; + } + /* check that all six images have same size */ + if (t->NegX[i]->Width2!=width || t->NegX[i]->Height2!=height || + t->PosY[i]->Width2!=width || t->PosY[i]->Height2!=height || + t->NegY[i]->Width2!=width || t->NegY[i]->Height2!=height || + t->PosZ[i]->Width2!=width || t->PosZ[i]->Height2!=height || + t->NegZ[i]->Width2!=width || t->NegZ[i]->Height2!=height) { + t->Complete = GL_FALSE; + return; + } + } + if (width == 1 && height == 1) { return; /* found smallest needed mipmap, all done! */ } } @@ -324,6 +363,8 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur } +_glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); + /* * Execute glGenTextures @@ -341,6 +382,12 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) return; } + + /* + * This must be atomic (generation and allocation of texture IDs) + */ + _glthread_LOCK_MUTEX(GenTexturesLock); + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); /* Return the texture names */ @@ -354,6 +401,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) GLuint dims = 0; (void) gl_alloc_texture_object(ctx->Shared, name, dims); } + + _glthread_UNLOCK_MUTEX(GenTexturesLock); } @@ -429,25 +478,37 @@ _mesa_BindTexture( GLenum target, GLuint texName ) switch (target) { case GL_TEXTURE_1D: dim = 1; + oldTexObj = texUnit->CurrentD[1]; break; case GL_TEXTURE_2D: dim = 2; + oldTexObj = texUnit->CurrentD[2]; break; case GL_TEXTURE_3D: dim = 3; + oldTexObj = texUnit->CurrentD[3]; break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + dim = 6; + oldTexObj = texUnit->CurrentCubeMap; + break; + } + /* fallthrough */ default: gl_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); return; } - oldTexObj = texUnit->CurrentD[dim]; - if (oldTexObj->Name == texName) return; - if (texName == 0) - newTexObj = ctx->Shared->DefaultD[dim]; + if (texName == 0) { + if (target == GL_TEXTURE_CUBE_MAP_ARB) + newTexObj = ctx->Shared->DefaultCubeMap; + else + newTexObj = ctx->Shared->DefaultD[dim]; + } else { struct _mesa_HashTable *hash = ctx->Shared->TexObjects; newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); @@ -467,7 +528,22 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj->RefCount++; - texUnit->CurrentD[dim] = newTexObj; + switch (target) { + case GL_TEXTURE_1D: + texUnit->CurrentD[1] = newTexObj; + break; + case GL_TEXTURE_2D: + texUnit->CurrentD[2] = newTexObj; + break; + case GL_TEXTURE_3D: + texUnit->CurrentD[3] = newTexObj; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + texUnit->CurrentCubeMap = newTexObj; + break; + default: + gl_problem(ctx, "bad target in BindTexture"); + } /* If we've changed the CurrentD[123] texture object then update the * ctx->Texture.Current pointer to point to the new texture object. diff --git a/xc/extras/Mesa/src/texobj.h b/xc/extras/Mesa/src/texobj.h index 5c578e9d0..c83c6144c 100644 --- a/xc/extras/Mesa/src/texobj.h +++ b/xc/extras/Mesa/src/texobj.h @@ -31,9 +31,6 @@ #include "types.h" -#ifdef VMS -#define gl_test_texture_object_completeness gl_test_texture_object_complete -#endif /* * Internal functions @@ -48,7 +45,9 @@ extern void gl_free_texture_object( struct gl_shared_state *shared, struct gl_texture_object *t ); -extern void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ); +extern void +_mesa_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *t ); /* diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index 3b0a7f539..a51a7f873 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -34,6 +34,7 @@ #include "macros.h" #include "matrix.h" #include "texobj.h" +#include "teximage.h" #include "texstate.h" #include "texture.h" #include "types.h" @@ -68,35 +69,24 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv"); - if (target!=GL_TEXTURE_ENV) { - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" ); - return; - } + if (target==GL_TEXTURE_ENV) { - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n", - gl_lookup_enum_by_nr(target), - gl_lookup_enum_by_nr(pname), - *param, - gl_lookup_enum_by_nr((GLenum) (GLint) *param)); - - - if (pname==GL_TEXTURE_ENV_MODE) { - GLenum mode = (GLenum) (GLint) *param; - switch (mode) { - case GL_ADD: - if (!gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add")) { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); - return; - } - /* FALL-THROUGH */ - case GL_MODULATE: - case GL_BLEND: - case GL_DECAL: - case GL_REPLACE: + if (pname==GL_TEXTURE_ENV_MODE) { + GLenum mode = (GLenum) (GLint) *param; + switch (mode) { + case GL_ADD: + if (!ctx->Extensions.HaveTextureEnvAdd) { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); + return; + } + /* FALL-THROUGH */ + case GL_MODULATE: + case GL_BLEND: + case GL_DECAL: + case GL_REPLACE: /* A small optimization for drivers */ if (texUnit->EnvMode == mode) - return; + return; if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE)) fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n", @@ -109,23 +99,53 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) default: gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); return; + } } + else if (pname==GL_TEXTURE_ENV_COLOR) { + texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F ); + texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F ); + texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F ); + texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + return; + } + } - else if (pname==GL_TEXTURE_ENV_COLOR) { - texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F ); - texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F ); - texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F ); - texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); + else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) { + + if (!ctx->Extensions.HaveTextureLodBias) { + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + + if (pname==GL_TEXTURE_LOD_BIAS_EXT) { + texUnit->LodBias = param[0]; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + return; + } + } else { - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" ); return; } + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n", + gl_lookup_enum_by_nr(target), + gl_lookup_enum_by_nr(pname), + *param, + gl_lookup_enum_by_nr((GLenum) (GLint) *param)); + /* Tell device driver about the new texture environment */ if (ctx->Driver.TexEnv) { - (*ctx->Driver.TexEnv)( ctx, pname, param ); + (*ctx->Driver.TexEnv)( ctx, target, pname, param ); } + } @@ -253,6 +273,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_3D_EXT: texObj = texUnit->CurrentD[3]; break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + texObj = texUnit->CurrentCubeMap; + break; + } + /* fallthrough */ default: gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; @@ -405,6 +431,28 @@ _mesa_GetTexLevelParameterfv( GLenum target, GLint level, } +static GLuint +tex_image_dimensions(GLcontext *ctx, GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + return 1; + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + return 2; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return 3; + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.HaveTextureCubeMap ? 2 : 0; + default: + gl_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); + return 0; + } +} + void _mesa_GetTexLevelParameteriv( GLenum target, GLint level, @@ -414,6 +462,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const struct gl_texture_image *img = NULL; GLuint dimensions; + GLboolean isProxy; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexLevelParameter"); @@ -422,36 +471,13 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } - switch (target) { - case GL_TEXTURE_1D: - img = texUnit->CurrentD[1]->Image[level]; - dimensions = 1; - break; - case GL_TEXTURE_2D: - img = texUnit->CurrentD[2]->Image[level]; - dimensions = 2; - break; - case GL_TEXTURE_3D: - img = texUnit->CurrentD[3]->Image[level]; - dimensions = 3; - break; - case GL_PROXY_TEXTURE_1D: - img = ctx->Texture.Proxy1D->Image[level]; - dimensions = 1; - break; - case GL_PROXY_TEXTURE_2D: - img = ctx->Texture.Proxy2D->Image[level]; - dimensions = 2; - break; - case GL_PROXY_TEXTURE_3D: - img = ctx->Texture.Proxy3D->Image[level]; - dimensions = 3; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); - return; + dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ + if (dimensions == 0) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); + return; } + img = _mesa_select_tex_image(ctx, texUnit, target, level); if (!img) { if (pname == GL_TEXTURE_COMPONENTS) *params = 1; @@ -460,6 +486,11 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } + isProxy = (target == GL_PROXY_TEXTURE_1D) || + (target == GL_PROXY_TEXTURE_2D) || + (target == GL_PROXY_TEXTURE_3D) || + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); + switch (pname) { case GL_TEXTURE_WIDTH: *params = img->Width; @@ -509,9 +540,31 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_TEXTURE_INDEX_SIZE_EXT: *params = img->IndexBits; return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCompression) { + if (img->IsCompressed && !isProxy) + *params = img->CompressedSize; + else + gl_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameter[if]v(pname)"); + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_COMPRESSED_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) img->IsCompressed; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + } + return; + default: - gl_error( ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)" ); + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } } @@ -526,19 +579,10 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameterfv"); - switch (target) { - case GL_TEXTURE_1D: - obj = texUnit->CurrentD[1]; - break; - case GL_TEXTURE_2D: - obj = texUnit->CurrentD[2]; - break; - case GL_TEXTURE_3D_EXT: - obj = texUnit->CurrentD[3]; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); - return; + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); + return; } switch (pname) { @@ -596,19 +640,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameteriv"); - switch (target) { - case GL_TEXTURE_1D: - obj = texUnit->CurrentD[1]; - break; - case GL_TEXTURE_2D: - obj = texUnit->CurrentD[2]; - break; - case GL_TEXTURE_3D_EXT: - obj = texUnit->CurrentD[3]; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); - return; + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); + return; } switch (pname) { @@ -737,30 +772,30 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; - switch(mode) { - case GL_OBJECT_LINEAR: - texUnit->GenModeT = GL_OBJECT_LINEAR; - texUnit->GenBitT = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - texUnit->GenModeT = GL_EYE_LINEAR; - texUnit->GenBitT = TEXGEN_EYE_LINEAR; - break; - case GL_REFLECTION_MAP_NV: - texUnit->GenModeT = GL_REFLECTION_MAP_NV; - texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - texUnit->GenModeT = GL_NORMAL_MAP_NV; - texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; - break; - case GL_SPHERE_MAP: - texUnit->GenModeT = GL_SPHERE_MAP; - texUnit->GenBitT = TEXGEN_SPHERE_MAP; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; + switch (mode) { + case GL_OBJECT_LINEAR: + texUnit->GenModeT = GL_OBJECT_LINEAR; + texUnit->GenBitT = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + texUnit->GenModeT = GL_EYE_LINEAR; + texUnit->GenBitT = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + texUnit->GenModeT = GL_REFLECTION_MAP_NV; + texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + texUnit->GenModeT = GL_NORMAL_MAP_NV; + texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + texUnit->GenModeT = GL_SPHERE_MAP; + texUnit->GenBitT = TEXGEN_SPHERE_MAP; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; } } else if (pname==GL_OBJECT_PLANE) { @@ -927,7 +962,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGendv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); @@ -1005,7 +1040,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGenfv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); @@ -1083,7 +1118,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGeniv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeS; @@ -1289,8 +1324,8 @@ void gl_update_dirty_texobjs( GLcontext *ctx ) struct gl_texture_object *t, *next; for (t = ctx->Shared->DirtyTexObjList; t; t = next) { next = t->NextDirty; - gl_test_texture_object_completeness(ctx, t); - gl_set_texture_sampler(t); + _mesa_test_texobj_completeness(ctx, t); + _mesa_set_texture_sampler(t); t->NextDirty = NULL; t->Dirty = GL_FALSE; } diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c index c73171bd2..829b1bcb7 100644 --- a/xc/extras/Mesa/src/texture.c +++ b/xc/extras/Mesa/src/texture.c @@ -32,6 +32,7 @@ #include "macros.h" #include "mmath.h" #include "pb.h" +#include "teximage.h" #include "texture.h" #include "types.h" #include "xform.h" @@ -144,7 +145,12 @@ void gl_update_texture_unit( GLcontext *ctx, struct gl_texture_unit *texUnit ) { (void) ctx; - if ((texUnit->Enabled & TEXTURE0_3D) && texUnit->CurrentD[3]->Complete) { + if ((texUnit->Enabled & TEXTURE0_CUBE) && texUnit->CurrentCubeMap->Complete) { + texUnit->ReallyEnabled = TEXTURE0_CUBE; + texUnit->Current = texUnit->CurrentCubeMap; + texUnit->CurrentDimension = 6; + } + else if ((texUnit->Enabled & TEXTURE0_3D) && texUnit->CurrentD[3]->Complete) { texUnit->ReallyEnabled = TEXTURE0_3D; texUnit->Current = texUnit->CurrentD[3]; texUnit->CurrentDimension = 3; @@ -162,6 +168,10 @@ void gl_update_texture_unit( GLcontext *ctx, struct gl_texture_unit *texUnit ) else { if (MESA_VERBOSE & VERBOSE_TEXTURE) { switch (texUnit->Enabled) { + case TEXTURE0_CUBE: + fprintf(stderr, "Using incomplete cube texture %u\n", + texUnit->CurrentCubeMap->Name); + break; case TEXTURE0_3D: fprintf(stderr, "Using incomplete 3d texture %u\n", texUnit->CurrentD[3]->Name); @@ -245,11 +255,13 @@ static void palette_sample(const struct gl_texture_object *tObj, GLenum format; if (ctx->Texture.SharedPalette) { - palette = ctx->Texture.Palette.Table; + ASSERT(ctx->Texture.Palette.TableType == GL_UNSIGNED_BYTE); + palette = (const GLubyte *) ctx->Texture.Palette.Table; format = ctx->Texture.Palette.Format; } else { - palette = tObj->Palette.Table; + ASSERT(tObj->Palette.TableType == GL_UNSIGNED_BYTE); + palette = (const GLubyte *) tObj->Palette.Table; format = tObj->Palette.Format; } @@ -532,10 +544,10 @@ static void sample_1d_linear( const struct gl_texture_object *tObj, } { - GLfloat a = myFrac(u); + const GLfloat a = myFrac(u); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ - GLint w0 = (GLint) ((1.0F-a) * WEIGHT_SCALE + 0.5F); - GLint w1 = (GLint) ( a * WEIGHT_SCALE + 0.5F); + const GLint w0 = (GLint) ((1.0F-a) * WEIGHT_SCALE + 0.5F); + const GLint w1 = (GLint) ( a * WEIGHT_SCALE + 0.5F); GLubyte t0[4], t1[4]; /* texels */ @@ -614,7 +626,7 @@ sample_1d_nearest_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_1d_nearest( tObj, tObj->Image[level ], s, t0 ); sample_1d_nearest( tObj, tObj->Image[level+1], s, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -643,7 +655,7 @@ sample_1d_linear_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_1d_linear( tObj, tObj->Image[level ], s, t0 ); sample_1d_linear( tObj, tObj->Image[level+1], s, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -906,13 +918,13 @@ static void sample_2d_linear( const struct gl_texture_object *tObj, } { - GLfloat a = myFrac(u); - GLfloat b = myFrac(v); + const GLfloat a = myFrac(u); + const GLfloat b = myFrac(v); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ - GLint w00 = (GLint) ((1.0F-a)*(1.0F-b) * WEIGHT_SCALE + 0.5F); - GLint w10 = (GLint) ( a *(1.0F-b) * WEIGHT_SCALE + 0.5F); - GLint w01 = (GLint) ((1.0F-a)* b * WEIGHT_SCALE + 0.5F); - GLint w11 = (GLint) ( a * b * WEIGHT_SCALE + 0.5F); + const GLint w00 = (GLint) ((1.0F-a)*(1.0F-b) * WEIGHT_SCALE + 0.5F); + const GLint w10 = (GLint) ( a *(1.0F-b) * WEIGHT_SCALE + 0.5F); + const GLint w01 = (GLint) ((1.0F-a)* b * WEIGHT_SCALE + 0.5F); + const GLint w11 = (GLint) ( a * b * WEIGHT_SCALE + 0.5F); GLubyte t00[4]; GLubyte t10[4]; GLubyte t01[4]; @@ -1008,7 +1020,7 @@ sample_2d_nearest_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_2d_nearest( tObj, tObj->Image[level ], s, t, t0 ); sample_2d_nearest( tObj, tObj->Image[level+1], s, t, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1037,7 +1049,7 @@ sample_2d_linear_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_2d_linear( tObj, tObj->Image[level ], s, t, t0 ); sample_2d_linear( tObj, tObj->Image[level+1], s, t, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1385,9 +1397,9 @@ static void sample_3d_linear( const struct gl_texture_object *tObj, } { - GLfloat a = myFrac(u); - GLfloat b = myFrac(v); - GLfloat c = myFrac(w); + const GLfloat a = myFrac(u); + const GLfloat b = myFrac(v); + const GLfloat c = myFrac(w); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ GLint w000 = (GLint) ((1.0F-a)*(1.0F-b)*(1.0F-c) * WEIGHT_SCALE + 0.5F); GLint w100 = (GLint) ( a *(1.0F-b)*(1.0F-c) * WEIGHT_SCALE + 0.5F); @@ -1525,7 +1537,7 @@ sample_3d_nearest_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_3d_nearest( tObj, tObj->Image[level ], s, t, r, t0 ); sample_3d_nearest( tObj, tObj->Image[level+1], s, t, r, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1553,7 +1565,7 @@ sample_3d_linear_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_3d_linear( tObj, tObj->Image[level ], s, t, r, t0 ); sample_3d_linear( tObj, tObj->Image[level+1], s, t, r, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1648,6 +1660,187 @@ static void sample_lambda_3d( const struct gl_texture_object *tObj, GLuint n, } +/**********************************************************************/ +/* Texture Cube Map Sampling Functions */ +/**********************************************************************/ + +static struct gl_texture_image * +choose_cube_face(const struct gl_texture_object *texObj, + const GLfloat texcoord[4], + GLint level, + GLfloat *newS, GLfloat *newT) +{ +/* + major axis + direction target sc tc ma + ---------- ------------------------------- --- --- --- + +rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx + -rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx + +ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry + -ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry + +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz + -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz +*/ + struct gl_texture_image *texImg; + const GLfloat rx = texcoord[0], ry = texcoord[1], rz = texcoord[2]; + const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz); + GLfloat sc, tc, ma; + + if (arx > ary && arx > arz) { + if (rx >= 0.0F) { + texImg = texObj->Image[level]; + sc = -rz; + tc = -ry; + ma = arx; + } + else { + texImg = texObj->NegX[level]; + sc = rz; + tc = -ry; + ma = arx; + } + } + else if (ary > arx && ary > arz) { + if (ry >= 0.0F) { + texImg = texObj->PosY[level]; + sc = rx; + tc = rz; + ma = ary; + } + else { + texImg = texObj->NegY[level]; + sc = rx; + tc = -rz; + ma = ary; + } + } + else { + if (rz > 0.0F) { + texImg = texObj->PosZ[level]; + sc = rx; + tc = -ry; + ma = arz; + } + else { + texImg = texObj->NegZ[level]; + sc = -rx; + tc = -ry; + ma = arz; + } + } + + *newS = ( sc / ma + 1.0F ) * 0.5F; + *newT = ( tc / ma + 1.0F ) * 0.5F; + return texImg; +} + + +static void +sample_nearest_cube(const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLubyte rgba[][4]) +{ + GLuint i; + (void) lambda; + for (i = 0; i < n; i++) { + struct gl_texture_image *image; + GLfloat newS, newT; + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + image = choose_cube_face(tObj, coord, 0, &newS, &newT); + sample_2d_nearest( tObj, image, newS, newT, rgba[i] ); + } +} + +static void +sample_linear_cube(const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLubyte rgba[][4]) +{ + GLuint i; + (void) lambda; + for (i = 0; i < n; i++) { + struct gl_texture_image *image; + GLfloat newS, newT; + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + image = choose_cube_face(tObj, coord, 0, &newS, &newT); + sample_2d_linear( tObj, image, newS, newT, rgba[i] ); + } +} + +static void +sample_lambda_cube(const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLubyte rgba[][4]) +{ + GLuint i; + + for (i = 0; i < n; i++) { + struct gl_texture_image *image; + GLfloat newS, newT; + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + image = choose_cube_face(tObj, coord, 0, &newS, &newT); + + if (lambda[i] > tObj->MinMagThresh) { + /* minification */ + switch (tObj->MinFilter) { + case GL_NEAREST: + sample_2d_nearest( tObj, image, newS, newT, rgba[i] ); + break; + case GL_LINEAR: + sample_2d_linear( tObj, image, newS, newT, rgba[i] ); + break; + case GL_NEAREST_MIPMAP_NEAREST: + /* + sample_3d_nearest_mipmap_nearest( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + case GL_LINEAR_MIPMAP_NEAREST: + /* + sample_3d_linear_mipmap_nearest( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + case GL_NEAREST_MIPMAP_LINEAR: + /* + sample_3d_nearest_mipmap_linear( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + case GL_LINEAR_MIPMAP_LINEAR: + /* + sample_3d_linear_mipmap_linear( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + default: + gl_problem(NULL, "Bad min filter in sample_lambda_cube"); + } + } + else { + /* magnification */ + switch (tObj->MagFilter) { + case GL_NEAREST: + sample_2d_nearest( tObj, image, newS, newT, rgba[i] ); + break; + case GL_LINEAR: + sample_2d_linear( tObj, image, newS, newT, rgba[i] ); + break; + default: + gl_problem(NULL, "Bad mag filter in sample_lambda_cube"); + } + } + } +} + /**********************************************************************/ /* Texture Sampling Setup */ @@ -1657,7 +1850,8 @@ static void sample_lambda_3d( const struct gl_texture_object *tObj, GLuint n, /* * Setup the texture sampling function for this texture object. */ -void gl_set_texture_sampler( struct gl_texture_object *t ) +void +_mesa_set_texture_sampler( struct gl_texture_object *t ) { if (!t->Complete) { t->SampleFunc = NULL; @@ -1723,8 +1917,20 @@ void gl_set_texture_sampler( struct gl_texture_object *t ) t->SampleFunc = sample_nearest_3d; } break; + case 6: /* cube map */ + if (needLambda) { + t->SampleFunc = sample_lambda_cube; + } + else if (t->MinFilter==GL_LINEAR) { + t->SampleFunc = sample_linear_cube; + } + else { + ASSERT(t->MinFilter==GL_NEAREST); + t->SampleFunc = sample_nearest_cube; + } + break; default: - gl_problem(NULL, "invalid dimensions in gl_set_texture_sampler"); + gl_problem(NULL, "invalid dimensions in _mesa_set_texture_sampler"); } } } @@ -2092,12 +2298,18 @@ void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat r[], GLfloat lambda[], GLubyte rgba[][4] ) { - GLuint mask = (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D) << (texUnit * 4); + GLuint mask = (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE) << (texUnit * 4); if (ctx->Texture.Enabled & mask) { const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; if (textureUnit->Current && textureUnit->Current->SampleFunc) { - GLubyte texel[PB_SIZE][4]; + if (textureUnit->LodBias != 0.0F) { + /* apply LOD bias, but don't clamp yet */ + GLuint i; + for (i=0;i<n;i++) { + lambda[i] += textureUnit->LodBias; + } + } if (textureUnit->Current->MinLod != -1000.0 || textureUnit->Current->MaxLod != 1000.0) { @@ -2111,6 +2323,45 @@ void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n, } } + /* fetch texture images from device driver, if needed */ + { + static const GLenum targets[] = { + GL_TEXTURE_1D, + GL_TEXTURE_2D, + GL_TEXTURE_3D, + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_CUBE_MAP_ARB + }; + struct gl_texture_object *texObj = textureUnit->Current; + GLboolean needLambda = (texObj->MinFilter != texObj->MagFilter); + GLenum target = targets[texObj->Dimensions - 1]; + if (needLambda) { + GLint level; + /* Get images for all mipmap levels. We might not need them + * all but this is easier. We're on a (slow) software path + * anyway. + */ + for (level = 0; level <= texObj->P; level++) { + struct gl_texture_image *texImg = texObj->Image[level]; + if (!texImg->Data) { + _mesa_get_teximage_from_driver(ctx, target, level, texObj); + if (!texImg->Data) + return; /* out of memory */ + } + } + } + else { + GLint level = texObj->BaseLevel; + struct gl_texture_image *texImg = texObj->Image[level]; + if (!texImg->Data) { + _mesa_get_teximage_from_driver(ctx, target, level, texObj); + if (!texImg->Data) + return; /* out of memory */ + } + } + } + /* Sample the texture. */ (*textureUnit->Current->SampleFunc)( textureUnit->Current, n, s, t, r, lambda, texel ); diff --git a/xc/extras/Mesa/src/texture.h b/xc/extras/Mesa/src/texture.h index d6631b786..58bc13136 100644 --- a/xc/extras/Mesa/src/texture.h +++ b/xc/extras/Mesa/src/texture.h @@ -34,7 +34,8 @@ #include "types.h" -extern void gl_set_texture_sampler( struct gl_texture_object *t ); +extern void +_mesa_set_texture_sampler( struct gl_texture_object *t ); extern void gl_init_texture( void ); diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h index b3af90a8c..d85698a73 100644 --- a/xc/extras/Mesa/src/types.h +++ b/xc/extras/Mesa/src/types.h @@ -31,7 +31,6 @@ #include "glheader.h" #include "config.h" -#include "extensions.h" #include "fixed.h" #include "glapitable.h" #include "glthread.h" @@ -82,13 +81,7 @@ /* * Depth buffer data type: */ -#if DEPTH_BITS==16 - typedef GLushort GLdepth; -#elif DEPTH_BITS==32 - typedef GLint GLdepth; -#else -# error "illegal number of depth bits" -#endif +typedef GLuint GLdepth; /* Must be 32-bits! */ @@ -182,42 +175,52 @@ typedef void (*TextureSampleFunc)( const struct gl_texture_object *tObj, /* Texture image record */ struct gl_texture_image { - GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, + GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_RGB, GL_RGBA, or * GL_COLOR_INDEX only */ - GLenum IntFormat; /* Internal format as given by the user */ - GLubyte RedBits; /* Bits per texel component */ - GLubyte GreenBits; /* These are initialized by Mesa but */ - GLubyte BlueBits; /* may be reassigned by the device */ - GLubyte AlphaBits; /* driver to indicate the true texture */ - GLubyte IntensityBits; /* color resolution. */ - GLubyte LuminanceBits; - GLubyte IndexBits; - GLuint Border; /* 0 or 1 */ - GLuint Width; /* = 2^WidthLog2 + 2*Border */ - GLuint Height; /* = 2^HeightLog2 + 2*Border */ - GLuint Depth; /* = 2^DepthLog2 + 2*Border */ - GLuint Width2; /* = Width - 2*Border */ - GLuint Height2; /* = Height - 2*Border */ - GLuint Depth2; /* = Depth - 2*Border */ - GLuint WidthLog2; /* = log2(Width2) */ - GLuint HeightLog2; /* = log2(Height2) */ - GLuint DepthLog2; /* = log2(Depth2) */ - GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ - GLubyte *Data; /* Image data as unsigned bytes */ - - /* For device driver: */ - void *DriverData; /* Arbitrary device driver data */ + GLenum IntFormat; /* Internal format as given by the user */ + GLubyte RedBits; /* Bits per texel component */ + GLubyte GreenBits; /* These are initialized by Mesa but */ + GLubyte BlueBits; /* may be reassigned by the device */ + GLubyte AlphaBits; /* driver to indicate the true texture */ + GLubyte IntensityBits; /* color resolution. */ + GLubyte LuminanceBits; + GLubyte IndexBits; + GLuint Border; /* 0 or 1 */ + GLuint Width; /* = 2^WidthLog2 + 2*Border */ + GLuint Height; /* = 2^HeightLog2 + 2*Border */ + GLuint Depth; /* = 2^DepthLog2 + 2*Border */ + GLuint Width2; /* = Width - 2*Border */ + GLuint Height2; /* = Height - 2*Border */ + GLuint Depth2; /* = Depth - 2*Border */ + GLuint WidthLog2; /* = log2(Width2) */ + GLuint HeightLog2; /* = log2(Height2) */ + GLuint DepthLog2; /* = log2(Depth2) */ + GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ + GLubyte *Data; /* Image data as unsigned bytes */ + + GLboolean IsCompressed; /* GL_ARB_texture_compression */ + GLuint CompressedSize; /* GL_ARB_texture_compression */ + + /* For device driver: */ + void *DriverData; /* Arbitrary device driver data */ }; /* Data structure for color tables */ struct gl_color_table { - GLubyte Table[4 * MAX_TEXTURE_PALETTE_SIZE]; - GLuint Size; /* number of entries (rows) in table */ - GLenum Format; - GLenum IntFormat; + GLvoid *Table; + GLenum TableType; /* GL_UNSIGNED_BYTE or GL_FLOAT */ + GLuint Size; /* number of entries (rows) in table */ + GLenum Format; + GLenum IntFormat; + GLint RedSize; + GLint GreenSize; + GLint BlueSize; + GLint AlphaSize; + GLint LuminanceSize; + GLint IntensitySize; }; @@ -261,47 +264,47 @@ struct gl_color_table { #define SHINE_TABLE_SIZE 256 struct gl_light { - struct gl_light *next; /* double linked list with sentinel */ - struct gl_light *prev; - - GLfloat Ambient[4]; /* ambient color */ - GLfloat Diffuse[4]; /* diffuse color */ - GLfloat Specular[4]; /* specular color */ - GLfloat EyePosition[4]; /* position in eye coordinates */ - GLfloat EyeDirection[4]; /* spotlight dir in eye coordinates */ - GLfloat SpotExponent; - GLfloat SpotCutoff; /* in degress */ - GLfloat CosCutoff; /* = MAX(0, cos(SpotCutoff)) */ - GLfloat ConstantAttenuation; - GLfloat LinearAttenuation; - GLfloat QuadraticAttenuation; - GLboolean Enabled; /* On/off flag */ - - /* Derived fields */ - GLuint Flags; /* State */ - - GLfloat Position[4]; /* position in eye/obj coordinates */ - GLfloat VP_inf_norm[3]; /* Norm direction to infinite light */ - GLfloat h_inf_norm[3]; /* Norm( VP_inf_norm + <0,0,1> ) */ - GLfloat NormDirection[4]; /* normalized spotlight direction */ - GLfloat VP_inf_spot_attenuation; - - GLfloat SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ - GLfloat MatAmbient[2][3]; /* material ambient * light ambient */ - GLfloat MatDiffuse[2][3]; /* material diffuse * light diffuse */ - GLfloat MatSpecular[2][3]; /* material spec * light specular */ - GLfloat dli; /* CI diffuse light intensity */ - GLfloat sli; /* CI specular light intensity */ - GLboolean IsMatSpecular[2]; + struct gl_light *next; /* double linked list with sentinel */ + struct gl_light *prev; + + GLfloat Ambient[4]; /* ambient color */ + GLfloat Diffuse[4]; /* diffuse color */ + GLfloat Specular[4]; /* specular color */ + GLfloat EyePosition[4]; /* position in eye coordinates */ + GLfloat EyeDirection[4]; /* spotlight dir in eye coordinates */ + GLfloat SpotExponent; + GLfloat SpotCutoff; /* in degress */ + GLfloat CosCutoff; /* = MAX(0, cos(SpotCutoff)) */ + GLfloat ConstantAttenuation; + GLfloat LinearAttenuation; + GLfloat QuadraticAttenuation; + GLboolean Enabled; /* On/off flag */ + + /* Derived fields */ + GLuint Flags; /* State */ + + GLfloat Position[4]; /* position in eye/obj coordinates */ + GLfloat VP_inf_norm[3]; /* Norm direction to infinite light */ + GLfloat h_inf_norm[3]; /* Norm( VP_inf_norm + <0,0,1> ) */ + GLfloat NormDirection[4]; /* normalized spotlight direction */ + GLfloat VP_inf_spot_attenuation; + + GLfloat SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ + GLfloat MatAmbient[2][3]; /* material ambient * light ambient */ + GLfloat MatDiffuse[2][3]; /* material diffuse * light diffuse */ + GLfloat MatSpecular[2][3]; /* material spec * light specular */ + GLfloat dli; /* CI diffuse light intensity */ + GLfloat sli; /* CI specular light intensity */ + GLboolean IsMatSpecular[2]; }; struct gl_lightmodel { - GLfloat Ambient[4]; /* ambient color */ - GLboolean LocalViewer; /* Local (or infinite) view point? */ - GLboolean TwoSide; /* Two (or one) sided lighting? */ - GLenum ColorControl; /* either GL_SINGLE_COLOR */ - /* or GL_SEPARATE_SPECULAR_COLOR */ + GLfloat Ambient[4]; /* ambient color */ + GLboolean LocalViewer; /* Local (or infinite) view point? */ + GLboolean TwoSide; /* Two (or one) sided lighting? */ + GLenum ColorControl; /* either GL_SINGLE_COLOR */ + /* or GL_SEPARATE_SPECULAR_COLOR */ }; @@ -313,7 +316,7 @@ struct gl_lightmodel { struct gl_accum_attrib { - GLfloat ClearColor[4]; /* Accumulation buffer clear color */ + GLfloat ClearColor[4]; /* Accumulation buffer clear color */ }; @@ -327,180 +330,220 @@ struct gl_accum_attrib { struct gl_colorbuffer_attrib { - GLuint ClearIndex; /* Index to use for glClear */ - GLfloat ClearColor[4]; /* Color to use for glClear */ - - GLuint IndexMask; /* Color index write mask */ - GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ - GLboolean SWmasking; /* Do color/CI masking in software? */ - - GLenum DrawBuffer; /* Which buffer to draw into */ - GLenum DriverDrawBuffer; /* Current device driver dest buffer */ - GLboolean MultiDrawBuffer; /* Drawing to mutliple buffers? */ - GLubyte DrawDestMask; /* bitwise-OR of bitflags above */ - - /* alpha testing */ - GLboolean AlphaEnabled; /* Alpha test enabled flag */ - GLenum AlphaFunc; /* Alpha test function */ - GLubyte AlphaRef; /* Alpha ref value in range [0,255] */ - - /* blending */ - GLboolean BlendEnabled; /* Blending enabled flag */ - GLenum BlendSrcRGB; /* Blending source operator */ - GLenum BlendDstRGB; /* Blending destination operator */ - GLenum BlendSrcA; /* GL_INGR_blend_func_separate */ - GLenum BlendDstA; /* GL_INGR_blend_func_separate */ - GLenum BlendEquation; - GLfloat BlendColor[4]; - blend_func BlendFunc; /* Points to C blending function */ - - /* logic op */ - GLenum LogicOp; /* Logic operator */ - GLboolean IndexLogicOpEnabled; /* Color index logic op enabled flag */ - GLboolean ColorLogicOpEnabled; /* RGBA logic op enabled flag */ - GLboolean SWLogicOpEnabled; /* Do logic ops in software? */ - - GLboolean DitherFlag; /* Dither enable flag */ + GLuint ClearIndex; /* Index to use for glClear */ + GLfloat ClearColor[4]; /* Color to use for glClear */ + + GLuint IndexMask; /* Color index write mask */ + GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ + GLboolean SWmasking; /* Do color/CI masking in software? */ + + GLenum DrawBuffer; /* Which buffer to draw into */ + GLenum DriverDrawBuffer; /* Current device driver dest buffer */ + GLboolean MultiDrawBuffer; /* Drawing to mutliple buffers? */ + GLubyte DrawDestMask; /* bitwise-OR of bitflags above */ + + /* alpha testing */ + GLboolean AlphaEnabled; /* Alpha test enabled flag */ + GLenum AlphaFunc; /* Alpha test function */ + GLubyte AlphaRef; /* Alpha ref value in range [0,255] */ + + /* blending */ + GLboolean BlendEnabled; /* Blending enabled flag */ + GLenum BlendSrcRGB; /* Blending source operator */ + GLenum BlendDstRGB; /* Blending destination operator */ + GLenum BlendSrcA; /* GL_INGR_blend_func_separate */ + GLenum BlendDstA; /* GL_INGR_blend_func_separate */ + GLenum BlendEquation; + GLfloat BlendColor[4]; + blend_func BlendFunc; /* Points to C blending function */ + + /* logic op */ + GLenum LogicOp; /* Logic operator */ + GLboolean IndexLogicOpEnabled; /* Color index logic op enabled flag */ + GLboolean ColorLogicOpEnabled; /* RGBA logic op enabled flag */ + GLboolean SWLogicOpEnabled; /* Do logic ops in software? */ + + GLboolean DitherFlag; /* Dither enable flag */ }; struct gl_current_attrib { - /* KW: These values valid only when the VB is flushed. - */ - GLuint Flag; /* Contains size information */ - GLfloat Normal[3]; - GLubyte ByteColor[4]; /* Current RGBA color */ - GLuint Index; /* Current color index */ - GLboolean EdgeFlag; /* Current edge flag */ - GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ - GLenum Primitive; /* Prim or GL_POLYGON+1 */ + /* KW: These values valid only when the VB is flushed. + */ + GLuint Flag; /* Contains size information */ + GLfloat Normal[3]; + GLubyte ByteColor[4]; /* Current RGBA color */ + GLuint Index; /* Current color index */ + GLboolean EdgeFlag; /* Current edge flag */ + GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ + GLenum Primitive; /* Prim or GL_POLYGON+1 */ - /* KW: No change to these values. - */ - GLfloat RasterPos[4]; /* Current raster position */ - GLfloat RasterDistance; /* Current raster distance */ - GLfloat RasterColor[4]; /* Current raster color */ - GLuint RasterIndex; /* Current raster index */ - GLfloat *RasterTexCoord; /* Current raster texcoord*/ - GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; - GLboolean RasterPosValid; /* Raster po valid flag */ + /* KW: No change to these values. + */ + GLfloat RasterPos[4]; /* Current raster position */ + GLfloat RasterDistance; /* Current raster distance */ + GLfloat RasterColor[4]; /* Current raster color */ + GLuint RasterIndex; /* Current raster index */ + GLfloat *RasterTexCoord; /* Current raster texcoord*/ + GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; + GLboolean RasterPosValid; /* Raster po valid flag */ }; struct gl_depthbuffer_attrib { - GLenum Func; /* Function for depth buffer compare */ - GLfloat Clear; /* Value to clear depth buffer to */ - GLboolean Test; /* Depth buffering enabled flag */ - GLboolean Mask; /* Depth buffer writable? */ + GLenum Func; /* Function for depth buffer compare */ + GLfloat Clear; /* Value to clear depth buffer to */ + GLboolean Test; /* Depth buffering enabled flag */ + GLboolean Mask; /* Depth buffer writable? */ + GLboolean OcclusionTest; /* GL_HP_occlusion_test */ }; struct gl_enable_attrib { - GLboolean AlphaTest; - GLboolean AutoNormal; - GLboolean Blend; - GLboolean ClipPlane[MAX_CLIP_PLANES]; - GLboolean ColorMaterial; - GLboolean CullFace; - GLboolean DepthTest; - GLboolean Dither; - GLboolean Fog; - GLboolean Light[MAX_LIGHTS]; - GLboolean Lighting; - GLboolean LineSmooth; - GLboolean LineStipple; - GLboolean IndexLogicOp; - GLboolean ColorLogicOp; - GLboolean Map1Color4; - GLboolean Map1Index; - GLboolean Map1Normal; - GLboolean Map1TextureCoord1; - GLboolean Map1TextureCoord2; - GLboolean Map1TextureCoord3; - GLboolean Map1TextureCoord4; - GLboolean Map1Vertex3; - GLboolean Map1Vertex4; - GLboolean Map2Color4; - GLboolean Map2Index; - GLboolean Map2Normal; - GLboolean Map2TextureCoord1; - GLboolean Map2TextureCoord2; - GLboolean Map2TextureCoord3; - GLboolean Map2TextureCoord4; - GLboolean Map2Vertex3; - GLboolean Map2Vertex4; - GLboolean Normalize; - GLboolean PointSmooth; - GLboolean PolygonOffsetPoint; - GLboolean PolygonOffsetLine; - GLboolean PolygonOffsetFill; - GLboolean PolygonSmooth; - GLboolean PolygonStipple; - GLboolean RescaleNormals; - GLboolean Scissor; - GLboolean Stencil; - GLuint Texture; - GLuint TexGen[MAX_TEXTURE_UNITS]; + GLboolean AlphaTest; + GLboolean AutoNormal; + GLboolean Blend; + GLboolean ClipPlane[MAX_CLIP_PLANES]; + GLboolean ColorMaterial; + GLboolean Convolution1D; + GLboolean Convolution2D; + GLboolean Separable2D; + GLboolean CullFace; + GLboolean DepthTest; + GLboolean Dither; + GLboolean Fog; + GLboolean Histogram; + GLboolean Light[MAX_LIGHTS]; + GLboolean Lighting; + GLboolean LineSmooth; + GLboolean LineStipple; + GLboolean IndexLogicOp; + GLboolean ColorLogicOp; + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean MinMax; + GLboolean Normalize; + GLboolean PixelTexture; + GLboolean PointSmooth; + GLboolean PolygonOffsetPoint; + GLboolean PolygonOffsetLine; + GLboolean PolygonOffsetFill; + GLboolean PolygonSmooth; + GLboolean PolygonStipple; + GLboolean RescaleNormals; + GLboolean Scissor; + GLboolean Stencil; + GLuint Texture; + GLuint TexGen[MAX_TEXTURE_UNITS]; }; struct gl_eval_attrib { - /* Enable bits */ - GLboolean Map1Color4; - GLboolean Map1Index; - GLboolean Map1Normal; - GLboolean Map1TextureCoord1; - GLboolean Map1TextureCoord2; - GLboolean Map1TextureCoord3; - GLboolean Map1TextureCoord4; - GLboolean Map1Vertex3; - GLboolean Map1Vertex4; - GLboolean Map2Color4; - GLboolean Map2Index; - GLboolean Map2Normal; - GLboolean Map2TextureCoord1; - GLboolean Map2TextureCoord2; - GLboolean Map2TextureCoord3; - GLboolean Map2TextureCoord4; - GLboolean Map2Vertex3; - GLboolean Map2Vertex4; - GLboolean AutoNormal; - /* Map Grid endpoints and divisions and calculated du values */ - GLint MapGrid1un; - GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; - GLint MapGrid2un, MapGrid2vn; - GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; - GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; + /* Enable bits */ + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean AutoNormal; + /* Map Grid endpoints and divisions and calculated du values */ + GLint MapGrid1un; + GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; + GLint MapGrid2un, MapGrid2vn; + GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; + GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; }; struct gl_fog_attrib { - GLboolean Enabled; /* Fog enabled flag */ - GLfloat Color[4]; /* Fog color */ - GLfloat Density; /* Density >= 0.0 */ - GLfloat Start; /* Start distance in eye coords */ - GLfloat End; /* End distance in eye coords */ - GLfloat Index; /* Fog index */ - GLenum Mode; /* Fog mode */ + GLboolean Enabled; /* Fog enabled flag */ + GLfloat Color[4]; /* Fog color */ + GLfloat Density; /* Density >= 0.0 */ + GLfloat Start; /* Start distance in eye coords */ + GLfloat End; /* End distance in eye coords */ + GLfloat Index; /* Fog index */ + GLenum Mode; /* Fog mode */ }; struct gl_hint_attrib { - /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */ - GLenum PerspectiveCorrection; - GLenum PointSmooth; - GLenum LineSmooth; - GLenum PolygonSmooth; - GLenum Fog; - - /* GL_PGI_misc_hints */ - GLenum AllowDrawWin; - GLenum AllowDrawSpn; - GLenum AllowDrawMem; - GLenum StrictLighting; - - /* GL_EXT_clip_volume_hint */ - GLenum ClipVolumeClipping; + /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */ + GLenum PerspectiveCorrection; + GLenum PointSmooth; + GLenum LineSmooth; + GLenum PolygonSmooth; + GLenum Fog; + + /* GL_PGI_misc_hints */ + GLenum AllowDrawWin; + GLenum AllowDrawFrg; + GLenum AllowDrawMem; + GLenum StrictLighting; + + /* GL_EXT_clip_volume_hint */ + GLenum ClipVolumeClipping; + + /* GL_ARB_texture_compression */ + GLenum TextureCompression; +}; + + +struct gl_histogram_attrib { + GLuint Width; + GLint Format; + GLboolean Sink; + GLuint RedSize; + GLuint GreenSize; + GLuint BlueSize; + GLuint AlphaSize; + GLuint LuminanceSize; + GLuint Count[HISTOGRAM_TABLE_SIZE][4]; +}; + + +struct gl_minmax_attrib { + GLenum Format; + GLboolean Sink; + GLfloat Min[4], Max[4]; /* RGBA */ +}; + + +struct gl_convolution_attrib { + /* XXX not done yet */ + GLenum Format; + GLenum InternalFormat; + GLuint Width; + GLuint Height; + GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4]; }; @@ -534,109 +577,139 @@ struct gl_light_attrib { #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? */ - GLushort StipplePattern; /* Stipple pattern */ - GLint StippleFactor; /* Stipple repeat factor */ - GLfloat Width; /* Line width */ + GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */ + GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */ + GLushort StipplePattern; /* Stipple pattern */ + GLint StippleFactor; /* Stipple repeat factor */ + GLfloat Width; /* Line width */ }; struct gl_list_attrib { - GLuint ListBase; + GLuint ListBase; }; struct gl_pixel_attrib { - GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ - GLenum DriverReadBuffer; /* Driver's current source buffer */ - GLfloat RedBias, RedScale; - GLfloat GreenBias, GreenScale; - GLfloat BlueBias, BlueScale; - GLfloat AlphaBias, AlphaScale; - GLboolean ScaleOrBiasRGBA; - GLfloat DepthBias, DepthScale; - GLint IndexShift, IndexOffset; - GLboolean MapColorFlag; - GLboolean MapStencilFlag; - GLfloat ZoomX; /* Pixel zoom X factor */ - GLfloat ZoomY; /* Pixel zoom Y factor */ - GLint MapStoSsize; /* Size of each pixel map */ - GLint MapItoIsize; - GLint MapItoRsize; - GLint MapItoGsize; - GLint MapItoBsize; - GLint MapItoAsize; - GLint MapRtoRsize; - GLint MapGtoGsize; - GLint MapBtoBsize; - GLint MapAtoAsize; - GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /* Pixel map tables */ - GLint MapItoI[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; - GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /* converted to 8-bit color */ - GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; - GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; - GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; - GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; - GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; - GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; - GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; + GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ + GLenum DriverReadBuffer; /* Driver's current source buffer */ + GLfloat RedBias, RedScale; + GLfloat GreenBias, GreenScale; + GLfloat BlueBias, BlueScale; + GLfloat AlphaBias, AlphaScale; + GLboolean ScaleOrBiasRGBA; + GLfloat DepthBias, DepthScale; + GLint IndexShift, IndexOffset; + GLboolean MapColorFlag; + GLboolean MapStencilFlag; + GLfloat ZoomX, ZoomY; + GLint MapStoSsize; /* Size of each pixel map */ + GLint MapItoIsize; + GLint MapItoRsize; + GLint MapItoGsize; + GLint MapItoBsize; + GLint MapItoAsize; + GLint MapRtoRsize; + GLint MapGtoGsize; + GLint MapBtoBsize; + GLint MapAtoAsize; + GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /* Pixel map tables */ + GLint MapItoI[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /* converted to 8-bit color */ + GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; + GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; + GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; + GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; + GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; + /* GL_EXT_histogram */ + GLboolean HistogramEnabled; + GLboolean MinMaxEnabled; + /* GL_SGIS_pixel_texture */ + GLboolean PixelTextureEnabled; + GLenum FragmentRgbSource; + GLenum FragmentAlphaSource; + /* GL_SGI_color_matrix */ + GLfloat PostColorMatrixScale[4]; /* RGBA */ + GLfloat PostColorMatrixBias[4]; /* RGBA */ + GLboolean ScaleOrBiasRGBApcm; + /* GL_SGI_color_table */ + GLfloat ColorTableScale[4]; + GLfloat ColorTableBias[4]; + GLboolean ColorTableEnabled; + GLfloat PCCTscale[4]; + GLfloat PCCTbias[4]; + GLboolean PostConvolutionColorTableEnabled; + GLfloat PCMCTscale[4]; + GLfloat PCMCTbias[4]; + GLboolean PostColorMatrixColorTableEnabled; + /* Convolution */ + GLboolean Convolution1DEnabled; + GLboolean Convolution2DEnabled; + GLboolean Separable2DEnabled; + GLfloat ConvolutionBorderColor[3][4]; + GLenum ConvolutionBorderMode[3]; + GLfloat ConvolutionFilterScale[3][4]; + GLfloat ConvolutionFilterBias[3][4]; + GLfloat PostConvolutionScale[4]; /* RGBA */ + GLfloat PostConvolutionBias[4]; /* RGBA */ }; struct gl_point_attrib { - GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */ - GLfloat Size; /* Point size */ - GLfloat Params[3]; /* Point Parameters EXT distance atenuation - factors by default = {1,0,0} */ - GLfloat MinSize; /* Default 0.0 always >=0 */ - GLfloat MaxSize; /* Default MAX_POINT_SIZE */ - GLfloat Threshold; /* Default 1.0 */ - GLboolean Attenuated; + GLboolean SmoothFlag;/* True if GL_POINT_SMOOTH is enabled */ + GLfloat UserSize; /* User-specified point size */ + GLfloat Size; /* Point size actually used */ + GLfloat Params[3]; /* Point Parameters EXT distance atenuation + factors by default = {1,0,0} */ + GLfloat MinSize; /* Default 0.0 always >=0 */ + GLfloat MaxSize; /* Default MAX_POINT_SIZE */ + GLfloat Threshold; /* Default 1.0 */ + GLboolean Attenuated; }; 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 Unfilled; /* True if back or front mode is not GL_FILL */ - GLboolean CullFlag; /* Culling on/off flag */ - GLubyte CullBits; /* Used for cull testing */ - 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 */ - GLfloat OffsetUnits; /* Polygon offset units */ - GLboolean OffsetPoint; /* Offset in GL_POINT mode? */ - GLboolean OffsetLine; /* Offset in GL_LINE mode? */ - GLboolean OffsetFill; /* Offset in GL_FILL mode? */ - + 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 Unfilled; /* True if back or front mode is not GL_FILL */ + GLboolean CullFlag; /* Culling on/off flag */ + GLubyte CullBits; /* Used for cull testing */ + 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 */ + GLfloat OffsetUnits; /* Polygon offset units */ + GLboolean OffsetPoint; /* Offset in GL_POINT mode? */ + GLboolean OffsetLine; /* Offset in GL_LINE mode? */ + GLboolean OffsetFill; /* Offset in GL_FILL mode? */ }; struct gl_scissor_attrib { - GLboolean Enabled; /* Scissor test enabled? */ - GLint X, Y; /* Lower left corner of box */ - GLsizei Width, Height; /* Size of box */ + GLboolean Enabled; /* Scissor test enabled? */ + GLint X, Y; /* Lower left corner of box */ + GLsizei Width, Height; /* Size of box */ }; 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 */ - GLstencil Clear; /* Clear value */ - GLstencil WriteMask; /* Write mask */ + 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 */ + GLstencil Clear; /* Clear value */ + GLstencil WriteMask; /* Write mask */ }; @@ -647,14 +720,16 @@ struct gl_stencil_attrib { #define Q_BIT 8 /* Texture Enabled flags */ -#define TEXTURE0_1D S_BIT /* Texture unit 0 (default) */ -#define TEXTURE0_2D T_BIT -#define TEXTURE0_3D R_BIT -#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D) -#define TEXTURE1_1D (S_BIT<<4) /* Texture unit 1 */ -#define TEXTURE1_2D (T_BIT<<4) -#define TEXTURE1_3D (R_BIT<<4) -#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D) +#define TEXTURE0_1D 0x1 /* Texture unit 0 (default) */ +#define TEXTURE0_2D 0x2 +#define TEXTURE0_3D 0x4 +#define TEXTURE0_CUBE 0x8 +#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE) +#define TEXTURE1_1D (TEXTURE0_1D << 4) /* Texture unit 1 */ +#define TEXTURE1_2D (TEXTURE0_2D << 4) +#define TEXTURE1_3D (TEXTURE0_3D << 4) +#define TEXTURE1_CUBE (TEXTURE0_CUBE << 4) +#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D | TEXTURE1_CUBE) /* Bitmap versions of the GL_ constants. */ @@ -706,37 +781,45 @@ typedef void (*texgen_func)( struct vertex_buffer *VB, /* Texture object record */ struct gl_texture_object { - _glthread_Mutex Mutex; /* for thread safety */ - GLint RefCount; /* reference count */ - GLuint Name; /* an unsigned integer */ - GLuint Dimensions; /* 1 or 2 or 3 */ - GLfloat Priority; /* in [0,1] */ - GLubyte BorderColor[4]; /* as integers in [0,255] */ - GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ - GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ - GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ - GLenum MinFilter; /* minification filter */ - GLenum MagFilter; /* magnification filter */ - GLfloat MinLod; /* OpenGL 1.2 */ - GLfloat MaxLod; /* OpenGL 1.2 */ - GLint BaseLevel; /* OpenGL 1.2 */ - GLint MaxLevel; /* OpenGL 1.2 */ - GLint P; /* Highest mipmap level */ - GLfloat M; /* = MIN(MaxLevel, P) - BaseLevel */ - GLfloat MinMagThresh; /* min/mag threshold */ - struct gl_texture_image *Image[MAX_TEXTURE_LEVELS]; - - /* GL_EXT_paletted_texture */ - struct gl_color_table Palette; - - /* For device driver: */ - GLboolean Dirty; /* Is this texture object in dirty list? */ - void *DriverData; /* Arbitrary device driver data */ - - GLboolean Complete; /* Complete set of images? */ - TextureSampleFunc SampleFunc; /* The texel sampling function */ - struct gl_texture_object *Next; /* Next in linked list */ - struct gl_texture_object *NextDirty; /* Next in dirty linked list */ + _glthread_Mutex Mutex; /* for thread safety */ + GLint RefCount; /* reference count */ + GLuint Name; /* an unsigned integer */ + GLuint Dimensions; /* 1 or 2 or 3 */ + GLfloat Priority; /* in [0,1] */ + GLubyte BorderColor[4]; /* as integers in [0,255] */ + GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ + GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ + GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ + GLenum MinFilter; /* minification filter */ + GLenum MagFilter; /* magnification filter */ + GLfloat MinLod; /* OpenGL 1.2 */ + GLfloat MaxLod; /* OpenGL 1.2 */ + GLint BaseLevel; /* OpenGL 1.2 */ + GLint MaxLevel; /* OpenGL 1.2 */ + GLint P; /* Highest mipmap level */ + GLfloat M; /* = MIN(MaxLevel, P) - BaseLevel */ + GLfloat MinMagThresh; /* min/mag threshold */ + struct gl_texture_image *Image[MAX_TEXTURE_LEVELS]; + + /* Texture cube faces */ + /* Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; */ + struct gl_texture_image *NegX[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *PosY[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *NegY[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *PosZ[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *NegZ[MAX_TEXTURE_LEVELS]; + + /* GL_EXT_paletted_texture */ + struct gl_color_table Palette; + + /* For device driver: */ + GLboolean Dirty; /* Is this texture object in dirty list? */ + void *DriverData; /* Arbitrary device driver data */ + + GLboolean Complete; /* Complete set of images? */ + TextureSampleFunc SampleFunc; /* The texel sampling function */ + struct gl_texture_object *Next; /* Next in linked list */ + struct gl_texture_object *NextDirty; /* Next in dirty linked list */ }; @@ -745,69 +828,73 @@ struct gl_texture_object { * Texture units are new with the multitexture extension. */ struct gl_texture_unit { - GLuint Enabled; - GLuint ReallyEnabled; - - GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND */ - GLenum LastEnvMode; - - GLfloat EnvColor[4]; - GLuint TexGenEnabled; /* Bitwise-OR of [STRQ]_BIT values */ - GLenum GenModeS; /* Tex coord generation mode, either */ - GLenum GenModeT; /* GL_OBJECT_LINEAR, or */ - GLenum GenModeR; /* GL_EYE_LINEAR, or */ - GLenum GenModeQ; /* GL_SPHERE_MAP */ - GLuint GenBitS; - GLuint GenBitT; - GLuint GenBitR; - GLuint GenBitQ; - GLuint GenFlags; /* bitwise or of GenBit[STRQ] */ - GLfloat ObjectPlaneS[4]; - GLfloat ObjectPlaneT[4]; - GLfloat ObjectPlaneR[4]; - GLfloat ObjectPlaneQ[4]; - GLfloat EyePlaneS[4]; - GLfloat EyePlaneT[4]; - GLfloat EyePlaneR[4]; - GLfloat EyePlaneQ[4]; - texgen_func *func; /* points to array of func pointers */ - GLubyte Holes; /* elements not generated by texgen */ - GLuint TexgenSize; /* size of element generated */ - GLboolean AnyTransform; /* texgen or non-identity matrix */ - - struct gl_texture_object *CurrentD[4]; - struct gl_texture_object *Current; - GLuint CurrentDimension; - - struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ - struct gl_texture_object Saved2D; - struct gl_texture_object Saved3D; + GLuint Enabled; + GLuint ReallyEnabled; + + GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND */ + GLenum LastEnvMode; + + GLfloat EnvColor[4]; + GLuint TexGenEnabled; /* Bitwise-OR of [STRQ]_BIT values */ + GLenum GenModeS; /* Tex coord generation mode, either */ + GLenum GenModeT; /* GL_OBJECT_LINEAR, or */ + GLenum GenModeR; /* GL_EYE_LINEAR, or */ + GLenum GenModeQ; /* GL_SPHERE_MAP */ + GLuint GenBitS; + GLuint GenBitT; + GLuint GenBitR; + GLuint GenBitQ; + GLuint GenFlags; /* bitwise or of GenBit[STRQ] */ + GLfloat ObjectPlaneS[4]; + GLfloat ObjectPlaneT[4]; + GLfloat ObjectPlaneR[4]; + GLfloat ObjectPlaneQ[4]; + GLfloat EyePlaneS[4]; + GLfloat EyePlaneT[4]; + GLfloat EyePlaneR[4]; + GLfloat EyePlaneQ[4]; + texgen_func *func; /* points to array of func pointers */ + GLubyte Holes; /* elements not generated by texgen */ + GLuint TexgenSize; /* size of element generated */ + GLboolean AnyTransform; /* texgen or non-identity matrix */ + GLfloat LodBias; /* for biasing mipmap levels */ + + struct gl_texture_object *CurrentD[4]; + struct gl_texture_object *CurrentCubeMap; /* GL_ARB_texture_cube_map */ + + struct gl_texture_object *Current; + GLuint CurrentDimension; + + struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ + struct gl_texture_object Saved2D; + struct gl_texture_object Saved3D; }; struct gl_texture_attrib { - /* multitexture */ - GLuint CurrentUnit; /* Current texture unit */ - GLuint CurrentTransformUnit; /* Current texture xform unit */ + /* multitexture */ + GLuint CurrentUnit; /* Current texture unit */ + GLuint CurrentTransformUnit; /* Current texture xform unit */ - /* Bitwise-OR of TEXTURE_XD values */ - GLuint Enabled; /* Enabled by the user */ - GLuint ReallyEnabled; /* Really enabled (w.r.t. completeness, etc) */ + /* Bitwise-OR of TEXTURE_XD values */ + GLuint Enabled; /* Enabled by the user */ + GLuint ReallyEnabled; /* Really enabled (w.r.t. completeness, etc) */ - GLuint LastEnabled; /* Decide whether enabled has really changed */ + GLuint LastEnabled; /* Decide whether enabled has really changed */ - GLboolean NeedNormals; - GLboolean NeedEyeCoords; + GLboolean NeedNormals; + GLboolean NeedEyeCoords; - struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; + struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; - struct gl_texture_object *Proxy1D; - struct gl_texture_object *Proxy2D; - struct gl_texture_object *Proxy3D; - - /* GL_EXT_shared_texture_palette */ - GLboolean SharedPalette; - struct gl_color_table Palette; + struct gl_texture_object *Proxy1D; + struct gl_texture_object *Proxy2D; + struct gl_texture_object *Proxy3D; + struct gl_texture_object *ProxyCubeMap; + + /* GL_EXT_shared_texture_palette */ + GLboolean SharedPalette; + struct gl_color_table Palette; }; @@ -815,29 +902,29 @@ struct gl_texture_attrib { /* KW: Renamed ClipEquation to avoid having 'ClipClipEquation' */ 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? */ - GLboolean Normalize; /* Normalize all normals? */ - GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ + 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? */ + GLboolean Normalize; /* Normalize all normals? */ + GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ }; struct gl_viewport_attrib { - GLint X, Y; /* position */ - GLsizei Width, Height; /* size */ - GLfloat Near, Far; /* Depth buffer range */ - GLmatrix WindowMap; /* Mapping transformation as a matrix. */ + GLint X, Y; /* position */ + GLsizei Width, Height; /* size */ + GLfloat Near, Far; /* Depth buffer range */ + GLmatrix WindowMap; /* Mapping transformation as a matrix. */ }; /* For the attribute stack: */ struct gl_attrib_node { - GLbitfield kind; - void *data; - struct gl_attrib_node *next; + GLbitfield kind; + void *data; + struct gl_attrib_node *next; }; @@ -846,14 +933,14 @@ struct gl_attrib_node { * Client pixel packing/unpacking attributes */ struct gl_pixelstore_attrib { - GLint Alignment; - GLint RowLength; - GLint SkipPixels; - GLint SkipRows; - GLint ImageHeight; /* for GL_EXT_texture3D */ - GLint SkipImages; /* for GL_EXT_texture3D */ - GLboolean SwapBytes; - GLboolean LsbFirst; + GLint Alignment; + GLint RowLength; + GLint SkipPixels; + GLint SkipRows; + GLint ImageHeight; /* for GL_EXT_texture3D */ + GLint SkipImages; /* for GL_EXT_texture3D */ + GLboolean SwapBytes; + GLboolean LsbFirst; }; @@ -944,37 +1031,37 @@ typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], struct gl_array_attrib { - struct gl_client_array Vertex; /* client data descriptors */ - struct gl_client_array Normal; - struct gl_client_array Color; - struct gl_client_array Index; - struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; - struct gl_client_array EdgeFlag; - - trans_4f_func VertexFunc; /* conversion functions */ - trans_3f_func NormalFunc; - trans_4ub_func ColorFunc; - trans_1ui_func IndexFunc; - trans_4f_func TexCoordFunc[MAX_TEXTURE_UNITS]; - trans_1ub_func EdgeFlagFunc; - - trans_elt_4f_func VertexEltFunc; /* array elt conversion functions */ - trans_elt_3f_func NormalEltFunc; - trans_elt_4ub_func ColorEltFunc; - trans_elt_1ui_func IndexEltFunc; - trans_elt_4f_func TexCoordEltFunc[MAX_TEXTURE_UNITS]; - trans_elt_1ub_func EdgeFlagEltFunc; - - GLint TexCoordInterleaveFactor; - GLint ActiveTexture; /* Client Active Texture */ - - GLuint LockFirst; - GLuint LockCount; + struct gl_client_array Vertex; /* client data descriptors */ + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; + struct gl_client_array EdgeFlag; + + trans_4f_func VertexFunc; /* conversion functions */ + trans_3f_func NormalFunc; + trans_4ub_func ColorFunc; + trans_1ui_func IndexFunc; + trans_4f_func TexCoordFunc[MAX_TEXTURE_UNITS]; + trans_1ub_func EdgeFlagFunc; + + trans_elt_4f_func VertexEltFunc; /* array elt conversion functions */ + trans_elt_3f_func NormalEltFunc; + trans_elt_4ub_func ColorEltFunc; + trans_elt_1ui_func IndexEltFunc; + trans_elt_4f_func TexCoordEltFunc[MAX_TEXTURE_UNITS]; + trans_elt_1ub_func EdgeFlagEltFunc; + + GLint TexCoordInterleaveFactor; + GLint ActiveTexture; /* Client Active Texture */ + + GLuint LockFirst; + GLuint LockCount; - GLuint Flag[VB_SIZE]; /* crock */ - GLuint Flags; - GLuint Summary; /* Like flags, but no size information */ - GLuint NewArrayState; /* Tracks which arrays have been changed. */ + GLuint Flag[VB_SIZE]; /* crock */ + GLuint Flags; + GLuint Summary; /* Like flags, but no size information */ + GLuint NewArrayState; /* Tracks which arrays have been changed. */ }; @@ -982,11 +1069,11 @@ struct gl_array_attrib { * arrays (with zero StrideB). */ struct gl_fallback_arrays { - struct gl_client_array Normal; - struct gl_client_array Color; - struct gl_client_array Index; - struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; - struct gl_client_array EdgeFlag; + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; + struct gl_client_array EdgeFlag; }; #define MAX_PIPELINE_STAGES 30 @@ -1010,10 +1097,10 @@ struct gl_fallback_arrays { * point/line/tri primitives. */ struct gl_prim_state { - GLuint v0, v1; - GLboolean draw; - GLboolean finish_loop; /* not used... */ - struct gl_prim_state *next; + GLuint v0, v1; + GLboolean draw; + GLboolean finish_loop; /* not used... */ + struct gl_prim_state *next; }; @@ -1021,88 +1108,88 @@ typedef void (*vb_func)( struct vertex_buffer *VB ); typedef void (*ctx_func)( GLcontext * ); struct gl_pipeline_stage { - const char *name; - GLuint ops; /* PIPE_OP flags */ - GLuint type; /* PIPE flags */ - GLuint special; /* PIPE flags - force update_inputs() */ - GLuint state_change; /* state flags - trigger update_inputs() */ - GLuint cva_state_change; /* state flags - recalc cva buffer */ - GLuint elt_forbidden_inputs; /* VERT flags - force a pipeline recalc */ - GLuint pre_forbidden_inputs; /* VERT flags - force a pipeline recalc */ - GLuint active; /* PIPE flags */ - GLuint inputs; /* VERT flags */ - GLuint outputs; /* VERT flags */ - void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); - void (*run)( struct vertex_buffer *VB ); + const char *name; + GLuint ops; /* PIPE_OP flags */ + GLuint type; /* PIPE flags */ + GLuint special; /* PIPE flags - force update_inputs() */ + GLuint state_change; /* state flags - trigger update_inputs() */ + GLuint cva_state_change; /* state flags - recalc cva buffer */ + GLuint elt_forbidden_inputs; /* VERT flags - force a pipeline recalc */ + GLuint pre_forbidden_inputs; /* VERT flags - force a pipeline recalc */ + GLuint active; /* PIPE flags */ + GLuint inputs; /* VERT flags */ + GLuint outputs; /* VERT flags */ + void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); + void (*run)( struct vertex_buffer *VB ); }; struct gl_pipeline { - GLuint state_change; /* state changes which require recalc */ - GLuint cva_state_change; /* ... which require re-run */ - GLuint forbidden_inputs; /* inputs which require recalc */ - GLuint ops; /* what gets done in this pipe */ - GLuint changed_ops; - GLuint inputs; - GLuint outputs; - GLuint new_inputs; - GLuint new_outputs; - GLuint fallback; - GLuint type; - GLuint pipeline_valid:1; - GLuint data_valid:1; - GLuint copy_transformed_data:1; - GLuint replay_copied_vertices:1; - GLuint new_state; /* state changes since last recalc */ - struct gl_pipeline_stage *stages[MAX_PIPELINE_STAGES]; + GLuint state_change; /* state changes which require recalc */ + GLuint cva_state_change; /* ... which require re-run */ + GLuint forbidden_inputs; /* inputs which require recalc */ + GLuint ops; /* what gets done in this pipe */ + GLuint changed_ops; + GLuint inputs; + GLuint outputs; + GLuint new_inputs; + GLuint new_outputs; + GLuint fallback; + GLuint type; + GLuint pipeline_valid:1; + GLuint data_valid:1; + GLuint copy_transformed_data:1; + GLuint replay_copied_vertices:1; + GLuint new_state; /* state changes since last recalc */ + struct gl_pipeline_stage *stages[MAX_PIPELINE_STAGES]; }; struct gl_cva { - struct gl_pipeline pre; - struct gl_pipeline elt; + struct gl_pipeline pre; + struct gl_pipeline elt; - struct gl_client_array Elt; - trans_1ui_func EltFunc; + struct gl_client_array Elt; + trans_1ui_func EltFunc; - struct vertex_buffer *VB; - struct vertex_arrays v; - struct vertex_data store; + struct vertex_buffer *VB; + struct vertex_arrays v; + struct vertex_data store; - GLuint elt_count; - GLenum elt_mode; - GLuint elt_size; + GLuint elt_count; + GLenum elt_mode; + GLuint elt_size; - GLuint forbidden_inputs; - GLuint orflag; - GLuint merge; + GLuint forbidden_inputs; + GLuint orflag; + GLuint merge; - GLuint lock_changed; - GLuint last_orflag; - GLuint last_array_flags; - GLuint last_array_new_state; + GLuint lock_changed; + GLuint last_orflag; + GLuint last_array_flags; + GLuint last_array_new_state; }; struct gl_feedback { - GLenum Type; - GLuint Mask; - GLfloat *Buffer; - GLuint BufferSize; - GLuint Count; + GLenum Type; + GLuint Mask; + GLfloat *Buffer; + GLuint BufferSize; + GLuint Count; }; struct gl_selection { - GLuint *Buffer; - GLuint BufferSize; /* size of SelectBuffer */ - GLuint BufferCount; /* number of values in SelectBuffer */ - GLuint Hits; /* number of records in SelectBuffer */ - GLuint NameStackDepth; - GLuint NameStack[MAX_NAME_STACK_DEPTH]; - GLboolean HitFlag; - GLfloat HitMinZ, HitMaxZ; + GLuint *Buffer; + GLuint BufferSize; /* size of SelectBuffer */ + GLuint BufferCount; /* number of values in SelectBuffer */ + GLuint Hits; /* number of records in SelectBuffer */ + GLuint NameStackDepth; + GLuint NameStack[MAX_NAME_STACK_DEPTH]; + GLboolean HitFlag; + GLfloat HitMinZ, HitMaxZ; }; @@ -1111,9 +1198,9 @@ struct gl_selection { * 1-D Evaluator control points */ struct gl_1d_map { - GLuint Order; /* Number of control points */ - GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ - GLfloat *Points; /* Points to contiguous control points */ + GLuint Order; /* Number of control points */ + GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ + GLfloat *Points; /* Points to contiguous control points */ }; @@ -1121,11 +1208,11 @@ struct gl_1d_map { * 2-D Evaluator control points */ struct gl_2d_map { - GLuint Uorder; /* Number of control points in U dimension */ - GLuint Vorder; /* Number of control points in V dimension */ - GLfloat u1, u2, du; - GLfloat v1, v2, dv; - GLfloat *Points; /* Points to contiguous control points */ + GLuint Uorder; /* Number of control points in U dimension */ + GLuint Vorder; /* Number of control points in V dimension */ + GLfloat u1, u2, du; + GLfloat v1, v2, dv; + GLfloat *Points; /* Points to contiguous control points */ }; @@ -1133,27 +1220,27 @@ struct gl_2d_map { * All evalutator control points */ struct gl_evaluators { - /* 1-D maps */ - struct gl_1d_map Map1Vertex3; - struct gl_1d_map Map1Vertex4; - struct gl_1d_map Map1Index; - struct gl_1d_map Map1Color4; - struct gl_1d_map Map1Normal; - struct gl_1d_map Map1Texture1; - struct gl_1d_map Map1Texture2; - struct gl_1d_map Map1Texture3; - struct gl_1d_map Map1Texture4; - - /* 2-D maps */ - struct gl_2d_map Map2Vertex3; - struct gl_2d_map Map2Vertex4; - struct gl_2d_map Map2Index; - struct gl_2d_map Map2Color4; - struct gl_2d_map Map2Normal; - struct gl_2d_map Map2Texture1; - struct gl_2d_map Map2Texture2; - struct gl_2d_map Map2Texture3; - struct gl_2d_map Map2Texture4; + /* 1-D maps */ + struct gl_1d_map Map1Vertex3; + struct gl_1d_map Map1Vertex4; + struct gl_1d_map Map1Index; + struct gl_1d_map Map1Color4; + struct gl_1d_map Map1Normal; + struct gl_1d_map Map1Texture1; + struct gl_1d_map Map1Texture2; + struct gl_1d_map Map1Texture3; + struct gl_1d_map Map1Texture4; + + /* 2-D maps */ + struct gl_2d_map Map2Vertex3; + struct gl_2d_map Map2Vertex4; + struct gl_2d_map Map2Index; + struct gl_2d_map Map2Color4; + struct gl_2d_map Map2Normal; + struct gl_2d_map Map2Texture1; + struct gl_2d_map Map2Texture2; + struct gl_2d_map Map2Texture3; + struct gl_2d_map Map2Texture4; }; @@ -1171,6 +1258,7 @@ struct gl_shared_state { /* Default texture objects (shared by all multi-texture units) */ struct gl_texture_object *DefaultD[4]; + struct gl_texture_object *DefaultCubeMap; }; @@ -1192,11 +1280,16 @@ struct gl_visual { GLint IndexBits; /* Bits/pixel if in color index mode */ - GLint AccumBits; /* Number of bits per color channel, or 0 */ + GLint AccumRedBits; /* Number of bits in red accum channel */ + GLint AccumGreenBits; /* Number of bits in green accum channel */ + GLint AccumBlueBits; /* Number of bits in blue accum channel */ + GLint AccumAlphaBits; /* Number of bits in alpha accum channel */ GLint DepthBits; /* Number of bits in depth buffer, or 0 */ GLint StencilBits; /* Number of bits in stencil buffer, or 0 */ + GLint NumSamples; /* Samples/pixel for multisampling */ - GLboolean SoftwareAlpha; /* Implement software alpha buffer? */ + GLuint DepthMax; /* Max depth buffer value */ + GLfloat DepthMaxF; /* Float max depth buffer value */ }; @@ -1218,7 +1311,7 @@ struct gl_frame_buffer { GLboolean UseSoftwareAlphaBuffers; /* Software depth (aka Z) buffer */ - GLdepth *Depth; /* array [Width*Height] of GLdepth values */ + GLvoid *DepthBuffer; /* array [Width*Height] of GLushort or GLuint*/ /* Software stencil buffer */ GLstencil *Stencil; /* array [Width*Height] of GLstencil values */ @@ -1234,7 +1327,7 @@ struct gl_frame_buffer { GLubyte *Alpha; /* Points to current alpha buffer */ /* Drawing bounds: intersection of window size and scissor box */ - GLint Xmin, Xmax, Ymin, Ymax; + GLint Xmin, Xmax, Ymin, Ymax; /* [Xmin,Xmax] X [Ymin,Ymax] */ }; @@ -1243,6 +1336,7 @@ struct gl_frame_buffer { */ struct gl_constants { GLint MaxTextureSize; + GLint MaxCubeTextureSize; GLint MaxTextureLevels; GLuint MaxTextureUnits; GLuint MaxArrayLockSize; @@ -1254,6 +1348,11 @@ struct gl_constants { GLfloat MinLineWidthAA, MaxLineWidthAA; /* antialiased */ GLfloat LineWidthGranularity; GLuint NumAuxBuffers; + GLuint MaxColorTableSize; + GLuint MaxConvolutionWidth; + GLuint MaxConvolutionHeight; + GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */ + GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS]; }; @@ -1264,6 +1363,14 @@ struct extension; struct gl_extensions { char *ext_string; struct extension *ext_list; + /* flags to quickly test if certain extensions are available */ + GLboolean HaveTextureEnvAdd; + GLboolean HaveTextureLodBias; + GLboolean HaveHpOcclusionTest; + GLboolean HaveTextureCubeMap; + GLboolean HaveTextureCompression; + GLboolean HaveTextureCompressionS3TC; + GLboolean HaveTextureCompressionFXT1; }; @@ -1282,6 +1389,9 @@ struct gl_extensions { #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 */ + /* * Bits to indicate what state has to be updated (NewState) @@ -1304,6 +1414,7 @@ struct gl_extensions { #define NEW_NORMAL_TRANSFORM 0x8000 #define NEW_VIEWPORT 0x10000 #define NEW_TEXTURE_ENABLE 0x20000 +#define NEW_COLOR_MATRIX 0x40000 #define NEW_ALL ~0 @@ -1338,6 +1449,9 @@ struct gl_extensions { #define DD_TRI_CULL_FRONT_BACK 0x400000 /* not supported by most drivers */ #define DD_Z_NEVER 0x800000 #define DD_STENCIL 0x1000000 +#define DD_CLIP_FOG_COORD 0x2000000 + + #define DD_SW_SETUP (DD_TRI_CULL| \ DD_TRI_CULL_FRONT_BACK| \ @@ -1540,7 +1654,8 @@ typedef union node Node; #define VERT_EVAL_C2 0x2000000 /* - or just use 3 bits */ #define VERT_EVAL_P1 0x4000000 /* */ #define VERT_EVAL_P2 0x8000000 /* */ -#define VERT_FLOAT_RGBA 0x10000000 /* allow partial support for this */ +#define VERT_SPEC_RGB 0x10000000 +#define VERT_FOG_COORD 0x20000000 /* internal use only, currently */ #define VERT_EYE VERT_BEGIN /* for pipeline management & cva */ #define VERT_WIN VERT_END /* some overlaps can be tolerated */ @@ -1591,7 +1706,7 @@ typedef union node Node; #define VERT_DATA (VERT_TEX0_ANY|VERT_TEX1_ANY|VERT_RGBA| \ VERT_INDEX|VERT_EDGE|VERT_NORM| \ VERT_OBJ_ANY|VERT_MATERIAL|VERT_ELT| \ - VERT_EVAL_ANY) + VERT_EVAL_ANY|VERT_FOG_COORD) #define VERT_TO_PIPE (~VERT_END_VB) @@ -1626,233 +1741,232 @@ typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB, */ struct gl_context { - /* State possibly shared with other contexts in the address space */ - struct gl_shared_state *Shared; + /* State possibly shared with other contexts in the address space */ + 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 !! */ + /* 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 !! */ - GLvisual *Visual; - GLframebuffer *DrawBuffer; /* buffer for writing */ - GLframebuffer *ReadBuffer; /* buffer for reading */ + GLvisual *Visual; + GLframebuffer *DrawBuffer; /* buffer for writing */ + GLframebuffer *ReadBuffer; /* buffer for reading */ - /* Driver function pointer table */ - struct dd_function_table Driver; + /* Driver function pointer table */ + struct dd_function_table Driver; - triangle_func TriangleFunc; /* driver or indirect triangle func */ - quad_func QuadFunc; - triangle_func ClippedTriangleFunc; - clip_poly_func *poly_clip_tab; - clip_line_func *line_clip_tab; - - 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]; - GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH - 1][2]; - - /* Combined modelview and projection matrix */ - GLmatrix ModelProjectMatrix; - - /* Combined modelview, projection and window matrix */ - GLmatrix ModelProjectWinMatrix; - GLboolean ModelProjectWinMatrixUptodate; - - /* Texture matrix and stack */ - GLmatrix TextureMatrix[MAX_TEXTURE_UNITS]; - GLuint TextureStackDepth[MAX_TEXTURE_UNITS]; - GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH - 1]; - - /* Display lists */ - GLuint CallDepth; /* Current recursion calling depth */ - GLboolean ExecuteFlag; /* Execute GL commands? */ - GLboolean CompileFlag; /* Compile GL commands into display list? */ - GLboolean CompileCVAFlag; - Node *CurrentListPtr; /* Head of list being compiled */ - GLuint CurrentListNum; /* Number of the list being compiled */ - Node *CurrentBlock; /* Pointer to current block of nodes */ - GLuint CurrentPos; /* Index into current block of nodes */ - - /* Extensions */ - struct gl_extensions Extensions; - - - /* Pipeline stages - shared between the two pipelines, - * which live in CVA. - */ - struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES]; - GLuint NrPipelineStages; - - /* Cva */ - struct gl_cva CVA; - - /* Renderer attribute stack */ - GLuint AttribStackDepth; - struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; - - /* Renderer attribute groups */ - struct gl_accum_attrib Accum; - struct gl_colorbuffer_attrib Color; - struct gl_current_attrib Current; - struct gl_depthbuffer_attrib Depth; - struct gl_eval_attrib Eval; - struct gl_fog_attrib Fog; - struct gl_hint_attrib Hint; - struct gl_light_attrib Light; - struct gl_line_attrib Line; - struct gl_list_attrib List; - struct gl_pixel_attrib Pixel; - struct gl_point_attrib Point; - struct gl_polygon_attrib Polygon; - GLuint PolygonStipple[32]; - struct gl_scissor_attrib Scissor; - struct gl_stencil_attrib Stencil; - struct gl_texture_attrib Texture; - struct gl_transform_attrib Transform; - struct gl_viewport_attrib Viewport; - - /* Client attribute stack */ - GLuint ClientAttribStackDepth; - struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; - - /* Client attribute groups */ - struct gl_array_attrib Array; /* Vertex arrays */ - struct gl_pixelstore_attrib Pack; /* Pixel packing */ - struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */ - - struct gl_evaluators EvalMap; /* All evaluators */ - struct gl_feedback Feedback; /* Feedback */ - struct gl_selection Select; /* Selection */ - - /* Optimized Accumulation buffer info */ - GLboolean IntegerAccumMode; /* Storing unscaled integers? */ - GLfloat IntegerAccumScaler; /* Implicit scale factor */ - - - struct gl_fallback_arrays Fallback; - - GLenum ErrorValue; /* Last error code */ - - /* Miscellaneous */ - GLuint NewState; /* bitwise OR of NEW_* flags */ - GLuint Enabled; /* bitwise or of ENABLE_* flags */ - GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ - GLuint StippleCounter; /* Line stipple counter */ - GLuint RasterMask; /* OR of rasterization flags */ - GLuint TriangleCaps; /* OR of DD_* flags */ - GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */ - GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */ - GLfloat LineZoffset; /* Z offset for GL_LINE polygons */ - GLfloat PointZoffset; /* Z offset for GL_POINT polygons */ - GLboolean NeedNormals; /* Are vertex normal vectors needed? */ - GLboolean MutablePixels;/* Can rasterization change pixel's color? */ - GLboolean MonoPixels; /* Are all pixels likely to be same color? */ - GLuint FogMode; /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */ - - GLboolean DoViewportMapping; - - - GLuint RenderFlags; /* Active inputs to render stage */ - - GLuint RequireWriteableFlags; /* What can the driver/clipping tolerate? */ - - /* Points to function which interpolates colors, etc when clipping */ - clip_interp_func ClipInterpFunc; - GLuint ClipTabMask; - - normal_func *NormalTransform; - - /* Current shading function */ - GLuint shade_func_flags; - - GLfloat EyeZDir[3]; - GLfloat rescale_factor; - - GLfloat vb_rescale_factor; - GLmatrix *vb_proj_matrix; - - GLubyte AllowVertexCull; /* To be set by the geometry driver */ - GLboolean NeedEyeCoords; - GLboolean NeedEyeNormals; - GLboolean NeedClipCoords; - - GLfloat backface_sign; - - /* Destination of immediate mode commands */ - struct immediate *input; - - - /* Cache of unused immediate structs - */ - struct immediate *freed_im_queue; - GLuint nr_im_queued; - - /* The vertex buffer being used by this context. - */ - struct vertex_buffer *VB; + triangle_func TriangleFunc; /* driver or indirect triangle func */ + quad_func QuadFunc; + triangle_func ClippedTriangleFunc; + clip_poly_func *poly_clip_tab; + clip_line_func *line_clip_tab; + + 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]; + GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH - 1][2]; + + /* Combined modelview and projection matrix */ + GLmatrix ModelProjectMatrix; + + /* Combined modelview, projection and window matrix */ + GLmatrix ModelProjectWinMatrix; + GLboolean ModelProjectWinMatrixUptodate; + + /* 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? */ + GLboolean CompileFlag; /* Compile GL commands into display list? */ + GLboolean CompileCVAFlag; + Node *CurrentListPtr; /* Head of list being compiled */ + GLuint CurrentListNum; /* Number of the list being compiled */ + Node *CurrentBlock; /* Pointer to current block of nodes */ + GLuint CurrentPos; /* Index into current block of nodes */ + + /* Extensions */ + struct gl_extensions Extensions; + + + /* Pipeline stages - shared between the two pipelines, + * which live in CVA. + */ + struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES]; + GLuint NrPipelineStages; + + /* Cva */ + struct gl_cva CVA; + + /* Renderer attribute stack */ + GLuint AttribStackDepth; + struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; + + /* Renderer attribute groups */ + struct gl_accum_attrib Accum; + struct gl_colorbuffer_attrib Color; + struct gl_current_attrib Current; + struct gl_depthbuffer_attrib Depth; + struct gl_eval_attrib Eval; + struct gl_fog_attrib Fog; + struct gl_hint_attrib Hint; + struct gl_light_attrib Light; + struct gl_line_attrib Line; + struct gl_list_attrib List; + struct gl_pixel_attrib Pixel; + struct gl_point_attrib Point; + struct gl_polygon_attrib Polygon; + GLuint PolygonStipple[32]; + struct gl_scissor_attrib Scissor; + struct gl_stencil_attrib Stencil; + struct gl_texture_attrib Texture; + struct gl_transform_attrib Transform; + struct gl_viewport_attrib Viewport; + + /* Other attribute groups */ + struct gl_histogram_attrib Histogram; + struct gl_minmax_attrib MinMax; + struct gl_convolution_attrib Convolution1D; + struct gl_convolution_attrib Convolution2D; + struct gl_convolution_attrib Separable2D; + + /* Client attribute stack */ + GLuint ClientAttribStackDepth; + struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; + + /* Client attribute groups */ + struct gl_array_attrib Array; /* Vertex arrays */ + struct gl_pixelstore_attrib Pack; /* Pixel packing */ + struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */ + + struct gl_evaluators EvalMap; /* All evaluators */ + struct gl_feedback Feedback; /* Feedback */ + struct gl_selection Select; /* Selection */ + + struct gl_color_table ColorTable; /* Pre-convolution */ + struct gl_color_table ProxyColorTable; /* Pre-convolution */ + struct gl_color_table PostConvolutionColorTable; + struct gl_color_table ProxyPostConvolutionColorTable; + struct gl_color_table PostColorMatrixColorTable; + struct gl_color_table ProxyPostColorMatrixColorTable; + + /* Optimized Accumulation buffer info */ + GLboolean IntegerAccumMode; /* Storing unscaled integers? */ + GLfloat IntegerAccumScaler; /* Implicit scale factor */ + + struct gl_fallback_arrays Fallback; + + GLenum ErrorValue; /* Last error code */ + + /* Miscellaneous */ + GLuint NewState; /* bitwise OR of NEW_* flags */ + GLuint Enabled; /* bitwise or of ENABLE_* flags */ + GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ + GLuint StippleCounter; /* Line stipple counter */ + GLuint RasterMask; /* OR of rasterization flags */ + GLuint TriangleCaps; /* OR of DD_* flags */ + GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */ + GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */ + GLfloat LineZoffset; /* Z offset for GL_LINE polygons */ + GLfloat PointZoffset; /* Z offset for GL_POINT polygons */ + GLboolean NeedNormals; /* Are vertex normal vectors needed? */ + GLuint FogMode; /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */ + + GLboolean DoViewportMapping; + + GLuint RenderFlags; /* Active inputs to render stage */ + + GLuint RequireWriteableFlags; /* What can the driver/clipping tolerate? */ + + /* Points to function which interpolates colors, etc when clipping */ + clip_interp_func ClipInterpFunc; + GLuint ClipTabMask; + + normal_func *NormalTransform; + + /* Current shading function */ + GLuint shade_func_flags; + + GLfloat EyeZDir[3]; + GLfloat rescale_factor; + + GLfloat vb_rescale_factor; + GLmatrix *vb_proj_matrix; + + GLubyte AllowVertexCull; /* To be set by the geometry driver */ + GLboolean NeedEyeCoords; + GLboolean NeedEyeNormals; + GLboolean NeedClipCoords; + + GLfloat backface_sign; + + GLboolean OcclusionResult; /* GL_HP_occlusion_test */ + GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */ + + /* Destination of immediate mode commands */ + struct immediate *input; + + + /* Cache of unused immediate structs + */ + struct immediate *freed_im_queue; + GLuint nr_im_queued; + + /* The vertex buffer being used by this context. + */ + struct vertex_buffer *VB; - /* The pixel buffer being used by this context */ - struct pixel_buffer* PB; - - struct gl_shine_tab *ShineTable[4]; /* Active shine tables */ - struct gl_shine_tab *ShineTabList; /* Mru list of inactive shine tables */ - - -#ifdef PROFILE - /* Performance measurements */ - GLuint BeginEndCount; /* number of glBegin/glEnd pairs */ - GLdouble BeginEndTime; /* seconds spent between glBegin/glEnd */ - GLuint VertexCount; /* number of vertices processed */ - GLdouble VertexTime; /* total time in seconds */ - GLuint PointCount; /* number of points rendered */ - GLdouble PointTime; /* total time in seconds */ - GLuint LineCount; /* number of lines rendered */ - GLdouble LineTime; /* total time in seconds */ - GLuint PolygonCount; /* number of polygons rendered */ - GLdouble PolygonTime; /* total time in seconds */ - GLuint ClearCount; /* number of glClear calls */ - GLdouble ClearTime; /* seconds spent in glClear */ - GLuint SwapCount; /* number of swap-buffer calls */ - GLdouble SwapTime; /* seconds spent in swap-buffers */ -#endif + /* The pixel buffer being used by this context */ + struct pixel_buffer* PB; + struct gl_shine_tab *ShineTable[4]; /* Active shine tables */ + struct gl_shine_tab *ShineTabList; /* Mru list of inactive shine tables */ - /* Should 3Dfx Glide driver catch signals? */ - GLboolean CatchSignals; + /* Should 3Dfx Glide driver catch signals? */ + GLboolean CatchSignals; - /* For debugging/development only */ - GLboolean NoRaster; - GLboolean FirstTimeCurrent; + /* For debugging/development only */ + GLboolean NoRaster; + GLboolean FirstTimeCurrent; - /* Dither disable via MESA_NO_DITHER env var */ - GLboolean NoDither; + /* Dither disable via MESA_NO_DITHER env var */ + GLboolean NoDither; }; -#ifndef MESA_DEBUG +#ifdef MESA_DEBUG +extern int MESA_VERBOSE; +extern int MESA_DEBUG_FLAGS; +#else # define MESA_VERBOSE 0 # define MESA_DEBUG_FLAGS 0 # ifndef NDEBUG # define NDEBUG # endif -#else -extern int MESA_VERBOSE; -extern int MESA_DEBUG_FLAGS; #endif + enum _verbose { VERBOSE_VARRAY = 0x1, VERBOSE_TEXTURE = 0x2, @@ -1863,7 +1977,8 @@ enum _verbose { VERBOSE_API = 0x40, VERBOSE_TRIANGLE_CHECKS = 0x80, VERBOSE_CULL = 0x100, - VERBOSE_DISPLAY_LIST = 0x200 + VERBOSE_DISPLAY_LIST = 0x200, + VERBOSE_LIGHTING = 0x400 }; diff --git a/xc/extras/Mesa/src/vb.c b/xc/extras/Mesa/src/vb.c index 1677806b6..7dcb64b10 100644 --- a/xc/extras/Mesa/src/vb.c +++ b/xc/extras/Mesa/src/vb.c @@ -271,7 +271,11 @@ struct immediate *gl_immediate_alloc( GLcontext *ctx ) IM->Start = VB_START; IM->Material = 0; IM->MaterialMask = 0; - +#ifdef VMS + for (j=0; j<VB_SIZE ; j++ ) + IM->Normal[j][0] = IM->Normal[j][1] = IM->Normal[j][2] = 0.0; +#endif + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) fprintf(stderr, "alloc immediate %d\n", id); diff --git a/xc/extras/Mesa/src/vbrender.c b/xc/extras/Mesa/src/vbrender.c index ff493f5fc..9ee4fbb8c 100644 --- a/xc/extras/Mesa/src/vbrender.c +++ b/xc/extras/Mesa/src/vbrender.c @@ -164,7 +164,7 @@ static void unfilled_polygon( GLcontext *ctx, j1 = vlist[i+1]; if (edge_ptr[j0] & 0x1) { - edge_ptr[j0] &= ~1; + edge_ptr[j0] &= ~0x1; (*ctx->Driver.LineFunc)( ctx, j0, j1, pv ); } } @@ -174,7 +174,7 @@ static void unfilled_polygon( GLcontext *ctx, j1 = vlist[0]; if (edge_ptr[j0] & 0x2) { - edge_ptr[j0] &= ~2; + edge_ptr[j0] &= ~0x2; (*ctx->Driver.LineFunc)( ctx, j0, j1, pv ); } } @@ -219,7 +219,9 @@ static INLINE void gl_render_clipped_triangle2( GLcontext *ctx, GLuint pv ) { struct vertex_buffer *VB = ctx->VB; - GLubyte mask = (GLubyte) (VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3]); + GLubyte mask = (GLubyte) (VB->ClipMask[v1] | + VB->ClipMask[v2] | + VB->ClipMask[v3]); GLuint vlist[VB_MAX_CLIPPED_VERTS]; GLuint i, n; @@ -233,7 +235,38 @@ static INLINE void gl_render_clipped_triangle2( GLcontext *ctx, ASSIGN_3V(vlist, v1, v2, v3 ); n = (ctx->poly_clip_tab[VB->ClipPtr->size])( VB, 3, vlist, mask ); - + + for (i=2;i<n;i++) + ctx->TriangleFunc( ctx, *vlist, vlist[i-1], vlist[i], pv ); +} + + +static INLINE void gl_render_clipped_quad2( GLcontext *ctx, + GLuint v1, GLuint v2, GLuint v3, + GLuint v4, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + GLubyte mask = (GLubyte) (VB->ClipMask[v1] | + VB->ClipMask[v2] | + VB->ClipMask[v3] | + VB->ClipMask[v4]); + GLuint vlist[VB_MAX_CLIPPED_VERTS]; + GLuint i, n; + + if (!mask) { + ctx->QuadFunc( ctx, v1, v2, v3, v4, pv ); + return; + } + + if (CLIP_ALL_BITS & VB->ClipMask[v1] & + VB->ClipMask[v2] & VB->ClipMask[v3] & + VB->ClipMask[v4]) + return; + + ASSIGN_4V(vlist, v1, v2, v3, v4 ); + n = (ctx->poly_clip_tab[VB->ClipPtr->size])( VB, 4, vlist, mask ); + for (i=2;i<n;i++) ctx->TriangleFunc( ctx, *vlist, vlist[i-1], vlist[i], pv ); } @@ -309,16 +342,14 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1, GLfloat fy = win[v3][1] - win[v1][1]; GLfloat c = ex*fy-ey*fx; GLuint facing; - GLuint tricaps; + GLuint tricaps = ctx->IndirectTriangles; if (c * ctx->backface_sign > 0) return; facing = (c<0.0F) ^ (ctx->Polygon.FrontFace==GL_CW); - tricaps = ctx->IndirectTriangles; - (void) tricaps; /* not needed? */ - if (ctx->IndirectTriangles & DD_TRI_OFFSET) { + if (tricaps & DD_TRI_OFFSET) { GLfloat ez = win[v2][2] - win[v0][2]; GLfloat fz = win[v3][2] - win[v1][2]; GLfloat a = ey*fz-ez*fy; @@ -327,7 +358,7 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1, } - if (ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE) { + if (tricaps & DD_TRI_LIGHT_TWOSIDE) { VB->Specular = VB->Spec[facing]; VB->ColorPtr = VB->Color[facing]; VB->IndexPtr = VB->Index[facing]; @@ -335,7 +366,7 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1, /* Render the quad! */ - if (ctx->IndirectTriangles & DD_TRI_UNFILLED) { + if (tricaps & DD_TRI_UNFILLED) { GLuint vlist[4]; vlist[0] = v0; vlist[1] = v1; @@ -373,9 +404,7 @@ extern const char *gl_prim_name[]; #define EDGEFLAG_TRI( i2, i1, i, pv, parity) \ do { \ - GLuint e1=i1, e0=i; \ - if (parity) { GLuint t=e1; e1=e0; e0=t; } \ - eflag[i2] = eflag[e1] = 1; eflag[e0] = 2; \ + eflag[i2] = eflag[i1] = 1; eflag[i] = 2; \ } while (0) #define EDGEFLAG_QUAD( i3, i2, i1, i, pv) \ @@ -384,6 +413,21 @@ do { \ } while (0) +#define EDGEFLAG_POLY_TRI_PRE( i2, i1, i, pv) \ +do { \ + eflag[i1] |= (eflag[i1] >> 2) & 1; \ + eflag[i] |= (eflag[i] >> 2) & 2; \ +} while (0) + +#define EDGEFLAG_POLY_TRI_POST( i2, i1, i, pv) \ +do { \ + eflag[i2] = 0; \ + eflag[i1] &= ~(4|1); \ + eflag[i] &= ~(8|2); \ +} while (0) + + + /* Culled and possibly clipped primitives. */ #define RENDER_POINTS( start, count ) \ @@ -455,10 +499,12 @@ do { \ const GLubyte *cullmask = VB->CullMask; \ GLuint vlist[VB_SIZE]; \ GLubyte *eflag = VB->EdgeFlagPtr->data; \ - (void) vlist; (void) eflag; + GLuint *stipplecounter = &VB->ctx->StippleCounter; \ + (void) vlist; (void) eflag; (void) stipplecounter; #define TAG(x) x##_cull #define INIT(x) FLUSH_PRIM(x) +#define RESET_STIPPLE *stipplecounter = 0 #include "render_tmp.h" @@ -492,9 +538,11 @@ do { \ #define LOCAL_VARS \ GLcontext *ctx = VB->ctx; \ GLubyte *eflag = VB->EdgeFlagPtr->data; \ - (void) eflag; + GLuint *stipplecounter = &VB->ctx->StippleCounter; \ + (void) eflag; (void) stipplecounter; #define INIT(x) FLUSH_PRIM(x); +#define RESET_STIPPLE *stipplecounter = 0 #include "render_tmp.h" @@ -510,24 +558,27 @@ do { \ #define RENDER_TRI( i2, i1, i, pv, parity) \ do { \ - GLuint e1=i1, e0=i; \ - if (parity) { GLuint t=e1; e1=e0; e0=t; } \ - gl_render_clipped_triangle2(ctx,i2,e1,e0,pv); \ + GLuint e2=i2, e1=i1; \ + if (parity) { GLuint t=e2; e2=e1; e1=t; } \ + gl_render_clipped_triangle2(ctx,e2,e1,i,pv); \ } while (0) #define RENDER_QUAD( i3, i2, i1, i, pv) \ do { \ - gl_render_clipped_triangle2(ctx,i3,i2,i1,pv); \ - gl_render_clipped_triangle2(ctx,i3,i1,i,pv); \ + gl_render_clipped_quad2(ctx,i3,i2,i1,i,pv); \ } while (0) #define LOCAL_VARS \ GLcontext *ctx = VB->ctx; \ GLubyte *eflag = VB->EdgeFlagPtr->data; \ - (void) eflag; + GLuint *stipplecounter = &VB->ctx->StippleCounter; \ + (void) eflag; (void) stipplecounter; + #define INIT(x) FLUSH_PRIM(x); #define TAG(x) x##_clipped +#define RESET_STIPPLE *stipplecounter = 0 + #include "render_tmp.h" /* Bits: @@ -566,24 +617,25 @@ setup_edgeflag( struct vertex_buffer *VB, switch (prim) { case GL_TRIANGLES: for (i = 0 ; i < n-2 ; i+=3) { - if (flag[i]) flag[i] = 0x5; - if (flag[i+1]) flag[i+1] = 0x5; - if (flag[i+2]) flag[i+2] = 0x6; + if (flag[i]) flag[i] = 0x1; + if (flag[i+1]) flag[i+1] = 0x1; + if (flag[i+2]) flag[i+2] = 0x3; } break; case GL_QUADS: for (i = 0 ; i < n-3 ; i+=4) { - if (flag[i]) flag[i] = 0x5; - if (flag[i+1]) flag[i+1] = 0x5; - if (flag[i+2]) flag[i+2] = 0x5; - if (flag[i+3]) flag[i+3] = 0x6; + if (flag[i]) flag[i] = 0x1; + if (flag[i+1]) flag[i+1] = 0x1; + if (flag[i+2]) flag[i+2] = 0x1; + if (flag[i+3]) flag[i+3] = 0x3; } break; case GL_POLYGON: - for (i = 0 ; i < n-1 ; i++) { - if (flag[i]) flag[i] = 0x5; + if (flag[0]) flag[0] = 0x1; + for (i = 1 ; i < n-1 ; i++) { + if (flag[i]) flag[i] = 0x1<<2; } - if (flag[i]) flag[i] = 0x6; + if (flag[i]) flag[i] = 0x3<<2; break; default: break; @@ -667,12 +719,12 @@ void gl_reduced_prim_change( GLcontext *ctx, GLenum prim ) if (ctx->PB->count > 0) gl_flush_pb(ctx); - ctx->PB->count = 0; - ctx->PB->mono = GL_FALSE; - ctx->PB->primitive = prim; + if (ctx->PB->primitive != prim) { + ctx->PB->primitive = prim; - if (ctx->Driver.ReducedPrimitiveChange) - ctx->Driver.ReducedPrimitiveChange( ctx, prim ); + if (ctx->Driver.ReducedPrimitiveChange) + ctx->Driver.ReducedPrimitiveChange( ctx, prim ); + } } |