diff options
-rw-r--r-- | src/mesa/main/glheader.h | 23 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 18 | ||||
-rw-r--r-- | src/mesa/main/texformat.h | 25 | ||||
-rw-r--r-- | src/mesa/main/texutil.c | 6 |
4 files changed, 48 insertions, 24 deletions
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 9f9f3edea9..3a66f618a2 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -1,4 +1,4 @@ -/* $Id: glheader.h,v 1.25 2002/03/23 01:49:58 brianp Exp $ */ +/* $Id: glheader.h,v 1.26 2002/06/12 00:52:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -162,6 +162,27 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC #endif +/* + * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. + * Do not use them unless absolutely necessary! + * Try to use a runtime test instead. + * For now, only used by some DRI hardware drivers for color/texel packing. + */ +#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#if defined(__linux__) +#include <byteswap.h> +#define CPU_TO_LE32( x ) bswap_32( x ) +#else /*__linux__*/ +#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */ +#endif /*__linux__*/ +#define MESA_BIG_ENDIAN 1 +#else +#define CPU_TO_LE32( x ) ( x ) +#define MESA_LITTLE_ENDIAN 1 +#endif +#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) + + /* This is a macro on IRIX */ #ifdef _P #undef _P diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 294c928e35..038518d90a 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,4 @@ -/* $Id: macros.h,v 1.27 2002/06/05 16:48:54 brianp Exp $ */ +/* $Id: macros.h,v 1.28 2002/06/12 00:52:50 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -454,20 +454,8 @@ do { \ -/* Byte swapping - */ - -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN -#include <byteswap.h> -#define CPU_TO_LE32( x ) bswap_32( x ) -#else -#define CPU_TO_LE32( x ) ( x ) -#endif - -#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) - - /* Generic color packing macros + * XXX We may move these into texutil.h at some point. */ #define PACK_COLOR_8888( a, b, c, d ) \ @@ -493,7 +481,7 @@ do { \ (((a) & 0xe0) | (((b) & 0xe0) >> 3) | (((c) & 0xc0) >> 6)) -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#ifdef MESA_BIG_ENDIAN #define PACK_COLOR_8888_LE( a, b, c, d ) PACK_COLOR_8888( d, c, b, a ) diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 1360c9ee1c..a8c5b52552 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -1,10 +1,10 @@ -/* $Id: texformat.h,v 1.7 2001/06/15 14:18:46 brianp Exp $ */ +/* $Id: texformat.h,v 1.8 2002/06/12 00:52:50 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * 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"), @@ -43,7 +43,7 @@ enum _format { * most useful for x86-based PC graphics card drivers. * * NOTE: In the default case, some of these formats will be - * duplicates of the default formats listed above. However, these + * duplicates of the generic formats listed below. However, these * formats guarantee their internal component sizes, while GLchan may * vary betwen GLubyte, GLushort and GLfloat. */ @@ -62,6 +62,21 @@ enum _format { MESA_FORMAT_I8, /* IIII IIII */ MESA_FORMAT_CI8, /* CCCC CCCC */ +#if 0 + /* upcoming little-endian formats: */ + + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_ABGR8888, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_BGRA8888, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_BGR565, /* BBBB BGGG GGGR RRRR */ + MESA_FORMAT_BGRA4444, /* BBBB GGGG RRRR AAAA */ + MESA_FORMAT_BGRA5551, /* BBBB BGGG GGRR RRRA */ + MESA_FORMAT_LA88, /* LLLL LLLL AAAA AAAA */ + MESA_FORMAT_BGR233, /* BBGG GRRR */ +#endif + /* Generic GLchan-based formats. These are the default formats used * by the software rasterizer and, unless the driver overrides the * texture image functions, incoming images will be converted to one @@ -70,7 +85,7 @@ enum _format { * * NOTE: Because these are based on the GLchan datatype, one cannot * assume 8 bits per channel with these formats. If you require - * GLubyte per channel, use one of the hardware formats below. + * GLubyte per channel, use one of the hardware formats above. */ MESA_FORMAT_RGBA, MESA_FORMAT_RGB, diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c index 47d320cf07..97e9c4561b 100644 --- a/src/mesa/main/texutil.c +++ b/src/mesa/main/texutil.c @@ -1,4 +1,4 @@ -/* $Id: texutil.c,v 1.29 2002/06/05 16:48:54 brianp Exp $ */ +/* $Id: texutil.c,v 1.30 2002/06/12 00:53:24 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -44,7 +44,7 @@ #define DEBUG_TEXUTIL 0 -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#ifdef MESA_BIG_ENDIAN #define APPEND16( a, b ) ( (a) << 16 | (b) ) #else #define APPEND16( a, b ) ( (a) | (b) << 16 ) @@ -417,7 +417,7 @@ CONVERT_ARGB4444( texsubimage3d ) #include "texutil_tmp.h" -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#ifdef MESA_BIG_ENDIAN #define CONVERT_TEXEL( dst, src ) \ { const GLushort s = *(GLushort *)src; \ |