summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-10-02 17:36:43 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-10-02 17:36:43 +0000
commita75246f8f5fa951d62b6b40db5bf47517b50d459 (patch)
treed41798ebe7819f53f4ef69cf8cd752e367eb84e1
parentd6643331ab1a2215338be19177296d255170c798 (diff)
updates from Daniel Borca
-rw-r--r--docs/README.DJ8
-rw-r--r--include/GL/fxmesa.h5
-rw-r--r--progs/samples/Makefile.mgw67
-rw-r--r--src/glut/dos/window.c4
-rw-r--r--src/mesa/Makefile.DJ3
-rw-r--r--src/mesa/Makefile.mgw19
-rw-r--r--src/mesa/drivers/glide/fxapi.c783
-rw-r--r--src/mesa/drivers/glide/fxdd.c686
-rw-r--r--src/mesa/drivers/glide/fxddspan.c107
-rw-r--r--src/mesa/drivers/glide/fxddtex.c525
-rw-r--r--src/mesa/drivers/glide/fxdrv.h84
-rw-r--r--src/mesa/drivers/glide/fxg.c2135
-rw-r--r--src/mesa/drivers/glide/fxg.h352
-rw-r--r--src/mesa/drivers/glide/fxglidew.c99
-rw-r--r--src/mesa/drivers/glide/fxglidew.h197
-rw-r--r--src/mesa/drivers/glide/fxopengl.def869
-rw-r--r--src/mesa/drivers/glide/fxsetup.c443
-rw-r--r--src/mesa/drivers/glide/fxtexman.c125
-rw-r--r--src/mesa/drivers/glide/fxtris.c534
-rw-r--r--src/mesa/drivers/glide/fxvb.c38
-rw-r--r--src/mesa/drivers/glide/fxvbtmp.h34
-rw-r--r--src/mesa/drivers/glide/fxwgl.c473
-rw-r--r--src/mesa/x86/assyntax.h4
23 files changed, 5572 insertions, 2022 deletions
diff --git a/docs/README.DJ b/docs/README.DJ
index 9fc7a55c63..da174f4acb 100644
--- a/docs/README.DJ
+++ b/docs/README.DJ
@@ -1,12 +1,12 @@
- Mesa 5.0.1 DOS/DJGPP Port v1.4
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Mesa 5.1 DOS/DJGPP Port v1.4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Description:
~~~~~~~~~~~~
-Well, guess what... this is the DOS port of Mesa 5.0.1, for DJGPP fans... Whoa!
+Well, guess what... this is the DOS port of Mesa 5.1, for DJGPP fans... Whoa!
The driver has its origins in ddsample.c, written by Brian Paul and found by me
in Mesa 3.4.2.
@@ -209,7 +209,7 @@ v1.3 (mar-2003)
* revamped GLUT
* switched to DXE3
-v1.4 (aug-2003)
+v1.4 (oct-2003)
+ enabled GLUT fonts with DXE
+ truly added multi-window support in GLUT (for Adrian Woodward)
* accomodated makefiles with the new sourcetree
diff --git a/include/GL/fxmesa.h b/include/GL/fxmesa.h
index 42f6ed8d72..24c38278f5 100644
--- a/include/GL/fxmesa.h
+++ b/include/GL/fxmesa.h
@@ -38,7 +38,7 @@ extern "C" {
#endif
-#define FXMESA_MAJOR_VERSION 4
+#define FXMESA_MAJOR_VERSION 5
#define FXMESA_MINOR_VERSION 0
@@ -52,6 +52,7 @@ extern "C" {
#define FXMESA_STENCIL_SIZE 13 /* followed by an integer */
#define FXMESA_ACCUM_SIZE 14 /* followed by an integer */
#define FXMESA_COLORDEPTH 20 /* followed by an integer */
+#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
@@ -84,7 +85,7 @@ GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal);
GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx);
-GLAPI int GLAPIENTRY fxQueryHardware(void);
+GLAPI GLboolean GLAPIENTRY fxQueryHardware(void);
GLAPI void GLAPIENTRY fxCloseHardware(void);
diff --git a/progs/samples/Makefile.mgw b/progs/samples/Makefile.mgw
new file mode 100644
index 0000000000..04c4b79253
--- /dev/null
+++ b/progs/samples/Makefile.mgw
@@ -0,0 +1,67 @@
+# Mesa 3-D graphics library
+# Version: 4.0
+#
+# Copyright (C) 1999 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.
+
+# MinGW samples makefile v1.0 for Mesa
+#
+# Copyright (C) 2002 - Borca Daniel
+# Email : dborca@users.sourceforge.net
+# Web : http://www.geocities.com/dborca
+
+
+#
+# Available options:
+#
+# Environment variables:
+# CPU optimize for the given processor.
+# default = pentium
+#
+# Targets:
+# <file.exe> build a specific file
+#
+
+
+
+.PHONY : all
+.SUFFIXES : .c .o .exe
+
+TOP = ../..
+CPU ?= pentium
+
+CC = mingw32-gcc
+CFLAGS = -Wall -W -pedantic
+CFLAGS += -O2 -ffast-math -mcpu=$(CPU)
+CFLAGS += -I$(TOP)/include -I../util
+CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
+CFLAGS += -D_WINDEF_ -D_WINGDI_
+
+LD = mingw32-g++
+LDFLAGS = -s -L$(TOP)/lib
+
+LDLIBS = -lglut32 -lglu32 -lopengl32
+
+.c.o:
+ $(CC) -o $@ $(CFLAGS) -c $<
+.o.exe:
+ $(LD) -o $@ $(LDFLAGS) $< $(LDLIBS)
+
+all:
+ $(error Must specify <filename.exe> to build)
diff --git a/src/glut/dos/window.c b/src/glut/dos/window.c
index af00897f3e..ed95451e8d 100644
--- a/src/glut/dos/window.c
+++ b/src/glut/dos/window.c
@@ -37,7 +37,7 @@
GLUTwindow *g_curwin;
static GLuint swaptime, swapcount;
-static DMesaVisual visual = NULL;
+static DMesaVisual visual = NULL;
GLUTwindow *g_windows[MAX_WINDOWS];
@@ -49,7 +49,7 @@ static void clean (void)
for (i=1; i<=MAX_WINDOWS; i++) {
glutDestroyWindow(i);
}
- if (visual) DMesaDestroyVisual(visual);
+ if (visual) DMesaDestroyVisual(visual);
pc_close_stdout();
pc_close_stderr();
diff --git a/src/mesa/Makefile.DJ b/src/mesa/Makefile.DJ
index b375c05b61..9d9eb05f6d 100644
--- a/src/mesa/Makefile.DJ
+++ b/src/mesa/Makefile.DJ
@@ -304,7 +304,8 @@ DRIVER_SOURCES += \
drivers/glide/fxtexman.c \
drivers/glide/fxtris.c \
drivers/glide/fxvb.c \
- drivers/glide/fxglidew.c
+ drivers/glide/fxglidew.c \
+ drivers/glide/fxg.c
else
ifeq ($(MATROX),1)
DRIVER_SOURCES += \
diff --git a/src/mesa/Makefile.mgw b/src/mesa/Makefile.mgw
index d8fb47c932..0834908ec1 100644
--- a/src/mesa/Makefile.mgw
+++ b/src/mesa/Makefile.mgw
@@ -60,6 +60,7 @@
.PHONY: all clean
.INTERMEDIATE: x86/gen_matypes.exe
+.SUFFIXES: .rc .res
TOP = ../..
GLIDE ?= $(TOP)/glide3
@@ -75,8 +76,9 @@ CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
ifeq ($(FX),1)
CFLAGS += -DH3
CFLAGS += -I$(GLIDE)/include -DFX
-LDLIBS += -L$(GLIDE)/lib -lglide3
+LDLIBS += -L$(GLIDE)/lib -lglide3x
GL_DEF = drivers/glide/fxopengl.def
+GL_RES = drivers/glide/fx.rc
else
GL_DEF = drivers/windows/gdi/mesa.def
endif
@@ -135,6 +137,7 @@ MAIN_SOURCES = \
main/pixel.c \
main/points.c \
main/polygon.c \
+ main/program.c \
main/rastpos.c \
main/state.c \
main/stencil.c \
@@ -293,6 +296,7 @@ DRIVER_SOURCES = \
drivers/glide/fxtris.c \
drivers/glide/fxvb.c \
drivers/glide/fxglidew.c \
+ drivers/glide/fxg.c \
drivers/glide/fxwgl.c
else
DRIVER_SOURCES = \
@@ -306,16 +310,20 @@ OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
+RESOURCE = $(GL_RES:.rc=.res)
+
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.S.o:
$(CC) -o $@ $(CFLAGS) -c $<
.s.o:
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
+.rc.res:
+ windres -o $@ -Irc -Ocoff $<
all: $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
-$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS)
+$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) --target i386-mingw32 --def $(GL_DEF) $^ $(LDLIBS)
$(X86_OBJECTS): x86/matypes.h
@@ -326,6 +334,12 @@ x86/matypes.h: x86/gen_matypes.exe
x86/gen_matypes.exe: x86/gen_matypes.c
$(CC) -o $@ $(CFLAGS) -s $<
+# [dBorca] Hack alert:
+# use standard API, to work around Win32 @x names
+# also glapi_x86.S is protected against __WIN32__
+main/dispatch.o: main/dispatch.c
+ $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $<
+
clean:
-$(call UNLINK,array_cache/*.o)
-$(call UNLINK,glapi/*.o)
@@ -337,3 +351,4 @@ clean:
-$(call UNLINK,x86/*.o)
-$(call UNLINK,drivers/windows/gdi/*.o)
-$(call UNLINK,drivers/glide/*.o)
+ -$(call UNLINK,drivers/glide/*.res)
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c
index 451c3a8ce2..89b4a38a62 100644
--- a/src/mesa/drivers/glide/fxapi.c
+++ b/src/mesa/drivers/glide/fxapi.c
@@ -1,4 +1,4 @@
-/* $Id: fxapi.c,v 1.37 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxapi.c,v 1.38 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -44,6 +44,22 @@
#if defined(FX)
#include "fxdrv.h"
+#ifndef TDFX_DEBUG
+int TDFX_DEBUG = (0
+/* | VERBOSE_VARRAY */
+/* | VERBOSE_TEXTURE */
+/* | VERBOSE_IMMEDIATE */
+/* | VERBOSE_PIPELINE */
+/* | VERBOSE_DRIVER */
+/* | VERBOSE_STATE */
+/* | VERBOSE_API */
+/* | VERBOSE_DISPLAY_LIST */
+/* | VERBOSE_LIGHTING */
+/* | VERBOSE_PRIMS */
+/* | VERBOSE_VERTS */
+ );
+#endif
+
static fxMesaContext fxMesaCurrentCtx = NULL;
/*
@@ -54,8 +70,8 @@ static int glbGlideInitialized = 0;
static int glb3DfxPresent = 0;
static int glbTotNumCtx = 0;
-GrHwConfiguration glbHWConfig;
-int glbCurrentBoard = 0;
+static GrHwConfiguration glbHWConfig;
+static int glbCurrentBoard = 0;
#if defined(__WIN32__)
@@ -78,7 +94,7 @@ cleangraphics(void)
static void
cleangraphics_handler(int s)
{
- fprintf(stderr, "fxmesa: Received a not handled signal %d\n", s);
+ fprintf(stderr, "fxmesa: ERROR: received a not handled signal %d\n", s);
cleangraphics();
/* abort(); */
@@ -91,8 +107,7 @@ cleangraphics_handler(int s)
* Select the Voodoo board to use when creating
* a new context.
*/
-GLboolean GLAPIENTRY
-fxMesaSelectCurrentBoard(int n)
+GLboolean GLAPIENTRY fxMesaSelectCurrentBoard (int n)
{
fxQueryHardware();
@@ -142,13 +157,14 @@ gl3DfxSetPaletteEXT(GLuint * pal)
{
fxMesaContext fxMesa = fxMesaCurrentCtx;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
int i;
- fprintf(stderr, "fxmesa: gl3DfxSetPaletteEXT()\n");
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
- for (i = 0; i < 256; i++)
- fprintf(stderr, "%x\n", pal[i]);
+ for (i = 0; i < 256; i++) {
+ fprintf(stderr, "\t%x\n", pal[i]);
+ }
}
if (fxMesa) {
@@ -159,53 +175,34 @@ gl3DfxSetPaletteEXT(GLuint * pal)
}
-static GrScreenResolution_t
-fxBestResolution(int width, int height, int aux)
+static GrScreenResolution_t fxBestResolution (int width, int height)
{
- static int resolutions[][5] = {
- {320, 200, GR_RESOLUTION_320x200, 2, 2},
- {320, 240, GR_RESOLUTION_320x240, 2, 2},
- {512, 384, GR_RESOLUTION_512x384, 2, 2},
- {640, 400, GR_RESOLUTION_640x400, 2, 2},
- {640, 480, GR_RESOLUTION_640x480, 2, 2},
- {800, 600, GR_RESOLUTION_800x600, 4, 2},
- {960, 720, GR_RESOLUTION_960x720, 6, 4}
-#ifdef GR_RESOLUTION_1024x768
- , {1024, 768, GR_RESOLUTION_1024x768, 8, 4}
-#endif
-#ifdef GR_RESOLUTION_1280x1024
- , {1280, 1024, GR_RESOLUTION_1280x1024, 8, 8}
-#endif
-#ifdef GR_RESOLUTION_1600x1200
- , {1600, 1200, GR_RESOLUTION_1600x1200, 16, 8}
-#endif
- };
- int NUM_RESOLUTIONS = sizeof(resolutions) / (sizeof(int) * 5);
- int i, fbmem;
- GrScreenResolution_t lastvalidres = resolutions[4][2];
-
- fxQueryHardware();
-
- fbmem = glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.fbRam
- * glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.numChips;
-
- /* A work around for BZFlag */
-
- if ((width == 1) && (height == 1)) {
- width = 640;
- height = 480;
- }
-
- for (i = 0; i < NUM_RESOLUTIONS; i++) {
- if (resolutions[i][4 - aux] <= fbmem) {
- if ((width <= resolutions[i][0]) && (height <= resolutions[i][1])) {
- return resolutions[i][2];
- }
- lastvalidres = resolutions[i][2];
- }
- }
+ static int resolutions[][5] = {
+ { 320, 200, GR_RESOLUTION_320x200 },
+ { 320, 240, GR_RESOLUTION_320x240 },
+ { 512, 384, GR_RESOLUTION_512x384 },
+ { 640, 400, GR_RESOLUTION_640x400 },
+ { 640, 480, GR_RESOLUTION_640x480 },
+ { 800, 600, GR_RESOLUTION_800x600 },
+ {1024, 768, GR_RESOLUTION_1024x768 },
+ {1280, 1024, GR_RESOLUTION_1280x1024},
+ {1600, 1200, GR_RESOLUTION_1600x1200},
+ };
+
+ int i, NUM_RESOLUTIONS = sizeof(resolutions) / sizeof(resolutions[0]);
+ int lastvalidres = 4; /* set default to GR_RESOLUTION_640x480 */
+ int min = 2048 * 2048; /* max is GR_RESOLUTION_2048x2048 */
+
+ for (i = 0; i < NUM_RESOLUTIONS; i++) {
+ if ((width <= resolutions[i][0]) && (height <= resolutions[i][1])) {
+ if (min > (resolutions[i][0] * resolutions[i][1])) {
+ min = resolutions[i][0] * resolutions[i][1];
+ lastvalidres = i;
+ }
+ }
+ }
- return lastvalidres;
+ return resolutions[lastvalidres][2];
}
@@ -213,63 +210,16 @@ fxMesaContext GLAPIENTRY
fxMesaCreateBestContext(GLuint win, GLint width, GLint height,
const GLint attribList[])
{
- GrScreenRefresh_t refresh;
- int i;
- int res, aux;
- refresh = GR_REFRESH_75Hz;
-
- if (getenv("SST_SCREENREFRESH")) {
- if (!strcmp(getenv("SST_SCREENREFRESH"), "60"))
- refresh = GR_REFRESH_60Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "70"))
- refresh = GR_REFRESH_70Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "72"))
- refresh = GR_REFRESH_72Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "75"))
- refresh = GR_REFRESH_75Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "80"))
- refresh = GR_REFRESH_80Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "85"))
- refresh = GR_REFRESH_85Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "90"))
- refresh = GR_REFRESH_90Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "100"))
- refresh = GR_REFRESH_100Hz;
- if (!strcmp(getenv("SST_SCREENREFRESH"), "120"))
- refresh = GR_REFRESH_120Hz;
- }
-
- aux = 0;
- for (i = 0; attribList[i] != FXMESA_NONE; i++)
- if ((attribList[i] == FXMESA_ALPHA_SIZE) ||
- (attribList[i] == FXMESA_DEPTH_SIZE)) {
- if (attribList[++i] > 0) {
- aux = 1;
- break;
- }
- }
+ int res = fxBestResolution(width, height);
- res = fxBestResolution(width, height, aux);
+ if (res == -1) {
+ return NULL;
+ }
- return fxMesaCreateContext(win, res, refresh, attribList);
+ return fxMesaCreateContext(win, res, GR_REFRESH_60Hz/*ZZZ: GR_REFRESH_75Hz*/, attribList);
}
-#if 0
-void
-fxsignals()
-{
- signal(SIGINT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- signal(SIGPIPE, SIG_IGN);
- signal(SIGFPE, SIG_IGN);
- signal(SIGBUS, SIG_IGN);
- signal(SIGILL, SIG_IGN);
- signal(SIGSEGV, SIG_IGN);
- signal(SIGTERM, SIG_IGN);
-}
-#endif
-
/*
* Create a new FX/Mesa context and return a handle to it.
*/
@@ -278,149 +228,269 @@ fxMesaCreateContext(GLuint win,
GrScreenResolution_t res,
GrScreenRefresh_t ref, const GLint attribList[])
{
- fxMesaContext fxMesa = NULL;
- int i, type;
- int aux;
- GLboolean doubleBuffer = GL_FALSE;
- GLboolean alphaBuffer = GL_FALSE;
- GLboolean verbose = GL_FALSE;
- GLint depthSize = 0;
- GLint stencilSize = 0;
- GLint accumSize = 0;
- GLcontext *shareCtx = NULL;
- GLcontext *ctx = 0;
- /*FX_GrContext_t glideContext = 0; */
- char *errorstr;
- GLboolean useBGR;
- GLuint pixFmt, colDepth = 16;
- GLint redBits, greenBits, blueBits, alphaBits;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxMesaCreateContext() Start\n");
- }
+ fxMesaContext fxMesa = NULL;
+ GLcontext *ctx = NULL, *shareCtx = NULL;
+
+ int i;
+ const char *str;
+ int numChips, sliaa, fsaa;
+ struct SstCard_St *voodoo;
+ struct tdfx_glide *Glide;
+
+ GLboolean aux;
+ GLboolean doubleBuffer;
+ GLuint colDepth;
+ GLuint depthSize, alphaSize, stencilSize, accumSize;
+ GLuint redBits, greenBits, blueBits, alphaBits;
+ GrPixelFormat_t pixFmt;
+
+ GLboolean useBGR;
+ GLboolean verbose = GL_FALSE;
+
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ }
- if (getenv("MESA_FX_INFO"))
- verbose = GL_TRUE;
-
- aux = 0;
- i = 0;
- while (attribList[i] != FXMESA_NONE) {
- switch (attribList[i]) {
- case FXMESA_COLORDEPTH:
- colDepth = attribList[++i];
- break;
- case FXMESA_DOUBLEBUFFER:
- doubleBuffer = GL_TRUE;
- break;
- case FXMESA_ALPHA_SIZE:
- i++;
- alphaBuffer = attribList[i] > 0;
- if (alphaBuffer) {
- aux = 1;
- }
- break;
- case FXMESA_DEPTH_SIZE:
- i++;
- depthSize = attribList[i];
- if (depthSize) {
- aux = 1;
- }
- break;
- case FXMESA_STENCIL_SIZE:
- i++;
- stencilSize = attribList[i];
- break;
- case FXMESA_ACCUM_SIZE:
- i++;
- accumSize = attribList[i];
- break;
- /* XXX ugly hack here for sharing display lists */
-#define FXMESA_SHARE_CONTEXT 990099 /* keep in sync with xmesa1.c! */
- case FXMESA_SHARE_CONTEXT:
- i++;
- {
- const void *vPtr = &attribList[i];
- GLcontext **ctx = (GLcontext **) vPtr;
- shareCtx = *ctx;
- }
- break;
- default:
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: bad FXMESA_* switch\n");
- }
- return NULL;
- }
- i++;
- }
+ if (getenv("MESA_FX_INFO")) {
+ verbose = GL_TRUE;
+ }
- if (depthSize) {
- depthSize = (colDepth == 32) ? 24 : 16;
- }
+ /* Okay, first process the user flags */
+ aux = GL_FALSE;
+ doubleBuffer = GL_FALSE;
+ colDepth = 16;
+ depthSize = alphaSize = stencilSize = accumSize = 0;
+
+ i = 0;
+ while (attribList[i] != FXMESA_NONE) {
+ switch (attribList[i]) {
+ case FXMESA_COLORDEPTH:
+ colDepth = attribList[++i];
+ break;
+ case FXMESA_DOUBLEBUFFER:
+ doubleBuffer = GL_TRUE;
+ break;
+ case FXMESA_ALPHA_SIZE:
+ if ((alphaSize = attribList[++i])) {
+ aux = GL_TRUE;
+ }
+ break;
+ case FXMESA_DEPTH_SIZE:
+ if ((depthSize = attribList[++i])) {
+ aux = GL_TRUE;
+ }
+ break;
+ case FXMESA_STENCIL_SIZE:
+ stencilSize = attribList[++i];
+ break;
+ case FXMESA_ACCUM_SIZE:
+ accumSize = attribList[++i];
+ break;
+ /* XXX ugly hack here for sharing display lists */
+ case FXMESA_SHARE_CONTEXT:
+ {
+ const void *vPtr = &attribList[++i];
+ GLcontext **ctx = (GLcontext **)vPtr;
+ shareCtx = *ctx;
+ }
+ break;
+ default:
+ fprintf(stderr, "%s: ERROR: wrong parameter (%d) passed\n", __FUNCTION__, attribList[i]);
+ return NULL;
+ }
+ i++;
+ }
- /* A workaround for Linux GLQuake */
- if (depthSize && alphaBuffer)
- alphaBuffer = 0;
+ if (!fxQueryHardware()) {
+ fprintf(stderr, "%s: ERROR: no Voodoo hardware!\n", __FUNCTION__);
+ return NULL;
+ }
- if ((type = fxQueryHardware()) < 0) {
- fprintf(stderr, "fxmesa: ERROR no Voodoo hardware!\n");
- return NULL;
- }
+ grSstSelect(glbCurrentBoard);
+ /*grEnable(GR_OPENGL_MODE_EXT);*/ /* ZZZ: trick to make GL happy.
+ Glide3 will unmap memory for card when grSstWinClose is called.
+ This also forces the SLI band height to be 32 (above 1024x768) or 16
+ and disables the splash screen due to y-origin swapping.
+ Note: We only want the former. */
+ voodoo = &glbHWConfig.SSTs[glbCurrentBoard];
+ numChips = voodoo->numChips;
+
+ fxMesa = (fxMesaContext)CALLOC_STRUCT(tfxMesaContext);
+ if (!fxMesa) {
+ str = "private context";
+ goto errorhandler;
+ }
- grSstSelect(glbCurrentBoard);
+ fxMesa->type = voodoo->type;
+ fxMesa->HavePixExt = voodoo->HavePixExt;
+ fxMesa->HaveTexFmt = voodoo->HaveTexFmt;
+ fxMesa->HaveCmbExt = voodoo->HaveCmbExt;
+ fxMesa->HaveMirExt = voodoo->HaveMirExt;
+ fxMesa->HaveTexus2 = voodoo->HaveTexus2;
+ fxMesa->Glide = glbHWConfig.Glide;
+ Glide = &fxMesa->Glide;
+ sprintf(fxMesa->rendererString, "Mesa %s v0.51 %s %dMB FB, %dMB TM, %d TMU, %s",
+ grGetString(GR_RENDERER),
+ grGetString(GR_HARDWARE),
+ voodoo->fbRam,
+ (voodoo->tmuConfig[GR_TMU0].tmuRam + ((voodoo->nTexelfx > 1) ? voodoo->tmuConfig[GR_TMU1].tmuRam : 0)),
+ voodoo->nTexelfx,
+ (numChips > 1) ? "SLI" : "NOSLI");
+
+ switch (fxMesa->colDepth = colDepth) {
+ case 15:
+ redBits = 5;
+ greenBits = 5;
+ blueBits = 5;
+ alphaBits = 1;
+ pixFmt = GR_PIXFMT_ARGB_1555;
+ break;
+ case 16:
+ redBits = 5;
+ greenBits = 6;
+ blueBits = 5;
+ alphaBits = depthSize ? 0 : 8;
+ pixFmt = GR_PIXFMT_RGB_565;
+ break;
+ case 32:
+ redBits = 8;
+ greenBits = 8;
+ blueBits = 8;
+ alphaBits = 8;
+ pixFmt = GR_PIXFMT_ARGB_8888;
+ break;
+ default:
+ str = "pixelFormat";
+ goto errorhandler;
+ }
- fxMesa = (fxMesaContext) calloc(1, sizeof(struct tfxMesaContext));
- if (!fxMesa) {
- errorstr = "malloc";
- goto errorhandler;
- }
+ /* Tips:
+ * 1. we don't bother setting/checking AUX for stencil, because we'll decide
+ * later whether we have HW stencil, based on depth buffer (thus AUX is
+ * properly set)
+ * 2. when both DEPTH and ALPHA are enabled, depth should win. However, it is
+ * not clear whether 15bpp and 32bpp require AUX alpha buffer. Furthermore,
+ * alpha buffering is required only if destination alpha is used in alpha
+ * blending; alpha blending modes that do not use destination alpha can be
+ * used w/o alpha buffer.
+ * 3. `alphaBits' is what we can provide
+ * `alphaSize' is what app requests
+ * if we cannot provide enough bits for alpha buffer, we should fallback to
+ * SW alpha. However, setting `alphaBits' to `alphaSize' might confuse some
+ * of the span functions...
+ */
+
+ fxMesa->haveHwAlpha = GL_FALSE;
+ if (alphaSize && (alphaSize <= alphaBits)) {
+ alphaSize = alphaBits;
+ fxMesa->haveHwAlpha = GL_TRUE;
+ }
- fxMesa->haveTwoTMUs = (glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.nTexelfx > 1);
- fxMesa->haveDoubleBuffer = doubleBuffer;
- fxMesa->haveAlphaBuffer = alphaBuffer;
- fxMesa->haveGlobalPaletteTexture = GL_FALSE;
- fxMesa->haveZBuffer = depthSize ? 1 : 0;
- fxMesa->verbose = verbose;
- fxMesa->board = glbCurrentBoard;
- fxMesa->maxTextureSize = glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig.maxTextureSize; /* [koolsmoky] */
-
-
- switch (fxMesa->colDepth = colDepth) {
- case 15:
- redBits = 5;
- greenBits = 5;
- blueBits = 5;
- alphaBits = 1;
- pixFmt = GR_PIXFMT_ARGB_1555;
- break;
- case 16:
- redBits = 5;
- greenBits = 6;
- blueBits = 5;
- alphaBits = 0;
- pixFmt = GR_PIXFMT_RGB_565;
- break;
- case 32:
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- alphaBits = 8;
- pixFmt = GR_PIXFMT_ARGB_8888;
- break;
- default:
- errorstr = "pixelFormat";
- goto errorhandler;
- }
+ fxMesa->haveHwStencil = (fxMesa->HavePixExt && stencilSize && depthSize == 24);
+ fxMesa->haveZBuffer = depthSize > 0;
+ fxMesa->haveDoubleBuffer = doubleBuffer;
+ fxMesa->haveGlobalPaletteTexture = GL_FALSE;
+ fxMesa->verbose = verbose;
+ fxMesa->board = glbCurrentBoard;
- fxMesa->glideContext = FX_grSstWinOpen(&glbHWConfig.SSTs[glbCurrentBoard],
- (FxU32)win, res, ref,
- GR_COLORFORMAT_ABGR,
- pixFmt,
- GR_ORIGIN_LOWER_LEFT, 2, aux);
- if (!fxMesa->glideContext) {
- errorstr = "grSstWinOpen";
- goto errorhandler;
- }
+ fxMesa->haveTwoTMUs = (voodoo->nTexelfx > 1);
+
+ if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_NUM_TMU"))) {
+ if (atoi(str) <= 1) {
+ fxMesa->haveTwoTMUs = GL_FALSE;
+ }
+ }
+
+ if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_SWAPPENDINGCOUNT"))) {
+ fxMesa->maxPendingSwapBuffers = atoi(str);
+ if (fxMesa->maxPendingSwapBuffers > 3) {
+ fxMesa->maxPendingSwapBuffers = 3;
+ } else if (fxMesa->maxPendingSwapBuffers < 0) {
+ fxMesa->maxPendingSwapBuffers = 0;
+ }
+ } else {
+ fxMesa->maxPendingSwapBuffers = 2;
+ }
+
+ if ((str = Glide->grGetRegistryOrEnvironmentStringExt("FX_GLIDE_SWAPINTERVAL"))) {
+ fxMesa->swapInterval = atoi(str);
+ } else {
+ fxMesa->swapInterval = 0;
+ }
+
+ if ((str = Glide->grGetRegistryOrEnvironmentStringExt("SSTH3_SLI_AA_CONFIGURATION"))) {
+ sliaa = atoi(str);
+ } else {
+ sliaa = 0;
+ }
+ switch (colDepth) {
+ case 15:
+ if ((numChips == 4) && (sliaa == 8)) {
+ pixFmt = GR_PIXFMT_AA_8_ARGB_1555;
+ fsaa = 8;
+ } else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) {
+ pixFmt = GR_PIXFMT_AA_4_ARGB_1555;
+ fsaa = 4;
+ } else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) {
+ pixFmt = GR_PIXFMT_AA_2_ARGB_1555;
+ fsaa = 2;
+ } else {
+ fsaa = 0;
+ }
+ break;
+ case 16:
+ if ((numChips == 4) && (sliaa == 8)) {
+ pixFmt = GR_PIXFMT_AA_8_RGB_565;
+ fsaa = 8;
+ } else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) {
+ pixFmt = GR_PIXFMT_AA_4_RGB_565;
+ fsaa = 4;
+ } else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) {
+ pixFmt = GR_PIXFMT_AA_2_RGB_565;
+ fsaa = 2;
+ } else {
+ fsaa = 0;
+ }
+ break;
+ case 32:
+ if ((numChips == 4) && (sliaa == 8)) {
+ pixFmt = GR_PIXFMT_AA_8_ARGB_8888;
+ fsaa = 8;
+ } else if (((numChips == 4) && (sliaa == 7)) || ((numChips == 2) && (sliaa == 4))) {
+ pixFmt = GR_PIXFMT_AA_4_ARGB_8888;
+ fsaa = 4;
+ } else if (((numChips == 4) && (sliaa == 6)) || ((numChips == 2) && (sliaa == 3)) || ((numChips == 1) && (sliaa == 1))) {
+ pixFmt = GR_PIXFMT_AA_2_ARGB_8888;
+ fsaa = 2;
+ } else {
+ fsaa = 0;
+ }
+ break;
+ default: /* NOTREACHED */
+ str = "pixelFormat";
+ goto errorhandler;
+ }
+ fxMesa->fsaa = fsaa;
+
+ BEGIN_BOARD_LOCK();
+ if (fxMesa->HavePixExt) {
+ fxMesa->glideContext = Glide->grSstWinOpenExt((FxU32)win, res, ref,
+ GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT,
+ pixFmt,
+ 2, aux);
+ } else if (pixFmt == GR_PIXFMT_RGB_565) {
+ fxMesa->glideContext = grSstWinOpen((FxU32)win, res, ref,
+ GR_COLORFORMAT_ABGR, GR_ORIGIN_LOWER_LEFT,
+ 2, aux);
+ } else {
+ fxMesa->glideContext = 0;
+ }
+ END_BOARD_LOCK();
+ if (!fxMesa->glideContext) {
+ str = "grSstWinOpen";
+ goto errorhandler;
+ }
/*
* Pixel tables are used during pixel read-back
@@ -429,7 +499,7 @@ fxMesaCreateContext(GLuint win,
* As a consequence, 32bit read-back is not swizzled!
* Also determine if we need vertex snapping.
*/
- switch (glbHWConfig.SSTs[glbCurrentBoard].type) {
+ switch (voodoo->type) {
case GR_SSTTYPE_VOODOO:
case GR_SSTTYPE_Banshee:
useBGR = GL_TRUE;
@@ -448,12 +518,6 @@ fxMesaCreateContext(GLuint win,
break;
}
- if (verbose) {
- fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n",
- useBGR ? "BGR" : "RGB",
- fxMesa->snapVertices);
- }
-
fxInitPixelTables(fxMesa, useBGR);
fxMesa->width = FX_grSstScreenWidth();
@@ -467,22 +531,40 @@ fxMesaCreateContext(GLuint win,
fxMesa->screen_width = fxMesa->width;
fxMesa->screen_height = fxMesa->height;
- fxMesa->new_state = ~0;
-
- if (verbose)
- fprintf(stderr, "Voodoo screen: %dx%dx%d\n",
- (int)FX_grSstScreenWidth(), (int)FX_grSstScreenHeight(), colDepth);
-
- fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */
- doubleBuffer, GL_FALSE, /* stereo */
- redBits, greenBits, blueBits, alphaBits, /* RGBA bits */
- 0, /* index bits */
+ if (verbose) {
+ char buf[80];
+
+ strcpy(buf, grGetString(GR_VERSION));
+ fprintf(stderr, "Voodoo Using Glide %s\n", buf);
+ fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst);
+ 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 chips detected: %d\n", voodoo->numChips);
+ fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n",
+ useBGR ? "BGR" : "RGB",
+ fxMesa->snapVertices);
+ fprintf(stderr, "Voodoo screen: %dx%d.%d\n",
+ fxMesa->screen_width, fxMesa->screen_height, colDepth);
+ }
+
+ fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */
+ doubleBuffer,
+ GL_FALSE, /* stereo */
+ redBits, /* RGBA.R bits */
+ greenBits, /* RGBA.G bits */
+ blueBits, /* RGBA.B bits */
+ alphaSize, /* RGBA.A bits */
+ 0, /* index bits */
depthSize, /* depth_size */
stencilSize, /* stencil_size */
- accumSize, accumSize, accumSize,
- accumSize, 1);
+ accumSize,
+ accumSize,
+ accumSize,
+ alphaSize ? accumSize : 0,
+ 1);
if (!fxMesa->glVis) {
- errorstr = "_mesa_create_visual";
+ str = "_mesa_create_visual";
goto errorhandler;
}
@@ -490,24 +572,24 @@ fxMesaCreateContext(GLuint win,
shareCtx,
(void *) fxMesa, GL_TRUE);
if (!ctx) {
- errorstr = "_mesa_create_context";
+ str = "_mesa_create_context";
goto errorhandler;
}
if (!fxDDInitFxMesaContext(fxMesa)) {
- errorstr = "fxDDInitFxMesaContext failed";
+ str = "fxDDInitFxMesaContext";
goto errorhandler;
}
- fxMesa->glBuffer = _mesa_create_framebuffer(fxMesa->glVis, GL_FALSE, /* no software depth */
- fxMesa->glVis->stencilBits > 0,
- fxMesa->glVis->accumRedBits >
- 0,
- fxMesa->glVis->alphaBits > 0);
+ fxMesa->glBuffer = _mesa_create_framebuffer(fxMesa->glVis,
+ GL_FALSE, /* no software depth */
+ stencilSize && !fxMesa->haveHwStencil,
+ fxMesa->glVis->accumRedBits > 0,
+ alphaSize && !fxMesa->haveHwAlpha);
if (!fxMesa->glBuffer) {
- errorstr = "_mesa_create_framebuffer";
+ str = "_mesa_create_framebuffer";
goto errorhandler;
}
@@ -528,35 +610,35 @@ fxMesaCreateContext(GLuint win,
}
#endif
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxMesaCreateContext() End\n");
- }
-
return fxMesa;
- errorhandler:
- if (fxMesa) {
- if (fxMesa->glideContext)
- grSstWinClose(fxMesa->glideContext);
- fxMesa->glideContext = 0;
-
- if (fxMesa->state)
- free(fxMesa->state);
- if (fxMesa->fogTable)
- free(fxMesa->fogTable);
- if (fxMesa->glBuffer)
- _mesa_destroy_framebuffer(fxMesa->glBuffer);
- if (fxMesa->glVis)
- _mesa_destroy_visual(fxMesa->glVis);
- if (fxMesa->glCtx)
- _mesa_destroy_context(fxMesa->glCtx);
- free(fxMesa);
- }
+errorhandler:
+ if (fxMesa) {
+ if (fxMesa->glideContext) {
+ grSstWinClose(fxMesa->glideContext);
+ fxMesa->glideContext = 0;
+ }
+
+ if (fxMesa->state) {
+ FREE(fxMesa->state);
+ }
+ if (fxMesa->fogTable) {
+ FREE(fxMesa->fogTable);
+ }
+ if (fxMesa->glBuffer) {
+ _mesa_destroy_framebuffer(fxMesa->glBuffer);
+ }
+ if (fxMesa->glVis) {
+ _mesa_destroy_visual(fxMesa->glVis);
+ }
+ if (fxMesa->glCtx) {
+ _mesa_destroy_context(fxMesa->glCtx);
+ }
+ FREE(fxMesa);
+ }
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: ERROR (%s)\n", errorstr);
- }
- return NULL;
+ fprintf(stderr, "%s: ERROR: %s\n", __FUNCTION__, str);
+ return NULL;
}
@@ -577,8 +659,8 @@ fxMesaUpdateScreenSize(fxMesaContext fxMesa)
void GLAPIENTRY
fxMesaDestroyContext(fxMesaContext fxMesa)
{
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxMesaDestroyContext()\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
if (!fxMesa)
@@ -621,10 +703,10 @@ fxMesaDestroyContext(fxMesaContext fxMesa)
_mesa_destroy_context(fxMesa->glCtx);
_mesa_destroy_framebuffer(fxMesa->glBuffer);
- fxCloseHardware();
grSstWinClose(fxMesa->glideContext);
+ fxCloseHardware();
- free(fxMesa);
+ FREE(fxMesa);
if (fxMesa == fxMesaCurrentCtx)
fxMesaCurrentCtx = NULL;
@@ -637,16 +719,12 @@ fxMesaDestroyContext(fxMesaContext fxMesa)
void GLAPIENTRY
fxMesaMakeCurrent(fxMesaContext fxMesa)
{
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxMesaMakeCurrent(...) Start\n");
- }
-
if (!fxMesa) {
_mesa_make_current(NULL, NULL);
fxMesaCurrentCtx = NULL;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxMesaMakeCurrent(NULL) End\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(NULL)\n", __FUNCTION__);
}
return;
@@ -655,14 +733,17 @@ fxMesaMakeCurrent(fxMesaContext fxMesa)
/* if this context is already the current one, we can return early */
if (fxMesaCurrentCtx == fxMesa
&& fxMesaCurrentCtx->glCtx == _mesa_get_current_context()) {
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr,
- "fxmesa: fxMesaMakeCurrent(fxMesaCurrentCtx==fxMesa) End\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(fxMesaCurrentCtx==fxMesa)\n", __FUNCTION__);
}
return;
}
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
+ }
+
if (fxMesaCurrentCtx)
grGlideGetState((GrState *) fxMesaCurrentCtx->state);
@@ -678,43 +759,17 @@ fxMesaMakeCurrent(fxMesaContext fxMesa)
/* The first time we call MakeCurrent we set the initial viewport size */
if (fxMesa->glCtx->Viewport.Width == 0)
_mesa_set_viewport(fxMesa->glCtx, 0, 0, fxMesa->width, fxMesa->height);
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxMesaMakeCurrent(...) End\n");
- }
}
-#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.
*/
void GLAPIENTRY
fxMesaSwapBuffers(void)
{
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr,
- "fxmesa: ------------------------------- fxMesaSwapBuffers() -------------------------------\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s()\n", __FUNCTION__);
}
if (fxMesaCurrentCtx) {
@@ -745,53 +800,29 @@ fxMesaSwapBuffers(void)
/*
* Query 3Dfx hardware presence/kind
*/
-int GLAPIENTRY
-fxQueryHardware(void)
+GLboolean GLAPIENTRY fxQueryHardware (void)
{
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxQueryHardware() Start\n");
- }
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s()\n", __FUNCTION__);
+ }
- if (!glbGlideInitialized) {
- grGlideInit();
- if (FX_grSstQueryHardware(&glbHWConfig)) {
- grSstSelect(glbCurrentBoard);
- glb3DfxPresent = 1;
-
- if (getenv("MESA_FX_INFO")) {
- char buf[80];
- GrVoodooConfig_t *voodoo = &glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig;
-
- strcpy(buf, grGetString(GR_VERSION));
- fprintf(stderr, "Voodoo Using Glide %s\n", buf);
- fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst);
- 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 chips detected: %d\n", voodoo->numChips);
- }
- }
- else {
- glb3DfxPresent = 0;
- }
+ if (!glbGlideInitialized) {
+ grGlideInit();
+ glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
- glbGlideInitialized = 1;
+ glbGlideInitialized = 1;
#if defined(__WIN32__)
- _onexit((_onexit_t) cleangraphics);
+ _onexit((_onexit_t) cleangraphics);
#elif defined(__linux__)
- /* Only register handler if environment variable is not defined. */
- if (!getenv("MESA_FX_NO_SIGNALS")) {
- atexit(cleangraphics);
- }
+ /* Only register handler if environment variable is not defined. */
+ if (!getenv("MESA_FX_NO_SIGNALS")) {
+ atexit(cleangraphics);
+ }
#endif
- }
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxQueryHardware() End (voodooo)\n");
- }
+ }
- return glbHWConfig.SSTs[glbCurrentBoard].type;
+ return glb3DfxPresent;
}
@@ -802,7 +833,7 @@ void GLAPIENTRY
fxCloseHardware(void)
{
if (glbGlideInitialized) {
- if (getenv("MESA_FX_INFO")) {
+ if (fxMesaCurrentCtx && fxMesaCurrentCtx->verbose) {
GrSstPerfStats_t st;
FX_grSstPerfStats(&st);
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index 3b58eb0535..09844a6e2a 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -2,7 +2,7 @@
* fxDDReadPixels888 does not convert 8A8R8G8B into 5R5G5B
*/
-/* $Id: fxdd.c,v 1.99 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxdd.c,v 1.100 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -63,8 +63,6 @@
-float gl_ubyte_to_float_255_color_tab[256];
-
/* These lookup table are used to extract RGB values in [0,255] from
* 16-bit pixel values.
*/
@@ -72,6 +70,12 @@ GLubyte FX_PixelToR[0x10000];
GLubyte FX_PixelToG[0x10000];
GLubyte FX_PixelToB[0x10000];
+/* lookup table for scaling 4 bit colors up to 8 bits */
+GLuint FX_rgb_scale_4[16] = {
+ 0, 17, 34, 51, 68, 85, 102, 119,
+ 136, 153, 170, 187, 204, 221, 238, 255
+};
+
/* lookup table for scaling 5 bit colors up to 8 bits */
GLuint FX_rgb_scale_5[32] = {
0, 8, 16, 25, 33, 41, 49, 58,
@@ -80,6 +84,18 @@ GLuint FX_rgb_scale_5[32] = {
197, 206, 214, 222, 230, 239, 247, 255
};
+/* lookup table for scaling 6 bit colors up to 8 bits */
+GLuint FX_rgb_scale_6[64] = {
+ 0, 4, 8, 12, 16, 20, 24, 28,
+ 32, 36, 40, 45, 49, 53, 57, 61,
+ 65, 69, 73, 77, 81, 85, 89, 93,
+ 97, 101, 105, 109, 113, 117, 121, 125,
+ 130, 134, 138, 142, 146, 150, 154, 158,
+ 162, 166, 170, 174, 178, 182, 186, 190,
+ 194, 198, 202, 206, 210, 215, 219, 223,
+ 227, 231, 235, 239, 243, 247, 251, 255
+};
+
/*
* Initialize the FX_PixelTo{RGB} arrays.
@@ -120,22 +136,18 @@ fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
/* Return buffer size information */
static void
-fxDDBufferSize(GLframebuffer *buffer, GLuint * width, GLuint * height)
+fxDDBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
{
GET_CURRENT_CONTEXT(ctx);
- if (ctx && ctx->DriverCtx) {
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ if (ctx && FX_CONTEXT(ctx)) {
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDBufferSize(...) Start\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
*width = fxMesa->width;
*height = fxMesa->height;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDBufferSize(...) End\n");
- }
}
}
@@ -144,11 +156,11 @@ fxDDBufferSize(GLframebuffer *buffer, GLuint * width, GLuint * height)
static void
fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLubyte col[4];
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDClearColor(%f,%f,%f,%f)\n",
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%f, %f, %f, %f)\n", __FUNCTION__,
color[0], color[1], color[2], color[3]);
}
@@ -163,122 +175,264 @@ fxDDClearColor(GLcontext * ctx, const GLfloat color[4])
/* Clear the color and/or depth buffers */
-static void
-fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
- GLint x, GLint y, GLint width, GLint height)
+static void fxDDClear( GLcontext *ctx,
+ GLbitfield mask, GLboolean all,
+ GLint x, GLint y, GLint width, GLint height )
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
- const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask);
- /* [dBorca] should use an adequate scaler for 16 vs 32bit (GR_ZDEPTH_MIN_MAX) */
- const FxU32 clearD = (FxU32) (ctx->Depth.Clear * 0x00ffffff);
- GLbitfield softwareMask = mask & (DD_STENCIL_BIT | DD_ACCUM_BIT);
-
- /* we can't clear stencil or accum buffers */
- mask &= ~(DD_STENCIL_BIT | DD_ACCUM_BIT);
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDClear(%d,%d,%d,%d)\n", (int) x, (int) y,
- (int) width, (int) height);
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GLbitfield softwareMask = mask & (DD_ACCUM_BIT);
+ const GLuint stencil_size = fxMesa->haveHwStencil ? ctx->Visual.stencilBits : 0;
+ const FxU32 clearD = (FxU32) (((1 << ctx->Visual.depthBits) - 1) * ctx->Depth.Clear);
+ const FxU8 clearS = (FxU8) (ctx->Stencil.Clear & 0xff);
+
+ if ( TDFX_DEBUG & MESA_VERBOSE ) {
+ fprintf( stderr, "%s( %d, %d, %d, %d )\n",
+ __FUNCTION__, (int) x, (int) y, (int) width, (int) height );
}
- if (colorMask != 0xffffffff) {
- /* 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);
+/*jejeje*/
+ /* Need this check to respond to glScissor and clipping updates */
+ if (fxMesa->new_state & FX_NEW_SCISSOR) {
+ extern void fxSetupScissor(GLcontext * ctx);
+ fxSetupScissor(ctx);
}
- /*
- * This could probably be done fancier but doing each possible case
- * explicitly is less error prone.
- */
- switch (mask) {
- case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
- /* back buffer & depth */
- grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- if (!ctx->Depth.Mask) {
- grDepthMask(FXFALSE);
+ /* we can't clear accum buffers */
+ mask &= ~(DD_ACCUM_BIT);
+
+ if (mask & DD_STENCIL_BIT) {
+ if (!fxMesa->haveHwStencil || fxMesa->unitsState.stencilWriteMask != 0xff) {
+ /* Napalm seems to have trouble with stencil write masks != 0xff */
+ /* do stencil clear in software */
+ mask &= ~(DD_STENCIL_BIT);
+ softwareMask |= DD_STENCIL_BIT;
}
- break;
- case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
- /* XXX it appears that the depth buffer isn't cleared when
- * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
- * This is a work-around/
+ }
+
+ if (ctx->Visual.greenBits != 8 && ctx->Visual.greenBits != 5) {
+ /* can only do color masking if running in 24/32bpp on Napalm */
+ if (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
+ ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP]) {
+ softwareMask |= (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT));
+ mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
+ }
+ }
+
+ if (fxMesa->haveHwStencil) {
+ /*
+ * If we want to clear stencil, it must be enabled
+ * in the HW, even if the stencil test is not enabled
+ * in the OGL state.
*/
- /* clear depth */
- grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- grColorMask(FXFALSE, FXFALSE);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- /* clear front */
- grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- break;
- case DD_BACK_LEFT_BIT:
- /* back buffer only */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- if (ctx->Depth.Mask) {
- grDepthMask(FXTRUE);
+ BEGIN_BOARD_LOCK();
+ if (mask & DD_STENCIL_BIT) {
+ fxMesa->Glide.grStencilMaskExt(0xff /*fxMesa->unitsState.stencilWriteMask*/);
+ /* set stencil ref value = desired clear value */
+ fxMesa->Glide.grStencilFuncExt(GR_CMP_ALWAYS, clearS, 0xff);
+ fxMesa->Glide.grStencilOpExt(GR_STENCILOP_REPLACE,
+ GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
+ grEnable(GR_STENCIL_MODE_EXT);
}
- break;
- case DD_FRONT_LEFT_BIT:
- /* front buffer only */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- if (ctx->Depth.Mask) {
- grDepthMask(FXTRUE);
+ else {
+ grDisable(GR_STENCIL_MODE_EXT);
}
- break;
- case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
- /* front and back */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- if (ctx->Depth.Mask) {
+ END_BOARD_LOCK();
+ }
+
+ /*
+ * This may be ugly, but it's needed in order to work around a number
+ * of Glide bugs.
+ */
+ BEGIN_CLIP_LOOP();
+ {
+ /*
+ * This could probably be done fancier but doing each possible case
+ * explicitly is less error prone.
+ */
+ switch (mask & ~DD_STENCIL_BIT) {
+ case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
+ /* back buffer & depth */
+ fxColorMask(fxMesa, GL_TRUE); /* work around Voodoo3 bug */
grDepthMask(FXTRUE);
- }
- break;
- case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
- /* clear front */
- grDepthMask(FXFALSE);
- grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- /* clear back and depth */
- grDepthMask(FXTRUE);
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- if (!ctx->Depth.Mask) {
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ if (stencil_size > 0) {
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ }
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ if (!ctx->Depth.Mask || !ctx->Depth.Test) {
+ grDepthMask(FXFALSE);
+ }
+ break;
+ case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
+ /* XXX it appears that the depth buffer isn't cleared when
+ * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
+ * This is a work-around/
+ */
+ /* clear depth */
+ grDepthMask(FXTRUE);
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ fxColorMask(fxMesa, GL_FALSE);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ /* clear front */
+ fxColorMask(fxMesa, GL_TRUE);
+ grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ if (!ctx->Depth.Mask || !ctx->Depth.Test) {
+ grDepthMask(FXFALSE);
+ }
+ break;
+ case DD_BACK_LEFT_BIT:
+ /* back buffer only */
grDepthMask(FXFALSE);
- }
- break;
- case DD_DEPTH_BIT:
- /* just the depth buffer */
- grRenderBuffer(GR_BUFFER_BACKBUFFER);
- grColorMask(FXFALSE, FXFALSE);
- grDepthMask(FXTRUE);
- FX_grBufferClear(fxMesa->clearC, fxMesa->clearA, clearD);
- grColorMask(FXTRUE, ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
- if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ if (ctx->Depth.Mask && ctx->Depth.Test) {
+ grDepthMask(FXTRUE);
+ }
+ break;
+ case DD_FRONT_LEFT_BIT:
+ /* front buffer only */
+ grDepthMask(FXFALSE);
+ grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ if (ctx->Depth.Mask && ctx->Depth.Test) {
+ grDepthMask(FXTRUE);
+ }
+ break;
+ case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
+ /* front and back */
+ grDepthMask(FXFALSE);
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
- if (!ctx->Depth.Test || !ctx->Depth.Mask)
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ if (ctx->Depth.Mask && ctx->Depth.Test) {
+ grDepthMask(FXTRUE);
+ }
+ break;
+ case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
+ /* clear front */
grDepthMask(FXFALSE);
- break;
- default:
- /* error */
- ;
+ grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ /* clear back and depth */
+ grDepthMask(FXTRUE);
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ if (!ctx->Depth.Mask || !ctx->Depth.Mask) {
+ grDepthMask(FXFALSE);
+ }
+ break;
+ case DD_DEPTH_BIT:
+ /* just the depth buffer */
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ fxColorMask(fxMesa, GL_FALSE);
+ grDepthMask(FXTRUE);
+ if (stencil_size > 0)
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ else
+ grBufferClear(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD);
+ fxColorMask(fxMesa, GL_TRUE);
+ if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
+ grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ if (!ctx->Depth.Test || !ctx->Depth.Mask)
+ grDepthMask(FXFALSE);
+ break;
+ default:
+ /* clear no color buffers or depth buffer but might clear stencil */
+ if (stencil_size > 0 && (mask & DD_STENCIL_BIT)) {
+ /* XXX need this RenderBuffer call to work around Glide bug */
+ grRenderBuffer(GR_BUFFER_BACKBUFFER);
+ grDepthMask(FXFALSE);
+ fxColorMask(fxMesa, GL_FALSE);
+ fxMesa->Glide.grBufferClearExt(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD, clearS);
+ if (ctx->Depth.Mask && ctx->Depth.Test) {
+ grDepthMask(FXTRUE);
+ }
+ fxColorMask(fxMesa, GL_TRUE);
+ if (ctx->Color._DrawDestMask & FRONT_LEFT_BIT)
+ grRenderBuffer(GR_BUFFER_FRONTBUFFER);
+ }
+ }
+ }
+ END_CLIP_LOOP();
+
+ if (fxMesa->haveHwStencil && (mask & DD_STENCIL_BIT)) {
+ /* We changed the stencil state above. Signal that we need to
+ * upload it again.
+ */
+ fxMesa->new_state |= FX_NEW_STENCIL;
}
- /* Clear any remaining buffers:
- */
if (softwareMask)
- _swrast_Clear(ctx, softwareMask, all, x, y, width, height);
+ _swrast_Clear( ctx, softwareMask, all, x, y, width, height );
}
@@ -287,10 +441,10 @@ fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
static void
fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%x)\n", __FUNCTION__, (int)mode);
}
if (mode == GL_FRONT_LEFT) {
@@ -302,7 +456,7 @@ fxDDSetDrawBuffer(GLcontext * ctx, GLenum mode)
grRenderBuffer(fxMesa->currentFB);
}
else if (mode == GL_NONE) {
- grColorMask(FXFALSE, FXFALSE);
+ fxColorMask(fxMesa, GL_FALSE);
}
else {
/* we'll need a software fallback */
@@ -323,7 +477,7 @@ fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * bitmap)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
FxU16 color;
const struct gl_pixelstore_attrib *finalUnpack;
@@ -409,9 +563,7 @@ fxDDDrawBitmap(GLcontext * ctx, GLint px, GLint py,
fxMesa->currentFB,
GR_LFBWRITEMODE_565,
GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifndef FX_SILENT
- fprintf(stderr, "fx Driver: error locking the linear frame buffer\n");
-#endif
+ fprintf(stderr, "%s: ERROR: locking the linear frame buffer\n", __FUNCTION__);
return;
}
@@ -493,7 +645,7 @@ fxDDReadPixels(GLcontext * ctx, GLint x, GLint y,
return;
}
else {
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
@@ -608,7 +760,7 @@ static void fxDDReadPixels555 (GLcontext * ctx,
return;
}
else {
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
@@ -719,7 +871,7 @@ static void fxDDReadPixels888 (GLcontext * ctx,
return;
}
else {
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
@@ -798,20 +950,11 @@ fxDDFinish(GLcontext * ctx)
static const GLubyte *
fxDDGetString(GLcontext * ctx, GLenum name)
{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+
switch (name) {
case GL_RENDERER:
- {
- static char buf[80];
- GrVoodooConfig_t *vc = &glbHWConfig.SSTs[glbCurrentBoard].VoodooConfig;
- sprintf(buf, "Mesa %s v0.31 %s %dMB FB, %dMB TM, %d TMU, %s",
- grGetString(GR_RENDERER),
- grGetString(GR_HARDWARE),
- vc->fbRam,
- (vc->tmuConfig[GR_TMU0].tmuRam + ((vc->nTexelfx > 1) ? vc->tmuConfig[GR_TMU1].tmuRam : 0)),
- (vc->nTexelfx * vc->numChips),
- (vc->numChips > 1) ? "SLI" : "NOSLI");
- return (GLubyte *)buf;
- }
+ return (GLubyte *)fxMesa->rendererString;
default:
return NULL;
}
@@ -821,10 +964,10 @@ static const struct gl_pipeline_stage *fx_pipeline[] = {
&_tnl_vertex_transform_stage, /* TODO: Add the fastpath here */
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
- &_tnl_fog_coordinate_stage, /* TODO: Omit fog stage */
+ /*&_tnl_fog_coordinate_stage,*/ /* TODO: Omit fog stage ZZZ ZZZ ZZZ */
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
- &_tnl_point_attenuation_stage,
+ /*&_tnl_point_attenuation_stage,*/ /* TODO: For AA primitives ZZZ ZZZ ZZZ */
&_tnl_render_stage,
0,
};
@@ -836,31 +979,10 @@ int
fxDDInitFxMesaContext(fxMesaContext fxMesa)
{
int i;
-
- for (i = 0; i < 256; i++) {
- gl_ubyte_to_float_255_color_tab[i] = (float) i;
- }
+ GLcontext *ctx = fxMesa->glCtx;
FX_setupGrVertexLayout();
- if (getenv("FX_EMULATE_SINGLE_TMU"))
- fxMesa->haveTwoTMUs = GL_FALSE;
-
- if (getenv("FX_GLIDE_SWAPINTERVAL"))
- fxMesa->swapInterval = atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
- else
- fxMesa->swapInterval = 1;
-
- if (getenv("MESA_FX_SWAP_PENDING"))
- fxMesa->maxPendingSwapBuffers = atoi(getenv("MESA_FX_SWAP_PENDING"));
- else
- fxMesa->maxPendingSwapBuffers = 2;
-
- if (getenv("MESA_FX_INFO"))
- fxMesa->verbose = GL_TRUE;
- else
- fxMesa->verbose = GL_FALSE;
-
fxMesa->color = 0xffffffff;
fxMesa->clearC = 0;
fxMesa->clearA = 0;
@@ -877,7 +999,7 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
/* FX units setup */
fxMesa->unitsState.alphaTestEnabled = GL_FALSE;
- fxMesa->unitsState.alphaTestFunc = GR_CMP_ALWAYS;
+ fxMesa->unitsState.alphaTestFunc = GL_ALWAYS;
fxMesa->unitsState.alphaTestRefValue = 0.0;
fxMesa->unitsState.blendEnabled = GL_FALSE;
@@ -888,9 +1010,12 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
fxMesa->unitsState.depthTestEnabled = GL_FALSE;
fxMesa->unitsState.depthMask = GL_TRUE;
- fxMesa->unitsState.depthTestFunc = GR_CMP_LESS;
+ fxMesa->unitsState.depthTestFunc = GL_LESS;
+ fxMesa->unitsState.depthBias = 0;
- grColorMask(FXTRUE, fxMesa->haveAlphaBuffer ? FXTRUE : FXFALSE);
+ fxMesa->unitsState.stencilWriteMask = 0xff;
+
+ fxColorMask(fxMesa, GL_TRUE);
if (fxMesa->haveDoubleBuffer) {
fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
grRenderBuffer(GR_BUFFER_BACKBUFFER);
@@ -900,15 +1025,15 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
- fxMesa->state = malloc(FX_grGetInteger(GR_GLIDE_STATE_SIZE));
- fxMesa->fogTable = (GrFog_t *) malloc(FX_grGetInteger(GR_FOG_TABLE_ENTRIES) *
+ fxMesa->state = MALLOC(FX_grGetInteger(GR_GLIDE_STATE_SIZE));
+ fxMesa->fogTable = (GrFog_t *) MALLOC(FX_grGetInteger(GR_FOG_TABLE_ENTRIES) *
sizeof(GrFog_t));
if (!fxMesa->state || !fxMesa->fogTable) {
if (fxMesa->state)
- free(fxMesa->state);
+ FREE(fxMesa->state);
if (fxMesa->fogTable)
- free(fxMesa->fogTable);
+ FREE(fxMesa->fogTable);
return 0;
}
@@ -920,42 +1045,50 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN);
/* [koolsmoky] */
{
- int textureSize = ((fxMesa->maxTextureSize > 2048) ? 2048 : fxMesa->maxTextureSize);
- fxMesa->glCtx->Const.MaxTextureLevels = 0;
+ int textureLevels = 0;
+ int textureSize = FX_grGetInteger(GR_MAX_TEXTURE_SIZE);
do {
- fxMesa->glCtx->Const.MaxTextureLevels++;
+ textureLevels++;
} while ((textureSize >>= 0x1) & 0x7ff);
+ ctx->Const.MaxTextureLevels = textureLevels;
}
- fxMesa->glCtx->Const.MaxTextureUnits = fxMesa->haveTwoTMUs ? 2 : 1;
+ ctx->Const.MaxTextureCoordUnits = fxMesa->haveTwoTMUs ? 2 : 1;
+ ctx->Const.MaxTextureImageUnits = fxMesa->haveTwoTMUs ? 2 : 1;
+ ctx->Const.MaxTextureUnits = MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits);
+
fxMesa->new_state = _NEW_ALL;
+ if (!fxMesa->haveHwStencil) {
+ /* don't touch stencil if there is none */
+ fxMesa->new_state &= ~FX_NEW_STENCIL;
+ }
/* Initialize the software rasterizer and helper modules.
*/
- _swrast_CreateContext(fxMesa->glCtx);
- _ac_CreateContext(fxMesa->glCtx);
- _tnl_CreateContext(fxMesa->glCtx);
- _swsetup_CreateContext(fxMesa->glCtx);
+ _swrast_CreateContext(ctx);
+ _ac_CreateContext(ctx);
+ _tnl_CreateContext(ctx);
+ _swsetup_CreateContext(ctx);
/* Install customized pipeline */
- _tnl_destroy_pipeline(fxMesa->glCtx);
- _tnl_install_pipeline(fxMesa->glCtx, fx_pipeline);
+ _tnl_destroy_pipeline(ctx);
+ _tnl_install_pipeline(ctx, fx_pipeline);
- fxAllocVB(fxMesa->glCtx);
+ fxAllocVB(ctx);
- fxSetupDDPointers(fxMesa->glCtx);
- fxDDInitTriFuncs(fxMesa->glCtx);
+ fxSetupDDPointers(ctx);
+ fxDDInitTriFuncs(ctx);
/* Tell the software rasterizer to use pixel fog always.
*/
- _swrast_allow_vertex_fog(fxMesa->glCtx, GL_FALSE);
- _swrast_allow_pixel_fog(fxMesa->glCtx, GL_TRUE);
+ _swrast_allow_vertex_fog(ctx, GL_FALSE);
+ _swrast_allow_pixel_fog(ctx, GL_TRUE);
/* Tell tnl not to calculate or use vertex fog factors. (Needed to
* tell render stage not to clip fog coords).
*/
-/* _tnl_calculate_vertex_fog( fxMesa->glCtx, GL_FALSE ); */
+/* _tnl_calculate_vertex_fog( ctx, GL_FALSE ); */
- fxDDInitExtensions(fxMesa->glCtx);
+ fxDDInitExtensions(ctx);
grGlideGetState((GrState *) fxMesa->state);
@@ -973,9 +1106,9 @@ fxDDDestroyFxMesaContext(fxMesaContext fxMesa)
_swrast_DestroyContext(fxMesa->glCtx);
if (fxMesa->state)
- free(fxMesa->state);
+ FREE(fxMesa->state);
if (fxMesa->fogTable)
- free(fxMesa->fogTable);
+ FREE(fxMesa->fogTable);
fxTMClose(fxMesa);
fxFreeVB(fxMesa->glCtx);
}
@@ -986,7 +1119,7 @@ fxDDDestroyFxMesaContext(fxMesaContext fxMesa)
void
fxDDInitExtensions(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
/*_mesa_add_extension(ctx, GL_TRUE, "3DFX_set_global_palette", 0);*/
_mesa_enable_extension(ctx, "GL_EXT_point_parameters");
@@ -994,11 +1127,32 @@ fxDDInitExtensions(GLcontext * ctx)
_mesa_enable_extension(ctx, "GL_EXT_texture_lod_bias");
_mesa_enable_extension(ctx, "GL_EXT_shared_texture_palette");
- if (fxMesa->haveTwoTMUs)
+ if (fxMesa->haveTwoTMUs) {
_mesa_enable_extension(ctx, "GL_EXT_texture_env_add");
-
- if (fxMesa->haveTwoTMUs)
_mesa_enable_extension(ctx, "GL_ARB_multitexture");
+ }
+
+ if (fxMesa->haveHwStencil) {
+ _mesa_enable_extension( ctx, "GL_EXT_stencil_wrap" );
+ }
+
+#if 0 /* not ready yet */
+ /* banshee/avenger should enable this for NCC */
+ _mesa_enable_extension( ctx, "GL_ARB_texture_compression" );
+#endif
+ if (0/*IS_NAPALM*/) {
+ /* tex_compress: not ready yet */
+ _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" );
+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
+ /*_mesa_enable_extension( ctx, "GL_S3_s3tc" );*/
+
+ /* env_combine: not ready yet */
+ /*_mesa_enable_extension( ctx, "GL_EXT_texture_env_combine" );*/
+ }
+
+ if (fxMesa->HaveMirExt) {
+ _mesa_enable_extension(ctx, "GL_ARB_texture_mirrored_repeat");
+ }
}
@@ -1010,38 +1164,52 @@ fxDDInitExtensions(GLcontext * ctx)
*
* Performs similar work to fxDDChooseRenderState() - should be merged.
*/
-GLboolean
+GLuint
fx_check_IsInHardware(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (ctx->RenderMode != GL_RENDER)
- return GL_FALSE;
+ if (ctx->RenderMode != GL_RENDER) {
+ return FX_FALLBACK_RENDER_MODE;
+ }
- if (ctx->Stencil.Enabled ||
- (ctx->Color._DrawDestMask != FRONT_LEFT_BIT &&
- ctx->Color._DrawDestMask != BACK_LEFT_BIT) ||
- ((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)
+ if (ctx->Stencil.Enabled && !fxMesa->haveHwStencil) {
+ return FX_FALLBACK_STENCIL;
+ }
+
+ if (ctx->Color._DrawDestMask != FRONT_LEFT_BIT && ctx->Color._DrawDestMask != BACK_LEFT_BIT) {
+ return FX_FALLBACK_DRAW_BUFFER;
+ }
+
+ if (ctx->Color.BlendEnabled && (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT)) {
+ return FX_FALLBACK_BLEND;
+ }
+
+ if (ctx->Color.ColorLogicOpEnabled && (ctx->Color.LogicOp != GL_COPY)) {
+ return FX_FALLBACK_LOGICOP;
+ }
+
+ if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
+ return FX_FALLBACK_SPECULAR;
+ }
+
+ if ((ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP])
||
- (!((ctx->
- Color.ColorMask[RCOMP] == ctx->Color.ColorMask[GCOMP])
- && (ctx->Color.ColorMask[GCOMP] == ctx->Color.ColorMask[BCOMP])
- && (ctx->Color.ColorMask[ACOMP] == ctx->Color.ColorMask[ACOMP])))
+ (ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP])
+ ||
+ (ctx->Color.ColorMask[BCOMP] != ctx->Color.ColorMask[ACOMP])
) {
- return GL_FALSE;
+ return FX_FALLBACK_COLORMASK;
}
+
/* Unsupported texture/multitexture cases */
if (fxMesa->haveTwoTMUs) {
/* we can only do 2D textures */
if (ctx->Texture.Unit[0]._ReallyEnabled & ~TEXTURE_2D_BIT)
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_1D_3D;
if (ctx->Texture.Unit[1]._ReallyEnabled & ~TEXTURE_2D_BIT)
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_1D_3D;
if (ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) {
if (ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
@@ -1050,21 +1218,21 @@ fx_check_IsInHardware(GLcontext * ctx)
ctx->Texture.Unit[0].EnvColor[1] != 0 ||
ctx->Texture.Unit[0].EnvColor[2] != 0 ||
ctx->Texture.Unit[0].EnvColor[3] != 1)) {
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_ENV;
}
if (ctx->Texture.Unit[0]._Current->Image[0]->Border > 0)
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_BORDER;
}
if (ctx->Texture.Unit[1]._ReallyEnabled & TEXTURE_2D_BIT) {
if (ctx->Texture.Unit[1].EnvMode == GL_BLEND)
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_ENV;
if (ctx->Texture.Unit[1]._Current->Image[0]->Border > 0)
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_BORDER;
}
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxMesa: fxIsInHardware, envmode is %s/%s\n",
+ if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
+ fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
@@ -1078,96 +1246,51 @@ fx_check_IsInHardware(GLcontext * ctx)
* back to software.
*/
if (!fxMesa->haveTwoTMUs && ctx->Color.BlendEnabled) {
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_MULTI;
}
if ((ctx->Texture.Unit[0].EnvMode != ctx->Texture.Unit[1].EnvMode) &&
(ctx->Texture.Unit[0].EnvMode != GL_MODULATE) &&
(ctx->Texture.Unit[0].EnvMode != GL_REPLACE)) { /* q2, seems ok... */
- if (MESA_VERBOSE & VERBOSE_DRIVER)
- fprintf(stderr, "fxMesa: unsupported multitex env mode\n");
- return GL_FALSE;
+ if (TDFX_DEBUG & VERBOSE_DRIVER)
+ fprintf(stderr, "%s: unsupported multitex env mode\n", __FUNCTION__);
+ return FX_FALLBACK_TEXTURE_MULTI;
}
}
}
else {
/* we have just one texture unit */
if (ctx->Texture._EnabledUnits > 0x1) {
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_MULTI;
}
if ((ctx->Texture.Unit[0]._ReallyEnabled & TEXTURE_2D_BIT) &&
(ctx->Texture.Unit[0].EnvMode == GL_BLEND)) {
- return GL_FALSE;
+ return FX_FALLBACK_TEXTURE_ENV;
}
}
- return GL_TRUE;
+ return 0;
}
static void
-update_texture_scales(GLcontext * ctx)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
- struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
-
- if (t0 && t0->_Current && FX_TEXTURE_DATA(t0)) {
- fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
- fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
- fxMesa->inv_s0scale = 1.0 / fxMesa->s0scale;
- fxMesa->inv_t0scale = 1.0 / fxMesa->t0scale;
- }
-
- if (t1 && t1->_Current && FX_TEXTURE_DATA(t1)) {
- fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
- fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
- fxMesa->inv_s1scale = 1.0 / fxMesa->s1scale;
- fxMesa->inv_t1scale = 1.0 / fxMesa->t1scale;
- }
-}
-
-static void
fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
{
/* TNLcontext *tnl = TNL_CONTEXT(ctx);*/
fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxDDUpdateDDPointers(%08x)\n", new_state);
+ }
+
_swrast_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
- /* Recalculate fog table on projection matrix changes. This used to
- * be triggered by the NearFar callback.
- */
- if (new_state & _NEW_PROJECTION)
- fxMesa->new_state |= FX_NEW_FOG;
-
- if (new_state & (_FX_NEW_IS_IN_HARDWARE |
- _FX_NEW_RENDERSTATE |
- _FX_NEW_SETUP_FUNCTION |
- _NEW_TEXTURE)) {
-
- if (new_state & _FX_NEW_IS_IN_HARDWARE)
- fxCheckIsInHardware(ctx);
-
- if (fxMesa->new_state)
- fxSetupFXUnits(ctx);
-
- if (fxMesa->is_in_hardware) {
- if (new_state & _FX_NEW_RENDERSTATE)
- fxDDChooseRenderState(ctx);
-
- if (new_state & _FX_NEW_SETUP_FUNCTION)
- fxChooseVertexState(ctx);
- }
-
- if (new_state & _NEW_TEXTURE)
- update_texture_scales(ctx);
- }
+ fxMesa->new_gl_state |= new_state;
}
@@ -1176,10 +1299,11 @@ fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
void
fxSetupDDPointers(GLcontext * ctx)
{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupDDPointers()\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s()\n", __FUNCTION__);
}
ctx->Driver.UpdateState = fxDDUpdateDDPointers;
@@ -1193,8 +1317,6 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.Bitmap = fxDDDrawBitmap;
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
- {
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
switch (fxMesa->colDepth) {
case 15:
ctx->Driver.ReadPixels = fxDDReadPixels555;
@@ -1206,7 +1328,6 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.ReadPixels = fxDDReadPixels888;
break;
}
- }
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.Finish = fxDDFinish;
ctx->Driver.Flush = NULL;
@@ -1249,8 +1370,11 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.CullFace = fxDDCullFace;
ctx->Driver.ShadeModel = fxDDShadeModel;
ctx->Driver.Enable = fxDDEnable;
-
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
+ if (fxMesa->haveHwStencil) {
+ ctx->Driver.StencilFunc = fxDDStencilFunc;
+ ctx->Driver.StencilMask = fxDDStencilMask;
+ ctx->Driver.StencilOp = fxDDStencilOp;
+ }
fxSetupDDSpanPointers(ctx);
fxDDUpdateDDPointers(ctx, ~0);
diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c
index 6e847acce4..460126e86b 100644
--- a/src/mesa/drivers/glide/fxddspan.c
+++ b/src/mesa/drivers/glide/fxddspan.c
@@ -5,7 +5,7 @@
* Optimize and check endianess for `read_R8G8B8_pixels'
*/
-/* $Id: fxddspan.c,v 1.24 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxddspan.c,v 1.25 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -98,12 +98,12 @@ fxDDWriteRGBASpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint i;
GLint bottom = fxMesa->height - 1;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteRGBASpan(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
if (mask) {
@@ -140,13 +140,13 @@ fxDDWriteRGBSpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint i;
GLint bottom = fxMesa->height - 1;
GLubyte rgba[MAX_WIDTH][4];
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteRGBSpan()\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
if (mask) {
@@ -195,14 +195,14 @@ fxDDWriteMonoRGBASpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint i;
GLint bottom = fxMesa->height - 1;
GLuint data[MAX_WIDTH];
GrColor_t gColor = FXCOLOR4(color);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteMonoRGBASpan(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
if (mask) {
@@ -244,14 +244,13 @@ static void
fxDDReadRGBASpan(const GLcontext * ctx,
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLushort data[MAX_WIDTH];
GLuint i;
GLint bottom = fxMesa->height - 1;
- printf("read span %d, %d, %d\n", x, y, n);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDReadRGBASpan(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
assert(n < MAX_WIDTH);
@@ -277,7 +276,7 @@ static void
read_R5G6B5_span(const GLcontext * ctx,
GLuint n, GLint x, GLint y, GLubyte rgba[][4])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
@@ -327,7 +326,7 @@ static void read_R5G5B5_span (const GLcontext * ctx,
GLint x, GLint y,
GLubyte rgba[][4])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
@@ -375,7 +374,7 @@ static void read_R8G8B8_span (const GLcontext * ctx,
GLint x, GLint y,
GLubyte rgba[][4])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
BEGIN_BOARD_LOCK();
grLfbReadRegion(fxMesa->currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba);
END_BOARD_LOCK();
@@ -391,12 +390,12 @@ fxDDWriteRGBAPixels(const GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
CONST GLubyte rgba[][4], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint i;
GLint bottom = fxMesa->height - 1;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteRGBAPixels(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
for (i = 0; i < n; i++)
@@ -410,13 +409,13 @@ fxDDWriteMonoRGBAPixels(const GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
const GLchan color[4], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint i;
GLint bottom = fxMesa->height - 1;
GrColor_t gColor = FXCOLOR4(color);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
for (i = 0; i < n; i++)
@@ -431,7 +430,7 @@ 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;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
@@ -464,7 +463,7 @@ static void read_R5G5B5_pixels (const GLcontext * ctx,
GLubyte rgba[][4],
const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
@@ -496,7 +495,7 @@ read_R8G8B8_pixels(const GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrLfbInfo_t info;
BEGIN_BOARD_LOCK();
if (grLfbLock(GR_LFB_READ_ONLY,
@@ -530,11 +529,11 @@ fxDDWriteDepthSpan(GLcontext * ctx,
GLuint n, GLint x, GLint y, const GLdepth depth[],
const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteDepthSpan(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
@@ -565,12 +564,12 @@ fxDDWriteDepth32Span(GLcontext * ctx,
GLuint n, GLint x, GLint y, const GLdepth depth[],
const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
GLint i;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteDepth32Span(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
@@ -598,13 +597,13 @@ void
fxDDReadDepthSpan(GLcontext * ctx,
GLuint n, GLint x, GLint y, GLdepth depth[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
GLushort depth16[MAX_WIDTH];
GLuint i;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDReadDepthSpan(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth16);
@@ -618,11 +617,11 @@ void
fxDDReadDepth32Span(GLcontext * ctx,
GLuint n, GLint x, GLint y, GLdepth depth[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDReadDepth32Span(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
grLfbReadRegion(GR_BUFFER_AUXBUFFER, x, bottom - y, n, 1, 0, depth);
@@ -635,12 +634,12 @@ fxDDWriteDepthPixels(GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
GLuint i;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteDepthPixels(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
for (i = 0; i < n; i++) {
@@ -660,12 +659,12 @@ fxDDWriteDepth32Pixels(GLcontext * ctx,
GLuint n, const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
GLuint i;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDWriteDepth32Pixels(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
for (i = 0; i < n; i++) {
@@ -684,12 +683,12 @@ void
fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
const GLint x[], const GLint y[], GLdepth depth[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
GLuint i;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDReadDepthPixels(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
for (i = 0; i < n; i++) {
@@ -706,12 +705,12 @@ void
fxDDReadDepth32Pixels(GLcontext * ctx, GLuint n,
const GLint x[], const GLint y[], GLdepth depth[])
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
GLuint i;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDReadDepth32Pixels(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
for (i = 0; i < n; i++) {
@@ -728,11 +727,11 @@ fxDDReadDepth32Pixels(GLcontext * ctx, GLuint n,
static void
fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
(void) buffer;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) bufferBit);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%x)\n", __FUNCTION__, (int)bufferBit);
}
if (bufferBit == FRONT_LEFT_BIT) {
@@ -765,7 +764,7 @@ fxSetupDDSpanPointers(GLcontext * ctx)
/* swdd->ReadRGBASpan =fxDDReadRGBASpan; */
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
switch (fxMesa->colDepth) {
case 15:
swdd->ReadRGBASpan = read_R5G5B5_span;
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index a2c3aec8a5..38a268922a 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -1,4 +1,4 @@
-/* $Id: fxddtex.c,v 1.47 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxddtex.c,v 1.48 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -76,8 +76,6 @@ fxPrintTextureData(tfxTexInfo * ti)
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);
fprintf(stderr, "\t%s\n",
(ti->fixedPalette) ? "Fixed palette" : "Non fixed palette");
fprintf(stderr, "\t%s\n", (ti->validated) ? "Validated" : "Not validated");
@@ -91,7 +89,7 @@ fxPrintTextureData(tfxTexInfo * ti)
static void
fxTexInvalidate(GLcontext * ctx, struct gl_texture_object *tObj)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti;
ti = fxTMGetTexInfo(tObj);
@@ -108,7 +106,7 @@ fxAllocTexObjData(fxMesaContext fxMesa)
tfxTexInfo *ti;
if (!(ti = CALLOC(sizeof(tfxTexInfo)))) {
- fprintf(stderr, "fx Driver: out of memory !\n");
+ fprintf(stderr, "%s: ERROR: out of memory !\n", __FUNCTION__);
fxCloseHardware();
exit(-1);
}
@@ -136,11 +134,11 @@ fxAllocTexObjData(fxMesaContext fxMesa)
void
fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexBind(%d,%x)\n", tObj->Name,
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d, %x)\n", __FUNCTION__, tObj->Name,
(GLuint) tObj->DriverData);
}
@@ -163,13 +161,13 @@ void
fxDDTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
const GLfloat * param)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
if (param)
- fprintf(stderr, "fxmesa: texenv(%x,%x)\n", pname, (GLint) (*param));
+ fprintf(stderr, "%s(%x, %x)\n", __FUNCTION__, pname, (GLint) (*param));
else
- fprintf(stderr, "fxmesa: texenv(%x)\n", pname);
+ fprintf(stderr, "%s(%x)\n", __FUNCTION__, pname);
}
/* apply any lod biasing right now */
@@ -189,13 +187,13 @@ void
fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
GLenum pname, const GLfloat * params)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLenum param = (GLenum) (GLint) params[0];
tfxTexInfo *ti;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexParam(%d,%x,%x,%x)\n", tObj->Name,
- (GLuint) tObj->DriverData, pname, param);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d, %x, %x, %x)\n", __FUNCTION__,
+ tObj->Name, (GLuint) tObj->DriverData, pname, param);
}
if (target != GL_TEXTURE_2D)
@@ -220,16 +218,6 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
ti->LODblend = FXFALSE;
break;
- case GL_NEAREST_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
- ti->LODblend = FXFALSE;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- ti->mmMode = GR_MIPMAP_NEAREST;
- ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
- ti->LODblend = FXFALSE;
- break;
case GL_NEAREST_MIPMAP_LINEAR:
if (fxMesa->haveTwoTMUs) {
ti->mmMode = GR_MIPMAP_NEAREST;
@@ -240,8 +228,16 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
ti->LODblend = FXFALSE;
}
ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
+ break; /* ZZZ: we may have to fall through here for V3 */
+ case GL_NEAREST_MIPMAP_NEAREST:
+ ti->mmMode = GR_MIPMAP_NEAREST;
+ ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED;
+ ti->LODblend = FXFALSE;
break;
case GL_LINEAR_MIPMAP_LINEAR:
+ /* ZZZ: HACK ALERT! trilinear is bugged! mipmap blending produce
+ incorrect filtered colors for the smallest mipmap levels. */
+#if 0
if (fxMesa->haveTwoTMUs) {
ti->mmMode = GR_MIPMAP_NEAREST;
ti->LODblend = FXTRUE;
@@ -251,6 +247,12 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
ti->LODblend = FXFALSE;
}
ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
+ break; /* ZZZ: we may have to fall through here for V3 */
+#endif
+ case GL_LINEAR_MIPMAP_NEAREST:
+ ti->mmMode = GR_MIPMAP_NEAREST;
+ ti->minFilt = GR_TEXTUREFILTER_BILINEAR;
+ ti->LODblend = FXFALSE;
break;
default:
break;
@@ -274,6 +276,9 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
case GL_TEXTURE_WRAP_S:
switch (param) {
+ case GL_MIRRORED_REPEAT:
+ ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
+ break;
case GL_CLAMP:
ti->sClamp = GR_TEXTURECLAMP_CLAMP;
break;
@@ -288,6 +293,9 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
case GL_TEXTURE_WRAP_T:
switch (param) {
+ case GL_MIRRORED_REPEAT:
+ ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
+ break;
case GL_CLAMP:
ti->tClamp = GR_TEXTURECLAMP_CLAMP;
break;
@@ -328,8 +336,8 @@ fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexDel(%d,%p)\n", tObj->Name, (void *) ti);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d, %p)\n", __FUNCTION__, tObj->Name, (void *) ti);
}
if (!ti)
@@ -419,8 +427,8 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
if (tObj) {
/* per-texture palette */
tfxTexInfo *ti;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n",
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d, %x)\n", __FUNCTION__,
tObj->Name, (GLuint) tObj->DriverData);
}
if (!tObj->DriverData)
@@ -431,8 +439,8 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
}
else {
/* global texture palette */
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexPalette(global)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(global)\n", __FUNCTION__);
}
convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette);
fxMesa->new_state |= FX_NEW_TEXTURING;
@@ -445,8 +453,8 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDTexUseGlbPalette(%d)\n", state);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d)\n", __FUNCTION__, state);
}
if (state) {
@@ -492,261 +500,107 @@ 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,
float *sscale, float *tscale,
- int *i_sscale, int *i_tscale, int *wscale, int *hscale)
+ int *wscale, int *hscale)
{
/* [koolsmoky] */
- static GrLOD_t lod[12] = { GR_LOD_2048, GR_LOD_1024, GR_LOD_512, 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
+ static GrLOD_t lod[12] = {
+ GR_LOD_LOG2_1,
+ GR_LOD_LOG2_2,
+ GR_LOD_LOG2_4,
+ GR_LOD_LOG2_8,
+ GR_LOD_LOG2_16,
+ GR_LOD_LOG2_32,
+ GR_LOD_LOG2_64,
+ GR_LOD_LOG2_128,
+ GR_LOD_LOG2_256,
+ GR_LOD_LOG2_512,
+ GR_LOD_LOG2_1024,
+ GR_LOD_LOG2_2048
};
int logw, logh, ws, hs;
GrLOD_t l;
GrAspectRatio_t aspectratio;
float s, t;
- int is, it;
logw = logbase2(w);
logh = logbase2(h);
switch (logw - logh) {
case 0:
- aspectratio = GR_ASPECT_1x1;
- l = lod[11 - logw];
+ aspectratio = GR_ASPECT_LOG2_1x1;
+ l = lod[logw];
s = t = 256.0f;
- is = it = INT_TRICK(8);
ws = hs = 1;
break;
case 1:
- aspectratio = GR_ASPECT_2x1;
- l = lod[11 - logw];
+ aspectratio = GR_ASPECT_LOG2_2x1;
+ l = lod[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[11 - logw];
+ aspectratio = GR_ASPECT_LOG2_4x1;
+ l = lod[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[11 - logw];
+ aspectratio = GR_ASPECT_LOG2_8x1;
+ l = lod[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[11 - 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[11 - logw];
- s = 256.0f;
- t = 32.0f;
- is = INT_TRICK(8);
- it = INT_TRICK(5);
- ws = 1;
- hs = 4;
- break;
- case 6:
- aspectratio = GR_ASPECT_8x1;
- l = lod[11 - 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[11 - 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[11 - logw];
- s = 256.0f;
- t = 32.0f;
- is = INT_TRICK(8);
- it = INT_TRICK(5);
- ws = 1;
- hs = 32;
- break;
- case 9:
- aspectratio = GR_ASPECT_8x1;
- l = lod[11 - logw];
- s = 256.0f;
- t = 32.0f;
- is = INT_TRICK(8);
- it = INT_TRICK(5);
- ws = 1;
- hs = 64;
- break;
- case 10:
- aspectratio = GR_ASPECT_8x1;
- l = lod[11 - logw];
- s = 256.0f;
- t = 32.0f;
- is = INT_TRICK(8);
- it = INT_TRICK(5);
- ws = 1;
- hs = 128;
- break;
- case 11:
- aspectratio = GR_ASPECT_8x1;
- l = lod[11 - logw];
- s = 256.0f;
- t = 32.0f;
- is = INT_TRICK(8);
- it = INT_TRICK(5);
- ws = 1;
- hs = 256;
- break;
case -1:
- aspectratio = GR_ASPECT_1x2;
- l = lod[11 - logh];
+ aspectratio = GR_ASPECT_LOG2_1x2;
+ l = lod[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[11 - logh];
+ aspectratio = GR_ASPECT_LOG2_1x4;
+ l = lod[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[11 - logh];
+ aspectratio = GR_ASPECT_LOG2_1x8;
+ l = lod[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[11 - 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[11 - 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[11 - 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[11 - 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[11 - logh];
- s = 32.0f;
- t = 256.0f;
- is = INT_TRICK(5);
- it = INT_TRICK(8);
- ws = 32;
- hs = 1;
- break;
- case -9:
- aspectratio = GR_ASPECT_1x8;
- l = lod[11 - logh];
- s = 32.0f;
- t = 256.0f;
- is = INT_TRICK(5);
- it = INT_TRICK(8);
- ws = 64;
- hs = 1;
- break;
- case -10:
- aspectratio = GR_ASPECT_1x8;
- l = lod[11 - logh];
- s = 32.0f;
- t = 256.0f;
- is = INT_TRICK(5);
- it = INT_TRICK(8);
- ws = 128;
- hs = 1;
- break;
- case -11:
- aspectratio = GR_ASPECT_1x8;
- l = lod[11 - logh];
- s = 32.0f;
- t = 256.0f;
- is = INT_TRICK(5);
- it = INT_TRICK(8);
- ws = 256;
- hs = 1;
- break;
default:
- return 0;
- break;
+ if ((logw - logh) > 3) {
+ aspectratio = GR_ASPECT_LOG2_8x1;
+ l = lod[logw];
+ s = 256.0f;
+ t = 32.0f;
+ ws = 1;
+ hs = 1 << (logw - logh - 3);
+ } else /*if ((logw - logh) < -3)*/ {
+ aspectratio = GR_ASPECT_LOG2_1x8;
+ l = lod[logh];
+ s = 32.0f;
+ t = 256.0f;
+ ws = 1 << (logh - logw - 3);
+ hs = 1;
+ }
}
if (lodlevel)
@@ -767,12 +621,6 @@ fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar,
if (hscale)
(*hscale) = hs;
- if (i_sscale)
- *i_sscale = is;
-
- if (i_tscale)
- *i_tscale = it;
-
return 1;
}
@@ -785,6 +633,7 @@ void
fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint * ifmt) /* [koolsmoky] */
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GLboolean allow32bpt = fxMesa->HaveTexFmt;
switch (glformat) {
case 1:
@@ -845,19 +694,10 @@ fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
- if (fxMesa->colDepth == 32) {
- if (tfmt) (*tfmt) = GR_TEXFMT_ARGB_8888;
- } else {
- if (tfmt) (*tfmt) = GR_TEXFMT_RGB_565;
- }
- if (ifmt) (*ifmt) = GL_RGB;
-#else
if (tfmt)
- (*tfmt) = GR_TEXFMT_RGB_565;
+ (*tfmt) = allow32bpt ? GR_TEXFMT_ARGB_8888 : GR_TEXFMT_RGB_565;
if (ifmt)
(*ifmt) = GL_RGB;
-#endif
break;
case GL_RGBA2:
case GL_RGBA4:
@@ -872,20 +712,11 @@ fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
- if (fxMesa->colDepth == 32) {
- if (tfmt) (*tfmt) = GR_TEXFMT_ARGB_8888;
- } else {
- if (tfmt) (*tfmt) = GR_TEXFMT_ARGB_4444;
- }
- if (ifmt) (*ifmt) = GL_RGBA;
-#else
if (tfmt)
- (*tfmt) = GR_TEXFMT_ARGB_4444;
+ (*tfmt) = allow32bpt ? GR_TEXFMT_ARGB_8888 : GR_TEXFMT_ARGB_4444;
if (ifmt)
(*ifmt) = GL_RGBA;
-#endif
- break;
+ break;
case GL_RGB5_A1:
if (tfmt)
(*tfmt) = GR_TEXFMT_ARGB_1555;
@@ -905,9 +736,8 @@ fxTexGetFormat(GLcontext *ctx, GLenum glformat, GrTextureFormat_t * tfmt, GLint
(*ifmt) = GL_RGBA; /* XXX why is this RGBA? */
break;
default:
- fprintf(stderr,
- "fx Driver: unsupported internalFormat (0x%x) in fxTexGetFormat()\n",
- glformat);
+ fprintf(stderr, "%s: ERROR: unsupported internalFormat (0x%x)\n",
+ __FUNCTION__, glformat);
fxCloseHardware();
exit(-1);
break;
@@ -921,9 +751,8 @@ fxIsTexSupported(GLenum target, GLint internalFormat,
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 (!fxTexGetInfo(image->Width, image->Height, NULL, NULL, NULL, NULL, NULL, NULL))
+ return GL_FALSE;
if (image->Border > 0)
return GL_FALSE;
@@ -1051,9 +880,9 @@ fetch_r5g6b5(const struct gl_texture_image *texImage,
j = j * mml->hScale;
texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
- rgba[GCOMP] = (((*texel) >> 5) & 0x3f) * 255 / 63;
- rgba[BCOMP] = (((*texel) >> 0) & 0x1f) * 255 / 31;
+ rgba[RCOMP] = FX_rgb_scale_5[(*texel >> 11) & 0x1F];
+ rgba[GCOMP] = FX_rgb_scale_6[(*texel >> 5) & 0x3F];
+ rgba[BCOMP] = FX_rgb_scale_5[ *texel & 0x1F];
rgba[ACOMP] = 255;
}
@@ -1070,10 +899,10 @@ fetch_r4g4b4a4(const struct gl_texture_image *texImage,
j = j * mml->hScale;
texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 12) & 0xf) * 255 / 15;
- rgba[GCOMP] = (((*texel) >> 8) & 0xf) * 255 / 15;
- rgba[BCOMP] = (((*texel) >> 4) & 0xf) * 255 / 15;
- rgba[ACOMP] = (((*texel) >> 0) & 0xf) * 255 / 15;
+ rgba[RCOMP] = FX_rgb_scale_4[(*texel >> 12) & 0xF];
+ rgba[GCOMP] = FX_rgb_scale_4[(*texel >> 8) & 0xF];
+ rgba[BCOMP] = FX_rgb_scale_4[(*texel >> 4) & 0xF];
+ rgba[ACOMP] = FX_rgb_scale_4[ *texel & 0xF];
}
@@ -1089,14 +918,13 @@ fetch_r5g5b5a1(const struct gl_texture_image *texImage,
j = j * mml->hScale;
texel = ((GLushort *) texImage->Data) + j * mml->width + i;
- rgba[RCOMP] = (((*texel) >> 11) & 0x1f) * 255 / 31;
- rgba[GCOMP] = (((*texel) >> 6) & 0x1f) * 255 / 31;
- rgba[BCOMP] = (((*texel) >> 1) & 0x1f) * 255 / 31;
- rgba[ACOMP] = (((*texel) >> 0) & 0x01) * 255;
+ rgba[RCOMP] = FX_rgb_scale_5[(*texel >> 11) & 0x1F];
+ rgba[GCOMP] = FX_rgb_scale_5[(*texel >> 6) & 0x1F];
+ rgba[BCOMP] = FX_rgb_scale_5[(*texel >> 1) & 0x1F];
+ rgba[ACOMP] = ((*texel) & 0x01) * 255;
}
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
static void
fetch_a8r8g8b8(const struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, GLvoid * texelOut)
@@ -1110,11 +938,10 @@ fetch_a8r8g8b8(const struct gl_texture_image *texImage,
texel = ((GLuint *) texImage->Data) + j * mml->width + i;
rgba[RCOMP] = (((*texel) >> 16) & 0xff);
- rgba[GCOMP] = (((*texel) >> 8) & 0xff);
- rgba[BCOMP] = (((*texel)) & 0xff);
+ rgba[GCOMP] = (((*texel) >> 8) & 0xff);
+ rgba[BCOMP] = (((*texel) ) & 0xff);
rgba[ACOMP] = (((*texel) >> 24) & 0xff);
}
-#endif
static void
@@ -1124,12 +951,12 @@ PrintTexture(int w, int h, int c, const GLubyte * data)
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
if (c == 2)
- printf("%02x %02x ", data[0], data[1]);
+ fprintf(stderr, "%02x %02x ", data[0], data[1]);
else if (c == 3)
- printf("%02x %02x %02x ", data[0], data[1], data[2]);
+ fprintf(stderr, "%02x %02x %02x ", data[0], data[1], data[2]);
data += c;
}
- printf("\n");
+ fprintf(stderr, "\n");
}
}
@@ -1139,6 +966,11 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType )
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GLboolean allow32bpt = fxMesa->HaveTexFmt;
+
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxDDChooseTextureFormat(...)\n");
+ }
switch (internalFormat) {
case GL_INTENSITY:
@@ -1146,6 +978,7 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
+ case GL_COMPRESSED_INTENSITY:
return &_mesa_texformat_i8;
case 1:
case GL_LUMINANCE:
@@ -1153,12 +986,14 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE8:
case GL_LUMINANCE12:
case GL_LUMINANCE16:
+ case GL_COMPRESSED_LUMINANCE:
return &_mesa_texformat_l8;
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA8:
case GL_ALPHA12:
case GL_ALPHA16:
+ case GL_COMPRESSED_ALPHA:
return &_mesa_texformat_a8;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
@@ -1176,6 +1011,7 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
return &_mesa_texformat_al88;
case GL_R3_G3_B2:
case GL_RGB4:
@@ -1183,33 +1019,57 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
return &_mesa_texformat_rgb565;
case 3:
case GL_RGB:
+ case GL_COMPRESSED_RGB:
+ if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) {
+ return &_mesa_texformat_rgb565;
+ }
+ /* intentional fall through */
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
- return (fxMesa->colDepth == 32) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_rgb565;
-#else
- return &_mesa_texformat_rgb565;
-#endif
+ return (allow32bpt) ? &_mesa_texformat_argb8888
+ : &_mesa_texformat_rgb565;
case GL_RGBA2:
case GL_RGBA4:
return &_mesa_texformat_argb4444;
case 4:
case GL_RGBA:
+ case GL_COMPRESSED_RGBA:
+ if ( srcFormat == GL_BGRA ) {
+ if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) {
+ return &_mesa_texformat_argb8888;
+ }
+ else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) {
+ return &_mesa_texformat_argb4444;
+ }
+ else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) {
+ return &_mesa_texformat_argb1555;
+ }
+ }
+ /* intentional fall through */
case GL_RGBA8:
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
- return (fxMesa->colDepth == 32) ? &_mesa_texformat_argb8888
- : &_mesa_texformat_argb4444;
-#else
- return &_mesa_texformat_argb4444;
-#endif
+ return (allow32bpt) ? &_mesa_texformat_argb8888
+ : &_mesa_texformat_argb4444;
case GL_RGB5_A1:
return &_mesa_texformat_argb1555;
+#if 0
+ /* GL_EXT_texture_compression_s3tc */
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgb_dxt1;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgba_dxt1;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ return &_mesa_texformat_rgba_dxt3;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ return &_mesa_texformat_rgba_dxt5;
+ /*case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ return blah;*/
+#endif
default:
_mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat");
return NULL;
@@ -1237,10 +1097,23 @@ fxGlideFormat(GLint mesaFormat)
return GR_TEXFMT_ARGB_4444;
case MESA_FORMAT_ARGB1555:
return GR_TEXFMT_ARGB_1555;
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
+#if 1 /* [koolsmoky] getting ready for 32bpp textures */
case MESA_FORMAT_ARGB8888:
return GR_TEXFMT_ARGB_8888;
#endif
+#if 0
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
+ return GR_TEXFMT_ARGB_CMP_DXT1;
+ case MESA_FORMAT_RGBA_DXT3:
+ return GR_TEXFMT_ARGB_CMP_DXT3;
+ case MESA_FORMAT_RGBA_DXT5:
+ return GR_TEXFMT_ARGB_CMP_DXT5;
+ /*case MESA_FORMAT_ARGB_CMP_FXT1:
+ return GR_TEXFMT_ARGB_CMP_FXT1;
+ case MESA_FORMAT_RGB_CMP_FXT1:
+ return GL_COMPRESSED_RGBA_FXT1_3DFX;*/
+#endif
default:
_mesa_problem(NULL, "Unexpected format in fxGlideFormat");
return 0;
@@ -1268,12 +1141,19 @@ fxFetchFunction(GLint mesaFormat)
return fetch_r4g4b4a4;
case MESA_FORMAT_ARGB1555:
return fetch_r5g5b5a1;
-#if 0 /* [koolsmoky] getting ready for 32bpp textures */
+#if 1 /* [koolsmoky] getting ready for 32bpp textures */
case MESA_FORMAT_ARGB8888:
return fetch_a8r8g8b8;
#endif
+#if 0
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
+ case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_RGBA_DXT5:
+ return fetch_r4g4b4a4;
+#endif
default:
- _mesa_problem(NULL, "Unexpected format in fxGlideFormat");
+ _mesa_problem(NULL, "Unexpected format in fxFetchFunction");
return NULL;
}
}
@@ -1286,11 +1166,17 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti;
tfxMipMapLevel *mml;
GLint texelBytes;
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxDDTexImage2D: id=%d int 0x%x format 0x%x type 0x%x %dx%d\n",
+ texObj->Name, texImage->IntFormat, format, type,
+ texImage->Width, texImage->Height);
+ }
+
if (!fxIsTexSupported(target, internalFormat, texImage)) {
_mesa_problem(NULL, "fx Driver: unsupported texture in fxDDTexImg()\n");
return;
@@ -1306,7 +1192,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
ti = fxTMGetTexInfo(texObj);
if (!texImage->DriverData) {
- texImage->DriverData = MALLOC(sizeof(tfxMipMapLevel));
+ texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel));
if (!texImage->DriverData) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
return;
@@ -1315,7 +1201,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
mml = FX_MIPMAP_DATA(texImage);
fxTexGetInfo(width, height, NULL, NULL, NULL, NULL,
- NULL, NULL, &mml->wScale, &mml->hScale);
+ &mml->wScale, &mml->hScale);
mml->width = width * mml->wScale;
mml->height = height * mml->hScale;
@@ -1327,7 +1213,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
internalFormat, format, type);
assert(texImage->TexFormat);
texelBytes = texImage->TexFormat->TexelBytes;
- assert(texelBytes == 1 || texelBytes == 2);
+ /*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/
if (mml->wScale != 1 || mml->hScale != 1) {
/* rescale image to overcome 1:8 aspect limitation */
@@ -1346,7 +1232,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
0, /* dstImageStride */
format, type, pixels, packing);
assert(!texImage->Data);
- texImage->Data = MALLOC(mml->width * mml->height * texelBytes);
+ texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
FREE(tempImage);
@@ -1362,7 +1248,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
else {
/* no rescaling needed */
assert(!texImage->Data);
- texImage->Data = MALLOC(mml->width * mml->height * texelBytes);
+ texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
return;
@@ -1377,16 +1263,18 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
}
mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat);
+ ti->info.format = mml->glideFormat;
texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat);
- fxTexInvalidate(ctx, texObj);
-
- if (ti->validated && ti->isInTM) {
- /*printf("reloadmipmaplevels\n"); */
+ /* [dBorca]
+ * Hack alert: unsure...
+ */
+ if (!(fxMesa->new_state & FX_NEW_TEXTURING) && ti->validated && ti->isInTM) {
+ /*fprintf(stderr, "reloadmipmaplevels\n"); */
fxTMReloadMipMapLevel(fxMesa, texObj, level);
}
else {
- /*printf("invalidate2\n"); */
+ /*fprintf(stderr, "invalidate2\n"); */
fxTexInvalidate(ctx, texObj);
}
}
@@ -1401,11 +1289,15 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti;
tfxMipMapLevel *mml;
GLint texelBytes;
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxDDTexSubImage2D: id=%d\n", texObj->Name);
+ }
+
if (!texObj->DriverData) {
_mesa_problem(ctx, "problem in fxDDTexSubImage2D");
return;
@@ -1425,7 +1317,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
/* need to rescale subimage to match mipmap level's rescale factors */
const GLint newWidth = width * mml->wScale;
const GLint newHeight = height * mml->hScale;
- GLvoid *scaledImage, *tempImage;
+ GLvoid *tempImage;
GLubyte *destAddr;
tempImage = MALLOC(width * height * texelBytes);
if (!tempImage) {
@@ -1443,13 +1335,6 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
format, type, pixels, packing);
/* now rescale */
- scaledImage = MALLOC(newWidth * newHeight * texelBytes);
- if (!scaledImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D");
- FREE(tempImage);
- return;
- }
-
/* compute address of dest subimage within the overal tex image */
destAddr = (GLubyte *) texImage->Data
+ (yoffset * mml->hScale * mml->width
@@ -1462,7 +1347,6 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
tempImage, destAddr);
FREE(tempImage);
- FREE(scaledImage);
}
else {
/* no rescaling needed */
@@ -1476,7 +1360,10 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
format, type, pixels, packing);
}
- if (ti->validated && ti->isInTM)
+ /* [dBorca]
+ * Hack alert: unsure...
+ */
+ if (!(fxMesa->new_state & FX_NEW_TEXTURING) && ti->validated && ti->isInTM)
fxTMReloadMipMapLevel(fxMesa, texObj, level);
else
fxTexInvalidate(ctx, texObj);
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 271cd85dfe..b404d52fa6 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -1,4 +1,4 @@
-/* $Id: fxdrv.h,v 1.58 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxdrv.h,v 1.59 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -69,25 +69,12 @@
#define ZCOORD GR_VERTEX_OOZ_OFFSET
#define OOWCOORD GR_VERTEX_OOW_OFFSET
-#define RCOORD GR_VERTEX_R_OFFSET
-#define GCOORD GR_VERTEX_G_OFFSET
-#define BCOORD GR_VERTEX_B_OFFSET
-#define ACOORD GR_VERTEX_A_OFFSET
-
#define S0COORD GR_VERTEX_SOW_TMU0_OFFSET
#define T0COORD GR_VERTEX_TOW_TMU0_OFFSET
#define S1COORD GR_VERTEX_SOW_TMU1_OFFSET
#define T1COORD GR_VERTEX_TOW_TMU1_OFFSET
-extern float gl_ubyte_to_float_255_color_tab[256];
-#define UBYTE_COLOR_TO_FLOAT_255_COLOR(c) gl_ubyte_to_float_255_color_tab[c]
-#define UBYTE_COLOR_TO_FLOAT_255_COLOR2(f,c) \
- (*(int *)&(f)) = ((int *)gl_ubyte_to_float_255_color_tab)[c]
-
-
-
-
#ifdef __i386__
#define FXCOLOR4( c ) (* (int *)c)
@@ -208,10 +195,6 @@ typedef struct tfxTexInfo_t
GrMipMapMode_t mmMode;
GLfloat sScale, tScale;
- GLint int_sScale, int_tScale; /* x86 floating point trick for
- * multiplication by powers of 2.
- * Used in fxfasttmp.h
- */
GuTexPalette palette;
@@ -252,6 +235,19 @@ typedef struct
GLboolean depthTestEnabled;
GLboolean depthMask;
GrCmpFnc_t depthTestFunc;
+ FxI32 depthBias;
+
+ /* Stencil */
+
+ GLboolean stencilEnabled;
+ GrCmpFnc_t stencilFunction; /* Stencil function */
+ GrStencil_t stencilRefValue; /* Stencil reference value */
+ GrStencil_t stencilValueMask; /* Value mask */
+ GrStencil_t stencilWriteMask; /* Write mask */
+ GrCmpFnc_t stencilFailFunc; /* Stencil fail function */
+ GrCmpFnc_t stencilZFailFunc; /* Stencil pass, depth fail function */
+ GrCmpFnc_t stencilZPassFunc; /* Stencil pass, depth pass function */
+ GrStencil_t stencilClear; /* Buffer clear value */
}
tfxUnitsState;
@@ -268,6 +264,7 @@ tfxUnitsState;
#define FX_NEW_SCISSOR 0x20
#define FX_NEW_COLOR_MASK 0x40
#define FX_NEW_CULL 0x80
+#define FX_NEW_STENCIL 0x100
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
@@ -327,8 +324,10 @@ extern GLubyte FX_PixelToR[0x10000];
extern GLubyte FX_PixelToG[0x10000];
extern GLubyte FX_PixelToB[0x10000];
-/* lookup table for scaling 5 bit colors up to 8 bits */
-GLuint FX_rgb_scale_5[32];
+/* lookup table for scaling y bit colors up to 8 bits */
+extern GLuint FX_rgb_scale_4[16];
+extern GLuint FX_rgb_scale_5[32];
+extern GLuint FX_rgb_scale_6[64];
typedef void (*fx_tri_func) (fxMesaContext, GrVertex *, GrVertex *, GrVertex *);
typedef void (*fx_line_func) (fxMesaContext, GrVertex *, GrVertex *);
@@ -359,6 +358,7 @@ struct tfxMesaContext
GLuint new_state;
+ GLuint new_gl_state;
/* Texture Memory Manager Data
*/
@@ -387,7 +387,7 @@ struct tfxMesaContext
/* Rasterization:
*/
GLuint render_index;
- GLuint is_in_hardware;
+ GLuint fallback;
GLenum render_primitive;
GLenum raster_primitive;
@@ -419,7 +419,8 @@ struct tfxMesaContext
GLboolean verbose;
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
- GLboolean haveAlphaBuffer;
+ GLboolean haveHwAlpha;
+ GLboolean haveHwStencil;
GLboolean haveZBuffer;
GLboolean haveDoubleBuffer;
GLboolean haveGlobalPaletteTexture;
@@ -430,19 +431,27 @@ struct tfxMesaContext
int screen_width;
int screen_height;
- int initDone;
int clipMinX;
int clipMaxX;
int clipMinY;
int clipMaxY;
int colDepth;
- int maxTextureSize; /* [koolsmoky] */
-};
+ GLboolean fsaa;
+ /* Glide (per card) capabilities. These get mirrored
+ * from `glbHWConfig' when creating a new context...
+ */
+ GrSstType type;
+ FxBool HavePixExt; /* PIXEXT */
+ FxBool HaveTexFmt; /* TEXFMT */
+ FxBool HaveCmbExt; /* COMBINE */
+ FxBool HaveMirExt; /* TEXMIRROR */
+ FxBool HaveTexus2; /* Texus 2 - FXT1 */
+ struct tdfx_glide Glide;
+ char rendererString[100];
+};
-extern GrHwConfiguration glbHWConfig;
-extern int glbCurrentBoard;
extern void fxSetupFXUnits(GLcontext *);
extern void fxSetupDDPointers(GLcontext *);
@@ -505,6 +514,9 @@ extern void fxDDAlphaFunc(GLcontext *, GLenum, GLfloat);
extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum);
extern void fxDDDepthMask(GLcontext *, GLboolean);
extern void fxDDDepthFunc(GLcontext *, GLenum);
+extern void fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask);
+extern void fxDDStencilMask (GLcontext *ctx, GLuint mask);
+extern void fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass);
extern void fxDDInitExtensions(GLcontext * ctx);
@@ -524,7 +536,7 @@ extern void fxTMReloadSubMipMapLevel(fxMesaContext,
extern void fxTexGetFormat(GLcontext *, GLenum, GrTextureFormat_t *, GLint *); /* [koolsmoky] */
extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
- float *, float *, int *, int *, int *, int *);
+ float *, float *, int *, int *);
extern void fxDDScissor(GLcontext * ctx,
GLint x, GLint y, GLsizei w, GLsizei h);
@@ -558,6 +570,7 @@ extern int fxDDInitFxMesaContext(fxMesaContext fxMesa);
extern void fxDDDestroyFxMesaContext(fxMesaContext fxMesa);
+void fxColorMask (fxMesaContext fxMesa, GLboolean enable);
extern void fxSetScissorValues(GLcontext * ctx);
@@ -567,6 +580,19 @@ extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
extern void fxCheckIsInHardware(GLcontext *ctx);
-extern GLboolean fx_check_IsInHardware(GLcontext *ctx);
+/* Flags for software fallback cases */
+#define FX_FALLBACK_TEXTURE_1D_3D 0x0001
+#define FX_FALLBACK_DRAW_BUFFER 0x0002
+#define FX_FALLBACK_SPECULAR 0x0004
+#define FX_FALLBACK_STENCIL 0x0008
+#define FX_FALLBACK_RENDER_MODE 0x0010
+#define FX_FALLBACK_LOGICOP 0x0020
+#define FX_FALLBACK_TEXTURE_ENV 0x0040
+#define FX_FALLBACK_TEXTURE_BORDER 0x0080
+#define FX_FALLBACK_COLORMASK 0x0100
+#define FX_FALLBACK_BLEND 0x0200
+#define FX_FALLBACK_TEXTURE_MULTI 0x0400
+
+extern GLuint fx_check_IsInHardware(GLcontext *ctx);
#endif
diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c
new file mode 100644
index 0000000000..3d00e080b1
--- /dev/null
+++ b/src/mesa/drivers/glide/fxg.c
@@ -0,0 +1,2135 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.0.1
+ *
+ * Copyright (C) 1999-2003 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.
+ */
+
+/*
+ * Mesa/FX device driver. Interface to Glide3.
+ *
+ * Copyright (c) 2003 - Daniel Borca
+ * Email : dborca@users.sourceforge.net
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#define DEBUG_TRAP_internal
+#include "fxg.h"
+
+
+
+/****************************************************************************\
+* logging *
+\****************************************************************************/
+#if DEBUG_TRAP
+#define TRAP_LOG trap_printf
+#ifdef __GNUC__
+__attribute__ ((format(printf, 1, 2)))
+#endif /* __GNUC__ */
+int trap_printf (const char *format, ...)
+{
+ va_list arg;
+ int n;
+ FILE *trap_file;
+ va_start(arg, format);
+ trap_file = fopen("trap.log", "a");
+ if (trap_file == NULL) {
+ trap_file = stderr;
+ }
+ n = vfprintf(trap_file, format, arg);
+ fclose(trap_file);
+ va_end(arg);
+ return n;
+}
+#else /* DEBUG_TRAP */
+#ifdef __GNUC__
+#define TRAP_LOG(format, ...) do {} while (0)
+#else /* __GNUC__ */
+#define TRAP_LOG 0 && (unsigned long)
+#endif /* __GNUC__ */
+#endif /* DEBUG_TRAP */
+
+
+
+#if DEBUG_TRAP
+/****************************************************************************\
+* helpers *
+\****************************************************************************/
+
+#define GOT "\t"
+
+const char *TRP_BOOL (FxBool b)
+{
+ return b ? "FXTRUE" : "FXFALSE";
+}
+
+#define TRAP_CASE_STRING(name) case name: return #name
+#define TRAP_NODEFAULT default: assert(0)
+
+const char *TRP_PARAM (FxU32 mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_PARAM_DISABLE);
+ TRAP_CASE_STRING(GR_PARAM_ENABLE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_VTX (FxU32 param)
+{
+ switch (param) {
+ TRAP_CASE_STRING(GR_PARAM_XY);
+ TRAP_CASE_STRING(GR_PARAM_Z);
+ TRAP_CASE_STRING(GR_PARAM_W);
+ TRAP_CASE_STRING(GR_PARAM_Q);
+ TRAP_CASE_STRING(GR_PARAM_FOG_EXT);
+ TRAP_CASE_STRING(GR_PARAM_A);
+ TRAP_CASE_STRING(GR_PARAM_RGB);
+ TRAP_CASE_STRING(GR_PARAM_PARGB);
+ TRAP_CASE_STRING(GR_PARAM_ST0);
+ TRAP_CASE_STRING(GR_PARAM_ST1);
+ TRAP_CASE_STRING(GR_PARAM_ST2);
+ TRAP_CASE_STRING(GR_PARAM_Q0);
+ TRAP_CASE_STRING(GR_PARAM_Q1);
+ TRAP_CASE_STRING(GR_PARAM_Q2);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_ARRAY (FxU32 mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_POINTS);
+ TRAP_CASE_STRING(GR_LINE_STRIP);
+ TRAP_CASE_STRING(GR_LINES);
+ TRAP_CASE_STRING(GR_POLYGON);
+ TRAP_CASE_STRING(GR_TRIANGLE_STRIP);
+ TRAP_CASE_STRING(GR_TRIANGLE_FAN);
+ TRAP_CASE_STRING(GR_TRIANGLES);
+ TRAP_CASE_STRING(GR_TRIANGLE_STRIP_CONTINUE);
+ TRAP_CASE_STRING(GR_TRIANGLE_FAN_CONTINUE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_BUFFER (GrBuffer_t buffer)
+{
+ switch (buffer) {
+ TRAP_CASE_STRING(GR_BUFFER_FRONTBUFFER);
+ TRAP_CASE_STRING(GR_BUFFER_BACKBUFFER);
+ TRAP_CASE_STRING(GR_BUFFER_AUXBUFFER);
+ TRAP_CASE_STRING(GR_BUFFER_DEPTHBUFFER);
+ TRAP_CASE_STRING(GR_BUFFER_ALPHABUFFER);
+ TRAP_CASE_STRING(GR_BUFFER_TRIPLEBUFFER);
+ TRAP_CASE_STRING(GR_BUFFER_TEXTUREBUFFER_EXT);
+ TRAP_CASE_STRING(GR_BUFFER_TEXTUREAUXBUFFER_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_ORIGIN (GrOriginLocation_t origin_location)
+{
+ switch (origin_location) {
+ TRAP_CASE_STRING(GR_ORIGIN_UPPER_LEFT);
+ TRAP_CASE_STRING(GR_ORIGIN_LOWER_LEFT);
+ TRAP_CASE_STRING(GR_ORIGIN_ANY);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_REFRESH (GrScreenRefresh_t refresh_rate)
+{
+ switch (refresh_rate) {
+ TRAP_CASE_STRING(GR_REFRESH_60Hz);
+ TRAP_CASE_STRING(GR_REFRESH_70Hz);
+ TRAP_CASE_STRING(GR_REFRESH_72Hz);
+ TRAP_CASE_STRING(GR_REFRESH_75Hz);
+ TRAP_CASE_STRING(GR_REFRESH_80Hz);
+ TRAP_CASE_STRING(GR_REFRESH_90Hz);
+ TRAP_CASE_STRING(GR_REFRESH_100Hz);
+ TRAP_CASE_STRING(GR_REFRESH_85Hz);
+ TRAP_CASE_STRING(GR_REFRESH_120Hz);
+ TRAP_CASE_STRING(GR_REFRESH_NONE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_COLFMT (GrColorFormat_t color_format)
+{
+ switch (color_format) {
+ TRAP_CASE_STRING(GR_COLORFORMAT_ARGB);
+ TRAP_CASE_STRING(GR_COLORFORMAT_ABGR);
+ TRAP_CASE_STRING(GR_COLORFORMAT_RGBA);
+ TRAP_CASE_STRING(GR_COLORFORMAT_BGRA);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_RESOLUTION (GrScreenResolution_t screen_resolution)
+{
+ switch (screen_resolution) {
+ TRAP_CASE_STRING(GR_RESOLUTION_320x200);
+ TRAP_CASE_STRING(GR_RESOLUTION_320x240);
+ TRAP_CASE_STRING(GR_RESOLUTION_400x256);
+ TRAP_CASE_STRING(GR_RESOLUTION_512x384);
+ TRAP_CASE_STRING(GR_RESOLUTION_640x200);
+ TRAP_CASE_STRING(GR_RESOLUTION_640x350);
+ TRAP_CASE_STRING(GR_RESOLUTION_640x400);
+ TRAP_CASE_STRING(GR_RESOLUTION_640x480);
+ TRAP_CASE_STRING(GR_RESOLUTION_800x600);
+ TRAP_CASE_STRING(GR_RESOLUTION_960x720);
+ TRAP_CASE_STRING(GR_RESOLUTION_856x480);
+ TRAP_CASE_STRING(GR_RESOLUTION_512x256);
+ TRAP_CASE_STRING(GR_RESOLUTION_1024x768);
+ TRAP_CASE_STRING(GR_RESOLUTION_1280x1024);
+ TRAP_CASE_STRING(GR_RESOLUTION_1600x1200);
+ TRAP_CASE_STRING(GR_RESOLUTION_400x300);
+ TRAP_CASE_STRING(GR_RESOLUTION_1152x864);
+ TRAP_CASE_STRING(GR_RESOLUTION_1280x960);
+ TRAP_CASE_STRING(GR_RESOLUTION_1600x1024);
+ TRAP_CASE_STRING(GR_RESOLUTION_1792x1344);
+ TRAP_CASE_STRING(GR_RESOLUTION_1856x1392);
+ TRAP_CASE_STRING(GR_RESOLUTION_1920x1440);
+ TRAP_CASE_STRING(GR_RESOLUTION_2048x1536);
+ TRAP_CASE_STRING(GR_RESOLUTION_2048x2048);
+ TRAP_CASE_STRING(GR_RESOLUTION_NONE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_BLEND (GrAlphaBlendFnc_t func)
+{
+ switch (func) {
+ TRAP_CASE_STRING(GR_BLEND_ZERO);
+ TRAP_CASE_STRING(GR_BLEND_SRC_ALPHA);
+ TRAP_CASE_STRING(GR_BLEND_SRC_COLOR);
+ /*TRAP_CASE_STRING(GR_BLEND_DST_COLOR); ==GR_BLEND_SRC_COLOR*/
+ TRAP_CASE_STRING(GR_BLEND_DST_ALPHA);
+ TRAP_CASE_STRING(GR_BLEND_ONE);
+ TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SRC_COLOR);
+ /*TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_DST_COLOR); ==GR_BLEND_ONE_MINUS_SRC_COLOR*/
+ TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_DST_ALPHA);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_8);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_9);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_A);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_B);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_C);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_D);
+ TRAP_CASE_STRING(GR_BLEND_RESERVED_E);
+ TRAP_CASE_STRING(GR_BLEND_ALPHA_SATURATE);
+ /*TRAP_CASE_STRING(GR_BLEND_PREFOG_COLOR); ==GR_BLEND_ALPHA_SATURATE*/
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CMBFUNC (GrCombineFunction_t cfunc)
+{
+ switch (cfunc) {
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_ZERO);
+ /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_NONE); ==GR_COMBINE_FUNCTION_ZERO*/
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_LOCAL);
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_LOCAL_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER);
+ /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_BLEND_OTHER); ==GR_COMBINE_FUNCTION_SCALE_OTHER*/
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL);
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL);
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL);
+ /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_BLEND); ==GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL*/
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL);
+ /*TRAP_CASE_STRING(GR_COMBINE_FUNCTION_BLEND_LOCAL); ==GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL*/
+ TRAP_CASE_STRING(GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CMBFACT (GrCombineFactor_t cfactor)
+{
+ switch (cfactor) {
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ZERO);
+ /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_NONE); ==GR_COMBINE_FACTOR_ZERO*/
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_LOCAL);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_OTHER_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_LOCAL_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_TEXTURE_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_TEXTURE_RGB);
+ /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_DETAIL_FACTOR); ==GR_COMBINE_FACTOR_TEXTURE_ALPHA*/
+ /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_LOD_FRACTION); ==GR_COMBINE_FACTOR_TEXTURE_RGB ???*/
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_LOCAL);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA);
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA);
+ /*TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR); ==GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA*/
+ TRAP_CASE_STRING(GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CMBLOCAL (GrCombineLocal_t clocal)
+{
+ switch (clocal) {
+ TRAP_CASE_STRING(GR_COMBINE_LOCAL_ITERATED);
+ TRAP_CASE_STRING(GR_COMBINE_LOCAL_CONSTANT);
+ /*TRAP_CASE_STRING(GR_COMBINE_LOCAL_NONE); ==GR_COMBINE_LOCAL_CONSTANT*/
+ TRAP_CASE_STRING(GR_COMBINE_LOCAL_DEPTH);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CMBOTHER (GrCombineOther_t cother)
+{
+ switch (cother) {
+ TRAP_CASE_STRING(GR_COMBINE_OTHER_ITERATED);
+ TRAP_CASE_STRING(GR_COMBINE_OTHER_TEXTURE);
+ TRAP_CASE_STRING(GR_COMBINE_OTHER_CONSTANT);
+ /*TRAP_CASE_STRING(GR_COMBINE_OTHER_NONE); ==GR_COMBINE_OTHER_CONSTANT*/
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CMPFUNC (GrCmpFnc_t function)
+{
+ switch (function) {
+ TRAP_CASE_STRING(GR_CMP_NEVER);
+ TRAP_CASE_STRING(GR_CMP_LESS);
+ TRAP_CASE_STRING(GR_CMP_EQUAL);
+ TRAP_CASE_STRING(GR_CMP_LEQUAL);
+ TRAP_CASE_STRING(GR_CMP_GREATER);
+ TRAP_CASE_STRING(GR_CMP_NOTEQUAL);
+ TRAP_CASE_STRING(GR_CMP_GEQUAL);
+ TRAP_CASE_STRING(GR_CMP_ALWAYS);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CKMODE (GrChromakeyMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_CHROMAKEY_DISABLE);
+ TRAP_CASE_STRING(GR_CHROMAKEY_ENABLE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CULLMODE (GrCullMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_CULL_DISABLE);
+ TRAP_CASE_STRING(GR_CULL_NEGATIVE);
+ TRAP_CASE_STRING(GR_CULL_POSITIVE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_DEPTHMODE (GrDepthBufferMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_DEPTHBUFFER_DISABLE);
+ TRAP_CASE_STRING(GR_DEPTHBUFFER_ZBUFFER);
+ TRAP_CASE_STRING(GR_DEPTHBUFFER_WBUFFER);
+ TRAP_CASE_STRING(GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS);
+ TRAP_CASE_STRING(GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_DITHERMODE (GrDitherMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_DITHER_DISABLE);
+ TRAP_CASE_STRING(GR_DITHER_2x2);
+ TRAP_CASE_STRING(GR_DITHER_4x4);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_FOGMODE (GrFogMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_FOG_DISABLE);
+ TRAP_CASE_STRING(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT);
+ TRAP_CASE_STRING(GR_FOG_WITH_TABLE_ON_Q);
+ /*TRAP_CASE_STRING(GR_FOG_WITH_TABLE_ON_W); ==GR_FOG_WITH_TABLE_ON_Q*/
+ TRAP_CASE_STRING(GR_FOG_WITH_ITERATED_Z);
+ TRAP_CASE_STRING(GR_FOG_WITH_ITERATED_ALPHA_EXT);
+ TRAP_CASE_STRING(GR_FOG_MULT2);
+ TRAP_CASE_STRING(GR_FOG_ADD2);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_GETNAME (FxU32 pname)
+{
+ switch (pname) {
+ TRAP_CASE_STRING(GR_BITS_DEPTH);
+ TRAP_CASE_STRING(GR_BITS_RGBA);
+ TRAP_CASE_STRING(GR_FIFO_FULLNESS);
+ TRAP_CASE_STRING(GR_FOG_TABLE_ENTRIES);
+ TRAP_CASE_STRING(GR_GAMMA_TABLE_ENTRIES);
+ TRAP_CASE_STRING(GR_GLIDE_STATE_SIZE);
+ TRAP_CASE_STRING(GR_GLIDE_VERTEXLAYOUT_SIZE);
+ TRAP_CASE_STRING(GR_IS_BUSY);
+ TRAP_CASE_STRING(GR_LFB_PIXEL_PIPE);
+ TRAP_CASE_STRING(GR_MAX_TEXTURE_SIZE);
+ TRAP_CASE_STRING(GR_MAX_TEXTURE_ASPECT_RATIO);
+ TRAP_CASE_STRING(GR_MEMORY_FB);
+ TRAP_CASE_STRING(GR_MEMORY_TMU);
+ TRAP_CASE_STRING(GR_MEMORY_UMA);
+ TRAP_CASE_STRING(GR_NUM_BOARDS);
+ TRAP_CASE_STRING(GR_NON_POWER_OF_TWO_TEXTURES);
+ TRAP_CASE_STRING(GR_NUM_FB);
+ TRAP_CASE_STRING(GR_NUM_SWAP_HISTORY_BUFFER);
+ TRAP_CASE_STRING(GR_NUM_TMU);
+ TRAP_CASE_STRING(GR_PENDING_BUFFERSWAPS);
+ TRAP_CASE_STRING(GR_REVISION_FB);
+ TRAP_CASE_STRING(GR_REVISION_TMU);
+ TRAP_CASE_STRING(GR_STATS_LINES);
+ TRAP_CASE_STRING(GR_STATS_PIXELS_AFUNC_FAIL);
+ TRAP_CASE_STRING(GR_STATS_PIXELS_CHROMA_FAIL);
+ TRAP_CASE_STRING(GR_STATS_PIXELS_DEPTHFUNC_FAIL);
+ TRAP_CASE_STRING(GR_STATS_PIXELS_IN);
+ TRAP_CASE_STRING(GR_STATS_PIXELS_OUT);
+ TRAP_CASE_STRING(GR_STATS_PIXELS);
+ TRAP_CASE_STRING(GR_STATS_POINTS);
+ TRAP_CASE_STRING(GR_STATS_TRIANGLES_IN);
+ TRAP_CASE_STRING(GR_STATS_TRIANGLES_OUT);
+ TRAP_CASE_STRING(GR_STATS_TRIANGLES);
+ TRAP_CASE_STRING(GR_SWAP_HISTORY);
+ TRAP_CASE_STRING(GR_SUPPORTS_PASSTHRU);
+ TRAP_CASE_STRING(GR_TEXTURE_ALIGN);
+ TRAP_CASE_STRING(GR_VIDEO_POSITION);
+ TRAP_CASE_STRING(GR_VIEWPORT);
+ TRAP_CASE_STRING(GR_WDEPTH_MIN_MAX);
+ TRAP_CASE_STRING(GR_ZDEPTH_MIN_MAX);
+ TRAP_CASE_STRING(GR_VERTEX_PARAMETER);
+ TRAP_CASE_STRING(GR_BITS_GAMMA);
+ TRAP_CASE_STRING(GR_GET_RESERVED_1);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_GETSTRING (FxU32 pname)
+{
+ switch (pname) {
+ TRAP_CASE_STRING(GR_EXTENSION);
+ TRAP_CASE_STRING(GR_HARDWARE);
+ TRAP_CASE_STRING(GR_RENDERER);
+ TRAP_CASE_STRING(GR_VENDOR);
+ TRAP_CASE_STRING(GR_VERSION);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_ENABLE (GrEnableMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_AA_ORDERED);
+ TRAP_CASE_STRING(GR_ALLOW_MIPMAP_DITHER);
+ TRAP_CASE_STRING(GR_PASSTHRU);
+ TRAP_CASE_STRING(GR_SHAMELESS_PLUG);
+ TRAP_CASE_STRING(GR_VIDEO_SMOOTHING);
+ TRAP_CASE_STRING(GR_TEXTURE_UMA_EXT);
+ TRAP_CASE_STRING(GR_STENCIL_MODE_EXT);
+ TRAP_CASE_STRING(GR_OPENGL_MODE_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_COORD (GrCoordinateSpaceMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_WINDOW_COORDS);
+ TRAP_CASE_STRING(GR_CLIP_COORDS);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_STIPPLEMODE (GrStippleMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_STIPPLE_DISABLE);
+ TRAP_CASE_STRING(GR_STIPPLE_PATTERN);
+ TRAP_CASE_STRING(GR_STIPPLE_ROTATE);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_LODLEVEL (GrLOD_t lod)
+{
+ switch (lod) {
+ TRAP_CASE_STRING(GR_LOD_LOG2_2048);
+ TRAP_CASE_STRING(GR_LOD_LOG2_1024);
+ TRAP_CASE_STRING(GR_LOD_LOG2_512);
+ TRAP_CASE_STRING(GR_LOD_LOG2_256);
+ TRAP_CASE_STRING(GR_LOD_LOG2_128);
+ TRAP_CASE_STRING(GR_LOD_LOG2_64);
+ TRAP_CASE_STRING(GR_LOD_LOG2_32);
+ TRAP_CASE_STRING(GR_LOD_LOG2_16);
+ TRAP_CASE_STRING(GR_LOD_LOG2_8);
+ TRAP_CASE_STRING(GR_LOD_LOG2_4);
+ TRAP_CASE_STRING(GR_LOD_LOG2_2);
+ TRAP_CASE_STRING(GR_LOD_LOG2_1);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_ASPECTRATIO (GrAspectRatio_t aspect)
+{
+ switch (aspect) {
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_8x1);
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_4x1);
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_2x1);
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_1x1);
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_1x2);
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_1x4);
+ TRAP_CASE_STRING(GR_ASPECT_LOG2_1x8);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_TEXFMT (GrTextureFormat_t fmt)
+{
+ switch (fmt) {
+ TRAP_CASE_STRING(GR_TEXFMT_8BIT);
+ /*TRAP_CASE_STRING(GR_TEXFMT_RGB_332); ==GR_TEXFMT_8BIT*/
+ TRAP_CASE_STRING(GR_TEXFMT_YIQ_422);
+ TRAP_CASE_STRING(GR_TEXFMT_ALPHA_8);
+ TRAP_CASE_STRING(GR_TEXFMT_INTENSITY_8);
+ TRAP_CASE_STRING(GR_TEXFMT_ALPHA_INTENSITY_44);
+ TRAP_CASE_STRING(GR_TEXFMT_P_8);
+ TRAP_CASE_STRING(GR_TEXFMT_RSVD0);
+ /*TRAP_CASE_STRING(GR_TEXFMT_P_8_6666); ==GR_TEXFMT_RSVD0*/
+ /*TRAP_CASE_STRING(GR_TEXFMT_P_8_6666_EXT); ==GR_TEXFMT_RSVD0*/
+ TRAP_CASE_STRING(GR_TEXFMT_RSVD1);
+ TRAP_CASE_STRING(GR_TEXFMT_16BIT);
+ /*TRAP_CASE_STRING(GR_TEXFMT_ARGB_8332); ==GR_TEXFMT_16BIT*/
+ TRAP_CASE_STRING(GR_TEXFMT_AYIQ_8422);
+ TRAP_CASE_STRING(GR_TEXFMT_RGB_565);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_1555);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_4444);
+ TRAP_CASE_STRING(GR_TEXFMT_ALPHA_INTENSITY_88);
+ TRAP_CASE_STRING(GR_TEXFMT_AP_88);
+ TRAP_CASE_STRING(GR_TEXFMT_RSVD2);
+ /*TRAP_CASE_STRING(GR_TEXFMT_RSVD4); ==GR_TEXFMT_RSVD2*/
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_FXT1);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_8888);
+ TRAP_CASE_STRING(GR_TEXFMT_YUYV_422);
+ TRAP_CASE_STRING(GR_TEXFMT_UYVY_422);
+ TRAP_CASE_STRING(GR_TEXFMT_AYUV_444);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT1);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT2);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT3);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT4);
+ TRAP_CASE_STRING(GR_TEXFMT_ARGB_CMP_DXT5);
+ TRAP_CASE_STRING(GR_TEXTFMT_RGB_888);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_EVENODD (FxU32 evenOdd)
+{
+ switch (evenOdd) {
+ TRAP_CASE_STRING(GR_MIPMAPLEVELMASK_EVEN);
+ TRAP_CASE_STRING(GR_MIPMAPLEVELMASK_ODD);
+ TRAP_CASE_STRING(GR_MIPMAPLEVELMASK_BOTH);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_NCC (GrNCCTable_t table)
+{
+ switch (table) {
+ TRAP_CASE_STRING(GR_NCCTABLE_NCC0);
+ TRAP_CASE_STRING(GR_NCCTABLE_NCC1);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CLAMPMODE (GrTextureClampMode_t clampmode)
+{
+ switch (clampmode) {
+ TRAP_CASE_STRING(GR_TEXTURECLAMP_WRAP);
+ TRAP_CASE_STRING(GR_TEXTURECLAMP_CLAMP);
+ TRAP_CASE_STRING(GR_TEXTURECLAMP_MIRROR_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_TEXFILTER (GrTextureFilterMode_t filter_mode)
+{
+ switch (filter_mode) {
+ TRAP_CASE_STRING(GR_TEXTUREFILTER_POINT_SAMPLED);
+ TRAP_CASE_STRING(GR_TEXTUREFILTER_BILINEAR);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_TABLE (GrTexTable_t type)
+{
+ switch (type) {
+ TRAP_CASE_STRING(GR_TEXTABLE_NCC0);
+ TRAP_CASE_STRING(GR_TEXTABLE_NCC1);
+ TRAP_CASE_STRING(GR_TEXTABLE_PALETTE);
+ TRAP_CASE_STRING(GR_TEXTABLE_PALETTE_6666_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_MIPMODE (GrMipMapMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_MIPMAP_DISABLE);
+ TRAP_CASE_STRING(GR_MIPMAP_NEAREST);
+ TRAP_CASE_STRING(GR_MIPMAP_NEAREST_DITHER);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_TEXBASERANGE (GrTexBaseRange_t range)
+{
+ switch (range) {
+ TRAP_CASE_STRING(GR_TEXBASE_2048);
+ TRAP_CASE_STRING(GR_TEXBASE_1024);
+ TRAP_CASE_STRING(GR_TEXBASE_512);
+ TRAP_CASE_STRING(GR_TEXBASE_256_TO_1);
+ TRAP_CASE_STRING(GR_TEXBASE_256);
+ TRAP_CASE_STRING(GR_TEXBASE_128);
+ TRAP_CASE_STRING(GR_TEXBASE_64);
+ TRAP_CASE_STRING(GR_TEXBASE_32_TO_1);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_LOCKTYPE (GrLock_t type)
+{
+ switch (type) {
+ TRAP_CASE_STRING(GR_LFB_READ_ONLY);
+ TRAP_CASE_STRING(GR_LFB_WRITE_ONLY);
+ /*TRAP_CASE_STRING(GR_LFB_IDLE); ==GR_LFB_READ_ONLY*/
+ TRAP_CASE_STRING(GR_LFB_NOIDLE);
+ TRAP_CASE_STRING(GR_LFB_WRITE_ONLY_EXPLICIT_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_WRITEMODE (GrLfbWriteMode_t writeMode)
+{
+ switch (writeMode) {
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_565);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_555);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_1555);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED1);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_888);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_8888);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED2);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED3);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_Z32);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED5);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED6);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_RESERVED7);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_565_DEPTH);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_555_DEPTH);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_1555_DEPTH);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_ZA16);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_ANY);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_SRCFMT (GrLfbSrcFmt_t src_format)
+{
+ switch (src_format) {
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_565);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_555);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_1555);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_888);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_8888);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_565_DEPTH);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_555_DEPTH);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_1555_DEPTH);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_ZA16);
+ TRAP_CASE_STRING(GR_LFB_SRC_FMT_RLE16);
+ TRAP_CASE_STRING(GR_LFBWRITEMODE_Z32); /*???*/
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CRMODE (GrChromaRangeMode_t mode)
+{
+ switch (mode) {
+ TRAP_CASE_STRING(GR_CHROMARANGE_DISABLE_EXT);
+ /*TRAP_CASE_STRING(GR_CHROMARANGE_RGB_ALL_EXT); ==GR_CHROMARANGE_DISABLE_EXT*/
+ TRAP_CASE_STRING(GR_CHROMARANGE_ENABLE_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_PIXFMT (GrPixelFormat_t pixelformat)
+{
+ switch (pixelformat) {
+ TRAP_CASE_STRING(GR_PIXFMT_I_8);
+ TRAP_CASE_STRING(GR_PIXFMT_AI_88);
+ TRAP_CASE_STRING(GR_PIXFMT_RGB_565);
+ TRAP_CASE_STRING(GR_PIXFMT_ARGB_1555);
+ TRAP_CASE_STRING(GR_PIXFMT_ARGB_8888);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_2_RGB_565);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_2_ARGB_1555);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_2_ARGB_8888);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_4_RGB_565);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_4_ARGB_1555);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_4_ARGB_8888);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_8_RGB_565);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_8_ARGB_1555);
+ TRAP_CASE_STRING(GR_PIXFMT_AA_8_ARGB_8888);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_STENCILOP (GrStencilOp_t op)
+{
+ switch (op) {
+ TRAP_CASE_STRING(GR_STENCILOP_KEEP);
+ TRAP_CASE_STRING(GR_STENCILOP_ZERO);
+ TRAP_CASE_STRING(GR_STENCILOP_REPLACE);
+ TRAP_CASE_STRING(GR_STENCILOP_INCR_CLAMP);
+ TRAP_CASE_STRING(GR_STENCILOP_DECR_CLAMP);
+ TRAP_CASE_STRING(GR_STENCILOP_INVERT);
+ TRAP_CASE_STRING(GR_STENCILOP_INCR_WRAP);
+ TRAP_CASE_STRING(GR_STENCILOP_DECR_WRAP);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_BLENDOP (GrAlphaBlendOp_t op)
+{
+ switch (op) {
+ TRAP_CASE_STRING(GR_BLEND_OP_ADD);
+ TRAP_CASE_STRING(GR_BLEND_OP_SUB);
+ TRAP_CASE_STRING(GR_BLEND_OP_REVSUB);
+ TRAP_CASE_STRING(GR_BLEND_SAME_COLOR_EXT);
+ TRAP_CASE_STRING(GR_BLEND_ONE_MINUS_SAME_COLOR_EXT);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CU (GrCCUColor_t a)
+{
+ switch (a) {
+ TRAP_CASE_STRING(GR_CMBX_ZERO);
+ TRAP_CASE_STRING(GR_CMBX_TEXTURE_ALPHA);
+ TRAP_CASE_STRING(GR_CMBX_ALOCAL);
+ TRAP_CASE_STRING(GR_CMBX_AOTHER);
+ TRAP_CASE_STRING(GR_CMBX_B);
+ TRAP_CASE_STRING(GR_CMBX_CONSTANT_ALPHA);
+ TRAP_CASE_STRING(GR_CMBX_CONSTANT_COLOR);
+ TRAP_CASE_STRING(GR_CMBX_DETAIL_FACTOR);
+ TRAP_CASE_STRING(GR_CMBX_ITALPHA);
+ TRAP_CASE_STRING(GR_CMBX_ITRGB);
+ TRAP_CASE_STRING(GR_CMBX_LOCAL_TEXTURE_ALPHA);
+ TRAP_CASE_STRING(GR_CMBX_LOCAL_TEXTURE_RGB);
+ TRAP_CASE_STRING(GR_CMBX_LOD_FRAC);
+ TRAP_CASE_STRING(GR_CMBX_OTHER_TEXTURE_ALPHA);
+ TRAP_CASE_STRING(GR_CMBX_OTHER_TEXTURE_RGB);
+ TRAP_CASE_STRING(GR_CMBX_TEXTURE_RGB);
+ TRAP_CASE_STRING(GR_CMBX_TMU_CALPHA);
+ TRAP_CASE_STRING(GR_CMBX_TMU_CCOLOR);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_CMBMODE (GrCombineMode_t a_mode)
+{
+ switch (a_mode) {
+ TRAP_CASE_STRING(GR_FUNC_MODE_ZERO);
+ TRAP_CASE_STRING(GR_FUNC_MODE_X);
+ TRAP_CASE_STRING(GR_FUNC_MODE_ONE_MINUS_X);
+ TRAP_CASE_STRING(GR_FUNC_MODE_NEGATIVE_X);
+ TRAP_CASE_STRING(GR_FUNC_MODE_X_MINUS_HALF);
+ TRAP_NODEFAULT;
+ }
+}
+
+const char *TRP_TMU (GrChipID_t tmu)
+{
+ switch (tmu) {
+ TRAP_CASE_STRING(GR_TMU0);
+ TRAP_CASE_STRING(GR_TMU1);
+ TRAP_NODEFAULT;
+ }
+}
+
+
+
+/****************************************************************************\
+* REAL POINTERS *
+\****************************************************************************/
+
+/*
+** glide extensions
+*/
+char * (FX_CALL *real_grGetRegistryOrEnvironmentStringExt) (char *theEntry);
+void (FX_CALL *real_grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
+void (FX_CALL *real_grChromaRangeModeExt) (GrChromakeyMode_t mode);
+void (FX_CALL *real_grChromaRangeExt) (GrColor_t color, GrColor_t range, GrChromaRangeMode_t match_mode);
+void (FX_CALL *real_grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode);
+void (FX_CALL *real_grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode);
+
+/* tbext */
+void (FX_CALL *real_grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
+void (FX_CALL *real_grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
+void (FX_CALL *real_grAuxBufferExt) (GrBuffer_t buffer);
+
+/* napalm */
+GrContext_t (FX_CALL *real_grSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers);
+void (FX_CALL *real_grStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
+void (FX_CALL *real_grStencilMaskExt) (GrStencil_t value);
+void (FX_CALL *real_grStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass);
+void (FX_CALL *real_grLfbConstantStencilExt) (GrStencil_t value);
+void (FX_CALL *real_grBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil);
+void (FX_CALL *real_grColorCombineExt) (GrCCUColor_t a, GrCombineMode_t a_mode, GrCCUColor_t b, GrCombineMode_t b_mode, GrCCUColor_t c, FxBool c_invert, GrCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+void (FX_CALL *real_grAlphaCombineExt) (GrACUColor_t a, GrCombineMode_t a_mode, GrACUColor_t b, GrCombineMode_t b_mode, GrACUColor_t c, FxBool c_invert, GrACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+void (FX_CALL *real_grTexColorCombineExt) (GrChipID_t tmu, GrTCCUColor_t a, GrCombineMode_t a_mode, GrTCCUColor_t b, GrCombineMode_t b_mode, GrTCCUColor_t c, FxBool c_invert, GrTCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+void (FX_CALL *real_grTexAlphaCombineExt) (GrChipID_t tmu, GrTACUColor_t a, GrCombineMode_t a_mode, GrTACUColor_t b, GrCombineMode_t b_mode, GrTACUColor_t c, FxBool c_invert, GrTACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+void (FX_CALL *real_grConstantColorValueExt) (GrChipID_t tmu, GrColor_t value);
+void (FX_CALL *real_grColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a);
+void (FX_CALL *real_grAlphaBlendFunctionExt) (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendOp_t rgb_op, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df, GrAlphaBlendOp_t alpha_op);
+void (FX_CALL *real_grTBufferWriteMaskExt) (FxU32 tmask);
+
+
+
+/****************************************************************************\
+* DEBUG HOOKS *
+\****************************************************************************/
+
+/*
+** rendering functions
+*/
+void FX_CALL trap_grDrawPoint (const void *pt)
+{
+#define FN_NAME "grDrawPoint"
+ TRAP_LOG("%s(%p)\n", FN_NAME, pt);
+ grDrawPoint(pt);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDrawLine (const void *v1,
+ const void *v2)
+{
+#define FN_NAME "grDrawLine"
+ TRAP_LOG("%s(%p, %p)\n", FN_NAME, v1, v2);
+ grDrawLine(v1, v2);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDrawTriangle (const void *a,
+ const void *b,
+ const void *c)
+{
+#define FN_NAME "grDrawTriangle"
+ TRAP_LOG("%s(%p, %p, %p)\n", FN_NAME, a, b, c);
+ grDrawTriangle(a, b, c);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grVertexLayout (FxU32 param,
+ FxI32 offset,
+ FxU32 mode)
+{
+#define FN_NAME "grVertexLayout"
+ TRAP_LOG("%s(%s, %ld, %s)\n", FN_NAME, TRP_VTX(param), offset, TRP_PARAM(mode));
+ grVertexLayout(param, offset, mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDrawVertexArray (FxU32 mode,
+ FxU32 Count,
+ void *pointers)
+{
+#define FN_NAME "grDrawVertexArray"
+ TRAP_LOG("%s(%s, %lu, %p)\n", FN_NAME, TRP_ARRAY(mode), Count, pointers);
+ grDrawVertexArray(mode, Count, pointers);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDrawVertexArrayContiguous (FxU32 mode,
+ FxU32 Count,
+ void *pointers,
+ FxU32 stride)
+{
+#define FN_NAME "grDrawVertexArrayContiguous"
+ TRAP_LOG("%s(%s, %lu, %p, %lu)\n", FN_NAME, TRP_ARRAY(mode), Count, pointers, stride);
+ grDrawVertexArrayContiguous(mode, Count, pointers, stride);
+#undef FN_NAME
+}
+
+/*
+** Antialiasing Functions
+*/
+void FX_CALL trap_grAADrawTriangle (const void *a,
+ const void *b,
+ const void *c,
+ FxBool ab_antialias,
+ FxBool bc_antialias,
+ FxBool ca_antialias)
+{
+#define FN_NAME "grAADrawTriangle"
+ TRAP_LOG("%s(%p, %p, %p, %s, %s, %s)\n", FN_NAME, a, b, c, TRP_BOOL(ab_antialias), TRP_BOOL(bc_antialias), TRP_BOOL(ca_antialias));
+ grAADrawTriangle(a, b, c, ab_antialias, bc_antialias, ca_antialias);
+#undef FN_NAME
+}
+
+/*
+** buffer management
+*/
+void FX_CALL trap_grBufferClear (GrColor_t color,
+ GrAlpha_t alpha,
+ FxU32 depth)
+{
+#define FN_NAME "grBufferClear"
+ TRAP_LOG("%s(%08lx, %02x, %08lx)\n", FN_NAME, color, alpha, depth);
+ grBufferClear(color, alpha, depth);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grBufferSwap (FxU32 swap_interval)
+{
+#define FN_NAME "grBufferSwap"
+ TRAP_LOG("%s(%lu)\n", FN_NAME, swap_interval);
+ grBufferSwap(swap_interval);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grRenderBuffer (GrBuffer_t buffer)
+{
+#define FN_NAME "grRenderBuffer"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BUFFER(buffer));
+ grRenderBuffer(buffer);
+#undef FN_NAME
+}
+
+/*
+** error management
+*/
+void FX_CALL trap_grErrorSetCallback (GrErrorCallbackFnc_t fnc)
+{
+#define FN_NAME "grErrorSetCallback"
+ TRAP_LOG("%s(%p)\n", FN_NAME, (void *)fnc);
+ grErrorSetCallback(fnc);
+#undef FN_NAME
+}
+
+/*
+** SST routines
+*/
+void FX_CALL trap_grFinish (void)
+{
+#define FN_NAME "grFinish"
+ TRAP_LOG("%s()\n", FN_NAME);
+ grFinish();
+#undef FN_NAME
+}
+
+void FX_CALL trap_grFlush (void)
+{
+#define FN_NAME "grFlush"
+ TRAP_LOG("%s()\n", FN_NAME);
+ grFlush();
+#undef FN_NAME
+}
+
+GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd,
+ GrScreenResolution_t screen_resolution,
+ GrScreenRefresh_t refresh_rate,
+ GrColorFormat_t color_format,
+ GrOriginLocation_t origin_location,
+ int nColBuffers,
+ int nAuxBuffers)
+{
+#define FN_NAME "grSstWinOpen"
+ GrContext_t rv;
+ TRAP_LOG("%s(%08lx, %s, %s, %s, %s, %d, %d)\n", FN_NAME, hWnd, TRP_RESOLUTION(screen_resolution), TRP_REFRESH(refresh_rate), TRP_COLFMT(color_format), TRP_ORIGIN(origin_location), nColBuffers, nAuxBuffers);
+ rv = grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
+ TRAP_LOG(GOT "%p\n", (void *)rv);
+ return rv;
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grSstWinClose (GrContext_t context)
+{
+#define FN_NAME "grSstWinClose"
+ FxBool rv;
+ TRAP_LOG("%s(%p)\n", FN_NAME, (void *)context);
+ rv = grSstWinClose(context);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers)
+{
+#define FN_NAME "grSetNumPendingBuffers"
+ TRAP_LOG("%s(%ld)\n", FN_NAME, NumPendingBuffers);
+ grSetNumPendingBuffers(NumPendingBuffers);
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grSelectContext (GrContext_t context)
+{
+#define FN_NAME "grSelectContext"
+ FxBool rv;
+ TRAP_LOG("%s(%p)\n", FN_NAME, (void *)context);
+ rv = grSelectContext(context);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin)
+{
+#define FN_NAME "grSstOrigin"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_ORIGIN(origin));
+ grSstOrigin(origin);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grSstSelect (int which_sst)
+{
+#define FN_NAME "grSstSelect"
+ TRAP_LOG("%s(%d)\n", FN_NAME, which_sst);
+ grSstSelect(which_sst);
+#undef FN_NAME
+}
+
+/*
+** Glide configuration and special effect maintenance functions
+*/
+void FX_CALL trap_grAlphaBlendFunction (GrAlphaBlendFnc_t rgb_sf,
+ GrAlphaBlendFnc_t rgb_df,
+ GrAlphaBlendFnc_t alpha_sf,
+ GrAlphaBlendFnc_t alpha_df)
+{
+#define FN_NAME "grAlphaBlendFunction"
+ TRAP_LOG("%s(%s, %s, %s, %s)\n", FN_NAME, TRP_BLEND(rgb_sf), TRP_BLEND(rgb_df), TRP_BLEND(alpha_sf), TRP_BLEND(alpha_df));
+ grAlphaBlendFunction(rgb_sf, rgb_df, alpha_sf, alpha_df);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAlphaCombine (GrCombineFunction_t function,
+ GrCombineFactor_t factor,
+ GrCombineLocal_t local,
+ GrCombineOther_t other,
+ FxBool invert)
+{
+#define FN_NAME "grAlphaCombine"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s)\n", FN_NAME, TRP_CMBFUNC(function), TRP_CMBFACT(factor), TRP_CMBLOCAL(local), TRP_CMBOTHER(other), TRP_BOOL(invert));
+ grAlphaCombine(function, factor, local, other, invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAlphaControlsITRGBLighting (FxBool enable)
+{
+#define FN_NAME "grAlphaControlsITRGBLighting"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BOOL(enable));
+ grAlphaControlsITRGBLighting(enable);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAlphaTestFunction (GrCmpFnc_t function)
+{
+#define FN_NAME "grAlphaTestFunction"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CMPFUNC(function));
+ grAlphaTestFunction(function);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAlphaTestReferenceValue (GrAlpha_t value)
+{
+#define FN_NAME "grAlphaTestReferenceValue"
+ TRAP_LOG("%s(%02x)\n", FN_NAME, value);
+ grAlphaTestReferenceValue(value);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grChromakeyMode (GrChromakeyMode_t mode)
+{
+#define FN_NAME "grChromakeyMode"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CKMODE(mode));
+ grChromakeyMode(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grChromakeyValue (GrColor_t value)
+{
+#define FN_NAME "grChromakeyValue"
+ TRAP_LOG("%s(%08lx)\n", FN_NAME, value);
+ grChromakeyValue(value);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grClipWindow (FxU32 minx,
+ FxU32 miny,
+ FxU32 maxx,
+ FxU32 maxy)
+{
+#define FN_NAME "grClipWindow"
+ TRAP_LOG("%s(%lu, %lu, %lu, %lu)\n", FN_NAME, minx, miny, maxx, maxy);
+ grClipWindow(minx, miny, maxx, maxy);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grColorCombine (GrCombineFunction_t function,
+ GrCombineFactor_t factor,
+ GrCombineLocal_t local,
+ GrCombineOther_t other,
+ FxBool invert)
+{
+#define FN_NAME "grColorCombine"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s)\n", FN_NAME, TRP_CMBFUNC(function), TRP_CMBFACT(factor), TRP_CMBLOCAL(local), TRP_CMBOTHER(other), TRP_BOOL(invert));
+ grColorCombine(function, factor, local, other, invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grColorMask (FxBool rgb,
+ FxBool a)
+{
+#define FN_NAME "grColorMask"
+ TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_BOOL(rgb), TRP_BOOL(a));
+ grColorMask(rgb, a);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grCullMode (GrCullMode_t mode)
+{
+#define FN_NAME "grCullMode"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CULLMODE(mode));
+ grCullMode(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grConstantColorValue (GrColor_t value)
+{
+#define FN_NAME "grConstantColorValue"
+ TRAP_LOG("%s(%08lx)\n", FN_NAME, value);
+ grConstantColorValue(value);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDepthBiasLevel (FxI32 level)
+{
+#define FN_NAME "grDepthBiasLevel"
+ TRAP_LOG("%s(%ld)\n", FN_NAME, level);
+ grDepthBiasLevel(level);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDepthBufferFunction (GrCmpFnc_t function)
+{
+#define FN_NAME "grDepthBufferFunction"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CMPFUNC(function));
+ grDepthBufferFunction(function);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDepthBufferMode (GrDepthBufferMode_t mode)
+{
+#define FN_NAME "grDepthBufferMode"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_DEPTHMODE(mode));
+ grDepthBufferMode(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDepthMask (FxBool mask)
+{
+#define FN_NAME "grDepthMask"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BOOL(mask));
+ grDepthMask(mask);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDisableAllEffects (void)
+{
+#define FN_NAME "grDisableAllEffects"
+ TRAP_LOG("%s()\n", FN_NAME);
+ grDisableAllEffects();
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDitherMode (GrDitherMode_t mode)
+{
+#define FN_NAME "grDitherMode"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_DITHERMODE(mode));
+ grDitherMode(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grFogColorValue (GrColor_t fogcolor)
+{
+#define FN_NAME "grFogColorValue"
+ TRAP_LOG("%s(%08lx)\n", FN_NAME, fogcolor);
+ grFogColorValue(fogcolor);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grFogMode (GrFogMode_t mode)
+{
+#define FN_NAME "grFogMode"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_FOGMODE(mode));
+ grFogMode(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grFogTable (const GrFog_t ft[])
+{
+#define FN_NAME "grFogTable"
+ TRAP_LOG("%s(%p)\n", FN_NAME, ft);
+ grFogTable(ft);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grLoadGammaTable (FxU32 nentries,
+ FxU32 *red,
+ FxU32 *green,
+ FxU32 *blue)
+{
+#define FN_NAME "grLoadGammaTable"
+ TRAP_LOG("%s(%lu, %p, %p, %p)\n", FN_NAME, nentries, (void *)red, (void *)green, (void *)blue);
+ grLoadGammaTable(nentries, red, green, blue);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grSplash (float x,
+ float y,
+ float width,
+ float height,
+ FxU32 frame)
+{
+#define FN_NAME "grSplash"
+ TRAP_LOG("%s(%f, %f, %f, %f, %lu)\n", FN_NAME, x, y, width, height, frame);
+ grSplash(x, y, width, height, frame);
+#undef FN_NAME
+}
+
+FxU32 FX_CALL trap_grGet (FxU32 pname,
+ FxU32 plength,
+ FxI32 *params)
+{
+#define FN_NAME "grGet"
+ FxU32 rv, i;
+ TRAP_LOG("%s(%s, %lu, %p)\n", FN_NAME, TRP_GETNAME(pname), plength, (void *)params);
+ rv = grGet(pname, plength, params);
+ TRAP_LOG(GOT "[");
+ for (i = 0; i < (rv/sizeof(FxI32)); i++) {
+ TRAP_LOG("%s%ld", i ? ", " : "", params[i]);
+ }
+ TRAP_LOG("]\n");
+ return rv;
+#undef FN_NAME
+}
+
+const char *FX_CALL trap_grGetString (FxU32 pname)
+{
+#define FN_NAME "grGetString"
+ const char *rv;
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_GETSTRING(pname));
+ rv = grGetString(pname);
+ if (rv) {
+ TRAP_LOG(GOT "\"%s\"\n", rv);
+ } else {
+ TRAP_LOG(GOT "NULL\n");
+ }
+ return rv;
+#undef FN_NAME
+}
+
+FxI32 FX_CALL trap_grQueryResolutions (const GrResolution *resTemplate,
+ GrResolution *output)
+{
+#define FN_NAME "grQueryResolutions"
+ FxI32 rv;
+ TRAP_LOG("%s(%p, %p)\n", FN_NAME, (void *)resTemplate, (void *)output);
+ rv = grQueryResolutions(resTemplate, output);
+ TRAP_LOG(GOT "%ld\n", rv);
+ return rv;
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grReset (FxU32 what)
+{
+#define FN_NAME "grReset"
+ FxBool rv;
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_GETNAME(what));
+ rv = grReset(what);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+GrProc FX_CALL trap_grGetProcAddress (char *procName)
+{
+#define FN_NAME "grGetProcAddress"
+ GrProc rv;
+ TRAP_LOG("%s(%s)\n", FN_NAME, procName);
+ rv = grGetProcAddress(procName);
+ TRAP_LOG(GOT "%p\n", (void *)rv);
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grEnable (GrEnableMode_t mode)
+{
+#define FN_NAME "grEnable"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_ENABLE(mode));
+ grEnable(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDisable (GrEnableMode_t mode)
+{
+#define FN_NAME "grDisable"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_ENABLE(mode));
+ grDisable(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grCoordinateSpace (GrCoordinateSpaceMode_t mode)
+{
+#define FN_NAME "grCoordinateSpace"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_COORD(mode));
+ grCoordinateSpace(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grDepthRange (FxFloat n,
+ FxFloat f)
+{
+#define FN_NAME "grDepthRange"
+ TRAP_LOG("%s(%f, %f)\n", FN_NAME, n, f);
+ grDepthRange(n, f);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grStippleMode (GrStippleMode_t mode)
+{
+#define FN_NAME "grStippleMode"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_STIPPLEMODE(mode));
+ grStippleMode(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grStipplePattern (GrStipplePattern_t mode)
+{
+#define FN_NAME "grStipplePattern"
+ TRAP_LOG("%s(%08lx)\n", FN_NAME, mode);
+ grStipplePattern(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grViewport (FxI32 x,
+ FxI32 y,
+ FxI32 width,
+ FxI32 height)
+{
+#define FN_NAME "grViewport"
+ TRAP_LOG("%s(%ld, %ld, %ld, %ld)\n", FN_NAME, x, y, width, height);
+ grViewport(x, y, width, height);
+#undef FN_NAME
+}
+
+/*
+** texture mapping control functions
+*/
+FxU32 FX_CALL trap_grTexCalcMemRequired (GrLOD_t lodmin,
+ GrLOD_t lodmax,
+ GrAspectRatio_t aspect,
+ GrTextureFormat_t fmt)
+{
+#define FN_NAME "grTexCalcMemRequired"
+ FxU32 rv;
+ TRAP_LOG("%s(%s, %s, %s, %s)\n", FN_NAME, TRP_LODLEVEL(lodmin), TRP_LODLEVEL(lodmax), TRP_ASPECTRATIO(aspect), TRP_TEXFMT(fmt));
+ rv = grTexCalcMemRequired(lodmin, lodmax, aspect, fmt);
+ TRAP_LOG(GOT "%lu\n", rv);
+ return rv;
+#undef FN_NAME
+}
+
+FxU32 FX_CALL trap_grTexTextureMemRequired (FxU32 evenOdd,
+ GrTexInfo *info)
+{
+#define FN_NAME "grTexTextureMemRequired"
+ FxU32 rv;
+ TRAP_LOG("%s(%s, %p)\n", FN_NAME, TRP_EVENODD(evenOdd), (void *)info);
+ rv = grTexTextureMemRequired(evenOdd, info);
+ TRAP_LOG(GOT "%lu\n", rv);
+ return rv;
+#undef FN_NAME
+}
+
+FxU32 FX_CALL trap_grTexMinAddress (GrChipID_t tmu)
+{
+#define FN_NAME "grTexMinAddress"
+ FxU32 rv;
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_TMU(tmu));
+ rv = grTexMinAddress(tmu);
+ TRAP_LOG(GOT "%lu\n", rv);
+ return rv;
+#undef FN_NAME
+}
+
+FxU32 FX_CALL trap_grTexMaxAddress (GrChipID_t tmu)
+{
+#define FN_NAME "grTexMaxAddress"
+ FxU32 rv;
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_TMU(tmu));
+ rv = grTexMaxAddress(tmu);
+ TRAP_LOG(GOT "%lu\n", rv);
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexNCCTable (GrNCCTable_t table)
+{
+#define FN_NAME "grTexNCCTable"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_NCC(table));
+ grTexNCCTable(table);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexSource (GrChipID_t tmu,
+ FxU32 startAddress,
+ FxU32 evenOdd,
+ GrTexInfo *info)
+{
+#define FN_NAME "grTexSource"
+ TRAP_LOG("%s(%s, %08lx, %s, %p)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_EVENODD(evenOdd), (void *)info);
+ grTexSource(tmu, startAddress, evenOdd, info);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexClampMode (GrChipID_t tmu,
+ GrTextureClampMode_t s_clampmode,
+ GrTextureClampMode_t t_clampmode)
+{
+#define FN_NAME "grTexClampMode"
+ TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CLAMPMODE(s_clampmode), TRP_CLAMPMODE(t_clampmode));
+ grTexClampMode(tmu, s_clampmode, t_clampmode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexCombine (GrChipID_t tmu,
+ GrCombineFunction_t rgb_function,
+ GrCombineFactor_t rgb_factor,
+ GrCombineFunction_t alpha_function,
+ GrCombineFactor_t alpha_factor,
+ FxBool rgb_invert,
+ FxBool alpha_invert)
+{
+#define FN_NAME "grTexCombine"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CMBFUNC(rgb_function), TRP_CMBFACT(rgb_factor), TRP_CMBFUNC(alpha_function), TRP_CMBFACT(alpha_factor), TRP_BOOL(rgb_invert), TRP_BOOL(alpha_invert));
+ grTexCombine(tmu, rgb_function, rgb_factor, alpha_function, alpha_factor, rgb_invert, alpha_invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexDetailControl (GrChipID_t tmu,
+ int lod_bias,
+ FxU8 detail_scale,
+ float detail_max)
+{
+#define FN_NAME "grTexDetailControl"
+ TRAP_LOG("%s(%s, %u, %d, %f)\n", FN_NAME, TRP_TMU(tmu), lod_bias, detail_scale, detail_max);
+ grTexDetailControl(tmu, lod_bias, detail_scale, detail_max);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexFilterMode (GrChipID_t tmu,
+ GrTextureFilterMode_t minfilter_mode,
+ GrTextureFilterMode_t magfilter_mode)
+{
+#define FN_NAME "grTexFilterMode"
+ TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_TEXFILTER(minfilter_mode), TRP_TEXFILTER(magfilter_mode));
+ grTexFilterMode(tmu, minfilter_mode, magfilter_mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexLodBiasValue (GrChipID_t tmu,
+ float bias)
+{
+#define FN_NAME "grTexLodBiasValue"
+ TRAP_LOG("%s(%s, %f)\n", FN_NAME, TRP_TMU(tmu), bias);
+ grTexLodBiasValue(tmu, bias);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexDownloadMipMap (GrChipID_t tmu,
+ FxU32 startAddress,
+ FxU32 evenOdd,
+ GrTexInfo *info)
+{
+#define FN_NAME "grTexDownloadMipMap"
+ TRAP_LOG("%s(%s, %08lx, %s, %p)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_EVENODD(evenOdd), (void *)info);
+ grTexDownloadMipMap(tmu, startAddress, evenOdd, info);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexDownloadMipMapLevel (GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t thisLod,
+ GrLOD_t largeLod,
+ GrAspectRatio_t aspectRatio,
+ GrTextureFormat_t format,
+ FxU32 evenOdd,
+ void *data)
+{
+#define FN_NAME "grTexDownloadMipMapLevel"
+ TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s, %p)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLod), TRP_LODLEVEL(largeLod), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(evenOdd), data);
+ grTexDownloadMipMapLevel(tmu, startAddress, thisLod, largeLod, aspectRatio, format, evenOdd, data);
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grTexDownloadMipMapLevelPartial (GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t thisLod,
+ GrLOD_t largeLod,
+ GrAspectRatio_t aspectRatio,
+ GrTextureFormat_t format,
+ FxU32 evenOdd,
+ void *data,
+ int start,
+ int end)
+{
+#define FN_NAME "grTexDownloadMipMapLevelPartial"
+ FxBool rv;
+ TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s, %p, %d, %d)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLod), TRP_LODLEVEL(largeLod), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(evenOdd), data, start, end);
+ rv = grTexDownloadMipMapLevelPartial(tmu, startAddress, thisLod, largeLod, aspectRatio, format, evenOdd, data, start, end);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexDownloadTable (GrTexTable_t type,
+ void *data)
+{
+#define FN_NAME "grTexDownloadTable"
+ TRAP_LOG("%s(%s, %p)\n", FN_NAME, TRP_TABLE(type), data);
+ grTexDownloadTable(type, data);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexDownloadTablePartial (GrTexTable_t type,
+ void *data,
+ int start,
+ int end)
+{
+#define FN_NAME "grTexDownloadTablePartial"
+ TRAP_LOG("%s(%s, %p, %d, %d)\n", FN_NAME, TRP_TABLE(type), data, start, end);
+ grTexDownloadTablePartial(type, data, start, end);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexMipMapMode (GrChipID_t tmu,
+ GrMipMapMode_t mode,
+ FxBool lodBlend)
+{
+#define FN_NAME "grTexMipMapMode"
+ TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_MIPMODE(mode), TRP_BOOL(lodBlend));
+ grTexMipMapMode(tmu, mode, lodBlend);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexMultibase (GrChipID_t tmu,
+ FxBool enable)
+{
+#define FN_NAME "grTexMultibase"
+ TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_BOOL(enable));
+ grTexMultibase(tmu, enable);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexMultibaseAddress (GrChipID_t tmu,
+ GrTexBaseRange_t range,
+ FxU32 startAddress,
+ FxU32 evenOdd,
+ GrTexInfo *info)
+{
+#define FN_NAME "grTexMultibaseAddress"
+ TRAP_LOG("%s(%s, %s, %08lx, %s, %p)\n", FN_NAME, TRP_TMU(tmu), TRP_TEXBASERANGE(range), startAddress, TRP_EVENODD(evenOdd), (void *)info);
+ grTexMultibaseAddress(tmu, range, startAddress, evenOdd, info);
+#undef FN_NAME
+}
+
+/*
+** linear frame buffer functions
+*/
+FxBool FX_CALL trap_grLfbLock (GrLock_t type,
+ GrBuffer_t buffer,
+ GrLfbWriteMode_t writeMode,
+ GrOriginLocation_t origin,
+ FxBool pixelPipeline,
+ GrLfbInfo_t *info)
+{
+#define FN_NAME "grLfbLock"
+ FxBool rv;
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %p)\n", FN_NAME, TRP_LOCKTYPE(type), TRP_BUFFER(buffer), TRP_WRITEMODE(writeMode), TRP_ORIGIN(origin), TRP_BOOL(pixelPipeline), (void *)info);
+ rv = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grLfbUnlock (GrLock_t type,
+ GrBuffer_t buffer)
+{
+#define FN_NAME "grLfbUnlock"
+ FxBool rv;
+ TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_LOCKTYPE(type), TRP_BUFFER(buffer));
+ rv = grLfbUnlock(type, buffer);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grLfbConstantAlpha (GrAlpha_t alpha)
+{
+#define FN_NAME "grLfbConstantAlpha"
+ TRAP_LOG("%s(%02x)\n", FN_NAME, alpha);
+ grLfbConstantAlpha(alpha);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grLfbConstantDepth (FxU32 depth)
+{
+#define FN_NAME "grLfbConstantDepth"
+ TRAP_LOG("%s(%08lx)\n", FN_NAME, depth);
+ grLfbConstantDepth(depth);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grLfbWriteColorSwizzle (FxBool swizzleBytes,
+ FxBool swapWords)
+{
+#define FN_NAME "grLfbWriteColorSwizzle"
+ TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_BOOL(swizzleBytes), TRP_BOOL(swapWords));
+ grLfbWriteColorSwizzle(swizzleBytes, swapWords);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grLfbWriteColorFormat (GrColorFormat_t colorFormat)
+{
+#define FN_NAME "grLfbWriteColorFormat"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_COLFMT(colorFormat));
+ grLfbWriteColorFormat(colorFormat);
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grLfbWriteRegion (GrBuffer_t dst_buffer,
+ FxU32 dst_x,
+ FxU32 dst_y,
+ GrLfbSrcFmt_t src_format,
+ FxU32 src_width,
+ FxU32 src_height,
+ FxBool pixelPipeline,
+ FxI32 src_stride,
+ void *src_data)
+{
+#define FN_NAME "grLfbWriteRegion"
+ FxBool rv;
+ TRAP_LOG("%s(%s, %lu, %lu, %s, %lu, %lu, %s, %ld, %p)\n", FN_NAME, TRP_BUFFER(dst_buffer), dst_x, dst_y, TRP_SRCFMT(src_format), src_width, src_height, TRP_BOOL(pixelPipeline), src_stride, src_data);
+ rv = grLfbWriteRegion(dst_buffer, dst_x, dst_y, src_format, src_width, src_height, pixelPipeline, src_stride, src_data);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+FxBool FX_CALL trap_grLfbReadRegion (GrBuffer_t src_buffer,
+ FxU32 src_x,
+ FxU32 src_y,
+ FxU32 src_width,
+ FxU32 src_height,
+ FxU32 dst_stride,
+ void *dst_data)
+{
+#define FN_NAME "grLfbReadRegion"
+ FxBool rv;
+ TRAP_LOG("%s(%s, %lu, %lu, %lu, %lu, %ld, %p)\n", FN_NAME, TRP_BUFFER(src_buffer), src_x, src_y, src_width, src_height, dst_stride, dst_data);
+ rv = grLfbReadRegion(src_buffer, src_x, src_y, src_width, src_height, dst_stride, dst_data);
+ TRAP_LOG(GOT "%s\n", TRP_BOOL(rv));
+ return rv;
+#undef FN_NAME
+}
+
+/*
+** glide management functions
+*/
+void FX_CALL trap_grGlideInit (void)
+{
+#define FN_NAME "grGlideInit"
+ TRAP_LOG("%s()\n", FN_NAME);
+ grGlideInit();
+#undef FN_NAME
+}
+
+void FX_CALL trap_grGlideShutdown (void)
+{
+#define FN_NAME "grGlideShutdown"
+ TRAP_LOG("%s()\n", FN_NAME);
+ grGlideShutdown();
+#undef FN_NAME
+}
+
+void FX_CALL trap_grGlideGetState (void *state)
+{
+#define FN_NAME "grGlideGetState"
+ TRAP_LOG("%s(%p)\n", FN_NAME, state);
+ grGlideGetState(state);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grGlideSetState (const void *state)
+{
+#define FN_NAME "grGlideSetState"
+ TRAP_LOG("%s(%p)\n", FN_NAME, state);
+ grGlideSetState(state);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grGlideGetVertexLayout (void *layout)
+{
+#define FN_NAME "grGlideGetVertexLayout"
+ TRAP_LOG("%s(%p)\n", FN_NAME, layout);
+ grGlideGetVertexLayout(layout);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grGlideSetVertexLayout (const void *layout)
+{
+#define FN_NAME "grGlideSetVertexLayout"
+ TRAP_LOG("%s(%p)\n", FN_NAME, layout);
+ grGlideSetVertexLayout(layout);
+#undef FN_NAME
+}
+
+/*
+** glide utility functions
+*/
+void FX_CALL trap_guGammaCorrectionRGB (FxFloat red,
+ FxFloat green,
+ FxFloat blue)
+{
+#define FN_NAME "guGammaCorrectionRGB"
+ TRAP_LOG("%s(%f, %f, %f)\n", FN_NAME, red, green, blue);
+ guGammaCorrectionRGB(red, green, blue);
+#undef FN_NAME
+}
+
+float FX_CALL trap_guFogTableIndexToW (int i)
+{
+#define FN_NAME "guFogTableIndexToW"
+ float rv;
+ TRAP_LOG("%s(%d)\n", FN_NAME, i);
+ rv = guFogTableIndexToW(i);
+ TRAP_LOG(GOT "%f\n", rv);
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_guFogGenerateExp (GrFog_t *fogtable,
+ float density)
+{
+#define FN_NAME "guFogGenerateExp"
+ TRAP_LOG("%s(%p, %f)\n", FN_NAME, fogtable, density);
+ guFogGenerateExp(fogtable, density);
+#undef FN_NAME
+}
+
+void FX_CALL trap_guFogGenerateExp2 (GrFog_t *fogtable,
+ float density)
+{
+#define FN_NAME "guFogGenerateExp2"
+ TRAP_LOG("%s(%p, %f)\n", FN_NAME, fogtable, density);
+ guFogGenerateExp2(fogtable, density);
+#undef FN_NAME
+}
+
+void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable,
+ float nearZ,
+ float farZ)
+{
+#define FN_NAME "guFogGenerateLinear"
+ TRAP_LOG("%s(%p, %f, %f)\n", FN_NAME, fogtable, nearZ, farZ);
+ guFogGenerateLinear(fogtable, nearZ, farZ);
+#undef FN_NAME
+}
+
+/*
+** glide extensions
+*/
+char *FX_CALL trap_grGetRegistryOrEnvironmentStringExt (char *theEntry)
+{
+#define FN_NAME "grGetRegistryOrEnvironmentStringExt"
+ char *rv;
+ TRAP_LOG("%s(\"%s\")\n", FN_NAME, theEntry);
+ assert(real_grGetRegistryOrEnvironmentStringExt);
+ rv = (*real_grGetRegistryOrEnvironmentStringExt)(theEntry);
+ if (rv) {
+ TRAP_LOG(GOT "\"%s\"\n", rv);
+ } else {
+ TRAP_LOG(GOT "NULL\n");
+ }
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grGetGammaTableExt (FxU32 nentries,
+ FxU32 *red,
+ FxU32 *green,
+ FxU32 *blue)
+{
+#define FN_NAME "grGetGammaTableExt"
+ TRAP_LOG("%s(%lu, %p, %p, %p)\n", FN_NAME, nentries, (void *)red, (void *)green, (void *)blue);
+ assert(real_grGetGammaTableExt);
+ (*real_grGetGammaTableExt)(nentries, red, green, blue);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grChromaRangeModeExt (GrChromakeyMode_t mode)
+{
+#define FN_NAME "grChromaRangeModeExt"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_CKMODE(mode));
+ assert(real_grChromaRangeModeExt);
+ (*real_grChromaRangeModeExt)(mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grChromaRangeExt (GrColor_t color,
+ GrColor_t range,
+ GrChromaRangeMode_t match_mode)
+{
+#define FN_NAME "grChromaRangeExt"
+ TRAP_LOG("%s(%08lx, %08lx, %s)\n", FN_NAME, color, range, TRP_CRMODE(match_mode));
+ assert(real_grChromaRangeExt);
+ (*real_grChromaRangeExt)(color, range, match_mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexChromaModeExt (GrChipID_t tmu,
+ GrChromakeyMode_t mode)
+{
+#define FN_NAME "grTexChromaModeExt"
+ TRAP_LOG("%s(%s, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CKMODE(mode));
+ assert(real_grTexChromaModeExt);
+ (*real_grTexChromaModeExt)(tmu, mode);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexChromaRangeExt (GrChipID_t tmu,
+ GrColor_t min,
+ GrColor_t max,
+ GrTexChromakeyMode_t mode)
+{
+#define FN_NAME "grTexChromaRangeExt"
+ TRAP_LOG("%s(%s, %08lx, %08lx, %s)\n", FN_NAME, TRP_TMU(tmu), min, max, TRP_CRMODE(mode));
+ assert(real_grTexChromaRangeExt);
+ (*real_grTexChromaRangeExt)(tmu, min, max, mode);
+#undef FN_NAME
+}
+
+ /* tbext */
+void FX_CALL trap_grTextureBufferExt (GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t thisLOD,
+ GrLOD_t largeLOD,
+ GrAspectRatio_t aspectRatio,
+ GrTextureFormat_t format,
+ FxU32 odd_even_mask)
+{
+#define FN_NAME "grTextureBufferExt"
+ TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLOD), TRP_LODLEVEL(largeLOD), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(odd_even_mask));
+ assert(real_grTextureBufferExt);
+ (*real_grTextureBufferExt)(tmu, startAddress, thisLOD, largeLOD, aspectRatio, format, odd_even_mask);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTextureAuxBufferExt (GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t thisLOD,
+ GrLOD_t largeLOD,
+ GrAspectRatio_t aspectRatio,
+ GrTextureFormat_t format,
+ FxU32 odd_even_mask)
+{
+#define FN_NAME "grTextureAuxBufferExt"
+ TRAP_LOG("%s(%s, %08lx, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_TMU(tmu), startAddress, TRP_LODLEVEL(thisLOD), TRP_LODLEVEL(largeLOD), TRP_ASPECTRATIO(aspectRatio), TRP_TEXFMT(format), TRP_EVENODD(odd_even_mask));
+ assert(real_grTextureAuxBufferExt);
+ (*real_grTextureAuxBufferExt)(tmu, startAddress, thisLOD, largeLOD, aspectRatio, format, odd_even_mask);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAuxBufferExt (GrBuffer_t buffer)
+{
+#define FN_NAME "grAuxBufferExt"
+ TRAP_LOG("%s(%s)\n", FN_NAME, TRP_BUFFER(buffer));
+ assert(real_grAuxBufferExt);
+ (*real_grAuxBufferExt)(buffer);
+#undef FN_NAME
+}
+
+ /* napalm */
+GrContext_t FX_CALL trap_grSstWinOpenExt (FxU32 hWnd,
+ GrScreenResolution_t resolution,
+ GrScreenRefresh_t refresh,
+ GrColorFormat_t format,
+ GrOriginLocation_t origin,
+ GrPixelFormat_t pixelformat,
+ int nColBuffers,
+ int nAuxBuffers)
+{
+#define FN_NAME "grSstWinOpenExt"
+ GrContext_t rv;
+ TRAP_LOG("%s(%08lx, %s, %s, %s, %s, %s, %d, %d)\n", FN_NAME, hWnd, TRP_RESOLUTION(resolution), TRP_REFRESH(refresh), TRP_COLFMT(format), TRP_ORIGIN(origin), TRP_PIXFMT(pixelformat), nColBuffers, nAuxBuffers);
+ assert(real_grSstWinOpenExt);
+ rv = (*real_grSstWinOpenExt)(hWnd, resolution, refresh, format, origin, pixelformat, nColBuffers, nAuxBuffers);
+ TRAP_LOG(GOT "%p\n", (void *)rv);
+ return rv;
+#undef FN_NAME
+}
+
+void FX_CALL trap_grStencilFuncExt (GrCmpFnc_t fnc,
+ GrStencil_t ref,
+ GrStencil_t mask)
+{
+#define FN_NAME "grStencilFuncExt"
+ TRAP_LOG("%s(%s, %02x, %02x)\n", FN_NAME, TRP_CMPFUNC(fnc), ref, mask);
+ assert(real_grStencilFuncExt);
+ (*real_grStencilFuncExt)(fnc, ref, mask);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grStencilMaskExt (GrStencil_t value)
+{
+#define FN_NAME "grStencilMaskExt"
+ TRAP_LOG("%s(%02x)\n", FN_NAME, value);
+ assert(real_grStencilMaskExt);
+ (*real_grStencilMaskExt)(value);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grStencilOpExt (GrStencilOp_t stencil_fail,
+ GrStencilOp_t depth_fail,
+ GrStencilOp_t depth_pass)
+{
+#define FN_NAME "grStencilOpExt"
+ TRAP_LOG("%s(%s, %s, %s)\n", FN_NAME, TRP_STENCILOP(stencil_fail), TRP_STENCILOP(depth_fail), TRP_STENCILOP(depth_pass));
+ assert(real_grStencilOpExt);
+ (*real_grStencilOpExt)(stencil_fail, depth_fail, depth_pass);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grLfbConstantStencilExt (GrStencil_t value)
+{
+#define FN_NAME "grLfbConstantStencilExt"
+ TRAP_LOG("%s(%02x)\n", FN_NAME, value);
+ assert(real_grLfbConstantStencilExt);
+ (*real_grLfbConstantStencilExt)(value);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grBufferClearExt (GrColor_t color,
+ GrAlpha_t alpha,
+ FxU32 depth,
+ GrStencil_t stencil)
+{
+#define FN_NAME "grBufferClearExt"
+ TRAP_LOG("%s(%08lx, %02x, %08lx, %02x)\n", FN_NAME, color, alpha, depth, stencil);
+ assert(real_grBufferClearExt);
+ (*real_grBufferClearExt)(color, alpha, depth, stencil);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grColorCombineExt (GrCCUColor_t a,
+ GrCombineMode_t a_mode,
+ GrCCUColor_t b,
+ GrCombineMode_t b_mode,
+ GrCCUColor_t c,
+ FxBool c_invert,
+ GrCCUColor_t d,
+ FxBool d_invert,
+ FxU32 shift,
+ FxBool invert)
+{
+#define FN_NAME "grColorCombineExt"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
+ assert(real_grColorCombineExt);
+ (*real_grColorCombineExt)(a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAlphaCombineExt (GrACUColor_t a,
+ GrCombineMode_t a_mode,
+ GrACUColor_t b,
+ GrCombineMode_t b_mode,
+ GrACUColor_t c,
+ FxBool c_invert,
+ GrACUColor_t d,
+ FxBool d_invert,
+ FxU32 shift,
+ FxBool invert)
+{
+#define FN_NAME "grAlphaCombineExt"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
+ assert(real_grAlphaCombineExt);
+ (*real_grAlphaCombineExt)(a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexColorCombineExt (GrChipID_t tmu,
+ GrTCCUColor_t a,
+ GrCombineMode_t a_mode,
+ GrTCCUColor_t b,
+ GrCombineMode_t b_mode,
+ GrTCCUColor_t c,
+ FxBool c_invert,
+ GrTCCUColor_t d,
+ FxBool d_invert,
+ FxU32 shift,
+ FxBool invert)
+{
+#define FN_NAME "grTexColorCombineExt"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
+ assert(real_grTexColorCombineExt);
+ (*real_grTexColorCombineExt)(tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTexAlphaCombineExt (GrChipID_t tmu,
+ GrTACUColor_t a,
+ GrCombineMode_t a_mode,
+ GrTACUColor_t b,
+ GrCombineMode_t b_mode,
+ GrTACUColor_t c,
+ FxBool c_invert,
+ GrTACUColor_t d,
+ FxBool d_invert,
+ FxU32 shift,
+ FxBool invert)
+{
+#define FN_NAME "grTexAlphaCombineExt"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %s, %s, %s, %s, %lu, %s)\n", FN_NAME, TRP_TMU(tmu), TRP_CU(a), TRP_CMBMODE(a_mode), TRP_CU(b), TRP_CMBMODE(b_mode), TRP_CU(c), TRP_BOOL(c_invert), TRP_CU(d), TRP_BOOL(d_invert), shift, TRP_BOOL(invert));
+ assert(real_grTexAlphaCombineExt);
+ (*real_grTexAlphaCombineExt)(tmu, a, a_mode, b, b_mode, c, c_invert, d, d_invert, shift, invert);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grConstantColorValueExt (GrChipID_t tmu,
+ GrColor_t value)
+{
+#define FN_NAME "grConstantColorValueExt"
+ TRAP_LOG("%s(%s, %08lx)\n", FN_NAME, TRP_TMU(tmu), value);
+ assert(real_grConstantColorValueExt);
+ (*real_grConstantColorValueExt)(tmu, value);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grColorMaskExt (FxBool r,
+ FxBool g,
+ FxBool b,
+ FxBool a)
+{
+#define FN_NAME "grColorMaskExt"
+ TRAP_LOG("%s(%s, %s, %s, %s)\n", FN_NAME, TRP_BOOL(r), TRP_BOOL(g), TRP_BOOL(b), TRP_BOOL(a));
+ assert(real_grColorMaskExt);
+ (*real_grColorMaskExt)(r, g, b, a);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grAlphaBlendFunctionExt (GrAlphaBlendFnc_t rgb_sf,
+ GrAlphaBlendFnc_t rgb_df,
+ GrAlphaBlendOp_t rgb_op,
+ GrAlphaBlendFnc_t alpha_sf,
+ GrAlphaBlendFnc_t alpha_df,
+ GrAlphaBlendOp_t alpha_op)
+{
+#define FN_NAME "grAlphaBlendFunctionExt"
+ TRAP_LOG("%s(%s, %s, %s, %s, %s, %s)\n", FN_NAME, TRP_BLEND(rgb_sf), TRP_BLEND(rgb_df), TRP_BLENDOP(rgb_op), TRP_BLEND(alpha_sf), TRP_BLEND(alpha_df), TRP_BLENDOP(alpha_op));
+ assert(real_grAlphaBlendFunctionExt);
+ (*real_grAlphaBlendFunctionExt)(rgb_sf, rgb_df, rgb_op, alpha_sf, alpha_df, alpha_op);
+#undef FN_NAME
+}
+
+void FX_CALL trap_grTBufferWriteMaskExt (FxU32 tmask)
+{
+#define FN_NAME "grTBufferWriteMaskExt"
+ TRAP_LOG("%s(%08lx)\n", FN_NAME, tmask);
+ assert(real_grTBufferWriteMaskExt);
+ (*real_grTBufferWriteMaskExt)(tmask);
+#undef FN_NAME
+}
+#endif
+
+
+
+/****************************************************************************\
+* interface
+\****************************************************************************/
+void tdfx_hook_glide (struct tdfx_glide *Glide)
+{
+#if DEBUG_TRAP
+#define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name
+#else /* DEBUG_TRAP */
+#define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name)
+#endif /* DEBUG_TRAP */
+
+ /*
+ ** glide extensions
+ */
+ GET_EXT_ADDR(grGetRegistryOrEnvironmentStringExt);
+ GET_EXT_ADDR(grGetGammaTableExt);
+ GET_EXT_ADDR(grChromaRangeModeExt);
+ GET_EXT_ADDR(grChromaRangeExt);
+ GET_EXT_ADDR(grTexChromaModeExt);
+ GET_EXT_ADDR(grTexChromaRangeExt);
+ /* tbext */
+ GET_EXT_ADDR(grTextureBufferExt);
+ GET_EXT_ADDR(grTextureAuxBufferExt);
+ GET_EXT_ADDR(grAuxBufferExt);
+ /* napalm */
+ GET_EXT_ADDR(grSstWinOpenExt);
+ GET_EXT_ADDR(grStencilFuncExt);
+ GET_EXT_ADDR(grStencilMaskExt);
+ GET_EXT_ADDR(grStencilOpExt);
+ GET_EXT_ADDR(grLfbConstantStencilExt);
+ GET_EXT_ADDR(grBufferClearExt);
+ GET_EXT_ADDR(grColorCombineExt);
+ GET_EXT_ADDR(grAlphaCombineExt);
+ GET_EXT_ADDR(grTexColorCombineExt);
+ GET_EXT_ADDR(grTexAlphaCombineExt);
+ GET_EXT_ADDR(grConstantColorValueExt);
+ GET_EXT_ADDR(grColorMaskExt);
+ GET_EXT_ADDR(grAlphaBlendFunctionExt);
+ GET_EXT_ADDR(grTBufferWriteMaskExt);
+
+#undef GET_EXT_ADDR
+}
diff --git a/src/mesa/drivers/glide/fxg.h b/src/mesa/drivers/glide/fxg.h
new file mode 100644
index 0000000000..234e52aee8
--- /dev/null
+++ b/src/mesa/drivers/glide/fxg.h
@@ -0,0 +1,352 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 5.0.1
+ *
+ * Copyright (C) 1999-2003 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.
+ */
+
+/*
+ * Mesa/FX device driver. Interface to Glide3.
+ *
+ * Copyright (c) 2003 - Daniel Borca
+ * Email : dborca@users.sourceforge.net
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#ifndef TDFX_GLIDE_H_included
+#define TDFX_GLIDE_H_included
+
+#include <glide.h>
+#include <g3ext.h>
+
+#define DEBUG_TRAP 0
+
+#if DEBUG_TRAP
+/*
+** rendering functions
+*/
+void FX_CALL trap_grDrawPoint (const void *pt);
+void FX_CALL trap_grDrawLine (const void *v1, const void *v2);
+void FX_CALL trap_grDrawTriangle (const void *a, const void *b, const void *c);
+void FX_CALL trap_grVertexLayout (FxU32 param, FxI32 offset, FxU32 mode);
+void FX_CALL trap_grDrawVertexArray (FxU32 mode, FxU32 Count, void *pointers);
+void FX_CALL trap_grDrawVertexArrayContiguous (FxU32 mode, FxU32 Count, void *pointers, FxU32 stride);
+
+/*
+** Antialiasing Functions
+*/
+void FX_CALL trap_grAADrawTriangle (const void *a, const void *b, const void *c, FxBool ab_antialias, FxBool bc_antialias, FxBool ca_antialias);
+
+/*
+** buffer management
+*/
+void FX_CALL trap_grBufferClear (GrColor_t color, GrAlpha_t alpha, FxU32 depth);
+void FX_CALL trap_grBufferSwap (FxU32 swap_interval);
+void FX_CALL trap_grRenderBuffer (GrBuffer_t buffer);
+
+/*
+** error management
+*/
+void FX_CALL trap_grErrorSetCallback (GrErrorCallbackFnc_t fnc);
+
+/*
+** SST routines
+*/
+void FX_CALL trap_grFinish (void);
+void FX_CALL trap_grFlush (void);
+GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers);
+FxBool FX_CALL trap_grSstWinClose (GrContext_t context);
+void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers);
+FxBool FX_CALL trap_grSelectContext (GrContext_t context);
+void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin);
+void FX_CALL trap_grSstSelect (int which_sst);
+
+/*
+** Glide configuration and special effect maintenance functions
+*/
+void FX_CALL trap_grAlphaBlendFunction (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df);
+void FX_CALL trap_grAlphaCombine (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert);
+void FX_CALL trap_grAlphaControlsITRGBLighting (FxBool enable);
+void FX_CALL trap_grAlphaTestFunction (GrCmpFnc_t function);
+void FX_CALL trap_grAlphaTestReferenceValue (GrAlpha_t value);
+void FX_CALL trap_grChromakeyMode (GrChromakeyMode_t mode);
+void FX_CALL trap_grChromakeyValue (GrColor_t value);
+void FX_CALL trap_grClipWindow (FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy);
+void FX_CALL trap_grColorCombine (GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, FxBool invert);
+void FX_CALL trap_grColorMask (FxBool rgb, FxBool a);
+void FX_CALL trap_grCullMode (GrCullMode_t mode);
+void FX_CALL trap_grConstantColorValue (GrColor_t value);
+void FX_CALL trap_grDepthBiasLevel (FxI32 level);
+void FX_CALL trap_grDepthBufferFunction (GrCmpFnc_t function);
+void FX_CALL trap_grDepthBufferMode (GrDepthBufferMode_t mode);
+void FX_CALL trap_grDepthMask (FxBool mask);
+void FX_CALL trap_grDisableAllEffects (void);
+void FX_CALL trap_grDitherMode (GrDitherMode_t mode);
+void FX_CALL trap_grFogColorValue (GrColor_t fogcolor);
+void FX_CALL trap_grFogMode (GrFogMode_t mode);
+void FX_CALL trap_grFogTable (const GrFog_t ft[]);
+void FX_CALL trap_grLoadGammaTable (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
+void FX_CALL trap_grSplash (float x, float y, float width, float height, FxU32 frame);
+FxU32 FX_CALL trap_grGet (FxU32 pname, FxU32 plength, FxI32 *params);
+const char * FX_CALL trap_grGetString (FxU32 pname);
+FxI32 FX_CALL trap_grQueryResolutions (const GrResolution *resTemplate, GrResolution *output);
+FxBool FX_CALL trap_grReset (FxU32 what);
+GrProc FX_CALL trap_grGetProcAddress (char *procName);
+void FX_CALL trap_grEnable (GrEnableMode_t mode);
+void FX_CALL trap_grDisable (GrEnableMode_t mode);
+void FX_CALL trap_grCoordinateSpace (GrCoordinateSpaceMode_t mode);
+void FX_CALL trap_grDepthRange (FxFloat n, FxFloat f);
+void FX_CALL trap_grStippleMode (GrStippleMode_t mode);
+void FX_CALL trap_grStipplePattern (GrStipplePattern_t mode);
+void FX_CALL trap_grViewport (FxI32 x, FxI32 y, FxI32 width, FxI32 height);
+
+/*
+** texture mapping control functions
+*/
+FxU32 FX_CALL trap_grTexCalcMemRequired (GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt);
+FxU32 FX_CALL trap_grTexTextureMemRequired (FxU32 evenOdd, GrTexInfo *info);
+FxU32 FX_CALL trap_grTexMinAddress (GrChipID_t tmu);
+FxU32 FX_CALL trap_grTexMaxAddress (GrChipID_t tmu);
+void FX_CALL trap_grTexNCCTable (GrNCCTable_t table);
+void FX_CALL trap_grTexSource (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
+void FX_CALL trap_grTexClampMode (GrChipID_t tmu, GrTextureClampMode_t s_clampmode, GrTextureClampMode_t t_clampmode);
+void FX_CALL trap_grTexCombine (GrChipID_t tmu, GrCombineFunction_t rgb_function, GrCombineFactor_t rgb_factor, GrCombineFunction_t alpha_function, GrCombineFactor_t alpha_factor, FxBool rgb_invert, FxBool alpha_invert);
+void FX_CALL trap_grTexDetailControl (GrChipID_t tmu, int lod_bias, FxU8 detail_scale, float detail_max);
+void FX_CALL trap_grTexFilterMode (GrChipID_t tmu, GrTextureFilterMode_t minfilter_mode, GrTextureFilterMode_t magfilter_mode);
+void FX_CALL trap_grTexLodBiasValue (GrChipID_t tmu, float bias);
+void FX_CALL trap_grTexDownloadMipMap (GrChipID_t tmu, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
+void FX_CALL trap_grTexDownloadMipMapLevel (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data);
+FxBool FX_CALL trap_grTexDownloadMipMapLevelPartial (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLod, GrLOD_t largeLod, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 evenOdd, void *data, int start, int end);
+void FX_CALL trap_grTexDownloadTable (GrTexTable_t type, void *data);
+void FX_CALL trap_grTexDownloadTablePartial (GrTexTable_t type, void *data, int start, int end);
+void FX_CALL trap_grTexMipMapMode (GrChipID_t tmu, GrMipMapMode_t mode, FxBool lodBlend);
+void FX_CALL trap_grTexMultibase (GrChipID_t tmu, FxBool enable);
+void FX_CALL trap_grTexMultibaseAddress (GrChipID_t tmu, GrTexBaseRange_t range, FxU32 startAddress, FxU32 evenOdd, GrTexInfo *info);
+
+/*
+** linear frame buffer functions
+*/
+FxBool FX_CALL trap_grLfbLock (GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, FxBool pixelPipeline, GrLfbInfo_t *info);
+FxBool FX_CALL trap_grLfbUnlock (GrLock_t type, GrBuffer_t buffer);
+void FX_CALL trap_grLfbConstantAlpha (GrAlpha_t alpha);
+void FX_CALL trap_grLfbConstantDepth (FxU32 depth);
+void FX_CALL trap_grLfbWriteColorSwizzle (FxBool swizzleBytes, FxBool swapWords);
+void FX_CALL trap_grLfbWriteColorFormat (GrColorFormat_t colorFormat);
+FxBool FX_CALL trap_grLfbWriteRegion (GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, FxU32 src_width, FxU32 src_height, FxBool pixelPipeline, FxI32 src_stride, void *src_data);
+FxBool FX_CALL trap_grLfbReadRegion (GrBuffer_t src_buffer, FxU32 src_x, FxU32 src_y, FxU32 src_width, FxU32 src_height, FxU32 dst_stride, void *dst_data);
+
+/*
+** glide management functions
+*/
+void FX_CALL trap_grGlideInit (void);
+void FX_CALL trap_grGlideShutdown (void);
+void FX_CALL trap_grGlideGetState (void *state);
+void FX_CALL trap_grGlideSetState (const void *state);
+void FX_CALL trap_grGlideGetVertexLayout (void *layout);
+void FX_CALL trap_grGlideSetVertexLayout (const void *layout);
+
+/*
+** glide utility functions
+*/
+void FX_CALL trap_guGammaCorrectionRGB (FxFloat red, FxFloat green, FxFloat blue);
+float FX_CALL trap_guFogTableIndexToW (int i);
+void FX_CALL trap_guFogGenerateExp (GrFog_t *fogtable, float density);
+void FX_CALL trap_guFogGenerateExp2 (GrFog_t *fogtable, float density);
+void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable, float nearZ, float farZ);
+
+#ifndef DEBUG_TRAP_internal
+/*
+** rendering functions
+*/
+#define grDrawPoint trap_grDrawPoint
+#define grDrawLine trap_grDrawLine
+#define grDrawTriangle trap_grDrawTriangle
+#define grVertexLayout trap_grVertexLayout
+#define grDrawVertexArray trap_grDrawVertexArray
+#define grDrawVertexArrayContiguous trap_grDrawVertexArrayContiguous
+
+/*
+** Antialiasing Functions
+*/
+#define grAADrawTriangle trap_grAADrawTriangle
+
+/*
+** buffer management
+*/
+#define grBufferClear trap_grBufferClear
+#define grBufferSwap trap_grBufferSwap
+#define grRenderBuffer trap_grRenderBuffer
+
+/*
+** error management
+*/
+#define grErrorSetCallback trap_grErrorSetCallback
+
+/*
+** SST routines
+*/
+#define grFinish trap_grFinish
+#define grFlush trap_grFlush
+#define grSstWinOpen trap_grSstWinOpen
+#define grSstWinClose trap_grSstWinClose
+#define grSetNumPendingBuffers trap_grSetNumPendingBuffers
+#define grSelectContext trap_grSelectContext
+#define grSstOrigin trap_grSstOrigin
+#define grSstSelect trap_grSstSelect
+
+/*
+** Glide configuration and special effect maintenance functions
+*/
+#define grAlphaBlendFunction trap_grAlphaBlendFunction
+#define grAlphaCombine trap_grAlphaCombine
+#define grAlphaControlsITRGBLighting trap_grAlphaControlsITRGBLighting
+#define grAlphaTestFunction trap_grAlphaTestFunction
+#define grAlphaTestReferenceValue trap_grAlphaTestReferenceValue
+#define grChromakeyMode trap_grChromakeyMode
+#define grChromakeyValue trap_grChromakeyValue
+#define grClipWindow trap_grClipWindow
+#define grColorCombine trap_grColorCombine
+#define grColorMask trap_grColorMask
+#define grCullMode trap_grCullMode
+#define grConstantColorValue trap_grConstantColorValue
+#define grDepthBiasLevel trap_grDepthBiasLevel
+#define grDepthBufferFunction trap_grDepthBufferFunction
+#define grDepthBufferMode trap_grDepthBufferMode
+#define grDepthMask trap_grDepthMask
+#define grDisableAllEffects trap_grDisableAllEffects
+#define grDitherMode trap_grDitherMode
+#define grFogColorValue trap_grFogColorValue
+#define grFogMode trap_grFogMode
+#define grFogTable trap_grFogTable
+#define grLoadGammaTable trap_grLoadGammaTable
+#define grSplash trap_grSplash
+#define grGet trap_grGet
+#define grGetString trap_grGetString
+#define grQueryResolutions trap_grQueryResolutions
+#define grReset trap_grReset
+#define grGetProcAddress trap_grGetProcAddress
+#define grEnable trap_grEnable
+#define grDisable trap_grDisable
+#define grCoordinateSpace trap_grCoordinateSpace
+#define grDepthRange trap_grDepthRange
+#define grStippleMode trap_grStippleMode
+#define grStipplePattern trap_grStipplePattern
+#define grViewport trap_grViewport
+
+/*
+** texture mapping control functions
+*/
+#define grTexCalcMemRequired trap_grTexCalcMemRequired
+#define grTexTextureMemRequired trap_grTexTextureMemRequired
+#define grTexMinAddress trap_grTexMinAddress
+#define grTexMaxAddress trap_grTexMaxAddress
+#define grTexNCCTable trap_grTexNCCTable
+#define grTexSource trap_grTexSource
+#define grTexClampMode trap_grTexClampMode
+#define grTexCombine trap_grTexCombine
+#define grTexDetailControl trap_grTexDetailControl
+#define grTexFilterMode trap_grTexFilterMode
+#define grTexLodBiasValue trap_grTexLodBiasValue
+#define grTexDownloadMipMap trap_grTexDownloadMipMap
+#define grTexDownloadMipMapLevel trap_grTexDownloadMipMapLevel
+#define grTexDownloadMipMapLevelPartial trap_grTexDownloadMipMapLevelPartial
+#define grTexDownloadTable trap_grTexDownloadTable
+#define grTexDownloadTablePartial trap_grTexDownloadTablePartial
+#define grTexMipMapMode trap_grTexMipMapMode
+#define grTexMultibase trap_grTexMultibase
+#define grTexMultibaseAddress trap_grTexMultibaseAddress
+
+/*
+** linear frame buffer functions
+*/
+#define grLfbLock trap_grLfbLock
+#define grLfbUnlock trap_grLfbUnlock
+#define grLfbConstantAlpha trap_grLfbConstantAlpha
+#define grLfbConstantDepth trap_grLfbConstantDepth
+#define grLfbWriteColorSwizzle trap_grLfbWriteColorSwizzle
+#define grLfbWriteColorFormat trap_grLfbWriteColorFormat
+#define grLfbWriteRegion trap_grLfbWriteRegion
+#define grLfbReadRegion trap_grLfbReadRegion
+
+/*
+** glide management functions
+*/
+#define grGlideInit trap_grGlideInit
+#define grGlideShutdown trap_grGlideShutdown
+#define grGlideGetState trap_grGlideGetState
+#define grGlideSetState trap_grGlideSetState
+#define grGlideGetVertexLayout trap_grGlideGetVertexLayout
+#define grGlideSetVertexLayout trap_grGlideSetVertexLayout
+
+/*
+** glide utility functions
+*/
+#define guGammaCorrectionRGB trap_guGammaCorrectionRGB
+#define guFogTableIndexToW trap_guFogTableIndexToW
+#define guFogGenerateExp trap_guFogGenerateExp
+#define guFogGenerateExp2 trap_guFogGenerateExp2
+#define guFogGenerateLinear trap_guFogGenerateLinear
+#endif /* DEBUG_TRAP_internal */
+#endif /* DEBUG_TRAP */
+
+struct tdfx_glide {
+ /*
+ ** glide extensions
+ */
+ char * (FX_CALL *grGetRegistryOrEnvironmentStringExt) (char *theEntry);
+ void (FX_CALL *grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue);
+ void (FX_CALL *grChromaRangeModeExt) (GrChromakeyMode_t mode);
+ void (FX_CALL *grChromaRangeExt) (GrColor_t color, GrColor_t range, GrChromaRangeMode_t match_mode);
+ void (FX_CALL *grTexChromaModeExt) (GrChipID_t tmu, GrChromakeyMode_t mode);
+ void (FX_CALL *grTexChromaRangeExt) (GrChipID_t tmu, GrColor_t min, GrColor_t max, GrTexChromakeyMode_t mode);
+
+ /* tbext */
+ void (FX_CALL *grTextureBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
+ void (FX_CALL *grTextureAuxBufferExt) (GrChipID_t tmu, FxU32 startAddress, GrLOD_t thisLOD, GrLOD_t largeLOD, GrAspectRatio_t aspectRatio, GrTextureFormat_t format, FxU32 odd_even_mask);
+ void (FX_CALL *grAuxBufferExt) (GrBuffer_t buffer);
+
+ /* napalm */
+ GrContext_t (FX_CALL *grSstWinOpenExt) (FxU32 hWnd, GrScreenResolution_t resolution, GrScreenRefresh_t refresh, GrColorFormat_t format, GrOriginLocation_t origin, GrPixelFormat_t pixelformat, int nColBuffers, int nAuxBuffers);
+ void (FX_CALL *grStencilFuncExt) (GrCmpFnc_t fnc, GrStencil_t ref, GrStencil_t mask);
+ void (FX_CALL *grStencilMaskExt) (GrStencil_t value);
+ void (FX_CALL *grStencilOpExt) (GrStencilOp_t stencil_fail, GrStencilOp_t depth_fail, GrStencilOp_t depth_pass);
+ void (FX_CALL *grLfbConstantStencilExt) (GrStencil_t value);
+ void (FX_CALL *grBufferClearExt) (GrColor_t color, GrAlpha_t alpha, FxU32 depth, GrStencil_t stencil);
+ void (FX_CALL *grColorCombineExt) (GrCCUColor_t a, GrCombineMode_t a_mode, GrCCUColor_t b, GrCombineMode_t b_mode, GrCCUColor_t c, FxBool c_invert, GrCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+ void (FX_CALL *grAlphaCombineExt) (GrACUColor_t a, GrCombineMode_t a_mode, GrACUColor_t b, GrCombineMode_t b_mode, GrACUColor_t c, FxBool c_invert, GrACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+ void (FX_CALL *grTexColorCombineExt) (GrChipID_t tmu, GrTCCUColor_t a, GrCombineMode_t a_mode, GrTCCUColor_t b, GrCombineMode_t b_mode, GrTCCUColor_t c, FxBool c_invert, GrTCCUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+ void (FX_CALL *grTexAlphaCombineExt) (GrChipID_t tmu, GrTACUColor_t a, GrCombineMode_t a_mode, GrTACUColor_t b, GrCombineMode_t b_mode, GrTACUColor_t c, FxBool c_invert, GrTACUColor_t d, FxBool d_invert, FxU32 shift, FxBool invert);
+ void (FX_CALL *grConstantColorValueExt) (GrChipID_t tmu, GrColor_t value);
+ void (FX_CALL *grColorMaskExt) (FxBool r, FxBool g, FxBool b, FxBool a);
+ void (FX_CALL *grAlphaBlendFunctionExt) (GrAlphaBlendFnc_t rgb_sf, GrAlphaBlendFnc_t rgb_df, GrAlphaBlendOp_t rgb_op, GrAlphaBlendFnc_t alpha_sf, GrAlphaBlendFnc_t alpha_df, GrAlphaBlendOp_t alpha_op);
+ void (FX_CALL *grTBufferWriteMaskExt) (FxU32 tmask);
+
+ /*
+ ** Texus2 functions
+ */
+ void (*txImgQuantize) (void *xxx_unknown_arguments);
+ void (*txImgDequantizeFXT1) (void *txMip, void *pxMip);
+ void (*txErrorSetCallback) (void *fnc);
+};
+
+void tdfx_hook_glide (struct tdfx_glide *Glide);
+
+#endif
diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c
index 69fbebdec8..6e89f00ed8 100644
--- a/src/mesa/drivers/glide/fxglidew.c
+++ b/src/mesa/drivers/glide/fxglidew.c
@@ -1,4 +1,4 @@
-/* $Id: fxglidew.c,v 1.21 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxglidew.c,v 1.22 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -41,7 +41,6 @@
#endif
#if defined(FX)
-#include "glide.h"
#include "fxglidew.h"
#include "fxdrv.h"
@@ -57,8 +56,8 @@ FX_grGetInteger_NoLock(FxU32 pname)
return result;
}
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: wrong parameter (%lx)\n", __FUNCTION__, pname);
}
return -1;
}
@@ -122,23 +121,6 @@ FX_grSstPerfStats(GrSstPerfStats_t * st)
}
void
-FX_grAADrawLine(GrVertex * a, GrVertex * b)
-{
- /* ToDo */
- BEGIN_CLIP_LOOP();
- grDrawLine(a, b);
- END_CLIP_LOOP();
-}
-
-void
-FX_grAADrawPoint(GrVertex * a)
-{
- BEGIN_CLIP_LOOP();
- grDrawPoint(a);
- END_CLIP_LOOP();
-}
-
-void
FX_setupGrVertexLayout(void)
{
BEGIN_BOARD_LOCK();
@@ -146,8 +128,7 @@ FX_setupGrVertexLayout(void)
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE);
grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2,
@@ -229,84 +210,40 @@ FX_grSstQueryHardware(GrHwConfiguration * config)
}
grGet(GR_MEMORY_FB, 4, &result);
- config->SSTs[i].VoodooConfig.fbRam = result / (1024 * 1024);
+ config->SSTs[i].fbRam = result / (1024 * 1024);
grGet(GR_NUM_TMU, 4, &result);
- config->SSTs[i].VoodooConfig.nTexelfx = result;
+ config->SSTs[i].nTexelfx = result;
grGet(GR_REVISION_FB, 4, &result);
- config->SSTs[i].VoodooConfig.fbiRev = result;
+ config->SSTs[i].fbiRev = result;
- for (j = 0; j < config->SSTs[i].VoodooConfig.nTexelfx; j++) {
+ for (j = 0; j < config->SSTs[i].nTexelfx; j++) {
grGet(GR_MEMORY_TMU, 4, &result);
- config->SSTs[i].VoodooConfig.tmuConfig[j].tmuRam = result / (1024 * 1024);
+ config->SSTs[i].tmuConfig[j].tmuRam = result / (1024 * 1024);
grGet(GR_REVISION_TMU, 4, &result);
- config->SSTs[i].VoodooConfig.tmuConfig[j].tmuRev = result;
+ config->SSTs[i].tmuConfig[j].tmuRev = result;
}
extension = grGetString(GR_EXTENSION);
- if (strstr(extension, " PIXEXT ")) {
- config->SSTs[i].VoodooConfig.grSstWinOpenExt = grGetProcAddress("grSstWinOpenExt");
- }
-
- /* [koolsmoky] */
- grGet(GR_MAX_TEXTURE_SIZE, 4, &result);
- config->SSTs[i].VoodooConfig.maxTextureSize = result;
+ config->SSTs[i].HavePixExt = (strstr(extension, " PIXEXT ") != NULL);
+ config->SSTs[i].HaveTexFmt = (strstr(extension, " TEXFMT ") != NULL);
+ config->SSTs[i].HaveCmbExt = (strstr(extension, " COMBINE ") != NULL);
+ config->SSTs[i].HaveMirExt = (strstr(extension, " TEXMIRROR ") != NULL);
+ config->SSTs[i].HaveTexus2 = GL_FALSE;
/* need to get the number of SLI units for napalm */
grGet(GR_NUM_FB, 4, (void *) &numFB);
- config->SSTs[i].VoodooConfig.numChips = numFB;
+ config->SSTs[i].numChips = numFB;
/* this can only be useful for Voodoo2:
* sliDetect = ((config->SSTs[i].type == GR_SSTTYPE_Voodoo2) && (numFB > 1));
*/
}
- END_BOARD_LOCK();
- return 1;
-}
+ tdfx_hook_glide(&config->Glide);
-/* It appears to me that this function is needed either way. */
-GrContext_t
-FX_grSstWinOpen(struct SstCard_St *c,
- FxU32 hWnd,
- GrScreenResolution_t screen_resolution,
- GrScreenRefresh_t refresh_rate,
- GrColorFormat_t color_format,
- GrPixelFormat_t pixel_format,
- GrOriginLocation_t origin_location,
- int nColBuffers, int nAuxBuffers)
-{
- GrContext_t i;
- BEGIN_BOARD_LOCK();
- if (c->VoodooConfig.grSstWinOpenExt) {
- i = c->VoodooConfig.grSstWinOpenExt(hWnd,
- screen_resolution,
- refresh_rate,
- color_format, origin_location,
- pixel_format,
- nColBuffers, nAuxBuffers);
- } else
- i = grSstWinOpen(hWnd,
- screen_resolution,
- refresh_rate,
- color_format, origin_location, nColBuffers, nAuxBuffers);
-
- /*
- fprintf(stderr,
- "grSstWinOpen( win %d res %d ref %d fmt %d\n"
- " org %d ncol %d naux %d )\n"
- " ==> %d\n",
- hWnd,
- screen_resolution,
- refresh_rate,
- color_format,
- origin_location,
- nColBuffers,
- nAuxBuffers,
- i);
- */
END_BOARD_LOCK();
- return i;
+ return 1;
}
diff --git a/src/mesa/drivers/glide/fxglidew.h b/src/mesa/drivers/glide/fxglidew.h
index a09df0b48c..f6177e4ff5 100644
--- a/src/mesa/drivers/glide/fxglidew.h
+++ b/src/mesa/drivers/glide/fxglidew.h
@@ -1,4 +1,4 @@
-/* $Id: fxglidew.h,v 1.15 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxglidew.h,v 1.16 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -38,43 +38,10 @@
#define __FX_GLIDE_WARPER__
-#include <glide.h>
-#include <g3ext.h>
+#include "fxg.h"
-#define FX_grGetInteger FX_grGetInteger_NoLock
-extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
-
-
-
-#define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1
-#define GR_ASPECT_2x1 GR_ASPECT_LOG2_2x1
-#define GR_ASPECT_4x1 GR_ASPECT_LOG2_4x1
-#define GR_ASPECT_8x1 GR_ASPECT_LOG2_8x1
-#define GR_ASPECT_1x2 GR_ASPECT_LOG2_1x2
-#define GR_ASPECT_1x4 GR_ASPECT_LOG2_1x4
-#define GR_ASPECT_1x8 GR_ASPECT_LOG2_1x8
-
-#define GR_LOD_2048 GR_LOD_LOG2_2048 /* [koolsmoky] big texture support for napalm */
-#define GR_LOD_1024 GR_LOD_LOG2_1024
-#define GR_LOD_512 GR_LOD_LOG2_512
-#define GR_LOD_256 GR_LOD_LOG2_256
-#define GR_LOD_128 GR_LOD_LOG2_128
-#define GR_LOD_64 GR_LOD_LOG2_64
-#define GR_LOD_32 GR_LOD_LOG2_32
-#define GR_LOD_16 GR_LOD_LOG2_16
-#define GR_LOD_8 GR_LOD_LOG2_8
-#define GR_LOD_4 GR_LOD_LOG2_4
-#define GR_LOD_2 GR_LOD_LOG2_2
-#define GR_LOD_1 GR_LOD_LOG2_1
-
-#define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q
-
-
-
-typedef int GrSstType;
-
#define MAX_NUM_SST 4
enum {
@@ -88,29 +55,33 @@ enum {
GR_SSTTYPE_Voodoo5 = 7
};
+#define GrState void
+
+typedef int GrSstType;
+
typedef struct GrTMUConfig_St {
int tmuRev; /* Rev of Texelfx chip */
int tmuRam; /* 1, 2, or 4 MB */
} GrTMUConfig_t;
-typedef struct GrVoodooConfig_St {
- int fbRam; /* 1, 2, or 4 MB */
- int fbiRev; /* Rev of Pixelfx chip */
- int nTexelfx; /* How many texelFX chips are there? */
- GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
- int maxTextureSize;
- int numChips; /* Number of Voodoo chips [koolsmoky] */
- /* Glide3 extensions */
- GrProc grSstWinOpenExt;
-} GrVoodooConfig_t;
-
typedef struct {
int num_sst; /* # of HW units in the system */
struct SstCard_St {
GrSstType type; /* Which hardware is it? */
- GrVoodooConfig_t VoodooConfig;
+ int fbRam; /* 1, 2, or 4 MB */
+ int fbiRev; /* Rev of Pixelfx chip */
+ int nTexelfx; /* How many texelFX chips are there? */
+ int numChips; /* Number of Voodoo chips [koolsmoky] */
+ GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
+ /* Glide3 extensions */
+ FxBool HavePixExt; /* PIXEXT */
+ FxBool HaveTexFmt; /* TEXFMT */
+ FxBool HaveCmbExt; /* COMBINE */
+ FxBool HaveMirExt; /* TEXMIRROR */
+ FxBool HaveTexus2; /* Texus 2 - FXT1 */
}
SSTs[MAX_NUM_SST]; /* configuration for each board */
+ struct tdfx_glide Glide;
} GrHwConfiguration;
@@ -133,10 +104,6 @@ typedef FxU32 GrSTWHint_t;
-#define GrState void
-
-
-
/*
** move the vertex layout defintion to application
*/
@@ -147,29 +114,38 @@ typedef struct {
} GrTmuVertex;
typedef struct {
- float x, y, z; /* X, Y, and Z of scrn space -- Z is ignored */
- float r, g, b; /* R, G, B, ([0..255.0]) */
+ float x, y; /* X and Y in screen space */
float ooz; /* 65535/Z (used for Z-buffering) */
- float a; /* Alpha [0..255.0] */
float oow; /* 1/W (used for W-buffering, texturing) */
+ unsigned char pargb[4]; /* B, G, R, A [0..255] */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
+ long pad[16 - 11]; /* future use; also ensure 64b structure */
} GrVertex;
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
-#define GR_VERTEX_Z_OFFSET 2
-#define GR_VERTEX_R_OFFSET 3
-#define GR_VERTEX_G_OFFSET 4
-#define GR_VERTEX_B_OFFSET 5
-#define GR_VERTEX_OOZ_OFFSET 6
-#define GR_VERTEX_A_OFFSET 7
-#define GR_VERTEX_OOW_OFFSET 8
-#define GR_VERTEX_SOW_TMU0_OFFSET 9
-#define GR_VERTEX_TOW_TMU0_OFFSET 10
-#define GR_VERTEX_OOW_TMU0_OFFSET 11
-#define GR_VERTEX_SOW_TMU1_OFFSET 12
-#define GR_VERTEX_TOW_TMU1_OFFSET 13
-#define GR_VERTEX_OOW_TMU1_OFFSET 14
+#define GR_VERTEX_OOZ_OFFSET 2
+#define GR_VERTEX_OOW_OFFSET 3
+#define GR_VERTEX_PARGB_OFFSET 4
+#define GR_VERTEX_SOW_TMU0_OFFSET 5
+#define GR_VERTEX_TOW_TMU0_OFFSET 6
+#define GR_VERTEX_OOW_TMU0_OFFSET 7
+#define GR_VERTEX_SOW_TMU1_OFFSET 8
+#define GR_VERTEX_TOW_TMU1_OFFSET 9
+#define GR_VERTEX_OOW_TMU1_OFFSET 10
+
+
+
+/*
+ * For Lod/LodLog2 conversion.
+ */
+#define FX_largeLodLog2(info) (info).largeLodLog2
+#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
+#define FX_smallLodLog2(info) (info).smallLodLog2
+#define FX_lodToValue(val) ((int)(GR_LOD_LOG2_256-val))
+#define FX_largeLodValue(info) ((int)(GR_LOD_LOG2_256-(info).largeLodLog2))
+#define FX_smallLodValue(info) ((int)(GR_LOD_LOG2_256-(info).smallLodLog2))
+#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_LOG2_256-val))
@@ -194,31 +170,6 @@ typedef struct {
/*
- * Draw triangle
- */
-#define FX_grDrawTriangle(a,b,c)\
- do { \
- BEGIN_CLIP_LOOP(); \
- grDrawTriangle(a,b,c); \
- END_CLIP_LOOP(); \
- } while (0)
-
-
-
-/*
- * For Lod/LodLog2 conversion.
- */
-#define FX_largeLodLog2(info) (info).largeLodLog2
-#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
-#define FX_smallLodLog2(info) (info).smallLodLog2
-#define FX_lodToValue(val) ((int)(GR_LOD_256-val))
-#define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2))
-#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
-#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
-
-
-
-/*
* ScreenWidth/Height stuff.
*/
extern int FX_grSstScreenWidth(void);
@@ -231,6 +182,8 @@ extern int FX_grSstScreenHeight(void);
*/
extern void FX_grSstPerfStats(GrSstPerfStats_t *st);
extern int FX_grSstQueryHardware(GrHwConfiguration *config);
+#define FX_grGetInteger FX_grGetInteger_NoLock
+extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
@@ -243,14 +196,6 @@ extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
/*
- * Antialiashed line+point drawing.
- */
-extern void FX_grAADrawLine(GrVertex *a, GrVertex *b);
-extern void FX_grAADrawPoint(GrVertex *a);
-
-
-
-/*
* Needed for Glide3 only, to set up Glide2 compatible vertex layout.
*/
extern void FX_setupGrVertexLayout(void);
@@ -262,39 +207,6 @@ extern void FX_setupGrVertexLayout(void);
*/
extern FxBool FX_grSstControl(FxU32 code);
-
-
-extern GrContext_t FX_grSstWinOpen(struct SstCard_St *c,
- FxU32 hWnd,
- GrScreenResolution_t screen_resolution,
- GrScreenRefresh_t refresh_rate,
- GrColorFormat_t color_format,
- GrPixelFormat_t pixel_format,
- GrOriginLocation_t origin_location,
- int nColBuffers, int nAuxBuffers);
-
-
-#define FX_grDrawLine(v1, v2) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grDrawLine(v1, v2); \
- END_CLIP_LOOP(); \
- } while (0)
-
-#define FX_grDrawPoint(p) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grDrawPoint(p); \
- END_CLIP_LOOP(); \
- } while (0)
-
-#define FX_grDrawPolygonVertexList(n, v) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grDrawVertexArrayContiguous(GR_POLYGON, n, v, sizeof(GrVertex)); \
- END_CLIP_LOOP(); \
- } while (0)
-
#define FX_grBufferClear(c, a, d) \
do { \
BEGIN_CLIP_LOOP(); \
@@ -303,21 +215,12 @@ extern GrContext_t FX_grSstWinOpen(struct SstCard_St *c,
} while (0)
-#define FX_grAADrawTriangle(a, b, c, ab, bc, ca) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grAADrawTriangle(a, b, c, ab, bc, ca); \
- END_CLIP_LOOP(); \
- } while (0)
-
-
-#define FX_grDrawVertexArray(m, c, p) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grDrawVertexArray(m, c, p); \
- END_CLIP_LOOP(); \
- } while (0)
+#if FX_DEBUG
+extern int TDFX_DEBUG;
+#else
+#define TDFX_DEBUG 0
+#endif
diff --git a/src/mesa/drivers/glide/fxopengl.def b/src/mesa/drivers/glide/fxopengl.def
index cb321670ce..9d0d3eb501 100644
--- a/src/mesa/drivers/glide/fxopengl.def
+++ b/src/mesa/drivers/glide/fxopengl.def
@@ -1,197 +1,501 @@
EXPORTS
glAccum
+ glActiveStencilFaceEXT
+ glActiveTexture
+ glActiveTextureARB
glAlphaFunc
+ glAreProgramsResidentNV
glAreTexturesResident
+ glAreTexturesResidentEXT
glArrayElement
+ glArrayElementEXT
glBegin
+ glBeginQueryARB
+ glBindBufferARB
+ glBindProgramARB
+ glBindProgramNV
glBindTexture
+ glBindTextureEXT
glBitmap
+ glBlendColor
+ glBlendColorEXT
+ glBlendEquation
+ glBlendEquationEXT
glBlendFunc
+ glBlendFuncSeparate
+ glBlendFuncSeparateEXT
+ glBlendFuncSeparateINGR
+ glBufferDataARB
+ glBufferSubDataARB
glCallList
glCallLists
glClear
glClearAccum
- glClearIndex
glClearColor
glClearDepth
+ glClearIndex
glClearStencil
+ glClientActiveTexture
+ glClientActiveTextureARB
glClipPlane
+ glColorMask
+ glColorMaterial
+ glColorPointer
+ glColorPointerEXT
+ glColorSubTable
+ glColorSubTableEXT
+ glColorTable
+ glColorTableEXT
+ glColorTableParameterfv
+ glColorTableParameterfvSGI
+ glColorTableParameteriv
+ glColorTableParameterivSGI
+ glColorTableSGI
glColor3b
- glColor3d
- glColor3f
- glColor3i
- glColor3s
- glColor3ub
- glColor3ui
- glColor3us
- glColor4b
- glColor4d
- glColor4f
- glColor4i
- glColor4s
- glColor4ub
- glColor4ui
- glColor4us
glColor3bv
+ glColor3d
glColor3dv
+ glColor3f
glColor3fv
+ glColor3i
glColor3iv
+ glColor3s
glColor3sv
+ glColor3ub
glColor3ubv
+ glColor3ui
glColor3uiv
+ glColor3us
glColor3usv
+ glColor4b
glColor4bv
+ glColor4d
glColor4dv
+ glColor4f
glColor4fv
+ glColor4i
glColor4iv
+ glColor4s
glColor4sv
+ glColor4ub
glColor4ubv
+ glColor4ui
glColor4uiv
+ glColor4us
glColor4usv
- glColorMask
- glColorMaterial
- glColorPointer
- glColorTableEXT
- glColorSubTableEXT
+ glCombinerInputNV
+ glCombinerOutputNV
+ glCombinerParameterfNV
+ glCombinerParameterfvNV
+ glCombinerParameteriNV
+ glCombinerParameterivNV
+ glCompressedTexImage1D
+ glCompressedTexImage1DARB
+ glCompressedTexImage2D
+ glCompressedTexImage2DARB
+ glCompressedTexImage3D
+ glCompressedTexImage3DARB
+ glCompressedTexSubImage1D
+ glCompressedTexSubImage1DARB
+ glCompressedTexSubImage2D
+ glCompressedTexSubImage2DARB
+ glCompressedTexSubImage3D
+ glCompressedTexSubImage3DARB
+ glConvolutionFilter1D
+ glConvolutionFilter1DEXT
+ glConvolutionFilter2D
+ glConvolutionFilter2DEXT
+ glConvolutionParameterf
+ glConvolutionParameterfEXT
+ glConvolutionParameterfv
+ glConvolutionParameterfvEXT
+ glConvolutionParameteri
+ glConvolutionParameteriEXT
+ glConvolutionParameteriv
+ glConvolutionParameterivEXT
+ glCopyColorSubTable
+ glCopyColorSubTableEXT
+ glCopyColorTable
+ glCopyColorTableSGI
+ glCopyConvolutionFilter1D
+ glCopyConvolutionFilter1DEXT
+ glCopyConvolutionFilter2D
+ glCopyConvolutionFilter2DEXT
glCopyPixels
glCopyTexImage1D
+ glCopyTexImage1DEXT
glCopyTexImage2D
+ glCopyTexImage2DEXT
glCopyTexSubImage1D
+ glCopyTexSubImage1DEXT
glCopyTexSubImage2D
+ glCopyTexSubImage2DEXT
+ glCopyTexSubImage3D
+ glCopyTexSubImage3DEXT
glCullFace
+ glCullParameterdvEXT
+ glCullParameterfvEXT
+ glDeleteBuffersARB
+ glDeleteFencesNV
+ glDeleteLists
+ glDeleteProgramsARB
+ glDeleteProgramsNV
+ glDeleteQueriesARB
+ glDeleteTextures
+ glDeleteTexturesEXT
+ glDepthBoundsEXT
glDepthFunc
glDepthMask
glDepthRange
- glDeleteLists
- glDeleteTextures
+ glDetailTexFuncSGIS
glDisable
glDisableClientState
+ glDisableVertexAttribArrayARB
glDrawArrays
+ glDrawArraysEXT
glDrawBuffer
glDrawElements
glDrawPixels
+ glDrawRangeElements
+ glDrawRangeElementsEXT
+ glEdgeFlag
+ glEdgeFlagPointer
+ glEdgeFlagPointerEXT
+ glEdgeFlagv
glEnable
glEnableClientState
+ glEnableVertexAttribArrayARB
glEnd
glEndList
+ glEndQueryARB
glEvalCoord1d
- glEvalCoord1f
glEvalCoord1dv
+ glEvalCoord1f
glEvalCoord1fv
glEvalCoord2d
- glEvalCoord2f
glEvalCoord2dv
+ glEvalCoord2f
glEvalCoord2fv
- glEvalPoint1
- glEvalPoint2
glEvalMesh1
- glEdgeFlag
- glEdgeFlagv
- glEdgeFlagPointer
glEvalMesh2
+ glEvalPoint1
+ glEvalPoint2
+ glExecuteProgramNV
glFeedbackBuffer
+ glFinalCombinerInputNV
glFinish
+ glFinishFenceNV
glFlush
+ glFlushRasterSGIX
+ glFlushVertexArrayRangeNV
+ glFogCoordd
+ glFogCoorddEXT
+ glFogCoorddv
+ glFogCoorddvEXT
+ glFogCoordf
+ glFogCoordfEXT
+ glFogCoordfv
+ glFogCoordfvEXT
+ glFogCoordPointer
+ glFogCoordPointerEXT
glFogf
- glFogi
glFogfv
+ glFogi
glFogiv
+ glFragmentColorMaterialSGIX
+ glFragmentLightfSGIX
+ glFragmentLightfvSGIX
+ glFragmentLightiSGIX
+ glFragmentLightivSGIX
+ glFragmentLightModelfSGIX
+ glFragmentLightModelfvSGIX
+ glFragmentLightModeliSGIX
+ glFragmentLightModelivSGIX
+ glFragmentMaterialfSGIX
+ glFragmentMaterialfvSGIX
+ glFragmentMaterialiSGIX
+ glFragmentMaterialivSGIX
+ glFrameZoomSGIX
glFrontFace
glFrustum
+ glGenBuffersARB
+ glGenFencesNV
glGenLists
+ glGenProgramsARB
+ glGenProgramsNV
+ glGenQueriesARB
glGenTextures
+ glGenTexturesEXT
glGetBooleanv
+ glGetBufferParameterivARB
+ glGetBufferPointervARB
+ glGetBufferSubDataARB
glGetClipPlane
+ glGetColorTable
glGetColorTableEXT
- glGetColorTableParameterivEXT
+ glGetColorTableParameterfv
glGetColorTableParameterfvEXT
+ glGetColorTableParameterfvSGI
+ glGetColorTableParameteriv
+ glGetColorTableParameterivEXT
+ glGetColorTableParameterivSGI
+ glGetColorTableSGI
+ glGetCombinerInputParameterfvNV
+ glGetCombinerInputParameterivNV
+ glGetCombinerOutputParameterfvNV
+ glGetCombinerOutputParameterivNV
+ glGetCompressedTexImage
+ glGetCompressedTexImageARB
+ glGetConvolutionFilter
+ glGetConvolutionFilterEXT
+ glGetConvolutionParameterfv
+ glGetConvolutionParameterfvEXT
+ glGetConvolutionParameteriv
+ glGetConvolutionParameterivEXT
+ glGetDetailTexFuncSGIS
glGetDoublev
glGetError
+ glGetFenceivNV
+ glGetFinalCombinerInputParameterfvNV
+ glGetFinalCombinerInputParameterivNV
glGetFloatv
+ glGetFragmentLightfvSGIX
+ glGetFragmentLightivSGIX
+ glGetFragmentMaterialfvSGIX
+ glGetFragmentMaterialivSGIX
+ glGetHistogram
+ glGetHistogramEXT
+ glGetHistogramParameterfv
+ glGetHistogramParameterfvEXT
+ glGetHistogramParameteriv
+ glGetHistogramParameterivEXT
+ glGetInstrumentsSGIX
glGetIntegerv
glGetLightfv
glGetLightiv
+ glGetListParameterfvSGIX
+ glGetListParameterivSGIX
glGetMapdv
glGetMapfv
glGetMapiv
glGetMaterialfv
glGetMaterialiv
+ glGetMinmax
+ glGetMinmaxEXT
+ glGetMinmaxParameterfv
+ glGetMinmaxParameterfvEXT
+ glGetMinmaxParameteriv
+ glGetMinmaxParameterivEXT
glGetPixelMapfv
glGetPixelMapuiv
glGetPixelMapusv
+ glGetPixelTexGenParameterfvSGIS
+ glGetPixelTexGenParameterivSGIS
glGetPointerv
+ glGetPointervEXT
glGetPolygonStipple
+ glGetProgramEnvParameterdvARB
+ glGetProgramEnvParameterfvARB
+ glGetProgramivARB
+ glGetProgramivNV
+ glGetProgramLocalParameterdvARB
+ glGetProgramLocalParameterfvARB
+ glGetProgramNamedParameterdvNV
+ glGetProgramNamedParameterfvNV
+ glGetProgramParameterdvNV
+ glGetProgramParameterfvNV
+ glGetProgramStringARB
+ glGetProgramStringNV
+ glGetQueryivARB
+ glGetQueryObjectivARB
+ glGetQueryObjectuivARB
+ glGetSeparableFilter
+ glGetSeparableFilterEXT
+ glGetSharpenTexFuncSGIS
glGetString
glGetTexEnvfv
glGetTexEnviv
- glGetTexGeniv
+ glGetTexFilterFuncSGIS
glGetTexGendv
glGetTexGenfv
+ glGetTexGeniv
glGetTexImage
glGetTexLevelParameterfv
glGetTexLevelParameteriv
glGetTexParameterfv
glGetTexParameteriv
+ glGetTrackMatrixivNV
+ glGetVertexAttribdvARB
+ glGetVertexAttribdvNV
+ glGetVertexAttribfvARB
+ glGetVertexAttribfvNV
+ glGetVertexAttribivARB
+ glGetVertexAttribivNV
+ glGetVertexAttribPointervARB
+ glGetVertexAttribPointervNV
glHint
+ glHintPGI
+ glHistogram
+ glHistogramEXT
glIndexd
- glIndexf
- glIndexi
- glIndexs
- glIndexub
glIndexdv
+ glIndexf
+ glIndexFuncEXT
glIndexfv
+ glIndexi
glIndexiv
- glIndexsv
- glIndexubv
glIndexMask
+ glIndexMaterialEXT
glIndexPointer
- glInterleavedArrays
+ glIndexPointerEXT
+ glIndexs
+ glIndexsv
+ glIndexub
+ glIndexubv
glInitNames
+ glInstrumentsBufferSGIX
+ glInterleavedArrays
+ glIsBufferARB
+ glIsEnabled
+ glIsFenceNV
glIsList
+ glIsProgramARB
+ glIsProgramNV
+ glIsQueryARB
glIsTexture
+ glIsTextureEXT
+ glLightEnviSGIX
glLightf
- glLighti
glLightfv
+ glLighti
glLightiv
glLightModelf
- glLightModeli
glLightModelfv
+ glLightModeli
glLightModeliv
- glLineWidth
glLineStipple
+ glLineWidth
glListBase
+ glListParameterfSGIX
+ glListParameterfvSGIX
+ glListParameteriSGIX
+ glListParameterivSGIX
glLoadIdentity
glLoadMatrixd
glLoadMatrixf
glLoadName
+ glLoadProgramNV
+ glLoadTransposeMatrixd
+ glLoadTransposeMatrixdARB
+ glLoadTransposeMatrixf
+ glLoadTransposeMatrixfARB
+ glLockArraysEXT
glLogicOp
- glMap1d
- glMap1f
- glMap2d
- glMap2f
+ glMapBufferARB
glMapGrid1d
glMapGrid1f
glMapGrid2d
glMapGrid2f
+ glMap1d
+ glMap1f
+ glMap2d
+ glMap2f
glMaterialf
- glMateriali
glMaterialfv
+ glMateriali
glMaterialiv
glMatrixMode
+ glMinmax
+ glMinmaxEXT
+ glMultiDrawArrays
+ glMultiDrawArraysEXT
+ glMultiDrawElements
+ glMultiDrawElementsEXT
+ glMultiModeDrawArraysIBM
+ glMultiModeDrawElementsIBM
+ glMultiTexCoord1d
+ glMultiTexCoord1dARB
+ glMultiTexCoord1dv
+ glMultiTexCoord1dvARB
+ glMultiTexCoord1f
+ glMultiTexCoord1fARB
+ glMultiTexCoord1fv
+ glMultiTexCoord1fvARB
+ glMultiTexCoord1i
+ glMultiTexCoord1iARB
+ glMultiTexCoord1iv
+ glMultiTexCoord1ivARB
+ glMultiTexCoord1s
+ glMultiTexCoord1sARB
+ glMultiTexCoord1sv
+ glMultiTexCoord1svARB
+ glMultiTexCoord2d
+ glMultiTexCoord2dARB
+ glMultiTexCoord2dv
+ glMultiTexCoord2dvARB
+ glMultiTexCoord2f
+ glMultiTexCoord2fARB
+ glMultiTexCoord2fv
+ glMultiTexCoord2fvARB
+ glMultiTexCoord2i
+ glMultiTexCoord2iARB
+ glMultiTexCoord2iv
+ glMultiTexCoord2ivARB
+ glMultiTexCoord2s
+ glMultiTexCoord2sARB
+ glMultiTexCoord2sv
+ glMultiTexCoord2svARB
+ glMultiTexCoord3d
+ glMultiTexCoord3dARB
+ glMultiTexCoord3dv
+ glMultiTexCoord3dvARB
+ glMultiTexCoord3f
+ glMultiTexCoord3fARB
+ glMultiTexCoord3fv
+ glMultiTexCoord3fvARB
+ glMultiTexCoord3i
+ glMultiTexCoord3iARB
+ glMultiTexCoord3iv
+ glMultiTexCoord3ivARB
+ glMultiTexCoord3s
+ glMultiTexCoord3sARB
+ glMultiTexCoord3sv
+ glMultiTexCoord3svARB
+ glMultiTexCoord4d
+ glMultiTexCoord4dARB
+ glMultiTexCoord4dv
+ glMultiTexCoord4dvARB
+ glMultiTexCoord4f
+ glMultiTexCoord4fARB
+ glMultiTexCoord4fv
+ glMultiTexCoord4fvARB
+ glMultiTexCoord4i
+ glMultiTexCoord4iARB
+ glMultiTexCoord4iv
+ glMultiTexCoord4ivARB
+ glMultiTexCoord4s
+ glMultiTexCoord4sARB
+ glMultiTexCoord4sv
+ glMultiTexCoord4svARB
glMultMatrixd
glMultMatrixf
+ glMultTransposeMatrixd
+ glMultTransposeMatrixdARB
+ glMultTransposeMatrixf
+ glMultTransposeMatrixfARB
glNewList
+ glNormalPointer
+ glNormalPointerEXT
glNormal3b
- glNormal3d
- glNormal3f
- glNormal3i
- glNormal3s
glNormal3bv
+ glNormal3d
glNormal3dv
+ glNormal3f
glNormal3fv
+ glNormal3i
glNormal3iv
+ glNormal3s
glNormal3sv
- glNormalPointer
glOrtho
glPassThrough
glPixelMapfv
@@ -199,10 +503,28 @@ EXPORTS
glPixelMapusv
glPixelStoref
glPixelStorei
+ glPixelTexGenParameterfSGIS
+ glPixelTexGenParameterfvSGIS
+ glPixelTexGenParameteriSGIS
+ glPixelTexGenParameterivSGIS
+ glPixelTexGenSGIX
glPixelTransferf
glPixelTransferi
glPixelZoom
+ glPointParameterf
+ glPointParameterfARB
+ glPointParameterfEXT
+ glPointParameterfSGIS
+ glPointParameterfv
+ glPointParameterfvARB
+ glPointParameterfvEXT
+ glPointParameterfvSGIS
+ glPointParameteri
+ glPointParameteriNV
+ glPointParameteriv
+ glPointParameterivNV
glPointSize
+ glPollInstrumentsSGIX
glPolygonMode
glPolygonOffset
glPolygonOffsetEXT
@@ -212,256 +534,403 @@ EXPORTS
glPopMatrix
glPopName
glPrioritizeTextures
+ glPrioritizeTexturesEXT
+ glProgramEnvParameter4dARB
+ glProgramEnvParameter4dvARB
+ glProgramEnvParameter4fARB
+ glProgramEnvParameter4fvARB
+ glProgramLocalParameter4dARB
+ glProgramLocalParameter4dvARB
+ glProgramLocalParameter4fARB
+ glProgramLocalParameter4fvARB
+ glProgramNamedParameter4dNV
+ glProgramNamedParameter4dvNV
+ glProgramNamedParameter4fNV
+ glProgramNamedParameter4fvNV
+ glProgramParameters4dvNV
+ glProgramParameters4fvNV
+ glProgramParameter4dNV
+ glProgramParameter4dvNV
+ glProgramParameter4fNV
+ glProgramParameter4fvNV
+ glProgramStringARB
+ glPushAttrib
+ glPushClientAttrib
glPushMatrix
+ glPushName
glRasterPos2d
- glRasterPos2f
- glRasterPos2i
- glRasterPos2s
- glRasterPos3d
- glRasterPos3f
- glRasterPos3i
- glRasterPos3s
- glRasterPos4d
- glRasterPos4f
- glRasterPos4i
- glRasterPos4s
glRasterPos2dv
+ glRasterPos2f
glRasterPos2fv
+ glRasterPos2i
glRasterPos2iv
+ glRasterPos2s
glRasterPos2sv
+ glRasterPos3d
glRasterPos3dv
+ glRasterPos3f
glRasterPos3fv
+ glRasterPos3i
glRasterPos3iv
+ glRasterPos3s
glRasterPos3sv
+ glRasterPos4d
glRasterPos4dv
+ glRasterPos4f
glRasterPos4fv
+ glRasterPos4i
glRasterPos4iv
+ glRasterPos4s
glRasterPos4sv
glReadBuffer
+ glReadInstrumentsSGIX
glReadPixels
glRectd
- glRectf
- glRecti
- glRects
glRectdv
+ glRectf
glRectfv
+ glRecti
glRectiv
+ glRects
glRectsv
- glScissor
- glIsEnabled
- glPushAttrib
- glPushClientAttrib
- glPushName
+ glReferencePlaneSGIX
glRenderMode
+ glRequestResidentProgramsNV
+ glResetHistogram
+ glResetHistogramEXT
+ glResetMinmax
+ glResetMinmaxEXT
+ glResizeBuffersMESA
glRotated
glRotatef
- glSelectBuffer
+ glSampleCoverage
+ glSampleCoverageARB
+ glSampleMaskEXT
+ glSampleMaskSGIS
+ glSamplePatternEXT
+ glSamplePatternSGIS
glScaled
glScalef
+ glScissor
+ glSecondaryColorPointer
+ glSecondaryColorPointerEXT
+ glSecondaryColor3b
+ glSecondaryColor3bEXT
+ glSecondaryColor3bv
+ glSecondaryColor3bvEXT
+ glSecondaryColor3d
+ glSecondaryColor3dEXT
+ glSecondaryColor3dv
+ glSecondaryColor3dvEXT
+ glSecondaryColor3f
+ glSecondaryColor3fEXT
+ glSecondaryColor3fv
+ glSecondaryColor3fvEXT
+ glSecondaryColor3i
+ glSecondaryColor3iEXT
+ glSecondaryColor3iv
+ glSecondaryColor3ivEXT
+ glSecondaryColor3s
+ glSecondaryColor3sEXT
+ glSecondaryColor3sv
+ glSecondaryColor3svEXT
+ glSecondaryColor3ub
+ glSecondaryColor3ubEXT
+ glSecondaryColor3ubv
+ glSecondaryColor3ubvEXT
+ glSecondaryColor3ui
+ glSecondaryColor3uiEXT
+ glSecondaryColor3uiv
+ glSecondaryColor3uivEXT
+ glSecondaryColor3us
+ glSecondaryColor3usEXT
+ glSecondaryColor3usv
+ glSecondaryColor3usvEXT
+ glSelectBuffer
+ glSeparableFilter2D
+ glSeparableFilter2DEXT
+ glSetFenceNV
glShadeModel
+ glSharpenTexFuncSGIS
+ glSpriteParameterfSGIX
+ glSpriteParameterfvSGIX
+ glSpriteParameteriSGIX
+ glSpriteParameterivSGIX
+ glStartInstrumentsSGIX
glStencilFunc
glStencilMask
glStencilOp
+ glStopInstrumentsSGIX
+ glTagSampleBufferSGIX
+ glTbufferMask3DFX
+ glTestFenceNV
+ glTexCoordPointer
+ glTexCoordPointerEXT
glTexCoord1d
- glTexCoord1f
- glTexCoord1i
- glTexCoord1s
- glTexCoord2d
- glTexCoord2f
- glTexCoord2i
- glTexCoord2s
- glTexCoord3d
- glTexCoord3f
- glTexCoord3i
- glTexCoord3s
- glTexCoord4d
- glTexCoord4f
- glTexCoord4i
- glTexCoord4s
glTexCoord1dv
+ glTexCoord1f
glTexCoord1fv
+ glTexCoord1i
glTexCoord1iv
+ glTexCoord1s
glTexCoord1sv
+ glTexCoord2d
glTexCoord2dv
+ glTexCoord2f
glTexCoord2fv
+ glTexCoord2i
glTexCoord2iv
+ glTexCoord2s
glTexCoord2sv
+ glTexCoord3d
glTexCoord3dv
+ glTexCoord3f
glTexCoord3fv
+ glTexCoord3i
glTexCoord3iv
+ glTexCoord3s
glTexCoord3sv
+ glTexCoord4d
glTexCoord4dv
+ glTexCoord4f
glTexCoord4fv
+ glTexCoord4i
glTexCoord4iv
+ glTexCoord4s
glTexCoord4sv
- glTexCoordPointer
+ glTexEnvf
+ glTexEnvfv
+ glTexEnvi
+ glTexEnviv
+ glTexFilterFuncSGIS
glTexGend
+ glTexGendv
glTexGenf
+ glTexGenfv
glTexGeni
- glTexGendv
glTexGeniv
- glTexGenfv
- glTexEnvf
- glTexEnvi
- glTexEnvfv
- glTexEnviv
glTexImage1D
glTexImage2D
+ glTexImage3D
+ glTexImage3DEXT
+ glTexImage4DSGIS
glTexParameterf
- glTexParameteri
glTexParameterfv
+ glTexParameteri
glTexParameteriv
glTexSubImage1D
+ glTexSubImage1DEXT
glTexSubImage2D
+ glTexSubImage2DEXT
+ glTexSubImage3D
+ glTexSubImage3DEXT
+ glTexSubImage4DSGIS
+ glTrackMatrixNV
glTranslated
glTranslatef
+ glUnlockArraysEXT
+ glUnmapBufferARB
+ glVertexArrayRangeNV
+ glVertexAttribPointerARB
+ glVertexAttribPointerNV
+ glVertexAttribs1dvNV
+ glVertexAttribs1fvNV
+ glVertexAttribs1svNV
+ glVertexAttribs2dvNV
+ glVertexAttribs2fvNV
+ glVertexAttribs2svNV
+ glVertexAttribs3dvNV
+ glVertexAttribs3fvNV
+ glVertexAttribs3svNV
+ glVertexAttribs4dvNV
+ glVertexAttribs4fvNV
+ glVertexAttribs4svNV
+ glVertexAttribs4ubvNV
+ glVertexAttrib1dARB
+ glVertexAttrib1dNV
+ glVertexAttrib1dvARB
+ glVertexAttrib1dvNV
+ glVertexAttrib1fARB
+ glVertexAttrib1fNV
+ glVertexAttrib1fvARB
+ glVertexAttrib1fvNV
+ glVertexAttrib1sARB
+ glVertexAttrib1sNV
+ glVertexAttrib1svARB
+ glVertexAttrib1svNV
+ glVertexAttrib2dARB
+ glVertexAttrib2dNV
+ glVertexAttrib2dvARB
+ glVertexAttrib2dvNV
+ glVertexAttrib2fARB
+ glVertexAttrib2fNV
+ glVertexAttrib2fvARB
+ glVertexAttrib2fvNV
+ glVertexAttrib2sARB
+ glVertexAttrib2sNV
+ glVertexAttrib2svARB
+ glVertexAttrib2svNV
+ glVertexAttrib3dARB
+ glVertexAttrib3dNV
+ glVertexAttrib3dvARB
+ glVertexAttrib3dvNV
+ glVertexAttrib3fARB
+ glVertexAttrib3fNV
+ glVertexAttrib3fvARB
+ glVertexAttrib3fvNV
+ glVertexAttrib3sARB
+ glVertexAttrib3sNV
+ glVertexAttrib3svARB
+ glVertexAttrib3svNV
+ glVertexAttrib4bvARB
+ glVertexAttrib4dARB
+ glVertexAttrib4dNV
+ glVertexAttrib4dvARB
+ glVertexAttrib4dvNV
+ glVertexAttrib4fARB
+ glVertexAttrib4fNV
+ glVertexAttrib4fvARB
+ glVertexAttrib4fvNV
+ glVertexAttrib4ivARB
+ glVertexAttrib4NbvARB
+ glVertexAttrib4NivARB
+ glVertexAttrib4NsvARB
+ glVertexAttrib4NubARB
+ glVertexAttrib4NubvARB
+ glVertexAttrib4NuivARB
+ glVertexAttrib4NusvARB
+ glVertexAttrib4sARB
+ glVertexAttrib4sNV
+ glVertexAttrib4svARB
+ glVertexAttrib4svNV
+ glVertexAttrib4ubNV
+ glVertexAttrib4ubvARB
+ glVertexAttrib4ubvNV
+ glVertexAttrib4uivARB
+ glVertexAttrib4usvARB
+ glVertexPointer
+ glVertexPointerEXT
+ glVertexWeightfEXT
+ glVertexWeightfvEXT
+ glVertexWeightPointerEXT
glVertex2d
- glVertex2f
- glVertex2i
- glVertex2s
- glVertex3d
- glVertex3f
- glVertex3i
- glVertex3s
- glVertex4d
- glVertex4f
- glVertex4i
- glVertex4s
glVertex2dv
+ glVertex2f
glVertex2fv
+ glVertex2i
glVertex2iv
+ glVertex2s
glVertex2sv
+ glVertex3d
glVertex3dv
+ glVertex3f
glVertex3fv
+ glVertex3i
glVertex3iv
+ glVertex3s
glVertex3sv
+ glVertex4d
glVertex4dv
+ glVertex4f
glVertex4fv
+ glVertex4i
glVertex4iv
+ glVertex4s
glVertex4sv
- glVertexPointer
glViewport
- glBlendEquationEXT
- glBlendColorEXT
- glVertexPointerEXT
- glNormalPointerEXT
- glColorPointerEXT
- glIndexPointerEXT
- glTexCoordPointerEXT
- glEdgeFlagPointerEXT
- glGetPointervEXT
- glArrayElementEXT
- glDrawArraysEXT
- glBindTextureEXT
- glDeleteTexturesEXT
- glGenTexturesEXT
- glPrioritizeTexturesEXT
- glCopyTexSubImage3DEXT
- glTexImage3DEXT
- glTexSubImage3DEXT
- glWindowPos4fMESA
- glWindowPos2iMESA
- glWindowPos2sMESA
- glWindowPos2fMESA
+ glWindowPos2d
+ glWindowPos2dARB
glWindowPos2dMESA
+ glWindowPos2dv
+ glWindowPos2dvARB
+ glWindowPos2dvMESA
+ glWindowPos2f
+ glWindowPos2fARB
+ glWindowPos2fMESA
+ glWindowPos2fv
+ glWindowPos2fvARB
+ glWindowPos2fvMESA
+ glWindowPos2i
+ glWindowPos2iARB
+ glWindowPos2iMESA
+ glWindowPos2iv
+ glWindowPos2ivARB
glWindowPos2ivMESA
+ glWindowPos2s
+ glWindowPos2sARB
+ glWindowPos2sMESA
+ glWindowPos2sv
+ glWindowPos2svARB
glWindowPos2svMESA
- glWindowPos2fvMESA
- glWindowPos2dvMESA
- glWindowPos3iMESA
- glWindowPos3sMESA
- glWindowPos3fMESA
+ glWindowPos3d
+ glWindowPos3dARB
glWindowPos3dMESA
+ glWindowPos3dv
+ glWindowPos3dvARB
+ glWindowPos3dvMESA
+ glWindowPos3f
+ glWindowPos3fARB
+ glWindowPos3fMESA
+ glWindowPos3fv
+ glWindowPos3fvARB
+ glWindowPos3fvMESA
+ glWindowPos3i
+ glWindowPos3iARB
+ glWindowPos3iMESA
+ glWindowPos3iv
+ glWindowPos3ivARB
glWindowPos3ivMESA
+ glWindowPos3s
+ glWindowPos3sARB
+ glWindowPos3sMESA
+ glWindowPos3sv
+ glWindowPos3svARB
glWindowPos3svMESA
- glWindowPos3fvMESA
- glWindowPos3dvMESA
- glWindowPos4iMESA
- glWindowPos4sMESA
glWindowPos4dMESA
+ glWindowPos4dvMESA
+ glWindowPos4fMESA
+ glWindowPos4fvMESA
+ glWindowPos4iMESA
glWindowPos4ivMESA
+ glWindowPos4sMESA
glWindowPos4svMESA
- glWindowPos4fvMESA
- glWindowPos4dvMESA
- glResizeBuffersMESA
+ fxCloseHardware
+;fxGetScreenGeometry
+ fxMesaCreateBestContext
+ fxMesaCreateContext
+ fxMesaDestroyContext
+ fxMesaGetCurrentContext
+ fxMesaMakeCurrent
+ fxMesaSelectCurrentBoard
+;fxMesaSetNearFar
+ fxMesaSwapBuffers
+ fxMesaUpdateScreenSize
+ fxQueryHardware
+ wglChoosePixelFormat
wglCopyContext
wglCreateContext
wglCreateLayerContext
wglDeleteContext
;wglDescribeLayerPlane
+ wglDescribePixelFormat
wglGetCurrentContext
wglGetCurrentDC
;wglGetLayerPaletteEntries
+ wglGetPixelFormat
wglGetProcAddress
wglMakeCurrent
;wglRealizeLayerPalette
;wglSetLayerPaletteEntries
+ wglSetPixelFormat
wglShareLists
+ wglSwapBuffers
wglSwapLayerBuffers
wglUseFontBitmapsA
wglUseFontBitmapsW
wglUseFontOutlinesA
wglUseFontOutlinesW
- wglChoosePixelFormat
ChoosePixelFormat
- wglDescribePixelFormat
DescribePixelFormat
- wglGetPixelFormat
GetPixelFormat
- wglSetPixelFormat
SetPixelFormat
- wglSwapBuffers
SwapBuffers
- gl3DfxSetPaletteEXT
- glActiveTextureARB
- glClientActiveTextureARB
- glMultiTexCoord1dARB
- glMultiTexCoord1dvARB
- glMultiTexCoord1fARB
- glMultiTexCoord1fvARB
- glMultiTexCoord1iARB
- glMultiTexCoord1ivARB
- glMultiTexCoord1sARB
- glMultiTexCoord1svARB
- glMultiTexCoord2dARB
- glMultiTexCoord2dvARB
- glMultiTexCoord2fARB
- glMultiTexCoord2fvARB
- glMultiTexCoord2iARB
- glMultiTexCoord2ivARB
- glMultiTexCoord2sARB
- glMultiTexCoord2svARB
- glMultiTexCoord3dARB
- glMultiTexCoord3dvARB
- glMultiTexCoord3fARB
- glMultiTexCoord3fvARB
- glMultiTexCoord3iARB
- glMultiTexCoord3ivARB
- glMultiTexCoord3sARB
- glMultiTexCoord3svARB
- glMultiTexCoord4dARB
- glMultiTexCoord4dvARB
- glMultiTexCoord4fARB
- glMultiTexCoord4fvARB
- glMultiTexCoord4iARB
- glMultiTexCoord4ivARB
- glMultiTexCoord4sARB
- glMultiTexCoord4svARB
- fxMesaCreateContext
- fxMesaCreateBestContext
- fxMesaDestroyContext
- fxMesaSelectCurrentBoard
- fxMesaMakeCurrent
- fxMesaGetCurrentContext
- fxMesaSwapBuffers
-; fxMesaSetNearFar
- fxMesaUpdateScreenSize
- fxQueryHardware
- fxCloseHardware
-; OSMesaCreateContext
-; OSMesaDestroyContext
-; OSMesaGetCurrentContext
-; OSMesaGetDepthBuffer
-; OSMesaGetIntegerv
-; OSMesaMakeCurrent
-; OSMesaPixelStore
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 523bf2b3fd..9ebc603ae7 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -1,4 +1,4 @@
-/* $Id: fxsetup.c,v 1.39 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxsetup.c,v 1.40 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -52,18 +52,17 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
GLint minl, maxl;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxTexValidate(...) Start\n");
- }
-
if (ti->validated) {
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr,
- "fxmesa: fxTexValidate(...) End (validated=GL_TRUE)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: validated=GL_TRUE\n", __FUNCTION__);
}
return;
}
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ }
+
ti->tObj = tObj;
minl = ti->minLevel = tObj->BaseLevel;
maxl = ti->maxLevel = MIN2(tObj->MaxLevel, tObj->Image[0]->MaxLog2);
@@ -71,38 +70,48 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
fxTexGetInfo(tObj->Image[minl]->Width, tObj->Image[minl]->Height,
&(FX_largeLodLog2(ti->info)), &(FX_aspectRatioLog2(ti->info)),
&(ti->sScale), &(ti->tScale),
- &(ti->int_sScale), &(ti->int_tScale), NULL, NULL);
+ NULL, NULL);
if ((tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR))
fxTexGetInfo(tObj->Image[maxl]->Width, tObj->Image[maxl]->Height,
&(FX_smallLodLog2(ti->info)), NULL,
- NULL, NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
else
FX_smallLodLog2(ti->info) = FX_largeLodLog2(ti->info);
+/*jejeje*/
+ti->baseLevelInternalFormat = tObj->Image[minl]->Format;
+#if 0
fxTexGetFormat(ctx, tObj->Image[minl]->TexFormat->BaseFormat, &(ti->info.format),
&(ti->baseLevelInternalFormat)); /* [koolsmoky] */
+#endif
switch (tObj->WrapS) {
+ case GL_MIRRORED_REPEAT:
+ ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT;
+ break;
case GL_CLAMP_TO_EDGE:
/* What's this really mean compared to GL_CLAMP? */
case GL_CLAMP:
- ti->sClamp = 1;
+ ti->sClamp = GR_TEXTURECLAMP_CLAMP;
break;
case GL_REPEAT:
- ti->sClamp = 0;
+ ti->sClamp = GR_TEXTURECLAMP_WRAP;
break;
default:
; /* silence compiler warning */
}
switch (tObj->WrapT) {
+ case GL_MIRRORED_REPEAT:
+ ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT;
+ break;
case GL_CLAMP_TO_EDGE:
/* What's this really mean compared to GL_CLAMP? */
case GL_CLAMP:
- ti->tClamp = 1;
+ ti->tClamp = GR_TEXTURECLAMP_CLAMP;
break;
case GL_REPEAT:
- ti->tClamp = 0;
+ ti->tClamp = GR_TEXTURECLAMP_WRAP;
break;
default:
; /* silence compiler warning */
@@ -111,10 +120,6 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
ti->validated = GL_TRUE;
ti->info.data = NULL;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxTexValidate(...) End\n");
- }
}
static void
@@ -274,8 +279,8 @@ fxGetTexSetConfiguration(GLcontext * ctx,
unitsmode |= (ifmt | envmode);
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fxPrintUnitsMode("unitsmode", unitsmode);
+ if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
+ fxPrintUnitsMode(__FUNCTION__, unitsmode);
return unitsmode;
}
@@ -292,6 +297,10 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
int tmu;
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ }
+
/* Make sure we're not loaded incorrectly */
if (ti->isInTM) {
if (ti->LODblend) {
@@ -309,7 +318,10 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if (ti->LODblend)
fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT);
else {
- if (fxMesa->haveTwoTMUs) {
+ /* XXX putting textures into the second memory bank when the
+ * first bank is full is not working at this time.
+ */
+ if (/*[dBorca]: fixme*/0 && fxMesa->haveTwoTMUs) {
if (fxMesa->freeTexMem[FX_TMU0] >
grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH,
&(ti->info))) {
@@ -327,8 +339,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) {
if ((ti->info.format == GR_TEXFMT_P_8)
&& (!fxMesa->haveGlobalPaletteTexture)) {
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: uploading texture palette\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__);
}
grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti->palette));
}
@@ -353,8 +365,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
if ((ti->info.format == GR_TEXFMT_P_8)
&& (!fxMesa->haveGlobalPaletteTexture)) {
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: uploading texture palette\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: uploading texture palette\n", __FUNCTION__);
}
grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti->palette));
}
@@ -363,8 +375,9 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
* we get to this point, I think it means we are thrashing the
* texture memory, so perhaps it's not a good idea.
*/
- if (ti->LODblend && (MESA_VERBOSE & VERBOSE_DRIVER))
- fprintf(stderr, "fxmesa: not blending texture - only on one tmu\n");
+ if (ti->LODblend && (TDFX_DEBUG & VERBOSE_DRIVER)) {
+ fprintf(stderr, "%s: not blending texture - only one tmu\n", __FUNCTION__);
+ }
grTexClampMode(tmu, ti->sClamp, ti->tClamp);
grTexFilterMode(tmu, ti->minFilt, ti->maxFilt);
@@ -377,8 +390,8 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
static void
fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
{
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSelectSingleTMUSrc(%d,%d)\n", tmu, LODblend);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d, %d)\n", __FUNCTION__, tmu, LODblend);
}
if (LODblend) {
@@ -436,7 +449,7 @@ fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
static void
fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrCombineLocal_t localc, locala;
GLuint unitsmode;
GLint ifmt;
@@ -444,8 +457,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
struct gl_texture_object *tObj = ctx->Texture.Unit[textureset].Current2D;
int tmu;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) Start\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
ti = fxTMGetTexInfo(tObj);
@@ -486,8 +499,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
else
localc = GR_COMBINE_LOCAL_CONSTANT;
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxMesa: fxSetupTextureSingleTMU, envmode is %s\n",
+ if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
+ fprintf(stderr, "%s: envmode is %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
switch (ctx->Texture.Unit[textureset].EnvMode) {
@@ -515,8 +528,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
break;
case GL_BLEND:
- if (MESA_VERBOSE & VERBOSE_DRIVER)
- fprintf(stderr, "fx Driver: GL_BLEND not yet supported\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER)
+ fprintf(stderr, "%s: GL_BLEND not yet supported\n", __FUNCTION__);
break;
case GL_REPLACE:
if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE))
@@ -538,15 +551,11 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
break;
default:
- if (MESA_VERBOSE & VERBOSE_DRIVER)
- fprintf(stderr, "fx Driver: %x Texture.EnvMode not yet supported\n",
+ if (TDFX_DEBUG & VERBOSE_DRIVER)
+ fprintf(stderr, "%s: %x Texture.EnvMode not yet supported\n", __FUNCTION__,
ctx->Texture.Unit[textureset].EnvMode);
break;
}
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) End\n");
- }
}
#if 00
@@ -579,8 +588,8 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
GLuint tstate = 0;
int tmu0 = 0, tmu1 = 1;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupDoubleTMU(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
/* We shouldn't need to do this. There is something wrong with
@@ -675,8 +684,8 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
* The next test shouldn't be TMU specific...
*/
if (ti0->info.format == GR_TEXFMT_P_8) {
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: uploading texture palette TMU0\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s: uploading texture palette TMU0\n", __FUNCTION__);
}
grTexDownloadTable(GR_TEXTABLE_PALETTE, &(ti0->palette));
}
@@ -705,7 +714,7 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
static void
fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrCombineLocal_t localc, locala;
tfxTexInfo *ti0, *ti1;
struct gl_texture_object *tObj0 = ctx->Texture.Unit[0].Current2D;
@@ -713,8 +722,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
GLuint envmode, ifmt, unitsmode;
int tmu0 = 0, tmu1 = 1;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTextureDoubleTMU(...) Start\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
ti0 = fxTMGetTexInfo(tObj0);
@@ -749,8 +758,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
localc = GR_COMBINE_LOCAL_CONSTANT;
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxMesa: fxSetupTextureDoubleTMU, envmode is %s/%s\n",
+ if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
+ fprintf(stderr, "%s: envmode is %s/%s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[0].EnvMode),
_mesa_lookup_enum_by_nr(ctx->Texture.Unit[1].EnvMode));
@@ -765,15 +774,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
{
GLboolean isalpha[FX_NUM_TMU];
- if (ti0->baseLevelInternalFormat == GL_ALPHA)
- isalpha[tmu0] = GL_TRUE;
- else
- isalpha[tmu0] = GL_FALSE;
-
- if (ti1->baseLevelInternalFormat == GL_ALPHA)
- isalpha[tmu1] = GL_TRUE;
- else
- isalpha[tmu1] = GL_FALSE;
+ isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
+ isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
if (isalpha[FX_TMU1])
grTexCombine(GR_TMU1,
@@ -896,15 +898,8 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
{
GLboolean isalpha[FX_NUM_TMU];
- if (ti0->baseLevelInternalFormat == GL_ALPHA)
- isalpha[tmu0] = GL_TRUE;
- else
- isalpha[tmu0] = GL_FALSE;
-
- if (ti1->baseLevelInternalFormat == GL_ALPHA)
- isalpha[tmu1] = GL_TRUE;
- else
- isalpha[tmu1] = GL_FALSE;
+ isalpha[tmu0] = (ti0->baseLevelInternalFormat == GL_ALPHA);
+ isalpha[tmu1] = (ti1->baseLevelInternalFormat == GL_ALPHA);
if (isalpha[FX_TMU1])
grTexCombine(GR_TMU1,
@@ -942,13 +937,9 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
break;
}
default:
- fprintf(stderr, "Unexpected dual texture mode encountered\n");
+ fprintf(stderr, "%s: Unexpected dual texture mode encountered\n", __FUNCTION__);
break;
}
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTextureDoubleTMU(...) End\n");
- }
}
/************************* No Texture ***************************/
@@ -956,11 +947,11 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
static void
fxSetupTextureNone_NoLock(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GrCombineLocal_t localc, locala;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTextureNone(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
if ((ctx->Light.ShadeModel == GL_SMOOTH) || 1 ||
@@ -993,10 +984,10 @@ fxSetupTextureNone_NoLock(GLcontext * ctx)
static void
fxSetupTexture_NoLock(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTexture(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(...)\n", __FUNCTION__);
}
/* Texture Combine, Color Combine and Alpha Combine. */
@@ -1032,7 +1023,7 @@ fxSetupTexture(GLcontext * ctx)
void
fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
GrAlphaBlendFnc_t sfact, dfact, asfact, adfact;
@@ -1149,7 +1140,7 @@ fxDDBlendFunc(GLcontext * ctx, GLenum sfactor, GLenum dfactor)
static void
fxSetupBlend(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
if (us->blendEnabled)
@@ -1167,48 +1158,15 @@ fxSetupBlend(GLcontext * ctx)
void
fxDDAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
- GrCmpFnc_t newfunc;
- switch (func) {
- case GL_NEVER:
- newfunc = GR_CMP_NEVER;
- break;
- case GL_LESS:
- newfunc = GR_CMP_LESS;
- break;
- case GL_EQUAL:
- newfunc = GR_CMP_EQUAL;
- break;
- case GL_LEQUAL:
- newfunc = GR_CMP_LEQUAL;
- break;
- case GL_GREATER:
- newfunc = GR_CMP_GREATER;
- break;
- case GL_NOTEQUAL:
- newfunc = GR_CMP_NOTEQUAL;
- break;
- case GL_GEQUAL:
- newfunc = GR_CMP_GEQUAL;
- break;
- case GL_ALWAYS:
- newfunc = GR_CMP_ALWAYS;
- break;
- default:
- fprintf(stderr, "fx Driver: internal error in fxDDAlphaFunc()\n");
- fxCloseHardware();
- exit(-1);
- break;
- }
-
- if (newfunc != us->alphaTestFunc) {
- us->alphaTestFunc = newfunc;
- fxMesa->new_state |= FX_NEW_ALPHA;
- }
-
- if (ref != us->alphaTestRefValue) {
+ if (
+ (us->alphaTestFunc != func)
+ ||
+ (us->alphaTestRefValue != ref)
+ ) {
+ us->alphaTestFunc = func;
us->alphaTestRefValue = ref;
fxMesa->new_state |= FX_NEW_ALPHA;
}
@@ -1217,12 +1175,12 @@ fxDDAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
static void
fxSetupAlphaTest(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
if (us->alphaTestEnabled) {
GrAlpha_t ref = (GLint) (us->alphaTestRefValue * 255.0);
- grAlphaTestFunction(us->alphaTestFunc);
+ grAlphaTestFunction(us->alphaTestFunc - GL_NEVER + GR_CMP_NEVER);
grAlphaTestReferenceValue(ref);
}
else
@@ -1236,53 +1194,19 @@ fxSetupAlphaTest(GLcontext * ctx)
void
fxDDDepthFunc(GLcontext * ctx, GLenum func)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
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 (dfunc != us->depthTestFunc) {
- us->depthTestFunc = dfunc;
+ if (us->depthTestFunc != func) {
+ us->depthTestFunc = func;
fxMesa->new_state |= FX_NEW_DEPTH;
}
-
}
void
fxDDDepthMask(GLcontext * ctx, GLboolean flag)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
if (flag != us->depthMask) {
@@ -1294,11 +1218,11 @@ fxDDDepthMask(GLcontext * ctx, GLboolean flag)
static void
fxSetupDepthTest(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
if (us->depthTestEnabled) {
- grDepthBufferFunction(us->depthTestFunc);
+ grDepthBufferFunction(us->depthTestFunc - GL_NEVER + GR_CMP_NEVER);
grDepthMask(us->depthMask);
}
else {
@@ -1308,14 +1232,134 @@ fxSetupDepthTest(GLcontext * ctx)
}
/************************************************************************/
+/************************** Stencil SetUp *******************************/
+/************************************************************************/
+
+static GrStencil_t convertGLStencilOp( 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;
+ case GL_INCR_WRAP_EXT:
+ return GR_STENCILOP_INCR_WRAP;
+ case GL_DECR_WRAP_EXT:
+ return GR_STENCILOP_DECR_WRAP;
+ default:
+ _mesa_problem( NULL, "bad stencil op in convertGLStencilOp" );
+ }
+ return GR_STENCILOP_KEEP; /* never get, silence compiler warning */
+}
+
+void
+fxDDStencilFunc (GLcontext *ctx, GLenum func, GLint ref, GLuint mask)
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ tfxUnitsState *us = &fxMesa->unitsState;
+
+ if (
+ (us->stencilFunction != func)
+ ||
+ (us->stencilRefValue != ref)
+ ||
+ (us->stencilValueMask != mask)
+ ) {
+ us->stencilFunction = func;
+ us->stencilRefValue = ref;
+ us->stencilValueMask = mask;
+ fxMesa->new_state |= FX_NEW_STENCIL;
+ }
+}
+
+void
+fxDDStencilMask (GLcontext *ctx, GLuint mask)
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ tfxUnitsState *us = &fxMesa->unitsState;
+
+ if (us->stencilWriteMask != mask) {
+ us->stencilWriteMask = mask;
+ fxMesa->new_state |= FX_NEW_STENCIL;
+ }
+}
+
+void
+fxDDStencilOp (GLcontext *ctx, GLenum sfail, GLenum zfail, GLenum zpass)
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ tfxUnitsState *us = &fxMesa->unitsState;
+
+ if (
+ (us->stencilFailFunc != sfail)
+ ||
+ (us->stencilZFailFunc != zfail)
+ ||
+ (us->stencilZPassFunc != zpass)
+ ) {
+ us->stencilFailFunc = sfail;
+ us->stencilZFailFunc = zfail;
+ us->stencilZPassFunc = zpass;
+ fxMesa->new_state |= FX_NEW_STENCIL;
+ }
+}
+
+static void
+fxSetupStencil (GLcontext * ctx)
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ tfxUnitsState *us = &fxMesa->unitsState;
+
+ if (us->stencilEnabled) {
+ grEnable(GR_STENCIL_MODE_EXT);
+ fxMesa->Glide.grStencilOpExt(convertGLStencilOp(us->stencilFailFunc),
+ convertGLStencilOp(us->stencilZFailFunc),
+ convertGLStencilOp(us->stencilZPassFunc));
+ fxMesa->Glide.grStencilFuncExt(us->stencilFunction - GL_NEVER + GR_CMP_NEVER,
+ us->stencilRefValue,
+ us->stencilValueMask);
+ fxMesa->Glide.grStencilMaskExt(us->stencilWriteMask);
+ } else {
+ grDisable(GR_STENCIL_MODE_EXT);
+ }
+}
+
+/************************************************************************/
/**************************** Color Mask SetUp **************************/
/************************************************************************/
+void fxColorMask (fxMesaContext fxMesa, GLboolean enable)
+{
+/* These are used in calls to FX_grColorMask() */
+static const FxBool false4[4] = { FXFALSE, FXFALSE, FXFALSE, FXFALSE };
+static const FxBool true4[4] = { FXTRUE, FXTRUE, FXTRUE, FXTRUE };
+
+ const FxBool *rgba = enable ? true4 : false4;
+
+ if (fxMesa->colDepth != 16) {
+ /* 32bpp mode or 15bpp mode */
+ fxMesa->Glide.grColorMaskExt(rgba[RCOMP], rgba[GCOMP],
+ rgba[BCOMP], rgba[ACOMP] && fxMesa->haveHwAlpha);
+ }
+ else {
+ /* 16 bpp mode */
+ grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], rgba[ACOMP] && fxMesa->haveHwAlpha);
+ }
+}
+
void
fxDDColorMask(GLcontext * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
fxMesa->new_state |= FX_NEW_COLOR_MASK;
(void) r;
(void) g;
@@ -1329,13 +1373,10 @@ fxSetupColorMask(GLcontext * ctx)
fxMesaContext fxMesa = FX_CONTEXT(ctx);
if (ctx->Color.DrawBuffer == GL_NONE) {
- grColorMask(FXFALSE, FXFALSE);
+ fxColorMask(fxMesa, GL_FALSE);
}
else {
- grColorMask(ctx->Color.ColorMask[RCOMP] ||
- ctx->Color.ColorMask[GCOMP] ||
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP] && fxMesa->haveAlphaBuffer);
+ fxColorMask(fxMesa, GL_TRUE);
}
}
@@ -1389,7 +1430,7 @@ fxSetupFog(GLcontext * ctx)
}
grFogTable(fxMesa->fogTable);
- grFogMode(GR_FOG_WITH_TABLE);
+ grFogMode(GR_FOG_WITH_TABLE_ON_Q);
}
else {
grFogMode(GR_FOG_DISABLE);
@@ -1410,7 +1451,7 @@ fxDDFogfv(GLcontext * ctx, GLenum pname, const GLfloat * params)
void
fxSetScissorValues(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
int xmin, xmax;
int ymin, ymax, check;
@@ -1439,7 +1480,7 @@ fxSetScissorValues(GLcontext * ctx)
grClipWindow(xmin, ymin, xmax, ymax);
}
-static void
+void
fxSetupScissor(GLcontext * ctx)
{
BEGIN_BOARD_LOCK();
@@ -1473,35 +1514,42 @@ fxDDFrontFace(GLcontext * ctx, GLenum mode)
}
-static void
+void
fxSetupCull(GLcontext * ctx)
{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrCullMode_t mode = 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;
+ mode = GR_CULL_NEGATIVE;
else
- FX_CONTEXT(ctx)->cullMode = GR_CULL_POSITIVE;
+ mode = GR_CULL_POSITIVE;
break;
case GL_FRONT:
if (ctx->Polygon.FrontFace == GL_CCW)
- FX_CONTEXT(ctx)->cullMode = GR_CULL_POSITIVE;
+ mode = GR_CULL_POSITIVE;
else
- FX_CONTEXT(ctx)->cullMode = GR_CULL_NEGATIVE;
+ mode = GR_CULL_NEGATIVE;
break;
case GL_FRONT_AND_BACK:
- FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE;
- break;
+ /* Handled as a fallback on triangles in tdfx_tris.c */
+ return;
default:
+ ASSERT(0);
break;
}
}
- else
- FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE;
- if (FX_CONTEXT(ctx)->raster_primitive == GL_TRIANGLES)
- grCullMode(FX_CONTEXT(ctx)->cullMode);
+ /* KW: don't need to check raster_primitive here as we don't
+ * attempt to draw lines or points with triangles.
+ */
+ if (fxMesa->cullMode != mode) {
+ fxMesa->cullMode = mode;
+ grCullMode(mode);
+ }
}
@@ -1512,11 +1560,12 @@ fxSetupCull(GLcontext * ctx)
void
fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxUnitsState *us = &fxMesa->unitsState;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDEnable(...)\n");
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%s)\n", state ? __FUNCTION__ : "fxDDDisable",
+ _mesa_lookup_enum_by_nr(cap));
}
switch (cap) {
@@ -1538,6 +1587,12 @@ fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
fxMesa->new_state |= FX_NEW_DEPTH;
}
break;
+ case GL_STENCIL_TEST:
+ if (fxMesa->haveHwStencil && state != us->stencilEnabled) {
+ us->stencilEnabled = state;
+ fxMesa->new_state |= FX_NEW_STENCIL;
+ }
+ break;
case GL_DITHER:
if (state) {
grDitherMode(GR_DITHER_4x4);
@@ -1595,7 +1650,7 @@ static void
fx_print_state_flags(const char *msg, GLuint flags)
{
fprintf(stderr,
- "%s: (0x%x) %s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s\n",
msg,
flags,
(flags & FX_NEW_TEXTURING) ? "texture, " : "",
@@ -1604,17 +1659,18 @@ fx_print_state_flags(const char *msg, GLuint flags)
(flags & FX_NEW_FOG) ? "fog, " : "",
(flags & FX_NEW_SCISSOR) ? "scissor, " : "",
(flags & FX_NEW_COLOR_MASK) ? "colormask, " : "",
- (flags & FX_NEW_CULL) ? "cull, " : "");
+ (flags & FX_NEW_CULL) ? "cull, " : "",
+ (flags & FX_NEW_STENCIL) ? "stencil, " : "");
}
void
fxSetupFXUnits(GLcontext * ctx)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint newstate = fxMesa->new_state;
- if (MESA_VERBOSE & VERBOSE_DRIVER)
- fx_print_state_flags("fxmesa: fxSetupFXUnits", newstate);
+ if (TDFX_DEBUG & VERBOSE_DRIVER)
+ fx_print_state_flags(__FUNCTION__, newstate);
if (newstate) {
if (newstate & FX_NEW_TEXTURING)
@@ -1629,6 +1685,9 @@ fxSetupFXUnits(GLcontext * ctx)
if (newstate & FX_NEW_DEPTH)
fxSetupDepthTest(ctx);
+ if (newstate & FX_NEW_STENCIL)
+ fxSetupStencil(ctx);
+
if (newstate & FX_NEW_FOG)
fxSetupFog(ctx);
diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c
index 5189816cde..648649c032 100644
--- a/src/mesa/drivers/glide/fxtexman.c
+++ b/src/mesa/drivers/glide/fxtexman.c
@@ -1,4 +1,4 @@
-/* $Id: fxtexman.c,v 1.16 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxtexman.c,v 1.17 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -116,10 +116,11 @@ fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
}
else {
if (!(result = MALLOC(sizeof(MemRange)))) {
- fprintf(stderr, "fxDriver: out of memory!\n");
+ fprintf(stderr, "%s: ERROR: out of memory!\n", __FUNCTION__);
fxCloseHardware();
exit(-1);
}
+ result->next = NULL;
}
result->startAddr = start;
result->endAddr = end;
@@ -137,11 +138,13 @@ static void
fxTMUInit(fxMesaContext fxMesa, int tmu)
{
MemRange *tmn, *last;
- FxU32 start, end, blockstart, blockend;
+ FxU32 start, end, blockstart, blockend, boundary;
start = grTexMinAddress(tmu);
end = grTexMaxAddress(tmu);
+ boundary = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT;
+
if (fxMesa->verbose) {
fprintf(stderr, "Voodoo %s configuration:\n",
(tmu == FX_TMU0) ? "TMU0" : "TMU1");
@@ -149,7 +152,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu)
(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");
+ fprintf(stderr, "Voodoo Splitting Texture memory in %luMB blocks:\n", boundary >> 20);
}
fxMesa->freeTexMem[tmu] = end - start;
@@ -158,17 +161,16 @@ fxTMUInit(fxMesaContext fxMesa, int tmu)
last = 0;
blockstart = start;
while (blockstart < end) {
- if (blockstart + FX_2MB_SPLIT > end)
+ if (blockstart + boundary > end)
blockend = end;
else
- blockend = blockstart + FX_2MB_SPLIT;
+ blockend = blockstart + boundary;
if (fxMesa->verbose)
fprintf(stderr, "Voodoo %07u-%07u\n",
(unsigned int) blockstart, (unsigned int) blockend);
tmn = fxTMNewRangeNode(fxMesa, blockstart, blockend);
- tmn->next = 0;
if (last)
last->next = tmn;
@@ -176,7 +178,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu)
fxMesa->tmFree[tmu] = tmn;
last = tmn;
- blockstart += FX_2MB_SPLIT;
+ blockstart += boundary;
}
}
@@ -210,9 +212,12 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
tmp = tmp->next;
}
/* No free space. Discard oldest */
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "%s: No free space. Discard oldest\n", __FUNCTION__);
+ }
obj = fxTMFindOldestObject(fxMesa, tmu);
if (!obj) {
- fprintf(stderr, "fx Driver: No space for texture\n");
+ fprintf(stderr, "%s: ERROR: No space for texture\n", __FUNCTION__);
return -1;
}
fxTMMoveOutTM(fxMesa, obj);
@@ -224,6 +229,7 @@ static void
fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
{
MemRange *tmp, *prev;
+ FxU32 boundary = (fxMesa->type >= GR_SSTTYPE_Banshee) ? -1 : (FX_2MB_SPLIT - 1);
if (range->startAddr == range->endAddr) {
fxTMDeleteRangeNode(fxMesa, range);
@@ -246,7 +252,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
range->next = tmp;
if (tmp) {
if (range->endAddr == tmp->startAddr
- && tmp->startAddr & (FX_2MB_SPLIT - 1)) {
+ && tmp->startAddr & boundary) {
/* Combine */
tmp->startAddr = range->startAddr;
fxTMDeleteRangeNode(fxMesa, range);
@@ -255,7 +261,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange * range)
}
if (prev) {
if (prev->endAddr == range->startAddr
- && range->startAddr & (FX_2MB_SPLIT - 1)) {
+ && range->startAddr & boundary) {
/* Combine */
prev->endAddr = range->endAddr;
prev->next = range->next;
@@ -273,15 +279,19 @@ static struct gl_texture_object *
fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
{
GLuint age, old, lasttime, bindnumber;
+ GLfloat lowestPriority;
tfxTexInfo *info;
- struct gl_texture_object *obj, *tmp;
+ struct gl_texture_object *obj, *tmp, *lowestPriorityObj;
tmp = fxMesa->glCtx->Shared->TexObjectList;
if (!tmp)
return 0;
- obj = 0;
+ obj = NULL;
old = 0;
+ lowestPriorityObj = NULL;
+ lowestPriority = 1.0F;
+
bindnumber = fxMesa->texBindNumber;
while (tmp) {
info = fxTMGetTexInfo(tmp);
@@ -300,10 +310,29 @@ fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
old = age;
obj = tmp;
}
+
+ /* examine priority */
+ if (obj->Priority < lowestPriority) {
+ lowestPriority = tmp->Priority;
+ lowestPriorityObj = tmp;
+ }
}
tmp = tmp->Next;
}
- return obj;
+
+ if (lowestPriority < 1.0) {
+ ASSERT(lowestPriorityObj);
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxTMFindOldestObject: %d pri=%f\n", lowestPriorityObj->Name, lowestPriority);
+ }
+ return lowestPriorityObj;
+ }
+ else {
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxTMFindOldestObject: %d age=%d\n", obj->Name, old);
+ }
+ return obj;
+ }
}
static MemRange *
@@ -330,15 +359,14 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
int i, l;
int texmemsize;
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxTMMoveInTM(%d)\n", tObj->Name);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%d)\n", __FUNCTION__, tObj->Name);
}
fxMesa->stats.reqTexUpload++;
if (!ti->validated) {
- fprintf(stderr,
- "fx Driver: internal error in fxTMMoveInTM() -> not validated\n");
+ fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
fxCloseHardware();
exit(-1);
}
@@ -355,9 +383,9 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
}
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
- fprintf(stderr, "fxmesa: downloading %x (%d) in texture memory in %d\n",
- (GLuint) tObj, tObj->Name, where);
+ if (TDFX_DEBUG & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
+ fprintf(stderr, "%s: downloading %p (%d) in texture memory in %d\n",
+ __FUNCTION__, (void *)tObj, tObj->Name, where);
}
ti->whichTMU = (FxU32) where;
@@ -419,9 +447,9 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
ti->tm[FX_TMU0] = fxTMAddObj(fxMesa, tObj, FX_TMU0, texmemsize);
fxMesa->stats.memTexUpload += texmemsize;
- texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
+ /*texmemsize = (int)grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &(ti->info));*/
ti->tm[FX_TMU1] = fxTMAddObj(fxMesa, tObj, FX_TMU1, texmemsize);
- fxMesa->stats.memTexUpload += texmemsize;
+ fxMesa->stats.memTexUpload += texmemsize; /* ZZZ: required? */
for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
i <= FX_smallLodValue(ti->info); i++, l++) {
@@ -446,9 +474,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
break;
default:
- fprintf(stderr,
- "fx Driver: internal error in fxTMMoveInTM() -> wrong tmu (%d)\n",
- where);
+ fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, where);
fxCloseHardware();
exit(-1);
}
@@ -479,14 +505,17 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
struct gl_texture_image *texImage = tObj->Image[level];
tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "fxTMReloadMipMapLevel(%p (%d), %d)\n", (void *)tObj, tObj->Name, level);
+ }
+
assert(mml);
assert(mml->width > 0);
assert(mml->height > 0);
assert(mml->glideFormat > 0);
if (!ti->validated) {
- fprintf(stderr,
- "fx Driver: internal error in fxTMReloadMipMapLevel() -> not validated\n");
+ fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
fxCloseHardware();
exit(-1);
}
@@ -494,16 +523,14 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
tmu = (int) ti->whichTMU;
fxTMMoveInTM(fxMesa, tObj, tmu);
- fxTexGetInfo(mml->width, mml->height,
- &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ lodlevel = ti->info.largeLodLog2 - (level - ti->minLevel);
- lodlevel -= level;
switch (tmu) {
case FX_TMU0:
case FX_TMU1:
grTexDownloadMipMapLevel(tmu,
ti->tm[tmu]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)),
+ lodlevel,
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
@@ -512,7 +539,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
case FX_TMU_SPLIT:
grTexDownloadMipMapLevel(GR_TMU0,
ti->tm[GR_TMU0]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)),
+ lodlevel,
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
@@ -520,7 +547,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
grTexDownloadMipMapLevel(GR_TMU1,
ti->tm[GR_TMU1]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)),
+ lodlevel,
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
@@ -529,7 +556,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
case FX_TMU_BOTH:
grTexDownloadMipMapLevel(GR_TMU0,
ti->tm[GR_TMU0]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)),
+ lodlevel,
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
@@ -537,7 +564,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
grTexDownloadMipMapLevel(GR_TMU1,
ti->tm[GR_TMU1]->startAddr,
- FX_valueToLod(FX_lodToValue(lodlevel)),
+ lodlevel,
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
ti->info.format,
@@ -545,9 +572,7 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
break;
default:
- fprintf(stderr,
- "fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n",
- tmu);
+ fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, tmu);
fxCloseHardware();
exit(-1);
}
@@ -568,8 +593,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
assert(mml);
if (!ti->validated) {
- fprintf(stderr,
- "fx Driver: internal error in fxTMReloadSubMipMapLevel() -> not validated\n");
+ fprintf(stderr, "%s: INTERNAL ERROR: not validated\n", __FUNCTION__);
fxCloseHardware();
exit(-1);
}
@@ -578,7 +602,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
fxTMMoveInTM(fxMesa, tObj, tmu);
fxTexGetInfo(mml->width, mml->height,
- &lodlevel, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ &lodlevel, NULL, NULL, NULL, NULL, NULL);
if ((ti->info.format == GR_TEXFMT_INTENSITY_8) ||
(ti->info.format == GR_TEXFMT_P_8) ||
@@ -643,9 +667,7 @@ fxTMReloadSubMipMapLevel(fxMesaContext fxMesa,
yoffset, yoffset + height - 1);
break;
default:
- fprintf(stderr,
- "fx Driver: internal error in fxTMReloadSubMipMapLevel() -> wrong tmu (%d)\n",
- tmu);
+ fprintf(stderr, "%s: INTERNAL ERROR: wrong tmu (%d)\n", __FUNCTION__, tmu);
fxCloseHardware();
exit(-1);
}
@@ -656,9 +678,8 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n", (GLuint) tObj,
- tObj->Name);
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+ fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
}
if (!ti->isInTM)
@@ -675,7 +696,7 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
break;
default:
- fprintf(stderr, "fx Driver: internal error in fxTMMoveOutTM()\n");
+ fprintf(stderr, "%s: INTERNAL ERROR: bad TMU (%ld)\n", __FUNCTION__, ti->whichTMU);
fxCloseHardware();
exit(-1);
}
@@ -690,13 +711,17 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
int i;
+ if (TDFX_DEBUG & VERBOSE_TEXTURE) {
+ fprintf(stderr, "%s(%p (%d))\n", __FUNCTION__, (void *)tObj, tObj->Name);
+ }
+
fxTMMoveOutTM(fxMesa, tObj);
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
struct gl_texture_image *texImage = tObj->Image[i];
if (texImage) {
if (texImage->Data) {
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
if (texImage->DriverData) {
diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c
index 9a88e58c47..3c6f51a326 100644
--- a/src/mesa/drivers/glide/fxtris.c
+++ b/src/mesa/drivers/glide/fxtris.c
@@ -1,4 +1,4 @@
-/* $Id: fxtris.c,v 1.23 2003/09/23 14:41:02 brianp Exp $ */
+/* $Id: fxtris.c,v 1.24 2003/10/02 17:36:44 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -136,10 +136,10 @@ fx_translate_vertex( GLcontext *ctx, const GrVertex *src, SWvertex *dst)
dst->win[2] = src->ooz;
dst->win[3] = src->oow;
- dst->color[0] = (GLubyte) src->r;
- dst->color[1] = (GLubyte) src->g;
- dst->color[2] = (GLubyte) src->b;
- dst->color[3] = (GLubyte) src->a;
+ dst->color[0] = src->pargb[2];
+ dst->color[1] = src->pargb[1];
+ dst->color[2] = src->pargb[0];
+ dst->color[3] = src->pargb[3];
dst->texcoord[ts0][0] = fxMesa->inv_s0scale * src->tmuvtx[0].sow * w;
dst->texcoord[ts0][1] = fxMesa->inv_t0scale * src->tmuvtx[0].tow * w;
@@ -208,17 +208,14 @@ fx_fallback_point( fxMesaContext fxMesa,
static void fx_print_vertex( GLcontext *ctx, const GrVertex *v )
{
- fprintf(stderr, "vertex at %p\n", (void *) v);
+ fprintf(stderr, "%s:\n", __FUNCTION__);
- fprintf(stderr, "x %f y %f z %f oow %f\n",
- v->x, v->y, v->ooz, v->oow);
- fprintf(stderr, "r %f g %f b %f a %f\n",
- v->r,
- v->g,
- v->b,
- v->a);
+ fprintf(stderr, "\tvertex at %p\n", (void *) v);
+
+ fprintf(stderr, "\tx %f y %f z %f oow %f\n", v->x, v->y, v->ooz, v->oow);
+ fprintf(stderr, "\tr %d g %d b %d a %d\n", v->pargb[2], v->pargb[1], v->pargb[0], v->pargb[3]);
- fprintf(stderr, "\n");
+ fprintf(stderr, "\n");
}
#define DO_FALLBACK 0
@@ -233,7 +230,9 @@ static void fx_draw_quad( fxMesaContext fxMesa,
GrVertex *v2,
GrVertex *v3 )
{
+ BEGIN_CLIP_LOOP();
QUAD( v0, v1, v2, v3 );
+ END_CLIP_LOOP();
}
static void fx_draw_triangle( fxMesaContext fxMesa,
@@ -241,7 +240,9 @@ static void fx_draw_triangle( fxMesaContext fxMesa,
GrVertex *v1,
GrVertex *v2 )
{
+ BEGIN_CLIP_LOOP();
TRI( v0, v1, v2 );
+ END_CLIP_LOOP();
}
static void fx_draw_line( fxMesaContext fxMesa,
@@ -250,7 +251,9 @@ static void fx_draw_line( fxMesaContext fxMesa,
{
/* No support for wide lines (avoid wide/aa line fallback).
*/
+ BEGIN_CLIP_LOOP();
LINE(v0, v1);
+ END_CLIP_LOOP();
}
static void fx_draw_point( fxMesaContext fxMesa,
@@ -258,7 +261,9 @@ static void fx_draw_point( fxMesaContext fxMesa,
{
/* No support for wide points.
*/
+ BEGIN_CLIP_LOOP();
POINT( v0 );
+ END_CLIP_LOOP();
}
#undef DO_FALLBACK
@@ -307,41 +312,26 @@ static struct {
#define VERT_SET_RGBA( dst, f ) \
do { \
- dst->r = (GLfloat)f[0]; \
- dst->g = (GLfloat)f[1]; \
- dst->b = (GLfloat)f[2]; \
- dst->a = (GLfloat)f[3]; \
+ dst->pargb[2] = f[0]; \
+ dst->pargb[1] = f[1]; \
+ dst->pargb[0] = f[2]; \
+ dst->pargb[3] = f[3]; \
} while (0)
#define VERT_COPY_RGBA( v0, v1 ) \
-do { \
- v0->r = v1->r; \
- v0->g = v1->g; \
- v0->b = v1->b; \
- v0->a = v1->a; \
-} while (0)
+ *(GLuint *)&v0->pargb = *(GLuint *)&v1->pargb
#define VERT_SAVE_RGBA( idx ) \
-do { \
- color[idx][0] = v[idx]->r; \
- color[idx][1] = v[idx]->g; \
- color[idx][2] = v[idx]->b; \
- color[idx][3] = v[idx]->a; \
-} while (0)
+ *(GLuint *)&color[idx] = *(GLuint *)&v[idx]->pargb
#define VERT_RESTORE_RGBA( idx ) \
-do { \
- v[idx]->r = color[idx][0]; \
- v[idx]->g = color[idx][1]; \
- v[idx]->b = color[idx][2]; \
- v[idx]->a = color[idx][3]; \
-} while (0)
+ *(GLuint *)&v[idx]->pargb = *(GLuint *)&color[idx]
#define LOCAL_VARS(n) \
fxMesaContext fxMesa = FX_CONTEXT(ctx); \
- GLfloat color[n][4]; \
+ GLubyte color[n][4]; \
(void) color;
@@ -534,6 +524,321 @@ static void init_rast_tab( void )
}
+/**********************************************************************/
+/* Render whole begin/end objects */
+/**********************************************************************/
+
+
+/* Accelerate vertex buffer rendering when renderindex == 0 and
+ * there is no clipping.
+ */
+
+static void fx_render_vb_points( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ GLint i;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_points\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_POINTS);
+
+ /* Adjust point coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x += PNT_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y += PNT_Y_OFFSET - TRI_Y_OFFSET;
+ }
+
+ grDrawVertexArrayContiguous( GR_POINTS, count-start,
+ fxVB + start, sizeof(GrVertex));
+ /* restore point coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x -= PNT_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y -= PNT_Y_OFFSET - TRI_Y_OFFSET;
+ }
+}
+
+static void fx_render_vb_line_strip( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ GLint i;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_line_strip\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_LINE_STRIP);
+
+ /* adjust line coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
+ }
+
+ grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,
+ fxVB + start, sizeof(GrVertex));
+
+ /* restore line coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
+ }
+}
+
+static void fx_render_vb_line_loop( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ GLint i;
+ GLint j = start;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_line_loop\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_LINE_LOOP);
+
+ if (!(flags & PRIM_BEGIN)) {
+ j++;
+ }
+
+ /* adjust line coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
+ }
+
+ grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,
+ fxVB + j, sizeof(GrVertex));
+
+ if (flags & PRIM_END)
+ grDrawLine( fxVB + (count - 1),
+ fxVB + start );
+
+ /* restore line coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
+ }
+}
+
+static void fx_render_vb_lines( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ GLint i;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_lines\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_LINES);
+
+ /* adjust line coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;
+ }
+
+ grDrawVertexArrayContiguous( GR_LINES, count-start,
+ fxVB + start, sizeof(GrVertex));
+
+ /* restore line coords */
+ for (i = start; i < count; i++) {
+ fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;
+ fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;
+ }
+}
+
+static void fx_render_vb_triangles( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_triangles\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_TRIANGLES);
+
+#if 0
+ /* [dBorca]
+ * apparently, this causes troubles with some programs (GLExcess);
+ * might be a bug in Glide... However, "grDrawVertexArrayContiguous"
+ * eventually calls "grDrawTriangle" for GR_TRIANGLES, so we're better
+ * off doing it by hand...
+ */
+ grDrawVertexArrayContiguous( GR_TRIANGLES, count-start,
+ fxVB + start, sizeof(GrVertex));
+#else
+ {
+ GLuint j;
+ for (j=start+2; j<count; j+=3) {
+ grDrawTriangle(fxVB + (j-2), fxVB + (j-1), fxVB + j);
+ }
+ }
+#endif
+}
+
+
+static void fx_render_vb_tri_strip( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ int mode;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_tri_strip\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_TRIANGLE_STRIP);
+
+ if (flags & PRIM_PARITY)
+ mode = GR_TRIANGLE_STRIP_CONTINUE;
+ else
+ mode = GR_TRIANGLE_STRIP;
+
+ grDrawVertexArrayContiguous( mode, count-start,
+ fxVB + start, sizeof(GrVertex));
+}
+
+
+static void fx_render_vb_tri_fan( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_tri_fan\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_TRIANGLE_FAN);
+
+ grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,
+ fxVB + start, sizeof(GrVertex) );
+}
+
+static void fx_render_vb_quads( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ GLuint i;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_quads\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_QUADS);
+
+ for (i = start ; i < count-3 ; i += 4 ) {
+#define VERT(x) (fxVB + (x))
+ grDrawTriangle( VERT(i), VERT(i+1), VERT(i+3) );
+ grDrawTriangle( VERT(i+1), VERT(i+2), VERT(i+3) );
+#undef VERT
+ }
+}
+
+static void fx_render_vb_quad_strip( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_quad_strip\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_QUAD_STRIP);
+
+ count -= (count-start)&1;
+
+ grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP,
+ count-start, fxVB + start, sizeof(GrVertex));
+}
+
+static void fx_render_vb_poly( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrVertex *fxVB = fxMesa->verts;
+ (void) flags;
+
+ if (TDFX_DEBUG & VERBOSE_VARRAY) {
+ fprintf(stderr, "fx_render_vb_poly\n");
+ }
+
+ fxRenderPrimitive(ctx, GL_POLYGON);
+
+ grDrawVertexArrayContiguous( GR_POLYGON, count-start,
+ fxVB + start, sizeof(GrVertex));
+}
+
+static void fx_render_vb_noop( GLcontext *ctx,
+ GLuint start,
+ GLuint count,
+ GLuint flags )
+{
+ (void) (ctx && start && count && flags);
+}
+
+static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
+ GLuint,
+ GLuint,
+ GLuint) =
+{
+ fx_render_vb_points,
+ fx_render_vb_lines,
+ fx_render_vb_line_loop,
+ fx_render_vb_line_strip,
+ fx_render_vb_triangles,
+ fx_render_vb_tri_strip,
+ fx_render_vb_tri_fan,
+ fx_render_vb_quads,
+ fx_render_vb_quad_strip,
+ fx_render_vb_poly,
+ fx_render_vb_noop,
+};
+
/**********************************************************************/
/* Render whole (indexed) begin/end objects */
@@ -582,7 +887,7 @@ static void init_rast_tab( void )
#undef TAG
#define TAG(x) fx_##x##_verts
#define ELT(x) x
-#include "../common/t_dd_rendertmp.h"
+/*#include "../common/t_dd_rendertmp.h"*/ /* we have fx_render_vb_* now */
@@ -621,7 +926,7 @@ static void fxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
GLuint n )
{
fxMesaContext fxMesa = FX_CONTEXT( ctx );
- GrVertex *vertptr = fxMesa->verts;
+ GrVertex *vertptr = fxMesa->verts;
const GrVertex *start = VERT(elts[0]);
int i;
for (i = 2 ; i < n ; i++) {
@@ -650,8 +955,6 @@ void fxDDChooseRenderState(GLcontext *ctx)
GLuint flags = ctx->_TriangleCaps;
GLuint index = 0;
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
if (flags & ANY_RASTER_FLAGS) {
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= FX_TWOSIDE_BIT;
@@ -665,30 +968,31 @@ void fxDDChooseRenderState(GLcontext *ctx)
fxMesa->draw_tri = fx_draw_triangle;
/* Hook in fallbacks for specific primitives.
- *
- *
+ * [dBorca] Hack alert:
+ * If we're in FSAA mode, we always do anti-aliased primitives.
*/
if (flags & (POINT_FALLBACK|
LINE_FALLBACK|
TRI_FALLBACK))
{
+ if (fxMesa->verbose) {
+ fprintf(stderr, "Voodoo ! fallback (%x), raster (%x)\n",
+ flags & ANY_FALLBACK_FLAGS, flags & ANY_RASTER_FLAGS);
+ }
+
if (flags & POINT_FALLBACK)
fxMesa->draw_point = fx_fallback_point;
if (flags & LINE_FALLBACK)
fxMesa->draw_line = fx_fallback_line;
- if (flags & TRI_FALLBACK) {
-/* fprintf(stderr, "tri fallback\n"); */
+ if (flags & TRI_FALLBACK)
fxMesa->draw_tri = fx_fallback_tri;
- }
index |= FX_FALLBACK_BIT;
}
}
-/* fprintf(stderr, "render index %x\n", index); */
-
tnl->Driver.Render.Points = rast_tab[index].points;
tnl->Driver.Render.Line = rast_tab[index].line;
tnl->Driver.Render.ClippedLine = rast_tab[index].line;
@@ -699,14 +1003,13 @@ void fxDDChooseRenderState(GLcontext *ctx)
tnl->Driver.Render.PrimTabVerts = fx_render_tab_verts;
tnl->Driver.Render.PrimTabElts = fx_render_tab_elts;
tnl->Driver.Render.ClippedPolygon = fxFastRenderClippedPoly;
-
- tnl->Driver.Render.ClippedPolygon = fxRenderClippedPoly;
-
} else {
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
tnl->Driver.Render.ClippedPolygon = fxRenderClippedPoly;
}
+
+ fxMesa->render_index = index;
}
@@ -714,6 +1017,65 @@ void fxDDChooseRenderState(GLcontext *ctx)
/* Runtime render state and callbacks */
/**********************************************************************/
+static void fxRunPipeline( GLcontext *ctx )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GLuint new_gl_state = fxMesa->new_gl_state;
+
+ if (TDFX_DEBUG & VERBOSE_PIPELINE) {
+ fprintf(stderr, "fxRunPipeline()\n");
+ }
+
+ /* Recalculate fog table on projection matrix changes. This used to
+ * be triggered by the NearFar callback.
+ */
+ if (new_gl_state & _NEW_PROJECTION)
+ fxMesa->new_state |= FX_NEW_FOG;
+
+ if (new_gl_state & (_FX_NEW_IS_IN_HARDWARE |
+ _FX_NEW_RENDERSTATE |
+ _FX_NEW_SETUP_FUNCTION |
+ _NEW_TEXTURE)) {
+
+ if (new_gl_state & _FX_NEW_IS_IN_HARDWARE)
+ fxCheckIsInHardware(ctx);
+
+ if (fxMesa->new_state)
+ fxSetupFXUnits(ctx);
+
+ if (!fxMesa->fallback) {
+ if (new_gl_state & _FX_NEW_RENDERSTATE)
+ fxDDChooseRenderState(ctx);
+
+ if (new_gl_state & _FX_NEW_SETUP_FUNCTION)
+ fxChooseVertexState(ctx);
+ }
+
+ if (new_gl_state & _NEW_TEXTURE) {
+ struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
+ struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
+
+ if (t0 && t0->_Current && FX_TEXTURE_DATA(t0)) {
+ fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
+ fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
+ fxMesa->inv_s0scale = 1.0 / fxMesa->s0scale;
+ fxMesa->inv_t0scale = 1.0 / fxMesa->t0scale;
+ }
+
+ if (t1 && t1->_Current && FX_TEXTURE_DATA(t1)) {
+ fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
+ fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
+ fxMesa->inv_s1scale = 1.0 / fxMesa->s1scale;
+ fxMesa->inv_t1scale = 1.0 / fxMesa->t1scale;
+ }
+ }
+ }
+
+ fxMesa->new_gl_state = 0;
+
+ _tnl_run_pipeline( ctx );
+}
+
static GLenum reduced_prim[GL_POLYGON+1] = {
GL_POINTS,
@@ -735,18 +1097,19 @@ static GLenum reduced_prim[GL_POLYGON+1] = {
*/
static void fxRasterPrimitive( GLcontext *ctx, GLenum prim )
{
+ extern void fxSetupCull (GLcontext *ctx);
+
fxMesaContext fxMesa = FX_CONTEXT( ctx );
fxMesa->raster_primitive = prim;
- if (prim == GL_TRIANGLES)
- grCullMode( fxMesa->cullMode );
- else
- grCullMode( GR_CULL_DISABLE );
+
+ fxSetupCull(ctx);
}
-/* Determine the rasterized primitive when drawing filled polygons.
+/* Determine the rasterized primitive when not drawing unfilled
+ * polygons.
*/
static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
{
@@ -755,9 +1118,7 @@ static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
fxMesa->render_primitive = prim;
- if (rprim == GL_TRIANGLES &&
- (ctx->Polygon.FrontMode != GL_FILL ||
- ctx->Polygon.BackMode != GL_FILL))
+ if (rprim == GL_TRIANGLES && (ctx->_TriangleCaps & DD_TRI_UNFILLED))
return;
if (fxMesa->raster_primitive != rprim) {
@@ -765,35 +1126,66 @@ static void fxRenderPrimitive( GLcontext *ctx, GLenum prim )
}
}
+static void fxRenderFinish( GLcontext *ctx )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+
+ if (fxMesa->render_index & FX_FALLBACK_BIT)
+ _swrast_flush( ctx );
+}
+
/**********************************************************************/
/* Manage total rasterization fallbacks */
/**********************************************************************/
+static char *fallbackStrings[] = {
+ "1D/3D Texture map",
+ "glDrawBuffer(GL_FRONT_AND_BACK)",
+ "Separate specular color",
+ "glEnable/Disable(GL_STENCIL_TEST)",
+ "glRenderMode(selection or feedback)",
+ "glLogicOp()",
+ "Texture env mode",
+ "Texture border",
+ "glColorMask",
+ "blend mode",
+ "line stipple"
+};
+
+
+static char *getFallbackString(GLuint bit)
+{
+ int i = 0;
+ while (bit > 1) {
+ i++;
+ bit >>= 1;
+ }
+ return fallbackStrings[i];
+}
+
void fxCheckIsInHardware( GLcontext *ctx )
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLuint oldfallback = !fxMesa->is_in_hardware;
- GLuint newfallback;
-
- fxMesa->is_in_hardware = fx_check_IsInHardware( ctx );
- newfallback = !fxMesa->is_in_hardware;
+ GLuint oldfallback = fxMesa->fallback;
+ GLuint newfallback = fxMesa->fallback = fx_check_IsInHardware( ctx );
if (newfallback) {
if (oldfallback == 0) {
-/* fprintf(stderr, "goint to fallback\n"); */
+ if (fxMesa->verbose) {
+ fprintf(stderr, "Voodoo ! begin SW 0x08%x %s\n", newfallback, getFallbackString(newfallback));
+ }
_swsetup_Wakeup( ctx );
}
}
else {
if (oldfallback) {
-/* fprintf(stderr, "leaving fallback\n"); */
_swrast_flush( ctx );
tnl->Driver.Render.Start = fxCheckTexSizes;
- tnl->Driver.Render.Finish = _swrast_flush;
+ tnl->Driver.Render.Finish = fxRenderFinish;
tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
@@ -804,6 +1196,9 @@ void fxCheckIsInHardware( GLcontext *ctx )
tnl->Driver.Render.Multipass = 0;
fxChooseVertexState(ctx);
fxDDChooseRenderState(ctx);
+ if (fxMesa->verbose) {
+ fprintf(stderr, "Voodoo ! end SW 0x08%x %s\n", oldfallback, getFallbackString(oldfallback));
+ }
}
}
}
@@ -818,8 +1213,9 @@ void fxDDInitTriFuncs( GLcontext *ctx )
firsttime = 0;
}
+ tnl->Driver.RunPipeline = fxRunPipeline;
tnl->Driver.Render.Start = fxCheckTexSizes;
- tnl->Driver.Render.Finish = _swrast_flush;
+ tnl->Driver.Render.Finish = fxRenderFinish;
tnl->Driver.Render.PrimitiveNotify = fxRenderPrimitive;
tnl->Driver.Render.ClippedPolygon = _tnl_RenderClippedPolygon;
tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c
index 9fc73e2379..da9108b7ba 100644
--- a/src/mesa/drivers/glide/fxvb.c
+++ b/src/mesa/drivers/glide/fxvb.c
@@ -1,3 +1,5 @@
+/* $Id: fxvb.c,v 1.19 2003/10/02 17:36:45 brianp Exp $ */
+
/*
* Mesa 3-D graphics library
* Version: 5.1
@@ -37,7 +39,6 @@
#include "mtypes.h"
#include "imports.h"
#include "macros.h"
-#include "context.h"
#include "colormac.h"
#include "math/m_translate.h"
@@ -55,10 +56,7 @@ static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
GrVertex *dst = fxMesa->verts + edst;
GrVertex *src = fxMesa->verts + esrc;
- dst->r = src->r;
- dst->g = src->g;
- dst->b = src->b;
- dst->a = src->a;
+ *(GLuint *)&dst->pargb = *(GLuint *)&src->pargb;
}
typedef void (*emit_func)( GLcontext *, GLuint, GLuint, void * );
@@ -104,7 +102,8 @@ static void import_float_colors( GLcontext *ctx )
}
-#define GET_COLOR(ptr, idx) (((GLfloat (*)[4])((ptr)->Ptr))[idx])
+/* Hack alert: assume chan is 8 bits */
+#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx])
static void interp_extras( GLcontext *ctx,
@@ -114,20 +113,19 @@ static void interp_extras( GLcontext *ctx,
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- /*fprintf(stderr, "%s\n", __FUNCTION__);*/
-
if (VB->ColorPtr[1]) {
- INTERP_4F( t,
+ INTERP_4CHAN( t,
GET_COLOR(VB->ColorPtr[1], dst),
GET_COLOR(VB->ColorPtr[1], out),
GET_COLOR(VB->ColorPtr[1], in) );
-
+#if 0 /* [dBorca] leaving disabled for now */
if (VB->SecondaryColorPtr[1]) {
- INTERP_3F( t,
+ INTERP_3CHAN( t,
GET_COLOR(VB->SecondaryColorPtr[1], dst),
GET_COLOR(VB->SecondaryColorPtr[1], out),
GET_COLOR(VB->SecondaryColorPtr[1], in) );
}
+#endif
}
if (VB->EdgeFlag) {
@@ -143,13 +141,14 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (VB->ColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst),
+ COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst),
GET_COLOR(VB->ColorPtr[1], src) );
-
+#if 0 /* [dBorca] leaving disabled for now */
if (VB->SecondaryColorPtr[1]) {
- COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst),
+ COPY_CHAN4( GET_COLOR(VB->SecondaryColorPtr[1], dst),
GET_COLOR(VB->SecondaryColorPtr[1], src) );
}
+#endif
}
copy_pv(ctx, dst, src);
@@ -285,9 +284,7 @@ void fxCheckTexSizes( GLcontext *ctx )
* In the unfilled and twosided cases we are using the
* Extras ones anyway, so leave them in place.
*/
- if (!(NEED_TWO_SIDED_LIGHTING(ctx) ||
- ctx->Polygon.FrontMode != GL_FILL ||
- ctx->Polygon.BackMode != GL_FILL)) {
+ if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
tnl->Driver.Render.Interp = setup_tab[fxMesa->SetupIndex].interp;
}
}
@@ -358,13 +355,10 @@ void fxChooseVertexState( GLcontext *ctx )
fxMesa->SetupIndex = ind;
- if (NEED_TWO_SIDED_LIGHTING(ctx) ||
- ctx->Polygon.FrontMode != GL_FILL ||
- ctx->Polygon.BackMode != GL_FILL) {
+ if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
tnl->Driver.Render.Interp = interp_extras;
tnl->Driver.Render.CopyPV = copy_pv_extras;
- }
- else {
+ } else {
tnl->Driver.Render.Interp = setup_tab[ind].interp;
tnl->Driver.Render.CopyPV = copy_pv;
}
diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h
index e53cf981f5..d1a022ff5e 100644
--- a/src/mesa/drivers/glide/fxvbtmp.h
+++ b/src/mesa/drivers/glide/fxvbtmp.h
@@ -1,4 +1,4 @@
-/* $Id: fxvbtmp.h,v 1.12 2002/10/29 20:28:57 brianp Exp $ */
+/* $Id: fxvbtmp.h,v 1.13 2003/10/02 17:36:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -45,6 +45,7 @@ static void TAG(emit)( GLcontext *ctx,
GLuint proj_stride = VB->NdcPtr->stride;
GrVertex *v = (GrVertex *)dest;
GLfloat u0scale,v0scale,u1scale,v1scale;
+ const GLubyte *mask = VB->ClipMask;
const GLfloat *const s = ctx->Viewport._WindowMap.m;
int i;
@@ -86,11 +87,16 @@ static void TAG(emit)( GLcontext *ctx,
for (i=start; i < end; i++, v++) {
if (IND & SETUP_XYZW) {
- /* unclipped */
- v->x = s[0] * proj[0][0] + s[12];
- v->y = s[5] * proj[0][1] + s[13];
- v->ooz = s[10] * proj[0][2] + s[14];
- v->oow = proj[0][3];
+ if (mask[i] == 0) {
+ /* unclipped */
+ v->x = s[0] * proj[0][0] + s[12];
+ v->y = s[5] * proj[0][1] + s[13];
+ v->ooz = s[10] * proj[0][2] + s[14];
+ v->oow = proj[0][3];
+ } else {
+ /* clipped */
+ v->oow = 1.0;
+ }
if (IND & SETUP_SNAP) {
#if defined(USE_IEEE)
@@ -108,10 +114,10 @@ static void TAG(emit)( GLcontext *ctx,
proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride);
}
if (IND & SETUP_RGBA) {
- v->r = (GLfloat) col[0][0];
- v->g = (GLfloat) col[0][1];
- v->b = (GLfloat) col[0][2];
- v->a = (GLfloat) col[0][3];
+ v->pargb[2] = col[0][0];
+ v->pargb[1] = col[0][1];
+ v->pargb[0] = col[0][2];
+ v->pargb[3] = col[0][3];
STRIDE_4UB(col, col_stride);
}
if (IND & SETUP_TMU0) {
@@ -210,10 +216,10 @@ static void TAG(interp)( GLcontext *ctx,
}
- INTERP_F( t, dst->r, out->r, in->r );
- INTERP_F( t, dst->g, out->g, in->g );
- INTERP_F( t, dst->b, out->b, in->b );
- INTERP_F( t, dst->a, out->a, in->a );
+ INTERP_UB( t, dst->pargb[0], out->pargb[0], in->pargb[0] );
+ INTERP_UB( t, dst->pargb[1], out->pargb[1], in->pargb[1] );
+ INTERP_UB( t, dst->pargb[2], out->pargb[2], in->pargb[2] );
+ INTERP_UB( t, dst->pargb[3], out->pargb[3], in->pargb[3] );
if (IND & SETUP_TMU0) {
if (IND & SETUP_PTEX) {
diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c
index a55b9cdf2c..1337585aec 100644
--- a/src/mesa/drivers/glide/fxwgl.c
+++ b/src/mesa/drivers/glide/fxwgl.c
@@ -1,4 +1,4 @@
-/* $Id: fxwgl.c,v 1.17 2003/08/19 15:52:53 brianp Exp $ */
+/* $Id: fxwgl.c,v 1.18 2003/10/02 17:36:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -35,7 +35,7 @@
*/
-#ifdef __WIN32__
+#ifdef _WIN32
#ifdef __cplusplus
extern "C"
@@ -51,11 +51,11 @@ extern "C"
}
#endif
-#include <stdio.h>
#include "GL/fxmesa.h"
#include "glheader.h"
-#include "fxdrv.h"
#include "glapi.h"
+#include "imports.h"
+#include "fxdrv.h"
#define MAX_MESA_ATTRS 20
@@ -71,73 +71,62 @@ struct __pixelformat__
GLint mesaAttr[MAX_MESA_ATTRS];
};
-WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
+//WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
struct __pixelformat__ pix[] = {
-#if 0
- /* None */
+ /* 16bit RGB565 single buffer with depth */
{
- {
- sizeof(PIXELFORMATDESCRIPTOR), 1,
- PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
- PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
+ {sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
PFD_TYPE_RGBA,
16,
- 5, 11, 6, 5, 5, 0, 0, 0,
+ 5, 0, 6, 5, 5, 11, 0, 0,
0, 0, 0, 0, 0,
- 0,
+ 16,
0,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {
- FXMESA_COLORDEPTH, 16,
- FXMESA_DOUBLEBUFFER,
+ {FXMESA_COLORDEPTH, 16,
FXMESA_ALPHA_SIZE, 0,
- FXMESA_DEPTH_SIZE, 0,
+ FXMESA_DEPTH_SIZE, 16,
FXMESA_STENCIL_SIZE, 0,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
- }
+ }
,
-
- /* Alpha */
+ /* 16bit RGB565 double buffer with depth */
{
- {
- sizeof(PIXELFORMATDESCRIPTOR), 1,
+ {sizeof(PIXELFORMATDESCRIPTOR), 1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
PFD_TYPE_RGBA,
16,
- 5, 10, 5, 5, 5, 0, 1, 15,
+ 5, 0, 6, 5, 5, 11, 0, 0,
0, 0, 0, 0, 0,
- 0,
+ 16,
0,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {
- FXMESA_COLORDEPTH, 15,
+ {FXMESA_COLORDEPTH, 16,
FXMESA_DOUBLEBUFFER,
- FXMESA_ALPHA_SIZE, 1,
- FXMESA_DEPTH_SIZE, 0,
+ FXMESA_ALPHA_SIZE, 0,
+ FXMESA_DEPTH_SIZE, 16,
FXMESA_STENCIL_SIZE, 0,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
- }
+ }
,
-
- /* Depth */
+ /* 16bit ARGB1555 single buffer with depth */
{
- {
- sizeof(PIXELFORMATDESCRIPTOR), 1,
- PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
- PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
+ {sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
PFD_TYPE_RGBA,
16,
- 5, 11, 6, 5, 5, 0, 0, 0,
+ 5, 0, 5, 5, 5, 10, 1, 15,
0, 0, 0, 0, 0,
16,
0,
@@ -145,156 +134,118 @@ struct __pixelformat__ pix[] = {
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {
- FXMESA_COLORDEPTH, 16,
- FXMESA_DOUBLEBUFFER,
- FXMESA_ALPHA_SIZE, 0,
+ {FXMESA_COLORDEPTH, 15,
+ FXMESA_ALPHA_SIZE, 1,
FXMESA_DEPTH_SIZE, 16,
FXMESA_STENCIL_SIZE, 0,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
- }
+ }
,
-
- /* None */
+ /* 16bit ARGB1555 double buffer with depth */
{
- {
- sizeof(PIXELFORMATDESCRIPTOR), 1,
+ {sizeof(PIXELFORMATDESCRIPTOR), 1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
PFD_TYPE_RGBA,
- 32,
- 8, 16, 8, 8, 8, 0, 0, 0,
+ 16,
+ 5, 0, 5, 5, 5, 10, 1, 15,
0, 0, 0, 0, 0,
- 0,
+ 16,
0,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {
- FXMESA_COLORDEPTH, 32,
+ {FXMESA_COLORDEPTH, 15,
FXMESA_DOUBLEBUFFER,
- FXMESA_ALPHA_SIZE, 0,
- FXMESA_DEPTH_SIZE, 0,
+ FXMESA_ALPHA_SIZE, 1,
+ FXMESA_DEPTH_SIZE, 16,
FXMESA_STENCIL_SIZE, 0,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
- }
+ }
,
-
- /* Alpha */
+#if 1
+ /* 24bit RGB888 single buffer with depth */
{
- {
- sizeof(PIXELFORMATDESCRIPTOR), 1,
- PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
- PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
+ {sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
PFD_TYPE_RGBA,
- 32,
- 8, 16, 8, 8, 8, 0, 8, 24,
+ 24,
+ 8, 0, 8, 8, 8, 16, 0, 0,
0, 0, 0, 0, 0,
- 0,
- 0,
+ 24,
+ 8,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {
- FXMESA_COLORDEPTH, 32,
- FXMESA_DOUBLEBUFFER,
+ {FXMESA_COLORDEPTH, 32,
FXMESA_ALPHA_SIZE, 8,
- FXMESA_DEPTH_SIZE, 0,
- FXMESA_STENCIL_SIZE, 0,
+ FXMESA_DEPTH_SIZE, 24,
+ FXMESA_STENCIL_SIZE, 8,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
- }
+ }
,
-
- /* Depth */
- {
- {
- sizeof(PIXELFORMATDESCRIPTOR), 1,
- PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
- PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
- PFD_TYPE_RGBA,
- 32,
- 8, 16, 8, 8, 8, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 16,
- 0,
- 0,
- PFD_MAIN_PLANE,
- 0, 0, 0, 0}
- ,
- {
- FXMESA_COLORDEPTH, 32,
- FXMESA_DOUBLEBUFFER,
- FXMESA_ALPHA_SIZE, 0,
- FXMESA_DEPTH_SIZE, 16,
- FXMESA_STENCIL_SIZE, 0,
- FXMESA_ACCUM_SIZE, 0,
- FXMESA_NONE}
- }
-#endif
- /* 16bit RGB565 */
+ /* 24bit RGB888 double buffer with depth */
{
{sizeof(PIXELFORMATDESCRIPTOR), 1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
PFD_TYPE_RGBA,
- 16,
- 5, 11, 6, 5, 5, 0, 0, 0,
+ 24,
+ 8, 0, 8, 8, 8, 16, 0, 0,
0, 0, 0, 0, 0,
- 16,
- 0,
+ 24,
+ 8,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {FXMESA_COLORDEPTH, 16,
+ {FXMESA_COLORDEPTH, 32,
FXMESA_DOUBLEBUFFER,
- FXMESA_ALPHA_SIZE, 0,
- FXMESA_DEPTH_SIZE, 16,
- FXMESA_STENCIL_SIZE, 0,
+ FXMESA_ALPHA_SIZE, 8,
+ FXMESA_DEPTH_SIZE, 24,
+ FXMESA_STENCIL_SIZE, 8,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
- }
- ,
- /* 16bit ARGB1555 */
+ },
+#endif
+ /* 32bit ARGB8888 single buffer with depth */
{
{sizeof(PIXELFORMATDESCRIPTOR), 1,
- PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
- PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL,
PFD_TYPE_RGBA,
- 16,
- 5, 10, 5, 5, 5, 0, 1, 15,
+ 32,
+ 8, 0, 8, 8, 8, 16, 8, 24,
0, 0, 0, 0, 0,
- 16,
- 0,
+ 24,
+ 8,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
,
- {FXMESA_COLORDEPTH, 15,
- FXMESA_DOUBLEBUFFER,
- FXMESA_ALPHA_SIZE, 1,
- FXMESA_DEPTH_SIZE, 16,
- FXMESA_STENCIL_SIZE, 0,
+ {FXMESA_COLORDEPTH, 32,
+ FXMESA_ALPHA_SIZE, 8,
+ FXMESA_DEPTH_SIZE, 24,
+ FXMESA_STENCIL_SIZE, 8,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
}
,
- /* 32bit ARGB8888 */
+ /* 32bit ARGB8888 double buffer with depth */
{
{sizeof(PIXELFORMATDESCRIPTOR), 1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER | PFD_SWAP_COPY,
PFD_TYPE_RGBA,
32,
- 8, 16, 8, 8, 8, 0, 8, 24,
+ 8, 0, 8, 8, 8, 16, 8, 24,
0, 0, 0, 0, 0,
24,
- 0,
+ 8,
0,
PFD_MAIN_PLANE,
0, 0, 0, 0}
@@ -303,7 +254,7 @@ struct __pixelformat__ pix[] = {
FXMESA_DOUBLEBUFFER,
FXMESA_ALPHA_SIZE, 8,
FXMESA_DEPTH_SIZE, 24,
- FXMESA_STENCIL_SIZE, 0,
+ FXMESA_STENCIL_SIZE, 8,
FXMESA_ACCUM_SIZE, 0,
FXMESA_NONE}
}
@@ -331,7 +282,7 @@ static BITMAPINFO *dibBMI;
static HBITMAP dibHBM;
static HWND dibWnd;
-LONG GLAPIENTRY
+static LRESULT APIENTRY
__wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
long ret; /* Now gives the resized window at the end to hWNDOldProc */
@@ -343,6 +294,7 @@ __wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
break;
case WM_DISPLAYCHANGE:
case WM_SIZE:
+#if 0
if (wParam != SIZE_MINIMIZED) {
static int moving = 0;
if (!moving) {
@@ -361,6 +313,7 @@ __wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
fxMesaUpdateScreenSize(ctx);
}
}
+#endif
break;
case WM_ACTIVATE:
break;
@@ -379,13 +332,13 @@ __wglMonitor(HWND hwnd, UINT message, UINT wParam, LONG lParam)
return (ret);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
{
return (FALSE);
}
-HGLRC GLAPIENTRY
+GLAPI HGLRC GLAPIENTRY
wglCreateContext(HDC hdc)
{
HWND hWnd;
@@ -412,7 +365,7 @@ wglCreateContext(HDC hdc)
SetWindowLong(hWnd, GWL_WNDPROC, (LONG) __wglMonitor);
}
-#ifndef FX_SILENT
+#ifdef FX_DEBUG
freopen("MESA.LOG", "w", stderr);
#endif
@@ -425,11 +378,11 @@ wglCreateContext(HDC hdc)
error = !(ctx = fxMesaCreateBestContext((GLuint) hWnd, cliRect.right, cliRect.bottom, pix[curPFD - 1].mesaAttr));
}
- if (getenv("SST_DUALHEAD"))
+ /*if (getenv("SST_DUALHEAD"))
haveDualHead =
((atoi(getenv("SST_DUALHEAD")) == 1) ? GL_TRUE : GL_FALSE);
else
- haveDualHead = GL_FALSE;
+ haveDualHead = GL_FALSE;*/
if (error) {
SetLastError(0);
@@ -445,14 +398,14 @@ wglCreateContext(HDC hdc)
return ((HGLRC) 1);
}
-HGLRC GLAPIENTRY
+GLAPI HGLRC GLAPIENTRY
wglCreateLayerContext(HDC hdc, int iLayerPlane)
{
SetLastError(0);
return (NULL);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglDeleteContext(HGLRC hglrc)
{
if (ctx && hglrc == (HGLRC) 1) {
@@ -471,7 +424,7 @@ wglDeleteContext(HGLRC hglrc)
return (FALSE);
}
-HGLRC GLAPIENTRY
+GLAPI HGLRC GLAPIENTRY
wglGetCurrentContext(VOID)
{
if (ctx)
@@ -481,7 +434,7 @@ wglGetCurrentContext(VOID)
return (NULL);
}
-HDC GLAPIENTRY
+GLAPI HDC GLAPIENTRY
wglGetCurrentDC(VOID)
{
if (ctx)
@@ -491,10 +444,11 @@ wglGetCurrentDC(VOID)
return (NULL);
}
-PROC GLAPIENTRY
+GLAPI PROC GLAPIENTRY
wglGetProcAddress(LPCSTR lpszProc)
-{
+{
PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc);
+
if (p)
return p;
@@ -502,7 +456,7 @@ wglGetProcAddress(LPCSTR lpszProc)
return (NULL);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglMakeCurrent(HDC hdc, HGLRC hglrc)
{
if ((hdc == NULL) && (hglrc == NULL))
@@ -520,7 +474,7 @@ wglMakeCurrent(HDC hdc, HGLRC hglrc)
return (TRUE);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
{
if (!ctx || hglrc1 != (HGLRC) 1 || hglrc1 != hglrc2) {
@@ -531,19 +485,17 @@ wglShareLists(HGLRC hglrc1, HGLRC hglrc2)
return (TRUE);
}
-BOOL GLAPIENTRY
-wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
- DWORD listBase)
+static BOOL
+wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, DWORD numChars,
+ DWORD listBase)
{
-#define VERIFY(a) a
-
TEXTMETRIC metric;
BITMAPINFO *dibInfo;
HDC bitDevice;
COLORREF tempColor;
int i;
- VERIFY(GetTextMetrics(fontDevice, &metric));
+ GetTextMetrics(fontDevice, &metric);
dibInfo = (BITMAPINFO *) calloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD), 1);
dibInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -552,8 +504,6 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
dibInfo->bmiHeader.biCompression = BI_RGB;
bitDevice = CreateCompatibleDC(fontDevice);
- // HDC bitDevice = CreateDC("DISPLAY", NULL, NULL, NULL);
- // VERIFY(bitDevice);
// Swap fore and back colors so the bitmap has the right polarity
tempColor = GetBkColor(bitDevice);
@@ -561,7 +511,7 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
SetTextColor(bitDevice, tempColor);
// Place chars based on base line
- VERIFY(SetTextAlign(bitDevice, TA_BASELINE) >= 0 ? 1 : 0);
+ SetTextAlign(bitDevice, TA_BASELINE);
for (i = 0; i < (int)numChars; i++) {
SIZE size;
@@ -574,8 +524,8 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
curChar = (char)(i + firstChar); // [koolsmoky] explicit cast
// Find how high/wide this character is
- VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size));
-
+ GetTextExtentPoint32(bitDevice, &curChar, 1, &size);
+
// Create the output bitmap
charWidth = size.cx;
charHeight = size.cy;
@@ -586,18 +536,17 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
// Assign the output bitmap to the device
origBmap = SelectObject(bitDevice, bitObject);
- VERIFY(origBmap);
- VERIFY(PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS));
+ PatBlt(bitDevice, 0, 0, bmapWidth, bmapHeight, BLACKNESS);
// Use our source font on the device
- VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT)));
+ SelectObject(bitDevice, GetCurrentObject(fontDevice, OBJ_FONT));
// Draw the character
- VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1));
+ TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1);
// Unselect our bmap object
- VERIFY(SelectObject(bitDevice, origBmap));
+ SelectObject(bitDevice, origBmap);
// Convert the display dependant representation to a 1 bit deep DIB
numBytes = (bmapWidth * bmapHeight) / 8;
@@ -606,7 +555,6 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
dibInfo->bmiHeader.biHeight = bmapHeight;
res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
dibInfo, DIB_RGB_COLORS);
- //VERIFY(res);
// Create the GL object
glNewList(i + listBase, GL_COMPILE);
@@ -623,21 +571,20 @@ wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChars,
}
// Destroy the DC
- VERIFY(DeleteDC(bitDevice));
+ DeleteDC(bitDevice);
FREE(dibInfo);
return TRUE;
-#undef VERIFY
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase)
{
return (FALSE);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglUseFontOutlinesA(HDC hdc, DWORD first, DWORD count,
DWORD listBase, FLOAT deviation,
FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
@@ -646,7 +593,7 @@ wglUseFontOutlinesA(HDC hdc, DWORD first, DWORD count,
return (FALSE);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglUseFontOutlinesW(HDC hdc, DWORD first, DWORD count,
DWORD listBase, FLOAT deviation,
FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
@@ -656,7 +603,7 @@ wglUseFontOutlinesW(HDC hdc, DWORD first, DWORD count,
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglSwapLayerBuffers(HDC hdc, UINT fuPlanes)
{
if (ctx && WindowFromDC(hdc) == hWND) {
@@ -669,11 +616,46 @@ wglSwapLayerBuffers(HDC hdc, UINT fuPlanes)
return (FALSE);
}
-int GLAPIENTRY
-wglChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
+GLAPI int GLAPIENTRY
+wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
{
int i, best = -1, qt_valid_pix;
+#if 0
+ FILE *pix_file;
+ pix_file = fopen("pix_log.txt", "a");
+ if (pix_file) {
+ fprintf(pix_file, "wglChoosePixelFormat\n");
+ fprintf(pix_file, "nSize = %d\n",ppfd->nSize);
+ fprintf(pix_file, "nVersion = %d\n",ppfd->nVersion);
+ fprintf(pix_file, "dwFlags = %d\n",ppfd->dwFlags);
+ fprintf(pix_file, "iPixelType = %d\n",ppfd->iPixelType);
+ fprintf(pix_file, "cColorBits = %d\n",ppfd->cColorBits);
+ fprintf(pix_file, "cRedBits = %d\n",ppfd->cRedBits);
+ fprintf(pix_file, "cRedShift = %d\n",ppfd->cRedShift);
+ fprintf(pix_file, "cGreenBits = %d\n",ppfd->cGreenBits);
+ fprintf(pix_file, "cGreenShift = %d\n",ppfd->cGreenShift);
+ fprintf(pix_file, "cBlueBits = %d\n",ppfd->cBlueBits);
+ fprintf(pix_file, "cBlueShift = %d\n",ppfd->cBlueShift);
+ fprintf(pix_file, "cAlphaBits = %d\n",ppfd->cAlphaBits);
+ fprintf(pix_file, "cAlphaShift = %d\n",ppfd->cAlphaShift);
+ fprintf(pix_file, "cAccumBits = %d\n",ppfd->cAccumBits);
+ fprintf(pix_file, "cAccumRedBits = %d\n",ppfd->cAccumRedBits);
+ fprintf(pix_file, "cAccumGreenBits = %d\n",ppfd->cAccumGreenBits);
+ fprintf(pix_file, "cAccumBlueBits = %d\n",ppfd->cAccumBlueBits);
+ fprintf(pix_file, "cAccumAlphaBits = %d\n",ppfd->cAccumAlphaBits);
+ fprintf(pix_file, "cDepthBits = %d\n",ppfd->cDepthBits);
+ fprintf(pix_file, "cStencilBits = %d\n",ppfd->cStencilBits);
+ fprintf(pix_file, "cAuxBuffers = %d\n",ppfd->cAuxBuffers);
+ fprintf(pix_file, "iLayerType = %d\n",ppfd->iLayerType);
+ fprintf(pix_file, "bReserved = %d\n",ppfd->bReserved);
+ fprintf(pix_file, "dwLayerMask = %d\n",ppfd->dwLayerMask);
+ fprintf(pix_file, "dwVisibleMask = %d\n",ppfd->dwVisibleMask);
+ fprintf(pix_file, "dwDamageMask = %d\n",ppfd->dwDamageMask);
+ }
+ fclose(pix_file);
+#endif
+
qt_valid_pix = qt_pix;
if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1) {
@@ -706,6 +688,11 @@ wglChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
if (ppfd->cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0)
continue; /* need alpha buffer */
+#if 0
+ if ((ppfd->cColorBits == 32) && (ppfd->cStencilBits > 0 && pix[i].pfd.cStencilBits == 0))
+ continue; /* need stencil */
+#endif
+
if (ppfd->iPixelType == pix[i].pfd.iPixelType) {
best = i + 1;
break;
@@ -720,13 +707,14 @@ wglChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
return (best);
}
-int GLAPIENTRY
-ChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR * ppfd)
+GLAPI int GLAPIENTRY
+ChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
{
+
return wglChoosePixelFormat(hdc, ppfd);
}
-int GLAPIENTRY
+GLAPI int GLAPIENTRY
wglDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd)
{
@@ -746,14 +734,14 @@ wglDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
return (qt_valid_pix);
}
-int GLAPIENTRY
+GLAPI int GLAPIENTRY
DescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd)
{
return wglDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
}
-int GLAPIENTRY
+GLAPI int GLAPIENTRY
wglGetPixelFormat(HDC hdc)
{
if (curPFD == 0) {
@@ -764,15 +752,14 @@ wglGetPixelFormat(HDC hdc)
return (curPFD);
}
-int GLAPIENTRY
+GLAPI int GLAPIENTRY
GetPixelFormat(HDC hdc)
{
return wglGetPixelFormat(hdc);
}
-BOOL GLAPIENTRY
-wglSetPixelFormat(HDC hdc, int iPixelFormat,
- CONST PIXELFORMATDESCRIPTOR * ppfd)
+GLAPI BOOL GLAPIENTRY
+wglSetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR * ppfd)
{
int qt_valid_pix;
@@ -788,7 +775,7 @@ wglSetPixelFormat(HDC hdc, int iPixelFormat,
return (TRUE);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
wglSwapBuffers(HDC hdc)
{
if (!ctx) {
@@ -801,16 +788,152 @@ wglSwapBuffers(HDC hdc)
return (TRUE);
}
-BOOL GLAPIENTRY
-SetPixelFormat(HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR * ppfd)
+GLAPI BOOL GLAPIENTRY
+SetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR * ppfd)
{
return wglSetPixelFormat(hdc, iPixelFormat, ppfd);
}
-BOOL GLAPIENTRY
+GLAPI BOOL GLAPIENTRY
SwapBuffers(HDC hdc)
{
return wglSwapBuffers(hdc);
}
+static FIXED FixedFromDouble(double d)
+{
+ long l = (long) (d * 65536L);
+ return *(FIXED *)&l;
+}
+
+/*
+** This was yanked from windows/gdi/wgl.c
+*/
+GLAPI BOOL GLAPIENTRY
+wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase)
+{
+ int i;
+ GLuint font_list;
+ DWORD size;
+ GLYPHMETRICS gm;
+ HANDLE hBits;
+ LPSTR lpBits;
+ MAT2 mat;
+ int success = TRUE;
+
+ if (first<0)
+ return FALSE;
+ if (count<0)
+ return FALSE;
+ if (listBase<0)
+ return FALSE;
+
+ font_list = listBase;
+
+ mat.eM11 = FixedFromDouble(1);
+ mat.eM12 = FixedFromDouble(0);
+ mat.eM21 = FixedFromDouble(0);
+ mat.eM22 = FixedFromDouble(-1);
+
+ memset(&gm,0,sizeof(gm));
+
+ /*
+ ** If we can't get the glyph outline, it may be because this is a fixed
+ ** font. Try processing it that way.
+ */
+ if( GetGlyphOutline(hdc, first, GGO_BITMAP, &gm, 0, NULL, &mat)
+ == GDI_ERROR )
+ {
+ return wglUseFontBitmaps_FX( hdc, first, count, listBase );
+ }
+
+ /*
+ ** Otherwise process all desired characters.
+ */
+ for (i = 0; i < count; i++)
+ {
+ DWORD err;
+
+ glNewList( font_list+i, GL_COMPILE );
+
+ /* allocate space for the bitmap/outline */
+ size = GetGlyphOutline(hdc, first + i, GGO_BITMAP, &gm, 0, NULL, &mat);
+ if (size == GDI_ERROR)
+ {
+ glEndList( );
+ err = GetLastError();
+ success = FALSE;
+ continue;
+ }
+
+ hBits = GlobalAlloc(GHND, size+1);
+ lpBits = GlobalLock(hBits);
+
+ err = GetGlyphOutline(hdc, /* handle to device context */
+ first + i, /* character to query */
+ GGO_BITMAP, /* format of data to return */
+ &gm, /* pointer to structure for metrics*/
+ size, /* size of buffer for data */
+ lpBits, /* pointer to buffer for data */
+ &mat /* pointer to transformation */
+ /* matrix structure */
+ );
+
+ if (err == GDI_ERROR)
+ {
+ GlobalUnlock(hBits);
+ GlobalFree(hBits);
+
+ glEndList( );
+ err = GetLastError();
+ success = FALSE;
+ continue;
+ }
+
+ glBitmap(gm.gmBlackBoxX,gm.gmBlackBoxY,
+ -gm.gmptGlyphOrigin.x,
+ gm.gmptGlyphOrigin.y,
+ gm.gmCellIncX,gm.gmCellIncY,
+ (const GLubyte * )lpBits);
+
+ GlobalUnlock(hBits);
+ GlobalFree(hBits);
+
+ glEndList( );
+ }
+
+ return success;
+}
+
+GLAPI BOOL GLAPIENTRY
+wglDescribeLayerPlane(HDC hdc, int iPixelFormat, int iLayerPlane,
+ UINT nBytes, LPLAYERPLANEDESCRIPTOR ppfd)
+{
+ SetLastError(0);
+ return (FALSE);
+}
+
+GLAPI int GLAPIENTRY
+wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart,
+ int cEntries, CONST COLORREF *pcr)
+{
+ SetLastError(0);
+ return (FALSE);
+}
+
+GLAPI BOOL GLAPIENTRY
+wglRealizeLayerPalette(HDC hdc,int iLayerPlane,BOOL bRealize)
+{
+ SetLastError(0);
+ return(FALSE);
+}
+
+GLAPI int GLAPIENTRY
+wglSetLayerPaletteEntries(HDC hdc,int iLayerPlane, int iStart,
+ int cEntries, CONST COLORREF *pcr)
+{
+ SetLastError(0);
+ return(FALSE);
+}
+
#endif /* FX */
diff --git a/src/mesa/x86/assyntax.h b/src/mesa/x86/assyntax.h
index 6ee6ac6c29..53e554728d 100644
--- a/src/mesa/x86/assyntax.h
+++ b/src/mesa/x86/assyntax.h
@@ -1,4 +1,4 @@
-/* $Id: assyntax.h,v 1.21 2002/06/11 01:26:58 brianp Exp $ */
+/* $Id: assyntax.h,v 1.22 2003/10/02 17:36:45 brianp Exp $ */
#ifndef __ASSYNTAX_H__
#define __ASSYNTAX_H__
@@ -254,7 +254,7 @@
#endif /* ACK_ASSEMBLER */
-#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(DJGPP)
+#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) || defined(__GNUC__) && !defined(__DJGPP__) && !defined(__MINGW32__)
#define GLNAME(a) a
#else
#define GLNAME(a) CONCAT(_,a)