diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-06-27 00:34:17 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-06-27 00:34:17 +0000 |
commit | 2dbffb30f05fcf67658c64b8101e9efaf07ca388 (patch) | |
tree | 87014f68871fdabde5062fdeb125365b02f731bb /src | |
parent | 397088ff5e904d5cb0fbff1f58fbd0d2bb498302 (diff) | |
download | external_mesa3d-2dbffb30f05fcf67658c64b8101e9efaf07ca388.zip external_mesa3d-2dbffb30f05fcf67658c64b8101e9efaf07ca388.tar.gz external_mesa3d-2dbffb30f05fcf67658c64b8101e9efaf07ca388.tar.bz2 |
Get rid of the MESA_PBUFFER_ALLOC/FREE() macros.
If that stuff is still needed, lots of other updates are needed anyway.
Also, some misc MALLOC/FREE -> _mesa_malloc/free() changes.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_tex.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_fb.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddtex.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxsetup.c | 4 | ||||
-rw-r--r-- | src/mesa/main/imports.h | 41 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 2 | ||||
-rw-r--r-- | src/mesa/main/texstore.c | 38 |
7 files changed, 31 insertions, 72 deletions
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 0ce6603..cf4de23 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1356,10 +1356,10 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, 1, internalFormat); dstRowStride = _mesa_compressed_row_stride(internalFormat, mml->width); - texImage->Data = MESA_PBUFFER_ALLOC(texImage->CompressedSize); + texImage->Data = _mesa_malloc(texImage->CompressedSize); } else { dstRowStride = mml->width * texelBytes; - texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes); + texImage->Data = _mesa_malloc(mml->width * mml->height * texelBytes); } if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); @@ -1662,7 +1662,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, mml->height, 1, internalFormat); - texImage->Data = MESA_PBUFFER_ALLOC(texImage->CompressedSize); + texImage->Data = _mesa_malloc(texImage->CompressedSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); return; diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index e121558..e07c200 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -156,7 +156,7 @@ via_alloc_texture(struct via_context *vmesa, } else if (t->memType == VIA_MEM_SYSTEM) { - t->bufAddr = MESA_PBUFFER_ALLOC(t->size); + t->bufAddr = _mesa_malloc(t->size); if (!t->bufAddr) goto cleanup; @@ -226,8 +226,8 @@ via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t) else if (t->memType == VIA_MEM_SYSTEM) { remove_from_list(t); vmesa->total_alloc[t->memType] -= t->size; - MESA_PBUFFER_FREE(t->bufAddr); - FREE(t); + _mesa_free(t->bufAddr); + _mesa_free(t); } else if (t->index && viaCheckBreadcrumb(vmesa, t->lastUsed)) { via_do_free_texture( vmesa, t ); diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index e7b7ec3..f3f12c4 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1399,10 +1399,10 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, 1, internalFormat); dstRowStride = _mesa_compressed_row_stride(internalFormat, mml->width); - texImage->Data = MESA_PBUFFER_ALLOC(texImage->CompressedSize); + texImage->Data = _mesa_malloc(texImage->CompressedSize); } else { dstRowStride = mml->width * texelBytes; - texImage->Data = MESA_PBUFFER_ALLOC(mml->width * mml->height * texelBytes); + texImage->Data = _mesa_malloc(mml->width * mml->height * texelBytes); } if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); @@ -1665,7 +1665,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, mml->height, 1, internalFormat); - texImage->Data = MESA_PBUFFER_ALLOC(texImage->CompressedSize); + texImage->Data = _mesa_malloc(texImage->CompressedSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); return; diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index ee945dc..360a42f 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -106,14 +106,14 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) &(mml->wScale), &(mml->hScale)); _w *= mml->wScale; _h *= mml->hScale; - texImage->Data = MESA_PBUFFER_ALLOC(_w * _h * texelBytes); + texImage->Data = _mesa_malloc(_w * _h * texelBytes); _mesa_rescale_teximage2d(texelBytes, mml->width, _w * texelBytes, /* dst stride */ mml->width, mml->height, /* src */ _w, _h, /* dst */ texImage_Data /*src*/, texImage->Data /*dst*/ ); - MESA_PBUFFER_FREE(texImage_Data); + _mesa_free(texImage_Data); mml->width = _w; mml->height = _h; /* (!) ... and set mml->wScale = _w / texImage->Width */ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a4afaf1..cf80b33 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -160,47 +160,6 @@ extern "C" { /*@}*/ -/**********************************************************************/ -/** \name External pixel buffer allocation. - * - * If you want Mesa's depth/stencil/accum/etc buffers to be allocated with a - * specialized allocator you can define MESA_EXTERNAL_BUFFERALLOC and implement - * _ext_mesa_alloc_pixelbuffer() _ext_mesa_free_pixelbuffer() in your - * application. - * - * \author - * Contributed by Gerk Huisma (gerk@five-d.demon.nl). - */ -/*@{*/ - -/** - * \def MESA_PBUFFER_ALLOC - * Allocate a pixel buffer. - */ - -/** - * \def MESA_PBUFFER_FREE - * Free a pixel buffer. - */ - -#ifdef MESA_EXTERNAL_BUFFERALLOC -extern void *_ext_mesa_alloc_pixelbuffer( unsigned int size ); -extern void _ext_mesa_free_pixelbuffer( void *pb ); - -#define MESA_PBUFFER_ALLOC(BYTES) (void *) _ext_mesa_alloc_pixelbuffer(BYTES) -#define MESA_PBUFFER_FREE(PTR) _ext_mesa_free_pixelbuffer(PTR) -#else -/* Default buffer allocation uses the aligned allocation routines: */ -#define MESA_PBUFFER_ALLOC(BYTES) (void *) _mesa_align_malloc(BYTES, 512) -#define MESA_PBUFFER_FREE(PTR) _mesa_align_free(PTR) -#endif - -/*@}*/ - - -/**********************************************************************/ - - /** * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float * as a int (thereby using integer registers instead of FP registers) is diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 38c7d6b..62153dc 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -582,7 +582,7 @@ _mesa_free_texture_image_data( GLcontext *ctx, struct gl_texture_image *texImage { if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ - MESA_PBUFFER_FREE(texImage->Data); + _mesa_free(texImage->Data); } texImage->Data = NULL; diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 9a910b2..8af23ae 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -516,7 +516,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, ASSERT(texComponents >= logComponents); newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth - * texComponents * sizeof(GLchan)); + * texComponents * sizeof(GLchan)); if (!newImage) { _mesa_free(tempImage); return NULL; @@ -2207,7 +2207,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, sizeInBytes = texImage->CompressedSize; else sizeInBytes = postConvWidth * texImage->TexFormat->TexelBytes; - texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); + texImage->Data = _mesa_malloc(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); return; @@ -2295,7 +2295,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, sizeInBytes = texImage->CompressedSize; else sizeInBytes = postConvWidth * postConvHeight * texelBytes; - texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); + texImage->Data = _mesa_malloc(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); return; @@ -2375,7 +2375,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, sizeInBytes = texImage->CompressedSize; else sizeInBytes = width * height * depth * texelBytes; - texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes); + texImage->Data = _mesa_malloc(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); return; @@ -2633,7 +2633,7 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; /* allocate storage */ - texImage->Data = MESA_PBUFFER_ALLOC(imageSize); + texImage->Data = _mesa_malloc(imageSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); return; @@ -3383,12 +3383,12 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, (void) srcDepthNB; /* silence warnings */ /* Need two temporary row buffers */ - tmpRowA = MALLOC(srcWidth * bpt); + tmpRowA = _mesa_malloc(srcWidth * bpt); if (!tmpRowA) return; - tmpRowB = MALLOC(srcWidth * bpt); + tmpRowB = _mesa_malloc(srcWidth * bpt); if (!tmpRowB) { - FREE(tmpRowA); + _mesa_free(tmpRowA); return; } @@ -3455,8 +3455,8 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, } } - FREE(tmpRowA); - FREE(tmpRowB); + _mesa_free(tmpRowA); + _mesa_free(tmpRowB); /* Luckily we can leverage the make_2d_mipmap() function here! */ if (border > 0) { @@ -3590,15 +3590,15 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, size = _mesa_bytes_per_pixel(srcImage->Format, CHAN_TYPE) * srcImage->Width * srcImage->Height * srcImage->Depth + 20; /* 20 extra bytes, just be safe when calling last FetchTexel */ - srcData = (GLubyte *) MALLOC(size); + srcData = (GLubyte *) _mesa_malloc(size); if (!srcData) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); return; } - dstData = (GLubyte *) MALLOC(size / 2); /* 1/4 would probably be OK */ + dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */ if (!dstData) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); - FREE((void *) srcData); + _mesa_free((void *) srcData); return; } @@ -3659,8 +3659,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstDepth == srcDepth) { /* all done */ if (srcImage->IsCompressed) { - FREE((void *) srcData); - FREE(dstData); + _mesa_free((void *) srcData); + _mesa_free(dstData); } return; } @@ -3674,7 +3674,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* Free old image data */ if (dstImage->Data) - MESA_PBUFFER_FREE(dstImage->Data); + _mesa_free(dstImage->Data); /* initialize new image */ _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight, @@ -3692,7 +3692,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, */ if (dstImage->IsCompressed) { ASSERT(dstImage->CompressedSize > 0); /* set by init_teximage_fields*/ - dstImage->Data = MESA_PBUFFER_ALLOC(dstImage->CompressedSize); + dstImage->Data = _mesa_malloc(dstImage->CompressedSize); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; @@ -3704,8 +3704,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, else { bytesPerTexel = srcImage->TexFormat->TexelBytes; ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); - dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth - * bytesPerTexel); + dstImage->Data = _mesa_malloc(dstWidth * dstHeight * dstDepth + * bytesPerTexel); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; |