From 7a0f9dbb94947110ed47c3ba4befc2d9ffb1e8c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 16 Feb 2000 23:06:12 +0000 Subject: [PATCH] updated with changes from DRI project CVS --- src/mesa/drivers/glide/fxdd.c | 13 +++++++- src/mesa/drivers/glide/fxdrv.h | 1 + src/mesa/drivers/glide/fxglidew.c | 9 +++++- src/mesa/drivers/glide/fxglidew.h | 14 ++++++++ src/mesa/drivers/glide/fxsetup.c | 53 ++++++++++++++++--------------- src/mesa/drivers/glide/fxtexman.c | 2 +- 6 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index d7e7293b218..ca5ff944844 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -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; diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index 4a9110393c7..208801e87b4 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -443,6 +443,7 @@ struct tfxMesaContext { GrColor_t clearC; GrAlpha_t clearA; GLuint constColor; + GrCullMode_t cullMode; tfxUnitsState unitsState; tfxUnitsState restoreUnitsState; /* saved during multipass */ diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c index d27c1558428..9084cc5feaa 100644 --- a/src/mesa/drivers/glide/fxglidew.c +++ b/src/mesa/drivers/glide/fxglidew.c @@ -55,7 +55,7 @@ #include #include -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) { diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h index 749540ce0ef..614949f71f7 100644 --- a/src/mesa/drivers/glide/fxglidew.h +++ b/src/mesa/drivers/glide/fxglidew.h @@ -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 { \ diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index a8ca52d62cb..6ebd037fd57 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -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); } diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 280a2c574c9..87f309adc35 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -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; } -- 2.30.2