-/* $Id: context.c,v 1.156 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: context.c,v 1.157 2002/03/19 16:47:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
return;
if (buffer->DepthBuffer) {
- FREE( buffer->DepthBuffer );
+ MESA_PBUFFER_FREE( buffer->DepthBuffer );
buffer->DepthBuffer = NULL;
}
if (buffer->Accum) {
- FREE( buffer->Accum );
+ MESA_PBUFFER_FREE( buffer->Accum );
buffer->Accum = NULL;
}
if (buffer->Stencil) {
- FREE( buffer->Stencil );
+ MESA_PBUFFER_FREE( buffer->Stencil );
buffer->Stencil = NULL;
}
if (buffer->FrontLeftAlpha) {
- FREE( buffer->FrontLeftAlpha );
+ MESA_PBUFFER_FREE( buffer->FrontLeftAlpha );
buffer->FrontLeftAlpha = NULL;
}
if (buffer->BackLeftAlpha) {
- FREE( buffer->BackLeftAlpha );
+ MESA_PBUFFER_FREE( buffer->BackLeftAlpha );
buffer->BackLeftAlpha = NULL;
}
if (buffer->FrontRightAlpha) {
- FREE( buffer->FrontRightAlpha );
+ MESA_PBUFFER_FREE( buffer->FrontRightAlpha );
buffer->FrontRightAlpha = NULL;
}
if (buffer->BackRightAlpha) {
- FREE( buffer->BackRightAlpha );
+ MESA_PBUFFER_FREE( buffer->BackRightAlpha );
buffer->BackRightAlpha = NULL;
}
}
-/* $Id: image.c,v 1.64 2002/03/13 04:34:32 brianp Exp $ */
+/* $Id: image.c,v 1.65 2002/03/19 16:47:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
dest += 3;
}
}
+ else if (transferOps == 0 && dstFormat == GL_RGBA && dstType == GL_UNSIGNED_BYTE) {
+ /* common simple case */
+ GLuint i;
+ GLubyte *dest = (GLubyte *) dstAddr;
+ for (i = 0; i < n; i++) {
+ dest[0] = CHAN_TO_UBYTE(srcRgba[i][RCOMP]);
+ dest[1] = CHAN_TO_UBYTE(srcRgba[i][GCOMP]);
+ dest[2] = CHAN_TO_UBYTE(srcRgba[i][BCOMP]);
+ dest[3] = CHAN_TO_UBYTE(srcRgba[i][ACOMP]);
+ dest += 4;
+ }
+ }
else {
/* general solution */
GLuint i;
srcType == GL_UNSIGNED_INT_2_10_10_10_REV);
/* Try simple cases first */
- if (transferOps == 0 && srcType == CHAN_TYPE) {
- if (dstFormat == GL_RGBA) {
- if (srcFormat == GL_RGBA) {
- MEMCPY( dest, source, n * 4 * sizeof(GLchan) );
- return;
+ if (transferOps == 0 ){
+ if (srcType == CHAN_TYPE) {
+ if (dstFormat == GL_RGBA) {
+ if (srcFormat == GL_RGBA) {
+ MEMCPY( dest, source, n * 4 * sizeof(GLchan) );
+ return;
+ }
+ else if (srcFormat == GL_RGB) {
+ GLuint i;
+ const GLchan *src = (const GLchan *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ dst[3] = CHAN_MAX;
+ src += 3;
+ dst += 4;
+ }
+ return;
+ }
}
- else if (srcFormat == GL_RGB) {
- GLuint i;
- const GLchan *src = (const GLchan *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- dst[3] = CHAN_MAX;
- src += 3;
- dst += 4;
+ else if (dstFormat == GL_RGB) {
+ if (srcFormat == GL_RGB) {
+ MEMCPY( dest, source, n * 3 * sizeof(GLchan) );
+ return;
+ }
+ else if (srcFormat == GL_RGBA) {
+ GLuint i;
+ const GLchan *src = (const GLchan *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = src[0];
+ dst[1] = src[1];
+ dst[2] = src[2];
+ src += 4;
+ dst += 3;
+ }
+ return;
}
+ }
+ else if (dstFormat == srcFormat) {
+ GLint comps = _mesa_components_in_format(srcFormat);
+ assert(comps > 0);
+ MEMCPY( dest, source, n * comps * sizeof(GLchan) );
return;
}
}
- else if (dstFormat == GL_RGB) {
- if (srcFormat == GL_RGB) {
- MEMCPY( dest, source, n * 3 * sizeof(GLchan) );
- return;
+ /*
+ * Common situation, loading 8bit RGBA/RGB source images
+ * into 16/32 bit destination. (OSMesa16/32)
+ */
+ else if (srcType == GL_UNSIGNED_BYTE) {
+ if (dstFormat == GL_RGBA) {
+ if (srcFormat == GL_RGB) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ dst[3] = CHAN_MAX;
+ src += 3;
+ dst += 4;
+ }
+ return;
+ }
+ else if (srcFormat == GL_RGBA) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ dst[3] = UBYTE_TO_CHAN(src[3]);
+ src += 4;
+ dst += 4;
+ }
+ return;
+ }
}
- else if (srcFormat == GL_RGBA) {
- GLuint i;
- const GLchan *src = (const GLchan *) source;
- GLchan *dst = dest;
- for (i = 0; i < n; i++) {
- dst[0] = src[0];
- dst[1] = src[1];
- dst[2] = src[2];
- src += 4;
- dst += 3;
+ else if (dstFormat == GL_RGB) {
+ if (srcFormat == GL_RGB) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ src += 3;
+ dst += 3;
+ }
+ return;
+ }
+ else if (srcFormat == GL_RGBA) {
+ GLuint i;
+ const GLubyte *src = (const GLubyte *) source;
+ GLchan *dst = dest;
+ for (i = 0; i < n; i++) {
+ dst[0] = UBYTE_TO_CHAN(src[0]);
+ dst[1] = UBYTE_TO_CHAN(src[1]);
+ dst[2] = UBYTE_TO_CHAN(src[2]);
+ src += 4;
+ dst += 3;
+ }
+ return;
}
- return;
}
}
- else if (dstFormat == srcFormat) {
- GLint comps = _mesa_components_in_format(srcFormat);
- assert(comps > 0);
- MEMCPY( dest, source, n * comps * sizeof(GLchan) );
- return;
- }
}
-/* $Id: teximage.c,v 1.106 2001/11/18 22:48:13 brianp Exp $ */
+/* $Id: teximage.c,v 1.107 2002/03/19 16:47:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.2
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
_mesa_free_texture_image( struct gl_texture_image *teximage )
{
if (teximage->Data) {
- FREE( teximage->Data );
+ MESA_PBUFFER_FREE( teximage->Data );
teximage->Data = NULL;
}
FREE( teximage );
}
else if (texImage->Data) {
/* free the old texture data */
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
}
else if (texImage->Data) {
/* free the old texture data */
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
}
}
else if (texImage->Data) {
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
}
else if (texImage->Data) {
/* free the old texture data */
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
}
else if (texImage->Data) {
/* free the old texture data */
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
}
}
else if (texImage->Data) {
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
}
}
else if (texImage->Data) {
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
}
}
else if (texImage->Data) {
- FREE(texImage->Data);
+ MESA_PBUFFER_FREE(texImage->Data);
texImage->Data = NULL;
}
-/* $Id: texstore.c,v 1.34 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: texstore.c,v 1.35 2002/03/19 16:47:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.0.2
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
}
/* allocate memory */
- texImage->Data = MALLOC(sizeInBytes);
+ texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D");
return;
}
/* allocate memory */
- texImage->Data = MALLOC(sizeInBytes);
+ texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
return;
}
/* allocate memory */
- texImage->Data = MALLOC(sizeInBytes);
+ texImage->Data = MESA_PBUFFER_ALLOC(sizeInBytes);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
return;
/* Free old image data */
if (dstImage->Data)
- FREE(dstImage->Data);
+ MESA_PBUFFER_FREE(dstImage->Data);
/* initialize new image */
_mesa_init_teximage_fields(ctx, dstImage, dstWidth, dstHeight,
ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0);
/* alloc new image buffer */
- dstImage->Data = MALLOC(dstWidth * dstHeight * dstDepth
+ dstImage->Data = MESA_PBUFFER_ALLOC(dstWidth * dstHeight * dstDepth
* bytesPerTexel);
if (!dstImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
-/* $Id: s_accum.c,v 1.15 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: s_accum.c,v 1.16 2002/03/19 16:47:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
GLint n;
if (buffer->Accum) {
- FREE( buffer->Accum );
+ MESA_PBUFFER_FREE( buffer->Accum );
buffer->Accum = NULL;
}
/* allocate accumulation buffer if not already present */
n = buffer->Width * buffer->Height * 4 * sizeof(GLaccum);
- buffer->Accum = (GLaccum *) MALLOC( n );
+ buffer->Accum = (GLaccum *) MESA_PBUFFER_ALLOC( n );
if (!buffer->Accum) {
/* unable to setup accumulation buffer */
_mesa_error( NULL, GL_OUT_OF_MEMORY, "glAccum" );
-/* $Id: s_alphabuf.c,v 1.9 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: s_alphabuf.c,v 1.10 2002/03/19 16:47:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT(buffer->UseSoftwareAlphaBuffers);
if (buffer->FrontLeftAlpha) {
- FREE( buffer->FrontLeftAlpha );
+ MESA_PBUFFER_FREE( buffer->FrontLeftAlpha );
}
- buffer->FrontLeftAlpha = (GLchan *) MALLOC( bytes );
+ buffer->FrontLeftAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes );
if (!buffer->FrontLeftAlpha) {
/* out of memory */
_mesa_error( NULL, GL_OUT_OF_MEMORY,
if (buffer->Visual.doubleBufferMode) {
if (buffer->BackLeftAlpha) {
- FREE( buffer->BackLeftAlpha );
+ MESA_PBUFFER_FREE( buffer->BackLeftAlpha );
}
- buffer->BackLeftAlpha = (GLchan *) MALLOC( bytes );
+ buffer->BackLeftAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes );
if (!buffer->BackLeftAlpha) {
/* out of memory */
_mesa_error( NULL, GL_OUT_OF_MEMORY,
if (buffer->Visual.stereoMode) {
if (buffer->FrontRightAlpha) {
- FREE( buffer->FrontRightAlpha );
+ MESA_PBUFFER_FREE( buffer->FrontRightAlpha );
}
- buffer->FrontRightAlpha = (GLchan *) MALLOC( bytes );
+ buffer->FrontRightAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes );
if (!buffer->FrontRightAlpha) {
/* out of memory */
_mesa_error( NULL, GL_OUT_OF_MEMORY,
if (buffer->Visual.doubleBufferMode) {
if (buffer->BackRightAlpha) {
- FREE( buffer->BackRightAlpha );
+ MESA_PBUFFER_FREE( buffer->BackRightAlpha );
}
- buffer->BackRightAlpha = (GLchan *) MALLOC( bytes );
+ buffer->BackRightAlpha = (GLchan *) MESA_PBUFFER_ALLOC( bytes );
if (!buffer->BackRightAlpha) {
/* out of memory */
_mesa_error( NULL, GL_OUT_OF_MEMORY,
-/* $Id: s_depth.c,v 1.18 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: s_depth.c,v 1.19 2002/03/19 16:47:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
/* deallocate current depth buffer if present */
if (buffer->DepthBuffer) {
- FREE(buffer->DepthBuffer);
+ MESA_PBUFFER_FREE(buffer->DepthBuffer);
buffer->DepthBuffer = NULL;
}
else
bytesPerValue = sizeof(GLuint);
- buffer->DepthBuffer =MALLOC(buffer->Width * buffer->Height * bytesPerValue);
+ buffer->DepthBuffer = MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height
+ * bytesPerValue);
if (!buffer->DepthBuffer) {
/* out of memory */
-/* $Id: s_stencil.c,v 1.21 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: s_stencil.c,v 1.22 2002/03/19 16:47:05 brianp Exp $ */
/*
* Mesa 3-D graphics library
{
/* deallocate current stencil buffer if present */
if (buffer->Stencil) {
- FREE(buffer->Stencil);
+ MESA_PBUFFER_FREE(buffer->Stencil);
buffer->Stencil = NULL;
}
/* allocate new stencil buffer */
- buffer->Stencil = (GLstencil *) MALLOC(buffer->Width * buffer->Height
- * sizeof(GLstencil));
+ buffer->Stencil = (GLstencil *)
+ MESA_PBUFFER_ALLOC(buffer->Width * buffer->Height * sizeof(GLstencil));
if (!buffer->Stencil) {
/* out of memory */
_mesa_error( NULL, GL_OUT_OF_MEMORY, "_mesa_alloc_stencil_buffer" );