-/* $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
#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
-/* $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
-/* 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 ) \
(((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 )
-/* $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"),
* 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.
*/
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
*
* 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,
-/* $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
#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 )
#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; \