diff options
Diffstat (limited to 'xc/extras/Mesa/src/texutil_tmp.h')
-rw-r--r-- | xc/extras/Mesa/src/texutil_tmp.h | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/xc/extras/Mesa/src/texutil_tmp.h b/xc/extras/Mesa/src/texutil_tmp.h index 34fbfd7cf..c1fadc185 100644 --- a/xc/extras/Mesa/src/texutil_tmp.h +++ b/xc/extras/Mesa/src/texutil_tmp.h @@ -1,4 +1,4 @@ -/* $Id: texutil_tmp.h,v 1.1.1.3 2002/10/22 13:05:37 alanh Exp $ */ +/* $Id: texutil_tmp.h,v 1.10.4.1 2003/03/30 04:50:25 ldelgass Exp $ */ /* * Mesa 3-D graphics library @@ -24,11 +24,28 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Author: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ + /* - * NOTE: All 3D teximage code is untested and most definitely broken... + * For 2D and 3D texture images, we generate functions for + * - conversion without pixel unpacking and standard stride + * - conversion without pixel unpacking and non-standard stride + * - conversion with pixel unpacking and standard stride + * - conversion with pixel unpacking and non-standard stride + * + * + * Macros which need to be defined before including this file: + * TAG(x) - the function name wrapper + * DST_TYPE - the destination texel datatype (GLuint, GLushort, etc) + * DST_TEXELS_PER_DWORD - number of dest texels that'll fit in 4 bytes + * CONVERT_TEXEL - code to convert from source to dest texel + * CONVER_TEXEL_DWORD - if multiple texels fit in 4 bytes, this macros + * will convert/store multiple texels at once + * CONVERT_DIRECT - if defined, just memcpy texels from src to dest + * SRC_TEXEL_BYTES - bytes per source texel + * PRESERVE_DST_TYPE - if defined, don't undefined these macros at end */ @@ -43,7 +60,7 @@ * PRE: No pixelstore attribs, width == dstImageWidth. */ static GLboolean -TAG(texsubimage2d)( struct gl_texture_convert *convert ) +TAG(texsubimage2d)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + @@ -51,7 +68,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert ) convert->xoffset) * DST_TEXEL_BYTES); #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif #ifdef CONVERT_DIRECT @@ -79,7 +96,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert ) /* PRE: As above, height == dstImageHeight also. */ static GLboolean -TAG(texsubimage3d)( struct gl_texture_convert *convert ) +TAG(texsubimage3d)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; GLuint *dst = (GLuint *)((GLubyte *)convert->dstImage + @@ -87,7 +104,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) convert->yoffset) * convert->width + convert->xoffset) * DST_TEXEL_BYTES); #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif #ifdef CONVERT_DIRECT @@ -118,7 +135,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) * PRE: No pixelstore attribs, width != dstImageWidth. */ static GLboolean -TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_stride)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + @@ -130,11 +147,11 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -151,7 +168,7 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) /* PRE: As above, or height != dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_stride)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *)convert->srcImage; DST_TYPE *dst = (DST_TYPE *)((GLubyte *)convert->dstImage + @@ -164,11 +181,11 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { @@ -191,7 +208,7 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) * PRE: Require pixelstore attribs, width == dstImageWidth. */ static GLboolean -TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -203,7 +220,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) GLint row, col; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { @@ -249,7 +266,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) /* PRE: as above, height == dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -265,7 +282,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) GLint row, col, img; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { @@ -324,7 +341,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) * PRE: Require pixelstore attribs, width != dstImageWidth. */ static GLboolean -TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage2d_stride_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -343,11 +360,11 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -372,7 +389,7 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) /* PRE: As above, or height != dstImageHeight also. */ static GLboolean -TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert ) +TAG(texsubimage3d_stride_unpack)( const struct convert_info *convert ) { const GLubyte *src = (const GLubyte *) _mesa_image_address( convert->unpacking, convert->srcImage, @@ -396,11 +413,11 @@ TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { |