fix GL_BACK color material bug
[mesa.git] / src / mesa / drivers / glide / fxglidew.c
index 900e84076d418d729fbdd247d3e8fc02b975a5ac..5155c825a857907bc0e8be5e757764e6705066e5 100644 (file)
@@ -2,9 +2,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"),
@@ -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) 
@@ -68,6 +68,9 @@ static FxI32 FX_grGetInteger_NoLock(FxU32 pname)
        return FXFALSE;
     case FX_PENDING_BUFFERSWAPS:
        return grBufferNumPending();
+    case FX_TEXTURE_ALIGN:
+        /* This is a guess from reading the glide3 docs */
+        return 8;
     default:
        if (MESA_VERBOSE&VERBOSE_DRIVER) {
           fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n");
@@ -84,6 +87,7 @@ static FxI32 FX_grGetInteger_NoLock(FxU32 pname)
      case FX_GLIDE_STATE_SIZE:
      case FX_LFB_PIXEL_PIPE:
      case FX_PENDING_BUFFERSWAPS:
+     case FX_TEXTURE_ALIGN:
        grname = pname;
        break;
      default:
@@ -150,7 +154,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;
@@ -221,12 +235,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)
@@ -244,6 +258,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)
 {
@@ -374,6 +395,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,
@@ -392,6 +417,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"
@@ -404,13 +430,13 @@ FX_GrContext_t FX_grSstWinOpen( FxU32                hWnd,
            nColBuffers,
            nAuxBuffers,
            i);
+   */
    END_BOARD_LOCK();
    return i;
 }
 
 
 
-#endif 
 #else
 
 /*