summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-03-27 20:32:24 +0000
committerBrian Paul <[email protected]>2001-03-27 20:32:24 +0000
commitfb8af6fc9780e6238c309487d265822fc7052a0d (patch)
treea8fc32cb0f07e8262ac67b63675b199fa4ebf948 /src/mesa
parent81e3955acff2c366f9591bc3010ca0024c968d91 (diff)
pass dst and src to CONVERT_TEXEL() macros to fix non-ANSI problems
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texutil.c134
-rw-r--r--src/mesa/main/texutil_tmp.h18
2 files changed, 76 insertions, 76 deletions
diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c
index 5b8edc1f16e..c6bf0c32da1 100644
--- a/src/mesa/main/texutil.c
+++ b/src/mesa/main/texutil.c
@@ -1,4 +1,4 @@
-/* $Id: texutil.c,v 1.19 2001/03/27 19:18:02 gareth Exp $ */
+/* $Id: texutil.c,v 1.20 2001/03/27 20:32:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -74,8 +74,8 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#define DST_TYPE GLuint
#define DST_TEXELS_PER_DWORD 1
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
#define CONVERT_DIRECT
@@ -86,10 +86,10 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[0], src[1], src[2], src[3] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[0], src[1], src[2], src[3] )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 4
@@ -98,10 +98,10 @@ typedef GLboolean (*convert_func)( struct gl_texture_convert *convert );
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[0], src[1], src[2], 0xff )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[0], src[1], src[2], 0xff )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 3
@@ -153,8 +153,8 @@ CONVERT_RGBA8888( texsubimage3d )
#define DST_TYPE GLuint
#define DST_TEXELS_PER_DWORD 1
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[3], src[2], src[1], src[0] )
#define CONVERT_DIRECT
@@ -165,10 +165,10 @@ CONVERT_RGBA8888( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( src[3], src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 4
@@ -177,10 +177,10 @@ CONVERT_RGBA8888( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_8888( 0xff, src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_8888( 0xff, src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) CONVERT_TEXEL( src )
+#define CONVERT_TEXEL_DWORD( dst, src ) CONVERT_TEXEL( dst, src )
#define SRC_TEXEL_BYTES 3
@@ -253,8 +253,8 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_565( src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
#define CONVERT_DIRECT
@@ -265,11 +265,11 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_565( src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
(PACK_COLOR_565( src[3], src[4], src[5] ) << 16))
#define SRC_TEXEL_BYTES 3
@@ -279,12 +279,12 @@ convert_texsubimage3d_rgb888( struct gl_texture_convert *convert )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_565( src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_565( src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
- (PACK_COLOR_565( src[4], src[5], src[6] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_565( src[0], src[1], src[2] )) | \
+ (PACK_COLOR_565( src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
@@ -335,8 +335,8 @@ CONVERT_RGB565( texsubimage3d )
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
#define CONVERT_DIRECT
@@ -347,12 +347,12 @@ CONVERT_RGB565( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_4444( src[3], src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) | \
- (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_4444( src[3], src[0], src[1], src[2] )) |\
+ (PACK_COLOR_4444( src[7], src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
@@ -398,8 +398,8 @@ CONVERT_ARGB4444( texsubimage3d )
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
#define CONVERT_DIRECT
@@ -410,14 +410,14 @@ CONVERT_ARGB4444( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- ({ GLushort s = *(GLushort *)src; \
- s = (s >> 1) | ((s & 1) << 15); s; })
+#define CONVERT_TEXEL( dst, src ) \
+ { const GLushort s = *(GLushort *)src; \
+ dst = (s >> 1) | ((s & 1) << 15); }
-#define CONVERT_TEXEL_DWORD( src ) \
- ({ GLuint s = *(GLuint *)src; \
- s = (((s & 0xfffefffe) >> 1) | \
- ((s & 0x00010001) << 15)); s; })
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ { const GLuint s = *(GLuint *)src; \
+ dst = (((s & 0xfffefffe) >> 1) | \
+ ((s & 0x00010001) << 15)); }
#define SRC_TEXEL_BYTES 2
@@ -426,12 +426,12 @@ CONVERT_ARGB4444( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_1555( src[3], src[0], src[1], src[2] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) | \
- (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_1555( src[3], src[0], src[1], src[2] )) |\
+ (PACK_COLOR_1555( src[7], src[4], src[5], src[6] ) << 16))
#define SRC_TEXEL_BYTES 4
@@ -482,8 +482,8 @@ CONVERT_ARGB1555( texsubimage3d )
#define DST_TYPE GLushort
#define DST_TEXELS_PER_DWORD 2
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( src[0], src[1] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( src[0], src[1] )
#define CONVERT_DIRECT
@@ -494,12 +494,12 @@ CONVERT_ARGB1555( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( src[0], 0x00 )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( src[0], 0x00 )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_88( src[0], 0x00 )) | \
- (PACK_COLOR_88( src[1], 0x00 ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_88( src[0], 0x00 )) | \
+ (PACK_COLOR_88( src[1], 0x00 ) << 16))
#define SRC_TEXEL_BYTES 1
@@ -508,12 +508,12 @@ CONVERT_ARGB1555( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( 0xff, src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( 0xff, src[0] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_88( 0xff, src[0] )) | \
- (PACK_COLOR_88( 0xff, src[1] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_88( 0xff, src[0] )) | \
+ (PACK_COLOR_88( 0xff, src[1] ) << 16))
#define SRC_TEXEL_BYTES 1
@@ -522,12 +522,12 @@ CONVERT_ARGB1555( texsubimage3d )
#include "texutil_tmp.h"
-#define CONVERT_TEXEL( src ) \
- PACK_COLOR_88( src[3], src[0] )
+#define CONVERT_TEXEL( dst, src ) \
+ dst = PACK_COLOR_88( src[3], src[0] )
-#define CONVERT_TEXEL_DWORD( src ) \
- ((PACK_COLOR_88( src[3], src[0] )) | \
- (PACK_COLOR_88( src[7], src[1] ) << 16))
+#define CONVERT_TEXEL_DWORD( dst, src ) \
+ dst = ((PACK_COLOR_88( src[3], src[0] )) | \
+ (PACK_COLOR_88( src[7], src[1] ) << 16))
#define SRC_TEXEL_BYTES 4
@@ -605,7 +605,7 @@ convert_texsubimage3d_rgb332( struct gl_texture_convert *convert )
#define DST_TYPE GLubyte
#define DST_TEXELS_PER_DWORD 4
-#define CONVERT_TEXEL( src ) src[0]
+#define CONVERT_TEXEL( dst, src ) dst = src[0]
#define CONVERT_DIRECT
diff --git a/src/mesa/main/texutil_tmp.h b/src/mesa/main/texutil_tmp.h
index 4d55e86414f..d8b8aae523b 100644
--- a/src/mesa/main/texutil_tmp.h
+++ b/src/mesa/main/texutil_tmp.h
@@ -1,4 +1,4 @@
-/* $Id: texutil_tmp.h,v 1.5 2001/03/21 16:44:08 brianp Exp $ */
+/* $Id: texutil_tmp.h,v 1.6 2001/03/27 20:32:24 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -65,7 +65,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert )
DST_TEXELS_PER_DWORD - 1) / DST_TEXELS_PER_DWORD;
for ( i = 0 ; i < dwords ; i++ ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
#endif
@@ -96,7 +96,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert )
DST_TEXELS_PER_DWORD - 1) / DST_TEXELS_PER_DWORD;
for ( i = 0 ; i < dwords ; i++ ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
#endif
@@ -131,7 +131,7 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert )
for ( row = 0 ; row < convert->height ; row++ ) {
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
dst += adjust;
@@ -166,7 +166,7 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert )
for ( img = 0 ; img < convert->depth ; img++ ) {
for ( row = 0 ; row < convert->height ; row++ ) {
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
dst += adjust;
@@ -213,7 +213,7 @@ TAG(texsubimage2d_pack)( struct gl_texture_convert *convert )
#else
const GLubyte *srcRow = src;
for ( col = width / DST_TEXELS_PER_DWORD ; col ; col-- ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
src = srcRow + srcRowStride;
@@ -258,7 +258,7 @@ TAG(texsubimage3d_pack)( struct gl_texture_convert *convert )
#else
const GLubyte *srcRow = src;
for ( col = width / DST_TEXELS_PER_DWORD ; col ; col-- ) {
- *dst++ = CONVERT_TEXEL_DWORD( src );
+ CONVERT_TEXEL_DWORD( *dst++, src );
src += SRC_TEXEL_BYTES * DST_TEXELS_PER_DWORD;
}
src = srcRow + srcRowStride;
@@ -309,7 +309,7 @@ TAG(texsubimage2d_stride_pack)( struct gl_texture_convert *convert )
#else
const GLubyte *srcRow = src;
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
src = srcRow + srcRowStride;
@@ -359,7 +359,7 @@ TAG(texsubimage3d_stride_pack)( struct gl_texture_convert *convert )
#else
const GLubyte *srcRow = src;
for ( col = 0 ; col < convert->width ; col++ ) {
- *dst++ = CONVERT_TEXEL( src );
+ CONVERT_TEXEL( *dst++, src );
src += SRC_TEXEL_BYTES;
}
src = srcRow + srcRowStride;