summaryrefslogtreecommitdiff
path: root/xc/lib/GL
diff options
context:
space:
mode:
authordawes <dawes>2000-12-21 19:23:26 +0000
committerdawes <dawes>2000-12-21 19:23:26 +0000
commit856c96701fa6c514447af12b4b881f762e59767c (patch)
tree14a18bab24f9003a9c4c50457bbc57528b30b153 /xc/lib/GL
parentde862f7f2c68c12cbfdb72a72c4ea6e97c968f90 (diff)
Import of XFree86 4.0.2X_4_0_2
Diffstat (limited to 'xc/lib/GL')
-rw-r--r--xc/lib/GL/Imakefile22
-rw-r--r--xc/lib/GL/dri/XF86dri.c68
-rw-r--r--xc/lib/GL/dri/xf86dri.h27
-rw-r--r--xc/lib/GL/dri/xf86dristr.h56
-rw-r--r--xc/lib/GL/glx/glxclient.h4
-rw-r--r--xc/lib/GL/glx/glxext.c7
-rw-r--r--xc/lib/GL/mesa/dri/dri_mesa.c119
-rw-r--r--xc/lib/GL/mesa/dri/dri_mesaint.h6
-rw-r--r--xc/lib/GL/mesa/dri/dri_xmesaapi.h12
-rw-r--r--xc/lib/GL/mesa/src/Imakefile11
-rw-r--r--xc/lib/GL/mesa/src/OSmesa/Imakefile8
-rw-r--r--xc/lib/GL/mesa/src/X86/Imakefile18
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/Imakefile17
-rw-r--r--xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/Imakefile17
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/i810/i810tritmp.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/Imakefile17
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/mga/mgatritmp.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/Imakefile17
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.c3
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.h7
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_dd.c8
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c35
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c9
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_lock.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_span.c234
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_state.c19
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tex.h9
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_vb.c20
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c31
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/Imakefile17
-rw-r--r--xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c14
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/Imakefile17
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxclip.c55
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxcva.c24
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxdd.c339
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c123
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c156
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h28
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h190
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c50
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h12
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c180
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h539
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c20
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c1325
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c482
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h8
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h13
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c66
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h47
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c41
58 files changed, 2856 insertions, 1772 deletions
diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile
index a7771d202..d7cf1884a 100644
--- a/xc/lib/GL/Imakefile
+++ b/xc/lib/GL/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.33 2000/11/13 23:31:22 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/Imakefile,v 1.34 2000/12/12 23:24:26 dawes Exp $
#include <Threads.tmpl>
@@ -55,7 +55,7 @@ NormalLintTarget($(PROFSRC))
MESAOBJS = mesa/src/?*.o
#ifdef i386Architecture
- ASM_OBJS = mesa/src/X86/common_x86_asm.o \
+ASM_BASE_OBJS = mesa/src/X86/common_x86_asm.o \
mesa/src/X86/x86_cliptest.o \
mesa/src/X86/x86_vertex.o \
mesa/src/X86/x86_xform_masked2.o \
@@ -63,10 +63,14 @@ NormalLintTarget($(PROFSRC))
mesa/src/X86/x86_xform_masked4.o \
mesa/src/X86/x86_xform_raw2.o \
mesa/src/X86/x86_xform_raw3.o \
- mesa/src/X86/x86_xform_raw4.o \
- mesa/src/X86/mmx_blend.o
-#ifdef MesaUse3DNow
- ASM_OBJS += mesa/src/X86/3dnow_norm_raw.o \
+ mesa/src/X86/x86_xform_raw4.o
+
+#if MesaUseMMX
+ MMX_OBJS = mesa/src/X86/mmx_blend.o
+#endif
+
+#if MesaUse3DNow
+ 3DNOW_OBJS = mesa/src/X86/3dnow_norm_raw.o \
mesa/src/X86/3dnow_vertex.o \
mesa/src/X86/3dnow_xform_masked1.o \
mesa/src/X86/3dnow_xform_masked2.o \
@@ -77,8 +81,8 @@ NormalLintTarget($(PROFSRC))
mesa/src/X86/3dnow_xform_raw3.o \
mesa/src/X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
- ASM_OBJS += mesa/src/X86/katmai_norm_raw.o \
+#if MesaUseKatmai
+ KATMAI_OBJS = mesa/src/X86/katmai_norm_raw.o \
mesa/src/X86/katmai_vertex.o \
mesa/src/X86/katmai_xform_masked1.o \
mesa/src/X86/katmai_xform_masked2.o \
@@ -90,6 +94,8 @@ NormalLintTarget($(PROFSRC))
mesa/src/X86/katmai_xform_raw4.o
#endif
+ ASM_OBJS = $(ASM_BASE_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) $(KATMAI_OBJS)
+
MESAOBJS = mesa/src/?*.o mesa/src/X86/?*.o
#endif
diff --git a/xc/lib/GL/dri/XF86dri.c b/xc/lib/GL/dri/XF86dri.c
index 3800110b4..a004aeb91 100644
--- a/xc/lib/GL/dri/XF86dri.c
+++ b/xc/lib/GL/dri/XF86dri.c
@@ -1,7 +1,8 @@
-/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.10 2000/09/24 13:50:59 alanh Exp $ */
+/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.11 2000/12/07 20:26:02 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,8 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
* Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- * Jens Owen <jens@precisioninsight.com>
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -592,3 +594,63 @@ Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer,
TRACE("GetDeviceInfo... return True");
return True;
}
+
+Bool XF86DRIOpenFullScreen(dpy, screen, drawable)
+ Display* dpy;
+ int screen;
+ Drawable drawable;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRIOpenFullScreenReply rep;
+ xXF86DRIOpenFullScreenReq *req;
+
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRIOpenFullScreen, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRIOpenFullScreen;
+ req->screen = screen;
+ req->drawable = drawable;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.isFullScreen ? True : False;
+}
+
+Bool XF86DRICloseFullScreen(dpy, screen, drawable)
+ Display* dpy;
+ int screen;
+ Drawable drawable;
+{
+ XExtDisplayInfo *info = find_display (dpy);
+ xXF86DRICloseFullScreenReply rep;
+ xXF86DRICloseFullScreenReq *req;
+
+ XF86DRICheckExtension (dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(XF86DRICloseFullScreen, req);
+ req->reqType = info->codes->major_opcode;
+ req->driReqType = X_XF86DRICloseFullScreen;
+ req->screen = screen;
+ req->drawable = drawable;
+
+ /* The reply doesn't contain any data --
+ we just use it as a synchronization
+ point. */
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
diff --git a/xc/lib/GL/dri/xf86dri.h b/xc/lib/GL/dri/xf86dri.h
index bc75cb64c..a16db686f 100644
--- a/xc/lib/GL/dri/xf86dri.h
+++ b/xc/lib/GL/dri/xf86dri.h
@@ -1,7 +1,8 @@
-/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.6 2000/06/17 00:02:48 martin Exp $ */
+/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,9 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
* Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- * Jens Owen <jens@precisioninsight.com>
- * Rickard E. Faith <faith@precisioninsight.com>
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
@@ -52,6 +53,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define X_XF86DRIGetDrawableInfo 9
#define X_XF86DRIGetDeviceInfo 10
#define X_XF86DRIAuthConnection 11
+#define X_XF86DRIOpenFullScreen 12
+#define X_XF86DRICloseFullScreen 13
#define XF86DRINumberEvents 0
@@ -200,6 +203,22 @@ Bool XF86DRIGetDeviceInfo(
#endif
);
+Bool XF86DRIOpenFullScreen(
+#if NeedFunctionPrototypes
+ Display* /* dpy */,
+ int /* screen */,
+ Drawable /* drawable */
+#endif
+);
+
+Bool XF86DRICloseFullScreen(
+#if NeedFunctionPrototypes
+ Display* /* dpy */,
+ int /* screen */,
+ Drawable /* drawable */
+#endif
+);
+
_XFUNCPROTOEND
#endif /* _XF86DRI_SERVER_ */
diff --git a/xc/lib/GL/dri/xf86dristr.h b/xc/lib/GL/dri/xf86dristr.h
index 4f92ba6cf..d2e42a3e3 100644
--- a/xc/lib/GL/dri/xf86dristr.h
+++ b/xc/lib/GL/dri/xf86dristr.h
@@ -1,7 +1,8 @@
-/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.6 2000/06/17 00:02:48 martin Exp $ */
+/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,8 +29,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
* Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- * Jens Owen <jens@precisioninsight.com>
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Fiath <faith@valinux.com>
*
*/
@@ -282,5 +284,51 @@ typedef struct {
} xXF86DRIGetDeviceInfoReply;
#define sz_xXF86DRIGetDeviceInfoReply 32
-#endif /* _XF86DRISTR_H_ */
+typedef struct _XF86DRIOpenFullScreen {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIOpenFullScreen */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+} xXF86DRIOpenFullScreenReq;
+#define sz_xXF86DRIOpenFullScreenReq 12
+typedef struct {
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 isFullScreen B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXF86DRIOpenFullScreenReply;
+#define sz_xXF86DRIOpenFullScreenReply 32
+
+typedef struct _XF86DRICloseFullScreen {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseFullScreen */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+} xXF86DRICloseFullScreenReq;
+#define sz_xXF86DRICloseFullScreenReq 12
+
+typedef struct {
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+} xXF86DRICloseFullScreenReply;
+#define sz_xXF86DRICloseFullScreenReply 32
+
+
+#endif /* _XF86DRISTR_H_ */
diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h
index 0ccc020a8..f89c1b58a 100644
--- a/xc/lib/GL/glx/glxclient.h
+++ b/xc/lib/GL/glx/glxclient.h
@@ -18,7 +18,7 @@
** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
**
*/
-/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.10 2000/11/13 23:31:22 dawes Exp $ */
+/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.11 2000/12/07 20:26:03 dawes Exp $ */
/*
* Direct rendering support added by Precision Insight, Inc.
@@ -157,7 +157,7 @@ struct __DRIcontextRec {
** Method to unbind a DRI drawable to a DRI graphics context.
*/
Bool (*unbindContext)(Display *dpy, int scrn, GLXDrawable draw,
- GLXContext gc);
+ GLXContext gc, int will_rebind);
/*
** Opaque pointer to private per context direct rendering data.
diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c
index 9bed4bb09..4e7f0dd60 100644
--- a/xc/lib/GL/glx/glxext.c
+++ b/xc/lib/GL/glx/glxext.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.8 2000/09/26 15:56:46 tsi Exp $ */
+/* $XFree86: xc/lib/GL/glx/glxext.c,v 1.9 2000/12/07 20:26:03 dawes Exp $ */
/*
** The contents of this file are subject to the GLX Public License Version 1.0
@@ -818,10 +818,13 @@ Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
/* Unbind the old direct rendering context */
if (oldGC->isDirect) {
if (oldGC->driContext.private) {
+ int will_rebind = (gc && gc->isDirect
+ && draw == oldGC->currentDrawable);
if (!(*oldGC->driContext.unbindContext)(oldGC->currentDpy,
oldGC->screen,
oldGC->currentDrawable,
- oldGC)) {
+ oldGC,
+ will_rebind)) {
/* The make current failed. Just return GL_FALSE. */
return GL_FALSE;
}
diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c
index a1a2ea1ea..3254bf877 100644
--- a/xc/lib/GL/mesa/dri/dri_mesa.c
+++ b/xc/lib/GL/mesa/dri/dri_mesa.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/dri/dri_mesa.c,v 1.12 2000/11/13 23:31:23 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/dri/dri_mesa.c,v 1.13 2000/12/07 20:26:04 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -51,7 +51,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static Bool driMesaBindContext(Display *dpy, int scrn,
GLXDrawable draw, GLXContext gc);
static Bool driMesaUnbindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc);
+ GLXDrawable draw, GLXContext gc,
+ int will_rebind);
/* Drawable methods */
static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw,
@@ -71,6 +72,21 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config);
static void driMesaDestroyScreen(Display *dpy, int scrn, void *private);
+static Bool driFeatureOn(const char *name)
+{
+ char *env = getenv(name);
+
+ if (!env) return GL_FALSE;
+ if (!strcasecmp(env, "enable")) return GL_TRUE;
+ if (!strcasecmp(env, "1")) return GL_TRUE;
+ if (!strcasecmp(env, "on")) return GL_TRUE;
+ if (!strcasecmp(env, "true")) return GL_TRUE;
+ if (!strcasecmp(env, "t")) return GL_TRUE;
+ if (!strcasecmp(env, "yes")) return GL_TRUE;
+ if (!strcasecmp(env, "y")) return GL_TRUE;
+
+ return GL_FALSE;
+}
/*
@@ -180,12 +196,15 @@ static void driMesaInitAPI(__MesaAPI *MesaAPI)
MesaAPI->SwapBuffers = XMesaSwapBuffers;
MesaAPI->MakeCurrent = XMesaMakeCurrent;
MesaAPI->UnbindContext = XMesaUnbindContext;
+ MesaAPI->OpenFullScreen = XMesaOpenFullScreen;
+ MesaAPI->CloseFullScreen = XMesaCloseFullScreen;
}
/*****************************************************************/
static Bool driMesaUnbindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc)
+ GLXDrawable draw, GLXContext gc,
+ int will_rebind)
{
__DRIscreen *pDRIScreen;
__DRIdrawable *pdraw;
@@ -220,6 +239,16 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn,
}
pdp = (__DRIdrawablePrivate *)pdraw->private;
+ /* Don't leave fullscreen mode if the
+ drawable will be rebound in the next
+ step -- this avoids a protocol
+ request. */
+ if (!will_rebind && psp->fullscreen) {
+ psp->MesaAPI.CloseFullScreen(pcp);
+ XF86DRICloseFullScreen(dpy, scrn, draw);
+ psp->fullscreen = NULL;
+ }
+
/* Unbind Mesa's drawable from Mesa's context */
(*psp->MesaAPI.UnbindContext)(pcp);
@@ -269,6 +298,8 @@ static Bool driMesaBindContext(Display *dpy, int scrn,
__DRIdrawablePrivate *pdp;
__DRIscreenPrivate *psp;
__DRIcontextPrivate *pcp;
+ static Bool envchecked = False;
+ static Bool checkfullscreen = False;
/*
** Assume error checking is done properly in glXMakeCurrent before
@@ -326,8 +357,10 @@ static Bool driMesaBindContext(Display *dpy, int scrn,
/*
** Now that we have a context associated with this drawable, we can
** initialize the drawable information if has not been done before.
+ ** Also, since we need it when LIBGL_DRI_FULLSCREEN, pick up any changes
+ ** that are outstanding.
*/
- if (!pdp->pStamp) {
+ if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) {
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
driMesaUpdateDrawableInfo(dpy, scrn, pdp);
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
@@ -336,6 +369,74 @@ static Bool driMesaBindContext(Display *dpy, int scrn,
/* Call device-specific MakeCurrent */
(*psp->MesaAPI.MakeCurrent)(pcp, pdp, pdp);
+ /* Check for the potential to enter an automatic full-screen mode.
+ This may need to be moved up. */
+ if (!envchecked) {
+ checkfullscreen = driFeatureOn("LIBGL_DRI_AUTOFULLSCREEN");
+ envchecked = GL_TRUE;
+ }
+ if (checkfullscreen && pdp->numClipRects == 1) {
+ /* If there is valid information in the SAREA, we can use it to
+ avoid a protocol request. The only time when the SAREA
+ information won't be valid will be initially, so in the worst
+ case, we'll make one protocol request that we could have
+ avoided. */
+ int try = 1;
+ int clw = pdp->pClipRects[0].x2 - pdp->pClipRects[0].x1;
+ int clh = pdp->pClipRects[0].y2 - pdp->pClipRects[0].y1;
+
+#if 0
+ /* Useful client-side debugging message */
+ fprintf(stderr,
+ "********************************************\n"
+ "********************************************\n"
+ "********************************************\n"
+ "%d @ %d,%d,%d,%d\n"
+ "frame %d,%d,%d,%d\n"
+ "win %d,%d,%d,%d\n"
+ "fs = %p pdp = %p sarea = %d\n"
+ "********************************************\n"
+ "********************************************\n"
+ "********************************************\n",
+ pdp->numClipRects,
+ pdp->pClipRects[0].x1,
+ pdp->pClipRects[0].y1,
+ pdp->pClipRects[0].x2,
+ pdp->pClipRects[0].y2,
+ psp->pSAREA->frame.x,
+ psp->pSAREA->frame.y,
+ psp->pSAREA->frame.width,
+ psp->pSAREA->frame.height,
+ pdp->x, pdp->y, pdp->w, pdp->h,
+ psp->fullscreen, pdp, psp->pSAREA->frame.fullscreen);
+#endif
+
+
+ if (pdp->x != pdp->pClipRects[0].x1
+ || pdp->y != pdp->pClipRects[0].y1
+ || pdp->w != clw
+ || pdp->h != clh) try = 0;
+
+ if (try && psp->pSAREA->frame.width && psp->pSAREA->frame.height) {
+ if (pdp->x != psp->pSAREA->frame.x
+ || pdp->y != psp->pSAREA->frame.y
+ || pdp->w != psp->pSAREA->frame.width
+ || pdp->h != psp->pSAREA->frame.height) try = 0;
+ }
+
+ if (try) {
+ if (psp->fullscreen && !psp->pSAREA->frame.fullscreen) {
+ /* Server has closed fullscreen mode */
+ __driMesaMessage("server closed fullscreen mode\n");
+ psp->fullscreen = NULL;
+ }
+ if (XF86DRIOpenFullScreen(dpy, scrn, draw)) {
+ psp->fullscreen = pdp;
+ psp->MesaAPI.OpenFullScreen(pcp);
+ }
+ }
+ }
+
return GL_TRUE;
}
@@ -594,8 +695,18 @@ static void *driMesaCreateContext(Display *dpy, XVisualInfo *vis, void *shared,
static void driMesaDestroyContext(Display *dpy, int scrn, void *private)
{
__DRIcontextPrivate *pcp = (__DRIcontextPrivate *)private;
+ __DRIscreenPrivate *psp;
+ __DRIdrawablePrivate *pdp;
if (pcp) {
+ if ((pdp = pcp->driDrawablePriv)) {
+ /* Shut down fullscreen mode */
+ if ((psp = pdp->driScreenPriv) && psp->fullscreen) {
+ psp->MesaAPI.CloseFullScreen(pcp);
+ XF86DRICloseFullScreen(dpy, scrn, pdp->draw);
+ psp->fullscreen = NULL;
+ }
+ }
__driMesaGarbageCollectDrawables(pcp->driScreenPriv->drawHash);
(void)XF86DRIDestroyContext(dpy, scrn, pcp->contextID);
(*pcp->driScreenPriv->MesaAPI.DestroyContext)(pcp);
diff --git a/xc/lib/GL/mesa/dri/dri_mesaint.h b/xc/lib/GL/mesa/dri/dri_mesaint.h
index 8b01e1cfc..96d741922 100644
--- a/xc/lib/GL/mesa/dri/dri_mesaint.h
+++ b/xc/lib/GL/mesa/dri/dri_mesaint.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/dri/dri_mesaint.h,v 1.8 2000/11/13 23:31:24 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/dri/dri_mesaint.h,v 1.9 2000/12/07 20:26:04 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -273,6 +273,10 @@ struct __DRIscreenPrivateRec {
** This pointer is never touched by the DRI layer.
*/
void *private;
+
+ /* If we're in full screen mode (via DRIOpenFullScreen), this points
+ to the drawable that was bound. Otherwise, this is NULL. */
+ __DRIdrawablePrivate *fullscreen;
};
diff --git a/xc/lib/GL/mesa/dri/dri_xmesaapi.h b/xc/lib/GL/mesa/dri/dri_xmesaapi.h
index dbe1f21b0..ea44be517 100644
--- a/xc/lib/GL/mesa/dri/dri_xmesaapi.h
+++ b/xc/lib/GL/mesa/dri/dri_xmesaapi.h
@@ -1,7 +1,8 @@
-/* $XFree86: xc/lib/GL/mesa/dri/dri_xmesaapi.h,v 1.4 2000/06/17 00:02:51 martin Exp $ */
+/* $XFree86: xc/lib/GL/mesa/dri/dri_xmesaapi.h,v 1.5 2000/12/07 20:26:04 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,8 +29,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
* Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- * Brian E. Paul <brian@precisioninsight.com>
+ * Kevin E. Martin <martin@valinux.com>
+ * Brian E. Paul <brianp@valinux.com>
*/
@@ -84,7 +85,8 @@ extern GLboolean XMesaUnbindContext( __DRIcontextPrivate *driContextPriv );
extern void XMesaSwapBuffers( __DRIdrawablePrivate *driDrawPriv );
-
+extern GLboolean XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv);
+extern GLboolean XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv);
@@ -131,6 +133,8 @@ struct __MesaAPIRec {
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv);
GLboolean (*UnbindContext)(__DRIcontextPrivate *driContextPriv);
+ GLboolean (*OpenFullScreen)(__DRIcontextPrivate *driContextPriv);
+ GLboolean (*CloseFullScreen)(__DRIcontextPrivate *driContextPriv);
};
diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile
index 8e384d0b9..cc88803f4 100644
--- a/xc/lib/GL/mesa/src/Imakefile
+++ b/xc/lib/GL/mesa/src/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.20 2000/11/13 23:31:25 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/Imakefile,v 1.21 2000/12/12 23:24:27 dawes Exp $
#include <Threads.tmpl>
@@ -348,13 +348,16 @@ LinkSourceFile(zoom.h, $(MESASRCDIR)/src)
#ifdef i386Architecture
ASM_SRCS =
ASM_OBJS =
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFS = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFS = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#ifdef UseCompaqMathLibrary
diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile
index 71a32d51a..ee1b684ff 100644
--- a/xc/lib/GL/mesa/src/OSmesa/Imakefile
+++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.5 2000/11/13 23:31:25 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/OSmesa/Imakefile,v 1.6 2000/12/12 23:24:27 dawes Exp $
#include <Threads.tmpl>
@@ -195,11 +195,13 @@ MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include
../X86/x86_xform_raw3.o \
../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../X86/mmx_blend.S
MMX_OBJS = ../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../X86/3dnow.c \
../X86/3dnow_norm_raw.S \
../X86/3dnow_vertex.S \
@@ -225,7 +227,7 @@ MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include
../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../X86/katmai.c \
../X86/katmai_norm_raw.S \
../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/X86/Imakefile b/xc/lib/GL/mesa/src/X86/Imakefile
index d90414e4a..edca1c7ec 100644
--- a/xc/lib/GL/mesa/src/X86/Imakefile
+++ b/xc/lib/GL/mesa/src/X86/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.13 2000/11/13 23:31:25 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/X86/Imakefile,v 1.14 2000/12/12 23:24:27 dawes Exp $
#define DoNormalLib NormalLibGlx
#define DoSharedLib SharedLibGlx
@@ -92,13 +92,15 @@ XCOMM Determine at runtime whether 3DNow!, Katmai, MMX, etc are really present.
X86_DEFS = -DUSE_X86_ASM
+#if MesaUseMMX
MMX_SRCS = mmx_blend.S
MMX_OBJS = mmx_blend.o
MMX_DEFS = -DUSE_MMX_ASM
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = 3dnow.c \
3dnow_norm_raw.S \
3dnow_vertex.S \
@@ -109,7 +111,7 @@ XCOMM Determine at runtime whether 3DNow!, Katmai, MMX, etc are really present.
3dnow_xform_raw1.S \
3dnow_xform_raw2.S \
3dnow_xform_raw3.S \
- 3dnow_xform_raw4.S \
+ 3dnow_xform_raw4.S
3DNOW_OBJS = 3dnow.o \
3dnow_norm_raw.o \
@@ -126,7 +128,7 @@ XCOMM Determine at runtime whether 3DNow!, Katmai, MMX, etc are really present.
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = katmai.c \
katmai_norm_raw.S \
katmai_vertex.S \
@@ -137,7 +139,7 @@ XCOMM Determine at runtime whether 3DNow!, Katmai, MMX, etc are really present.
katmai_xform_raw1.S \
katmai_xform_raw2.S \
katmai_xform_raw3.S \
- katmai_xform_raw4.S \
+ katmai_xform_raw4.S
KATMAI_OBJS = katmai.o \
katmai_norm_raw.o \
@@ -188,9 +190,11 @@ ObjectFromAsmSource(x86_xform_raw2, NullParameter)
ObjectFromAsmSource(x86_xform_raw3, NullParameter)
ObjectFromAsmSource(x86_xform_raw4, NullParameter)
+#if MesaUseMMX
ObjectFromAsmSource(mmx_blend, NullParameter)
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
ObjectFromAsmSource(3dnow_norm_raw, NullParameter)
ObjectFromAsmSource(3dnow_vertex, NullParameter)
ObjectFromAsmSource(3dnow_xform_masked1, NullParameter)
@@ -203,7 +207,7 @@ ObjectFromAsmSource(3dnow_xform_raw3, NullParameter)
ObjectFromAsmSource(3dnow_xform_raw4, NullParameter)
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
ObjectFromAsmSource(katmai_norm_raw, NullParameter)
ObjectFromAsmSource(katmai_vertex, NullParameter)
ObjectFromAsmSource(katmai_xform_masked1, NullParameter)
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h b/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h
index c7d3b1e8e..7b42098cd 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.1 2000/06/20 05:08:39 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.2 2000/12/05 21:18:33 dawes Exp $ */
static void TAG(ffb_points)(GLcontext *ctx, GLuint first, GLuint last)
{
@@ -18,7 +18,7 @@ static void TAG(ffb_points)(GLcontext *ctx, GLuint first, GLuint last)
#endif
int i;
- for (i = first; i <= last; i++) {
+ for (i = first; i < last; i++) {
if (VB->ClipMask[i] == 0) {
ffb_vertex *tmp = &ffbVB[i];
#if !(IND & FFB_POINT_BIG_BIT)
diff --git a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
index 021da998d..89c6a1c5c 100644
--- a/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c,v 1.1 2000/06/20 05:08:40 dawes Exp $
+/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_xmesa.c,v 1.2 2000/12/07 20:26:05 dawes Exp $
*
* GLX Hardware Device Driver for Sun Creator/Creator3D
* Copyright (C) 2000 David S. Miller
@@ -517,6 +517,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv)
return GL_TRUE;
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
void ffbXMesaUpdateState(ffbContextPtr fmesa)
{
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile b/xc/lib/GL/mesa/src/drv/gamma/Imakefile
index 49fd6b01b..95a1b6450 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/gamma/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.15 2000/11/13 23:31:26 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/gamma/Imakefile,v 1.16 2000/12/12 23:24:27 dawes Exp $
#include <Threads.tmpl>
@@ -13,13 +13,16 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef i386Architecture
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#if BuildXF86DRI
@@ -244,11 +247,13 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/x86_xform_raw3.o \
../../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../../X86/mmx_blend.S
MMX_OBJS = ../../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../../X86/3dnow.c \
../../X86/3dnow_norm_raw.S \
../../X86/3dnow_vertex.S \
@@ -274,7 +279,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../../X86/katmai.c \
../../X86/katmai_norm_raw.S \
../../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
index 6b93a3e09..a442ee913 100644
--- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.7 2000/11/27 10:59:37 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.8 2000/12/07 20:26:05 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -528,6 +528,18 @@ GLboolean XMesaUnbindContext( __DRIcontextPrivate *driContextPriv )
return GL_TRUE;
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
void __driRegisterExtensions(void)
{
diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile b/xc/lib/GL/mesa/src/drv/i810/Imakefile
index 990657c7b..570c1bad9 100644
--- a/xc/lib/GL/mesa/src/drv/i810/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/i810/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.12 2000/11/13 23:31:27 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i810/Imakefile,v 1.13 2000/12/12 23:24:27 dawes Exp $
#include <Threads.tmpl>
@@ -13,13 +13,16 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef i386Architecture
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#if BuildXF86DRI
@@ -249,11 +252,13 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/x86_xform_raw3.o \
../../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../../X86/mmx_blend.S
MMX_OBJS = ../../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../../X86/3dnow.c \
../../X86/3dnow_norm_raw.S \
../../X86/3dnow_vertex.S \
@@ -279,7 +284,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../../X86/katmai.c \
../../X86/katmai_norm_raw.S \
../../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c
index b2bb932ee..43d1d4973 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c
@@ -24,7 +24,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c,v 1.8 2000/11/08 05:02:43 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c,v 1.9 2000/12/07 20:26:06 dawes Exp $ */
/*
* Authors:
@@ -555,6 +555,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv)
return GL_TRUE;
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tritmp.h b/xc/lib/GL/mesa/src/drv/i810/i810tritmp.h
index caaf264bf..c9cf18124 100644
--- a/xc/lib/GL/mesa/src/drv/i810/i810tritmp.h
+++ b/xc/lib/GL/mesa/src/drv/i810/i810tritmp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tritmp.h,v 1.4 2000/08/28 02:43:11 tsi Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/i810/i810tritmp.h,v 1.5 2000/12/05 21:18:33 dawes Exp $ */
static __inline void TAG(triangle)(GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2,
@@ -162,7 +162,7 @@ static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
* ctx->Driver.ReducedPrimitiveChange() callback.
*/
- for(i=first;i<=last;i++) {
+ for(i=first;i<last;i++) {
if(VB->ClipMask[i]==0) {
if (IND & I810_TWOSIDE_BIT) {
i810Vertex tmp0 = i810VB[i];
diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/src/drv/mga/Imakefile
index 276cf2ae8..62fecb053 100644
--- a/xc/lib/GL/mesa/src/drv/mga/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.12 2000/11/13 23:31:28 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/mga/Imakefile,v 1.13 2000/12/12 23:24:28 dawes Exp $
#include <Threads.tmpl>
@@ -13,13 +13,16 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef i386Architecture
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#if BuildXF86DRI
@@ -257,11 +260,13 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/x86_xform_raw3.o \
../../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../../X86/mmx_blend.S
MMX_OBJS = ../../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../../X86/3dnow.c \
../../X86/3dnow_norm_raw.S \
../../X86/3dnow_vertex.S \
@@ -287,7 +292,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../../X86/katmai.c \
../../X86/katmai_norm_raw.S \
../../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
index e1eed7b2b..7524a52a1 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.7 2000/11/08 05:02:45 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v 1.8 2000/12/07 20:26:06 dawes Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -474,6 +474,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv)
return GL_TRUE;
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
/* This looks buggy to me - the 'b' variable isn't used anywhere...
* Hmm - It seems that the drawable is already hooked in to
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h
index 47629cd4d..f578871ce 100644
--- a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h
+++ b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatritmp.h,v 1.4 2000/08/28 02:43:13 tsi Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgatritmp.h,v 1.5 2000/12/05 21:18:34 dawes Exp $ */
static __inline void TAG(triangle)(GLcontext *ctx,
GLuint e0, GLuint e1, GLuint e2,
@@ -171,7 +171,7 @@ static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
GLfloat sz = ctx->Point.Size * .5;
int i;
- for(i=first;i<=last;i++)
+ for(i=first;i<last;i++)
if(VB->ClipMask[i]==0) {
if (IND & (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT)) {
mgaVertex tmp0 = mgaVB[i];
diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile b/xc/lib/GL/mesa/src/drv/r128/Imakefile
index fac037986..7e15a1074 100644
--- a/xc/lib/GL/mesa/src/drv/r128/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.10 2000/12/04 19:21:44 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r128/Imakefile,v 1.11 2000/12/12 23:24:28 dawes Exp $
#include <Threads.tmpl>
@@ -13,13 +13,16 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef i386Architecture
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#if BuildXF86DRI
@@ -267,11 +270,13 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/x86_xform_raw3.o \
../../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../../X86/mmx_blend.S
MMX_OBJS = ../../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../../X86/3dnow.c \
../../X86/3dnow_norm_raw.S \
../../X86/3dnow_vertex.S \
@@ -297,7 +302,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \
../../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../../X86/katmai.c \
../../X86/katmai_norm_raw.S \
../../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.c b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
index e7be00853..e11a47a47 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.3 2000/12/04 19:21:44 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.c,v 1.4 2000/12/12 17:17:06 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -101,7 +101,6 @@ GLboolean r128CreateContext(Display *dpy, GLvisual *glVisual,
}
r128ctx->lastTexHeap = r128scrn->NRTexHeaps;
- r128ctx->BufferSize = glVisual->DepthBits;
r128ctx->DepthSize = glVisual->DepthBits;
r128ctx->StencilSize = glVisual->StencilBits;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
index 1b62681eb..a6f5b31ae 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.3 2000/12/04 19:21:44 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_context.h,v 1.4 2000/12/12 17:17:06 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -90,8 +90,8 @@ typedef struct r128_context *r128ContextPtr;
/* Subpixel offsets for window coordinates:
*/
-#define SUBPIXEL_X (-0.5F)
-#define SUBPIXEL_Y (-0.5F + 0.125)
+#define SUBPIXEL_X (-0.125F)
+#define SUBPIXEL_Y ( 0.375F)
typedef void (*r128_interp_func)( GLfloat t,
GLfloat *result,
@@ -195,7 +195,6 @@ struct r128_context {
/* Visual, drawable, cliprect and scissor information
*/
- GLint BufferSize; /* Bits in color buffer */
GLint DepthSize; /* Bits in depth buffer */
GLint StencilSize; /* Bits in stencil buffer */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
index 636b712a8..a16b04276 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.3 2000/12/04 19:21:45 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_dd.c,v 1.6 2000/12/15 22:48:38 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -45,7 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "X86/common_x86_asm.h"
#endif
-#define R128_DATE "20001201"
+#define R128_DATE "20001215"
/* Return the current color buffer size */
static void r128DDGetBufferSize( GLcontext *ctx,
@@ -65,10 +65,10 @@ static const GLubyte *r128DDGetString( GLcontext *ctx, GLenum name )
switch ( name ) {
case GL_VENDOR:
- return "VA Linux Systems, Inc.";
+ return (const GLubyte *)"VA Linux Systems, Inc.";
case GL_RENDERER:
- sprintf( buffer, "Mesa DRI Rage128 " R128_DATE );
+ sprintf((void *)buffer, "Mesa DRI Rage128 " R128_DATE );
/* Append any chipset-specific information.
*/
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c b/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c
index c02196ef9..02085932a 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c,v 1.1 2000/12/04 19:21:46 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_eltpath.c,v 1.2 2000/12/07 20:26:08 dawes Exp $ */
/*
* GLX Hardware Device Driver for Matrox G400
* Copyright (C) 1999 Keith Whitwell
@@ -118,6 +118,14 @@ static void fire_elts( r128ContextPtr r128ctx )
r128ctx->elt_buf, r128ctx->elt_buf->idx,
r128ctx->elt_buf->total,
r128ctx->next_vert, r128ctx->next_vert_index );
+
+ {
+ GLint space = (GLint)((GLuint)r128ctx->next_vert -
+ (GLuint)r128ctx->next_elt);
+ if ( DEBUG_ELTPATH )
+ fprintf( stderr, " new nv=%p ne=%p space=%d\n",
+ r128ctx->next_vert, r128ctx->next_elt, space );
+ }
}
@@ -217,7 +225,7 @@ static void r128_tri_clip( r128ContextPtr r128ctx,
{
struct r128_elt_tab *tab = r128ctx->elt_tab;
r128_interp_func interp = tab->interp;
- int vertsize = r128ctx->vertsize;
+ GLint vertsize = r128ctx->vertsize;
GLuint inlist[2][VB_MAX_CLIPPED_VERTS];
GLuint in = 0;
GLuint n = 3, next_vert = 3;
@@ -249,10 +257,13 @@ static void r128_tri_clip( r128ContextPtr r128ctx,
if ( DEBUG_ELTPATH )
fprintf( stderr, " clip nv=%p ne=%p space=%d thresh=%d %d\n",
r128ctx->next_vert, r128ctx->next_elt,
- space, n * (vertsize + 2) * sizeof(GLuint),
- space < n * (vertsize + 2) * sizeof(GLuint) );
+ space, (GLint)n * (vertsize + 2) * (GLint)sizeof(GLuint),
+ space < (GLint)n * (vertsize + 2) * (GLint)sizeof(GLuint) );
- if ( space < n * (vertsize + 2) * sizeof(GLuint) ) {
+ /* GH: Why the hell do we explicitly have to test the sign of the
+ * available space here?
+ */
+ if ( space < (GLint)n * (vertsize + 2) * (GLint)sizeof(GLuint) ) {
fire_elts( r128ctx );
}
@@ -271,6 +282,8 @@ static void r128_tri_clip( r128ContextPtr r128ctx,
r128ctx->next_elt += 3;
}
}
+ if ( DEBUG_ELTPATH )
+ fflush( stderr );
}
@@ -311,6 +324,8 @@ do { \
e2, e1, e0, r128ctx->next_elt[0], \
r128ctx->next_elt[1], r128ctx->next_elt[2]); \
r128ctx->next_elt += 3; \
+ if ( DEBUG_ELTPATH ) \
+ fflush( stderr ); \
} while (0)
#define CLIP_TRIANGLE( e2, e1, e0 ) \
@@ -464,7 +479,7 @@ void r128DDEltPath( struct vertex_buffer *VB )
GLint space;
if ( DEBUG_ELTPATH )
- fprintf( stderr, "\n%s: count=%d space=%d\n",
+ fprintf( stderr, "\n\n\n%s: count=%d space=%d\n",
__FUNCTION__, VB->Count,
(GLint)((GLuint)r128ctx->next_vert -
(GLuint)r128ctx->next_elt) );
@@ -504,15 +519,15 @@ void r128DDEltPath( struct vertex_buffer *VB )
if ( DEBUG_ELTPATH )
fprintf( stderr, " top nv=%p ne=%p space=%d reqd=%d count=%d clip=0x%x\n\n",
r128ctx->next_vert, r128ctx->next_elt, space,
- VB->Count * vertsize * sizeof(GLuint),
+ (GLint)VB->Count * vertsize * sizeof(GLuint),
VB->Count, VB->ClipOrMask );
/* Because we need to adjust the next_elt pointer to accomodate the
* CCE packet header, we can sometimes go past the next_vert pointer
* and thus have negative space.
*/
- if ( space < VB->Count * vertsize * sizeof(GLuint) ||
- space < 0 || r128ctx->vertsize != r128ctx->elt_vertsize ) {
+ if ( space < (GLint)VB->Count * vertsize * (GLint)sizeof(GLuint) ||
+ r128ctx->vertsize != r128ctx->elt_vertsize ) {
fire_elts( r128ctx );
}
@@ -540,7 +555,7 @@ void r128DDEltPath( struct vertex_buffer *VB )
VB->pipeline->data_valid = 0;
VB->pipeline->new_state = 0;
- if ( 0 ) {
+ if ( DEBUG_ELTPATH ) {
FLUSH_BATCH( r128ctx );
LOCK_HARDWARE( r128ctx );
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
index 067beff4e..2ae7fe4b5 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.1 2000/12/04 19:21:46 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_ioctl.c,v 1.2 2000/12/12 17:17:07 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -454,6 +454,10 @@ static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
#endif
+ if ( !flags ) {
+ return mask;
+ }
+
/* Flip top to bottom */
cx += dPriv->x;
cy = dPriv->y + dPriv->h - cy - ch;
@@ -511,8 +515,7 @@ static GLbitfield r128DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
ret = drmR128Clear( r128ctx->driFd, flags,
cx, cy, cw, ch,
- r128ctx->ClearColor, r128ctx->ClearDepth,
- 0xffffffff, 0xffffffff );
+ r128ctx->ClearColor, r128ctx->ClearDepth );
if ( ret ) {
fprintf( stderr, "drmR128Clear: return = %d\n", ret );
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_lock.h b/xc/lib/GL/mesa/src/drv/r128/r128_lock.h
index 57ec768bb..7ae5b639a 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_lock.h
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_lock.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.2 2000/12/04 19:21:46 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_lock.h,v 1.3 2000/12/07 15:43:37 tsi Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -42,7 +42,7 @@ extern void r128GetLock( r128ContextPtr r128ctx, GLuint flags );
/* Turn DEBUG_LOCKING on to find locking conflicts (see r128_init.h) */
-#if DEBUG_LOCKING
+#ifdef DEBUG_LOCKING
extern char *prevLockFile;
extern int prevLockLine;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_span.c b/xc/lib/GL/mesa/src/drv/r128/r128_span.c
index 925b874e4..c25250378 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_span.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_span.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.3 2000/12/04 19:21:47 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_span.c,v 1.4 2000/12/12 17:17:07 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -69,6 +69,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
GLuint height = dPriv->h; \
(void) height
+#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
+
#define INIT_MONO_PIXEL( p ) \
p = r128ctx->Color
@@ -115,7 +117,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
-/* 16 bit, RGB565 color spanline and pixel functions */ \
+/* ================================================================
+ * Color buffer
+ */
+
+/* 16 bit, RGB565 color spanline and pixel functions
+ */ \
#define WRITE_RGBA( _x, _y, r, g, b, a ) \
*(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
(((int)g & 0xfc) << 3) | \
@@ -137,55 +144,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "spantmp.h"
-
-/* 15 bit, ARGB1555 color spanline and pixel functions */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \
- ((g & 0xf8) << 2) | \
- ((b & 0xf8) >> 3) | \
- ((a) ? 0x8000 : 0))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLushort *)(buf + _x*2 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
- do { \
- GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
- rgba[0] = (p >> 7) & 0xf8; \
- rgba[1] = (p >> 2) & 0xf8; \
- rgba[2] = (p << 3) & 0xf8; \
- rgba[3] = (p & 0x8000) ? 0xff : 0; \
- } while (0)
-
-#define TAG(x) r128##x##_ARGB1555
-#include "spantmp.h"
-
-
-
-/* 24 bit, RGB888 color spanline and pixel functions */
-#define WRITE_RGBA( _x, _y, r, g, b, a ) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = ((b << 0) | \
- (g << 8) | \
- (r << 16))
-
-#define WRITE_PIXEL( _x, _y, p ) \
- *(GLuint *)(buf + _x*3 + _y*pitch) = p
-
-#define READ_RGBA( rgba, _x, _y ) \
-do { \
- GLuint p = *(GLuint *)(read_buf + _x*3 + _y*pitch); \
- rgba[0] = (p >> 16) & 0xff; \
- rgba[1] = (p >> 8) & 0xff; \
- rgba[2] = (p >> 0) & 0xff; \
- rgba[3] = 0xff; \
-} while (0)
-
-#define TAG(x) r128##x##_RGB888
-#include "spantmp.h"
-
-
-
-/* 32 bit, ARGB8888 color spanline and pixel functions */
+/* 32 bit, ARGB8888 color spanline and pixel functions
+ */
#define WRITE_RGBA( _x, _y, r, g, b, a ) \
*(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
(g << 8) | \
@@ -209,18 +169,30 @@ do { \
-/* 16-bit depth buffer functions */
+/* ================================================================
+ * Depth buffer
+ */
+
+/* 16-bit depth buffer functions
+ */
#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( r128ctx, n, x, y, depth, mask );
+ r128WriteDepthSpanLocked( r128ctx, n, \
+ x + dPriv->x, \
+ y + dPriv->y, \
+ depth, mask );
#define WRITE_DEPTH_PIXELS() \
do { \
- GLint fy[PB_SIZE]; \
+ GLint ox[PB_SIZE]; \
+ GLint oy[PB_SIZE]; \
for ( i = 0 ; i < n ; i++ ) { \
- fy[i] = Y_FLIP( y[i] ); \
+ ox[i] = x[i] + dPriv->x; \
} \
- r128WriteDepthPixelsLocked( r128ctx, n, x, fy, depth, mask ); \
+ for ( i = 0 ; i < n ; i++ ) { \
+ oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
+ } \
+ r128WriteDepthPixelsLocked( r128ctx, n, ox, oy, depth, mask ); \
} while (0)
#define READ_DEPTH_SPAN() \
@@ -230,7 +202,9 @@ do { \
r128scrn->spanOffset); \
GLint i; \
\
- r128ReadDepthSpanLocked( r128ctx, n, x, y ); \
+ r128ReadDepthSpanLocked( r128ctx, n, \
+ x + dPriv->x, \
+ y + dPriv->y ); \
r128WaitForIdleLocked( r128ctx ); \
\
for ( i = 0 ; i < n ; i++ ) { \
@@ -246,7 +220,8 @@ do { \
GLint i, remaining = n; \
\
while ( remaining > 0 ) { \
- GLint fy[PB_SIZE]; \
+ GLint ox[PB_SIZE]; \
+ GLint oy[PB_SIZE]; \
GLint count; \
\
if ( remaining <= 128 ) { \
@@ -255,10 +230,13 @@ do { \
count = 128; \
} \
for ( i = 0 ; i < count ; i++ ) { \
- fy[i] = Y_FLIP( y[i] ); \
+ ox[i] = x[i] + dPriv->x; \
+ } \
+ for ( i = 0 ; i < count ; i++ ) { \
+ oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
} \
\
- r128ReadDepthPixelsLocked( r128ctx, count, x, fy ); \
+ r128ReadDepthPixelsLocked( r128ctx, count, ox, oy ); \
r128WaitForIdleLocked( r128ctx ); \
\
for ( i = 0 ; i < count ; i++ ) { \
@@ -275,19 +253,25 @@ do { \
#include "depthtmp.h"
-
-/* 24-bit depth, 8-bit stencil buffer functions */
-
+/* 24-bit depth, 8-bit stencil buffer functions
+ */
#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( r128ctx, n, x, y, depth, mask );
+ r128WriteDepthSpanLocked( r128ctx, n, \
+ x + dPriv->x, \
+ y + dPriv->y, \
+ depth, mask );
#define WRITE_DEPTH_PIXELS() \
do { \
- GLint fy[PB_SIZE]; \
+ GLint ox[PB_SIZE]; \
+ GLint oy[PB_SIZE]; \
for ( i = 0 ; i < n ; i++ ) { \
- fy[i] = Y_FLIP( y[i] ); \
+ ox[i] = x[i] + dPriv->x; \
} \
- r128WriteDepthPixelsLocked( r128ctx, n, x, fy, depth, mask ); \
+ for ( i = 0 ; i < n ; i++ ) { \
+ oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
+ } \
+ r128WriteDepthPixelsLocked( r128ctx, n, ox, oy, depth, mask ); \
} while (0)
#define READ_DEPTH_SPAN() \
@@ -297,7 +281,9 @@ do { \
r128scrn->spanOffset); \
GLint i; \
\
- r128ReadDepthSpanLocked( r128ctx, n, x, y ); \
+ r128ReadDepthSpanLocked( r128ctx, n, \
+ x + dPriv->x, \
+ y + dPriv->y ); \
r128WaitForIdleLocked( r128ctx ); \
\
for ( i = 0 ; i < n ; i++ ) { \
@@ -305,7 +291,6 @@ do { \
} \
} while (0)
-
#define READ_DEPTH_PIXELS() \
do { \
r128ScreenPtr r128scrn = r128ctx->r128Screen; \
@@ -314,7 +299,8 @@ do { \
GLint i, remaining = n; \
\
while ( remaining > 0 ) { \
- GLint fy[PB_SIZE]; \
+ GLint ox[PB_SIZE]; \
+ GLint oy[PB_SIZE]; \
GLint count; \
\
if ( remaining <= 128 ) { \
@@ -323,10 +309,13 @@ do { \
count = 128; \
} \
for ( i = 0 ; i < count ; i++ ) { \
- fy[i] = Y_FLIP( y[i] ); \
+ ox[i] = x[i] + dPriv->x; \
+ } \
+ for ( i = 0 ; i < count ; i++ ) { \
+ oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
} \
\
- r128ReadDepthPixelsLocked( r128ctx, count, x, fy ); \
+ r128ReadDepthPixelsLocked( r128ctx, count, ox, oy ); \
r128WaitForIdleLocked( r128ctx ); \
\
for ( i = 0 ; i < count ; i++ ) { \
@@ -344,71 +333,12 @@ do { \
-/* 32-bit depth buffer functions */
-
-#define WRITE_DEPTH_SPAN() \
- r128WriteDepthSpanLocked( r128ctx, n, x, y, depth, mask );
-
-#define WRITE_DEPTH_PIXELS() \
-do { \
- GLint fy[PB_SIZE]; \
- for ( i = 0 ; i < n ; i++ ) { \
- fy[i] = Y_FLIP( y[i] ); \
- } \
- r128WriteDepthPixelsLocked( r128ctx, n, x, fy, depth, mask ); \
-} while (0)
-
-#define READ_DEPTH_SPAN() \
-do { \
- r128ScreenPtr r128scrn = r128ctx->r128Screen; \
- GLuint *buf = (GLuint *)((GLubyte *)r128scrn->fb + \
- r128scrn->spanOffset); \
- GLint i; \
- \
- r128ReadDepthSpanLocked( r128ctx, n, x, y ); \
- r128WaitForIdleLocked( r128ctx ); \
- \
- for ( i = 0 ; i < n ; i++ ) { \
- depth[i] = buf[i]; \
- } \
-} while (0)
-
-#define READ_DEPTH_PIXELS() \
-do { \
- r128ScreenPtr r128scrn = r128ctx->r128Screen; \
- GLuint *buf = (GLuint *)((GLubyte *)r128scrn->fb + \
- r128scrn->spanOffset); \
- GLint i, remaining = n; \
- \
- while ( remaining > 0 ) { \
- GLint fy[PB_SIZE]; \
- GLint count; \
- \
- if ( remaining <= 128 ) { \
- count = remaining; \
- } else { \
- count = 128; \
- } \
- for ( i = 0 ; i < count ; i++ ) { \
- fy[i] = Y_FLIP( y[i] ); \
- } \
- \
- r128ReadDepthPixelsLocked( r128ctx, count, x, fy ); \
- r128WaitForIdleLocked( r128ctx ); \
- \
- for ( i = 0 ; i < count ; i++ ) { \
- depth[i] = buf[i]; \
- } \
- depth += count; \
- x += count; \
- y += count; \
- remaining -= count; \
- } \
-} while (0)
-
-#define TAG(x) r128##x##_32
-#include "depthtmp.h"
+/* ================================================================
+ * Stencil buffer
+ */
+/* FIXME: Add support for hardware stencil buffers.
+ */
@@ -416,20 +346,7 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
{
r128ContextPtr r128ctx = R128_CONTEXT(ctx);
- switch ( r128ctx->BufferSize ) {
- case 8: /* Color Index mode not supported */
- break;
-
- case 15:
- ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_ARGB1555;
- ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_ARGB1555;
- ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_ARGB1555;
- ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_ARGB1555;
- ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_ARGB1555;
- ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_ARGB1555;
- ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_ARGB1555;
- break;
-
+ switch ( r128ctx->r128Screen->bpp ) {
case 16:
ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_RGB565;
ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_RGB565;
@@ -440,16 +357,6 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_RGB565;
break;
- case 24:
- ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_RGB888;
- ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_RGB888;
- ctx->Driver.WriteMonoRGBASpan = r128WriteMonoRGBASpan_RGB888;
- ctx->Driver.WriteRGBAPixels = r128WriteRGBAPixels_RGB888;
- ctx->Driver.WriteMonoRGBAPixels = r128WriteMonoRGBAPixels_RGB888;
- ctx->Driver.ReadRGBASpan = r128ReadRGBASpan_RGB888;
- ctx->Driver.ReadRGBAPixels = r128ReadRGBAPixels_RGB888;
- break;
-
case 32:
ctx->Driver.WriteRGBASpan = r128WriteRGBASpan_ARGB8888;
ctx->Driver.WriteRGBSpan = r128WriteRGBSpan_ARGB8888;
@@ -479,13 +386,6 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_24_8;
break;
- case 32:
- ctx->Driver.ReadDepthSpan = r128ReadDepthSpan_32;
- ctx->Driver.WriteDepthSpan = r128WriteDepthSpan_32;
- ctx->Driver.ReadDepthPixels = r128ReadDepthPixels_32;
- ctx->Driver.WriteDepthPixels = r128WriteDepthPixels_32;
- break;
-
default:
break;
}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_state.c b/xc/lib/GL/mesa/src/drv/r128/r128_state.c
index 0aa8fef33..10a955af7 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_state.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_state.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.5 2000/12/04 19:21:47 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_state.c,v 1.6 2000/12/12 17:17:07 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -484,7 +484,7 @@ static void r128UpdateMasks( GLcontext *ctx )
{
r128ContextPtr r128ctx = R128_CONTEXT( ctx );
- GLuint mask = r128PackColor( r128ctx->BufferSize,
+ GLuint mask = r128PackColor( r128ctx->r128Screen->bpp,
ctx->Color.ColorMask[RCOMP],
ctx->Color.ColorMask[GCOMP],
ctx->Color.ColorMask[BCOMP],
@@ -609,7 +609,7 @@ static void r128DDClearColor( GLcontext *ctx,
{
r128ContextPtr r128ctx = R128_CONTEXT( ctx );
- r128ctx->ClearColor = r128PackColor( r128ctx->r128Screen->depth,
+ r128ctx->ClearColor = r128PackColor( r128ctx->r128Screen->bpp,
r, g, b, a );
}
@@ -618,7 +618,7 @@ static void r128DDColor( GLcontext *ctx,
{
r128ContextPtr r128ctx = R128_CONTEXT( ctx );
- r128ctx->Color = r128PackColor( r128ctx->r128Screen->depth,
+ r128ctx->Color = r128PackColor( r128ctx->r128Screen->bpp,
r, g, b, a );
}
@@ -1052,15 +1052,12 @@ void r128DDInitState( r128ContextPtr r128ctx )
int dst_bpp, depth_bpp;
CARD32 bias;
- switch ( r128ctx->BufferSize ) {
- case 8: dst_bpp = R128_GMC_DST_8BPP_CI; break;
- case 15: dst_bpp = R128_GMC_DST_15BPP; break;
+ switch ( r128ctx->r128Screen->bpp ) {
case 16: dst_bpp = R128_GMC_DST_16BPP; break;
- case 24: dst_bpp = R128_GMC_DST_24BPP; break;
case 32: dst_bpp = R128_GMC_DST_32BPP; break;
default:
fprintf( stderr, "Error: Unsupported pixel depth %d... exiting\n",
- r128ctx->BufferSize );
+ r128ctx->r128Screen->bpp );
exit( -1 );
}
@@ -1171,7 +1168,7 @@ void r128DDInitState( r128ContextPtr r128ctx )
R128_BACKFACE_SOLID |
R128_FRONTFACE_SOLID |
R128_FPU_COLOR_GOURAUD |
- R128_FPU_SUB_PIX_2BITS |
+ R128_FPU_SUB_PIX_4BITS |
R128_FPU_MODE_3D |
R128_TRAP_BITS_DISABLE |
R128_XFACTOR_2 |
@@ -1186,7 +1183,7 @@ void r128DDInitState( r128ContextPtr r128ctx )
R128_STARTING_VERTEX_1 |
R128_ENDING_VERTEX_3 |
R128_SU_POLY_LINE_NOT_LAST |
- R128_SUB_PIX_2BITS);
+ R128_SUB_PIX_4BITS);
r128ctx->setup.tex_size_pitch_c = 0x00000000;
r128ctx->setup.constant_color_c = 0x00ffffff;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h
index d225765a6..fbe39b8c0 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.h
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.2 2000/12/04 19:21:47 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.h,v 1.3 2000/12/12 17:17:08 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -70,15 +70,12 @@ extern void r128DDInitTextureFuncs( GLcontext *ctx );
#define R128PACKCOLOR4444(r, g, b, a) \
((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-static __inline__ CARD32 r128PackColor( GLuint depth,
+static __inline__ CARD32 r128PackColor( GLuint bpp,
GLubyte r, GLubyte g,
GLubyte b, GLubyte a )
{
- switch ( depth ) {
- case 8: return R128PACKCOLOR332( r, g, b );
- case 15: return R128PACKCOLOR1555( r, g, b, a );
+ switch ( bpp ) {
case 16: return R128PACKCOLOR565( r, g, b );
- case 24: return R128PACKCOLOR888( r, g, b );
case 32: return R128PACKCOLOR8888( r, g, b, a );
default: return 0;
}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
index 64308e76d..744b3c7c4 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_vb.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.8 2000/12/04 19:21:48 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.10 2000/12/12 17:17:08 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -90,7 +90,7 @@ do { \
} \
} while (0)
-#if USE_RHW2
+#ifdef USE_RHW2
#define TEX1_4 \
do { \
@@ -109,8 +109,8 @@ do { \
#define COORD \
do { \
GLfloat *win = VB->Win.data[i]; \
- v->v.x = win[0]; \
- v->v.y = r128height - win[1]; \
+ v->v.x = win[0] + SUBPIXEL_X; \
+ v->v.y = r128height - win[1] + SUBPIXEL_Y; \
v->v.z = scale * win[2]; \
v->v.rhw = v->v.rhw2 = win[3]; \
} while (0)
@@ -121,12 +121,12 @@ do { \
#define COORD \
do { \
- GLfloat *win = VB->Win.data[i]; \
- v->v.x = win[0]; \
- v->v.y = r128height - win[1]; \
- v->v.z = scale * win[2]; \
- v->v.rhw = win[3]; \
-} while (0) \
+ GLfloat *win = VB->Win.data[i]; \
+ v->v.x = win[0] + SUBPIXEL_X; \
+ v->v.y = r128height - win[1] + SUBPIXEL_Y; \
+ v->v.z = scale * win[2]; \
+ v->v.rhw = win[3]; \
+} while (0)
#endif /* USE_RHW2 */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c
index c33eca347..07450e3c0 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.2 2000/12/04 19:21:48 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c,v 1.4 2000/12/12 17:17:08 dawes Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -170,18 +170,6 @@ GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv,
if (driContextPriv) {
r128ContextPtr r128ctx = (r128ContextPtr)driContextPriv->driverPrivate;
-#if 0
- /* GH: This causes the driver to fail the glean makeCurrent
- * tests. Leave it disabled for now...
- */
- if (r128Context &&
- r128ctx == (void *)r128Context &&
- driDrawPriv == R128_DRIDRAWABLE(r128Context))
- return GL_TRUE;
-#endif
-
- /* GH: Do we still need this then?
- */
r128Context = r128MakeCurrent(r128Context, r128ctx, driDrawPriv);
gl_make_current2(R128_MESACTX(r128Context),
@@ -192,6 +180,11 @@ GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv,
r128Context->dirty = R128_UPLOAD_ALL;
}
+ /* GH: We need this to correctly calculate the window offset
+ * and aux scissor rects.
+ */
+ r128Context->new_state = R128_NEW_WINDOW | R128_NEW_CLIP;
+
if (!R128_MESACTX(r128Context)->Viewport.Width) {
gl_Viewport(R128_MESACTX(r128Context), 0, 0,
driDrawPriv->w, driDrawPriv->h);
@@ -217,4 +210,16 @@ void __driRegisterExtensions( void )
{
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
#endif
diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile b/xc/lib/GL/mesa/src/drv/sis/Imakefile
index d1c1c47fb..505d18831 100644
--- a/xc/lib/GL/mesa/src/drv/sis/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/sis/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.11 2000/11/13 23:31:31 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/sis/Imakefile,v 1.12 2000/12/12 23:24:28 dawes Exp $
#include <Threads.tmpl>
@@ -19,13 +19,16 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef i386Architecture
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#if BuildXF86DRI
@@ -283,11 +286,13 @@ LinkSourceFile(xdriP.h, ../../X)
../../X86/x86_xform_raw3.o \
../../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../../X86/mmx_blend.S
MMX_OBJS = ../../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../../X86/3dnow.c \
../../X86/3dnow_norm_raw.S \
../../X86/3dnow_vertex.S \
@@ -313,7 +318,7 @@ LinkSourceFile(xdriP.h, ../../X)
../../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../../X86/katmai.c \
../../X86/katmai_norm_raw.S \
../../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c
index 318684ae8..24a7e84b9 100644
--- a/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c
@@ -24,7 +24,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c,v 1.5 2000/09/26 15:56:49 tsi Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_xmesa.c,v 1.6 2000/12/07 20:26:10 dawes Exp $ */
/*
* Authors:
@@ -400,6 +400,18 @@ GLboolean XMesaUnbindContext(__DRIcontextPrivate *driContextPriv)
return GL_TRUE;
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ return GL_TRUE;
+}
+
GLboolean XMesaMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
index 8fa5d0fc5..160a33da6 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/tdfx/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.16 2000/11/13 23:31:31 dawes Exp $
+XCOMM $XFree86: xc/lib/GL/mesa/src/drv/tdfx/Imakefile,v 1.19 2000/12/12 23:24:28 dawes Exp $
#include <Threads.tmpl>
@@ -13,13 +13,16 @@ ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
#endif
#ifdef i386Architecture
-#ifdef MesaUse3DNow
+#if MesaUseMMX
+ MMX_DEFS = -DUSE_MMX_ASM
+#endif
+#if MesaUse3DNow
3DNOW_DEFS = -DUSE_3DNOW_ASM
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_DEFS = -DUSE_KATMAI_ASM
#endif
- ASM_DEFINES = -DUSE_X86_ASM -DUSE_MMX_ASM $(3DNOW_DEFS) $(KATMAI_DEFS)
+ ASM_DEFINES = -DUSE_X86_ASM $(MMX_DEFS) $(3DNOW_DEFS) $(KATMAI_DEFS)
#endif
#if BuildXF86DRI
@@ -263,11 +266,13 @@ MESA_INCLUDES = -I. -I.. -I../../include
../../X86/x86_xform_raw3.o \
../../X86/x86_xform_raw4.o
+#if MesaUseMMX
MMX_SRCS = ../../X86/mmx_blend.S
MMX_OBJS = ../../X86/mmx_blend.o
+#endif
-#ifdef MesaUse3DNow
+#if MesaUse3DNow
3DNOW_SRCS = ../../X86/3dnow.c \
../../X86/3dnow_norm_raw.S \
../../X86/3dnow_vertex.S \
@@ -293,7 +298,7 @@ MESA_INCLUDES = -I. -I.. -I../../include
../../X86/3dnow_xform_raw4.o
#endif
-#ifdef MesaUseKatmai
+#if MesaUseKatmai
KATMAI_SRCS = ../../X86/katmai.c \
../../X86/katmai_norm_raw.S \
../../X86/katmai_vertex.S \
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c b/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c
index 0cac71a06..1beb843fc 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxclip.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxclip.c,v 1.1 2000/09/24 13:51:12 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxclip.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -355,31 +355,7 @@ fx_clip_line(GLcontext * ctx,
}
-
-
-
-
-#if defined(FX_V2)
-
-#define VARS_XYZW \
- GLfloat vsx = mat[MAT_SX]; \
- GLfloat vsy = mat[MAT_SY]; \
- GLfloat vsz = mat[MAT_SZ]; \
- GLfloat vtx = mat[MAT_TX]; \
- GLfloat vty = mat[MAT_TY]; \
- GLfloat vtz = mat[MAT_TZ];
-
-#define DO_SETUP_XYZW \
-{ \
- GLfloat oow = 1.0 / data[3]; \
- v->x = data[0]*oow*vsx + vtx; \
- v->y = data[1]*oow*vsy + vty; \
- v->ooz = data[2]*oow*vsz + vtz; \
- v->oow = oow; \
-}
-#else
-
-#if defined(DRIVERTS)
+/* Add window offset to window coords to get screen coords */
#define VARS_XYZW \
GLfloat vsx = mat[MAT_SX]; \
@@ -398,29 +374,7 @@ fx_clip_line(GLcontext * ctx,
v->oow = oow; \
}
-#else
-#define VARS_XYZW \
- GLfloat vsx = mat[MAT_SX]; \
- GLfloat vsy = mat[MAT_SY]; \
- GLfloat vsz = mat[MAT_SZ]; \
- const GLfloat snapper = (3L << 18); \
- GLfloat snap_tx = mat[MAT_TX] + snapper; \
- GLfloat snap_ty = mat[MAT_TY] + snapper; \
- GLfloat vtz = mat[MAT_TZ];
-#define DO_SETUP_XYZW \
-{ \
- GLfloat oow = 1.0 / data[3]; \
- v->x = data[0]*oow*vsx + snap_tx; \
- v->y = data[1]*oow*vsy + snap_ty; \
- v->ooz = data[2]*oow*vsz + vtz; \
- v->oow = oow; \
- v->x -= snapper; \
- v->y -= snapper; \
-}
-
-#endif
-#endif
#define COPY_XYZW_STRIDE \
{ GLfloat *clip = VEC_ELT(VB->ClipPtr, GLfloat, e); \
@@ -434,10 +388,7 @@ fx_clip_line(GLcontext * ctx,
#if FX_USE_PARGB
#define DO_SETUP_RGBA \
- GET_PARGB(v) = (((int)data[4+3]) << 24) | \
- (((int)data[4+0]) << 16) | \
- (((int)data[4+1]) << 8) | \
- (((int)data[4+2]) << 0);
+ PACK_4F_ARGB(GET_PARGB(v), data[4+3], data[4+0], data[4+1], data[4+2]);
#else
#define DO_SETUP_RGBA \
v->r = data[4+0]; \
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c b/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c
index 21a1c4dfb..0ee144854 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxcva.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcva.c,v 1.1 2000/09/24 13:51:14 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxcva.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -137,17 +137,14 @@ static mergefunc merge_and_render_tab[2][MAX_MERGABLE][PRIM_CULLED + 1];
#undef DO_SETUP_RGBA
#if FX_USE_PARGB
-#define DO_SETUP_RGBA \
-{ \
- GLubyte *col = color[i]; \
- GET_PARGB(v)= ((col[3] << 24) | \
- (col[0] << 16) | \
- (col[1] << 8) | \
- (col[2])); \
+#define DO_SETUP_RGBA \
+{ \
+ GLubyte *col = color[i]; \
+ PACK_4F_ARGB(GET_PARGB(v), col[3], col[0], col[1], col[2]); \
}
#else
-#define DO_SETUP_RGBA \
-{ \
+#define DO_SETUP_RGBA \
+{ \
GLubyte *col = color[i]; \
v[GR_VERTEX_R_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
v[GR_VERTEX_G_OFFSET]=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
@@ -404,13 +401,6 @@ fxDDCheckMergeAndRender(GLcontext * ctx, struct gl_pipeline_stage *d)
}
-extern void fxPointSmooth(GLcontext * ctx, GLuint first, GLuint last);
-extern void fxLineSmooth(GLcontext * ctx, GLuint v1, GLuint v2, GLuint pv);
-extern void fxTriangleSmooth(GLcontext * ctx, GLuint v1, GLuint v2, GLuint v3,
- GLuint pv);
-extern const char *gl_prim_name[];
-
-
/* static GLboolean edge_flag[GL_POLYGON+2] = { 0,0,0,0,1,0,0,1,0,1,0 }; */
void
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c b/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c
index e9d19d335..4fbd469bd 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxdd.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxdd.c,v 1.2 2000/11/08 05:02:52 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxdd.c,v 1.3 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -66,7 +66,6 @@ static const GLboolean true4[4] = { GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE };
GLubyte FX_PixelToRArray[0x10000];
GLubyte FX_PixelToGArray[0x10000];
GLubyte FX_PixelToBArray[0x10000];
-#endif /* defined(FX_PXCONV_TABULAR) */
/*
* Initialize the FX_PixelTo{RGB} arrays.
@@ -76,7 +75,6 @@ void
fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
{
fxMesa->bgrOrder = bgrOrder;
-#ifdef FX_PXCONV_TABULAR
/*
* We add a level of braces so that we can define the
* variable pixel here.
@@ -103,8 +101,8 @@ fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder)
FX_PixelToBArray[pixel] = b;
}
}
-#endif /* FX_PXCONV_TABULAR */
}
+#endif /* FX_PXCONV_TABULAR */
/**********************************************************************/
/***** Miscellaneous functions *****/
@@ -196,7 +194,6 @@ fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
}
-
if (fxMesa->haveHwStencil) {
/*
* If we want to clear stencil, it must be enabled
@@ -204,18 +201,20 @@ fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
* in the OGL state.
*/
if (mask & DD_STENCIL_BIT) {
- FX_grStencilMask(fxMesa, 0xff /*ctx->Stencil.WriteMask*/);
+ FX_grStencilMask_NoLock(0xFF /* ctx->Stencil.WriteMask*/ );
/* set stencil ref value = desired clear value */
- FX_grStencilFunc(fxMesa, GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff);
- FX_grStencilOp(fxMesa, GR_STENCILOP_REPLACE,
+ FX_grStencilFunc_NoLock(GR_CMP_ALWAYS, ctx->Stencil.Clear, 0xff);
+ FX_grStencilOp_NoLock(GR_STENCILOP_REPLACE,
GR_STENCILOP_REPLACE, GR_STENCILOP_REPLACE);
- FX_grEnable(fxMesa, GR_STENCIL_MODE_EXT);
+ FX_grEnable_NoLock(GR_STENCIL_MODE_EXT);
}
else {
- FX_grDisable(fxMesa, GR_STENCIL_MODE_EXT);
+ FX_grDisable_NoLock(GR_STENCIL_MODE_EXT);
}
}
+ BEGIN_CLIP_LOOP(fxMesa)
+
/*
* This could probably be done fancier but doing each possible case
* explicitly is less error prone.
@@ -223,146 +222,161 @@ fxDDClear(GLcontext * ctx, GLbitfield mask, GLboolean all,
switch (mask & ~DD_STENCIL_BIT) {
case DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
/* back buffer & depth */
- FX_grDepthMask(fxMesa, FXTRUE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask_NoLock(FXTRUE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
- clearS);
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
+ clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- FX_grDepthMask(fxMesa, FXFALSE);
+ FX_grDepthMask_NoLock(FXFALSE);
}
break;
case DD_FRONT_LEFT_BIT | DD_DEPTH_BIT:
/* XXX it appears that the depth buffer isn't cleared when
- * glRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER) is set.
+ * glRenderBuffer(GR_BUFFER_FRONTBUFFER) is set.
* This is a work-around/
*/
/* clear depth */
- FX_grDepthMask(fxMesa, FXTRUE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER);
- FX_grColorMaskv(ctx, false4);
+ FX_grDepthMask_NoLock(FXTRUE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ FX_grColorMaskv_NoLock(ctx, false4);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
/* clear front */
- FX_grColorMaskv(ctx, true4);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER);
+ FX_grColorMaskv_NoLock(ctx, true4);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
if (!ctx->Depth.Mask || !ctx->Depth.Test) {
- FX_grDepthMask(fxMesa, FXFALSE);
+ FX_grDepthMask_NoLock(FXFALSE);
}
break;
case DD_BACK_LEFT_BIT:
/* back buffer only */
- FX_grDepthMask(fxMesa, FXFALSE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask_NoLock(FXFALSE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask(fxMesa, FXTRUE);
+ FX_grDepthMask_NoLock(FXTRUE);
}
break;
case DD_FRONT_LEFT_BIT:
/* front buffer only */
- FX_grDepthMask(fxMesa, FXFALSE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER);
+ FX_grDepthMask_NoLock(FXFALSE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask(fxMesa, FXTRUE);
+ FX_grDepthMask_NoLock(FXTRUE);
}
break;
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT:
/* front and back */
- FX_grDepthMask(fxMesa, FXFALSE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask_NoLock(FXFALSE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
if (ctx->Depth.Mask && ctx->Depth.Test) {
- FX_grDepthMask(fxMesa, FXTRUE);
+ FX_grDepthMask_NoLock(FXTRUE);
}
break;
case DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT:
/* clear front */
- FX_grDepthMask(fxMesa, FXFALSE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER);
+ FX_grDepthMask_NoLock(FXFALSE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
/* clear back and depth */
- FX_grDepthMask(fxMesa, FXTRUE);
- FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER);
+ FX_grDepthMask_NoLock(FXTRUE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
if (!ctx->Depth.Mask || !ctx->Depth.Mask) {
- FX_grDepthMask(fxMesa, FXFALSE);
+ FX_grDepthMask_NoLock(FXFALSE);
}
break;
case DD_DEPTH_BIT:
/* just the depth buffer */
- FX_grRenderBuffer(fxMesa, GR_BUFFER_BACKBUFFER);
- FX_grColorMaskv(ctx, false4);
- FX_grDepthMask(fxMesa, FXTRUE);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_BACKBUFFER);
+ FX_grColorMaskv_NoLock(ctx, false4);
+ FX_grDepthMask_NoLock(FXTRUE);
if (stencil_size > 0)
- FX_grBufferClearExt(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD,
+ FX_grBufferClearExt_NoLock(fxMesa->clearC, fxMesa->clearA, clearD,
clearS);
else
- FX_grBufferClear(fxMesa, fxMesa->clearC, fxMesa->clearA, clearD);
- FX_grColorMaskv(ctx, true4);
+ FX_grBufferClear_NoLock(fxMesa->clearC, fxMesa->clearA, clearD);
+ FX_grColorMaskv_NoLock(ctx, true4);
if (ctx->Color.DrawDestMask & FRONT_LEFT_BIT)
- FX_grRenderBuffer(fxMesa, GR_BUFFER_FRONTBUFFER);
+ FX_grRenderBuffer_NoLock(GR_BUFFER_FRONTBUFFER);
if (!ctx->Depth.Test || !ctx->Depth.Mask)
- FX_grDepthMask(fxMesa, FXFALSE);
+ FX_grDepthMask_NoLock(FXFALSE);
break;
default:
- /* error */
- ;
+ /* clear no color buffers or depth buffer but might clear stencil */
+ if ((stencil_size > 0) && (mask & DD_STENCIL_BIT)) {
+ FX_grDepthMask_NoLock(FXFALSE);
+ FX_grColorMaskv_NoLock(ctx, false4);
+ FX_grBufferClearExt_NoLock(fxMesa->clearC,
+ fxMesa->clearA,
+ clearD,
+ (FxU32) clearS);
+ if (ctx->Depth.Mask && ctx->Depth.Test) {
+ FX_grDepthMask_NoLock(FXTRUE);
+ }
+ FX_grColorMaskv_NoLock(ctx, true4);
+ }
+ break;
}
+ END_CLIP_LOOP(fxMesa);
+
if (fxMesa->haveHwStencil) {
if (ctx->Stencil.Enabled) {
/* restore stencil state to as it was before the clear */
GrStencil_t sfail = fxConvertGLStencilOp(ctx->Stencil.FailFunc);
GrStencil_t zfail = fxConvertGLStencilOp(ctx->Stencil.ZFailFunc);
GrStencil_t zpass = fxConvertGLStencilOp(ctx->Stencil.ZPassFunc);
- FX_grStencilOp(fxMesa, sfail, zfail, zpass);
- FX_grStencilMask(fxMesa, ctx->Stencil.WriteMask);
- FX_grStencilFunc(fxMesa, ctx->Stencil.Function - GL_NEVER,
+ FX_grStencilOp_NoLock(sfail, zfail, zpass);
+ FX_grStencilMask_NoLock(ctx->Stencil.WriteMask);
+ FX_grStencilFunc_NoLock(ctx->Stencil.Function - GL_NEVER,
ctx->Stencil.Ref, ctx->Stencil.ValueMask);
- FX_grEnable(fxMesa, GR_STENCIL_MODE_EXT);
+ FX_grEnable_NoLock(GR_STENCIL_MODE_EXT);
}
else {
- FX_grDisable(fxMesa, GR_STENCIL_MODE_EXT);
+ FX_grDisable_NoLock(GR_STENCIL_MODE_EXT);
}
}
+
return softwareMask;
}
@@ -480,6 +494,7 @@ fxDDDepthMask(GLcontext * ctx, GLboolean mask)
* Return the current value of the occlusion test flag and
* reset the flag (hardware counters) to false.
*/
+#if 0
static GLboolean
get_occlusion_result(GLcontext *ctx)
{
@@ -515,7 +530,54 @@ get_occlusion_result(GLcontext *ctx)
return result;
}
+#else
+
+static GLboolean get_occlusion_result( GLcontext *ctx )
+{
+ fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ GLboolean result;
+
+ LOCK_HARDWARE( fxMesa );
+
+ printf("start state: %d %d\n", ctx->Depth.OcclusionTest, ctx->OcclusionResult);
+
+ if (ctx->Depth.OcclusionTest) {
+ if (ctx->OcclusionResult) {
+ result = GL_TRUE; /* result of software rendering */
+ printf("res = true 1\n");
+ }
+ else {
+ FxI32 zfail, in;
+ zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL);
+ in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN);
+ if (in == zfail) {
+ result = GL_FALSE; /* geom was completely occluded */
+ printf("res = false 2\n");
+ }
+ else {
+ result = GL_TRUE; /* all or part of geom was visible */
+ printf("res = true 2\n");
+
+ }
+ }
+ }
+ else {
+ result = ctx->OcclusionResultSaved;
+ printf("res = saved\n");
+ }
+
+ /* reset results now */
+ grReset(GR_STATS_PIXELS);
+ ctx->OcclusionResult = GL_FALSE;
+ ctx->OcclusionResultSaved = GL_FALSE;
+
+ UNLOCK_HARDWARE( fxMesa );
+
+ printf("result = %d\n", result);
+ return result;
+}
+#endif
/*
* We're only implementing this function to handle the
@@ -566,7 +628,6 @@ fxDDGetDoublev(GLcontext *ctx, GLenum pname, GLdouble *result)
}
-#ifdef XF86DRI
/* test if window coord (px,py) is visible */
static GLboolean
inClipRects(fxMesaContext fxMesa, int px, int py)
@@ -580,7 +641,6 @@ inClipRects(fxMesaContext fxMesa, int px, int py)
}
return GL_FALSE;
}
-#endif
@@ -678,12 +738,6 @@ bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
return GL_TRUE;
}
-#ifdef XF86DRI
-#define INSIDE(c, x, y) inClipRects((c), (x), (y))
-#else
-#define INSIDE(c, x, y) (1)
-#endif
-
{
const GLint winX = fxMesa->x_offset;
const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
@@ -691,12 +745,8 @@ bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
* to the front or back buffer. This compile-time test seems to do
* the job for now.
*/
-#ifdef XF86DRI
const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width) : (info.strideInBytes / 2);
-#else
- const GLint dstStride = info.strideInBytes / 2; /* stride in GLushorts */
-#endif
GLint row;
/* compute dest address of bottom-left pixel in bitmap */
GLushort *dst = (GLushort *) info.lfbPtr
@@ -714,7 +764,7 @@ bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
GLint col;
for (col = 0; col < width; col++) {
if (*src & mask) {
- if (INSIDE(fxMesa, winX + px + col, winY - py - row))
+ if (inClipRects(fxMesa, winX + px + col, winY - py - row))
dst[col] = color;
}
if (mask == 128U) {
@@ -734,7 +784,7 @@ bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
GLint col;
for (col = 0; col < width; col++) {
if (*src & mask) {
- if (INSIDE(fxMesa, winX + px + col, winY - py - row))
+ if (inClipRects(fxMesa, winX + px + col, winY - py - row))
dst[col] = color;
}
if (mask == 1U) {
@@ -752,8 +802,6 @@ bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
}
}
-#undef INSIDE
-
FX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB);
return GL_TRUE;
}
@@ -841,12 +889,6 @@ bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
return GL_TRUE;
}
-#ifdef XF86DRI
-#define INSIDE(c, x, y) inClipRects((c), (x), (y))
-#else
-#define INSIDE(c, x, y) (1)
-#endif
-
{
const GLint winX = fxMesa->x_offset;
const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
@@ -880,7 +922,7 @@ bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
GLint col;
for (col = 0; col < width; col++) {
if (*src & mask) {
- if (INSIDE(fxMesa, winX + px + col, winY - py - row))
+ if (inClipRects(fxMesa, winX + px + col, winY - py - row))
dst[col] = color;
}
if (mask == 128U) {
@@ -900,7 +942,7 @@ bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
GLint col;
for (col = 0; col < width; col++) {
if (*src & mask) {
- if (INSIDE(fxMesa, winX + px + col, winY - py - row))
+ if (inClipRects(fxMesa, winX + px + col, winY - py - row))
dst[col] = color;
}
if (mask == 1U) {
@@ -918,8 +960,6 @@ bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
}
}
-#undef INSIDE
-
FX_grLfbUnlock(fxMesa, GR_LFB_WRITE_ONLY, fxMesa->currentFB);
return GL_TRUE;
}
@@ -948,14 +988,10 @@ readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
const GLint winX = fxMesa->x_offset;
const GLint winY = fxMesa->y_offset + fxMesa->height - 1;
-#ifdef XF86DRI
const GLint srcStride =
(fxMesa->glCtx->Color.DrawBuffer ==
GL_FRONT) ? (fxMesa->screen_width) : (info.strideInBytes /
2);
-#else
- const GLint srcStride = info.strideInBytes / 2; /* stride in GLushorts */
-#endif
const GLushort *src = (const GLushort *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
GLubyte *dst = (GLubyte *) _mesa_image_address(packing, dstImage,
@@ -1083,12 +1119,8 @@ readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
fxMesa->currentFB,
GR_LFBWRITEMODE_ANY,
GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifdef XF86DRI
const GLint srcStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width) : (info.strideInBytes / 4);
-#else
- const GLint srcStride = info.strideInBytes / 4; /* stride in GLuints */
-#endif
const GLuint *src = (const GLuint *) info.lfbPtr
+ scrY * srcStride + scrX;
const GLint dstStride =
@@ -1116,13 +1148,14 @@ readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
MEMCPY(dst, src, widthInBytes);
dst += dstStride;
src -= srcStride;
- /* Data is in memory in BGRA format - we need to convert now */
- for (i = 0; i < width; i++) {
- const GLuint data = *dstp;
- /* Swap R & B values */
- *dstp++ = ((data & 0xff) << 16) |
- ((data & 0xff0000) >> 16) |
- (data & 0xff00ff00);
+ /* Data is in memory in BGRA format */
+ /* We need to swap R & B values */
+ for (i = 0; i < width; i++, dstp++) {
+ char *dstp0 = ((char *)(dstp)) + 0;
+ char *dstp2 = ((char *)(dstp)) + 2;
+ *dstp0 ^= *dstp2;
+ *dstp2 ^= *dstp0;
+ *dstp0 ^= *dstp2;
}
}
result = GL_TRUE;
@@ -1190,12 +1223,8 @@ drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
if (grLfbLock(GR_LFB_WRITE_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_8888, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
-#ifdef XF86DRI
const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width * 4) : (info.strideInBytes);
-#else
- const GLint dstStride = info.strideInBytes;
-#endif
const GLubyte *dst = (const GLubyte *) info.lfbPtr
+ scrY * dstStride + scrX * 4;
const GLint srcStride =
@@ -1276,12 +1305,8 @@ drawpixels_R8G8B8A8_v2(GLcontext * ctx, GLint x, GLint y,
if (grLfbLock(GR_LFB_WRITE_ONLY,
fxMesa->currentFB,
GR_LFBWRITEMODE_8888, GR_ORIGIN_UPPER_LEFT, FXTRUE, &info)) {
-#ifdef XF86DRI
const GLint dstStride = (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT)
? (fxMesa->screen_width * 4) : (info.strideInBytes);
-#else
- const GLint dstStride = info.strideInBytes;
-#endif
const GLubyte *dst = (const GLubyte *) info.lfbPtr
+ scrY * dstStride + scrX * 4;
const GLint srcStride =
@@ -1397,6 +1422,10 @@ fxDDGetString(GLcontext * ctx, GLenum name)
strcpy(hardware, FX_grGetString(fxMesa, GR_HARDWARE));
if (strcmp(hardware, "Voodoo3 (tm)") == 0)
strcpy(hardware, "Voodoo3");
+ else if (strcmp(hardware, "Voodoo4 (tm)") == 0)
+ strcpy(hardware, "Voodoo4");
+ else if (strcmp(hardware, "Voodoo5 (tm)") == 0)
+ strcpy(hardware, "Voodoo5");
else if (strcmp(hardware, "Voodoo Banshee (tm)") == 0)
strcpy(hardware, "VoodooBanshee");
else {
@@ -1408,7 +1437,7 @@ fxDDGetString(GLcontext * ctx, GLenum name)
}
}
/* now make the GL_RENDERER string */
- sprintf(buffer, "Mesa DRI %s 20000821", hardware);
+ sprintf(buffer, "Mesa DRI %s 20001101", hardware);
return buffer;
}
case GL_VENDOR:
@@ -1455,6 +1484,14 @@ fxDDInitExtensions(GLcontext * ctx)
if (fxMesa->isNapalm) {
gl_extensions_enable(ctx, "GL_ARB_texture_compression");
gl_extensions_enable(ctx, "GL_3DFX_texture_compression_FXT1");
+ {
+ char *legacy_str = getenv("FX_GL_COMPRESS_LEGACY_TEXTURES");
+ if (!legacy_str || ((legacy_str[0] == '0')
+ && (legacy_str[1] == '\0'))) {
+ gl_extensions_add(ctx, ALWAYS_ENABLED, "GL_S3_s3tc", 0);
+ }
+ }
+ gl_extensions_enable(ctx, "GL_EXT_texture_env_combine");
}
/* Example of hooking in an extension function.
@@ -1489,9 +1526,20 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
{
void *handle = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL);
if (!handle) {
- txImgQuantizePtr = 0;
- txImgDequantizeFXT1Ptr = 0;
- txErrorSetCallbackPtr = 0;
+ txImgQuantizePtr = NULL;
+ txImgDequantizeFXT1Ptr = NULL;
+ txErrorSetCallbackPtr = NULL;
+ grStencilFuncPtr = NULL;
+ grStencilMaskPtr = NULL;
+ grStencilOpPtr = NULL;
+ grBufferClearExtPtr = NULL;
+ grColorMaskExtPtr = NULL;
+ grColorCombineExtPtr = NULL;
+ grTexColorCombineExtPtr = NULL;
+ grAlphaCombineExtPtr = NULL;
+ grTexAlphaCombineExtPtr = NULL;
+ grAlphaBlendFunctionExtPtr = NULL;
+ grConstantColorValueExtPtr = NULL;
return 0;
}
else {
@@ -1506,6 +1554,12 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
grStencilOpPtr = dlsym(handle, "grStencilOp");
grBufferClearExtPtr = dlsym(handle, "grBufferClearExt");
grColorMaskExtPtr = dlsym(handle, "grColorMaskExt");
+ grColorCombineExtPtr = dlsym(handle, "grColorCombineExt");
+ grTexColorCombineExtPtr = dlsym(handle, "grTexColorCombineExt");
+ grAlphaCombineExtPtr = dlsym(handle, "grAlphaCombineExt");
+ grTexAlphaCombineExtPtr = dlsym(handle, "grTexAlphaCombineExt");
+ grAlphaBlendFunctionExtPtr = dlsym(handle, "grAlphaBlendFunctionExt");
+ grConstantColorValueExtPtr = dlsym(handle, "grConstantColorValueExt");
}
dlclose(handle);
}
@@ -1649,7 +1703,9 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
fxMesa->new_state = NEW_ALL;
fxMesa->glCtx->Driver.RenderStart = fxSetupFXUnits;
+#if defined(FX_PXCONV_TABULAR)
fxInitPixelTables(fxMesa, GL_FALSE); /* Load tables of pixel colors */
+#endif /* FX_PXCONV_TABULAR */
/* Run the config file */
gl_context_initialize(fxMesa->glCtx);
@@ -1658,9 +1714,6 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
}
-/************************************************************************/
-/************************************************************************/
-/************************************************************************/
/* Check if the hardware supports the current context
*
@@ -1674,6 +1727,29 @@ fxIsInHardware(GLcontext * ctx)
if (!ctx->Hint.AllowDrawMem)
return GL_TRUE; /* you'll take it and like it */
+ if (ctx->Color.BlendEnabled
+ && ctx->Color.BlendEquation != GL_FUNC_ADD_EXT) {
+ return GL_FALSE;
+ }
+
+ if (ctx->Color.ColorLogicOpEnabled && ctx->Color.LogicOp != GL_COPY) {
+ return GL_FALSE;
+ }
+
+ if (ctx->Light.Enabled &&
+ ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) {
+ return GL_FALSE;
+ }
+
+ if (ctx->Visual->RedBits < 8 &&
+ (ctx->Color.ColorMask[RCOMP] != ctx->Color.ColorMask[GCOMP] ||
+ ctx->Color.ColorMask[GCOMP] != ctx->Color.ColorMask[BCOMP])) {
+ /* can't individually mask R, G, B in 16bpp/Voodoo3 mode */
+ return GL_FALSE;
+ }
+
+
+#if 000
if (
((ctx->Color.BlendEnabled)
&& (ctx->Color.BlendEquation != GL_FUNC_ADD_EXT))
@@ -1687,6 +1763,9 @@ fxIsInHardware(GLcontext * ctx)
) {
return GL_FALSE;
}
+#endif
+
+
/* Unsupported texture/multitexture cases */
if (fxMesa->emulateTwoTMUs) {
@@ -1704,7 +1783,8 @@ fxIsInHardware(GLcontext * ctx)
return GL_FALSE;
}
#endif
- if (ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
+ if (!fxMesa->isNapalm &&
+ ctx->Texture.Unit[0].EnvMode == GL_BLEND &&
(ctx->Texture.ReallyEnabled & TEXTURE1_2D ||
ctx->Texture.Unit[0].EnvColor[0] != 0 ||
ctx->Texture.Unit[0].EnvColor[1] != 0 ||
@@ -1717,9 +1797,9 @@ fxIsInHardware(GLcontext * ctx)
}
if (ctx->Texture.ReallyEnabled & TEXTURE1_2D) {
- if (ctx->Texture.Unit[1].EnvMode == GL_BLEND)
+ if (!fxMesa->isNapalm && ctx->Texture.Unit[1].EnvMode == GL_BLEND)
return GL_FALSE;
- if (ctx->Texture.Unit[0].Current->Image[0]->Border > 0)
+ if (ctx->Texture.Unit[1].Current->Image[0]->Border > 0)
return GL_FALSE;
}
@@ -1759,7 +1839,7 @@ fxIsInHardware(GLcontext * ctx)
}
- if ((ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
+ if (!fxMesa->isNapalm && (ctx->Texture.ReallyEnabled & TEXTURE0_2D) &&
(ctx->Texture.Unit[0].EnvMode == GL_BLEND)) {
return GL_FALSE;
}
@@ -1878,6 +1958,7 @@ fxSetupDDPointers(GLcontext * ctx)
ctx->Driver.TexImage2D = fxDDTexImage2D;
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
+ ctx->Driver.TestProxyTexImage = fxDDTestProxyTexImage;
ctx->Driver.GetTexImage = fxDDGetTexImage;
ctx->Driver.CompressedTexImage2D = fxDDCompressedTexImage2D;
ctx->Driver.CompressedTexSubImage2D = fxDDCompressedTexSubImage2D;
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c b/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c
index 2f2d0cfb8..c18cac338 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c,v 1.5 2000/12/02 20:29:06 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddspan.c,v 1.7 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -781,19 +781,20 @@ write_R8G8B8A8_rgb_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
const GLint winX = fxMesa->x_offset;
const GLint scrX = winX + x;
const GLint scrY = winY - y;
+ GLubyte visMask[MAX_WIDTH];
+
+ generate_vismask(fxMesa, scrX, scrY, n, visMask);
if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) {
GLint dstStride = fxMesa->screen_width * 4;
GLubyte *dst = (GLubyte *) info.lfbPtr
+ (winY - y) * dstStride + (winX + x) * 4;
GLuint *dst32 = (GLuint *) dst;
- GLubyte visMask[MAX_WIDTH];
GLuint i;
- generate_vismask(fxMesa, scrX, scrY, n, visMask);
for (i = 0; i < n; i++) {
if (visMask[i] && (!mask || mask[i])) {
dst32[i] =
- PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255);
+ PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255);
}
}
}
@@ -806,7 +807,7 @@ write_R8G8B8A8_rgb_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
if (mask) {
GLuint i;
for (i = 0; i < n; i++) {
- if (mask[i]) {
+ if (visMask[i] && mask[i]) {
dst32[i] =
PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255);
}
@@ -815,8 +816,10 @@ write_R8G8B8A8_rgb_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
else {
GLuint i;
for (i = 0; i < n; i++) {
- dst32[i] =
- PACK_BGRA32(rgb[i][0], rgb[i][1], rgb[i][2], 255);
+ if (visMask[i]) {
+ dst32[i] = PACK_BGRA32(rgb[i][0], rgb[i][1],
+ rgb[i][2], 255);
+ }
}
}
}
@@ -860,20 +863,20 @@ write_R8G8B8A8_rgba_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
const GLint winX = fxMesa->x_offset;
const GLint scrX = winX + x;
const GLint scrY = winY - y;
+ GLubyte visMask[MAX_WIDTH];
+
+ generate_vismask(fxMesa, scrX, scrY, n, visMask);
if (fxMesa->glCtx->Color.DrawBuffer == GL_FRONT) {
GLint dstStride = fxMesa->screen_width * 4;
GLubyte *dst = (GLubyte *) info.lfbPtr
+ (winY - y) * dstStride + (winX + x) * 4;
GLuint *dst32 = (GLuint *) dst;
- GLubyte visMask[MAX_WIDTH];
GLuint i;
- generate_vismask(fxMesa, scrX, scrY, n, visMask);
for (i = 0; i < n; i++) {
if (visMask[i] && (!mask || mask[i])) {
- dst32[i] =
- PACK_BGRA32(rgba[i][0], rgba[i][1], rgba[i][2],
- rgba[i][3]);
+ dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1], rgba[i][2],
+ rgba[i][3]);
}
}
}
@@ -883,12 +886,14 @@ write_R8G8B8A8_rgba_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
GLubyte *dst = (GLubyte *) info.lfbPtr
+ (winY - y) * dstStride + (winX + x) * 4;
GLuint *dst32 = (GLuint *) dst;
+ GLubyte visMask[MAX_WIDTH];
+ generate_vismask(fxMesa, scrX, scrY, n, visMask);
if (mask) {
GLuint i;
for (i = 0; i < n; i++) {
- if (mask[i]) {
- dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3]);
+ if (visMask[i] && mask[i]) {
+ dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1],
+ rgba[i][2], rgba[i][3]);
}
}
}
@@ -896,8 +901,10 @@ write_R8G8B8A8_rgba_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
/* no mask, write all pixels */
GLuint i;
for (i = 0; i < n; i++) {
- dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1],
- rgba[i][2], rgba[i][3]);
+ if (visMask[i]) {
+ dst32[i] = PACK_BGRA32(rgba[i][0], rgba[i][1],
+ rgba[i][2], rgba[i][3]);
+ }
}
}
}
@@ -946,13 +953,11 @@ read_R8G8B8A8_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
const GLuint *src32 = (const GLuint *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
GLuint i;
- GLuint *color = (GLuint*)rgba;
- MEMCPY(color, src32, n * 4);
+ MEMCPY(rgba, src32, n * 4);
for (i = 0; i < n; i++) {
- const GLuint p = *color;
- *color++ = ((p & 0x00ff0000) >> 16) |
- (p & 0xff00ff00) |
- ((p & 0x000000ff) << 16);
+ rgba[i][0] ^= rgba[i][2];
+ rgba[i][2] ^= rgba[i][0];
+ rgba[i][0] ^= rgba[i][2];
}
}
else {
@@ -961,13 +966,11 @@ read_R8G8B8A8_span(const GLcontext * ctx, GLuint n, GLint x, GLint y,
const GLuint *src32 = (const GLuint *) info.lfbPtr
+ (winY - y) * srcStride + (winX + x);
GLuint i;
- GLuint *color = (GLuint*)rgba;
- MEMCPY(color, src32, n * 4);
+ MEMCPY(rgba, src32, n * 4);
for (i = 0; i < n; i++) {
- const GLuint p = *color;
- *color++ = ((p & 0x00ff0000) >> 16) |
- (p & 0xff00ff00) |
- ((p & 0x000000ff) << 16);
+ rgba[i][0] ^= rgba[i][2];
+ rgba[i][2] ^= rgba[i][0];
+ rgba[i][0] ^= rgba[i][2];
}
}
grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
@@ -1216,15 +1219,10 @@ typedef struct
void *lfbPtr;
void *lfbWrapPtr;
FxU32 LFBStrideInElts;
- FxU32 firstWrappedX;
+ GLint firstWrappedX;
}
LFBParameters;
-static void GetFbParams(fxMesaContext fxMesa,
- GrLfbInfo_t * info,
- GrLfbInfo_t * backBufferInfo,
- LFBParameters * ReadParams, FxU32 elementSize);
-
/*
* We need information about the back buffer. Note that
* this function *cannot be called* while the aux buffer
@@ -1277,7 +1275,7 @@ GetFbParams(fxMesaContext fxMesa,
* < bufferOffset&(info->strideInBytes-1)
* the buffer begins in the forbidden zone. We assert for this.
*/
- bufferOffset = lfbPtr - (char *) backBufferInfo->lfbPtr;
+ bufferOffset = (FxU32)(lfbPtr - (char *) backBufferInfo->lfbPtr);
physicalStrideInBytes
= (fxMesa->screen_width * elementSize + TILE_WIDTH_IN_BYTES - 1)
& ~(TILE_WIDTH_IN_BYTES - 1);
@@ -1380,7 +1378,7 @@ fxDDWriteDepthSpan(GLcontext * ctx,
wrappedPartStart = n;
}
else {
- wrappedPartStart = n - (ReadParams.firstWrappedX - x);
+ wrappedPartStart = (ReadParams.firstWrappedX - x);
}
for (i = 0; i < wrappedPartStart; i++) {
if (mask[i] && visMask[i]) {
@@ -1419,7 +1417,7 @@ fxDDWriteDepthSpan(GLcontext * ctx,
wrappedPartStart = n;
}
else {
- wrappedPartStart = n - (ReadParams.firstWrappedX - x);
+ wrappedPartStart = (ReadParams.firstWrappedX - x);
}
for (i = 0; i < wrappedPartStart; i++) {
GLuint d32;
@@ -1486,7 +1484,7 @@ fxDDWriteDepthSpan(GLcontext * ctx,
wrappedPartStart = n;
}
else {
- wrappedPartStart = n - (ReadParams.firstWrappedX - x);
+ wrappedPartStart = (ReadParams.firstWrappedX - x);
}
for (i = 0; i < wrappedPartStart; i++) {
if (visMask[i]) {
@@ -1532,7 +1530,7 @@ fxDDWriteDepthSpan(GLcontext * ctx,
wrappedPartStart = n;
}
else {
- wrappedPartStart = n - (ReadParams.firstWrappedX - x);
+ wrappedPartStart = (ReadParams.firstWrappedX - x);
}
for (i = 0; i < wrappedPartStart; i++) {
if (visMask[i]) {
@@ -1573,10 +1571,8 @@ fxDDReadDepthSpan(GLcontext * ctx,
{
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GLint bottom = fxMesa->height + fxMesa->y_offset - 1;
- GLushort depth16[MAX_WIDTH];
GLuint i;
GLuint depth_size = fxMesa->glVis->DepthBits;
- GLuint stencil_size = fxMesa->glVis->StencilBits;
GrLfbInfo_t info;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
@@ -1590,17 +1586,48 @@ fxDDReadDepthSpan(GLcontext * ctx,
y = bottom - y;
switch (depth_size) {
case 16:
- FX_grLfbReadRegion(fxMesa, GR_BUFFER_AUXBUFFER, x, y, n, 1, 0, depth16);
- for (i = 0; i < n; i++) {
- depth[i] = depth16[i];
+ {
+ LFBParameters ReadParams;
+ GrLfbInfo_t backBufferInfo;
+ int wrappedPartStart;
+ GetBackBufferInfo(fxMesa, &backBufferInfo);
+ /*
+ * Note that the _LOCK macro adds a curly brace,
+ * and the UNLOCK macro removes it.
+ */
+ READ_FB_SPAN_LOCK(fxMesa, info, GR_BUFFER_AUXBUFFER);
+ GetFbParams(fxMesa, &info, &backBufferInfo,
+ &ReadParams, sizeof(GLushort));
+ if (ReadParams.firstWrappedX <= x) {
+ wrappedPartStart = 0;
+ }
+ else if (n <= (ReadParams.firstWrappedX - x)) {
+ wrappedPartStart = n;
+ }
+ else {
+ wrappedPartStart = (ReadParams.firstWrappedX - x);
+ }
+ /*
+ * Read the line.
+ */
+ for (i = 0; i < wrappedPartStart; i++) {
+ depth[i] =
+ GET_ORDINARY_FB_DATA(&ReadParams, GLushort, x + i, y);
+ }
+ for (; i < n; i++) {
+ depth[i] = GET_WRAPPED_FB_DATA(&ReadParams, GLushort,
+ x + i, y);
+ }
+ READ_FB_SPAN_UNLOCK(fxMesa, GR_BUFFER_AUXBUFFER);
+ break;
}
- break;
case 24:
case 32:
{
LFBParameters ReadParams;
GrLfbInfo_t backBufferInfo;
int wrappedPartStart;
+ GLuint stencil_size = fxMesa->glVis->StencilBits;
GetBackBufferInfo(fxMesa, &backBufferInfo);
/*
* Note that the _LOCK macro adds a curly brace,
@@ -1754,14 +1781,14 @@ fxDDReadDepthPixels(GLcontext * ctx, GLuint n,
{
LFBParameters ReadParams;
GetFbParams(fxMesa, &info, &backBufferInfo,
- &ReadParams, sizeof(GLuint));
+ &ReadParams, sizeof(GLushort));
for (i = 0; i < n; i++) {
/*
* Convert to screen coordinates.
*/
xpos = x[i] + fxMesa->x_offset;
ypos = bottom - y[i];
- d16 = GET_FB_DATA(&ReadParams, GLuint, xpos, ypos);
+ d16 = GET_FB_DATA(&ReadParams, GLushort, xpos, ypos);
depth[i] = d16;
}
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c b/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c
index 11438f440..84994a966 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c,v 1.1 2000/09/24 13:51:14 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddtex.c,v 1.3 2000/12/08 21:34:20 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -64,7 +64,7 @@ fxPrintTextureData(tfxTexInfo * ti)
else
fprintf(stderr, "\tName: UNNAMED\n");
fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed);
- fprintf(stderr, "\tTMU: %ld\n", ti->whichTMU);
+ fprintf(stderr, "\tTMU: %ld\n", (unsigned long)ti->whichTMU);
fprintf(stderr, "\t%s\n", (ti->isInTM) ? "In TMU" : "Not in TMU");
if (ti->tm[0])
fprintf(stderr, "\tMem0: %x-%x\n", (unsigned) ti->tm[0]->startAddr,
@@ -153,7 +153,7 @@ fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDTexBind(%d,%x)\n", tObj->Name,
- (GLuint) tObj->DriverData);
+ tObj->DriverData);
}
if (target != GL_TEXTURE_2D)
@@ -220,7 +220,7 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDTexParam(%d,%x,%x,%x)\n", tObj->Name,
- (GLuint) tObj->DriverData, pname, param);
+ tObj->DriverData, pname, param);
}
if (target != GL_TEXTURE_2D)
@@ -358,20 +358,7 @@ void
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, ti);
- }
-
- if (!ti)
- return;
-
fxTMFreeTexture(fxMesa, tObj);
-
- FREE(ti);
- tObj->DriverData = NULL;
-
ctx->NewState |= NEW_TEXTURING;
}
@@ -468,7 +455,7 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
tfxTexInfo *ti;
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n",
- tObj->Name, (GLuint) tObj->DriverData);
+ tObj->Name, tObj->DriverData);
}
if (!tObj->DriverData)
tObj->DriverData = fxAllocTexObjData(fxMesa);
@@ -488,6 +475,9 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)
}
+/*
+ * Enable/disable the shared texture palette feature.
+ */
void
fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
{
@@ -498,8 +488,6 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
}
if (state) {
- fxMesa->haveGlobalPaletteTexture = 1;
-
FX_grTexDownloadTable(fxMesa, GR_TMU0, GR_TEXTABLE_PALETTE_6666_EXT,
&(fxMesa->glbPalette));
if (fxMesa->haveTwoTMUs)
@@ -507,8 +495,6 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)
&(fxMesa->glbPalette));
}
else {
- fxMesa->haveGlobalPaletteTexture = 0;
-
if ((ctx->Texture.Unit[0].Current == ctx->Texture.Unit[0].CurrentD[2])
&& (ctx->Texture.Unit[0].Current != NULL)) {
struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current;
@@ -897,11 +883,6 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
GLint texsize;
void *uncompressedImage;
- if (target == GL_PROXY_TEXTURE_2D) {
- /* XXX not possible for now */
-
- }
-
isCompressedFormat = texImage->IsCompressed;
if (target != GL_TEXTURE_2D || texImage->Border > 0)
return GL_FALSE;
@@ -1267,11 +1248,6 @@ fxDDCompressedTexImage2D( GLcontext *ctx, GLenum target,
GLboolean isCompressedFormat;
GLsizei texsize;
- if (target == GL_PROXY_TEXTURE_2D) {
- /* XXX not possible for now */
-
- }
-
if (target != GL_TEXTURE_2D || texImage->Border > 0)
return GL_FALSE;
@@ -1398,6 +1374,84 @@ PrintTexture(int w, int h, int c, const GLubyte * data)
#endif
+GLboolean
+fxDDTestProxyTexImage(GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLenum format, GLenum type,
+ GLint width, GLint height,
+ GLint depth, GLint border )
+{
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
+
+ switch (target) {
+ case GL_PROXY_TEXTURE_1D:
+ return GL_TRUE; /* software rendering */
+ case GL_PROXY_TEXTURE_2D:
+ {
+ struct gl_texture_object *tObj;
+ tfxTexInfo *ti;
+ int memNeeded;
+
+ tObj = ctx->Texture.Proxy2D;
+ if (!tObj->DriverData)
+ tObj->DriverData = fxAllocTexObjData(fxMesa);
+ ti = fxTMGetTexInfo(tObj);
+
+ /* assign the parameters to test against */
+ tObj->Image[level]->Width = width;
+ tObj->Image[level]->Height = height;
+ tObj->Image[level]->Border = border;
+ tObj->Image[level]->IntFormat = internalFormat;
+ if (level == 0) {
+ /* don't use mipmap levels > 0 */
+ tObj->MinFilter = tObj->MagFilter = GL_NEAREST;
+ }
+ else {
+ /* test with all mipmap levels */
+ tObj->MinFilter = GL_LINEAR_MIPMAP_LINEAR;
+ tObj->MagFilter = GL_NEAREST;
+ }
+ ti->validated = GL_FALSE;
+ fxTexValidate(ctx, tObj);
+
+ /*
+ printf("small lodlog2 0x%x\n", ti->info.smallLodLog2);
+ printf("large lodlog2 0x%x\n", ti->info.largeLodLog2);
+ printf("aspect ratio 0x%x\n", ti->info.aspectRatioLog2);
+ printf("glide format 0x%x\n", ti->info.format);
+ printf("data %p\n", ti->info.data);
+ printf("lodblend %d\n", (int) ti->LODblend);
+ */
+
+ /* determine where texture will reside */
+ if (ti->LODblend && !shared->umaTexMemory) {
+ /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
+ memNeeded = FX_grTexTextureMemRequired_NoLock(
+ GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
+ }
+ else {
+ /* XXX GR_MIPMAPLEVELMASK_BOTH might not be right, but works */
+ memNeeded = FX_grTexTextureMemRequired_NoLock(
+ GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
+ }
+ /*
+ printf("Proxy test %d > %d\n", memNeeded, shared->totalTexMem[0]);
+ */
+ if (memNeeded > shared->totalTexMem[0])
+ return GL_FALSE;
+ else
+ return GL_TRUE;
+ }
+ case GL_PROXY_TEXTURE_3D:
+ return GL_TRUE; /* software rendering */
+ default:
+ return GL_TRUE; /* never happens, silence compiler */
+ }
+}
+
+
/*
* Return a texture image to Mesa. This is either to satisfy
* a glGetTexImage() call or to prepare for software texturing.
@@ -1551,7 +1605,14 @@ fxDDGetCompressedTexImage( GLcontext *ctx, GLenum target,
GLint
fxDDSpecificCompressedTexFormat(GLcontext *ctx,
GLint internalFormat,
- GLint numDimensions)
+ GLint numDimensions,
+ GLint *levelp,
+ GLsizei *widthp,
+ GLsizei *heightp,
+ GLsizei *depthp,
+ GLint *borderp,
+ GLenum *formatp,
+ GLenum *typep)
{
if (numDimensions != 2) {
return internalFormat;
@@ -1568,6 +1629,35 @@ fxDDSpecificCompressedTexFormat(GLcontext *ctx,
return(internalFormat);
}
switch (internalFormat) {
+ /*
+ * GL_S3_s3tc uses negative level values.
+ */
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ {
+ GLint level;
+ if (levelp) {
+ level = *levelp;
+ if (level < 0) {
+ level = -level;
+ *levelp = level;
+ }
+ }
+ }
+ return GL_COMPRESSED_RGB_FXT1_3DFX;
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ {
+ GLint level;
+ if (levelp) {
+ level = *levelp;
+ if (level < 0) {
+ level = -level;
+ *levelp = level;
+ }
+ }
+ }
+ return GL_COMPRESSED_RGBA_FXT1_3DFX;
case GL_COMPRESSED_RGB_ARB:
return GL_COMPRESSED_RGB_FXT1_3DFX;
case GL_COMPRESSED_RGBA_ARB:
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h b/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h
index 24b63ed07..e4695c616 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h,v 1.1 2000/09/24 13:51:15 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxddtex.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
#ifndef FXDDTEX_H
#define FXDDTEX_H
@@ -32,6 +32,12 @@ extern GLboolean fxDDTexSubImage2D(GLcontext * ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
+extern GLboolean fxDDTestProxyTexImage(GLcontext *ctx, GLenum target,
+ GLint level, GLint internalFormat,
+ GLenum format, GLenum type,
+ GLint width, GLint height,
+ GLint depth, GLint border );
+
extern GLvoid *fxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
GLenum * formatOut, GLenum * typeOut,
@@ -56,7 +62,14 @@ extern void fxDDGetCompressedTexImage( GLcontext *ctx, GLenum target,
struct gl_texture_image *texImage );
extern GLint fxDDSpecificCompressedTexFormat(GLcontext *ctx,
GLint internalFormat,
- GLint numDimensions);
+ GLint numDimensions,
+ GLint *levelp,
+ GLsizei *widthp,
+ GLsizei *heightp,
+ GLsizei *depthp,
+ GLint *borderp,
+ GLenum *formatp,
+ GLenum *typep);
extern GLint fxDDBaseCompressedTexFormat(GLcontext *ctx,
GLint internalFormat);
@@ -96,4 +109,15 @@ extern GLsizei fxDDCompressedImageSize(GLcontext *ctx,
GLuint height,
GLuint depth);
+/*
+ * This is not in glext.h, since this is not an EXT or ARB
+ * extension. It probably shouldn't be here exactly, but
+ * there's not an obvious good place for it.
+ */
+#ifndef GL_S3_s3tc
+#define GL_RGB_S3TC 0x83A0
+#define GL_RGB4_S3TC 0x83A1
+#define GL_RGBA_S3TC 0x83A2
+#define GL_RGBA4_S3TC 0x83A3
+#endif
#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h b/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h
index 08622ede1..d3ae3e30a 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h,v 1.1 2000/09/24 13:51:15 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxdrv.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
@@ -39,7 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
#include <sys/time.h>
-#include <glide.h>
#include "dri_tmm.h"
#include "dri_mesaint.h"
#include "dri_mesa.h"
@@ -52,32 +51,25 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if defined(__linux__)
#include <signal.h>
#endif
+#include "clip.h"
#include "context.h"
+#include "fxglidew.h"
#include "macros.h"
#include "matrix.h"
#include "mem.h"
#include "texture.h"
#include "types.h"
#include "vb.h"
-#include "xform.h"
-#include "clip.h"
#include "vbrender.h"
-#include "fxglidew.h"
-
-
-/*typedef struct tfxMesaContext *fxMesaContext;*/
-
+#include "xform.h"
-typedef struct
-{
+typedef struct {
drmHandle handle;
drmSize size;
drmAddress map;
-}
-tdfxRegion, *tdfxRegionPtr;
+} tdfxRegion, *tdfxRegionPtr;
-typedef struct
-{
+typedef struct {
tdfxRegion regs;
int deviceID;
int width;
@@ -93,18 +85,15 @@ typedef struct
int textureOffset;
int textureSize;
__DRIscreenPrivate *driScrnPriv;
-}
-tdfxScreenPrivate;
+} tdfxScreenPrivate;
-typedef struct
-{
+typedef struct {
volatile int fifoPtr;
volatile int fifoRead;
volatile int fifoOwner;
volatile int ctxOwner;
volatile int texOwner;
-}
-TDFXSAREAPriv;
+} TDFXSAREAPriv;
extern void fx_sanity_triangle(fxMesaContext fxMesa,
@@ -184,6 +173,12 @@ fxVertex;
gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
}
+#if FX_USE_PARGB
+#define GOURAUD2(v, c) { \
+ GLubyte *col = c; \
+ PACK_4F_ARGB(GET_PARGB(v), col[3], col[0], col[1], col[2]); \
+}
+#else
#define GOURAUD2(v, c) { \
GLubyte *col = c; \
v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
@@ -191,6 +186,7 @@ fxVertex;
v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
}
+#endif /* FX_USE_PARGB */
/* Mergable items first
@@ -363,6 +359,7 @@ typedef struct
GLuint reqTexUpload;
GLuint texUpload;
GLuint memTexUpload;
+ GLuint texSwaps;
}
tfxStats;
@@ -426,24 +423,20 @@ tfxUnitsState;
*/
struct tfxMesaVertexBuffer
{
- GLvector1ui clipped_elements;
-
- fxVertex *verts;
- fxVertex *last_vert;
- void *vert_store;
+ GLuint size; /* Number of vertexes */
+ GLvector1ui clipped_elements; /* Array [size] of GLuints */
+ fxVertex *verts; /* Array of [size] fxVertex */
+ fxVertex *last_vert; /* Points into verts array */
#if defined(FX_GLIDE3)
- GrVertex **triangle_b; /* Triangle buffer */
- GrVertex **strips_b; /* Strips buffer */
+ GrVertex **triangle_b; /* Triangle buffer */
+ GrVertex **strips_b; /* Strips buffer */
#endif
-
- GLuint size;
};
#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data))
#define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx))
#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current)
-
#if !defined(FX_PXCONV_TABULAR) \
&& !defined(FX_PXCONV_APPROXIMATION) \
&& !defined(FX_PXCONV_EXACT)
@@ -490,40 +483,96 @@ extern GLubyte FX_PixelToBArray[0x10000];
#elif defined(FX_PXCONV_EXACT)
#define FX_PixelToR(fxMesa, v) \
((((fxMesa)->bgrOrder \
- ? FX_PXCONV_INT_FIELD(v, 5, 0)
+ ? FX_PXCONV_INT_FIELD(v, 5, 0) \
: FX_PXCONV_INT_FIELD(v, 5, 11)) * 8 * 255) / 0xF8)
#define FX_PixelToG(fxMesa, v) \
((FX_PXCONV_INT_FIELD(v, 6, 5) * 4 * 255) / 0xFC)
#define FX_PixelToB(fxMesa, v) \
((((fxMesa)->bgrOrder \
- ? FX_PXCONV_INT_FIELD(v, 5, 11)
+ ? FX_PXCONV_INT_FIELD(v, 5, 11) \
: FX_PXCONV_INT_FIELD(v, 5, 0)) * 8 * 255) / 0xF8)
#else
#error Need to define pixel a conversion method.
#endif
+
+/*
+ * This is state which may be shared by several tdfx contexts.
+ * It hangs off of Mesa's gl_shared_state object (ctx->Shared->DriverData).
+ */
+struct TdfxSharedState
+{
+ GLboolean umaTexMemory;
+ GLuint totalTexMem[FX_NUM_TMU]; /* constant */
+ GLuint freeTexMem[FX_NUM_TMU]; /* changes as we go */
+ MemRange *tmPool;
+ MemRange *tmFree[FX_NUM_TMU];
+};
+
+
+/*
+ * This is the tdfx context struct.
+ */
struct tfxMesaContext
{
+ /*
+ * Set once and never changed:
+ */
GLcontext *glCtx; /* the core Mesa context */
GLvisual *glVis; /* describes the color buffer */
+ GLboolean initDone; /* has this context been initialized? */
GLint board; /* the board used for this context */
- GLint width, height; /* size of color buffer */
+ int screen_width;
+ int screen_height;
- GrBuffer_t currentFB;
+ FX_GrContext_t glideContext; /* returned by grSstWinOpen() */
+ void *state; /* Glide state buffer */
+ GLint textureAlign;
GLboolean bgrOrder;
- GLuint depthClear;
- GrColor_t color;
- GrColor_t clearC;
- GrAlpha_t clearA;
+ GLboolean verbose;
+ GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
+ GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
+ GLboolean haveHwStencil;
+ GLboolean isNapalm;
+ GLint swapInterval;
+ GLint maxPendingSwapBuffers;
+
+ /* stuff added for DRI */
+ __DRIcontextPrivate *driContextPriv;
+ drmContext hHWContext;
+ int numClipRects;
+ XF86DRIClipRectPtr pClipRects;
+ tdfxScreenPrivate *tdfxScrnPriv;
+
+ /*
+ * Changes during execution:
+ */
+ int width, height; /* size of window */
+ int x_offset; /* distance from window left to screen left */
+ int y_offset; /* distance from window top to screen top */
+ int y_delta; /* distance from window bottom to screen bottom */
+ int needClip; /* need to loop over cliprects? */
+ int clipMinX; /* if !needClip, bounds of the single clip rect */
+ int clipMaxX; /* "" */
+ int clipMinY; /* "" */
+ int clipMaxY; /* "" */
+
+
+ GrBuffer_t currentFB; /* front buffer or back buffer */
+
+ GLuint depthClear; /* glClear depth value */
+ GrColor_t clearC; /* glClear color value */
+ GrAlpha_t clearA; /* glClear alpha value */
GLuint constColor;
+ GrColor_t color;
GrCullMode_t cullMode;
tfxUnitsState unitsState;
tfxUnitsState restoreUnitsState; /* saved during multipass */
- GuTexPalette glbPalette;
+ GuTexPalette glbPalette; /* global texture palette */
GLuint tmu_source[FX_NUM_TMU];
GLuint tex_dest[MAX_TEXTURE_UNITS];
@@ -538,25 +587,17 @@ struct tfxMesaContext
GLuint is_in_hardware;
GLuint new_state;
GLuint using_fast_path, passes, multipass;
+ GLuint texBindNumber;
+ GLint tmuSrc;
tfxLineClipFunc clip_line;
tfxTriClipFunc clip_tri_stride;
tfxTriViewClipFunc view_clip_tri;
-
- /* Texture Memory Manager Data */
- GLboolean umaTexMemory;
- GLuint texBindNumber;
- GLint tmuSrc;
- GLuint freeTexMem[FX_NUM_TMU];
- MemRange *tmPool;
- MemRange *tmFree[FX_NUM_TMU];
-
GLenum fogTableMode;
GLfloat fogDensity;
GLfloat fogStart, fogEnd;
GrFog_t *fogTable;
- GLint textureAlign;
/* Acc. functions */
@@ -566,54 +607,16 @@ struct tfxMesaContext
quad_func QuadFunc;
render_func **RenderVBTables;
-
render_func *RenderVBClippedTab;
render_func *RenderVBCulledTab;
render_func *RenderVBRawTab;
-
tfxStats stats;
-
- void *state;
-
- /* Options */
-
- GLboolean verbose;
- GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
- GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
- GLboolean haveAlphaBuffer;
- GLboolean haveHwStencil;
- GLboolean haveGlobalPaletteTexture;
- GLboolean isNapalm;
- GLint swapInterval;
- GLint maxPendingSwapBuffers;
-
- FX_GrContext_t glideContext;
-
- int x_offset;
- int y_offset;
- int y_delta;
- int screen_width;
- int screen_height;
- int initDone;
- int clipMinX;
- int clipMaxX;
- int clipMinY;
- int clipMaxY;
- int needClip;
-
- /* stuff added for DRI */
- __DRIcontextPrivate *driContextPriv;
- drmContext hHWContext;
- int numClipRects;
- XF86DRIClipRectPtr pClipRects;
- tdfxScreenPrivate *tdfxScrnPriv;
};
typedef void (*tfxSetupFunc) (struct vertex_buffer *, GLuint, GLuint);
-extern int texSwaps;
extern void fxPrintSetupFlags(const char *msg, GLuint flags);
extern void fxSetupDDPointers(GLcontext *);
@@ -676,7 +679,7 @@ extern int fxDDInitFxMesaContext(fxMesaContext fxMesa);
extern void fxSetScissorValues(GLcontext * ctx);
extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
- struct gl_texture_object *tObj, GLint where);
+ struct gl_texture_object *tObj, FxU32 where);
extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
@@ -690,13 +693,10 @@ extern void XMesaUpdateState(fxMesaContext fxMesa);
/* This is the private interface between Glide and DRI */
-extern void grDRIOpen(char *pFB, char *pRegs, int deviceID,
- int width, int height,
- int mem, int cpp, int stride,
- int fifoOffset, int fifoSize,
- int fbOffset, int backOffset, int depthOffset,
- int textureOffset, int textureSize,
+#if 0
+extern void grDRIOpen(char *pFB, tdfxScreenPrivate *sPriv,
volatile int *fifoPtr, volatile int *fifoRead);
+#endif
extern void grDRIPosition(int x, int y, int w, int h,
int numClip, XF86DRIClipRectPtr pClip);
extern void grDRILostContext(void);
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c b/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c
index 60a48d576..e238f0584 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c,v 1.2 2000/11/13 23:31:32 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxfastpath.c,v 1.4 2000/12/09 02:13:22 dawes Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -170,7 +170,8 @@ do { \
} \
} while (0)
-#if defined(FX_V2) || defined(DRIVERTS)
+
+/* Add window offset to window coords to get screen coords */
#define VARS_XYZ \
GLfloat vsx = mat[MAT_SX]; \
@@ -185,43 +186,6 @@ do { \
f[YCOORD] = f[1] * oow * vsy + vty; \
f[ZCOORD] = f[2] * oow * vsz + vtz;
-#else
-#if defined(HAVE_FAST_MATH)
-
-#define VARS_XYZ \
- GLfloat vsx = mat[MAT_SX]; \
- GLfloat vsy = mat[MAT_SY]; \
- GLfloat vsz = mat[MAT_SZ]; \
- const GLfloat snapper = (3L << 18); \
- GLfloat vtx = mat[MAT_TX] + snapper; \
- GLfloat vty = mat[MAT_TY] + snapper; \
- GLfloat vtz = mat[MAT_TZ];
-
-#define DO_SETUP_XYZ \
- f[XCOORD] = f[0] * oow * vsx + vtx; \
- f[XCOORD] -= snapper; \
- f[YCOORD] = f[1] * oow * vsy + vty; \
- f[YCOORD] -= snapper; \
- f[ZCOORD] = f[2] * oow * vsz + vtz;
-
-#else
-
-#define VARS_XYZ \
- GLfloat vsx = mat[MAT_SX] * 16.0f; \
- GLfloat vsy = mat[MAT_SY] * 16.0f; \
- GLfloat vsz = mat[MAT_SZ]; \
- GLfloat vtx = mat[MAT_TX] * 16.0f; \
- GLfloat vty = mat[MAT_TY] * 16.0f; \
- GLfloat vtz = mat[MAT_TZ];
-
-#define DO_SETUP_XYZ \
- f[XCOORD] = ((int)(f[0]*oow*vsx+vtx)) * (1.0f/16.0f); \
- f[YCOORD] = ((int)(f[1]*oow*vsy+vty)) * (1.0f/16.0f); \
- f[ZCOORD] = f[2]*oow*vsz + vtz;
-
-
-#endif
-#endif
@@ -342,9 +306,7 @@ fxDDFastPath(struct vertex_buffer *VB)
struct fx_fast_tab *tab = &fxFastTab[fxMesa->setupindex & 0x7];
GLuint do_clip = 1;
struct tfxMesaVertexBuffer *fxVB = FX_DRIVER_DATA(VB);
-#ifdef DRIVERTS
GLfloat tx, ty;
-#endif
fxVertex *first;
GLfloat *mat = ctx->Viewport.WindowMap.m;
@@ -360,12 +322,11 @@ fxDDFastPath(struct vertex_buffer *VB)
first = FX_DRIVER_DATA(VB)->verts;
-#ifdef DRIVERTS
+ /* Add window offset to window coords to get screen coords */
tx = mat[MAT_TX];
ty = mat[MAT_TY];
mat[MAT_TX] = tx + fxMesa->x_offset;
mat[MAT_TY] = ty + fxMesa->y_delta;
-#endif
if (VB->ClipOrMask) {
if (!VB->ClipAndMask) {
@@ -392,10 +353,9 @@ fxDDFastPath(struct vertex_buffer *VB)
fxDDRenderElementsDirect(VB); /* render using orig list */
}
-#ifdef DRIVERTS
+ /* Add window offset to window coords to get screen coords */
mat[MAT_TX] = tx;
mat[MAT_TY] = ty;
-#endif
/* This indicates that there is no cached data to reuse.
*/
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h
index 2e1949a18..8a85a2ad5 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h,v 1.2 2000/11/13 23:31:32 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxfasttmp.h,v 1.4 2000/12/12 23:24:28 dawes Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -144,8 +144,7 @@ static void TAG(fx_project_vertices) (GLfloat * first,
#if FX_USE_PARGB
if (TYPE & SETUP_RGBA) {
- PACK_4F_ARGB(GET_PARGB(f), f[CLIP_A], f[CLIP_R], f[CLIP_G],
- f[CLIP_B]);
+ PACK_4F_ARGB(GET_PARGB(f), f[CLIP_A], f[CLIP_R], f[CLIP_G], f[CLIP_B]);
}
#else
if (TYPE & SETUP_RGBA) {
@@ -183,12 +182,7 @@ static void TAG(fx_project_clipped_vertices) (GLfloat * first,
GLfloat oow = 1.0f / f[CLIP_WCOORD];
#if FX_USE_PARGB
if (TYPE & SETUP_RGBA) {
- const GLuint r = f[CLIP_R];
- const GLuint g = f[CLIP_G];
- const GLuint b = f[CLIP_B];
- const GLuint a = f[CLIP_A];
- /* ToDo Optimize */
- GET_PARGB(f) = a << 24 | r << 16 | g << 8 | b;
+ PACK_4F_ARGB(GET_PARGB(f), f[CLIP_A], f[CLIP_R], f[CLIP_G], f[CLIP_B]);
}
#else
if (TYPE & SETUP_RGBA) {
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c b/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c
index c88d7ca3f..93e0c915a 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c,v 1.1 2000/09/24 13:51:15 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxglidew.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -57,6 +57,13 @@ grColorMaskExt_t grColorMaskExtPtr = NULL;
txImgQuantize_t txImgQuantizePtr = NULL;
txImgDeQuantize_t txImgDequantizeFXT1Ptr = NULL;
txErrorSetCallback_t txErrorSetCallbackPtr = NULL;
+grColorCombineExt_t grColorCombineExtPtr = NULL;
+grTexColorCombineExt_t grTexColorCombineExtPtr = NULL;
+grAlphaCombineExt_t grAlphaCombineExtPtr = NULL;
+grTexAlphaCombineExt_t grTexAlphaCombineExtPtr = NULL;
+grAlphaBlendFunctionExt_t grAlphaBlendFunctionExtPtr = NULL;
+grConstantColorValueExt_t grConstantColorValueExtPtr = NULL;
+
FxI32
FX_grGetInteger_NoLock(FxU32 pname)
@@ -137,6 +144,23 @@ FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g,
}
+void
+FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g,
+ GLboolean b, GLboolean a)
+{
+ if (ctx->Visual->RedBits == 8) {
+ /* 32bpp mode */
+ ASSERT(grColorMaskExtPtr);
+ (*grColorMaskExtPtr)(r, g, b, a);
+ }
+ else {
+ /* 16 bpp mode */
+ /* we never have an alpha buffer */
+ grColorMask(r || g || b, GL_FALSE);
+ }
+}
+
+
/* As above, but pass the mask as an array
*/
void
@@ -158,6 +182,22 @@ FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4])
END_BOARD_LOCK(fxMesa);
}
+void
+FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4])
+{
+ if (ctx->Visual->RedBits == 8) {
+ /* 32bpp mode */
+ ASSERT(grColorMaskExtPtr);
+ (*grColorMaskExtPtr)(rgba[RCOMP], rgba[GCOMP],
+ rgba[BCOMP], rgba[ACOMP]);
+ }
+ else {
+ /* 16 bpp mode */
+ /* we never have an alpha buffer */
+ grColorMask(rgba[RCOMP] || rgba[GCOMP] || rgba[BCOMP], GL_FALSE);
+ }
+}
+
FxBool
@@ -207,15 +247,6 @@ FX_grTexMaxAddress(fxMesaContext fxMesa, GrChipID_t tmu)
}
-#if defined(FX_GLIDE3)
-
-void
-FX_grGammaCorrectionValue(float val)
-{
- (void) val;
-/* ToDo */
-}
-
int
FX_getFogTableSize(fxMesaContext fxMesa)
{
@@ -236,31 +267,6 @@ FX_getGrStateSize(fxMesaContext fxMesa)
return result;
}
-
-void
-FX_grGlideGetVersion(fxMesaContext fxMesa, char *buf)
-{
- BEGIN_BOARD_LOCK(fxMesa);
- strcpy(buf, grGetString(GR_VERSION));
- END_BOARD_LOCK(fxMesa);
-}
-
-void
-FX_grSstPerfStats(GrSstPerfStats_t * st)
-{
- FxI32 n;
- grGet(GR_STATS_PIXELS_IN, 4, &n);
- st->pixelsIn = n;
- grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n);
- st->chromaFail = n;
- grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n);
- st->zFuncFail = n;
- grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n);
- st->aFuncFail = n;
- grGet(GR_STATS_PIXELS_OUT, 4, &n);
- st->pixelsOut = n;
-}
-
void
FX_grAADrawLine(fxMesaContext fxMesa, GrVertex * a, GrVertex * b)
{
@@ -288,25 +294,20 @@ FX_grDrawPolygonVertexList(fxMesaContext fxMesa, int n, GrVertex * verts)
#if FX_USE_PARGB
void
-FX_setupGrVertexLayout(void)
+FX_setupGrVertexLayout(fxMesaContext fxMesa)
{
BEGIN_BOARD_LOCK(fxMesa);
grReset(GR_VERTEX_PARAMETER);
grCoordinateSpace(GR_WINDOW_COORDS);
grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_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,
- GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
END_BOARD_LOCK(fxMesa);
}
#else /* FX_USE_PARGB */
@@ -322,17 +323,13 @@ FX_setupGrVertexLayout(fxMesaContext fxMesa)
grVertexLayout(GR_PARAM_A, GR_VERTEX_A_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,
- GR_PARAM_ENABLE);
- grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2,
- GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
- grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2,
- GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE);
+ grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
+ grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE);
END_BOARD_LOCK(fxMesa);
}
-#endif
+#endif /* FX_USE_PARGB */
void
FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask)
@@ -373,79 +370,6 @@ FX_grHints(fxMesaContext fxMesa, GrHint_t hintType, FxU32 hintMask)
END_BOARD_LOCK(fxMesa);
}
-int
-FX_grSstQueryHardware(fxMesaContext fxMesa, GrHwConfiguration * config)
-{
- int i, j;
- int numFB;
-
- BEGIN_BOARD_LOCK(fxMesa);
- grGet(GR_NUM_BOARDS, 4, (void *) &(config->num_sst));
- if (config->num_sst == 0)
- return 0;
- for (i = 0; i < config->num_sst; i++) {
- config->SSTs[i].type = GR_SSTTYPE_VOODOO;
- grSstSelect(i);
- grGet(GR_MEMORY_FB, 4,
- (void *) &(config->SSTs[i].sstBoard.VoodooConfig.fbRam));
- config->SSTs[i].sstBoard.VoodooConfig.fbRam /= 1024 * 1024;
-
- grGet(GR_NUM_TMU, 4,
- (void *) &(config->SSTs[i].sstBoard.VoodooConfig.nTexelfx));
-
-
- grGet(GR_NUM_FB, 4, (void *) &numFB);
- if (numFB > 1)
- config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXTRUE;
- else
- config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE;
- for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++) {
- grGet(GR_MEMORY_TMU, 4,
- (void *) &(config->SSTs[i].sstBoard.
- VoodooConfig.tmuConfig[j].tmuRam));
- config->SSTs[i].sstBoard.VoodooConfig.
- tmuConfig[j].tmuRam /= 1024 * 1024;
- }
- }
- END_BOARD_LOCK(fxMesa);
- return 1;
-}
-
-#else
-
-int
-FX_grSstScreenWidth()
-{
- int i;
- BEGIN_BOARD_LOCK(fxMesa);
- i = grSstScreenWidth();
- END_BOARD_LOCK(fxMesa);
- return i;
-}
-
-int
-FX_grSstScreenHeight()
-{
- int i;
- BEGIN_BOARD_LOCK(fxMesa);
- i = grSstScreenHeight();
- END_BOARD_LOCK(fxMesa);
- return i;
-}
-
-int
-FX_grSstQueryHardware(GrHwConfiguration * c)
-{
- int i;
- BEGIN_BOARD_LOCK(fxMesa);
- i = grSstQueryHardware(c);
- END_BOARD_LOCK(fxMesa);
- return i;
-}
-
-
-#endif /* FX_GLIDE3 */
-
/* It appears to me that this function is needed either way. */
FX_GrContext_t
FX_grSstWinOpen(fxMesaContext fxMesa,
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h b/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h
index bdf9ee661..15c4f3408 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h,v 1.2 2000/11/13 23:31:32 dawes Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxglidew.h,v 1.3 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -84,6 +84,42 @@ typedef void (*grStencilOp_t) (GrStencilOp_t stencil_fail,
typedef void (*grBufferClearExt_t) (GrColor_t color, GrAlpha_t alpha,
FxU32 depth, GrStencil_t stencil);
typedef void (*grColorMaskExt_t) (FxBool r, FxBool g, FxBool b, FxBool a);
+
+/*
+ * "COMBINE" extension for Napalm
+ */
+typedef void (*grColorCombineExt_t)(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);
+typedef void (*grTexColorCombineExt_t)(FxU32 tmu,
+ GrTCCUColor_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);
+typedef void (*grAlphaCombineExt_t)(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);
+typedef void (*grTexAlphaCombineExt_t)(FxU32 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);
+typedef void (*grAlphaBlendFunctionExt_t)(GrAlphaBlendFnc_t rgb_sf,
+ GrAlphaBlendFnc_t rgb_df,
+ GrAlphaBlendOp_t rgb_op,
+ GrAlphaBlendFnc_t alpha_sf,
+ GrAlphaBlendFnc_t alpha_df,
+ GrAlphaBlendOp_t alpha_op);
+typedef void (*grConstantColorValueExt_t)(FxU32 tmu, GrColor_t value);
+
+
+
/*
* These are functions to compress and decompress images.
* The types of the first and second parameters are not exactly
@@ -112,49 +148,27 @@ extern grColorMaskExt_t grColorMaskExtPtr;
extern txImgQuantize_t txImgQuantizePtr;
extern txImgDeQuantize_t txImgDequantizeFXT1Ptr;
extern txErrorSetCallback_t txErrorSetCallbackPtr;
+extern grColorCombineExt_t grColorCombineExtPtr;
+extern grTexColorCombineExt_t grTexColorCombineExtPtr;
+extern grAlphaCombineExt_t grAlphaCombineExtPtr;
+extern grTexAlphaCombineExt_t grTexAlphaCombineExtPtr;
+extern grAlphaBlendFunctionExt_t grAlphaBlendFunctionExtPtr;
+extern grConstantColorValueExt_t grConstantColorValueExtPtr;
-FX_ENTRY void FX_CALL grEnable(GrEnableMode_t mode);
/*
* General context:
*/
-#if !defined(FX_GLIDE3)
-typedef FxU32 FX_GrContext_t; /* Not used in Glide2 */
-#else
typedef GrContext_t FX_GrContext_t;
-#endif
-/*
- * Glide3 emulation on Glide2:
- */
-#if !defined(FX_GLIDE3)
- /* Constanst for FX_grGetInteger( ) */
-#define FX_FOG_TABLE_ENTRIES 0x0004 /* The number of entries in the hardware fog table. */
-#define FX_GLIDE_STATE_SIZE 0x0006 /* Size of buffer, in bytes, needed to save Glide state. */
-#define FX_LFB_PIXEL_PIPE 0x0009 /* 1 if LFB writes can go through the 3D pixel pipe. */
-#define FX_PENDING_BUFFERSWAPS 0x0014 /* The number of buffer swaps pending. */
-#define FX_TEXTURE_ALIGN 0x0024 /* The required alignment for textures */
-#else
#define FX_FOG_TABLE_ENTRIES GR_FOG_TABLE_ENTRIES
#define FX_GLIDE_STATE_SIZE GR_GLIDE_STATE_SIZE
#define FX_LFB_PIXEL_PIPE GR_LFB_PIXEL_PIPE
#define FX_PENDING_BUFFERSWAPS GR_PENDING_BUFFERSWAPS
#define FX_TEXTURE_ALIGN GR_TEXTURE_ALIGN
-#endif
-#define FX_ZDEPTH_MAX 0x100
-/*
- * General warper functions for Glide2/Glide3:
- */
-extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
-extern FxI32 FX_grGetInteger(fxMesaContext fxMesa, FxU32 pname);
-
-extern const char *FX_grGetString(fxMesaContext fxMesa, FxU32 pname);
+#define FX_ZDEPTH_MAX 0x100
-/*
- * Glide2 emulation on Glide3:
- */
-#if defined(FX_GLIDE3)
#define GR_ASPECT_1x1 GR_ASPECT_LOG2_1x1
#define GR_ASPECT_2x1 GR_ASPECT_LOG2_2x1
@@ -176,66 +190,6 @@ extern const char *FX_grGetString(fxMesaContext fxMesa, FxU32 pname);
#define GR_FOG_WITH_TABLE GR_FOG_WITH_TABLE_ON_Q
-typedef int GrSstType;
-
-#define MAX_NUM_SST 4
-
-#define GR_SSTTYPE_VOODOO 0
-#define GR_SSTTYPE_SST96 1
-#define GR_SSTTYPE_AT3D 2
-#define GR_SSTTYPE_Voodoo2 3
-
-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? */
- FxBool sliDetect; /* Is it a scan-line interleaved board? */
- GrTMUConfig_t tmuConfig[GLIDE_NUM_TMU]; /* Configuration of the Texelfx chips */
-}
-GrVoodooConfig_t;
-
-typedef struct GrSst96Config_St
-{
- int fbRam; /* How much? */
- int nTexelfx;
- GrTMUConfig_t tmuConfig;
-}
-GrSst96Config_t;
-
-typedef GrVoodooConfig_t GrVoodoo2Config_t;
-
-typedef struct GrAT3DConfig_St
-{
- int rev;
-}
-GrAT3DConfig_t;
-
-typedef struct
-{
- int num_sst; /* # of HW units in the system */
- struct
- {
- GrSstType type; /* Which hardware is it? */
- union SstBoard_u
- {
- GrVoodooConfig_t VoodooConfig;
- GrSst96Config_t SST96Config;
- GrAT3DConfig_t AT3DConfig;
- GrVoodoo2Config_t Voodoo2Config;
- }
- sstBoard;
- }
- SSTs[MAX_NUM_SST]; /* configuration for each board */
-}
-GrHwConfiguration;
typedef FxU32 GrHint_t;
#define GR_HINTTYPE_MIN 0
@@ -260,26 +214,52 @@ typedef FxU32 GrSTWHint_t;
*/
typedef struct
{
- float sow; /* s texture ordinate (s over w) */
- float tow; /* t texture ordinate (t over w) */
- float oow; /* 1/w (used mipmapping - really 0xfff/w) */
+ GLfloat sow; /* s texture ordinate (s over w) */
+ GLfloat tow; /* t texture ordinate (t over w) */
+ GLfloat oow; /* 1/w (used mipmapping - really 0xfff/w) */
}
GrTmuVertex;
#if FX_USE_PARGB
+/* standard vertex, packed argb, double texture, 12 dwords */
typedef struct
{
- float x, y; /* X and Y in screen space */
- float ooz; /* 65535/Z (used for Z-buffering) */
- float oow; /* 1/W (used for W-buffering, texturing) */
- FxU32 argb; /* R, G, B, A [0..255.0] */
+ GLfloat x, y; /* X and Y in screen space */
+ GLfloat ooz; /* 65535/Z (used for Z-buffering) */
+ GLfloat oow; /* 1/W (used for W-buffering, texturing) */
+ FxU32 argb; /* R, G, B, A [0..255.0] */
GrTmuVertex tmuvtx[GLIDE_NUM_TMU];
- float z; /* Z is ignored */
+ GLfloat z; /* Z is ignored */
}
-GrVertex;
+GrVertex_12;
+/* optimised vertex, packed argb, single texture, 8 dwords = 1 cacheline */
+typedef struct
+{
+ GLfloat x, y; /* X and Y in screen space */
+ GLfloat ooz; /* 65535/Z (used for Z-buffering) */
+ GLfloat oow; /* 1/W (used for W-buffering, texturing) */
+ FxU32 argb; /* R, G, B, A [0..255.0] */
+ GrTmuVertex tmuvtx; /* only 1 TMU used to keep vertex size down */
+}
+GrVertex_8;
+
+/* vertex structure, padded to 16 dwords */
+typedef union
+{
+ GrVertex_8 v_8;
+ GrVertex_12 v_12;
+ GLfloat f[16];
+ GLuint u[16];
+}
+GrVertex_t;
+
+/* keep the compiler happy for now */
+typedef GrVertex_12 GrVertex;
+
+/* following offsets work for both vertex layouts */
#define GR_VERTEX_X_OFFSET 0
#define GR_VERTEX_Y_OFFSET 1
#define GR_VERTEX_OOZ_OFFSET 2
@@ -293,21 +273,26 @@ GrVertex;
#define GR_VERTEX_OOW_TMU1_OFFSET 10
#define GR_VERTEX_Z_OFFSET 11
-#define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET]
-/* GET_PA: returns the alpha component */
#if GLIDE_ENDIAN == GLIDE_ENDIAN_BIG
-#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4]
-#else
#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3]
+#define GET_PR(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+2]
+#define GET_PG(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+1]
+#define GET_PB(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+0]
+#else
+#define GET_PA(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+0]
+#define GET_PR(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+1]
+#define GET_PG(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+2]
+#define GET_PB(v) ((FxU8*)(v))[GR_VERTEX_PARGB_OFFSET*4+3]
#endif
-#define MESACOLOR2PARGB(c) (c[ACOMP] << 24 | c[GCOMP] << 16 | c[GCOMP] << 8 | c[BCOMP])
-#define PACK_4F_ARGB(dest,a,r,g,b) { \
- const GLuint cr = (int)r; \
- const GLuint cg = (int)g; \
- const GLuint ca = (int)a; \
- const GLuint cb = (int)b; \
- dest = ca << 24 | cr << 16 | cg << 8 | cb; \
- }
+
+#define GET_PARGB(v) ((FxU32*)(v))[GR_VERTEX_PARGB_OFFSET]
+#define PACK_4F_ARGB(dest, a, r, g, b) { \
+ const GLuint cr = (int)r; \
+ const GLuint cg = (int)g; \
+ const GLuint ca = (int)a; \
+ const GLuint cb = (int)b; \
+ dest = ca << 24 | cr << 16 | cg << 8 | cb; \
+ }
#else /* FX_USE_PARGB */
@@ -339,12 +324,14 @@ GrVertex;
#define GR_VERTEX_OOW_TMU1_OFFSET 14
#endif /* FX_USE_PARGB */
-#endif
-/*
- * Glide2 functions for Glide3
- */
-#if defined(FX_GLIDE3)
+
+extern FxI32 FX_grGetInteger_NoLock(FxU32 pname);
+
+extern FxI32 FX_grGetInteger(fxMesaContext fxMesa, FxU32 pname);
+
+extern const char *FX_grGetString(fxMesaContext fxMesa, FxU32 pname);
+
#define FX_grTexDownloadTable(fxMesa, TMU, type, data) \
do { \
@@ -356,34 +343,13 @@ GrVertex;
#define FX_grTexDownloadTable_NoLock(TMU, type, data) \
grTexDownloadTable(type, data)
-#else
-#define FX_grTexDownloadTable(TMU,type,data) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grTexDownloadTable(TMU,type,data); \
- END_BOARD_LOCK(); \
- } while (0);
-#define FX_grTexDownloadTable_NoLock grTexDownloadTable
-#endif
-/*
- * Flush
- */
-#if defined(FX_GLIDE3)
#define FX_grFlush(fxMesa) \
do { \
BEGIN_BOARD_LOCK(fxMesa); \
grFlush(); \
END_BOARD_LOCK(fxMesa); \
} while (0)
-#else
-#define FX_grFlush(fxMesa) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grSstIdle(); \
- END_BOARD_LOCK(fxMesa); \
- } while (0)
-#endif
#define FX_grFinish(fxMesa) \
do { \
@@ -392,10 +358,6 @@ GrVertex;
END_BOARD_LOCK(fxMesa); \
} while (0)
-/*
- * Write region: ToDo possible exploit the PixelPipe parameter.
- */
-#if defined(FX_GLIDE3)
#define FX_grLfbWriteRegion(fxMesa,dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
do { \
@@ -404,19 +366,7 @@ GrVertex;
END_BOARD_LOCK(fxMesa); \
} while(0)
-#else
-#define FX_grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grLfbWriteRegion(dst_buffer,dst_x,dst_y,src_format,src_width,src_height,src_stride,src_data); \
- END_BOARD_LOCK(); \
- } while (0)
-#endif
-
-/*
- * Read region
- */
#define FX_grLfbReadRegion(fxMesa,src_buffer,src_x,src_y,src_width,src_height,dst_stride,dst_data) \
do { \
BEGIN_BOARD_LOCK(fxMesa); \
@@ -424,9 +374,7 @@ GrVertex;
END_BOARD_LOCK(fxMesa); \
} while (0);
-/*
- * Draw triangle
- */
+
#define FX_grDrawTriangle_NoLock(a,b,c) grDrawTriangle(a,b,c)
#define FX_grDrawTriangle(fxMesa, a,b,c) \
do { \
@@ -438,165 +386,34 @@ GrVertex;
/*
* For Lod/LodLog2 conversion.
*/
-#if defined(FX_GLIDE3)
#define FX_largeLodLog2(info) (info).largeLodLog2
-#else
-#define FX_largeLodLog2(info) (info).largeLod
-#endif
-
-#if defined(FX_GLIDE3)
-#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
-#else
-#define FX_aspectRatioLog2(info) (info).aspectRatio
-#endif
-#if defined(FX_GLIDE3)
#define FX_smallLodLog2(info) (info).smallLodLog2
-#else
-#define FX_smallLodLog2(info) (info).smallLod
-#endif
-#if defined(FX_GLIDE3)
+#define FX_aspectRatioLog2(info) (info).aspectRatioLog2
+
#define FX_lodToValue(val) ((int)(GR_LOD_256-val))
-#else
-#define FX_lodToValue(val) ((int)(val))
-#endif
-#if defined(FX_GLIDE3)
#define FX_largeLodValue(info) ((int)(GR_LOD_256-(info).largeLodLog2))
-#else
-#define FX_largeLodValue(info) ((int)(info).largeLod)
-#endif
#define FX_largeLodValue_NoLock FX_largeLodValue
-#if defined(FX_GLIDE3)
#define FX_smallLodValue(info) ((int)(GR_LOD_256-(info).smallLodLog2))
-#else
-#define FX_smallLodValue(info) ((int)(info).smallLod)
-#endif
#define FX_smallLodValue_NoLock FX_smallLodValue
-#if defined(FX_GLIDE3)
#define FX_valueToLod(val) ((GrLOD_t)(GR_LOD_256-val))
-#else
-#define FX_valueToLod(val) ((GrLOD_t)(val))
-#endif
-
-/*
- * Version string.
- */
-#if defined(FX_GLIDE3)
-extern void FX_grGlideGetVersion(fxMesaContext fxMesa, char *buf);
-#else
-#define FX_grGlideGetVersion(b) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grGlideGetVersion(b); \
- END_BOARD_LOCK(); \
- } while (0)
-#endif
-/*
- * Performance statistics
- */
-#if defined(FX_GLIDE3)
-extern void FX_grSstPerfStats(GrSstPerfStats_t * st);
-#else
-#define FX_grSstPerfStats(s) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grSstPerfStats(s); \
- END_BOARD_LOCK(); \
- } while (0)
-#endif
-
-/*
- * Hardware Query
- */
-extern int FX_grSstQueryHardware(fxMesaContext fxMesa,
- GrHwConfiguration * config);
-
-/*
- * GrHints
- */
-#if defined(FX_GLIDE3)
extern void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask);
extern void FX_grHints(fxMesaContext fxMesa, GrHint_t hintType, FxU32 hintMask);
-#else
-#define FX_grHints(t,m) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grHints(t, m); \
- END_BOARD_LOCK(); \
- } while(0)
-#define FX_grHints_NoLock grHints
-#endif
-/*
- * Antialiashed line+point drawing.
- */
-#if defined(FX_GLIDE3)
-extern void FX_grAADrawLine(fxMesaContext fxMesa, GrVertex * a, GrVertex * b);
-#else
-#define FX_grAADrawLine(a,b) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grAADrawLine(a,b); \
- END_CLIP_LOOP(); \
- } while (0)
-#endif
-#if defined(FX_GLIDE3)
-extern void FX_grAADrawPoint(fxMesaContext fxMesa, GrVertex * a);
-#else
-#define FX_grAADrawPoint(a) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grAADrawPoint(a); \
- END_CLIP_LOOP(); \
- } while (0)
-#endif
-/*
- * Needed for Glide3 only, to set up Glide2 compatible vertex layout.
- */
-#if defined(FX_GLIDE3)
-extern void FX_setupGrVertexLayout(fxMesaContext fxMesa);
-#else
-#define FX_setupGrVertexLayout() do {} while (0)
-#endif
+extern void FX_grAADrawLine(fxMesaContext fxMesa, GrVertex * a, GrVertex * b);
+extern void FX_grAADrawPoint(fxMesaContext fxMesa, GrVertex * a);
-/*
- * grGammaCorrectionValue
- */
-#if defined(FX_GLIDE3)
-extern void FX_grGammaCorrectionValue(float val);
-#else
-#define FX_grGammaCorrectionValue(v) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grGammaCorrectionValue(v) \
- END_BOARD_LOCK(); \
- } while (0)
-#endif
-#if defined(FX_GLIDE3)
-#define FX_grSstWinClose(fxMesa, w) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grSstWinClose(w); \
- END_BOARD_LOCK(fxMesa); \
- } while (0)
-#else
-#define FX_grSstWinClose(w) \
- do { \
- BEGIN_BOARD_LOCK(); \
- grSstWinClose(); \
- END_BOARD_LOCK(); \
- } while (0)
-#endif
+extern void FX_setupGrVertexLayout(fxMesaContext fxMesa);
extern FX_GrContext_t FX_grSstWinOpen(fxMesaContext fxMesa,
@@ -624,17 +441,8 @@ extern FX_GrContext_t FX_grSstWinOpen(fxMesaContext fxMesa,
END_CLIP_LOOP(fxMesa); \
} while (0)
-#if defined(FX_GLIDE3)
extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa,
int n, GrVertex * v);
-#else
-#define FX_grDrawPolygonVertexList(n, v) \
- do { \
- BEGIN_CLIP_LOOP(); \
- grDrawPolygonVertexList(n, v); \
- END_CLIP_LOOP(); \
- } while (0)
-#endif
#define FX_grDitherMode(fxMesa, m) \
do { \
@@ -650,6 +458,8 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa,
END_BOARD_LOCK(fxMesa); \
} while (0)
+#define FX_grRenderBuffer_NoLock(b) grRenderBuffer(b)
+
#define FX_grBufferClear(fxMesa, c, a, d) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
@@ -657,6 +467,8 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa,
END_CLIP_LOOP(fxMesa); \
} while (0)
+#define FX_grBufferClearExt_NoLock(c, a, d, s) (*grBufferClearExtPtr)(c, a, d, s)
+
#define FX_grBufferClearExt(fxMesa, c, a, d, s) \
do { \
BEGIN_CLIP_LOOP(fxMesa); \
@@ -664,9 +476,9 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa,
END_CLIP_LOOP(fxMesa); \
} while (0)
-/*
- * Enable/Disable
- */
+#define FX_grBufferClear_NoLock(c, a, d) grBufferClear(c, a, d)
+
+
#define FX_grEnable(fxMesa, m) \
do { \
BEGIN_BOARD_LOCK(fxMesa); \
@@ -674,6 +486,8 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa,
END_BOARD_LOCK(fxMesa); \
} while (0)
+#define FX_grEnable_NoLock(m) grEnable(m)
+
#define FX_grDisable(fxMesa, m) \
do { \
BEGIN_BOARD_LOCK(fxMesa); \
@@ -681,44 +495,57 @@ extern void FX_grDrawPolygonVertexList(fxMesaContext fxMesa,
END_BOARD_LOCK(fxMesa); \
} while (0)
-/*
- * Stencil operations.
- */
-#define FX_grStencilFunc(fxMesa, fnc, ref, mask) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- (*grStencilFuncPtr)((fnc), (ref), (mask)); \
- END_BOARD_LOCK(fxMesa); \
+#define FX_grDisable_NoLock(m) grDisable(m)
+
+
+#define FX_grStencilFunc(fxMesa, fnc, ref, mask) \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ (*grStencilFuncPtr)((fnc), (ref), (mask)); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
-#define FX_grStencilMask(fxMesa, write_mask) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- (*grStencilMaskPtr)(write_mask); \
- END_BOARD_LOCK(fxMesa); \
+#define FX_grStencilFunc_NoLock(f, r, m) (*grStencilFuncPtr)(f, r, m)
+
+#define FX_grStencilMask(fxMesa, write_mask) \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ (*grStencilMaskPtr)(write_mask); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
+#define FX_grStencilMask_NoLock(m) (*grStencilMaskPtr)(m)
-#define FX_grStencilOp(fxMesa, stencil_fail, depth_fail, depth_pass) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- (*grStencilOpPtr)((stencil_fail), (depth_fail), (depth_pass)); \
- END_BOARD_LOCK(fxMesa); \
+#define FX_grStencilOp(fxMesa, stencil_fail, depth_fail, depth_pass) \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ (*grStencilOpPtr)((stencil_fail), (depth_fail), (depth_pass)); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
+#define FX_grStencilOp_NoLock(sf, df, dp) (*grStencilOpPtr)(sf, df, dp)
+
#define FX_grDepthMask(fxMesa, m) \
- do { \
+ do { \
BEGIN_BOARD_LOCK(fxMesa); \
- grDepthMask(m); \
+ grDepthMask(m); \
END_BOARD_LOCK(fxMesa); \
} while (0)
+#define FX_grDepthMask_NoLock(m) grDepthMask(m)
+
extern void FX_grColorMask(GLcontext *ctx, GLboolean r, GLboolean g,
GLboolean b, GLboolean a);
+extern void FX_grColorMask_NoLock(GLcontext *ctx, GLboolean r, GLboolean g,
+ GLboolean b, GLboolean a);
+
extern void FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]);
+extern void FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]);
+
+
extern FxBool FX_grLfbLock(fxMesaContext fxMesa,
GrLock_t type, GrBuffer_t buffer,
GrLfbWriteMode_t writeMode,
@@ -779,18 +606,18 @@ extern FxBool FX_grLfbLock(fxMesaContext fxMesa,
} while (0)
#define FX_grClipWindow(fxMesa, minx, miny, maxx, maxy) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grClipWindow(minx, miny, maxx, maxy); \
- END_BOARD_LOCK(fxMesa); \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ grClipWindow(minx, miny, maxx, maxy); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
#define FX_grClipWindow_NoLock grClipWindow
#define FX_grColorCombine(fxMesa, func, fact, loc, oth, inv) \
- do { \
+ do { \
BEGIN_BOARD_LOCK(fxMesa); \
- grColorCombine(func, fact, loc, oth, inv); \
+ grColorCombine(func, fact, loc, oth, inv); \
END_BOARD_LOCK(fxMesa); \
} while (0)
@@ -804,17 +631,17 @@ extern FxBool FX_grLfbLock(fxMesaContext fxMesa,
} while (0)
#define FX_grDepthBiasLevel(fxMesa, lev) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grDepthBiasLevel(lev); \
- END_BOARD_LOCK(fxMesa); \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ grDepthBiasLevel(lev); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
#define FX_grDepthBufferFunction(fxMesa, func) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grDepthBufferFunction(func); \
- END_BOARD_LOCK(fxMesa); \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ grDepthBufferFunction(func); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
#define FX_grFogColorValue(fxMesa, c) \
@@ -839,10 +666,10 @@ extern FxBool FX_grLfbLock(fxMesaContext fxMesa,
} while (0)
#define FX_grTexClampMode(fxMesa, t, sc, tc) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grTexClampMode(t, sc, tc); \
- END_BOARD_LOCK(fxMesa); \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ grTexClampMode(t, sc, tc); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
#define FX_grTexClampMode_NoLock grTexClampMode
@@ -873,10 +700,10 @@ extern FxBool FX_grLfbLock(fxMesaContext fxMesa,
} while (0)
#define FX_grTexFilterMode(fxMesa, t, minf, magf) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grTexFilterMode(t, minf, magf); \
- END_BOARD_LOCK(fxMesa); \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ grTexFilterMode(t, minf, magf); \
+ END_BOARD_LOCK(fxMesa); \
} while (0)
#define FX_grTexFilterMode_NoLock grTexFilterMode
@@ -940,23 +767,23 @@ extern FxU32 FX_grTexTextureMemRequired(fxMesaContext fxMesa,
#define FX_grGlideSetState_NoLock(s) grGlideSetState(s);
#define FX_grDepthBufferMode(fxMesa, m) \
- do { \
- BEGIN_BOARD_LOCK(fxMesa); \
- grDepthBufferMode(m); \
- END_BOARD_LOCK(fxMesa); \
- } while (0)
-
-#define FX_grLfbWriteColorFormat(fxMesa, f) \
do { \
BEGIN_BOARD_LOCK(fxMesa); \
- grLfbWriteColorFormat(f); \
+ grDepthBufferMode(m); \
END_BOARD_LOCK(fxMesa); \
} while (0)
+#define FX_grLfbWriteColorFormat(fxMesa, f) \
+ do { \
+ BEGIN_BOARD_LOCK(fxMesa); \
+ grLfbWriteColorFormat(f); \
+ END_BOARD_LOCK(fxMesa); \
+ } while (0)
+
#define FX_grDrawVertexArray(fxMesa, m, c, p) \
- do { \
+ do { \
BEGIN_CLIP_LOOP(fxMesa); \
- grDrawVertexArray(m, c, p); \
+ grDrawVertexArray(m, c, p); \
END_CLIP_LOOP(fxMesa); \
} while (0)
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c b/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c
index f614e8fae..634bb50ed 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c,v 1.1 2000/09/24 13:51:17 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsanity.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -85,6 +85,23 @@ fx_sanity_triangle(fxMesaContext fxMesa,
}
if (print) {
+#if FX_USE_PARGB
+ fprintf(stderr,
+ "v1: %f %f %f %f col %d %d %d %d t0 %f %f %f t1 %f %f %f\n",
+ v3->x, v3->y, v3->ooz, v3->oow, GET_PR(v1), GET_PG(v1), GET_PB(v1), GET_PA(v1),
+ v1->tmuvtx[0].sow, v1->tmuvtx[0].tow, v1->tmuvtx[0].oow,
+ v1->tmuvtx[1].sow, v1->tmuvtx[1].tow, v1->tmuvtx[1].oow);
+ fprintf(stderr,
+ "v2: %f %f %f %f col %d %d %d %d t0 %f %f %f t1 %f %f %f\n",
+ v3->x, v3->y, v3->ooz, v3->oow, GET_PR(v1), GET_PG(v1), GET_PB(v1), GET_PA(v1),
+ v2->tmuvtx[0].sow, v2->tmuvtx[0].tow, v2->tmuvtx[0].oow,
+ v2->tmuvtx[1].sow, v2->tmuvtx[1].tow, v2->tmuvtx[1].oow);
+ fprintf(stderr,
+ "v3: %f %f %f %f col %d %d %d %d t0 %f %f %f t1 %f %f %f\n",
+ v3->x, v3->y, v3->ooz, v3->oow, GET_PR(v1), GET_PG(v1), GET_PB(v1), GET_PA(v1),
+ v3->tmuvtx[0].sow, v3->tmuvtx[0].tow, v3->tmuvtx[0].oow,
+ v3->tmuvtx[1].sow, v3->tmuvtx[1].tow, v3->tmuvtx[1].oow);
+#else
fprintf(stderr,
"v1: %f %f %f %f col %.0f %.0f %.0f %.0f t0 %f %f %f t1 %f %f %f\n",
v1->x, v1->y, v1->ooz, v1->oow, v1->r, v1->g, v1->b, v1->a,
@@ -100,6 +117,7 @@ fx_sanity_triangle(fxMesaContext fxMesa,
v3->x, v3->y, v3->ooz, v3->oow, v3->r, v3->g, v3->b, v3->a,
v3->tmuvtx[0].sow, v3->tmuvtx[0].tow, v3->tmuvtx[0].oow,
v3->tmuvtx[1].sow, v3->tmuvtx[1].tow, v3->tmuvtx[1].oow);
+#endif
}
if (1)
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c b/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c
index a84a6ee15..640a429e3 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c,v 1.1 2000/09/24 13:51:19 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsetup.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -55,7 +55,7 @@ static GLboolean fxMultipassTexture(struct vertex_buffer *, GLuint);
-static void
+void
fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
@@ -300,11 +300,15 @@ fxGetTexSetConfiguration(GLcontext * ctx,
static void
fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- int tmu;
+ const GLcontext *ctx = fxMesa->glCtx;
/* Make sure we're not loaded incorrectly */
- if (ti->isInTM) {
+ if (ti->isInTM && !shared->umaTexMemory) {
+ /* if doing filtering between mipmap levels, alternate mipmap levels
+ * must be in alternate TMUs.
+ */
if (ti->LODblend) {
if (ti->whichTMU != FX_TMU_SPLIT)
fxTMMoveOutTM(fxMesa, tObj);
@@ -317,27 +321,35 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
/* Make sure we're loaded correctly */
if (!ti->isInTM) {
- if (ti->LODblend)
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT);
+ /* Have to download the texture */
+ if (shared->umaTexMemory) {
+ fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
+ }
else {
- if (fxMesa->haveTwoTMUs) {
- if (fxMesa->freeTexMem[FX_TMU0] >
- FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info))) {
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
- }
- else {
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU1);
- }
- }
- else
- fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
+ /* Voodoo3 (split texture memory) */
+ if (ti->LODblend) {
+ fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU_SPLIT);
+ }
+ else {
+ if (fxMesa->haveTwoTMUs) {
+ GLint memReq = FX_grTexTextureMemRequired_NoLock(
+ GR_MIPMAPLEVELMASK_BOTH, &(ti->info));
+ if (shared->freeTexMem[FX_TMU0] > memReq) {
+ fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
+ }
+ else {
+ fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU1);
+ }
+ }
+ else
+ fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
+ }
}
}
if (ti->LODblend && ti->whichTMU == FX_TMU_SPLIT) {
- if ((ti->info.format == GR_TEXFMT_P_8)
- && (!fxMesa->haveGlobalPaletteTexture)) {
+ /* mipmap levels split between texture banks */
+ if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) {
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: uploading texture palette\n");
}
@@ -360,13 +372,19 @@ fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
GR_MIPMAPLEVELMASK_EVEN, &(ti->info));
}
else {
+ FxU32 tmu;
+
if (ti->whichTMU == FX_TMU_BOTH)
tmu = FX_TMU0;
else
tmu = ti->whichTMU;
- if ((ti->info.format == GR_TEXFMT_P_8)
- && (!fxMesa->haveGlobalPaletteTexture)) {
+ if (shared->umaTexMemory) {
+ assert(ti->whichTMU == FX_TMU0);
+ assert(tmu == FX_TMU0);
+ }
+
+ if (ti->info.format == GR_TEXFMT_P_8 && !ctx->Texture.SharedPalette) {
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: uploading texture palette\n");
}
@@ -409,12 +427,22 @@ fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
GR_COMBINE_FACTOR_ONE_MINUS_LOD_FRACTION,
FXFALSE, FXFALSE);
- if (fxMesa->haveTwoTMUs)
- FX_grTexCombine_NoLock(GR_TMU1,
+ if (fxMesa->haveTwoTMUs) {
+ const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ const struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
+ int tmu;
+
+ if (shared->umaTexMemory)
+ tmu = GR_TMU0;
+ else
+ tmu = GR_TMU1;
+
+ FX_grTexCombine_NoLock(tmu,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
+ }
fxMesa->tmuSrc = FX_TMU_SPLIT;
}
else {
@@ -454,60 +482,21 @@ fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
}
}
+
+/*
+ * Setup the texture env mode for a texture unit on Banshee/Voodoo3
+ */
static void
-fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
+SetupTexEnvVoodoo3(GLcontext *ctx, FxU32 unit, GLboolean iteratedRGBA,
+ GLenum envMode, GLenum baseFormat)
{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
GrCombineLocal_t localc, locala;
- GLuint unitsmode;
- GLint ifmt;
- tfxTexInfo *ti;
- struct gl_texture_object *tObj =
- ctx->Texture.Unit[textureset].CurrentD[2];
- int tmu;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) Start\n");
- }
-
- ti = fxTMGetTexInfo(tObj);
-
- fxTexValidate(ctx, tObj);
-
- fxSetupSingleTMU_NoLock(fxMesa, tObj);
-
- if (ti->whichTMU == FX_TMU_BOTH)
- tmu = FX_TMU0;
- else
- tmu = ti->whichTMU;
- if (fxMesa->tmuSrc != tmu)
- fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend);
-
- if (textureset == 0 || !fxMesa->haveTwoTMUs)
- unitsmode = fxGetTexSetConfiguration(ctx, tObj, NULL);
+ if (iteratedRGBA)
+ localc = locala = GR_COMBINE_LOCAL_ITERATED;
else
- unitsmode = fxGetTexSetConfiguration(ctx, NULL, tObj);
-
- fxMesa->stw_hint_state = 0;
- FX_grHints_NoLock(GR_HINT_STWHINT, 0);
-
- ifmt = ti->baseLevelInternalFormat;
-
- if (unitsmode & FX_UM_ALPHA_ITERATED)
- locala = GR_COMBINE_LOCAL_ITERATED;
- else
- locala = GR_COMBINE_LOCAL_CONSTANT;
-
- if (unitsmode & FX_UM_COLOR_ITERATED)
- localc = GR_COMBINE_LOCAL_ITERATED;
- else
- localc = GR_COMBINE_LOCAL_CONSTANT;
+ localc = locala = GR_COMBINE_LOCAL_CONSTANT;
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE))
- fprintf(stderr, "fxMesa: fxSetupTextureSingleTMU, envmode is %s\n",
- gl_lookup_enum_by_nr(ctx->Texture.Unit[textureset].EnvMode));
-
- switch (ctx->Texture.Unit[textureset].EnvMode) {
+ switch (envMode) {
case GL_DECAL:
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
@@ -522,7 +511,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
GR_COMBINE_FACTOR_LOCAL,
locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
- if (ifmt == GL_ALPHA)
+ if (baseFormat == GL_ALPHA)
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
localc, GR_COMBINE_OTHER_NONE, FXFALSE);
@@ -537,7 +526,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
- if (ifmt == GL_ALPHA)
+ if (baseFormat == GL_ALPHA)
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
localc, GR_COMBINE_OTHER_NONE, FXFALSE);
@@ -553,7 +542,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
#endif
break;
case GL_REPLACE:
- if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE))
+ if ((baseFormat == GL_RGB) || (baseFormat == GL_LUMINANCE))
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
locala, GR_COMBINE_OTHER_NONE, FXFALSE);
@@ -563,7 +552,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
locala, GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
- if (ifmt == GL_ALPHA)
+ if (baseFormat == GL_ALPHA)
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
localc, GR_COMBINE_OTHER_NONE, FXFALSE);
@@ -574,29 +563,29 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
FXFALSE);
break;
case GL_ADD:
- if (ifmt == GL_ALPHA ||
- ifmt == GL_LUMINANCE_ALPHA ||
- ifmt == GL_RGBA) {
+ if (baseFormat == GL_ALPHA ||
+ baseFormat == GL_LUMINANCE_ALPHA ||
+ baseFormat == GL_RGBA) {
/* product of texel and fragment alpha */
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_LOCAL,
locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
}
- else if (ifmt == GL_LUMINANCE || ifmt == GL_RGB) {
+ else if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
/* fragment alpha is unchanged */
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
locala, GR_COMBINE_OTHER_NONE, FXFALSE);
}
else {
- ASSERT(ifmt == GL_INTENSITY);
+ ASSERT(baseFormat == GL_INTENSITY);
/* sum of texel and fragment alpha */
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
GR_COMBINE_FACTOR_ONE,
locala, GR_COMBINE_OTHER_TEXTURE,
FXFALSE);
}
- if (ifmt == GL_ALPHA) {
+ if (baseFormat == GL_ALPHA) {
/* rgb unchanged */
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
@@ -611,11 +600,797 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
}
break;
default:
- if (MESA_VERBOSE & VERBOSE_DRIVER)
- fprintf(stderr,
- "fx Driver: %x Texture.EnvMode not yet supported\n",
- ctx->Texture.Unit[textureset].EnvMode);
+ gl_problem(ctx, "Bad baseFormat in SetupTexEnvVoodoo3");
+ }
+}
+
+
+/*
+ * These macros are used below when handling COMBINE_EXT.
+ */
+#define TEXENV_OPERAND_INVERTED(operand) \
+ (((operand) == GL_ONE_MINUS_SRC_ALPHA) \
+ || ((operand) == GL_ONE_MINUS_SRC_COLOR))
+#define TEXENV_OPERAND_ALPHA(operand) \
+ (((operand) == GL_SRC_ALPHA) || ((operand) == GL_ONE_MINUS_SRC_ALPHA))
+#define TEXENV_SETUP_ARG_A(param, source, operand, iteratedAlpha) \
+ switch (source) { \
+ case GL_TEXTURE: \
+ param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \
+ break; \
+ case GL_CONSTANT_EXT: \
+ param = GR_CMBX_TMU_CALPHA; \
+ break; \
+ case GL_PRIMARY_COLOR_EXT: \
+ param = GR_CMBX_ITALPHA; \
+ break; \
+ case GL_PREVIOUS_EXT: \
+ param = iteratedAlpha; \
+ break; \
+ default: \
+ /* \
+ * This is here just to keep from getting \
+ * compiler warnings. \
+ */ \
+ param = GR_CMBX_ZERO; \
+ break; \
+ }
+
+#define TEXENV_SETUP_ARG_RGB(param, source, operand, iteratedColor, iteratedAlpha) \
+ if (!TEXENV_OPERAND_ALPHA(operand)) { \
+ switch (source) { \
+ case GL_TEXTURE: \
+ param = GR_CMBX_LOCAL_TEXTURE_RGB; \
+ break; \
+ case GL_CONSTANT_EXT: \
+ param = GR_CMBX_TMU_CCOLOR; \
+ break; \
+ case GL_PRIMARY_COLOR_EXT: \
+ param = GR_CMBX_ITRGB; \
+ break; \
+ case GL_PREVIOUS_EXT: \
+ param = iteratedColor; \
+ break; \
+ default: \
+ /* \
+ * This is here just to keep from getting \
+ * compiler warnings. \
+ */ \
+ param = GR_CMBX_ZERO; \
+ break; \
+ } \
+ } else { \
+ switch (source) { \
+ case GL_TEXTURE: \
+ param = GR_CMBX_LOCAL_TEXTURE_ALPHA; \
+ break; \
+ case GL_CONSTANT_EXT: \
+ param = GR_CMBX_TMU_CALPHA; \
+ break; \
+ case GL_PRIMARY_COLOR_EXT: \
+ param = GR_CMBX_ITALPHA; \
+ break; \
+ case GL_PREVIOUS_EXT: \
+ param = iteratedAlpha; \
+ break; \
+ default: \
+ /* \
+ * This is here just to keep from getting \
+ * compiler warnings. \
+ */ \
+ param = GR_CMBX_ZERO; \
+ break; \
+ } \
+ }
+
+#define TEXENV_SETUP_MODE_RGB(param, operand) \
+ switch (operand) { \
+ case GL_SRC_COLOR: \
+ case GL_SRC_ALPHA: \
+ param = GR_FUNC_MODE_X; \
+ break; \
+ case GL_ONE_MINUS_SRC_ALPHA: \
+ case GL_ONE_MINUS_SRC_COLOR: \
+ param = GR_FUNC_MODE_ONE_MINUS_X; \
+ break; \
+ default: \
+ param = GR_FUNC_MODE_ZERO; \
+ break; \
+ }
+
+#define TEXENV_SETUP_MODE_A(param, operand) \
+ switch (operand) { \
+ case GL_SRC_ALPHA: \
+ param = GR_FUNC_MODE_X; \
+ break; \
+ case GL_ONE_MINUS_SRC_ALPHA: \
+ param = GR_FUNC_MODE_ONE_MINUS_X; \
+ break; \
+ default: \
+ param = GR_FUNC_MODE_ZERO; \
+ break; \
+ }
+
+/*
+ * Setup the texture env mode for a texture unit on Napalm.
+ * If useIteratedRGBA is true, we'll feed the interpolated fragment
+ * color into the combiner, else we'll feed in the upstream texture
+ * unit's resultant color.
+ */
+static void
+SetupTexEnvNapalm(GLcontext *ctx, FxU32 unit, GLboolean useIteratedRGBA,
+ struct gl_texture_unit *texUnit, GLenum baseFormat)
+{
+ GrTCCUColor_t incomingRGB, incomingAlpha;
+ GLenum envMode = texUnit->EnvMode;
+
+ if (useIteratedRGBA) {
+ incomingRGB = GR_CMBX_ITRGB;
+ incomingAlpha = GR_CMBX_ITALPHA;
+ }
+ else {
+ incomingRGB = GR_CMBX_OTHER_TEXTURE_RGB;
+ incomingAlpha = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ }
+
+ switch (envMode) {
+ case GL_REPLACE:
+ /* Setup RGB combiner */
+ if (baseFormat == GL_ALPHA) {
+ /* Rv = Rf */
+ (*grTexColorCombineExtPtr)(unit,
+ incomingRGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Rv = Rt */
+ (*grTexColorCombineExtPtr)(unit,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ /* Setup Alpha combiner */
+ if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
+ /* Av = Af */
+ (*grTexAlphaCombineExtPtr)(unit,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXFALSE,
+ incomingAlpha, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Av = At */
+ (*grTexAlphaCombineExtPtr)(unit,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXFALSE,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, FXFALSE,
+ 0, FXFALSE);
+ }
break;
+ case GL_MODULATE:
+ /* Setup RGB combiner */
+ if (baseFormat == GL_ALPHA) {
+ /* Rv = Rf */
+ (*grTexColorCombineExtPtr)(unit,
+ incomingRGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Result = Frag * Tex */
+ (*grTexColorCombineExtPtr)(unit,
+ incomingRGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, FXFALSE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ /* Setup Alpha combiner */
+ if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
+ /* Av = Af */
+ (*grTexAlphaCombineExtPtr)(unit,
+ incomingAlpha, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Av = Af * At */
+ (*grTexAlphaCombineExtPtr)(unit,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ incomingAlpha, FXFALSE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ break;
+ case GL_DECAL:
+ /* Setup RGB combiner */
+ if (baseFormat == GL_RGB) {
+ /* Rv = Rt */
+ (*grTexColorCombineExtPtr)(unit,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Rv = Rf * (1 - At) + Rt * At */
+ (*grTexColorCombineExtPtr)(unit,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ incomingRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, FXFALSE,
+ GR_CMBX_B, FXFALSE,
+ 0, FXFALSE);
+ }
+ /* Setup Alpha combiner */
+ /* Av = Af */
+ (*grTexAlphaCombineExtPtr)(unit,
+ incomingAlpha, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ break;
+ case GL_BLEND:
+ /* Setup RGB combiner */
+ if (baseFormat == GL_ALPHA) {
+ /* Rv = Rf */
+ (*grTexColorCombineExtPtr)(unit,
+ incomingRGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Rv = Rf * (1 - Rt) + Rc * Rt */
+ (*grTexColorCombineExtPtr)(unit,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ incomingRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, FXFALSE,
+ GR_CMBX_B, FXFALSE,
+ 0, FXFALSE);
+ }
+ /* Setup Alpha combiner */
+ if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
+ /* Av = Af */
+ (*grTexAlphaCombineExtPtr)(unit,
+ incomingAlpha, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else if (baseFormat == GL_INTENSITY) {
+ /* Av = Af * (1 - It) + Ac * It */
+ (*grTexAlphaCombineExtPtr)(unit,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_X,
+ incomingAlpha, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, FXFALSE,
+ GR_CMBX_B, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Av = Af * At */
+ (*grTexAlphaCombineExtPtr)(unit,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ incomingAlpha, FXFALSE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ /* Also have to set up the tex env constant color */
+ {
+ GrColor_t constColor;
+ GLubyte *abgr = (GLubyte *) &constColor;
+ abgr[0] = ctx->Texture.Unit[0].EnvColor[0] * 255.0F;
+ abgr[1] = ctx->Texture.Unit[0].EnvColor[1] * 255.0F;
+ abgr[2] = ctx->Texture.Unit[0].EnvColor[2] * 255.0F;
+ abgr[3] = ctx->Texture.Unit[0].EnvColor[3] * 255.0F;
+ (*grConstantColorValueExtPtr)(unit, constColor);
+ }
+ break;
+ case GL_ADD:
+ /* Setup RGB combiner */
+ if (baseFormat == GL_ALPHA) {
+ /* Rv = Rf */
+ (*grTexColorCombineExtPtr)(unit,
+ incomingRGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Rv = Rf + Tt */
+ (*grTexColorCombineExtPtr)(unit,
+ incomingRGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ /* Setup Alpha combiner */
+ if (baseFormat == GL_LUMINANCE || baseFormat == GL_RGB) {
+ /* Av = Af */
+ (*grTexAlphaCombineExtPtr)(unit,
+ incomingAlpha, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else if (baseFormat == GL_INTENSITY) {
+ /* Av = Af + It */
+ (*grTexAlphaCombineExtPtr)(unit,
+ incomingAlpha, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ else {
+ /* Av = Af * At */
+ (*grTexAlphaCombineExtPtr)(unit,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ incomingAlpha, FXFALSE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ }
+ break;
+ case GL_COMBINE_EXT:
+ {
+ FxU32 A_RGB, B_RGB, C_RGB, D_RGB;
+ FxU32 Amode_RGB, Bmode_RGB;
+ FxBool Cinv_RGB, Dinv_RGB, Ginv_RGB;
+ FxU32 Shift_RGB;
+ FxU32 A_A, B_A, C_A, D_A;
+ FxU32 Amode_A, Bmode_A;
+ FxBool Cinv_A, Dinv_A, Ginv_A;
+ FxU32 Shift_A;
+ /*
+ *
+ * In the formulas below, we write:
+ * o "1(x)" for the identity function applied to x,
+ * so 1(x) = x.
+ * o "0(x)" for the constant function 0, so
+ * 0(x) = 0 for all values of x.
+ *
+ * Calculate the color combination.
+ */
+ Shift_RGB = texUnit->CombineScaleShiftRGB;
+ Shift_A = texUnit->CombineScaleShiftA;
+ switch (texUnit->CombineModeRGB) {
+ case GL_REPLACE:
+ /*
+ * The formula is: Arg0
+ * We implement this by the formula:
+ * (Arg0 + 0(0))*(1-0) + 0
+ */
+ TEXENV_SETUP_ARG_RGB(A_RGB,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ incomingRGB, incomingAlpha);
+ TEXENV_SETUP_MODE_RGB(Amode_RGB,
+ texUnit->CombineOperandRGB[0]);
+ B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
+ Bmode_RGB = GR_FUNC_MODE_ZERO;
+ Cinv_RGB = FXTRUE;
+ Dinv_RGB = Ginv_RGB = FXFALSE;
+ break;
+ case GL_MODULATE:
+ /*
+ * The formula is: Arg0 * Arg1
+ *
+ * We implement this by the formula
+ * (Arg0 + 0(0)) * Arg1 + 0(0)
+ */
+ TEXENV_SETUP_ARG_RGB(A_RGB,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ incomingRGB, incomingAlpha);
+ TEXENV_SETUP_MODE_RGB(Amode_RGB,
+ texUnit->CombineOperandRGB[0]);
+ B_RGB = GR_CMBX_ZERO;
+ Bmode_RGB = GR_CMBX_ZERO;
+ TEXENV_SETUP_ARG_RGB(C_RGB,
+ texUnit->CombineSourceRGB[1],
+ texUnit->CombineOperandRGB[1],
+ incomingRGB, incomingAlpha);
+ Cinv_RGB = TEXENV_OPERAND_INVERTED
+ (texUnit->CombineOperandRGB[1]);
+ D_RGB = GR_CMBX_ZERO;
+ Dinv_RGB = Ginv_RGB = FXFALSE;
+ break;
+ case GL_ADD:
+ /*
+ * The formula is Arg0 + Arg1
+ */
+ TEXENV_SETUP_ARG_RGB(A_RGB,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ incomingRGB, incomingAlpha);
+ TEXENV_SETUP_MODE_RGB(Amode_RGB,
+ texUnit->CombineOperandRGB[0]);
+ TEXENV_SETUP_ARG_RGB(B_RGB,
+ texUnit->CombineSourceRGB[1],
+ texUnit->CombineOperandRGB[1],
+ incomingRGB, incomingAlpha);
+ TEXENV_SETUP_MODE_RGB(Bmode_RGB,
+ texUnit->CombineOperandRGB[1]);
+ C_RGB = D_RGB = GR_CMBX_ZERO;
+ Cinv_RGB = FXTRUE;
+ Dinv_RGB = Ginv_RGB = FXFALSE;
+ break;
+ case GL_ADD_SIGNED_EXT:
+ /*
+ * The formula is: Arg0 + Arg1 - 0.5.
+ * We compute this by calculating:
+ * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA}
+ * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA}
+ * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
+ * we cannot implement the formula properly.
+ */
+ TEXENV_SETUP_ARG_RGB(A_RGB,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ incomingRGB, incomingAlpha);
+ TEXENV_SETUP_ARG_RGB(B_RGB,
+ texUnit->CombineSourceRGB[1],
+ texUnit->CombineOperandRGB[1],
+ incomingRGB, incomingAlpha);
+ if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[0])) {
+ /*
+ * A is not inverted. So, choose it.
+ */
+ Amode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
+ if (!TEXENV_OPERAND_INVERTED
+ (texUnit->CombineOperandRGB[1])) {
+ Bmode_RGB = GR_FUNC_MODE_X;
+ } else {
+ Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
+ }
+ } else {
+ /*
+ * A is inverted, so try to subtract 1/2
+ * from B.
+ */
+ Amode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
+ if (!TEXENV_OPERAND_INVERTED
+ (texUnit->CombineOperandRGB[1])) {
+ Bmode_RGB = GR_FUNC_MODE_X_MINUS_HALF;
+ } else {
+ /*
+ * Both are inverted. This is the case
+ * we cannot handle properly. We just
+ * choose to not add the - 1/2.
+ */
+ Bmode_RGB = GR_FUNC_MODE_ONE_MINUS_X;
+ }
+ }
+ C_RGB = D_RGB = GR_CMBX_ZERO;
+ Cinv_RGB = FXTRUE;
+ Dinv_RGB = Ginv_RGB = FXFALSE;
+ break;
+ case GL_INTERPOLATE_EXT:
+ /*
+ * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
+ * We compute this by the formula:
+ * (Arg0 - Arg1) * Arg2 + Arg1
+ * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
+ * == Arg0 * Arg2 + Arg1 * (1 - Arg2)
+ * However, if both Arg1 is ONE_MINUS_X, the HW does
+ * not support it properly.
+ */
+ TEXENV_SETUP_ARG_RGB(A_RGB,
+ texUnit->CombineSourceRGB[0],
+ texUnit->CombineOperandRGB[0],
+ incomingRGB, incomingAlpha);
+ TEXENV_SETUP_MODE_RGB(Amode_RGB,
+ texUnit->CombineOperandRGB[0]);
+ TEXENV_SETUP_ARG_RGB(B_RGB,
+ texUnit->CombineSourceRGB[1],
+ texUnit->CombineOperandRGB[1],
+ incomingRGB, incomingAlpha);
+ if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandRGB[1])) {
+ Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
+ } else {
+ /*
+ * This case is wrong.
+ */
+ Bmode_RGB = GR_FUNC_MODE_NEGATIVE_X;
+ }
+ /*
+ * The Source/Operand for the C value must
+ * specify some kind of alpha value.
+ */
+ TEXENV_SETUP_ARG_A(C_RGB,
+ texUnit->CombineSourceRGB[2],
+ texUnit->CombineOperandRGB[2],
+ incomingAlpha);
+ Cinv_RGB = FXFALSE;
+ D_RGB = GR_CMBX_B;
+ Dinv_RGB = Ginv_RGB = FXFALSE;
+ break;
+ default:
+ /*
+ * This is here mostly to keep from getting
+ * a compiler warning about these not being set.
+ * However, this should set all the texture values
+ * to zero.
+ */
+ A_RGB = B_RGB = C_RGB = D_RGB = GR_CMBX_ZERO;
+ Amode_RGB = Bmode_RGB = GR_FUNC_MODE_X;
+ Cinv_RGB = Dinv_RGB = Ginv_RGB = FXFALSE;
+ break;
+ }
+ /*
+ * Calculate the alpha combination.
+ */
+ switch (texUnit->CombineModeA) {
+ case GL_REPLACE:
+ /*
+ * The formula is: Arg0
+ * We implement this by the formula:
+ * (Arg0 + 0(0))*(1-0) + 0
+ */
+ TEXENV_SETUP_ARG_A(A_A,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ incomingAlpha);
+ TEXENV_SETUP_MODE_A(Amode_A,
+ texUnit->CombineOperandA[0]);
+ B_A = C_A = D_A = GR_CMBX_ZERO;
+ Bmode_A = GR_FUNC_MODE_ZERO;
+ Cinv_A = FXTRUE;
+ Dinv_A = Ginv_A = FXFALSE;
+ break;
+ case GL_MODULATE:
+ /*
+ * The formula is: Arg0 * Arg1
+ *
+ * We implement this by the formula
+ * (Arg0 + 0(0)) * Arg1 + 0(0)
+ */
+ TEXENV_SETUP_ARG_A(A_A,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ incomingAlpha);
+ TEXENV_SETUP_MODE_A(Amode_A,
+ texUnit->CombineOperandA[0]);
+ B_A = GR_CMBX_ZERO;
+ Bmode_A = GR_CMBX_ZERO;
+ TEXENV_SETUP_ARG_A(C_A,
+ texUnit->CombineSourceA[1],
+ texUnit->CombineOperandA[1],
+ incomingAlpha);
+ Cinv_A = TEXENV_OPERAND_INVERTED
+ (texUnit->CombineOperandA[1]);
+ D_A = GR_CMBX_ZERO;
+ Dinv_A = Ginv_A = FXFALSE;
+ break;
+ case GL_ADD:
+ /*
+ * The formula is Arg0 + Arg1
+ */
+ TEXENV_SETUP_ARG_A(A_A,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ incomingAlpha);
+ TEXENV_SETUP_MODE_A(Amode_A,
+ texUnit->CombineOperandA[0]);
+ TEXENV_SETUP_ARG_A(B_A,
+ texUnit->CombineSourceA[1],
+ texUnit->CombineOperandA[1],
+ incomingAlpha);
+ TEXENV_SETUP_MODE_A(Bmode_A,
+ texUnit->CombineOperandA[0]);
+ C_A = D_A = GR_CMBX_ZERO;
+ Cinv_A = FXTRUE;
+ Dinv_A = Ginv_A = FXFALSE;
+ break;
+ case GL_ADD_SIGNED_EXT:
+ /*
+ * The formula is: Arg0 + Arg1 - 0.5.
+ * We compute this by calculating:
+ * (Arg0 - 1/2) + Arg1 if op0 is SRC_{COLOR,ALPHA}
+ * Arg0 + (Arg1 - 1/2) if op1 is SRC_{COLOR,ALPHA}
+ * If both op0 and op1 are ONE_MINUS_SRC_{COLOR,ALPHA}
+ * we cannot implement the formula properly.
+ */
+ TEXENV_SETUP_ARG_A(A_A,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ incomingAlpha);
+ TEXENV_SETUP_ARG_A(B_A,
+ texUnit->CombineSourceA[1],
+ texUnit->CombineOperandA[1],
+ incomingAlpha);
+ if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[0])) {
+ /*
+ * A is not inverted. So, choose it.
+ */
+ Amode_A = GR_FUNC_MODE_X_MINUS_HALF;
+ if (!TEXENV_OPERAND_INVERTED
+ (texUnit->CombineOperandA[1])) {
+ Bmode_A = GR_FUNC_MODE_X;
+ } else {
+ Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
+ }
+ } else {
+ /*
+ * A is inverted, so try to subtract 1/2
+ * from B.
+ */
+ Amode_A = GR_FUNC_MODE_ONE_MINUS_X;
+ if (!TEXENV_OPERAND_INVERTED
+ (texUnit->CombineOperandA[1])) {
+ Bmode_A = GR_FUNC_MODE_X_MINUS_HALF;
+ } else {
+ /*
+ * Both are inverted. This is the case
+ * we cannot handle properly. We just
+ * choose to not add the - 1/2.
+ */
+ Bmode_A = GR_FUNC_MODE_ONE_MINUS_X;
+ }
+ }
+ C_A = D_A = GR_CMBX_ZERO;
+ Cinv_A = FXTRUE;
+ Dinv_A = Ginv_A = FXFALSE;
+ break;
+ case GL_INTERPOLATE_EXT:
+ /*
+ * The formula is: Arg0 * Arg2 + Arg1 * (1 - Arg2).
+ * We compute this by the formula:
+ * (Arg0 - Arg1) * Arg2 + Arg1
+ * == Arg0 * Arg2 - Arg1 * Arg2 + Arg1
+ * == Arg0 * Arg2 + Arg1 * (1 - Arg2)
+ * However, if both Arg1 is ONE_MINUS_X, the HW does
+ * not support it properly.
+ */
+ TEXENV_SETUP_ARG_A(A_A,
+ texUnit->CombineSourceA[0],
+ texUnit->CombineOperandA[0],
+ incomingAlpha);
+ TEXENV_SETUP_MODE_A(Amode_A,
+ texUnit->CombineOperandA[0]);
+ TEXENV_SETUP_ARG_A(B_A,
+ texUnit->CombineSourceA[1],
+ texUnit->CombineOperandA[1],
+ incomingAlpha);
+ if (!TEXENV_OPERAND_INVERTED(texUnit->CombineOperandA[1])) {
+ Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
+ } else {
+ /*
+ * This case is wrong.
+ */
+ Bmode_A = GR_FUNC_MODE_NEGATIVE_X;
+ }
+ /*
+ * The Source/Operand for the C value must
+ * specify some kind of alpha value.
+ */
+ TEXENV_SETUP_ARG_A(C_A,
+ texUnit->CombineSourceA[2],
+ texUnit->CombineOperandA[2],
+ incomingAlpha);
+ Cinv_A = FXFALSE;
+ D_A = GR_CMBX_ZERO;
+ Dinv_A = Ginv_A = FXFALSE;
+ break;
+ default:
+ /*
+ * This is here mostly to keep from getting
+ * a compiler warning about these not being set.
+ * However, this should set all the alpha values
+ * to one.
+ */
+ A_A = B_A = C_A = D_A = GR_CMBX_ZERO;
+ Amode_A = Bmode_A = GR_FUNC_MODE_X;
+ Cinv_A = Dinv_A = FXFALSE;
+ Ginv_A = FXTRUE;
+ break;
+ }
+ /*
+ * Call the functions.
+ */
+ (*grTexColorCombineExtPtr)(unit,
+ A_RGB, Amode_RGB,
+ B_RGB, Bmode_RGB,
+ C_RGB, Cinv_RGB,
+ D_RGB, Dinv_RGB,
+ Shift_RGB, Ginv_RGB);
+ (*grTexAlphaCombineExtPtr)(unit,
+ A_A, Amode_A,
+ B_A, Bmode_A,
+ C_A, Cinv_A,
+ D_A, Dinv_A,
+ Shift_A, Ginv_A);
+ }
+ break;
+ default:
+ gl_problem(ctx, "Bad baseFormat in SetupTexEnvNapalm");
+ }
+
+ /* setup Color and Alpha combine always the same */
+ (*grColorCombineExtPtr)(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+ (*grAlphaCombineExtPtr)(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, FXTRUE,
+ GR_CMBX_ZERO, FXFALSE,
+ 0, FXFALSE);
+}
+
+
+static void
+fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
+{
+ fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ GLuint unitsmode;
+ GLint ifmt;
+ tfxTexInfo *ti;
+ struct gl_texture_object *tObj =
+ ctx->Texture.Unit[textureset].CurrentD[2];
+ int tmu;
+
+ if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxmesa: fxSetupTextureSingleTMU(...) Start\n");
+ }
+
+ ti = fxTMGetTexInfo(tObj);
+ fxTexValidate(ctx, tObj);
+
+ fxSetupSingleTMU_NoLock(fxMesa, tObj);
+
+ if (ti->whichTMU == FX_TMU_BOTH)
+ tmu = FX_TMU0;
+ else
+ tmu = ti->whichTMU;
+
+ if (fxMesa->tmuSrc != tmu)
+ fxSelectSingleTMUSrc_NoLock(fxMesa, tmu, ti->LODblend);
+
+ fxMesa->stw_hint_state = 0;
+ FX_grHints_NoLock(GR_HINT_STWHINT, 0);
+
+ ifmt = ti->baseLevelInternalFormat;
+
+ if (/*0*/fxMesa->isNapalm) {
+ SetupTexEnvNapalm(ctx, tmu, GL_TRUE,
+ &(ctx->Texture.Unit[textureset]),
+ ti->baseLevelInternalFormat);
+ }
+ else {
+ GLboolean iteratedRGBA = GL_FALSE;
+ if (textureset == 0 || !fxMesa->haveTwoTMUs)
+ unitsmode = fxGetTexSetConfiguration(ctx, tObj, NULL);
+ else
+ unitsmode = fxGetTexSetConfiguration(ctx, NULL, tObj);
+ if ((unitsmode & FX_UM_ALPHA_ITERATED) ||
+ (unitsmode & FX_UM_COLOR_ITERATED)) {
+ iteratedRGBA = GL_TRUE;
+ }
+ SetupTexEnvVoodoo3(ctx, tmu, iteratedRGBA,
+ ctx->Texture.Unit[textureset].EnvMode,
+ ti->baseLevelInternalFormat);
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
@@ -623,6 +1398,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
}
}
+
static void
fxSetupTextureSingleTMU(GLcontext * ctx, GLuint textureset)
{
@@ -646,6 +1422,9 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
#define T0_IN_TMU1 0x10
#define T1_IN_TMU1 0x20
+ const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ const struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
+ const GLcontext *ctx = fxMesa->glCtx;
tfxTexInfo *ti0 = fxTMGetTexInfo(tObj0);
tfxTexInfo *ti1 = fxTMGetTexInfo(tObj1);
GLuint tstate = 0;
@@ -708,14 +1487,21 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
if (!(((tstate & T0_IN_TMU0) && (tstate & T1_IN_TMU1)) ||
((tstate & T0_IN_TMU1) && (tstate & T1_IN_TMU0)))) {
- if (tObj0 == tObj1)
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU_BOTH);
+ if (tObj0 == tObj1) {
+ if (shared->umaTexMemory)
+ fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0);
+ else
+ fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU_BOTH);
+ }
else {
/* Find the minimal way to correct the situation */
if ((tstate & T0_IN_TMU0) || (tstate & T1_IN_TMU1)) {
/* We have one in the standard order, setup the other */
if (tstate & T0_IN_TMU0) { /* T0 is in TMU0, put T1 in TMU1 */
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
+ if (shared->umaTexMemory)
+ fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0);
+ else
+ fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
}
else {
fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
@@ -725,7 +1511,10 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
else if ((tstate & T0_IN_TMU1) || (tstate & T1_IN_TMU0)) {
/* we have one in the reverse order, setup the other */
if (tstate & T1_IN_TMU0) { /* T1 is in TMU0, put T0 in TMU1 */
- fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU1);
+ if (shared->umaTexMemory)
+ fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
+ else
+ fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU1);
}
else {
fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0);
@@ -735,13 +1524,16 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
}
else { /* Nothing is loaded */
fxTMMoveInTM_NoLock(fxMesa, tObj0, FX_TMU0);
- fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
+ if (shared->umaTexMemory)
+ fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU0);
+ else
+ fxTMMoveInTM_NoLock(fxMesa, tObj1, FX_TMU1);
/* tmu0 and tmu1 are setup */
}
}
}
- if (!fxMesa->haveGlobalPaletteTexture) {
+ if (!ctx->Texture.SharedPalette) {
if (ti0->info.format == GR_TEXFMT_P_8) {
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: uploading texture palette TMU0\n");
@@ -765,8 +1557,13 @@ fxSetupDoubleTMU_NoLock(fxMesaContext fxMesa,
FX_grTexFilterMode_NoLock(tmu0, ti0->minFilt, ti0->maxFilt);
FX_grTexMipMapMode_NoLock(tmu0, ti0->mmMode, FXFALSE);
- FX_grTexSource_NoLock(tmu1, ti1->tm[tmu1]->startAddr,
- GR_MIPMAPLEVELMASK_BOTH, &(ti1->info));
+ if (shared->umaTexMemory)
+ FX_grTexSource_NoLock(tmu1, ti1->tm[tmu0]->startAddr,
+ GR_MIPMAPLEVELMASK_BOTH, &(ti1->info));
+ else
+ FX_grTexSource_NoLock(tmu1, ti1->tm[tmu1]->startAddr,
+ GR_MIPMAPLEVELMASK_BOTH, &(ti1->info));
+
FX_grTexClampMode_NoLock(tmu1, ti1->sClamp, ti1->tClamp);
FX_grTexFilterMode_NoLock(tmu1, ti1->minFilt, ti1->maxFilt);
FX_grTexMipMapMode_NoLock(tmu1, ti1->mmMode, FXFALSE);
@@ -832,200 +1629,212 @@ fxSetupTextureDoubleTMU_NoLock(GLcontext * ctx)
tmu1 = 0;
}
fxMesa->tmuSrc = FX_TMU_BOTH;
- switch (envmode) {
- case (FX_UM_E0_MODULATE | FX_UM_E1_MODULATE):
- {
- 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;
- if (isalpha[FX_TMU1])
+ if (fxMesa->isNapalm) {
+ /* Remember, Glide has its texture units numbered in backward
+ * order compared to OpenGL.
+ */
+ SetupTexEnvNapalm(ctx, FX_TMU1, GL_TRUE, &(ctx->Texture.Unit[0]),
+ ti0->baseLevelInternalFormat);
+ SetupTexEnvNapalm(ctx, FX_TMU0, GL_FALSE, &(ctx->Texture.Unit[1]),
+ ti1->baseLevelInternalFormat);
+ }
+ else {
+ switch (envmode) {
+ case (FX_UM_E0_MODULATE | FX_UM_E1_MODULATE):
+ {
+ 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;
+
+ if (isalpha[FX_TMU1])
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_ZERO,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE, FXTRUE,
+ FXFALSE);
+ else
+ FX_grTexCombine_NoLock(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE, FXFALSE,
+ FXFALSE);
+
+ if (isalpha[FX_TMU0])
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL, FXFALSE,
+ FXFALSE);
+ else
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL, FXFALSE,
+ FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ localc, GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ locala, GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ break;
+ }
+ case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */
+ if (tmu1 == FX_TMU1) {
FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_ZERO,
- GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXTRUE,
- FXFALSE);
- else
- FX_grTexCombine_NoLock(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXFALSE,
- FXFALSE);
+ GR_COMBINE_FACTOR_NONE, FXTRUE, FXFALSE);
- if (isalpha[FX_TMU0])
FX_grTexCombine_NoLock(GR_TMU0,
GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FACTOR_LOCAL,
GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL, FXFALSE,
- FXFALSE);
- else
+ GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE);
+ }
+ else {
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
+
FX_grTexCombine_NoLock(GR_TMU0,
GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL, FXFALSE,
- FXFALSE);
-
- FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- localc, GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
-
- FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- locala, GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
- break;
- }
- case (FX_UM_E0_REPLACE | FX_UM_E1_BLEND): /* Only for GLQuake */
- if (tmu1 == FX_TMU1) {
- FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXTRUE, FXFALSE);
-
- FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE);
- }
- else {
- FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
-
- FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
- FXFALSE, FXFALSE);
- }
-
- FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- locala, GR_COMBINE_OTHER_NONE, FXFALSE);
-
- FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
- break;
- case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */
- if (tmu1 == FX_TMU1) {
- FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_ZERO,
- GR_COMBINE_FACTOR_NONE, FXFALSE, FXTRUE);
-
- FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE);
-
- }
- else {
- FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE,
- GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
-
- FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- GR_COMBINE_FUNCTION_BLEND_OTHER,
- GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE);
- }
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ FXFALSE, FXFALSE);
+ }
- if (ti0->baseLevelInternalFormat == GL_RGB)
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
locala, GR_COMBINE_OTHER_NONE, FXFALSE);
- else
- FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- locala, GR_COMBINE_OTHER_NONE, FXFALSE);
-
-
- FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
- break;
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
+ break;
+ case (FX_UM_E0_REPLACE | FX_UM_E1_MODULATE): /* Quake 2 and 3 */
+ if (tmu1 == FX_TMU1) {
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_ZERO,
+ GR_COMBINE_FACTOR_NONE, FXFALSE, FXTRUE);
- case (FX_UM_E0_MODULATE | FX_UM_E1_ADD): /* Quake 3 Sky */
- {
- 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;
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL, FXFALSE, FXFALSE);
- if (isalpha[FX_TMU1])
+ }
+ else {
FX_grTexCombine_NoLock(GR_TMU1,
- GR_COMBINE_FUNCTION_ZERO,
- GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXTRUE,
- FXFALSE);
- else
- FX_grTexCombine_NoLock(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,
- GR_COMBINE_FACTOR_NONE, FXFALSE,
- FXFALSE);
+ GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
- if (isalpha[FX_TMU0])
FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- GR_COMBINE_FACTOR_ONE, FXFALSE,
- FXFALSE);
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_FUNCTION_BLEND_OTHER,
+ GR_COMBINE_FACTOR_ONE, FXFALSE, FXFALSE);
+ }
+
+ if (ti0->baseLevelInternalFormat == GL_RGB)
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ locala, GR_COMBINE_OTHER_NONE, FXFALSE);
else
- FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
- GR_COMBINE_FACTOR_ONE, FXFALSE,
- FXFALSE);
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ locala, GR_COMBINE_OTHER_NONE, FXFALSE);
+
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- localc, GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+ GR_COMBINE_FACTOR_ONE,
+ localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
+ break;
- FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
- GR_COMBINE_FACTOR_LOCAL,
- locala, GR_COMBINE_OTHER_TEXTURE,
- FXFALSE);
+
+ case (FX_UM_E0_MODULATE | FX_UM_E1_ADD): /* Quake 3 Sky */
+ {
+ 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;
+
+ if (isalpha[FX_TMU1])
+ FX_grTexCombine_NoLock(GR_TMU1,
+ GR_COMBINE_FUNCTION_ZERO,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE, FXTRUE,
+ FXFALSE);
+ else
+ FX_grTexCombine_NoLock(GR_TMU1, GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE, FXFALSE,
+ FXFALSE);
+
+ if (isalpha[FX_TMU0])
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE, FXFALSE,
+ FXFALSE);
+ else
+ FX_grTexCombine_NoLock(GR_TMU0,
+ GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE, FXFALSE,
+ FXFALSE);
+
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ localc, GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ locala, GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ break;
+ }
+ default:
+ fprintf(stderr, "Unexpected dual texture mode encountered\n");
break;
}
- default:
- fprintf(stderr, "Unexpected dual texture mode encountered\n");
- break;
}
if (MESA_VERBOSE & VERBOSE_DRIVER) {
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h b/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h
index b79d96ce9..4b71e5ea2 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h
@@ -1,7 +1,8 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h,v 1.1 2000/09/24 13:51:19 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxsetup.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
#ifndef FXSETUP_H
#define FXSETUP_H
+extern void fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj);
extern void fxDDEnable(GLcontext *, GLenum, GLboolean);
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c b/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c
index c1d01b3d7..63a9b8922 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c,v 1.1 2000/09/24 13:51:20 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtexman.c,v 1.3 2000/12/08 21:34:20 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -52,9 +52,6 @@
#define BAD_ADDRESS ((FxU32) -1)
-int texSwaps = 0;
-
-
#ifdef TEXSANITY
static void
@@ -117,24 +114,32 @@ sanity(fxMesaContext fxMesa)
* Try to allocate it from the pool of free MemRange nodes rather than malloc.
*/
static MemRange *
-fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
+NewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
{
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
MemRange *result;
- if (fxMesa->tmPool) {
- result = fxMesa->tmPool;
- fxMesa->tmPool = fxMesa->tmPool->next;
+ _glthread_LOCK_MUTEX(mesaShared->Mutex);
+ if (shared && shared->tmPool) {
+ result = shared->tmPool;
+ shared->tmPool = shared->tmPool->next;
}
else {
result = MALLOC(sizeof(MemRange));
- if (!result) {
- /*fprintf(stderr, "fxDriver: out of memory!\n");*/
- return NULL;
- }
+
+ }
+ _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
+
+ if (!result) {
+ /*fprintf(stderr, "fxDriver: out of memory!\n");*/
+ return NULL;
}
+
result->startAddr = start;
result->endAddr = end;
result->next = NULL;
+
return result;
}
@@ -144,12 +149,19 @@ fxTMNewRangeNode(fxMesaContext fxMesa, FxU32 start, FxU32 end)
* We keep a linked list of free/available MemRange structs to
* avoid extra malloc/free calls.
*/
+#if 0
static void
-fxTMDeleteRangeNode(fxMesaContext fxMesa, MemRange *range)
+DeleteRangeNode_NoLock(struct TdfxSharedState *shared, MemRange *range)
{
- range->next = fxMesa->tmPool;
- fxMesa->tmPool = range;
+ /* insert at head of list */
+ range->next = shared->tmPool;
+ shared->tmPool = range;
}
+#endif
+
+#define DELETE_RANGE_NODE(shared, range) \
+ (range)->next = (shared)->tmPool; \
+ (shared)->tmPool = (range)
/*
@@ -158,7 +170,7 @@ fxTMDeleteRangeNode(fxMesaContext fxMesa, MemRange *range)
* determins the texture to throw out.
*/
static struct gl_texture_object *
-fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
+FindOldestObject(fxMesaContext fxMesa, FxU32 tmu)
{
const GLuint bindnumber = fxMesa->texBindNumber;
struct gl_texture_object *oldestObj, *obj, *lowestPriorityObj;
@@ -221,15 +233,22 @@ fxTMFindOldestObject(fxMesaContext fxMesa, int tmu)
* <size> is the texture size in bytes.
*/
static FxU32
-fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, FxU32 size)
+FindStartAddr(fxMesaContext fxMesa, FxU32 tmu, FxU32 size)
{
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
MemRange *prev, *block;
FxU32 result;
struct gl_texture_object *obj;
+ if (shared->umaTexMemory) {
+ assert(tmu == FX_TMU0);
+ }
+
+ _glthread_LOCK_MUTEX(mesaShared->Mutex);
while (1) {
prev = NULL;
- block = fxMesa->tmFree[tmu];
+ block = shared->tmFree[tmu];
while (block) {
if (block->endAddr - block->startAddr >= size) {
/* The texture will fit here */
@@ -241,25 +260,31 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, FxU32 size)
prev->next = block->next;
}
else {
- fxMesa->tmFree[tmu] = block->next;
+ shared->tmFree[tmu] = block->next;
}
- fxTMDeleteRangeNode(fxMesa, block);
+ DELETE_RANGE_NODE(shared, block);
}
- fxMesa->freeTexMem[tmu] -= size;
+ shared->freeTexMem[tmu] -= size;
+ _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
return result;
}
prev = block;
block = block->next;
}
/* No free space. Discard oldest */
- obj = fxTMFindOldestObject(fxMesa, tmu);
+ obj = FindOldestObject(fxMesa, tmu);
if (!obj) {
/*gl_problem(NULL, "fx Driver: No space for texture\n");*/
+ _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
return BAD_ADDRESS;
}
- fxTMMoveOutTM(fxMesa, obj);
- texSwaps++;
+ fxTMMoveOutTM_NoLock(fxMesa, obj);
+ fxMesa->stats.texSwaps++;
}
+
+ /* never get here, but play it safe */
+ _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
+ return BAD_ADDRESS;
}
@@ -267,22 +292,28 @@ fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, FxU32 size)
* Remove the given MemRange node from hardware texture memory.
*/
static void
-fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange *range)
+RemoveRange_NoLock(fxMesaContext fxMesa, FxU32 tmu, MemRange *range)
{
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
MemRange *block, *prev;
+ if (shared->umaTexMemory) {
+ assert(tmu == FX_TMU0);
+ }
+
if (!range)
return;
if (range->startAddr == range->endAddr) {
- fxTMDeleteRangeNode(fxMesa, range);
+ DELETE_RANGE_NODE(shared, range);
return;
}
- fxMesa->freeTexMem[tmu] += range->endAddr - range->startAddr;
+ shared->freeTexMem[tmu] += range->endAddr - range->startAddr;
/* find position in linked list to insert this MemRange node */
prev = NULL;
- block = fxMesa->tmFree[tmu];
+ block = shared->tmFree[tmu];
while (block) {
if (range->startAddr > block->startAddr) {
prev = block;
@@ -299,7 +330,7 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange *range)
if (range->endAddr == block->startAddr) {
/* Combine */
block->startAddr = range->startAddr;
- fxTMDeleteRangeNode(fxMesa, range);
+ DELETE_RANGE_NODE(shared, range);
range = block;
}
}
@@ -308,96 +339,73 @@ fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange *range)
/* Combine */
prev->endAddr = range->endAddr;
prev->next = range->next;
- fxTMDeleteRangeNode(fxMesa, range);
+ DELETE_RANGE_NODE(shared, range);
}
else {
prev->next = range;
}
}
else {
- fxMesa->tmFree[tmu] = range;
+ shared->tmFree[tmu] = range;
}
}
+static void
+RemoveRange(fxMesaContext fxMesa, FxU32 tmu, MemRange *range)
+{
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ _glthread_LOCK_MUTEX(mesaShared->Mutex);
+ RemoveRange_NoLock(fxMesa, tmu, range);
+ _glthread_UNLOCK_MUTEX(mesaShared->Mutex);
+}
+
+
/*
* Allocate space for a texture image.
* <tmu> is the texture unit
* <texmemsize> is the number of bytes to allocate
*/
static MemRange *
-fxTMAllocTexMem(fxMesaContext fxMesa, GLint tmu, FxU32 texmemsize)
+AllocTexMem(fxMesaContext fxMesa, FxU32 tmu, FxU32 texmemsize)
{
- FxU32 startAddr = fxTMFindStartAddr(fxMesa, tmu, texmemsize);
+ FxU32 startAddr = FindStartAddr(fxMesa, tmu, texmemsize);
if (startAddr == BAD_ADDRESS) {
return NULL;
}
else {
MemRange *range;
- range = fxTMNewRangeNode(fxMesa, startAddr, startAddr + texmemsize);
+ range = NewRangeNode(fxMesa, startAddr, startAddr + texmemsize);
return range;
}
}
-
/*
- * Move the given texture back into hardare texture memory.
+ * Download (copy) the given texture data into the Voodoo's texture memory.
+ * The texture memory must have already been allocated.
+ * Called by fxTMMoveInTM_NoLock() and fxTMRestoreTextures().
*/
-void
-fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
- GLint where)
+static void
+DownloadTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
int i, l;
- FxU32 texmemsize;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxTMMoveInTM(%d)\n", tObj->Name);
- }
-
- fxMesa->stats.reqTexUpload++;
-
- if (!ti->validated) {
- gl_problem(NULL,
- "fx Driver: internal error in fxTMMoveInTM() -> not validated\n");
- return; /* used to abort here */
- }
-
- if (ti->isInTM) {
- if (ti->whichTMU == where)
- return;
- if (where == FX_TMU_SPLIT || ti->whichTMU == FX_TMU_SPLIT) {
- fxTMMoveOutTM_NoLock(fxMesa, tObj);
- }
- else {
- if (ti->whichTMU == FX_TMU_BOTH)
- return;
- where = FX_TMU_BOTH;
- }
- }
+ FxU32 targetTMU;
- if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
- fprintf(stderr,
- "fxmesa: downloading %x (%d) in texture memory in %d\n",
- (GLuint) tObj, tObj->Name, where);
- }
+ assert(tObj);
+ assert(ti);
- ti->whichTMU = (FxU32) where;
+ targetTMU = ti->whichTMU;
- switch (where) {
+ switch (targetTMU) {
case FX_TMU0:
case FX_TMU1:
- texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[where] = fxTMAllocTexMem(fxMesa, where, texmemsize);
- if (ti->tm[where]) {
- fxMesa->stats.memTexUpload += texmemsize;
-
+ if (ti->tm[targetTMU]) {
for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
i <= FX_smallLodValue(ti->info); i++, l++)
- FX_grTexDownloadMipMapLevel_NoLock(where,
- ti->tm[where]->startAddr,
+ FX_grTexDownloadMipMapLevel_NoLock(targetTMU,
+ ti->tm[targetTMU]->startAddr,
FX_valueToLod(i),
FX_largeLodLog2(ti->info),
FX_aspectRatioLog2(ti->info),
@@ -407,18 +415,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
break;
case FX_TMU_SPLIT:
- texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD,
- &(ti->info));
- ti->tm[FX_TMU0] = fxTMAllocTexMem(fxMesa, FX_TMU0, texmemsize);
- if (ti->tm[FX_TMU0])
- fxMesa->stats.memTexUpload += texmemsize;
-
- texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN,
- &(ti->info));
- ti->tm[FX_TMU1] = fxTMAllocTexMem(fxMesa, FX_TMU1, texmemsize);
if (ti->tm[FX_TMU0] && ti->tm[FX_TMU1]) {
- fxMesa->stats.memTexUpload += texmemsize;
-
for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
i <= FX_smallLodValue(ti->info); i++, l++) {
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
@@ -442,18 +439,7 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
}
break;
case FX_TMU_BOTH:
- texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[FX_TMU0] = fxTMAllocTexMem(fxMesa, FX_TMU0, texmemsize);
- if (ti->tm[FX_TMU0])
- fxMesa->stats.memTexUpload += texmemsize;
-
- texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
- &(ti->info));
- ti->tm[FX_TMU1] = fxTMAllocTexMem(fxMesa, FX_TMU1, texmemsize);
if (ti->tm[FX_TMU0] && ti->tm[FX_TMU1]) {
- fxMesa->stats.memTexUpload += texmemsize;
-
for (i = FX_largeLodValue(ti->info), l = ti->minLevel;
i <= FX_smallLodValue(ti->info); i++, l++) {
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
@@ -478,8 +464,94 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
break;
default:
fprintf(stderr,
- "fx Driver: internal error in fxTMMoveInTM() -> wrong tmu (%d)\n",
- where);
+ "fx Driver: internal error in DownloadTexture -> bad tmu (%d)\n",
+ (int) targetTMU);
+ return; /* used to abort here */
+ }
+}
+
+
+
+/*
+ * Allocate space for the given texture in texture memory then
+ * download (copy) it into that space.
+ */
+void
+fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
+ FxU32 targetTMU)
+{
+ tfxTexInfo *ti = fxTMGetTexInfo(tObj);
+ FxU32 texmemsize;
+
+ if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxmesa: fxTMMoveInTM(%d)\n", tObj->Name);
+ }
+
+ fxMesa->stats.reqTexUpload++;
+
+ if (!ti->validated) {
+ gl_problem(NULL,
+ "fx Driver: internal error in fxTMMoveInTM() -> not validated\n");
+ return; /* used to abort here */
+ }
+
+ if (ti->isInTM) {
+ if (ti->whichTMU == targetTMU)
+ return;
+ if (targetTMU == FX_TMU_SPLIT || ti->whichTMU == FX_TMU_SPLIT) {
+ fxTMMoveOutTM_NoLock(fxMesa, tObj);
+ }
+ else {
+ if (ti->whichTMU == FX_TMU_BOTH)
+ return;
+ targetTMU = FX_TMU_BOTH;
+ }
+ }
+
+ if (MESA_VERBOSE & (VERBOSE_DRIVER | VERBOSE_TEXTURE)) {
+ fprintf(stderr,
+ "fxmesa: downloading %x (%d) in texture memory in %d\n",
+ tObj, tObj->Name, (int) targetTMU);
+ }
+
+ ti->whichTMU = targetTMU;
+
+ switch (targetTMU) {
+ case FX_TMU0:
+ case FX_TMU1:
+ texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
+ &(ti->info));
+ ti->tm[targetTMU] = AllocTexMem(fxMesa, targetTMU, texmemsize);
+ DownloadTexture(fxMesa, tObj);
+ break;
+ case FX_TMU_SPLIT:
+ texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_ODD,
+ &(ti->info));
+ ti->tm[FX_TMU0] = AllocTexMem(fxMesa, FX_TMU0, texmemsize);
+ if (ti->tm[FX_TMU0])
+ fxMesa->stats.memTexUpload += texmemsize;
+
+ texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_EVEN,
+ &(ti->info));
+ ti->tm[FX_TMU1] = AllocTexMem(fxMesa, FX_TMU1, texmemsize);
+ DownloadTexture(fxMesa, tObj);
+ break;
+ case FX_TMU_BOTH:
+ texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
+ &(ti->info));
+ ti->tm[FX_TMU0] = AllocTexMem(fxMesa, FX_TMU0, texmemsize);
+ if (ti->tm[FX_TMU0])
+ fxMesa->stats.memTexUpload += texmemsize;
+
+ texmemsize = FX_grTexTextureMemRequired_NoLock(GR_MIPMAPLEVELMASK_BOTH,
+ &(ti->info));
+ ti->tm[FX_TMU1] = AllocTexMem(fxMesa, FX_TMU1, texmemsize);
+ DownloadTexture(fxMesa, tObj);
+ break;
+ default:
+ fprintf(stderr,
+ "fx Driver: internal error in fxTMMoveInTM() -> bad tmu (%d)\n",
+ (int) targetTMU);
return; /* used to abort here */
}
@@ -491,10 +563,10 @@ fxTMMoveInTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj,
void
fxTMMoveInTM(fxMesaContext fxMesa, struct gl_texture_object *tObj,
- GLint where)
+ FxU32 targetTMU)
{
BEGIN_BOARD_LOCK(fxMesa);
- fxTMMoveInTM_NoLock(fxMesa, tObj, where);
+ fxTMMoveInTM_NoLock(fxMesa, tObj, targetTMU);
END_BOARD_LOCK(fxMesa);
}
@@ -506,14 +578,14 @@ fxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj,
fxMesaContext fxMesa = FX_CONTEXT(ctx);
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
GrLOD_t lodlevel;
- GLint tmu;
+ FxU32 tmu;
if (!ti->validated) {
gl_problem(ctx, "internal error in fxTMReloadMipMapLevel() -> not validated\n");
return;
}
- tmu = (int) ti->whichTMU;
+ tmu = ti->whichTMU;
fxTMMoveInTM(fxMesa, tObj, tmu);
fxTexGetInfo(ctx, ti->mipmapLevel[0].width, ti->mipmapLevel[0].height,
@@ -578,7 +650,7 @@ fxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj,
default:
fprintf(stderr,
"fx Driver: internal error in fxTMReloadMipMapLevel() -> wrong tmu (%d)\n",
- tmu);
+ (int) tmu);
break;
}
}
@@ -677,17 +749,21 @@ fxTMReloadSubMipMapLevel(GLcontext *ctx,
}
#endif
+
/*
* Move the given texture out of hardware texture memory.
+ * This deallocates the texture's memory space.
*/
void
-fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
+fxTMMoveOutTM_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n", (GLuint) tObj,
- tObj->Name);
+ fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n",
+ tObj, tObj->Name);
}
if (!ti->isInTM)
@@ -696,12 +772,13 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
switch (ti->whichTMU) {
case FX_TMU0:
case FX_TMU1:
- fxTMRemoveRange(fxMesa, (int) ti->whichTMU, ti->tm[ti->whichTMU]);
+ RemoveRange_NoLock(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]);
break;
case FX_TMU_SPLIT:
case FX_TMU_BOTH:
- fxTMRemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]);
- fxTMRemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
+ assert(!shared->umaTexMemory);
+ RemoveRange_NoLock(fxMesa, FX_TMU0, ti->tm[FX_TMU0]);
+ RemoveRange_NoLock(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
break;
default:
fprintf(stderr, "fx Driver: internal error in fxTMMoveOutTM()\n");
@@ -712,34 +789,60 @@ fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
ti->whichTMU = FX_TMU_NONE;
}
-
-/*
- * Called via glDeleteTexture to delete a texture object.
- */
void
-fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
+fxTMMoveOutTM(fxMesaContext fxMesa, struct gl_texture_object *tObj)
{
+ struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) mesaShared->DriverData;
tfxTexInfo *ti = fxTMGetTexInfo(tObj);
- int i;
-
- fxTMMoveOutTM(fxMesa, tObj);
- for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
- if (ti->mipmapLevel[i].data) {
- FREE(ti->mipmapLevel[i].data);
- ti->mipmapLevel[i].data = NULL;
- }
+ if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxmesa: fxTMMoveOutTM(%x (%d))\n",
+ tObj, tObj->Name);
}
+
+ if (!ti->isInTM)
+ return;
+
switch (ti->whichTMU) {
case FX_TMU0:
case FX_TMU1:
- fxTMDeleteRangeNode(fxMesa, ti->tm[ti->whichTMU]);
+ RemoveRange(fxMesa, ti->whichTMU, ti->tm[ti->whichTMU]);
break;
case FX_TMU_SPLIT:
case FX_TMU_BOTH:
- fxTMDeleteRangeNode(fxMesa, ti->tm[FX_TMU0]);
- fxTMDeleteRangeNode(fxMesa, ti->tm[FX_TMU1]);
+ assert(!shared->umaTexMemory);
+ RemoveRange(fxMesa, FX_TMU0, ti->tm[FX_TMU0]);
+ RemoveRange(fxMesa, FX_TMU1, ti->tm[FX_TMU1]);
break;
+ default:
+ fprintf(stderr, "fx Driver: internal error in fxTMMoveOutTM()\n");
+ return;
+ }
+
+ ti->isInTM = GL_FALSE;
+ ti->whichTMU = FX_TMU_NONE;
+}
+
+
+/*
+ * Called via glDeleteTexture to delete a texture object.
+ */
+void
+fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
+{
+ tfxTexInfo *ti = fxTMGetTexInfo(tObj);
+ if (ti) {
+ int i;
+ fxTMMoveOutTM(fxMesa, tObj);
+ for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
+ if (ti->mipmapLevel[i].data) {
+ FREE(ti->mipmapLevel[i].data);
+ ti->mipmapLevel[i].data = NULL;
+ }
+ }
+ FREE(ti);
+ tObj->DriverData = NULL;
}
}
@@ -751,36 +854,43 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
void
fxTMInit(fxMesaContext fxMesa)
{
- const char *extensions = FX_grGetString(fxMesa, GR_EXTENSION);
-
- fxMesa->texBindNumber = 0;
- fxMesa->tmPool = NULL;
-
- /* On Voodoo4 and later there's a UMA texture memory instead of
- * separate TMU0 and TMU1 segments. We setup UMA mode here if
- * possible.
- */
- if (strstr(extensions, " TEXUMA disabled for now")) {
- FxU32 start, end;
- fxMesa->umaTexMemory = GL_TRUE;
- FX_grEnable(fxMesa, GR_TEXTURE_UMA_EXT);
- start = FX_grTexMinAddress(fxMesa, 0);
- end = FX_grTexMaxAddress(fxMesa, 0);
- fxMesa->freeTexMem[0] = end - start;
- fxMesa->tmFree[0] = fxTMNewRangeNode(fxMesa, start, end);
- }
- else {
- const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
- int tmu;
- fxMesa->umaTexMemory = GL_FALSE;
- for (tmu = 0; tmu < numTMUs; tmu++) {
- FxU32 start = FX_grTexMinAddress(fxMesa, tmu);
- FxU32 end = FX_grTexMaxAddress(fxMesa, tmu);
- fxMesa->freeTexMem[tmu] = end - start;
- fxMesa->tmFree[tmu] = fxTMNewRangeNode(fxMesa, start, end);
+ if (!fxMesa->glCtx->Shared->DriverData) {
+ const char *extensions;
+ struct TdfxSharedState *shared = CALLOC_STRUCT(TdfxSharedState);
+ if (!shared)
+ return;
+
+ extensions = FX_grGetString(fxMesa, GR_EXTENSION);
+ if (strstr(extensions, "TEXUMA")) {
+ FxU32 start, end;
+ shared->umaTexMemory = GL_TRUE;
+ FX_grEnable(fxMesa, GR_TEXTURE_UMA_EXT);
+ start = FX_grTexMinAddress(fxMesa, 0);
+ end = FX_grTexMaxAddress(fxMesa, 0);
+ shared->totalTexMem[0] = end - start;
+ shared->totalTexMem[1] = 0;
+ shared->freeTexMem[0] = end - start;
+ shared->tmFree[0] = NewRangeNode(fxMesa, start, end);
+ /*printf("UMA tex memory: %d\n", (int) (end - start));*/
+ }
+ else {
+ const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
+ int tmu;
+ shared->umaTexMemory = GL_FALSE;
+ for (tmu = 0; tmu < numTMUs; tmu++) {
+ FxU32 start = FX_grTexMinAddress(fxMesa, tmu);
+ FxU32 end = FX_grTexMaxAddress(fxMesa, tmu);
+ shared->totalTexMem[tmu] = end - start;
+ shared->freeTexMem[tmu] = end - start;
+ shared->tmFree[tmu] = NewRangeNode(fxMesa, start, end);
+ /*printf("Split tex memory: %d\n", (int) (end - start));*/
+ }
}
- }
+ shared->tmPool = NULL;
+ fxMesa->glCtx->Shared->DriverData = shared;
+ /*printf("Texture memory init UMA: %d\n", shared->umaTexMemory);*/
+ }
}
@@ -790,26 +900,34 @@ fxTMInit(fxMesaContext fxMesa)
void
fxTMClose(fxMesaContext fxMesa)
{
- const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
- int tmu;
- MemRange *tmp, *next;
+ if (fxMesa->glCtx->Shared->RefCount == 1) {
+ /* refcount will soon go to zero, free our 3dfx stuff */
+ struct TdfxSharedState *shared = (struct TdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
- /* Deallocate the pool of free MemRange nodes */
- tmp = fxMesa->tmPool;
- while (tmp) {
- next = tmp->next;
- FREE(tmp);
- tmp = next;
- }
+ const int numTMUs = fxMesa->haveTwoTMUs ? 2 : 1;
+ int tmu;
+ MemRange *tmp, *next;
- /* Delete the texture memory block MemRange nodes */
- for (tmu = 0; tmu < numTMUs; tmu++) {
- tmp = fxMesa->tmFree[tmu];
+ /* Deallocate the pool of free MemRange nodes */
+ tmp = shared->tmPool;
while (tmp) {
next = tmp->next;
FREE(tmp);
tmp = next;
}
+
+ /* Delete the texture memory block MemRange nodes */
+ for (tmu = 0; tmu < numTMUs; tmu++) {
+ tmp = shared->tmFree[tmu];
+ while (tmp) {
+ next = tmp->next;
+ FREE(tmp);
+ tmp = next;
+ }
+ }
+
+ FREE(shared);
+ fxMesa->glCtx->Shared->DriverData = NULL;
}
}
@@ -821,25 +939,21 @@ fxTMClose(fxMesaContext fxMesa)
void
fxTMRestoreTextures_NoLock(fxMesaContext ctx)
{
- tfxTexInfo *ti;
struct gl_texture_object *tObj;
- int i, where;
- tObj = ctx->glCtx->Shared->TexObjectList;
- while (tObj) {
- ti = fxTMGetTexInfo(tObj);
+ for (tObj = ctx->glCtx->Shared->TexObjectList; tObj; tObj = tObj->Next) {
+ tfxTexInfo *ti = fxTMGetTexInfo(tObj);
if (ti && ti->isInTM) {
- for (i = 0; i < MAX_TEXTURE_UNITS; i++)
+ int i;
+ for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
if (ctx->glCtx->Texture.Unit[i].Current == tObj) {
- /* Force the texture onto the board, as it could be in use */
- where = ti->whichTMU;
- fxTMMoveOutTM_NoLock(ctx, tObj);
- fxTMMoveInTM_NoLock(ctx, tObj, where);
+ DownloadTexture(ctx, tObj);
break;
}
- if (i == MAX_TEXTURE_UNITS) /* Mark the texture as off the board */
+ }
+ if (i == MAX_TEXTURE_UNITS) {
fxTMMoveOutTM_NoLock(ctx, tObj);
+ }
}
- tObj = tObj->Next;
}
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h b/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h
index 37fedcbb3..c9af7ae48 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h
@@ -1,12 +1,10 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h,v 1.1 2000/09/24 13:51:20 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtexman.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
#ifndef FXTEXMAN_H
#define FXTEXMAN_H
#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData))
-#define fxTMMoveOutTM_NoLock fxTMMoveOutTM
-
extern void fxTMReloadMipMapLevel(GLcontext *, struct gl_texture_object *,
GLint);
extern void fxTMReloadSubMipMapLevel(GLcontext *,
@@ -19,10 +17,12 @@ extern void fxTMClose(fxMesaContext ctx);
extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx);
-extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
+extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, FxU32);
extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
+extern void fxTMMoveOutTM_NoLock(fxMesaContext, struct gl_texture_object *);
+
extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h b/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h
index 8e068bd9b..a71fd7f2c 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h,v 1.1 2000/09/24 13:51:20 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxtritmp.h,v 1.3 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -306,10 +306,8 @@ static void TAG(fx_line) (GLcontext * ctx, GLuint e1, GLuint e2, GLuint pv)
GLfloat w = ctx->Line.Width * .5;
if (IND & FX_FLAT) {
- v1->r = v2->r = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][0]);
- v1->g = v2->g = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][1]);
- v1->b = v2->b = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][2]);
- v1->a = v2->a = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[pv][3]);
+ GOURAUD2(v1, color[pv]);
+ GOURAUD2(v2, color[pv]);
}
else if (IND & FX_TWOSIDE) {
/* XXX use signed area of the polygon to determine front/back color choice */
@@ -354,10 +352,7 @@ static void TAG(fx_line) (GLcontext * ctx, GLuint e1, GLuint e2, GLuint pv)
do { \
GrVertex verts[4], *tmp; \
tmp = (GrVertex *) gWin[i].f; \
- tmp->r = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[0]); \
- tmp->g = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[1]); \
- tmp->b = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[2]); \
- tmp->a = UBYTE_COLOR_TO_FLOAT_255_COLOR(color[3]); \
+ GOURAUD2(tmp, color); \
verts[0] = *tmp; \
verts[1] = *tmp; \
verts[2] = *tmp; \
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c b/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c
index 8102ea09c..eb26fbaca 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c,v 1.1 2000/09/24 13:51:20 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.c,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -462,7 +462,10 @@ fxDDPartialRasterSetup(struct vertex_buffer *VB)
setupfuncs[ind] (VB, VB->Start, VB->Count);
}
-/* Almost certainly never called.
+
+/*
+ * This is called by the fastpath code if we need to resize a vertex buffer.
+ * (Almost certainly never called.)
*/
void
fxDDResizeVB(struct vertex_buffer *VB, GLuint size)
@@ -475,26 +478,23 @@ fxDDResizeVB(struct vertex_buffer *VB, GLuint size)
ALIGN_FREE(VB->ClipMask);
VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * fvb->size, 4);
- FREE(fvb->vert_store);
- fvb->vert_store = MALLOC(sizeof(fxVertex) * fvb->size + 31);
- if (!fvb->vert_store || !VB->ClipMask) {
- fprintf(stderr, "fx Driver: out of memory !\n");
- return;
- }
- fvb->verts = (fxVertex *) (((unsigned long) fvb->vert_store + 31) & ~31);
+ ALIGN_FREE(fvb->verts);
+ fvb->verts = (fxVertex *) ALIGN_MALLOC(sizeof(fxVertex) * fvb->size, 32);
gl_vector1ui_free(&fvb->clipped_elements);
gl_vector1ui_alloc(&fvb->clipped_elements, VEC_WRITABLE, fvb->size, 32);
- if (!fvb->clipped_elements.start)
- goto memerror;
-
- return;
- memerror:
- fprintf(stderr, "fx Driver: out of memory !\n");
+ if (!fvb->verts || !VB->ClipMask || !fvb->clipped_elements.start) {
+ gl_problem(NULL, "tdfx driver out of memory in fxDDResizeVB");
+ return;
+ }
}
+/*
+ * This is called by Mesa when it creates a new vertex buffer.
+ * Here, we allocate a tfxMesaVertexBuffer and hook it to VB->driver_data.
+ */
void
fxDDRegisterVB(struct vertex_buffer *VB)
{
@@ -508,9 +508,10 @@ fxDDRegisterVB(struct vertex_buffer *VB)
*/
if (VB->Type == VB_CVA_PRECALC) {
fvb->size = VB->Size * 5;
- fvb->vert_store = MALLOC(sizeof(fxVertex) * fvb->size + 31);
- if (!fvb->vert_store)
+ fvb->verts = (fxVertex *) ALIGN_MALLOC(sizeof(fxVertex)*fvb->size, 32);
+ if (!fvb->verts)
goto memerror;
+
#if defined(FX_GLIDE3)
fvb->triangle_b = MALLOC(sizeof(GrVertex *) * 4 * fvb->size + 31);
if (!fvb->triangle_b)
@@ -519,23 +520,21 @@ fxDDRegisterVB(struct vertex_buffer *VB)
if (!fvb->strips_b)
goto memerror;
#endif
- fvb->verts =
- (fxVertex *) (((unsigned long) fvb->vert_store + 31) & ~31);
- gl_vector1ui_alloc(&fvb->clipped_elements, VEC_WRITABLE, fvb->size,
- 32);
+ gl_vector1ui_alloc(&fvb->clipped_elements, VEC_WRITABLE, fvb->size,32);
if (!fvb->clipped_elements.start)
goto memerror;
ALIGN_FREE(VB->ClipMask);
- VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte) * fvb->size, 4);
+ VB->ClipMask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*fvb->size, 4);
if (!VB->ClipMask)
goto memerror;
-
}
else {
- fvb->vert_store = MALLOC(sizeof(fxVertex) * (VB->Size + 12) + 31);
- if (!fvb->vert_store)
+ fvb->size = VB->Size + 12;
+ fvb->verts = (fxVertex *) ALIGN_MALLOC(sizeof(fxVertex)*fvb->size, 32);
+ if (!fvb->verts)
goto memerror;
+
#if defined(FX_GLIDE3)
fvb->triangle_b = MALLOC(sizeof(GrVertex *) * 4 * fvb->size + 31);
if (!fvb->triangle_b)
@@ -544,35 +543,36 @@ fxDDRegisterVB(struct vertex_buffer *VB)
if (!fvb->strips_b)
goto memerror;
#endif
- fvb->verts =
- (fxVertex *) (((unsigned long) fvb->vert_store + 31) & ~31);
- fvb->size = VB->Size + 12;
}
-
VB->driver_data = fvb;
return;
+
memerror:
fprintf(stderr, "fx Driver: out of memory !\n");
}
+/*
+ * This is called by Mesa when it's about to deallocate a vertex buffer.
+ * Here we free the tfxMesaVertexBuffer we attached to VB->driver_data.
+ */
void
fxDDUnregisterVB(struct vertex_buffer *VB)
{
struct tfxMesaVertexBuffer *fvb = FX_DRIVER_DATA(VB);
if (fvb) {
- if (fvb->vert_store)
- FREE(fvb->vert_store);
+ if (fvb->verts)
+ ALIGN_FREE(fvb->verts);
gl_vector1ui_free(&fvb->clipped_elements);
- FREE(fvb);
#if defined(FX_GLIDE3)
if (fvb->strips_b)
FREE(fvb->strips_b);
if (fvb->triangle_b)
FREE(fvb->triangle_b);
#endif
- VB->driver_data = 0;
+ FREE(fvb);
+ VB->driver_data = NULL;
}
}
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h b/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h
index 85a5f1f66..02cd0c9ba 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h
+++ b/xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h,v 1.1 2000/09/24 13:51:20 alanh Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/fxvsetup.h,v 1.2 2000/12/08 19:36:23 alanh Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.3
@@ -79,35 +79,13 @@
#define INCR_XY win += 4
-#ifdef FX_V2
-# define DO_SETUP_XY \
- v[XCOORD]=win[0]; \
- v[YCOORD]=win[1];
-#else
-#ifdef DRIVERTS
+/* Add window offset to window coords to get screen coords */
# define DO_SETUP_XY \
v[XCOORD]=win[0]+fxMesa->x_offset; \
v[YCOORD]=win[1]+fxMesa->y_delta;
-#else
-# if (defined(__linux__) && defined(__i386__)) || defined(macintosh)
-# define DO_SETUP_XY { \
- GLfloat t1 = win[0] + snapper; \
- GLfloat t2 = win[1] + snapper; \
- v[XCOORD] = t1 - snapper; \
- v[YCOORD] = t2 - snapper; \
- }
-# else
-# define DO_SETUP_XY { \
- /* trunc (x,y) to multiple of 1/16 */ \
- v[XCOORD]=((int)(win[0]*16.0f))*(1.0f/16.0f); \
- v[YCOORD]=((int)(win[1]*16.0f))*(1.0f/16.0f); \
- }
-# endif
-#endif
-#endif
-#define DO_SETUP_W { \
+#define DO_SETUP_W { \
v[OOWCOORD]=win[3]; \
}
@@ -130,16 +108,17 @@
#define INCR_TMU1 STRIDE_F(tmu1_data, tmu1_stride)
#if FX_USE_PARGB
-#define DO_SETUP_RGBA \
- { GET_PARGB(v) = color[ACOMP] << 24 | color[RCOMP] << 16 | color[GCOMP] << 8 | color[BCOMP];}
-
+#define DO_SETUP_RGBA \
+{ \
+ PACK_4F_ARGB(GET_PARGB(v), color[3], color[0], color[1], color[2]); \
+}
#else
-#define DO_SETUP_RGBA \
-{ \
- UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[RCOORD], color[0]); \
- UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[GCOORD], color[1]); \
- UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[BCOORD], color[2]); \
- UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[ACOORD], color[3]); \
+#define DO_SETUP_RGBA \
+{ \
+ UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[RCOORD], color[0]); \
+ UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[GCOORD], color[1]); \
+ UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[BCOORD], color[2]); \
+ UBYTE_COLOR_TO_FLOAT_255_COLOR2(v[ACOORD], color[3]); \
}
#endif
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c
index 1dcc6a0e8..34c973ba8 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c
@@ -24,7 +24,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c,v 1.6 2000/09/26 15:56:50 tsi Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_inithw.c,v 1.7 2000/12/08 19:36:23 alanh Exp $ */
/*
* Authors:
@@ -70,10 +70,6 @@ tdfxInitHW(__DRIdrawablePrivate * driDrawPriv, fxMesaContext fxMesa)
else
fxMesa->haveTwoTMUs = GL_TRUE;
- /* !!! We are forcing these !!! */
- fxMesa->haveAlphaBuffer = GL_FALSE;
- fxMesa->haveGlobalPaletteTexture = GL_FALSE;
-
fxMesa->glideContext =
FX_grSstWinOpen_NoLock((FxU32) - 1, GR_RESOLUTION_NONE,
GR_REFRESH_NONE, GR_COLORFORMAT_ABGR,
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c
index 228a59758..9da5a11f8 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c
@@ -1,6 +1,7 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.8 2000/09/26 15:56:50 tsi Exp $ */
+/* $XFree86: xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c,v 1.10 2000/12/08 19:36:24 alanh Exp $ */
/*
* Authors:
@@ -197,6 +198,17 @@ XMesaDestroyContext(__DRIcontextPrivate * driContextPriv)
{
fxMesaContext fxMesa = (fxMesaContext) driContextPriv->driverPrivate;
if (fxMesa) {
+ if (fxMesa->glCtx->Shared->RefCount == 1) {
+ /* This share group is about to go away, free our private
+ * texture object data.
+ */
+ struct gl_texture_object *tObj;
+ tObj = fxMesa->glCtx->Shared->TexObjectList;
+ while (tObj) {
+ fxTMFreeTexture(fxMesa, tObj);
+ tObj = tObj->Next;
+ }
+ }
XFree(fxMesa);
driContextPriv->driverPrivate = NULL;
}
@@ -280,9 +292,9 @@ XMesaSwapBuffers(__DRIdrawablePrivate * driDrawPriv)
fprintf(stderr, "%d stalls occurred\n", stalls - prevStalls);
prevStalls = stalls;
}
- if (texSwaps) {
- fprintf(stderr, "%d texture swaps occurred\n", texSwaps);
- texSwaps = 0;
+ if (fxMesa && fxMesa->texSwaps) {
+ fprintf(stderr, "%d texture swaps occurred\n", fxMesa->texSwaps);
+ fxMesa->texSwaps = 0;
}
}
#endif
@@ -336,6 +348,27 @@ XMesaUnbindContext(__DRIcontextPrivate * driContextPriv)
return GL_TRUE;
}
+GLboolean
+XMesaOpenFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ fprintf(stderr,"XMesaOpenFullScreen\n");
+#if 0 /* When new glide3 calls exist */
+ return((GLboolean)grDRISetupFullScreen(GL_TRUE));
+#else
+ return GL_TRUE;
+#endif
+}
+
+GLboolean
+XMesaCloseFullScreen(__DRIcontextPrivate *driContextPriv)
+{
+ fprintf(stderr,"***** XMesaCloseFullScreen *****\n");
+#if 0 /* When new glide3 calls exist */
+ return((GLboolean)grDRISetupFullScreen(GL_FALSE));
+#else
+ return GL_TRUE;
+#endif
+}
/*
* This function sends the window position and cliprect list to