From: Daniel Borca Date: Mon, 26 Jan 2004 10:38:46 +0000 (+0000) Subject: accomodate FetchTexel and fix some memory leak bugs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3682ce37616bb1b33c587263bcb6c4e4eeac313;p=mesa.git accomodate FetchTexel and fix some memory leak bugs --- diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 50f783f3b25..61c69853e6a 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -784,13 +784,21 @@ fxMesaDestroyContext(fxMesaContext fxMesa) glbTotNumCtx--; + /* [dBorca] + * close the hardware first, so we can debug + * atexit problems (memory leaks, etc). + * NB: fxDDDestroyFxMesaContext must be called + * before _mesa_destroy_context; which must be + * called before fxTMClose! + */ + grSstWinClose(fxMesa->glideContext); + fxCloseHardware(); + fxDDDestroyFxMesaContext(fxMesa); _mesa_destroy_visual(fxMesa->glVis); _mesa_destroy_context(fxMesa->glCtx); _mesa_destroy_framebuffer(fxMesa->glBuffer); - - grSstWinClose(fxMesa->glideContext); - fxCloseHardware(); + fxTMClose(fxMesa); FREE(fxMesa); diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index a07a27bad49..447fbfa8819 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1422,7 +1422,6 @@ fxDDDestroyFxMesaContext(fxMesaContext fxMesa) FREE(fxMesa->state); if (fxMesa->fogTable) FREE(fxMesa->fogTable); - fxTMClose(fxMesa); fxFreeVB(fxMesa->glCtx); } diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index a6a5dc5aa79..f1dd2dd3874 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -285,7 +285,7 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj, default: break; } - fxTexInvalidate(ctx, tObj); + fxMesa->new_state |= FX_NEW_TEXTURING; break; case GL_TEXTURE_WRAP_S: @@ -666,9 +666,8 @@ fxIsTexSupported(GLenum target, GLint internalFormat, static void fetch_intensity8(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLubyte *texel; @@ -685,9 +684,8 @@ fetch_intensity8(const struct gl_texture_image *texImage, static void fetch_luminance8(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLubyte *texel; @@ -704,9 +702,8 @@ fetch_luminance8(const struct gl_texture_image *texImage, static void fetch_alpha8(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLubyte *texel; @@ -723,9 +720,8 @@ fetch_alpha8(const struct gl_texture_image *texImage, static void fetch_index8(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *indexOut) { - GLchan *indexOut = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLubyte *texel; @@ -739,9 +735,8 @@ fetch_index8(const struct gl_texture_image *texImage, static void fetch_luminance8_alpha8(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLubyte *texel; @@ -758,9 +753,8 @@ fetch_luminance8_alpha8(const struct gl_texture_image *texImage, static void fetch_r5g6b5(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLushort *texel; @@ -777,9 +771,8 @@ fetch_r5g6b5(const struct gl_texture_image *texImage, static void fetch_r4g4b4a4(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLushort *texel; @@ -796,9 +789,8 @@ fetch_r4g4b4a4(const struct gl_texture_image *texImage, static void fetch_r5g5b5a1(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLushort *texel; @@ -815,9 +807,8 @@ fetch_r5g5b5a1(const struct gl_texture_image *texImage, static void fetch_a8r8g8b8(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLvoid * texelOut) + GLint i, GLint j, GLint k, GLchan *rgba) { - GLchan *rgba = (GLchan *) texelOut; const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage); const GLuint *texel; @@ -1167,7 +1158,7 @@ fxGlideFormat(GLint mesaFormat) } -static FetchTexelFunc +static FetchTexelFuncC fxFetchFunction(GLint mesaFormat) { switch (mesaFormat) { @@ -1397,7 +1388,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, } ti->info.format = mml->glideFormat; - texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat); + texImage->FetchTexelc = fxFetchFunction(texImage->TexFormat->MesaFormat); /* [dBorca] * Hack alert: unsure... @@ -1608,7 +1599,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, #endif ti->info.format = mml->glideFormat; - texImage->FetchTexel = fxFetchFunction(texImage->TexFormat->MesaFormat); + texImage->FetchTexelc = fxFetchFunction(texImage->TexFormat->MesaFormat); /* [dBorca] Hack alert: * what about different size/texel? other anomalies? SW rescaling? diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index 45883f465ba..cdfef475564 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -161,35 +161,6 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) ti->baseLevelInternalFormat = tObj->Image[minl]->Format; - switch (tObj->WrapS) { - case GL_MIRRORED_REPEAT: - ti->sClamp = GR_TEXTURECLAMP_MIRROR_EXT; - break; - case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */ - case GL_CLAMP: - ti->sClamp = GR_TEXTURECLAMP_CLAMP; - break; - case GL_REPEAT: - ti->sClamp = GR_TEXTURECLAMP_WRAP; - break; - default: - ; /* silence compiler warning */ - } - switch (tObj->WrapT) { - case GL_MIRRORED_REPEAT: - ti->tClamp = GR_TEXTURECLAMP_MIRROR_EXT; - break; - case GL_CLAMP_TO_EDGE: /* CLAMP discarding border */ - case GL_CLAMP: - ti->tClamp = GR_TEXTURECLAMP_CLAMP; - break; - case GL_REPEAT: - ti->tClamp = GR_TEXTURECLAMP_WRAP; - break; - default: - ; /* silence compiler warning */ - } - ti->validated = GL_TRUE; ti->info.data = NULL; diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 560a0f4d1be..66f6f443e14 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -773,10 +773,6 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj) for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { struct gl_texture_image *texImage = tObj->Image[i]; if (texImage) { - if (texImage->Data) { - MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; - } if (texImage->DriverData) { FREE(texImage->DriverData); texImage->DriverData = NULL;