updated with changes from DRI project CVS
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 16 Feb 2000 23:06:12 +0000 (23:06 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 16 Feb 2000 23:06:12 +0000 (23:06 +0000)
src/mesa/drivers/glide/fxdd.c
src/mesa/drivers/glide/fxdrv.h
src/mesa/drivers/glide/fxglidew.c
src/mesa/drivers/glide/fxglidew.h
src/mesa/drivers/glide/fxsetup.c
src/mesa/drivers/glide/fxtexman.c

index d7e7293b218e23fb419b041a508bc09526fd84a1..ca5ff944844bd2b7f85dfee58b53fd4d727244dc 100644 (file)
@@ -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;
index 4a9110393c7b1b9e9e9260875d3f801ff5516ff2..208801e87b4ec3e624e5788e6583fa5f338bbe0a 100644 (file)
@@ -443,6 +443,7 @@ struct tfxMesaContext {
   GrColor_t clearC;
   GrAlpha_t clearA;
   GLuint constColor;
+  GrCullMode_t cullMode;
 
   tfxUnitsState unitsState;
   tfxUnitsState restoreUnitsState; /* saved during multipass */
index d27c1558428ed9e4c3b7d00cbddf326e2ab4a843..9084cc5feaa3f72055cef9586dee0d88d75e378c 100644 (file)
@@ -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)
 {
index 749540ce0ef0fc84c2cb0eb4b1b5fa1e4f5c7e9b..614949f71f79b363c56fda6ef0a04e83771b7f3a 100644 (file)
@@ -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 {                         \
index a8ca52d62cb8e8137f43c510b068eed23c5a9a5d..6ebd037fd5760af2df50ba095c844bfbc9ac0337 100644 (file)
@@ -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);
 }
 
 
index 280a2c574c9e461e17b7d6f519b6bb1e576da118..87f309adc35ea6adbb9ae7e79ecce01bbf3e3a39 100644 (file)
@@ -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;
        }