| @@ -56,7 +56,7 @@ | |||
| #include "fxdrv.h" | |||
| #include "enums.h" | |||
| #include "extensions.h" | |||
| #include "pb.h" | |||
| /* These lookup table are used to extract RGB values in [0,255] from | |||
| * 16-bit pixel values. | |||
| @@ -847,6 +847,16 @@ static void fxDDUpdateDDPointers(GLcontext *ctx) | |||
| } | |||
| } | |||
| static void fxDDReducedPrimitiveChange(GLcontext *ctx, GLenum prim) | |||
| { | |||
| if (ctx->Polygon.CullFlag) { | |||
| if (ctx->PB->primitive != GL_POLYGON) { /* Lines or Points */ | |||
| FX_grCullMode(GR_CULL_DISABLE); | |||
| FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; | |||
| } | |||
| } | |||
| } | |||
| void fxSetupDDPointers(GLcontext *ctx) | |||
| { | |||
| if (MESA_VERBOSE&VERBOSE_DRIVER) { | |||
| @@ -910,6 +920,7 @@ void fxSetupDDPointers(GLcontext *ctx) | |||
| ctx->Driver.CullFace=fxDDCullFace; | |||
| ctx->Driver.ShadeModel=fxDDShadeModel; | |||
| ctx->Driver.Enable=fxDDEnable; | |||
| ctx->Driver.ReducedPrimitiveChange=fxDDReducedPrimitiveChange; | |||
| ctx->Driver.RegisterVB=fxDDRegisterVB; | |||
| ctx->Driver.UnregisterVB=fxDDUnregisterVB; | |||
| @@ -443,6 +443,7 @@ struct tfxMesaContext { | |||
| GrColor_t clearC; | |||
| GrAlpha_t clearA; | |||
| GLuint constColor; | |||
| GrCullMode_t cullMode; | |||
| tfxUnitsState unitsState; | |||
| tfxUnitsState restoreUnitsState; /* saved during multipass */ | |||
| @@ -55,7 +55,7 @@ | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| static FxI32 FX_grGetInteger_NoLock(FxU32 pname) | |||
| FxI32 FX_grGetInteger_NoLock(FxU32 pname) | |||
| { | |||
| #if !defined(FX_GLIDE3) | |||
| switch (pname) | |||
| @@ -244,6 +244,13 @@ void FX_grAADrawPoint(GrVertex *a) | |||
| END_CLIP_LOOP(); | |||
| } | |||
| void FX_grDrawPolygonVertexList(int n, GrVertex *verts) | |||
| { | |||
| BEGIN_CLIP_LOOP(); | |||
| grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); | |||
| END_CLIP_LOOP(); | |||
| } | |||
| #if FX_USE_PARGB | |||
| void FX_setupGrVertexLayout(void) | |||
| { | |||
| @@ -77,6 +77,7 @@ | |||
| * Genral warper functions for Glide2/Glide3: | |||
| */ | |||
| extern FxI32 FX_grGetInteger(FxU32 pname); | |||
| extern FxI32 FX_grGetInteger_NoLock(FxU32 pname); | |||
| /* | |||
| * Glide2 emulation on Glide3: | |||
| @@ -532,6 +533,17 @@ extern FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, | |||
| END_CLIP_LOOP(); \ | |||
| } while (0) | |||
| #if defined(FX_GLIDE3) | |||
| extern void FX_grDrawPolygonVertexList(int n, GrVertex *v); | |||
| #else | |||
| #define FX_grDrawPolygonVertexList(n, v) \ | |||
| do { \ | |||
| BEGIN_CLIP_LOOP(); \ | |||
| grDrawPolygonVertexList(n, v); \ | |||
| END_CLIP_LOOP(); \ | |||
| } while (0) | |||
| #endif | |||
| #define FX_grDitherMode(m) \ | |||
| do { \ | |||
| BEGIN_BOARD_LOCK(); \ | |||
| @@ -758,6 +770,7 @@ extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info); | |||
| grGlideGetState(s); \ | |||
| END_BOARD_LOCK(); \ | |||
| } while (0) | |||
| #define FX_grGlideGetState_NoLock(s) grGlideGetState(s); | |||
| #define FX_grDRIBufferSwap(i) \ | |||
| do { \ | |||
| @@ -781,6 +794,7 @@ extern FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info); | |||
| grGlideSetState(s); \ | |||
| END_BOARD_LOCK(); \ | |||
| } while (0) | |||
| #define FX_grGlideSetState_NoLock(s) grGlideSetState(s); | |||
| #define FX_grDepthBufferMode(m) \ | |||
| do { \ | |||
| @@ -407,10 +407,11 @@ static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, | |||
| GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION, | |||
| FXFALSE,FXFALSE); | |||
| FX_grTexCombine_NoLock(GR_TMU1, | |||
| GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, | |||
| GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, | |||
| FXFALSE,FXFALSE); | |||
| if (fxMesa->haveTwoTMUs) | |||
| FX_grTexCombine_NoLock(GR_TMU1, | |||
| GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, | |||
| GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE, | |||
| FXFALSE,FXFALSE); | |||
| fxMesa->tmuSrc=FX_TMU_SPLIT; | |||
| } | |||
| else { | |||
| @@ -1561,28 +1562,28 @@ void fxDDFrontFace(GLcontext *ctx, GLenum mode) | |||
| static void fxSetupCull(GLcontext *ctx) | |||
| { | |||
| if(ctx->Polygon.CullFlag) { | |||
| switch(ctx->Polygon.CullFaceMode) { | |||
| case GL_BACK: | |||
| if(ctx->Polygon.FrontFace==GL_CCW) | |||
| FX_grCullMode(GR_CULL_NEGATIVE); | |||
| else | |||
| FX_grCullMode(GR_CULL_POSITIVE); | |||
| break; | |||
| case GL_FRONT: | |||
| if(ctx->Polygon.FrontFace==GL_CCW) | |||
| FX_grCullMode(GR_CULL_POSITIVE); | |||
| else | |||
| FX_grCullMode(GR_CULL_NEGATIVE); | |||
| break; | |||
| case GL_FRONT_AND_BACK: | |||
| FX_grCullMode(GR_CULL_DISABLE); | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| } else | |||
| FX_grCullMode(GR_CULL_DISABLE); | |||
| if (ctx->Polygon.CullFlag) { | |||
| switch (ctx->Polygon.CullFaceMode) { | |||
| case GL_BACK: | |||
| if (ctx->Polygon.FrontFace==GL_CCW) | |||
| FX_CONTEXT(ctx)->cullMode=GR_CULL_NEGATIVE; | |||
| else | |||
| FX_CONTEXT(ctx)->cullMode=GR_CULL_POSITIVE; | |||
| break; | |||
| case GL_FRONT: | |||
| if(ctx->Polygon.FrontFace==GL_CCW) | |||
| FX_CONTEXT(ctx)->cullMode=GR_CULL_POSITIVE; | |||
| else | |||
| FX_CONTEXT(ctx)->cullMode=GR_CULL_NEGATIVE; | |||
| break; | |||
| case GL_FRONT_AND_BACK: | |||
| FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| } else FX_CONTEXT(ctx)->cullMode=GR_CULL_DISABLE; | |||
| FX_grCullMode(FX_CONTEXT(ctx)->cullMode); | |||
| } | |||
| @@ -722,7 +722,7 @@ fxTMRestoreTextures_NoLock(fxMesaContext ctx) { | |||
| if (ctx->glCtx->Texture.Unit[i].Current==tObj) { | |||
| /* Force the texture onto the board, as it could be in use */ | |||
| where=ti->whichTMU; | |||
| ti->whichTMU=FX_TMU_NONE; | |||
| fxTMMoveOutTM_NoLock(ctx, tObj); | |||
| fxTMMoveInTM_NoLock(ctx, tObj, where); | |||
| break; | |||
| } | |||