mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 23:00:11 +01:00
accomodate FetchTexel and fix some memory leak bugs
This commit is contained in:
parent
c9d2f4ca47
commit
d3682ce376
5 changed files with 24 additions and 59 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1422,7 +1422,6 @@ fxDDDestroyFxMesaContext(fxMesaContext fxMesa)
|
|||
FREE(fxMesa->state);
|
||||
if (fxMesa->fogTable)
|
||||
FREE(fxMesa->fogTable);
|
||||
fxTMClose(fxMesa);
|
||||
fxFreeVB(fxMesa->glCtx);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue