summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>1999-12-13 21:53:01 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>1999-12-13 21:53:01 +0000
commit32ea1fdc7e08890f282fe7e7f392efc535b80fe5 (patch)
tree4ce3bfbc18cd885772b44c62ebafe7b3a311facd
parent8d52ee9ae1dcbd69d0c17f060a8ab05806b91ede (diff)
applied Daryll's patches
-rw-r--r--include/GL/xmesa.h38
-rw-r--r--include/GL/xmesa_xf86.h50
-rw-r--r--src/mesa/drivers/glide/fxddtex.c21
-rw-r--r--src/mesa/drivers/glide/fxdrv.h1
-rw-r--r--src/mesa/drivers/glide/fxsetup.c107
-rw-r--r--src/mesa/drivers/glide/fxtexman.c51
6 files changed, 193 insertions, 75 deletions
diff --git a/include/GL/xmesa.h b/include/GL/xmesa.h
index bbedf91677..0fecb6f66e 100644
--- a/include/GL/xmesa.h
+++ b/include/GL/xmesa.h
@@ -1,4 +1,4 @@
-/* $Id: xmesa.h,v 1.1.1.1.2.1 1999/11/24 18:41:37 brianp Exp $ */
+/* $Id: xmesa.h,v 1.1.1.1.2.2 1999/12/13 21:54:19 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,6 +27,9 @@
/*
* $Log: xmesa.h,v $
+ * Revision 1.1.1.1.2.2 1999/12/13 21:54:19 brianp
+ * applied Daryll's patches
+ *
* Revision 1.1.1.1.2.1 1999/11/24 18:41:37 brianp
* bumped version to 3.1
*
@@ -99,6 +102,9 @@ extern "C" {
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "xmesa_x.h"
+#ifdef GLX_DIRECT_RENDERING
+#include "dri_mesa.h"
+#endif
#endif
#include "GL/gl.h"
@@ -134,7 +140,17 @@ typedef struct xmesa_visual *XMesaVisual;
typedef struct xmesa_buffer *XMesaBuffer;
+#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
+/*
+ * Initialize the XMesa driver.
+ */
+extern GLboolean XMesaInitDriver( __DRIscreenPrivate *driScrnPriv );
+/*
+ * Reset the XMesa driver when the X server resets.
+ */
+extern void XMesaResetDriver( __DRIscreenPrivate *driScrnPriv );
+#endif
/*
@@ -182,7 +198,11 @@ extern void XMesaDestroyVisual( XMesaVisual v );
* Return: an XMesaContext or NULL if error.
*/
extern XMesaContext XMesaCreateContext( XMesaVisual v,
- XMesaContext share_list );
+ XMesaContext share_list
+#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
+ , __DRIcontextPrivate *driContextPriv
+#endif
+ );
/*
@@ -195,7 +215,12 @@ extern void XMesaDestroyContext( XMesaContext c );
* Create an XMesaBuffer from an X window.
*/
extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
- XMesaWindow w );
+ XMesaWindow w
+#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
+ , __DRIdrawablePrivate *driDrawPriv
+#endif
+ );
+
/*
@@ -203,7 +228,12 @@ extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v,
*/
extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
XMesaPixmap p,
- XMesaColormap cmap );
+ XMesaColormap cmap
+#if defined(GLX_DIRECT_RENDERING) && !defined(XFree86Server)
+ , __DRIdrawablePrivate *driDrawPriv
+#endif
+ );
+
/*
diff --git a/include/GL/xmesa_xf86.h b/include/GL/xmesa_xf86.h
index 5c1af7a641..0b28aa48e2 100644
--- a/include/GL/xmesa_xf86.h
+++ b/include/GL/xmesa_xf86.h
@@ -30,7 +30,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
- * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.1 1999/08/19 00:55:40 jtg Exp $
+ * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/include/GL/xmesa_xf86.h,v 1.1.1.1.2.1 1999/12/13 21:54:19 brianp Exp $
*/
#ifndef _XMESA_XF86_H_
@@ -52,29 +52,29 @@ typedef DDXPointRec XMesaPoint;
typedef xColorItem XMesaColor;
#define XMesaSetGeneric(__d,__gc,__val,__mask) \
-{ \
+do { \
CARD32 __v[1]; \
(void) __d; \
__v[0] = __val; \
dixChangeGC(NullClient, __gc, __mask, __v, NULL); \
-}
+} while (0)
#define XMesaSetGenericPtr(__d,__gc,__pval,__mask) \
-{ \
+do { \
ChangeGCVal __v[1]; \
(void) __d; \
__v[0].ptr = __pval; \
dixChangeGC(NullClient, __gc, __mask, NULL, __v); \
-}
+} while (0)
#define XMesaSetDashes(__d,__gc,__do,__dl,__n) \
-{ \
+do { \
(void) __d; \
SetDashes(__gc, __do, __n, (unsigned char *)__dl); \
-}
+} while (0)
#define XMesaSetLineAttributes(__d,__gc,__lw,__ls,__cs,__js) \
-{ \
+do { \
CARD32 __v[4]; \
(void) __d; \
__v[0] = __lw; \
@@ -84,7 +84,7 @@ typedef xColorItem XMesaColor;
dixChangeGC(NullClient, __gc, \
GCLineWidth|GCLineStyle|GCCapStyle|GCJoinStyle, \
__v, NULL); \
-}
+} while (0)
#define XMesaSetForeground(d,gc,v) XMesaSetGeneric(d,gc,v,GCForeground)
#define XMesaSetBackground(d,gc,v) XMesaSetGeneric(d,gc,v,GCBackground)
@@ -96,24 +96,24 @@ typedef xColorItem XMesaColor;
#define XMesaSetStipple(d,gc,v) XMesaSetGenericPtr(d,gc,v,GCStipple)
#define XMesaDrawPoint(__d,__b,__gc,__x,__y) \
-{ \
+do { \
XMesaPoint __p[1]; \
(void) __d; \
__p[0].x = __x; \
__p[0].y = __y; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, CoordModeOrigin, 1, __p); \
-}
+} while (0)
#define XMesaDrawPoints(__d,__b,__gc,__p,__n,__m) \
-{ \
+do { \
(void) __d; \
ValidateGC(__b, __gc); \
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
-}
+} while (0)
#define XMesaDrawLine(__d,__b,__gc,__x0,__y0,__x1,__y1) \
-{ \
+do { \
XMesaPoint __p[2]; \
(void) __d; \
ValidateGC(__b, __gc); \
@@ -122,10 +122,10 @@ typedef xColorItem XMesaColor;
__p[1].x = __x1; \
__p[1].y = __y1; \
(*__gc->ops->Polylines)(__b, __gc, CoordModeOrigin, 2, __p); \
-}
+} while (0)
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
-{ \
+do { \
xRectangle __r[1]; \
(void) __d; \
ValidateGC(__b, __gc); \
@@ -134,10 +134,10 @@ typedef xColorItem XMesaColor;
__r[0].width = __w; \
__r[0].height = __h; \
(*__gc->ops->PolyFillRect)(__b, __gc, 1, __r); \
-}
+} while (0)
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
-{ \
+do { \
/* Assumes: Images are always in ZPixmap format */ \
(void) __d; \
if (__sx || __sy) /* The non-trivial case */ \
@@ -146,22 +146,22 @@ typedef xColorItem XMesaColor;
(*__gc->ops->PutImage)(__b, __gc, ((XMesaDrawable)(__b))->depth, \
__x, __y, __w, __h, 0, ZPixmap, \
((XMesaImage *)(__i))->data); \
-}
+} while (0)
#define XMesaCopyArea(__d,__sb,__db,__gc,__sx,__sy,__w,__h,__x,__y) \
-{ \
+do { \
(void) __d; \
ValidateGC(__db, __gc); \
(*__gc->ops->CopyArea)((DrawablePtr)__sb, __db, __gc, \
__sx, __sy, __w, __h, __x, __y); \
-}
+} while (0)
#define XMesaFillPolygon(__d,__b,__gc,__p,__n,__s,__m) \
-{ \
+do { \
(void) __d; \
ValidateGC(__b, __gc); \
(*__gc->ops->FillPolygon)(__b, __gc, __s, __m, __n, __p); \
-}
+} while (0)
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
@@ -170,10 +170,10 @@ typedef xColorItem XMesaColor;
(*__d->DestroyPixmap)(__b)
#define XMesaFreeGC(__d,__gc) \
-{ \
+do { \
(void) __d; \
FreeScratchGC(__gc); \
-}
+} while (0)
#define GET_COLORMAP_SIZE(__v) __v->visinfo->ColormapEntries
#define GET_REDMASK(__v) __v->visinfo->redMask
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index 38dbf6f1a7..db0120a03a 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -124,13 +124,8 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa)
ti->sClamp=GR_TEXTURECLAMP_WRAP;
ti->tClamp=GR_TEXTURECLAMP_WRAP;
- if(fxMesa->haveTwoTMUs) {
- ti->mmMode=GR_MIPMAP_NEAREST;
- ti->LODblend=FXTRUE;
- } else {
- ti->mmMode=GR_MIPMAP_NEAREST_DITHER;
- ti->LODblend=FXFALSE;
- }
+ ti->mmMode=GR_MIPMAP_NEAREST;
+ ti->LODblend=FXFALSE;
for(i=0;i<MAX_TEXTURE_LEVELS;i++) {
ti->mipmapLevel[i].used=GL_FALSE;
@@ -921,10 +916,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
if(wscale==hscale==1) {
int i=0;
- int lenght=h*w;
+ int length=h*w;
unsigned short a,l;
- while(i++<lenght) {
+ while(i++<length) {
l=*data++;
a=*data++;
@@ -965,10 +960,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
if(wscale==hscale==1) {
int i=0;
- int lenght=h*w;
+ int length=h*w;
unsigned short r,g,b;
- while(i++<lenght) {
+ while(i++<length) {
r=*data++;
g=*data++;
b=*data++;
@@ -1015,10 +1010,10 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image,
if(wscale==hscale==1) {
int i=0;
- int lenght=h*w;
+ int length=h*w;
unsigned short r,g,b,a;
- while(i++<lenght) {
+ while(i++<length) {
r=*data++;
g=*data++;
b=*data++;
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h
index 8cef3340b7..08bd52043d 100644
--- a/src/mesa/drivers/glide/fxdrv.h
+++ b/src/mesa/drivers/glide/fxdrv.h
@@ -469,7 +469,6 @@ struct tfxMesaContext {
GLuint texBindNumber;
GLint tmuSrc;
GLuint lastUnitsMode;
- GLuint texStart[FX_NUM_TMU];
GLuint freeTexMem[FX_NUM_TMU];
MemRange *tmPool;
MemRange *tmFree[FX_NUM_TMU];
diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c
index 14acf722be..d38027f114 100644
--- a/src/mesa/drivers/glide/fxsetup.c
+++ b/src/mesa/drivers/glide/fxsetup.c
@@ -70,6 +70,7 @@ static void fxSetupFog(GLcontext *ctx, GLboolean forceTableRebuild);
static void fxSetupScissor(GLcontext *ctx);
static void fxSetupCull(GLcontext *ctx);
static void gl_print_fx_state_flags( const char *msg, GLuint flags);
+static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint);
static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint );
static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj)
@@ -314,12 +315,22 @@ static void fxSetupSingleTMU_NoLock(fxMesaContext fxMesa, struct gl_texture_obje
fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU_SPLIT);
else {
if (fxMesa->haveTwoTMUs) {
+#if 0
+ /* This path is disabled because we're not correctly setting up
+ the second TMU as the only texture unit. It is arguable if this
+ fallback is ever really a win, because when we use the second
+ TMU we have to do setup for both TMU0 and TMU1 which is extra
+ work. We could just flush a texture from TMU0 instead. */
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);
+ &(ti->info))) {
+ fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU0);
+ } else {
+ fxTMMoveInTM_NoLock(fxMesa,tObj, FX_TMU1);
+ }
+#else
+ fxTMMoveInTM_NoLock(fxMesa, tObj, FX_TMU0);
+#endif
} else
fxTMMoveInTM_NoLock(fxMesa,tObj,FX_TMU0);
}
@@ -376,7 +387,8 @@ static void fxSetupSingleTMU(fxMesaContext fxMesa, struct gl_texture_object *tOb
END_BOARD_LOCK();
}
-static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool LODblend)
+static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu,
+ FxBool LODblend)
{
if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxSelectSingleTMUSrc(%d,%d)\n",tmu,LODblend);
@@ -394,7 +406,6 @@ static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool
GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
FXFALSE,FXFALSE);
-
fxMesa->tmuSrc=FX_TMU_SPLIT;
} else {
if(tmu==FX_TMU0) {
@@ -402,7 +413,6 @@ static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool
GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
GR_COMBINE_FUNCTION_LOCAL,GR_COMBINE_FACTOR_NONE,
FXFALSE,FXFALSE);
-
fxMesa->tmuSrc=FX_TMU0;
} else {
FX_grTexCombine_NoLock(GR_TMU1,
@@ -413,8 +423,10 @@ static void fxSelectSingleTMUSrc_NoLock(fxMesaContext fxMesa, GLint tmu, FxBool
/* GR_COMBINE_FUNCTION_SCALE_OTHER doesn't work ?!? */
FX_grTexCombine_NoLock(GR_TMU0,
- GR_COMBINE_FUNCTION_BLEND,GR_COMBINE_FACTOR_ONE,
- GR_COMBINE_FUNCTION_BLEND,GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_ONE,
FXFALSE,FXFALSE);
fxMesa->tmuSrc=FX_TMU1;
@@ -508,10 +520,24 @@ static void fxSetupTextureSingleTMU_NoLock(GLcontext *ctx, GLuint textureset)
FXFALSE);
break;
case GL_BLEND:
-#ifndef FX_SILENT
- fprintf(stderr,"fx Driver: GL_BLEND not yet supported\n");
-#endif
- /* TO DO (I think that the Voodoo Graphics isn't able to support GL_BLEND) */
+ FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ locala,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ if (ifmt==GL_ALPHA)
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ localc,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+ else
+ FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ localc,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXTRUE);
+ ctx->Driver.MultipassFunc = fxMultipassBlend;
break;
case GL_REPLACE:
if((ifmt==GL_RGB) || (ifmt==GL_LUMINANCE))
@@ -1584,10 +1610,61 @@ void fxDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
ctx->Driver.RenderStart = fxSetupFXUnits;
break;
default:
- ; /* XXX no-op??? */
+ ; /* XXX no-op? */
}
}
+#if 0
+/*
+ Multipass to do GL_BLEND texture functions
+ Cf*(1-Ct) has already been written to the buffer during the first pass
+ Cc*Ct gets written during the second pass (in this function)
+ Everything gets reset in the third call (in this function)
+*/
+static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass)
+{
+ GLcontext *ctx = VB->ctx;
+ fxMesaContext fxMesa = FX_CONTEXT(ctx);
+
+ switch (pass) {
+ case 1:
+ /* Add Cc*Ct */
+ fxMesa->restoreUnitsState=fxMesa->unitsState;
+ if (ctx->Depth.Mask) {
+ /* We don't want to check or change the depth buffers */
+ switch (ctx->Depth.Func) {
+ case GL_NEVER:
+ case GL_ALWAYS:
+ break;
+ default:
+ fxDDDepthFunc(ctx, GL_EQUAL);
+ break;
+ }
+ fxDDDepthMask(ctx, FALSE);
+ }
+ /* Enable Cc*Ct mode */
+ /* ? Set the Constant Color ? */
+ fxDDEnable(ctx, GL_BLEND, GL_TRUE);
+ fxDDBlendFunc(ctx, ?, ?);
+ fxSetupTextureSingleTMU(ctx, ?);
+ fxSetupBlend(ctx);
+ fxSetupDepthTest(ctx);
+ break;
+
+ case 2:
+ /* Reset everything back to normal */
+ fxMesa->unitsState = fxMesa->restoreUnitsState;
+ fxMesa->setupdone &= ?;
+ fxSetupTextureSingleTMU(ctx, ?);
+ fxSetupBlend(ctx);
+ fxSetupDepthTest(ctx);
+ break;
+ }
+
+ return pass==1;
+}
+#endif
+
/************************************************************************/
/******************** Fake Multitexture Support *************************/
/************************************************************************/
@@ -1697,7 +1774,7 @@ void fxSetupFXUnits( GLcontext *ctx )
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint newstate = fxMesa->new_state;
- if (MESA_VERBOSE&VERBOSE_DRIVER)
+ if (MESA_VERBOSE&VERBOSE_DRIVER)
gl_print_fx_state_flags("fxmesa: fxSetupFXUnits", newstate);
if (newstate) {
diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c
index 770f095ab8..285045de3e 100644
--- a/src/mesa/drivers/glide/fxtexman.c
+++ b/src/mesa/drivers/glide/fxtexman.c
@@ -60,24 +60,38 @@ static struct gl_texture_object *fxTMFindOldestObject(fxMesaContext fxMesa,
int tmu);
-#if 0
+#ifdef TEXSANITY
static void fubar()
{
}
/* Sanity Check */
-static void sanity(fxMesaContext fxMesa, int tmu)
+static void sanity(fxMesaContext fxMesa)
{
- MemRange *tmp, *prev;
- int i;
+ MemRange *tmp, *prev, *pos;
prev=0;
- tmp = fxMesa->tmFree[tmu];
- i=0;
+ tmp = fxMesa->tmFree[0];
+ while (tmp) {
+ if (!tmp->startAddr && !tmp->endAddr) {
+ fprintf(stderr, "Textures fubar\n");
+ fubar();
+ }
+ if (tmp->startAddr>=tmp->endAddr) {
+ fprintf(stderr, "Node fubar\n");
+ fubar();
+ }
+ if (prev && (prev->startAddr>=tmp->startAddr ||
+ prev->endAddr>tmp->startAddr)) {
+ fprintf(stderr, "Sorting fubar\n");
+ fubar();
+ }
+ prev=tmp;
+ tmp=tmp->next;
+ }
+ prev=0;
+ tmp = fxMesa->tmFree[1];
while (tmp) {
- fprintf(stderr, "TMU %d Sanity %d %d-%d\n", tmu, i,
- tmp->startAddr, tmp->endAddr);
- i++;
if (!tmp->startAddr && !tmp->endAddr) {
fprintf(stderr, "Textures fubar\n");
fubar();
@@ -87,7 +101,7 @@ static void sanity(fxMesaContext fxMesa, int tmu)
fubar();
}
if (prev && (prev->startAddr>=tmp->startAddr ||
- prev->endAddr>=tmp->startAddr)) {
+ prev->endAddr>tmp->startAddr)) {
fprintf(stderr, "Sorting fubar\n");
fubar();
}
@@ -128,13 +142,12 @@ static void fxTMUInit(fxMesaContext fxMesa, int tmu)
start=FX_grTexMinAddress(tmu);
end=FX_grTexMaxAddress(tmu);
- fxMesa->texStart[tmu]=start;
if(fxMesa->verbose) {
fprintf(stderr,"%s configuration:",(tmu==FX_TMU0) ? "TMU0" : "TMU1");
fprintf(stderr," Lower texture memory address (%u)\n",(unsigned int)start);
fprintf(stderr," Higher texture memory address (%u)\n",(unsigned int)end);
- fprintf(stderr," Splitting Texture memory in 2Mb blocks:\n");
+ fprintf(stderr," Splitting Texture memory in 2b blocks:\n");
}
fxMesa->freeTexMem[tmu]=end-start;
@@ -182,6 +195,7 @@ static int fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
}
fxTMDeleteRangeNode(fxMesa, tmp);
}
+ fxMesa->freeTexMem[tmu]-=size;
return result;
}
prev=tmp;
@@ -199,12 +213,13 @@ static int fxTMFindStartAddr(fxMesaContext fxMesa, GLint tmu, int size)
static void fxTMRemoveRange(fxMesaContext fxMesa, GLint tmu, MemRange *range)
{
- MemRange *tmp, *prev, *next;
+ MemRange *tmp, *prev;
if (range->startAddr==range->endAddr) {
fxTMDeleteRangeNode(fxMesa, range);
return;
}
+ fxMesa->freeTexMem[tmu]+=range->endAddr-range->startAddr;
prev=0;
tmp=fxMesa->tmFree[tmu];
while (tmp) {
@@ -554,6 +569,7 @@ void fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
}
switch (ti->whichTMU) {
case FX_TMU0:
+ case FX_TMU1:
fxTMDeleteRangeNode(fxMesa, ti->tm[ti->whichTMU]);
break;
case FX_TMU_SPLIT:
@@ -566,12 +582,13 @@ void fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
void fxTMInit(fxMesaContext fxMesa)
{
+ fxMesa->texBindNumber=0;
+ fxMesa->tmPool=0;
+
fxTMUInit(fxMesa,FX_TMU0);
if(fxMesa->haveTwoTMUs)
fxTMUInit(fxMesa,FX_TMU1);
-
- fxMesa->texBindNumber=0;
}
void fxTMClose(fxMesaContext fxMesa)
@@ -641,7 +658,7 @@ void fxTMRestore_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
for (i=FX_largeLodValue_NoLock(ti->info),l=ti->minLevel;
i<=FX_smallLodValue_NoLock(ti->info);
i++,l++) {
- if (ti->mipmapLevel[l].data)
+ if (ti->mipmapLevel[l].data) {
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU0,
ti->tm[FX_TMU0]->startAddr,
FX_valueToLod(i),
@@ -650,7 +667,6 @@ void fxTMRestore_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
ti->info.format,
GR_MIPMAPLEVELMASK_ODD,
ti->mipmapLevel[l].data);
- if (ti->mipmapLevel[l].data)
FX_grTexDownloadMipMapLevel_NoLock(GR_TMU1,
ti->tm[FX_TMU1]->startAddr,
FX_valueToLod(i),
@@ -659,6 +675,7 @@ void fxTMRestore_NoLock(fxMesaContext fxMesa, struct gl_texture_object *tObj)
ti->info.format,
GR_MIPMAPLEVELMASK_EVEN,
ti->mipmapLevel[l].data);
+ }
}
break;
default: