/*@}*/
-/**********************************************************************/
-/** \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
ASSERT(texComponents >= logComponents);
newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
- * texComponents * sizeof(GLchan));
+ * texComponents * sizeof(GLchan));
if (!newImage) {
_mesa_free(tempImage);
return NULL;
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;
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;
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;
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;
(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;
}
}
}
- FREE(tmpRowA);
- FREE(tmpRowB);
+ _mesa_free(tmpRowA);
+ _mesa_free(tmpRowB);
/* Luckily we can leverage the make_2d_mipmap() function here! */
if (border > 0) {
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;
}
dstDepth == srcDepth) {
/* all done */
if (srcImage->IsCompressed) {
- FREE((void *) srcData);
- FREE(dstData);
+ _mesa_free((void *) srcData);
+ _mesa_free(dstData);
}
return;
}
/* 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,
*/
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;
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;