aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-05 09:00:27 +0200
committermarha <marha@users.sourceforge.net>2011-09-05 09:00:27 +0200
commit51a003c23f4e27a826e56b0a3465d1e3e922d678 (patch)
tree502470d9e5724764860fe16653b0f73a77fb6983 /mesalib/src/mesa/main
parentbdc38022df44bde91e7ff95f6446cf20e19eaa5f (diff)
parent324c1ed4069c7d49d0ff7c63261281148f9b6cd8 (diff)
downloadvcxsrv-51a003c23f4e27a826e56b0a3465d1e3e922d678.tar.gz
vcxsrv-51a003c23f4e27a826e56b0a3465d1e3e922d678.tar.bz2
vcxsrv-51a003c23f4e27a826e56b0a3465d1e3e922d678.zip
Merge remote-tracking branch 'origin/released'
Conflicts: libxcb/src/xcb_in.c mesalib/src/mesa/main/formats.c mesalib/src/mesa/main/mtypes.h mesalib/src/mesa/program/ir_to_mesa.cpp mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c mesalib/src/mesa/state_tracker/st_extensions.c mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c mesalib/src/mesa/swrast/s_context.c mesalib/src/mesa/swrast/s_readpix.c
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/bufferobj.c24
-rw-r--r--mesalib/src/mesa/main/colormac.h484
-rw-r--r--mesalib/src/mesa/main/config.h716
-rw-r--r--mesalib/src/mesa/main/formats.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/texfetch_tmp.h97
6 files changed, 686 insertions, 643 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 79ca91e04..428384b35 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -1004,6 +1004,12 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
return NULL;
}
+ if (!bufObj->Size) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY,
+ "glMapBuffer(buffer size = 0)");
+ return NULL;
+ }
+
ASSERT(ctx->Driver.MapBufferRange);
map = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size, accessFlags, bufObj);
if (!map) {
@@ -1410,7 +1416,23 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
"glMapBufferRange(buffer already mapped)");
return NULL;
}
-
+
+ if (!bufObj->Size) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY,
+ "glMapBufferRange(buffer size = 0)");
+ return NULL;
+ }
+
+ /* Mapping zero bytes should return a non-null pointer. */
+ if (!length) {
+ static long dummy = 0;
+ bufObj->Pointer = &dummy;
+ bufObj->Length = length;
+ bufObj->Offset = offset;
+ bufObj->AccessFlags = access;
+ return bufObj->Pointer;
+ }
+
ASSERT(ctx->Driver.MapBufferRange);
map = ctx->Driver.MapBufferRange(ctx, offset, length, access, bufObj);
if (!map) {
diff --git a/mesalib/src/mesa/main/colormac.h b/mesalib/src/mesa/main/colormac.h
index ebad20fc4..d308c48b6 100644
--- a/mesalib/src/mesa/main/colormac.h
+++ b/mesalib/src/mesa/main/colormac.h
@@ -1,239 +1,245 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.3
- *
- * Copyright (C) 1999-2008 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"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file colormac.h
- * Color-related macros
- */
-
-
-#ifndef COLORMAC_H
-#define COLORMAC_H
-
-
-#include "config.h"
-#include "macros.h"
-#include "mtypes.h"
-
-
-/** \def BYTE_TO_CHAN
- * Convert from GLbyte to GLchan */
-
-/** \def UBYTE_TO_CHAN
- * Convert from GLubyte to GLchan */
-
-/** \def SHORT_TO_CHAN
- * Convert from GLshort to GLchan */
-
-/** \def USHORT_TO_CHAN
- * Convert from GLushort to GLchan */
-
-/** \def INT_TO_CHAN
- * Convert from GLint to GLchan */
-
-/** \def UINT_TO_CHAN
- * Convert from GLuint to GLchan */
-
-/** \def CHAN_TO_UBYTE
- * Convert from GLchan to GLubyte */
-
-/** \def CHAN_TO_FLOAT
- * Convert from GLchan to GLfloat */
-
-/** \def CLAMPED_FLOAT_TO_CHAN
- * Convert from GLclampf to GLchan */
-
-/** \def UNCLAMPED_FLOAT_TO_CHAN
- * Convert from GLfloat to GLchan */
-
-/** \def COPY_CHAN4
- * Copy a GLchan[4] array */
-
-#if CHAN_BITS == 8
-
-#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b))
-#define UBYTE_TO_CHAN(b) (b)
-#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7))
-#define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8))
-#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23))
-#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24))
-
-#define CHAN_TO_UBYTE(c) (c)
-#define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c)
-
-#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f)
-#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f)
-
-#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC)
-
-#elif CHAN_BITS == 16
-
-#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516))
-#define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b)))
-#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s))
-#define USHORT_TO_CHAN(s) (s)
-#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15))
-#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16))
-
-#define CHAN_TO_UBYTE(c) ((c) >> 8)
-#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF)))
-
-#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f)
-#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f)
-
-#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
-
-#elif CHAN_BITS == 32
-
-/* XXX floating-point color channels not fully thought-out */
-#define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F)))
-#define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F)))
-#define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F)))
-#define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F)))
-#define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F)))
-#define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F)))
-
-#define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c)
-#define CHAN_TO_FLOAT(c) (c)
-
-#define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
-#define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
-
-#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
-
-#else
-
-#error unexpected CHAN_BITS size
-
-#endif
-
-
-/**
- * Convert 3 channels at once.
- *
- * \param dst pointer to destination GLchan[3] array.
- * \param f pointer to source GLfloat[3] array.
- *
- * \sa #UNCLAMPED_FLOAT_TO_CHAN.
- */
-#define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \
-do { \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]); \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]); \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]); \
-} while (0)
-
-
-/**
- * Convert 4 channels at once.
- *
- * \param dst pointer to destination GLchan[4] array.
- * \param f pointer to source GLfloat[4] array.
- *
- * \sa #UNCLAMPED_FLOAT_TO_CHAN.
- */
-#define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \
-do { \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]); \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]); \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]); \
- UNCLAMPED_FLOAT_TO_CHAN((dst)[3], (f)[3]); \
-} while (0)
-
-
-
-/**
- * \name Generic color packing macros. All inputs should be GLubytes.
- *
- * \todo We may move these into texstore.h at some point.
- */
-/*@{*/
-
-#define PACK_COLOR_8888( X, Y, Z, W ) \
- (((X) << 24) | ((Y) << 16) | ((Z) << 8) | (W))
-
-#define PACK_COLOR_8888_REV( X, Y, Z, W ) \
- (((W) << 24) | ((Z) << 16) | ((Y) << 8) | (X))
-
-#define PACK_COLOR_888( X, Y, Z ) \
- (((X) << 16) | ((Y) << 8) | (Z))
-
-#define PACK_COLOR_565( X, Y, Z ) \
- ((((X) & 0xf8) << 8) | (((Y) & 0xfc) << 3) | (((Z) & 0xf8) >> 3))
-
-#define PACK_COLOR_565_REV( X, Y, Z ) \
- (((X) & 0xf8) | ((Y) & 0xe0) >> 5 | (((Y) & 0x1c) << 11) | (((Z) & 0xf8) << 5))
-
-#define PACK_COLOR_5551( R, G, B, A ) \
- ((((R) & 0xf8) << 8) | (((G) & 0xf8) << 3) | (((B) & 0xf8) >> 2) | \
- ((A) ? 1 : 0))
-
-#define PACK_COLOR_1555( A, B, G, R ) \
- ((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \
- ((A) ? 0x8000 : 0))
-
-#define PACK_COLOR_1555_REV( A, B, G, R ) \
- ((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \
- ((A) ? 0x80 : 0))
-
-#define PACK_COLOR_2101010_UB( A, B, G, R ) \
- (((B) << 22) | ((G) << 12) | ((R) << 2) | \
- (((A) & 0xc0) << 24))
-
-#define PACK_COLOR_2101010_US( A, B, G, R ) \
- ((((B) >> 6) << 20) | (((G) >> 6) << 10) | ((R) >> 6) | \
- (((A) >> 14) << 30))
-
-#define PACK_COLOR_4444( R, G, B, A ) \
- ((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4))
-
-#define PACK_COLOR_4444_REV( R, G, B, A ) \
- ((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4))
-
-#define PACK_COLOR_44( L, A ) \
- (((L) & 0xf0) | (((A) & 0xf0) >> 4))
-
-#define PACK_COLOR_88( L, A ) \
- (((L) << 8) | (A))
-
-#define PACK_COLOR_88_REV( L, A ) \
- (((A) << 8) | (L))
-
-#define PACK_COLOR_1616( L, A ) \
- (((L) << 16) | (A))
-
-#define PACK_COLOR_1616_REV( L, A ) \
- (((A) << 16) | (L))
-
-#define PACK_COLOR_332( R, G, B ) \
- (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6))
-
-#define PACK_COLOR_233( B, G, R ) \
- (((B) & 0xc0) | (((G) & 0xe0) >> 2) | (((R) & 0xe0) >> 5))
-
-/*@}*/
-
-
-#endif /* COLORMAC_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.3
+ *
+ * Copyright (C) 1999-2008 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file colormac.h
+ * Color-related macros
+ */
+
+
+#ifndef COLORMAC_H
+#define COLORMAC_H
+
+
+#include "config.h"
+#include "macros.h"
+#include "mtypes.h"
+
+
+/** \def BYTE_TO_CHAN
+ * Convert from GLbyte to GLchan */
+
+/** \def UBYTE_TO_CHAN
+ * Convert from GLubyte to GLchan */
+
+/** \def SHORT_TO_CHAN
+ * Convert from GLshort to GLchan */
+
+/** \def USHORT_TO_CHAN
+ * Convert from GLushort to GLchan */
+
+/** \def INT_TO_CHAN
+ * Convert from GLint to GLchan */
+
+/** \def UINT_TO_CHAN
+ * Convert from GLuint to GLchan */
+
+/** \def CHAN_TO_UBYTE
+ * Convert from GLchan to GLubyte */
+
+/** \def CHAN_TO_FLOAT
+ * Convert from GLchan to GLfloat */
+
+/** \def CLAMPED_FLOAT_TO_CHAN
+ * Convert from GLclampf to GLchan */
+
+/** \def UNCLAMPED_FLOAT_TO_CHAN
+ * Convert from GLfloat to GLchan */
+
+/** \def COPY_CHAN4
+ * Copy a GLchan[4] array */
+
+#if CHAN_BITS == 8
+
+#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (GLchan) (b))
+#define UBYTE_TO_CHAN(b) (b)
+#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) ((s) >> 7))
+#define USHORT_TO_CHAN(s) ((GLchan) ((s) >> 8))
+#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 23))
+#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 24))
+
+#define CHAN_TO_UBYTE(c) (c)
+#define CHAN_TO_USHORT(c) (((c) << 8) | (c))
+#define CHAN_TO_SHORT(c) (((c) << 7) | ((c) >> 1))
+#define CHAN_TO_FLOAT(c) UBYTE_TO_FLOAT(c)
+
+#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_UBYTE(c, f)
+#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_UBYTE(c, f)
+
+#define COPY_CHAN4(DST, SRC) COPY_4UBV(DST, SRC)
+
+#elif CHAN_BITS == 16
+
+#define BYTE_TO_CHAN(b) ((b) < 0 ? 0 : (((GLchan) (b)) * 516))
+#define UBYTE_TO_CHAN(b) ((((GLchan) (b)) << 8) | ((GLchan) (b)))
+#define SHORT_TO_CHAN(s) ((s) < 0 ? 0 : (GLchan) (s))
+#define USHORT_TO_CHAN(s) (s)
+#define INT_TO_CHAN(i) ((i) < 0 ? 0 : (GLchan) ((i) >> 15))
+#define UINT_TO_CHAN(i) ((GLchan) ((i) >> 16))
+
+#define CHAN_TO_UBYTE(c) ((c) >> 8)
+#define CHAN_TO_USHORT(c) (c)
+#define CHAN_TO_SHORT(c) ((c) >> 1)
+#define CHAN_TO_FLOAT(c) ((GLfloat) ((c) * (1.0 / CHAN_MAXF)))
+
+#define CLAMPED_FLOAT_TO_CHAN(c, f) CLAMPED_FLOAT_TO_USHORT(c, f)
+#define UNCLAMPED_FLOAT_TO_CHAN(c, f) UNCLAMPED_FLOAT_TO_USHORT(c, f)
+
+#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
+
+#elif CHAN_BITS == 32
+
+/* XXX floating-point color channels not fully thought-out */
+#define BYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 127.0F)))
+#define UBYTE_TO_CHAN(b) ((GLfloat) ((b) * (1.0F / 255.0F)))
+#define SHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 32767.0F)))
+#define USHORT_TO_CHAN(s) ((GLfloat) ((s) * (1.0F / 65535.0F)))
+#define INT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 2147483647.0F)))
+#define UINT_TO_CHAN(i) ((GLfloat) ((i) * (1.0F / 4294967295.0F)))
+
+#define CHAN_TO_UBYTE(c) FLOAT_TO_UBYTE(c)
+#define CHAN_TO_USHORT(c) ((GLushort) (CLAMP((c), 0.0f, 1.0f) * 65535.0))
+#define CHAN_TO_SHORT(c) ((GLshort) (CLAMP((c), 0.0f, 1.0f) * 32767.0))
+#define CHAN_TO_FLOAT(c) (c)
+
+#define CLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
+#define UNCLAMPED_FLOAT_TO_CHAN(c, f) c = (f)
+
+#define COPY_CHAN4(DST, SRC) COPY_4V(DST, SRC)
+
+#else
+
+#error unexpected CHAN_BITS size
+
+#endif
+
+
+/**
+ * Convert 3 channels at once.
+ *
+ * \param dst pointer to destination GLchan[3] array.
+ * \param f pointer to source GLfloat[3] array.
+ *
+ * \sa #UNCLAMPED_FLOAT_TO_CHAN.
+ */
+#define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \
+do { \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]); \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]); \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]); \
+} while (0)
+
+
+/**
+ * Convert 4 channels at once.
+ *
+ * \param dst pointer to destination GLchan[4] array.
+ * \param f pointer to source GLfloat[4] array.
+ *
+ * \sa #UNCLAMPED_FLOAT_TO_CHAN.
+ */
+#define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \
+do { \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]); \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]); \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]); \
+ UNCLAMPED_FLOAT_TO_CHAN((dst)[3], (f)[3]); \
+} while (0)
+
+
+
+/**
+ * \name Generic color packing macros. All inputs should be GLubytes.
+ *
+ * \todo We may move these into texstore.h at some point.
+ */
+/*@{*/
+
+#define PACK_COLOR_8888( X, Y, Z, W ) \
+ (((X) << 24) | ((Y) << 16) | ((Z) << 8) | (W))
+
+#define PACK_COLOR_8888_REV( X, Y, Z, W ) \
+ (((W) << 24) | ((Z) << 16) | ((Y) << 8) | (X))
+
+#define PACK_COLOR_888( X, Y, Z ) \
+ (((X) << 16) | ((Y) << 8) | (Z))
+
+#define PACK_COLOR_565( X, Y, Z ) \
+ ((((X) & 0xf8) << 8) | (((Y) & 0xfc) << 3) | (((Z) & 0xf8) >> 3))
+
+#define PACK_COLOR_565_REV( X, Y, Z ) \
+ (((X) & 0xf8) | ((Y) & 0xe0) >> 5 | (((Y) & 0x1c) << 11) | (((Z) & 0xf8) << 5))
+
+#define PACK_COLOR_5551( R, G, B, A ) \
+ ((((R) & 0xf8) << 8) | (((G) & 0xf8) << 3) | (((B) & 0xf8) >> 2) | \
+ ((A) ? 1 : 0))
+
+#define PACK_COLOR_1555( A, B, G, R ) \
+ ((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \
+ ((A) ? 0x8000 : 0))
+
+#define PACK_COLOR_1555_REV( A, B, G, R ) \
+ ((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \
+ ((A) ? 0x80 : 0))
+
+#define PACK_COLOR_2101010_UB( A, B, G, R ) \
+ (((B) << 22) | ((G) << 12) | ((R) << 2) | \
+ (((A) & 0xc0) << 24))
+
+#define PACK_COLOR_2101010_US( A, B, G, R ) \
+ ((((B) >> 6) << 20) | (((G) >> 6) << 10) | ((R) >> 6) | \
+ (((A) >> 14) << 30))
+
+#define PACK_COLOR_4444( R, G, B, A ) \
+ ((((R) & 0xf0) << 8) | (((G) & 0xf0) << 4) | ((B) & 0xf0) | ((A) >> 4))
+
+#define PACK_COLOR_4444_REV( R, G, B, A ) \
+ ((((B) & 0xf0) << 8) | (((A) & 0xf0) << 4) | ((R) & 0xf0) | ((G) >> 4))
+
+#define PACK_COLOR_44( L, A ) \
+ (((L) & 0xf0) | (((A) & 0xf0) >> 4))
+
+#define PACK_COLOR_88( L, A ) \
+ (((L) << 8) | (A))
+
+#define PACK_COLOR_88_REV( L, A ) \
+ (((A) << 8) | (L))
+
+#define PACK_COLOR_1616( L, A ) \
+ (((L) << 16) | (A))
+
+#define PACK_COLOR_1616_REV( L, A ) \
+ (((A) << 16) | (L))
+
+#define PACK_COLOR_332( R, G, B ) \
+ (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6))
+
+#define PACK_COLOR_233( B, G, R ) \
+ (((B) & 0xc0) | (((G) & 0xe0) >> 2) | (((R) & 0xe0) >> 5))
+
+/*@}*/
+
+
+#endif /* COLORMAC_H */
diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h
index a12f7f4f3..91aef90b7 100644
--- a/mesalib/src/mesa/main/config.h
+++ b/mesalib/src/mesa/main/config.h
@@ -1,358 +1,358 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- * Copyright (C) 2008 VMware, Inc. 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"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file config.h
- * Tunable configuration parameters.
- */
-
-#ifndef MESA_CONFIG_H_INCLUDED
-#define MESA_CONFIG_H_INCLUDED
-
-
-/**
- * \name OpenGL implementation limits
- */
-/*@{*/
-
-/** Maximum modelview matrix stack depth */
-#define MAX_MODELVIEW_STACK_DEPTH 32
-
-/** Maximum projection matrix stack depth */
-#define MAX_PROJECTION_STACK_DEPTH 32
-
-/** Maximum texture matrix stack depth */
-#define MAX_TEXTURE_STACK_DEPTH 10
-
-/** Maximum color matrix stack depth */
-#define MAX_COLOR_STACK_DEPTH 4
-
-/** Maximum attribute stack depth */
-#define MAX_ATTRIB_STACK_DEPTH 16
-
-/** Maximum client attribute stack depth */
-#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16
-
-/** Maximum recursion depth of display list calls */
-#define MAX_LIST_NESTING 64
-
-/** Maximum number of lights */
-#define MAX_LIGHTS 8
-
-/** Maximum user-defined clipping planes */
-#define MAX_CLIP_PLANES 6
-
-/** Maximum pixel map lookup table size */
-#define MAX_PIXEL_MAP_TABLE 256
-
-/** Maximum number of auxillary color buffers */
-#define MAX_AUX_BUFFERS 1
-
-/** Maximum order (degree) of curves */
-#ifdef AMIGA
-# define MAX_EVAL_ORDER 12
-#else
-# define MAX_EVAL_ORDER 30
-#endif
-
-/** Maximum Name stack depth */
-#define MAX_NAME_STACK_DEPTH 64
-
-/** Minimum point size */
-#define MIN_POINT_SIZE 1.0
-/** Maximum point size */
-#define MAX_POINT_SIZE 60.0
-/** Point size granularity */
-#define POINT_SIZE_GRANULARITY 0.1
-
-/** Minimum line width */
-#define MIN_LINE_WIDTH 1.0
-/** Maximum line width */
-#define MAX_LINE_WIDTH 10.0
-/** Line width granularity */
-#define LINE_WIDTH_GRANULARITY 0.1
-
-/** Max texture palette / color table size */
-#define MAX_COLOR_TABLE_SIZE 256
-
-/** Max memory to allow for a single texture image (in megabytes) */
-#define MAX_TEXTURE_MBYTES 1024
-
-/** Number of 1D/2D texture mipmap levels */
-#define MAX_TEXTURE_LEVELS 15
-
-/** Number of 3D texture mipmap levels */
-#define MAX_3D_TEXTURE_LEVELS 15
-
-/** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
-#define MAX_CUBE_TEXTURE_LEVELS 15
-
-/** Maximum rectangular texture size - GL_NV_texture_rectangle */
-#define MAX_TEXTURE_RECT_SIZE 16384
-
-/** Maximum number of layers in a 1D or 2D array texture - GL_MESA_texture_array */
-#define MAX_ARRAY_TEXTURE_LAYERS 64
-
-/**
- * Max number of texture coordinate units. This mainly just applies to
- * the fixed-function vertex code. This will be difficult to raise above
- * eight because of various vertex attribute bitvectors.
- */
-#define MAX_TEXTURE_COORD_UNITS 8
-
-/**
- * Max number of texture image units. Also determines number of texture
- * samplers in shaders.
- */
-#define MAX_TEXTURE_IMAGE_UNITS 16
-
-/**
- * Larger of MAX_TEXTURE_COORD_UNITS and MAX_TEXTURE_IMAGE_UNITS.
- * This value is only used for dimensioning arrays.
- * Either MAX_TEXTURE_COORD_UNITS or MAX_TEXTURE_IMAGE_UNITS (or the
- * corresponding ctx->Const.MaxTextureCoord/ImageUnits fields) should be
- * used almost everywhere else.
- */
-#define MAX_TEXTURE_UNITS ((MAX_TEXTURE_COORD_UNITS > MAX_TEXTURE_IMAGE_UNITS) ? MAX_TEXTURE_COORD_UNITS : MAX_TEXTURE_IMAGE_UNITS)
-
-
-/**
- * Maximum viewport/image width. Must accomodate all texture sizes too.
- */
-
-#ifndef MAX_WIDTH
-# define MAX_WIDTH 16384
-#endif
-/** Maximum viewport/image height */
-#ifndef MAX_HEIGHT
-# define MAX_HEIGHT 16384
-#endif
-
-/* XXX: hack to prevent stack overflow on windows until all temporary arrays
- * [MAX_WIDTH] are allocated from the heap */
-#ifdef WIN32
-#undef MAX_TEXTURE_LEVELS
-#undef MAX_3D_TEXTURE_LEVELS
-#undef MAX_CUBE_TEXTURE_LEVELS
-#undef MAX_TEXTURE_RECT_SIZE
-#undef MAX_WIDTH
-#undef MAX_HEIGHT
-#define MAX_TEXTURE_LEVELS 13
-#define MAX_3D_TEXTURE_LEVELS 9
-#define MAX_CUBE_TEXTURE_LEVELS 13
-#define MAX_TEXTURE_RECT_SIZE 4096
-#define MAX_WIDTH 4096
-#define MAX_HEIGHT 4096
-#endif
-
-/** Maxmimum size for CVA. May be overridden by the drivers. */
-#define MAX_ARRAY_LOCK_SIZE 3000
-
-/** Subpixel precision for antialiasing, window coordinate snapping */
-#define SUB_PIXEL_BITS 4
-
-/** Size of histogram tables */
-#define HISTOGRAM_TABLE_SIZE 256
-
-/** Max convolution filter width */
-#define MAX_CONVOLUTION_WIDTH 9
-/** Max convolution filter height */
-#define MAX_CONVOLUTION_HEIGHT 9
-
-/** For GL_ARB_texture_compression */
-#define MAX_COMPRESSED_TEXTURE_FORMATS 25
-
-/** For GL_EXT_texture_filter_anisotropic */
-#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
-
-/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
-#define MAX_TEXTURE_LOD_BIAS 14.0
-
-/** For any program target/extension */
-/*@{*/
-#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024)
-
-/**
- * Per-program constants (power of two)
- *
- * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assembly shader
- * and GLSL shader names for the same thing. They should \b always have the
- * same value. Each refers to the number of vec4 values supplied as
- * per-program parameters.
- */
-/*@{*/
-#define MAX_PROGRAM_LOCAL_PARAMS 1024
-#define MAX_UNIFORMS 1024
-/*@}*/
-
-/**
- * Per-context constants (power of two)
- *
- * \note
- * This value should always be less than or equal to \c MAX_PROGRAM_LOCAL_PARAMS
- * and \c MAX_VERTEX_PROGRAM_PARAMS. Otherwise some applications will make
- * incorrect assumptions.
- */
-#define MAX_PROGRAM_ENV_PARAMS 256
-
-#define MAX_PROGRAM_MATRICES 8
-#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
-#define MAX_PROGRAM_CALL_DEPTH 8
-#define MAX_PROGRAM_TEMPS 256
-#define MAX_PROGRAM_ADDRESS_REGS 2
-#define MAX_VARYING 16 /**< number of float[4] vectors */
-#define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS
-#define MAX_PROGRAM_INPUTS 32
-#define MAX_PROGRAM_OUTPUTS 64
-/*@}*/
-
-/** For GL_ARB_vertex_program */
-/*@{*/
-#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1
-#define MAX_VERTEX_PROGRAM_PARAMS MAX_UNIFORMS
-/*@}*/
-
-/** For GL_ARB_fragment_program */
-/*@{*/
-#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0
-/*@}*/
-
-/** For GL_NV_vertex_program */
-/*@{*/
-#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
-#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
-#define MAX_NV_VERTEX_PROGRAM_PARAMS 96
-#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
-#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
-/*@}*/
-
-/** For GL_NV_fragment_program */
-/*@{*/
-#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */
-#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96
-#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64
-#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12
-#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3
-#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2
-/*@}*/
-
-
-/** For GL_ARB_vertex_shader */
-/*@{*/
-#define MAX_VERTEX_GENERIC_ATTRIBS 16
-#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS
-#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_VERTEX_TEXTURE_IMAGE_UNITS + \
- MAX_TEXTURE_IMAGE_UNITS)
-/*@}*/
-
-
-/** For GL_ARB_draw_buffers */
-/*@{*/
-#define MAX_DRAW_BUFFERS 8
-/*@}*/
-
-
-/** For GL_EXT_framebuffer_object */
-/*@{*/
-#define MAX_COLOR_ATTACHMENTS 8
-/*@}*/
-
-/** For GL_ATI_envmap_bump - support bump mapping on first 8 units */
-#define SUPPORTED_ATI_BUMP_UNITS 0xff
-
-/** For GL_EXT_transform_feedback */
-#define MAX_FEEDBACK_ATTRIBS 32
-
-/** For GL_ARB_geometry_shader4 */
-/*@{*/
-#define MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 8
-#define MAX_GEOMETRY_VARYING_COMPONENTS 32
-#define MAX_VERTEX_VARYING_COMPONENTS 32
-#define MAX_GEOMETRY_UNIFORM_COMPONENTS 512
-#define MAX_GEOMETRY_OUTPUT_VERTICES 256
-#define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024
-/*@}*/
-
-
-/**
- * \name Mesa-specific parameters
- */
-/*@{*/
-
-
-/**
- * If non-zero use GLdouble for walking triangle edges, for better accuracy.
- */
-#define TRIANGLE_WALK_DOUBLE 0
-
-
-/**
- * Bits per depth buffer value (max is 32).
- */
-#ifndef DEFAULT_SOFTWARE_DEPTH_BITS
-#define DEFAULT_SOFTWARE_DEPTH_BITS 16
-#endif
-/** Depth buffer data type */
-#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16
-#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort
-#else
-#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint
-#endif
-
-
-/**
- * Bits per stencil value: 8
- */
-#define STENCIL_BITS 8
-
-
-/**
- * Bits per color channel: 8, 16 or 32
- */
-#ifndef CHAN_BITS
-#define CHAN_BITS 8
-#endif
-
-
-/*
- * Color channel component order
- *
- * \note Changes will almost certainly cause problems at this time.
- */
-#define RCOMP 0
-#define GCOMP 1
-#define BCOMP 2
-#define ACOMP 3
-
-
-/**
- * Maximum number of temporary vertices required for clipping.
- *
- * Used in array_cache and tnl modules.
- */
-#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
-
-
-#endif /* MESA_CONFIG_H_INCLUDED */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.5
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 2008 VMware, Inc. 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"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file config.h
+ * Tunable configuration parameters.
+ */
+
+#ifndef MESA_CONFIG_H_INCLUDED
+#define MESA_CONFIG_H_INCLUDED
+
+
+/**
+ * \name OpenGL implementation limits
+ */
+/*@{*/
+
+/** Maximum modelview matrix stack depth */
+#define MAX_MODELVIEW_STACK_DEPTH 32
+
+/** Maximum projection matrix stack depth */
+#define MAX_PROJECTION_STACK_DEPTH 32
+
+/** Maximum texture matrix stack depth */
+#define MAX_TEXTURE_STACK_DEPTH 10
+
+/** Maximum color matrix stack depth */
+#define MAX_COLOR_STACK_DEPTH 4
+
+/** Maximum attribute stack depth */
+#define MAX_ATTRIB_STACK_DEPTH 16
+
+/** Maximum client attribute stack depth */
+#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16
+
+/** Maximum recursion depth of display list calls */
+#define MAX_LIST_NESTING 64
+
+/** Maximum number of lights */
+#define MAX_LIGHTS 8
+
+/** Maximum user-defined clipping planes */
+#define MAX_CLIP_PLANES 6
+
+/** Maximum pixel map lookup table size */
+#define MAX_PIXEL_MAP_TABLE 256
+
+/** Maximum number of auxillary color buffers */
+#define MAX_AUX_BUFFERS 1
+
+/** Maximum order (degree) of curves */
+#ifdef AMIGA
+# define MAX_EVAL_ORDER 12
+#else
+# define MAX_EVAL_ORDER 30
+#endif
+
+/** Maximum Name stack depth */
+#define MAX_NAME_STACK_DEPTH 64
+
+/** Minimum point size */
+#define MIN_POINT_SIZE 1.0
+/** Maximum point size */
+#define MAX_POINT_SIZE 60.0
+/** Point size granularity */
+#define POINT_SIZE_GRANULARITY 0.1
+
+/** Minimum line width */
+#define MIN_LINE_WIDTH 1.0
+/** Maximum line width */
+#define MAX_LINE_WIDTH 10.0
+/** Line width granularity */
+#define LINE_WIDTH_GRANULARITY 0.1
+
+/** Max texture palette / color table size */
+#define MAX_COLOR_TABLE_SIZE 256
+
+/** Max memory to allow for a single texture image (in megabytes) */
+#define MAX_TEXTURE_MBYTES 1024
+
+/** Number of 1D/2D texture mipmap levels */
+#define MAX_TEXTURE_LEVELS 15
+
+/** Number of 3D texture mipmap levels */
+#define MAX_3D_TEXTURE_LEVELS 15
+
+/** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
+#define MAX_CUBE_TEXTURE_LEVELS 15
+
+/** Maximum rectangular texture size - GL_NV_texture_rectangle */
+#define MAX_TEXTURE_RECT_SIZE 16384
+
+/** Maximum number of layers in a 1D or 2D array texture - GL_MESA_texture_array */
+#define MAX_ARRAY_TEXTURE_LAYERS 64
+
+/**
+ * Max number of texture coordinate units. This mainly just applies to
+ * the fixed-function vertex code. This will be difficult to raise above
+ * eight because of various vertex attribute bitvectors.
+ */
+#define MAX_TEXTURE_COORD_UNITS 8
+
+/**
+ * Max number of texture image units. Also determines number of texture
+ * samplers in shaders.
+ */
+#define MAX_TEXTURE_IMAGE_UNITS 16
+
+/**
+ * Larger of MAX_TEXTURE_COORD_UNITS and MAX_TEXTURE_IMAGE_UNITS.
+ * This value is only used for dimensioning arrays.
+ * Either MAX_TEXTURE_COORD_UNITS or MAX_TEXTURE_IMAGE_UNITS (or the
+ * corresponding ctx->Const.MaxTextureCoord/ImageUnits fields) should be
+ * used almost everywhere else.
+ */
+#define MAX_TEXTURE_UNITS ((MAX_TEXTURE_COORD_UNITS > MAX_TEXTURE_IMAGE_UNITS) ? MAX_TEXTURE_COORD_UNITS : MAX_TEXTURE_IMAGE_UNITS)
+
+
+/**
+ * Maximum viewport/image width. Must accomodate all texture sizes too.
+ */
+
+#ifndef MAX_WIDTH
+# define MAX_WIDTH 16384
+#endif
+/** Maximum viewport/image height */
+#ifndef MAX_HEIGHT
+# define MAX_HEIGHT 16384
+#endif
+
+/* XXX: hack to prevent stack overflow on windows until all temporary arrays
+ * [MAX_WIDTH] are allocated from the heap */
+#ifdef WIN32
+#undef MAX_TEXTURE_LEVELS
+#undef MAX_3D_TEXTURE_LEVELS
+#undef MAX_CUBE_TEXTURE_LEVELS
+#undef MAX_TEXTURE_RECT_SIZE
+#undef MAX_WIDTH
+#undef MAX_HEIGHT
+#define MAX_TEXTURE_LEVELS 13
+#define MAX_3D_TEXTURE_LEVELS 9
+#define MAX_CUBE_TEXTURE_LEVELS 13
+#define MAX_TEXTURE_RECT_SIZE 4096
+#define MAX_WIDTH 4096
+#define MAX_HEIGHT 4096
+#endif
+
+/** Maxmimum size for CVA. May be overridden by the drivers. */
+#define MAX_ARRAY_LOCK_SIZE 3000
+
+/** Subpixel precision for antialiasing, window coordinate snapping */
+#define SUB_PIXEL_BITS 4
+
+/** Size of histogram tables */
+#define HISTOGRAM_TABLE_SIZE 256
+
+/** Max convolution filter width */
+#define MAX_CONVOLUTION_WIDTH 9
+/** Max convolution filter height */
+#define MAX_CONVOLUTION_HEIGHT 9
+
+/** For GL_ARB_texture_compression */
+#define MAX_COMPRESSED_TEXTURE_FORMATS 25
+
+/** For GL_EXT_texture_filter_anisotropic */
+#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
+
+/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
+#define MAX_TEXTURE_LOD_BIAS 14.0
+
+/** For any program target/extension */
+/*@{*/
+#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024)
+
+/**
+ * Per-program constants (power of two)
+ *
+ * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assembly shader
+ * and GLSL shader names for the same thing. They should \b always have the
+ * same value. Each refers to the number of vec4 values supplied as
+ * per-program parameters.
+ */
+/*@{*/
+#define MAX_PROGRAM_LOCAL_PARAMS 4096
+#define MAX_UNIFORMS 4096
+/*@}*/
+
+/**
+ * Per-context constants (power of two)
+ *
+ * \note
+ * This value should always be less than or equal to \c MAX_PROGRAM_LOCAL_PARAMS
+ * and \c MAX_VERTEX_PROGRAM_PARAMS. Otherwise some applications will make
+ * incorrect assumptions.
+ */
+#define MAX_PROGRAM_ENV_PARAMS 256
+
+#define MAX_PROGRAM_MATRICES 8
+#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
+#define MAX_PROGRAM_CALL_DEPTH 8
+#define MAX_PROGRAM_TEMPS 256
+#define MAX_PROGRAM_ADDRESS_REGS 2
+#define MAX_VARYING 16 /**< number of float[4] vectors */
+#define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS
+#define MAX_PROGRAM_INPUTS 32
+#define MAX_PROGRAM_OUTPUTS 64
+/*@}*/
+
+/** For GL_ARB_vertex_program */
+/*@{*/
+#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1
+#define MAX_VERTEX_PROGRAM_PARAMS MAX_UNIFORMS
+/*@}*/
+
+/** For GL_ARB_fragment_program */
+/*@{*/
+#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0
+/*@}*/
+
+/** For GL_NV_vertex_program */
+/*@{*/
+#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128
+#define MAX_NV_VERTEX_PROGRAM_TEMPS 12
+#define MAX_NV_VERTEX_PROGRAM_PARAMS 96
+#define MAX_NV_VERTEX_PROGRAM_INPUTS 16
+#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15
+/*@}*/
+
+/** For GL_NV_fragment_program */
+/*@{*/
+#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */
+#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96
+#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64
+#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12
+#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3
+#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2
+/*@}*/
+
+
+/** For GL_ARB_vertex_shader */
+/*@{*/
+#define MAX_VERTEX_GENERIC_ATTRIBS 16
+#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS
+#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_VERTEX_TEXTURE_IMAGE_UNITS + \
+ MAX_TEXTURE_IMAGE_UNITS)
+/*@}*/
+
+
+/** For GL_ARB_draw_buffers */
+/*@{*/
+#define MAX_DRAW_BUFFERS 8
+/*@}*/
+
+
+/** For GL_EXT_framebuffer_object */
+/*@{*/
+#define MAX_COLOR_ATTACHMENTS 8
+/*@}*/
+
+/** For GL_ATI_envmap_bump - support bump mapping on first 8 units */
+#define SUPPORTED_ATI_BUMP_UNITS 0xff
+
+/** For GL_EXT_transform_feedback */
+#define MAX_FEEDBACK_ATTRIBS 32
+
+/** For GL_ARB_geometry_shader4 */
+/*@{*/
+#define MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 8
+#define MAX_GEOMETRY_VARYING_COMPONENTS 32
+#define MAX_VERTEX_VARYING_COMPONENTS 32
+#define MAX_GEOMETRY_UNIFORM_COMPONENTS 512
+#define MAX_GEOMETRY_OUTPUT_VERTICES 256
+#define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024
+/*@}*/
+
+
+/**
+ * \name Mesa-specific parameters
+ */
+/*@{*/
+
+
+/**
+ * If non-zero use GLdouble for walking triangle edges, for better accuracy.
+ */
+#define TRIANGLE_WALK_DOUBLE 0
+
+
+/**
+ * Bits per depth buffer value (max is 32).
+ */
+#ifndef DEFAULT_SOFTWARE_DEPTH_BITS
+#define DEFAULT_SOFTWARE_DEPTH_BITS 16
+#endif
+/** Depth buffer data type */
+#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16
+#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort
+#else
+#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint
+#endif
+
+
+/**
+ * Bits per stencil value: 8
+ */
+#define STENCIL_BITS 8
+
+
+/**
+ * Bits per color channel: 8, 16 or 32
+ */
+#ifndef CHAN_BITS
+#define CHAN_BITS 8
+#endif
+
+
+/*
+ * Color channel component order
+ *
+ * \note Changes will almost certainly cause problems at this time.
+ */
+#define RCOMP 0
+#define GCOMP 1
+#define BCOMP 2
+#define ACOMP 3
+
+
+/**
+ * Maximum number of temporary vertices required for clipping.
+ *
+ * Used in array_cache and tnl modules.
+ */
+#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
+
+
+#endif /* MESA_CONFIG_H_INCLUDED */
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 47cc6ef55..2826addf9 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -47,7 +47,7 @@ struct gl_format_info
GLenum BaseFormat;
/**
- * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED,
+ * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALIZED,
* GL_UNSIGNED_INT, GL_INT, GL_FLOAT.
*/
GLenum DataType;
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 8685f0ba0..5977f17f8 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2266,11 +2266,6 @@ struct gl_shader_compiler_options
/** Driver-selectable options: */
GLboolean EmitCondCodes; /**< Use condition codes? */
GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */
- /**
- * Attempts to flatten all ir_if (OPCODE_IF) for GPUs that can't
- * support control flow.
- */
- GLboolean EmitNoIfs;
GLboolean EmitNoLoops;
GLboolean EmitNoFunctions;
GLboolean EmitNoCont; /**< Emit CONT opcode? */
@@ -2288,6 +2283,7 @@ struct gl_shader_compiler_options
GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */
/*@}*/
+ GLuint MaxIfDepth; /**< Maximum nested IF blocks */
GLuint MaxUnrollIterations;
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h
index 548d50c8e..dbed3dba9 100644
--- a/mesalib/src/mesa/main/texfetch_tmp.h
+++ b/mesalib/src/mesa/main/texfetch_tmp.h
@@ -792,9 +792,12 @@ static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLubyte *rgba = (const GLubyte *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
+ GLushort p = PACK_COLOR_565(CHAN_TO_UBYTE(rgba[RCOMP]),
+ CHAN_TO_UBYTE(rgba[GCOMP]),
+ CHAN_TO_UBYTE(rgba[BCOMP]));
+ *dst = (p >> 8) | (p << 8); /* byte swap */
}
#endif
@@ -817,9 +820,12 @@ static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
static void store_texel_argb4444(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLubyte *rgba = (const GLubyte *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+ *dst = PACK_COLOR_4444(CHAN_TO_UBYTE(rgba[ACOMP]),
+ CHAN_TO_UBYTE(rgba[RCOMP]),
+ CHAN_TO_UBYTE(rgba[GCOMP]),
+ CHAN_TO_UBYTE(rgba[BCOMP]));
}
#endif
@@ -841,9 +847,12 @@ static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLubyte *rgba = (const GLubyte *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]);
+ *dst = PACK_COLOR_4444(CHAN_TO_UBYTE(rgba[GCOMP]),
+ CHAN_TO_UBYTE(rgba[BCOMP]),
+ CHAN_TO_UBYTE(rgba[ACOMP]),
+ CHAN_TO_UBYTE(rgba[RCOMP]));
}
#endif
@@ -939,9 +948,13 @@ static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage,
static void store_texel_argb2101010(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLubyte *rgba = (const GLubyte *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_2101010_UB(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+ GLushort r = CHAN_TO_USHORT(rgba[RCOMP]);
+ GLushort g = CHAN_TO_USHORT(rgba[GCOMP]);
+ GLushort b = CHAN_TO_USHORT(rgba[BCOMP]);
+ GLushort a = CHAN_TO_USHORT(rgba[ACOMP]);
+ *dst = PACK_COLOR_2101010_US(a, r, g, b);
}
#endif
@@ -963,9 +976,11 @@ static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
static void store_texel_rg88(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLubyte *rgba = (const GLubyte *) texel;
+ const GLchan *rgba = (const GLubyte *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_88(rgba[RCOMP], rgba[GCOMP]);
+ GLubyte r = CHAN_TO_UBYTE(rgba[RCOMP]);
+ GLubyte g = CHAN_TO_UBYTE(rgba[GCOMP]);
+ *dst = PACK_COLOR_88(g, r);
}
#endif
@@ -1083,9 +1098,9 @@ static void FETCH(f_r16)(const struct gl_texture_image *texImage,
static void store_texel_r16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLushort *rgba = (const GLushort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = rgba[RCOMP];
+ *dst = CHAN_TO_USHORT(rgba[RCOMP]);
}
#endif
@@ -1131,9 +1146,11 @@ static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
static void store_texel_rg1616(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLubyte *rgba = (const GLubyte *) texel;
- GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[GCOMP]);
+ const GLchan *rgba = (const GLchan *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ GLushort r = CHAN_TO_USHORT(rgba[RCOMP]);
+ GLushort g = CHAN_TO_USHORT(rgba[GCOMP]);
+ *dst = PACK_COLOR_1616(g, r);
}
#endif
@@ -1179,9 +1196,11 @@ static void FETCH(f_al1616)( const struct gl_texture_image *texImage,
static void store_texel_al1616(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLushort *rgba = (const GLushort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]);
+ GLushort l = CHAN_TO_USHORT(rgba[RCOMP]);
+ GLushort a = CHAN_TO_USHORT(rgba[ACOMP]);
+ *dst = PACK_COLOR_1616(a, l);
}
#endif
@@ -1276,9 +1295,9 @@ static void FETCH(f_a16)( const struct gl_texture_image *texImage,
static void store_texel_a16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLushort *rgba = (const GLushort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- *dst = rgba[ACOMP];
+ *dst = CHAN_TO_USHORT(rgba[ACOMP]);
}
#endif
@@ -1995,10 +2014,10 @@ static void
store_texel_signed_rg1616(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLshort *rgba = (const GLshort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
+ dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
+ dst[1] = CHAN_TO_SHORT(rgba[GCOMP]);
}
#endif
@@ -2021,10 +2040,10 @@ static void
store_texel_signed_al1616(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLshort *rgba = (const GLshort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[ACOMP];
+ dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
+ dst[1] = CHAN_TO_SHORT(rgba[ACOMP]);
}
#endif
@@ -2047,11 +2066,11 @@ static void
store_texel_signed_rgb_16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLshort *rgba = (const GLshort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 3);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[BCOMP];
+ dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
+ dst[1] = CHAN_TO_SHORT(rgba[GCOMP]);
+ dst[2] = CHAN_TO_SHORT(rgba[BCOMP]);
}
#endif
@@ -2074,12 +2093,12 @@ static void
store_texel_signed_rgba_16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLshort *rgba = (const GLshort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[BCOMP];
- dst[3] = rgba[ACOMP];
+ dst[0] = CHAN_TO_SHORT(rgba[RCOMP]);
+ dst[1] = CHAN_TO_SHORT(rgba[GCOMP]);
+ dst[2] = CHAN_TO_SHORT(rgba[BCOMP]);
+ dst[3] = CHAN_TO_SHORT(rgba[ACOMP]);
}
#endif
@@ -2103,12 +2122,12 @@ static void
store_texel_rgba_16(struct gl_texture_image *texImage,
GLint i, GLint j, GLint k, const void *texel)
{
- const GLushort *rgba = (const GLushort *) texel;
+ const GLchan *rgba = (const GLchan *) texel;
GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
- dst[0] = rgba[RCOMP];
- dst[1] = rgba[GCOMP];
- dst[2] = rgba[BCOMP];
- dst[3] = rgba[ACOMP];
+ dst[0] = CHAN_TO_USHORT(rgba[RCOMP]);
+ dst[1] = CHAN_TO_USHORT(rgba[GCOMP]);
+ dst[2] = CHAN_TO_USHORT(rgba[BCOMP]);
+ dst[3] = CHAN_TO_USHORT(rgba[ACOMP]);
}
#endif