aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/main/accum.c1
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.c2
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.h1
-rw-r--r--mesalib/src/mesa/main/api_noop.c1
-rw-r--r--mesalib/src/mesa/main/api_noop.h121
-rw-r--r--mesalib/src/mesa/main/arrayobj.c2
-rw-r--r--mesalib/src/mesa/main/atifragshader.c1
-rw-r--r--mesalib/src/mesa/main/attrib.c1
-rw-r--r--mesalib/src/mesa/main/bufferobj.c2
-rw-r--r--mesalib/src/mesa/main/bufferobj.h1
-rw-r--r--mesalib/src/mesa/main/buffers.c1
-rw-r--r--mesalib/src/mesa/main/clear.c1
-rw-r--r--mesalib/src/mesa/main/colormac.h6
-rw-r--r--mesalib/src/mesa/main/colortab.c2
-rw-r--r--mesalib/src/mesa/main/compiler.h24
-rw-r--r--mesalib/src/mesa/main/condrender.c1
-rw-r--r--mesalib/src/mesa/main/context.c8
-rw-r--r--mesalib/src/mesa/main/convolve.c1
-rw-r--r--mesalib/src/mesa/main/cpuinfo.c218
-rw-r--r--mesalib/src/mesa/main/dlist.h1
-rw-r--r--mesalib/src/mesa/main/drawpix.c1
-rw-r--r--mesalib/src/mesa/main/drawtex.c2
-rw-r--r--mesalib/src/mesa/main/enable.c1
-rw-r--r--mesalib/src/mesa/main/eval.c1
-rw-r--r--mesalib/src/mesa/main/eval.h1
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/fbobject.c29
-rw-r--r--mesalib/src/mesa/main/fbobject.h3
-rw-r--r--mesalib/src/mesa/main/feedback.c1
-rw-r--r--mesalib/src/mesa/main/feedback.h1
-rw-r--r--mesalib/src/mesa/main/ffvertex_prog.c1
-rw-r--r--mesalib/src/mesa/main/formats.c7
-rw-r--r--mesalib/src/mesa/main/framebuffer.c8
-rw-r--r--mesalib/src/mesa/main/framebuffer.h3
-rw-r--r--mesalib/src/mesa/main/get.c1
-rw-r--r--mesalib/src/mesa/main/getstring.c2
-rw-r--r--mesalib/src/mesa/main/hint.c1
-rw-r--r--mesalib/src/mesa/main/histogram.c1
-rw-r--r--mesalib/src/mesa/main/image.c2
-rw-r--r--mesalib/src/mesa/main/imports.c1
-rw-r--r--mesalib/src/mesa/main/matrix.c1
-rw-r--r--mesalib/src/mesa/main/mipmap.c1
-rw-r--r--mesalib/src/mesa/main/mtypes.h3
-rw-r--r--mesalib/src/mesa/main/multisample.c1
-rw-r--r--mesalib/src/mesa/main/nvprogram.c1
-rw-r--r--mesalib/src/mesa/main/pack.c1
-rw-r--r--mesalib/src/mesa/main/pixel.c1
-rw-r--r--mesalib/src/mesa/main/pixelstore.c1
-rw-r--r--mesalib/src/mesa/main/pixeltransfer.c1
-rw-r--r--mesalib/src/mesa/main/queryobj.c1
-rw-r--r--mesalib/src/mesa/main/queryobj.h1
-rw-r--r--mesalib/src/mesa/main/rastpos.c2
-rw-r--r--mesalib/src/mesa/main/readpix.c1
-rw-r--r--mesalib/src/mesa/main/renderbuffer.c11
-rw-r--r--mesalib/src/mesa/main/renderbuffer.h6
-rw-r--r--mesalib/src/mesa/main/scissor.c1
-rw-r--r--mesalib/src/mesa/main/shaderapi.c2
-rw-r--r--mesalib/src/mesa/main/shaderobj.c2
-rw-r--r--mesalib/src/mesa/main/shared.c1
-rw-r--r--mesalib/src/mesa/main/syncobj.c2
-rw-r--r--mesalib/src/mesa/main/texcompress.c2
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.c1
-rw-r--r--mesalib/src/mesa/main/texcompress_fxt1.h123
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c2
-rw-r--r--mesalib/src/mesa/main/texenv.c1
-rw-r--r--mesalib/src/mesa/main/texenvprogram.c1
-rw-r--r--mesalib/src/mesa/main/texfetch_tmp.h6
-rw-r--r--mesalib/src/mesa/main/texformat.c311
-rw-r--r--mesalib/src/mesa/main/texgen.c801
-rw-r--r--mesalib/src/mesa/main/texgen.h169
-rw-r--r--mesalib/src/mesa/main/texgetimage.c2
-rw-r--r--mesalib/src/mesa/main/teximage.c3
-rw-r--r--mesalib/src/mesa/main/texobj.c6
-rw-r--r--mesalib/src/mesa/main/texpal.c409
-rw-r--r--mesalib/src/mesa/main/texparam.c2
-rw-r--r--mesalib/src/mesa/main/texstore.c34
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c2
-rw-r--r--mesalib/src/mesa/main/uniforms.c4
-rw-r--r--mesalib/src/mesa/main/varray.c1
-rw-r--r--mesalib/src/mesa/main/version.c3
-rw-r--r--mesalib/src/mesa/main/version.h6
-rw-r--r--mesalib/src/mesa/main/viewport.c1
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c1
-rw-r--r--mesalib/src/mesa/main/vtxfmt.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_constbuf.c27
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c7
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h14
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw_feedback.c15
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c2
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c1
-rw-r--r--mesalib/src/mesa/swrast/s_triangle.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c1
98 files changed, 1358 insertions, 1134 deletions
diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c
index 1e001ab42..752ef70b8 100644
--- a/mesalib/src/mesa/main/accum.c
+++ b/mesalib/src/mesa/main/accum.c
@@ -27,6 +27,7 @@
#include "context.h"
#include "imports.h"
#include "macros.h"
+#include "mfeatures.h"
#include "state.h"
#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index 2103d30e1..3c59e9be3 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -40,6 +40,8 @@
#include "context.h"
#include "imports.h"
#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "main/dispatch.h"
typedef void (GLAPIENTRY *array_func)( const void * );
diff --git a/mesalib/src/mesa/main/api_arrayelt.h b/mesalib/src/mesa/main/api_arrayelt.h
index 1e5c6dee0..16e938fd0 100644
--- a/mesalib/src/mesa/main/api_arrayelt.h
+++ b/mesalib/src/mesa/main/api_arrayelt.h
@@ -28,6 +28,7 @@
#define API_ARRAYELT_H
+#include "main/mfeatures.h"
#include "main/mtypes.h"
#if FEATURE_arrayelt
diff --git a/mesalib/src/mesa/main/api_noop.c b/mesalib/src/mesa/main/api_noop.c
index f13d3641b..beffa88e4 100644
--- a/mesalib/src/mesa/main/api_noop.c
+++ b/mesalib/src/mesa/main/api_noop.c
@@ -30,6 +30,7 @@
#include "context.h"
#include "light.h"
#include "macros.h"
+#include "mfeatures.h"
#include "dlist.h"
#include "eval.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/api_noop.h b/mesalib/src/mesa/main/api_noop.h
index e7fd49baf..4af2cde6b 100644
--- a/mesalib/src/mesa/main/api_noop.h
+++ b/mesalib/src/mesa/main/api_noop.h
@@ -1,60 +1,61 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 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.
- */
-
-#ifndef _API_NOOP_H
-#define _API_NOOP_H
-
-#include "main/mtypes.h"
-
-#if FEATURE_beginend
-
-extern void GLAPIENTRY
-_mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
-
-extern void GLAPIENTRY
-_mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2);
-
-extern void GLAPIENTRY
-_mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
-
-extern void GLAPIENTRY
-_mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat *param);
-
-extern void GLAPIENTRY
-_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
- const GLvoid **indices, GLsizei primcount);
-
-extern void GLAPIENTRY
-_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
- GLenum type,
- const GLvoid **indices,
- GLsizei primcount,
- const GLint *basevertex);
-
-extern void
-_mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
-
-#endif /* FEATURE_beginend */
-
-#endif /* _API_NOOP_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.1
+ *
+ * Copyright (C) 1999-2006 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.
+ */
+
+#ifndef _API_NOOP_H
+#define _API_NOOP_H
+
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
+
+#if FEATURE_beginend
+
+extern void GLAPIENTRY
+_mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
+
+extern void GLAPIENTRY
+_mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2);
+
+extern void GLAPIENTRY
+_mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
+
+extern void GLAPIENTRY
+_mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat *param);
+
+extern void GLAPIENTRY
+_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
+ const GLvoid **indices, GLsizei primcount);
+
+extern void GLAPIENTRY
+_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
+ GLenum type,
+ const GLvoid **indices,
+ GLsizei primcount,
+ const GLint *basevertex);
+
+extern void
+_mesa_noop_vtxfmt_init(GLvertexformat *vfmt);
+
+#endif /* FEATURE_beginend */
+
+#endif /* _API_NOOP_H */
diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c
index 37ecb6b97..2d85b88ae 100644
--- a/mesalib/src/mesa/main/arrayobj.c
+++ b/mesalib/src/mesa/main/arrayobj.c
@@ -43,11 +43,13 @@
#include "hash.h"
#include "imports.h"
#include "context.h"
+#include "mfeatures.h"
#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
#endif
#include "arrayobj.h"
#include "macros.h"
+#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/atifragshader.c b/mesalib/src/mesa/main/atifragshader.c
index f2a41e30b..1707f0b95 100644
--- a/mesalib/src/mesa/main/atifragshader.c
+++ b/mesalib/src/mesa/main/atifragshader.c
@@ -26,6 +26,7 @@
#include "main/hash.h"
#include "main/imports.h"
#include "main/macros.h"
+#include "main/mfeatures.h"
#include "main/enums.h"
#include "main/mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 23ba36fba..4404c9b30 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -43,6 +43,7 @@
#include "lines.h"
#include "macros.h"
#include "matrix.h"
+#include "mfeatures.h"
#include "multisample.h"
#include "points.h"
#include "polygon.h"
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 45eb3fbee..e971ee558 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -39,6 +39,8 @@
#include "context.h"
#include "bufferobj.h"
#include "fbobject.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "texobj.h"
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index 57aa82eda..cf43ad9a2 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -29,6 +29,7 @@
#define BUFFEROBJ_H
+#include "mfeatures.h"
#include "mtypes.h"
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index cdc174454..1ddf5b2c8 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -35,6 +35,7 @@
#include "colormac.h"
#include "context.h"
#include "enums.h"
+#include "mtypes.h"
#define BAD_MASK ~0u
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index 3edcbe884..ca831476b 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -36,6 +36,7 @@
#include "colormac.h"
#include "enums.h"
#include "macros.h"
+#include "mtypes.h"
#include "state.h"
diff --git a/mesalib/src/mesa/main/colormac.h b/mesalib/src/mesa/main/colormac.h
index 995183aeb..ebad20fc4 100644
--- a/mesalib/src/mesa/main/colormac.h
+++ b/mesalib/src/mesa/main/colormac.h
@@ -198,10 +198,14 @@ do { \
((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \
((A) ? 0x80 : 0))
-#define PACK_COLOR_2101010( A, B, G, R ) \
+#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))
diff --git a/mesalib/src/mesa/main/colortab.c b/mesalib/src/mesa/main/colortab.c
index a18a67ce2..9c23e253b 100644
--- a/mesalib/src/mesa/main/colortab.c
+++ b/mesalib/src/mesa/main/colortab.c
@@ -29,6 +29,8 @@
#include "context.h"
#include "image.h"
#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "pack.h"
#include "state.h"
#include "teximage.h"
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index 41cd48bc6..c1d773b18 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -60,29 +60,7 @@ extern "C" {
/**
* Get standard integer types
*/
-#if defined(_MSC_VER)
- typedef __int8 int8_t;
- typedef unsigned __int8 uint8_t;
- typedef __int16 int16_t;
- typedef unsigned __int16 uint16_t;
- typedef __int32 int32_t;
- typedef unsigned __int32 uint32_t;
- typedef __int64 int64_t;
- typedef unsigned __int64 uint64_t;
-
-# if defined(_WIN64)
- typedef __int64 intptr_t;
- typedef unsigned __int64 uintptr_t;
-# else
- typedef __int32 intptr_t;
- typedef unsigned __int32 uintptr_t;
-# endif
-
-# define INT64_C(__val) __val##i64
-# define UINT64_C(__val) __val##ui64
-#else
-# include <stdint.h>
-#endif
+#include <stdint.h>
/**
diff --git a/mesalib/src/mesa/main/condrender.c b/mesalib/src/mesa/main/condrender.c
index 250397854..2c5ed0269 100644
--- a/mesalib/src/mesa/main/condrender.c
+++ b/mesalib/src/mesa/main/condrender.c
@@ -34,6 +34,7 @@
#include "glheader.h"
#include "condrender.h"
#include "enums.h"
+#include "mtypes.h"
#include "queryobj.h"
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index a18af86a3..8a4041f68 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -955,6 +955,14 @@ _mesa_initialize_context_for_api(struct gl_context *ctx,
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
}
+ /* Mesa core handles all the formats that mesa core knows about.
+ * Drivers will want to override this list with just the formats
+ * they can handle, and confirm that appropriate fallbacks exist in
+ * _mesa_choose_tex_format().
+ */
+ memset(&ctx->TextureFormatSupported, GL_TRUE,
+ sizeof(ctx->TextureFormatSupported));
+
switch (ctx->API) {
case API_OPENGL:
#if FEATURE_dlist
diff --git a/mesalib/src/mesa/main/convolve.c b/mesalib/src/mesa/main/convolve.c
index cd725bb01..1e789dd8c 100644
--- a/mesalib/src/mesa/main/convolve.c
+++ b/mesalib/src/mesa/main/convolve.c
@@ -36,6 +36,7 @@
#include "colormac.h"
#include "convolve.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/cpuinfo.c b/mesalib/src/mesa/main/cpuinfo.c
index 35de69b18..d19aef91b 100644
--- a/mesalib/src/mesa/main/cpuinfo.c
+++ b/mesalib/src/mesa/main/cpuinfo.c
@@ -1,109 +1,109 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 2009 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.
- */
-
-
-#include "main/imports.h"
-#include "main/cpuinfo.h"
-
-
-/**
- * This function should be called before the various "cpu_has_foo" macros
- * are used.
- */
-void
-_mesa_get_cpu_features(void)
-{
-#ifdef USE_X86_ASM
- _mesa_get_x86_features();
-#endif
-}
-
-
-/**
- * Return a string describing the CPU architexture and extensions that
- * Mesa is using (such as SSE or Altivec).
- * \return information string, free it with free()
- */
-char *
-_mesa_get_cpu_string(void)
-{
-#define MAX_STRING 50
- char *buffer;
-
- buffer = (char *) malloc(MAX_STRING);
- if (!buffer)
- return NULL;
-
- buffer[0] = 0;
-
-#ifdef USE_X86_ASM
-
- if (_mesa_x86_cpu_features) {
- strcat(buffer, "x86");
- }
-
-# ifdef USE_MMX_ASM
- if (cpu_has_mmx) {
- strcat(buffer, (cpu_has_mmxext) ? "/MMX+" : "/MMX");
- }
-# endif
-# ifdef USE_3DNOW_ASM
- if (cpu_has_3dnow) {
- strcat(buffer, (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!");
- }
-# endif
-# ifdef USE_SSE_ASM
- if (cpu_has_xmm) {
- strcat(buffer, (cpu_has_xmm2) ? "/SSE2" : "/SSE");
- }
-# endif
-
-#elif defined(USE_SPARC_ASM)
-
- strcat(buffer, "SPARC");
-
-#elif defined(USE_PPC_ASM)
-
- if (_mesa_ppc_cpu_features) {
- strcat(buffer, (cpu_has_64) ? "PowerPC 64" : "PowerPC");
- }
-
-# ifdef USE_VMX_ASM
-
- if (cpu_has_vmx) {
- strcat(buffer, "/Altivec");
- }
-
-# endif
-
- if (! cpu_has_fpu) {
- strcat(buffer, "/No FPU");
- }
-
-#endif
-
- assert(strlen(buffer) < MAX_STRING);
-
- return buffer;
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.5
+ *
+ * Copyright (C) 2009 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.
+ */
+
+
+#include "main/compiler.h"
+#include "main/cpuinfo.h"
+
+
+/**
+ * This function should be called before the various "cpu_has_foo" macros
+ * are used.
+ */
+void
+_mesa_get_cpu_features(void)
+{
+#ifdef USE_X86_ASM
+ _mesa_get_x86_features();
+#endif
+}
+
+
+/**
+ * Return a string describing the CPU architexture and extensions that
+ * Mesa is using (such as SSE or Altivec).
+ * \return information string, free it with free()
+ */
+char *
+_mesa_get_cpu_string(void)
+{
+#define MAX_STRING 50
+ char *buffer;
+
+ buffer = (char *) malloc(MAX_STRING);
+ if (!buffer)
+ return NULL;
+
+ buffer[0] = 0;
+
+#ifdef USE_X86_ASM
+
+ if (_mesa_x86_cpu_features) {
+ strcat(buffer, "x86");
+ }
+
+# ifdef USE_MMX_ASM
+ if (cpu_has_mmx) {
+ strcat(buffer, (cpu_has_mmxext) ? "/MMX+" : "/MMX");
+ }
+# endif
+# ifdef USE_3DNOW_ASM
+ if (cpu_has_3dnow) {
+ strcat(buffer, (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!");
+ }
+# endif
+# ifdef USE_SSE_ASM
+ if (cpu_has_xmm) {
+ strcat(buffer, (cpu_has_xmm2) ? "/SSE2" : "/SSE");
+ }
+# endif
+
+#elif defined(USE_SPARC_ASM)
+
+ strcat(buffer, "SPARC");
+
+#elif defined(USE_PPC_ASM)
+
+ if (_mesa_ppc_cpu_features) {
+ strcat(buffer, (cpu_has_64) ? "PowerPC 64" : "PowerPC");
+ }
+
+# ifdef USE_VMX_ASM
+
+ if (cpu_has_vmx) {
+ strcat(buffer, "/Altivec");
+ }
+
+# endif
+
+ if (! cpu_has_fpu) {
+ strcat(buffer, "/No FPU");
+ }
+
+#endif
+
+ assert(strlen(buffer) < MAX_STRING);
+
+ return buffer;
+}
diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h
index 784368d1a..b954e06df 100644
--- a/mesalib/src/mesa/main/dlist.h
+++ b/mesalib/src/mesa/main/dlist.h
@@ -33,6 +33,7 @@
#define DLIST_H
+#include "main/mfeatures.h"
#include "main/mtypes.h"
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index 40a1cb5df..d7628c8f7 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -30,6 +30,7 @@
#include "enums.h"
#include "feedback.h"
#include "framebuffer.h"
+#include "mfeatures.h"
#include "readpix.h"
#include "state.h"
#include "dispatch.h"
diff --git a/mesalib/src/mesa/main/drawtex.c b/mesalib/src/mesa/main/drawtex.c
index 3e91f15bc..e386e90f6 100644
--- a/mesalib/src/mesa/main/drawtex.c
+++ b/mesalib/src/mesa/main/drawtex.c
@@ -24,6 +24,8 @@
#include "main/drawtex.h"
#include "main/state.h"
#include "main/imports.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
#if FEATURE_OES_draw_texture
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index c3dbd4a29..c91337355 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -33,6 +33,7 @@
#include "enable.h"
#include "light.h"
#include "simple_list.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "enums.h"
#include "api_arrayelt.h"
diff --git a/mesalib/src/mesa/main/eval.c b/mesalib/src/mesa/main/eval.c
index d7666a630..8eeeb2aea 100644
--- a/mesalib/src/mesa/main/eval.c
+++ b/mesalib/src/mesa/main/eval.c
@@ -43,6 +43,7 @@
#include "context.h"
#include "eval.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/eval.h b/mesalib/src/mesa/main/eval.h
index b92e41e9f..c6a37c135 100644
--- a/mesalib/src/mesa/main/eval.h
+++ b/mesalib/src/mesa/main/eval.h
@@ -37,6 +37,7 @@
#define EVAL_H
+#include "main/mfeatures.h"
#include "main/mtypes.h"
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 81978b3c1..4b656a70f 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -28,6 +28,7 @@
#include "imports.h"
#include "context.h"
#include "extensions.h"
+#include "mfeatures.h"
#include "mtypes.h"
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index fce9e5bba..4f7a527c3 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -40,6 +40,8 @@
#include "framebuffer.h"
#include "hash.h"
#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "renderbuffer.h"
#include "state.h"
#include "teximage.h"
@@ -402,8 +404,8 @@ fbo_incomplete(const char *msg, int index)
/**
* Is the given base format a legal format for a color renderbuffer?
*/
-static GLboolean
-is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
+GLboolean
+_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
{
switch (baseFormat) {
case GL_RGB:
@@ -488,7 +490,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
if (format == GL_COLOR) {
- if (!is_legal_color_format(ctx, baseFormat)) {
+ if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
att_incomplete("bad format");
att->Complete = GL_FALSE;
return;
@@ -542,8 +544,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
return;
}
if (format == GL_COLOR) {
- if (baseFormat != GL_RGB &&
- baseFormat != GL_RGBA) {
+ if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
att_incomplete("bad renderbuffer color format");
att->Complete = GL_FALSE;
return;
@@ -669,7 +670,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
f = texImg->_BaseFormat;
mesaFormat = texImg->TexFormat;
numImages++;
- if (!is_legal_color_format(ctx, f) &&
+ if (!_mesa_is_legal_color_format(ctx, f) &&
!is_legal_depth_format(ctx, f)) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
fbo_incomplete("texture attachment incomplete", -1);
@@ -793,7 +794,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
fb->Height = minHeight;
/* finally, update the visual info for the framebuffer */
- _mesa_update_framebuffer_visual(fb);
+ _mesa_update_framebuffer_visual(ctx, fb);
}
}
@@ -1172,8 +1173,17 @@ get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
switch (pname) {
case GL_RENDERBUFFER_RED_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ if (baseFormat == GL_RGB || baseFormat == GL_RGBA ||
+ baseFormat == GL_RG || baseFormat == GL_RED)
+ return _mesa_get_format_bits(format, pname);
+ else
+ return 0;
case GL_RENDERBUFFER_GREEN_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ if (baseFormat == GL_RGB || baseFormat == GL_RGBA || baseFormat == GL_RG)
+ return _mesa_get_format_bits(format, pname);
+ else
+ return 0;
case GL_RENDERBUFFER_BLUE_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
if (baseFormat == GL_RGB || baseFormat == GL_RGBA)
@@ -1182,7 +1192,8 @@ get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
return 0;
case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
- if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA)
+ if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA ||
+ baseFormat == GL_LUMINANCE_ALPHA)
return _mesa_get_format_bits(format, pname);
else
return 0;
@@ -1940,7 +1951,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
/* Some subsequent GL commands may depend on the framebuffer's visual
* after the binding is updated. Update visual info now.
*/
- _mesa_update_framebuffer_visual(fb);
+ _mesa_update_framebuffer_visual(ctx, fb);
}
diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h
index 5d250fba1..0e0e348a6 100644
--- a/mesalib/src/mesa/main/fbobject.h
+++ b/mesalib/src/mesa/main/fbobject.h
@@ -71,6 +71,9 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb
extern void
_mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb);
+extern GLboolean
+_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
+
extern GLenum
_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
diff --git a/mesalib/src/mesa/main/feedback.c b/mesalib/src/mesa/main/feedback.c
index 5ce0880c2..80565c62c 100644
--- a/mesalib/src/mesa/main/feedback.c
+++ b/mesalib/src/mesa/main/feedback.c
@@ -35,6 +35,7 @@
#include "enums.h"
#include "feedback.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/feedback.h b/mesalib/src/mesa/main/feedback.h
index 06a07725d..24ce53af4 100644
--- a/mesalib/src/mesa/main/feedback.h
+++ b/mesalib/src/mesa/main/feedback.h
@@ -27,6 +27,7 @@
#define FEEDBACK_H
+#include "main/mfeatures.h"
#include "main/mtypes.h"
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index 60b200419..281229e34 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -36,6 +36,7 @@
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/macros.h"
+#include "main/mfeatures.h"
#include "main/enums.h"
#include "main/ffvertex_prog.h"
#include "program/program.h"
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index b7aecb396..d17619ef1 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -40,9 +40,10 @@ struct gl_format_info
const char *StrName;
/**
- * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE,
- * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX,
- * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
+ * Base format is one of GL_RED, GL_RG, GL_RGB, GL_RGBA, GL_ALPHA,
+ * GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA,
+ * GL_COLOR_INDEX, GL_DEPTH_COMPONENT, GL_STENCIL_INDEX,
+ * GL_DEPTH_STENCIL, GL_DUDV_ATI.
*/
GLenum BaseFormat;
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index f8c0c6379..5833e5d58 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -522,7 +522,8 @@ _mesa_update_draw_buffer_bounds(struct gl_context *ctx)
* integer Z values.
*/
void
-_mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
+_mesa_update_framebuffer_visual(struct gl_context *ctx,
+ struct gl_framebuffer *fb)
{
GLuint i;
@@ -542,9 +543,8 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
const gl_format fmt = rb->Format;
-
- if (baseFormat == GL_RGBA || baseFormat == GL_RGB ||
- baseFormat == GL_ALPHA) {
+
+ if (_mesa_is_legal_color_format(ctx, baseFormat)) {
fb->Visual.redBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
fb->Visual.greenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
fb->Visual.blueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);
diff --git a/mesalib/src/mesa/main/framebuffer.h b/mesalib/src/mesa/main/framebuffer.h
index 6b705146a..261f84515 100644
--- a/mesalib/src/mesa/main/framebuffer.h
+++ b/mesalib/src/mesa/main/framebuffer.h
@@ -70,7 +70,8 @@ extern void
_mesa_update_draw_buffer_bounds(struct gl_context *ctx);
extern void
-_mesa_update_framebuffer_visual(struct gl_framebuffer *fb);
+_mesa_update_framebuffer_visual(struct gl_context *ctx,
+ struct gl_framebuffer *fb);
extern void
_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index cb6880a6f..f13f6572a 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -29,6 +29,7 @@
#include "extensions.h"
#include "get.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "state.h"
#include "texcompress.h"
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index 103a4942a..e55584afc 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -29,6 +29,8 @@
#include "get.h"
#include "enums.h"
#include "extensions.h"
+#include "mfeatures.h"
+#include "mtypes.h"
/**
diff --git a/mesalib/src/mesa/main/hint.c b/mesalib/src/mesa/main/hint.c
index ccec1d285..96f5f4d6b 100644
--- a/mesalib/src/mesa/main/hint.c
+++ b/mesalib/src/mesa/main/hint.c
@@ -29,6 +29,7 @@
#include "context.h"
#include "hint.h"
#include "imports.h"
+#include "mtypes.h"
diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c
index f12428121..fc79feb68 100644
--- a/mesalib/src/mesa/main/histogram.c
+++ b/mesalib/src/mesa/main/histogram.c
@@ -28,6 +28,7 @@
#include "colormac.h"
#include "histogram.h"
#include "macros.h"
+#include "mfeatures.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index 08d25c8d1..fa9e8b9bb 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -35,6 +35,8 @@
#include "image.h"
#include "imports.h"
#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
/**
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c
index 6bfa734b8..dcd8cf537 100644
--- a/mesalib/src/mesa/main/imports.c
+++ b/mesalib/src/mesa/main/imports.c
@@ -46,6 +46,7 @@
#include "imports.h"
#include "context.h"
+#include "mtypes.h"
#include "version.h"
#ifdef _GNU_SOURCE
diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c
index 3fae85cad..5ac6f8108 100644
--- a/mesalib/src/mesa/main/matrix.c
+++ b/mesalib/src/mesa/main/matrix.c
@@ -40,6 +40,7 @@
#include "context.h"
#include "enums.h"
#include "macros.h"
+#include "mfeatures.h"
#include "matrix.h"
#include "mtypes.h"
#include "math/m_matrix.h"
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index cf85782bc..d27179e86 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -30,6 +30,7 @@
#include "imports.h"
#include "formats.h"
#include "mipmap.h"
+#include "mtypes.h"
#include "teximage.h"
#include "texstore.h"
#include "image.h"
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 7cac96c1d..df84db93f 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -40,6 +40,7 @@
#include "glapi/glapi.h"
#include "math/m_matrix.h" /* GLmatrix */
#include "main/simple_list.h" /* struct simple_node */
+#include "main/formats.h" /* MESA_FORMAT_COUNT */
/**
@@ -3240,6 +3241,8 @@ struct gl_context
/** software compression/decompression supported or not */
GLboolean Mesa_DXTn;
+ GLboolean TextureFormatSupported[MESA_FORMAT_COUNT];
+
/**
* Use dp4 (rather than mul/mad) instructions for position
* transformation?
diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c
index 824778195..4eb1ab3a3 100644
--- a/mesalib/src/mesa/main/multisample.c
+++ b/mesalib/src/mesa/main/multisample.c
@@ -27,6 +27,7 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/multisample.h"
+#include "main/mtypes.h"
/**
diff --git a/mesalib/src/mesa/main/nvprogram.c b/mesalib/src/mesa/main/nvprogram.c
index 89b9bc426..6b20fdae6 100644
--- a/mesalib/src/mesa/main/nvprogram.c
+++ b/mesalib/src/mesa/main/nvprogram.c
@@ -42,6 +42,7 @@
#include "main/hash.h"
#include "main/imports.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "main/nvprogram.h"
#include "program/arbprogparse.h"
#include "program/nvfragparse.h"
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index f323c51f1..6463ddfbd 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -34,6 +34,7 @@
#include "enums.h"
#include "image.h"
#include "imports.h"
+#include "mtypes.h"
#include "pack.h"
#include "pixeltransfer.h"
#include "imports.h"
diff --git a/mesalib/src/mesa/main/pixel.c b/mesalib/src/mesa/main/pixel.c
index db1f05a58..2b4934fd3 100644
--- a/mesalib/src/mesa/main/pixel.c
+++ b/mesalib/src/mesa/main/pixel.c
@@ -33,6 +33,7 @@
#include "colormac.h"
#include "context.h"
#include "macros.h"
+#include "mfeatures.h"
#include "pixel.h"
#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/pixelstore.c b/mesalib/src/mesa/main/pixelstore.c
index 5d90391ca..f07115e6d 100644
--- a/mesalib/src/mesa/main/pixelstore.c
+++ b/mesalib/src/mesa/main/pixelstore.c
@@ -32,6 +32,7 @@
#include "bufferobj.h"
#include "context.h"
#include "pixelstore.h"
+#include "mfeatures.h"
#include "mtypes.h"
diff --git a/mesalib/src/mesa/main/pixeltransfer.c b/mesalib/src/mesa/main/pixeltransfer.c
index 67173ce3e..092ee3a14 100644
--- a/mesalib/src/mesa/main/pixeltransfer.c
+++ b/mesalib/src/mesa/main/pixeltransfer.c
@@ -33,6 +33,7 @@
#include "colormac.h"
#include "pixeltransfer.h"
#include "imports.h"
+#include "mtypes.h"
/*
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index 13d53edb8..c97179f1e 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -28,6 +28,7 @@
#include "hash.h"
#include "imports.h"
#include "queryobj.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h
index 71a93de85..4e8a1455b 100644
--- a/mesalib/src/mesa/main/queryobj.h
+++ b/mesalib/src/mesa/main/queryobj.h
@@ -27,6 +27,7 @@
#define QUERYOBJ_H
+#include "main/mfeatures.h"
#include "main/mtypes.h"
#include "main/hash.h"
diff --git a/mesalib/src/mesa/main/rastpos.c b/mesalib/src/mesa/main/rastpos.c
index 372b177c4..70f67d398 100644
--- a/mesalib/src/mesa/main/rastpos.c
+++ b/mesalib/src/mesa/main/rastpos.c
@@ -32,6 +32,8 @@
#include "context.h"
#include "feedback.h"
#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "rastpos.h"
#include "state.h"
#include "main/dispatch.h"
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index 986dbb60a..9887fd816 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -30,6 +30,7 @@
#include "framebuffer.h"
#include "formats.h"
#include "image.h"
+#include "mtypes.h"
#include "state.h"
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index ddc2fe30d..0b51ac123 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -1481,7 +1481,7 @@ _mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLboolean frontLeft, GLboolean backLeft,
GLboolean frontRight, GLboolean backRight)
{
- GLuint b;
+ gl_buffer_index b;
if (rgbBits > 16 || alphaBits > 16) {
_mesa_problem(ctx,
@@ -1545,7 +1545,7 @@ _mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLboolean frontLeft, GLboolean backLeft,
GLboolean frontRight, GLboolean backRight)
{
- GLuint b;
+ gl_buffer_index b;
/* for window system framebuffers only! */
assert(fb->Name == 0);
@@ -1883,10 +1883,11 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
/**
* Attach a renderbuffer to a framebuffer.
+ * \param bufferName one of the BUFFER_x tokens
*/
void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,
- GLuint bufferName, struct gl_renderbuffer *rb)
+ gl_buffer_index bufferName, struct gl_renderbuffer *rb)
{
assert(fb);
assert(rb);
@@ -1916,9 +1917,11 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb,
/**
* Remove the named renderbuffer from the given framebuffer.
+ * \param bufferName one of the BUFFER_x tokens
*/
void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName)
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
+ gl_buffer_index bufferName)
{
struct gl_renderbuffer *rb;
diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h
index c93eef4b8..12a06a58a 100644
--- a/mesalib/src/mesa/main/renderbuffer.h
+++ b/mesalib/src/mesa/main/renderbuffer.h
@@ -27,6 +27,7 @@
#define RENDERBUFFER_H
#include "glheader.h"
+#include "mtypes.h"
struct gl_context;
struct gl_framebuffer;
@@ -95,10 +96,11 @@ _mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
extern void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,
- GLuint bufferName, struct gl_renderbuffer *rb);
+ gl_buffer_index bufferName, struct gl_renderbuffer *rb);
extern void
-_mesa_remove_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName);
+_mesa_remove_renderbuffer(struct gl_framebuffer *fb,
+ gl_buffer_index bufferName);
extern void
_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c
index 716b16b80..16e8438c5 100644
--- a/mesalib/src/mesa/main/scissor.c
+++ b/mesalib/src/mesa/main/scissor.c
@@ -25,6 +25,7 @@
#include "main/glheader.h"
#include "main/context.h"
+#include "main/mtypes.h"
#include "main/scissor.h"
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index d84273263..bcc7ec019 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -41,6 +41,8 @@
#include "main/dispatch.h"
#include "main/enums.h"
#include "main/hash.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
#include "program/program.h"
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index 60f133691..efee05ac6 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -32,6 +32,8 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
#include "main/shaderobj.h"
#include "program/program.h"
#include "program/prog_parameter.h"
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index bfbddaaa0..9a2b90c8e 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -30,6 +30,7 @@
#include "imports.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "hash.h"
#if FEATURE_ATI_fragment_shader
diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c
index 8f53e5ab7..25307a17c 100644
--- a/mesalib/src/mesa/main/syncobj.c
+++ b/mesalib/src/mesa/main/syncobj.c
@@ -59,8 +59,10 @@
#include "imports.h"
#include "context.h"
#include "macros.h"
+#include "mfeatures.h"
#include "get.h"
#include "dispatch.h"
+#include "mtypes.h"
#if FEATURE_ARB_sync
#include "syncobj.h"
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index 52954ece4..eaebb06d3 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -34,6 +34,8 @@
#include "imports.h"
#include "colormac.h"
#include "formats.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "texcompress.h"
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c
index e6dd7f364..261014d63 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.c
+++ b/mesalib/src/mesa/main/texcompress_fxt1.c
@@ -34,6 +34,7 @@
#include "colormac.h"
#include "image.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mipmap.h"
#include "texcompress.h"
#include "texcompress_fxt1.h"
diff --git a/mesalib/src/mesa/main/texcompress_fxt1.h b/mesalib/src/mesa/main/texcompress_fxt1.h
index 38048b26c..a6beb07e5 100644
--- a/mesalib/src/mesa/main/texcompress_fxt1.h
+++ b/mesalib/src/mesa/main/texcompress_fxt1.h
@@ -1,61 +1,62 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-#ifndef TEXCOMPRESS_FXT1_H
-#define TEXCOMPRESS_FXT1_H
-
-#include "glheader.h"
-#include "texstore.h"
-
-struct gl_texture_image;
-
-#if FEATURE_texture_fxt1
-
-extern GLboolean
-_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
-
-extern GLboolean
-_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
-
-extern void
-_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-extern void
-_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
-
-#else /* FEATURE_texture_fxt1 */
-
-/* these are used only in texstore_funcs[] */
-#define _mesa_texstore_rgb_fxt1 NULL
-#define _mesa_texstore_rgba_fxt1 NULL
-
-/* these are used only in texfetch_funcs[] */
-#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
-#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
-
-#endif /* FEATURE_texture_fxt1 */
-
-#endif /* TEXCOMPRESS_FXT1_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * 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.
+ */
+
+#ifndef TEXCOMPRESS_FXT1_H
+#define TEXCOMPRESS_FXT1_H
+
+#include "glheader.h"
+#include "mfeatures.h"
+#include "texstore.h"
+
+struct gl_texture_image;
+
+#if FEATURE_texture_fxt1
+
+extern GLboolean
+_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS);
+
+extern GLboolean
+_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS);
+
+extern void
+_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+extern void
+_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
+
+#else /* FEATURE_texture_fxt1 */
+
+/* these are used only in texstore_funcs[] */
+#define _mesa_texstore_rgb_fxt1 NULL
+#define _mesa_texstore_rgba_fxt1 NULL
+
+/* these are used only in texfetch_funcs[] */
+#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL
+#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL
+
+#endif /* FEATURE_texture_fxt1 */
+
+#endif /* TEXCOMPRESS_FXT1_H */
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 3324af452..479806eca 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -39,6 +39,8 @@
#include "dlopen.h"
#include "image.h"
#include "macros.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "texcompress.h"
#include "texcompress_s3tc.h"
#include "texstore.h"
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index 5669cc4bc..c802f6f3b 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -34,6 +34,7 @@
#include "main/context.h"
#include "main/enums.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "main/texenv.h"
#include "main/texstate.h"
diff --git a/mesalib/src/mesa/main/texenvprogram.c b/mesalib/src/mesa/main/texenvprogram.c
index aa318f7de..af631af14 100644
--- a/mesalib/src/mesa/main/texenvprogram.c
+++ b/mesalib/src/mesa/main/texenvprogram.c
@@ -28,6 +28,7 @@
#include "glheader.h"
#include "imports.h"
+#include "mtypes.h"
#include "program/program.h"
#include "program/prog_parameter.h"
#include "program/prog_cache.h"
diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h
index 40f56209f..9c2b36a02 100644
--- a/mesalib/src/mesa/main/texfetch_tmp.h
+++ b/mesalib/src/mesa/main/texfetch_tmp.h
@@ -837,7 +837,7 @@ static void store_texel_argb2101010(struct gl_texture_image *texImage,
{
const GLubyte *rgba = (const GLubyte *) texel;
GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
- *dst = PACK_COLOR_2101010(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
+ *dst = PACK_COLOR_2101010_UB(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]);
}
#endif
@@ -899,8 +899,8 @@ static void FETCH(f_al44)( const struct gl_texture_image *texImage,
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
texel[GCOMP] =
- texel[BCOMP] = UBYTE_TO_FLOAT( (s & 0x0f) << 4 );
- texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xf0 );
+ texel[BCOMP] = (s & 0xf) * (1.0F / 15.0F);
+ texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
}
#if DIM == 3
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 7b0b17b25..325fb9ebc 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -34,9 +34,15 @@
#include "context.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "texcompress.h"
#include "texformat.h"
+#define RETURN_IF_SUPPORTED(f) do { \
+ if (ctx->TextureFormatSupported[f]) \
+ return f; \
+} while (0)
/**
* Choose an appropriate texture format given the format, type and
@@ -64,85 +70,132 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
/* shallow RGBA formats */
case 4:
case GL_RGBA:
+ if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+ } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
+ }
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+
case GL_RGBA8:
- return MESA_FORMAT_RGBA8888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
case GL_RGB5_A1:
- return MESA_FORMAT_ARGB1555;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
+ break;
case GL_RGBA2:
- return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+ break;
case GL_RGBA4:
- return MESA_FORMAT_ARGB4444;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+ break;
/* deep RGBA formats */
case GL_RGB10_A2:
- return MESA_FORMAT_ARGB2101010;
-
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
case GL_RGBA12:
case GL_RGBA16:
- return MESA_FORMAT_RGBA_16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
/* shallow RGB formats */
case 3:
case GL_RGB:
case GL_RGB8:
- return MESA_FORMAT_RGB888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
case GL_R3_G3_B2:
- return MESA_FORMAT_RGB332;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
case GL_RGB4:
- return MESA_FORMAT_RGB565_REV; /* just to test another format */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+ break;
case GL_RGB5:
- return MESA_FORMAT_RGB565;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+ break;
/* deep RGB formats */
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return MESA_FORMAT_RGBA_16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
/* Alpha formats */
case GL_ALPHA:
case GL_ALPHA4:
case GL_ALPHA8:
- return MESA_FORMAT_A8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+ break;
case GL_ALPHA12:
case GL_ALPHA16:
- return MESA_FORMAT_A16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+ break;
/* Luminance formats */
case 1:
case GL_LUMINANCE:
case GL_LUMINANCE4:
case GL_LUMINANCE8:
- return MESA_FORMAT_L8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+ break;
case GL_LUMINANCE12:
case GL_LUMINANCE16:
- return MESA_FORMAT_L16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+ break;
/* Luminance/Alpha formats */
case GL_LUMINANCE4_ALPHA4:
- return MESA_FORMAT_AL44;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL44);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
case 2:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE6_ALPHA2:
case GL_LUMINANCE8_ALPHA8:
- return MESA_FORMAT_AL88;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- return MESA_FORMAT_AL1616;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
case GL_INTENSITY:
case GL_INTENSITY4:
case GL_INTENSITY8:
- return MESA_FORMAT_I8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+ break;
case GL_INTENSITY12:
case GL_INTENSITY16:
- return MESA_FORMAT_I16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+ break;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
@@ -151,7 +204,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
case GL_COLOR_INDEX8_EXT:
- return MESA_FORMAT_CI8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_CI8);
+ break;
default:
; /* fallthrough */
@@ -162,9 +216,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32:
- return MESA_FORMAT_Z32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_Z32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+ break;
case GL_DEPTH_COMPONENT16:
- return MESA_FORMAT_Z16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_Z16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
default:
; /* fallthrough */
}
@@ -172,27 +229,36 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_COMPRESSED_ALPHA_ARB:
- return MESA_FORMAT_A8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+ break;
case GL_COMPRESSED_LUMINANCE_ARB:
- return MESA_FORMAT_L8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+ break;
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- return MESA_FORMAT_AL88;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
case GL_COMPRESSED_INTENSITY_ARB:
- return MESA_FORMAT_I8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+ break;
case GL_COMPRESSED_RGB_ARB:
if (ctx->Extensions.EXT_texture_compression_s3tc ||
ctx->Extensions.S3_s3tc)
- return MESA_FORMAT_RGB_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return MESA_FORMAT_RGB_FXT1;
- return MESA_FORMAT_RGB888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
case GL_COMPRESSED_RGBA_ARB:
if (ctx->Extensions.EXT_texture_compression_s3tc ||
ctx->Extensions.S3_s3tc)
- return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
if (ctx->Extensions.TDFX_texture_compression_FXT1)
- return MESA_FORMAT_RGBA_FXT1;
- return MESA_FORMAT_RGBA8888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
default:
; /* fallthrough */
}
@@ -200,9 +266,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
if (ctx->Extensions.MESA_ycbcr_texture) {
if (internalFormat == GL_YCBCR_MESA) {
if (type == GL_UNSIGNED_SHORT_8_8_MESA)
- return MESA_FORMAT_YCBCR;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR);
else
- return MESA_FORMAT_YCBCR_REV;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV);
}
}
@@ -210,9 +276,11 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_FXT1_3DFX:
- return MESA_FORMAT_RGB_FXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+ break;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return MESA_FORMAT_RGBA_FXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+ break;
default:
; /* fallthrough */
}
@@ -223,13 +291,17 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
if (ctx->Extensions.EXT_texture_compression_s3tc) {
switch (internalFormat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return MESA_FORMAT_RGB_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ break;
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return MESA_FORMAT_RGBA_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT1);
+ break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- return MESA_FORMAT_RGBA_DXT3;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
+ break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return MESA_FORMAT_RGBA_DXT5;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT5);
+ break;
default:
; /* fallthrough */
}
@@ -239,10 +311,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
- return MESA_FORMAT_RGB_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ break;
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
- return MESA_FORMAT_RGBA_DXT3;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
+ break;
default:
; /* fallthrough */
}
@@ -252,29 +326,41 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
if (ctx->Extensions.ARB_texture_float) {
switch (internalFormat) {
case GL_ALPHA16F_ARB:
- return MESA_FORMAT_ALPHA_FLOAT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
+ break;
case GL_ALPHA32F_ARB:
- return MESA_FORMAT_ALPHA_FLOAT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+ break;
case GL_LUMINANCE16F_ARB:
- return MESA_FORMAT_LUMINANCE_FLOAT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
+ break;
case GL_LUMINANCE32F_ARB:
- return MESA_FORMAT_LUMINANCE_FLOAT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+ break;
case GL_LUMINANCE_ALPHA16F_ARB:
- return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
+ break;
case GL_LUMINANCE_ALPHA32F_ARB:
- return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+ break;
case GL_INTENSITY16F_ARB:
- return MESA_FORMAT_INTENSITY_FLOAT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
+ break;
case GL_INTENSITY32F_ARB:
- return MESA_FORMAT_INTENSITY_FLOAT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+ break;
case GL_RGB16F_ARB:
- return MESA_FORMAT_RGB_FLOAT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
+ break;
case GL_RGB32F_ARB:
- return MESA_FORMAT_RGB_FLOAT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
+ break;
case GL_RGBA16F_ARB:
- return MESA_FORMAT_RGBA_FLOAT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
+ break;
case GL_RGBA32F_ARB:
- return MESA_FORMAT_RGBA_FLOAT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
default:
; /* fallthrough */
}
@@ -284,7 +370,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- return MESA_FORMAT_Z24_S8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+ break;
default:
; /* fallthrough */
}
@@ -294,7 +382,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
- return MESA_FORMAT_DUDV8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8);
+ break;
default:
; /* fallthrough */
}
@@ -304,7 +393,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
- return MESA_FORMAT_SIGNED_RGBA8888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
default:
; /* fallthrough */
}
@@ -314,24 +405,32 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_RED_SNORM:
case GL_R8_SNORM:
- return MESA_FORMAT_SIGNED_R8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8);
+ break;
case GL_RG_SNORM:
case GL_RG8_SNORM:
- return MESA_FORMAT_SIGNED_RG88;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88);
+ break;
case GL_RGB_SNORM:
case GL_RGB8_SNORM:
- return MESA_FORMAT_SIGNED_RGBX8888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
+ break;
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
- return MESA_FORMAT_SIGNED_RGBA8888;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ break;
case GL_R16_SNORM:
- return MESA_FORMAT_SIGNED_R_16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R_16);
+ break;
case GL_RG16_SNORM:
- return MESA_FORMAT_SIGNED_RG_16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG_16);
+ break;
case GL_RGB16_SNORM:
- return MESA_FORMAT_SIGNED_RGB_16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16);
+ break;
case GL_RGBA16_SNORM:
- return MESA_FORMAT_SIGNED_RGBA_16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
+ break;
default:
; /* fall-through */
}
@@ -342,48 +441,68 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
switch (internalFormat) {
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
- return MESA_FORMAT_SRGB8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
- return MESA_FORMAT_SRGBA8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
- return MESA_FORMAT_SL8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_SLUMINANCE_ALPHA_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
- return MESA_FORMAT_SLA8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_COMPRESSED_SLUMINANCE_EXT:
- return MESA_FORMAT_SL8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- return MESA_FORMAT_SLA8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_COMPRESSED_SRGB_EXT:
#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGB_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
#endif
- return MESA_FORMAT_SRGB8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
case GL_COMPRESSED_SRGB_ALPHA_EXT:
#if FEATURE_texture_s3tc
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
#endif
- return MESA_FORMAT_SRGBA8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
#if FEATURE_texture_s3tc
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGB_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT1;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT3;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
if (ctx->Extensions.EXT_texture_compression_s3tc)
- return MESA_FORMAT_SRGBA_DXT5;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
break;
#endif
default:
@@ -400,42 +519,48 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_INTENSITY32UI_EXT:
case GL_LUMINANCE32UI_EXT:
case GL_LUMINANCE_ALPHA32UI_EXT:
- return MESA_FORMAT_RGBA_UINT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
case GL_RGBA16UI_EXT:
case GL_RGB16UI_EXT:
case GL_ALPHA16UI_EXT:
case GL_INTENSITY16UI_EXT:
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE_ALPHA16UI_EXT:
- return MESA_FORMAT_RGBA_UINT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
case GL_RGBA8UI_EXT:
case GL_RGB8UI_EXT:
case GL_ALPHA8UI_EXT:
case GL_INTENSITY8UI_EXT:
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT:
- return MESA_FORMAT_RGBA_UINT8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
case GL_ALPHA32I_EXT:
case GL_INTENSITY32I_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE_ALPHA32I_EXT:
- return MESA_FORMAT_RGBA_INT32;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
case GL_RGBA16I_EXT:
case GL_RGB16I_EXT:
case GL_ALPHA16I_EXT:
case GL_INTENSITY16I_EXT:
case GL_LUMINANCE16I_EXT:
case GL_LUMINANCE_ALPHA16I_EXT:
- return MESA_FORMAT_RGBA_INT16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
case GL_RGBA8I_EXT:
case GL_RGB8I_EXT:
case GL_ALPHA8I_EXT:
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
- return MESA_FORMAT_RGBA_INT8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
}
}
@@ -444,18 +569,22 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
case GL_R8:
case GL_RED:
case GL_COMPRESSED_RED:
- return MESA_FORMAT_R8;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
+ break;
case GL_R16:
- return MESA_FORMAT_R16;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R16);
+ break;
case GL_RG:
case GL_RG8:
case GL_COMPRESSED_RG:
- return MESA_FORMAT_RG88;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
+ break;
case GL_RG16:
- return MESA_FORMAT_RG1616;
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG1616);
+ break;
default:
; /* fallthrough */
diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c
index 108ea4cd4..10eaa89ad 100644
--- a/mesalib/src/mesa/main/texgen.c
+++ b/mesalib/src/mesa/main/texgen.c
@@ -1,400 +1,401 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.5
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 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 texgen.c
- *
- * glTexGen-related functions
- */
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-#include "main/enums.h"
-#include "main/macros.h"
-#include "main/texgen.h"
-#include "main/texstate.h"
-#include "math/m_matrix.h"
-#include "main/dispatch.h"
-
-
-#if FEATURE_texgen
-
-
-/**
- * Return texgen state for given coordinate
- */
-static struct gl_texgen *
-get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
-{
- switch (coord) {
- case GL_S:
- return &texUnit->GenS;
- case GL_T:
- return &texUnit->GenT;
- case GL_R:
- return &texUnit->GenR;
- case GL_Q:
- return &texUnit->GenQ;
- default:
- return NULL;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
- _mesa_lookup_enum_by_nr(coord),
- _mesa_lookup_enum_by_nr(pname),
- *params,
- _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- {
- GLenum mode = (GLenum) (GLint) params[0];
- GLbitfield bit = 0x0;
- if (texgen->Mode == mode)
- return;
- switch (mode) {
- case GL_OBJECT_LINEAR:
- bit = TEXGEN_OBJ_LINEAR;
- break;
- case GL_EYE_LINEAR:
- bit = TEXGEN_EYE_LINEAR;
- break;
- case GL_SPHERE_MAP:
- if (coord == GL_S || coord == GL_T)
- bit = TEXGEN_SPHERE_MAP;
- break;
- case GL_REFLECTION_MAP_NV:
- if (coord != GL_Q)
- bit = TEXGEN_REFLECTION_MAP_NV;
- break;
- case GL_NORMAL_MAP_NV:
- if (coord != GL_Q)
- bit = TEXGEN_NORMAL_MAP_NV;
- break;
- default:
- ; /* nop */
- }
- if (!bit) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
- return;
- }
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texgen->Mode = mode;
- texgen->_ModeBit = bit;
- }
- break;
-
- case GL_OBJECT_PLANE:
- {
- if (TEST_EQ_4V(texgen->ObjectPlane, params))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texgen->ObjectPlane, params);
- }
- break;
-
- case GL_EYE_PLANE:
- {
- GLfloat tmp[4];
- /* Transform plane equation by the inverse modelview matrix */
- if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
- _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
- }
- _mesa_transform_vector(tmp, params,
- ctx->ModelviewMatrixStack.Top->inv);
- if (TEST_EQ_4V(texgen->EyePlane, tmp))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texgen->EyePlane, tmp);
- }
- break;
-
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
- return;
- }
-
- if (ctx->Driver.TexGen)
- ctx->Driver.TexGen( ctx, coord, pname, params );
-}
-
-
-static void GLAPIENTRY
-_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- if (pname == GL_TEXTURE_GEN_MODE) {
- p[1] = p[2] = p[3] = 0.0F;
- }
- else {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- }
- _mesa_TexGenfv(coord, pname, p);
-}
-
-
-static void GLAPIENTRY
-_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
-{
- GLfloat p[4];
- p[0] = (GLfloat) param;
- p[1] = p[2] = p[3] = 0.0F;
- _mesa_TexGenfv( coord, pname, p );
-}
-
-#if FEATURE_ES1
-
-void GLAPIENTRY
-_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
-{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
- _mesa_GetTexGenfv(GL_S, pname, params);
-}
-
-
-void GLAPIENTRY
-_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
-{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
- /* set S, T, and R at the same time */
- _mesa_TexGenf(GL_S, pname, param);
- _mesa_TexGenf(GL_T, pname, param);
- _mesa_TexGenf(GL_R, pname, param);
-}
-
-
-void GLAPIENTRY
-_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
-{
- ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
- /* set S, T, and R at the same time */
- _mesa_TexGenfv(GL_S, pname, params);
- _mesa_TexGenfv(GL_T, pname, params);
- _mesa_TexGenfv(GL_R, pname, params);
-}
-
-#endif
-
-static void GLAPIENTRY
-_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
-{
- GLfloat p[4];
- p[0] = (GLfloat) params[0];
- if (pname == GL_TEXTURE_GEN_MODE) {
- p[1] = p[2] = p[3] = 0.0F;
- }
- else {
- p[1] = (GLfloat) params[1];
- p[2] = (GLfloat) params[2];
- p[3] = (GLfloat) params[3];
- }
- _mesa_TexGenfv( coord, pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
-{
- GLfloat p[4];
- p[0] = param;
- p[1] = p[2] = p[3] = 0.0F;
- _mesa_TexGenfv(coord, pname, p);
-}
-
-
-void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
-{
- GLint p[4];
- p[0] = param;
- p[1] = p[2] = p[3] = 0;
- _mesa_TexGeniv( coord, pname, p );
-}
-
-
-
-static void GLAPIENTRY
-_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- params[0] = ENUM_TO_DOUBLE(texgen->Mode);
- break;
- case GL_OBJECT_PLANE:
- COPY_4V(params, texgen->ObjectPlane);
- break;
- case GL_EYE_PLANE:
- COPY_4V(params, texgen->EyePlane);
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
- }
-}
-
-
-
-void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- params[0] = ENUM_TO_FLOAT(texgen->Mode);
- break;
- case GL_OBJECT_PLANE:
- COPY_4V(params, texgen->ObjectPlane);
- break;
- case GL_EYE_PLANE:
- COPY_4V(params, texgen->EyePlane);
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
- }
-}
-
-
-
-static void GLAPIENTRY
-_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texgen *texgen;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- texgen = get_texgen(texUnit, coord);
- if (!texgen) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
- return;
- }
-
- switch (pname) {
- case GL_TEXTURE_GEN_MODE:
- params[0] = texgen->Mode;
- break;
- case GL_OBJECT_PLANE:
- params[0] = (GLint) texgen->ObjectPlane[0];
- params[1] = (GLint) texgen->ObjectPlane[1];
- params[2] = (GLint) texgen->ObjectPlane[2];
- params[3] = (GLint) texgen->ObjectPlane[3];
- break;
- case GL_EYE_PLANE:
- params[0] = (GLint) texgen->EyePlane[0];
- params[1] = (GLint) texgen->EyePlane[1];
- params[2] = (GLint) texgen->EyePlane[2];
- params[3] = (GLint) texgen->EyePlane[3];
- break;
- default:
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
- }
-}
-
-
-void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp)
-{
- SET_GetTexGendv(disp, _mesa_GetTexGendv);
- SET_GetTexGenfv(disp, _mesa_GetTexGenfv);
- SET_GetTexGeniv(disp, _mesa_GetTexGeniv);
- SET_TexGend(disp, _mesa_TexGend);
- SET_TexGendv(disp, _mesa_TexGendv);
- SET_TexGenf(disp, _mesa_TexGenf);
- SET_TexGenfv(disp, _mesa_TexGenfv);
- SET_TexGeni(disp, _mesa_TexGeni);
- SET_TexGeniv(disp, _mesa_TexGeniv);
-}
-
-
-#endif /* FEATURE_texgen */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.5
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 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 texgen.c
+ *
+ * glTexGen-related functions
+ */
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/macros.h"
+#include "main/mfeatures.h"
+#include "main/texgen.h"
+#include "main/texstate.h"
+#include "math/m_matrix.h"
+#include "main/dispatch.h"
+
+
+#if FEATURE_texgen
+
+
+/**
+ * Return texgen state for given coordinate
+ */
+static struct gl_texgen *
+get_texgen(struct gl_texture_unit *texUnit, GLenum coord)
+{
+ switch (coord) {
+ case GL_S:
+ return &texUnit->GenS;
+ case GL_T:
+ return &texUnit->GenT;
+ case GL_R:
+ return &texUnit->GenR;
+ case GL_Q:
+ return &texUnit->GenQ;
+ default:
+ return NULL;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texgen *texgen;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))
+ _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n",
+ _mesa_lookup_enum_by_nr(coord),
+ _mesa_lookup_enum_by_nr(pname),
+ *params,
+ _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");
+ return;
+ }
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
+
+ texgen = get_texgen(texUnit, coord);
+ if (!texgen) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE:
+ {
+ GLenum mode = (GLenum) (GLint) params[0];
+ GLbitfield bit = 0x0;
+ if (texgen->Mode == mode)
+ return;
+ switch (mode) {
+ case GL_OBJECT_LINEAR:
+ bit = TEXGEN_OBJ_LINEAR;
+ break;
+ case GL_EYE_LINEAR:
+ bit = TEXGEN_EYE_LINEAR;
+ break;
+ case GL_SPHERE_MAP:
+ if (coord == GL_S || coord == GL_T)
+ bit = TEXGEN_SPHERE_MAP;
+ break;
+ case GL_REFLECTION_MAP_NV:
+ if (coord != GL_Q)
+ bit = TEXGEN_REFLECTION_MAP_NV;
+ break;
+ case GL_NORMAL_MAP_NV:
+ if (coord != GL_Q)
+ bit = TEXGEN_NORMAL_MAP_NV;
+ break;
+ default:
+ ; /* nop */
+ }
+ if (!bit) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
+ return;
+ }
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ texgen->Mode = mode;
+ texgen->_ModeBit = bit;
+ }
+ break;
+
+ case GL_OBJECT_PLANE:
+ {
+ if (TEST_EQ_4V(texgen->ObjectPlane, params))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texgen->ObjectPlane, params);
+ }
+ break;
+
+ case GL_EYE_PLANE:
+ {
+ GLfloat tmp[4];
+ /* Transform plane equation by the inverse modelview matrix */
+ if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
+ _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
+ }
+ _mesa_transform_vector(tmp, params,
+ ctx->ModelviewMatrixStack.Top->inv);
+ if (TEST_EQ_4V(texgen->EyePlane, tmp))
+ return;
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ COPY_4FV(texgen->EyePlane, tmp);
+ }
+ break;
+
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
+ return;
+ }
+
+ if (ctx->Driver.TexGen)
+ ctx->Driver.TexGen( ctx, coord, pname, params );
+}
+
+
+static void GLAPIENTRY
+_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ if (pname == GL_TEXTURE_GEN_MODE) {
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ else {
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ }
+ _mesa_TexGenfv(coord, pname, p);
+}
+
+
+static void GLAPIENTRY
+_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) param;
+ p[1] = p[2] = p[3] = 0.0F;
+ _mesa_TexGenfv( coord, pname, p );
+}
+
+#if FEATURE_ES1
+
+void GLAPIENTRY
+_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
+{
+ ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ _mesa_GetTexGenfv(GL_S, pname, params);
+}
+
+
+void GLAPIENTRY
+_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
+{
+ ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ /* set S, T, and R at the same time */
+ _mesa_TexGenf(GL_S, pname, param);
+ _mesa_TexGenf(GL_T, pname, param);
+ _mesa_TexGenf(GL_R, pname, param);
+}
+
+
+void GLAPIENTRY
+_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
+{
+ ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
+ /* set S, T, and R at the same time */
+ _mesa_TexGenfv(GL_S, pname, params);
+ _mesa_TexGenfv(GL_T, pname, params);
+ _mesa_TexGenfv(GL_R, pname, params);
+}
+
+#endif
+
+static void GLAPIENTRY
+_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
+{
+ GLfloat p[4];
+ p[0] = (GLfloat) params[0];
+ if (pname == GL_TEXTURE_GEN_MODE) {
+ p[1] = p[2] = p[3] = 0.0F;
+ }
+ else {
+ p[1] = (GLfloat) params[1];
+ p[2] = (GLfloat) params[2];
+ p[3] = (GLfloat) params[3];
+ }
+ _mesa_TexGenfv( coord, pname, p );
+}
+
+
+void GLAPIENTRY
+_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
+{
+ GLfloat p[4];
+ p[0] = param;
+ p[1] = p[2] = p[3] = 0.0F;
+ _mesa_TexGenfv(coord, pname, p);
+}
+
+
+void GLAPIENTRY
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+ GLint p[4];
+ p[0] = param;
+ p[1] = p[2] = p[3] = 0;
+ _mesa_TexGeniv( coord, pname, p );
+}
+
+
+
+static void GLAPIENTRY
+_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texgen *texgen;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)");
+ return;
+ }
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
+
+ texgen = get_texgen(texUnit, coord);
+ if (!texgen) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE:
+ params[0] = ENUM_TO_DOUBLE(texgen->Mode);
+ break;
+ case GL_OBJECT_PLANE:
+ COPY_4V(params, texgen->ObjectPlane);
+ break;
+ case GL_EYE_PLANE:
+ COPY_4V(params, texgen->EyePlane);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" );
+ }
+}
+
+
+
+void GLAPIENTRY
+_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texgen *texgen;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)");
+ return;
+ }
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
+
+ texgen = get_texgen(texUnit, coord);
+ if (!texgen) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE:
+ params[0] = ENUM_TO_FLOAT(texgen->Mode);
+ break;
+ case GL_OBJECT_PLANE:
+ COPY_4V(params, texgen->ObjectPlane);
+ break;
+ case GL_EYE_PLANE:
+ COPY_4V(params, texgen->EyePlane);
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" );
+ }
+}
+
+
+
+static void GLAPIENTRY
+_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+{
+ struct gl_texture_unit *texUnit;
+ struct gl_texgen *texgen;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)");
+ return;
+ }
+
+ texUnit = _mesa_get_current_tex_unit(ctx);
+
+ texgen = get_texgen(texUnit, coord);
+ if (!texgen) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)");
+ return;
+ }
+
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE:
+ params[0] = texgen->Mode;
+ break;
+ case GL_OBJECT_PLANE:
+ params[0] = (GLint) texgen->ObjectPlane[0];
+ params[1] = (GLint) texgen->ObjectPlane[1];
+ params[2] = (GLint) texgen->ObjectPlane[2];
+ params[3] = (GLint) texgen->ObjectPlane[3];
+ break;
+ case GL_EYE_PLANE:
+ params[0] = (GLint) texgen->EyePlane[0];
+ params[1] = (GLint) texgen->EyePlane[1];
+ params[2] = (GLint) texgen->EyePlane[2];
+ params[3] = (GLint) texgen->EyePlane[3];
+ break;
+ default:
+ _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" );
+ }
+}
+
+
+void
+_mesa_init_texgen_dispatch(struct _glapi_table *disp)
+{
+ SET_GetTexGendv(disp, _mesa_GetTexGendv);
+ SET_GetTexGenfv(disp, _mesa_GetTexGenfv);
+ SET_GetTexGeniv(disp, _mesa_GetTexGeniv);
+ SET_TexGend(disp, _mesa_TexGend);
+ SET_TexGendv(disp, _mesa_TexGendv);
+ SET_TexGenf(disp, _mesa_TexGenf);
+ SET_TexGenfv(disp, _mesa_TexGenfv);
+ SET_TexGeni(disp, _mesa_TexGeni);
+ SET_TexGeniv(disp, _mesa_TexGeniv);
+}
+
+
+#endif /* FEATURE_texgen */
diff --git a/mesalib/src/mesa/main/texgen.h b/mesalib/src/mesa/main/texgen.h
index 9ed802383..9160af002 100644
--- a/mesalib/src/mesa/main/texgen.h
+++ b/mesalib/src/mesa/main/texgen.h
@@ -1,84 +1,85 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * 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.
- */
-
-
-#ifndef TEXGEN_H
-#define TEXGEN_H
-
-
-#include "compiler.h"
-#include "glheader.h"
-
-struct _glapi_table;
-
-
-#if FEATURE_texgen
-
-extern void GLAPIENTRY
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
-
-extern void GLAPIENTRY
-_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
-
-extern void GLAPIENTRY
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
-
-extern void GLAPIENTRY
-_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
-
-extern void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp);
-
-
-extern void GLAPIENTRY
-_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
-
-extern void GLAPIENTRY
-_es_TexGenf(GLenum coord, GLenum pname, GLfloat param);
-
-extern void GLAPIENTRY
-_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
-
-
-#else /* FEATURE_texgen */
-
-static void
-_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
-{
-}
-
-static void INLINE
-_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
-{
-}
-
-static INLINE void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_texgen */
-
-
-#endif /* TEXGEN_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * 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.
+ */
+
+
+#ifndef TEXGEN_H
+#define TEXGEN_H
+
+
+#include "compiler.h"
+#include "glheader.h"
+#include "mfeatures.h"
+
+struct _glapi_table;
+
+
+#if FEATURE_texgen
+
+extern void GLAPIENTRY
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+
+extern void GLAPIENTRY
+_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param );
+
+extern void GLAPIENTRY
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param );
+
+extern void GLAPIENTRY
+_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+
+extern void
+_mesa_init_texgen_dispatch(struct _glapi_table *disp);
+
+
+extern void GLAPIENTRY
+_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
+
+extern void GLAPIENTRY
+_es_TexGenf(GLenum coord, GLenum pname, GLfloat param);
+
+extern void GLAPIENTRY
+_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
+
+
+#else /* FEATURE_texgen */
+
+static void
+_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+}
+
+static void INLINE
+_mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+}
+
+static INLINE void
+_mesa_init_texgen_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_texgen */
+
+
+#endif /* TEXGEN_H */
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 227a670da..36bd02a6c 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -35,6 +35,8 @@
#include "context.h"
#include "formats.h"
#include "image.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "pack.h"
#include "texgetimage.h"
#include "teximage.h"
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index f62074a1b..a4143ba45 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -40,6 +40,7 @@
#include "image.h"
#include "imports.h"
#include "macros.h"
+#include "mfeatures.h"
#include "state.h"
#include "texcompress.h"
#include "texfetch.h"
@@ -340,11 +341,11 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
return GL_RGBA;
case GL_SLUMINANCE_ALPHA_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
- case GL_COMPRESSED_SLUMINANCE_EXT:
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
return GL_LUMINANCE_ALPHA;
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
+ case GL_COMPRESSED_SLUMINANCE_EXT:
return GL_LUMINANCE;
default:
; /* fallthrough */
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 6a038514b..831dbc5b6 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -470,6 +470,12 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
ASSERT(maxLevels > 0);
+ if (t->MaxLevel < t->BaseLevel) {
+ incomplete(t, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
+ t->MaxLevel, t->BaseLevel);
+ return;
+ }
+
t->_MaxLevel = baseLevel + maxLog2;
t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1);
diff --git a/mesalib/src/mesa/main/texpal.c b/mesalib/src/mesa/main/texpal.c
index a25e7aa4f..801914462 100644
--- a/mesalib/src/mesa/main/texpal.c
+++ b/mesalib/src/mesa/main/texpal.c
@@ -1,204 +1,205 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- **************************************************************************/
-
-
-/**
- * Code to convert compressed/paletted texture images to ordinary images.
- * See the GL_OES_compressed_paletted_texture spec at
- * http://khronos.org/registry/gles/extensions/OES/OES_compressed_paletted_texture.txt
- *
- * XXX this makes it impossible to add hardware support...
- */
-
-
-#include "glheader.h"
-#include "compiler.h" /* for ASSERT */
-#include "context.h"
-#include "mtypes.h"
-#include "imports.h"
-#include "pixelstore.h"
-#include "teximage.h"
-#include "texpal.h"
-
-#if FEATURE_ES
-
-
-static const struct cpal_format_info {
- GLenum cpal_format;
- GLenum format;
- GLenum type;
- GLuint palette_size;
- GLuint size;
-} formats[] = {
- { GL_PALETTE4_RGB8_OES, GL_RGB, GL_UNSIGNED_BYTE, 16, 3 },
- { GL_PALETTE4_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE, 16, 4 },
- { GL_PALETTE4_R5_G6_B5_OES, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 16, 2 },
- { GL_PALETTE4_RGBA4_OES, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 16, 2 },
- { GL_PALETTE4_RGB5_A1_OES, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 16, 2 },
- { GL_PALETTE8_RGB8_OES, GL_RGB, GL_UNSIGNED_BYTE, 256, 3 },
- { GL_PALETTE8_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE, 256, 4 },
- { GL_PALETTE8_R5_G6_B5_OES, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 256, 2 },
- { GL_PALETTE8_RGBA4_OES, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 256, 2 },
- { GL_PALETTE8_RGB5_A1_OES, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 256, 2 }
-};
-
-
-/**
- * Get a color/entry from the palette.
- */
-static GLuint
-get_palette_entry(const struct cpal_format_info *info, const GLubyte *palette,
- GLuint index, GLubyte *pixel)
-{
- memcpy(pixel, palette + info->size * index, info->size);
- return info->size;
-}
-
-
-/**
- * Convert paletted texture to color texture.
- */
-static void
-paletted_to_color(const struct cpal_format_info *info, const GLubyte *palette,
- const void *indices, GLuint num_pixels, GLubyte *image)
-{
- GLubyte *pix = image;
- GLuint remain, i;
-
- if (info->palette_size == 16) {
- /* 4 bits per index */
- const GLubyte *ind = (const GLubyte *) indices;
-
- /* two pixels per iteration */
- remain = num_pixels % 2;
- for (i = 0; i < num_pixels / 2; i++) {
- pix += get_palette_entry(info, palette, (ind[i] >> 4) & 0xf, pix);
- pix += get_palette_entry(info, palette, ind[i] & 0xf, pix);
- }
- if (remain) {
- get_palette_entry(info, palette, (ind[i] >> 4) & 0xf, pix);
- }
- }
- else {
- /* 8 bits per index */
- const GLubyte *ind = (const GLubyte *) indices;
- for (i = 0; i < num_pixels; i++)
- pix += get_palette_entry(info, palette, ind[i], pix);
- }
-}
-
-
-static const struct cpal_format_info *
-cpal_get_info(GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei imageSize)
-{
- const struct cpal_format_info *info;
- GLint lvl, num_levels;
- GLsizei w, h, expect_size;
-
- info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
- ASSERT(info->cpal_format == internalFormat);
-
- if (level > 0) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE,
- "glCompressedTexImage2D(level=%d)", level);
- return NULL;
- }
-
- num_levels = -level + 1;
- expect_size = info->palette_size * info->size;
- for (lvl = 0; lvl < num_levels; lvl++) {
- w = width >> lvl;
- if (!w)
- w = 1;
- h = height >> lvl;
- if (!h)
- h = 1;
-
- if (info->palette_size == 16)
- expect_size += (w * h + 1) / 2;
- else
- expect_size += w * h;
- }
- if (expect_size > imageSize) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE,
- "glCompressedTexImage2D(imageSize=%d)", imageSize);
- return NULL;
- }
- return info;
-}
-
-/**
- * Convert a call to glCompressedTexImage2D() where internalFormat is a
- * compressed palette format into a regular GLubyte/RGBA glTexImage2D() call.
- */
-void
-_mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
- GLenum internalFormat,
- GLsizei width, GLsizei height,
- GLsizei imageSize, const void *palette)
-{
- const struct cpal_format_info *info;
- GLint lvl, num_levels;
- const GLubyte *indices;
- GLint saved_align, align;
- GET_CURRENT_CONTEXT(ctx);
-
- info = cpal_get_info(level, internalFormat, width, height, imageSize);
- if (!info)
- return;
-
- info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
- ASSERT(info->cpal_format == internalFormat);
- num_levels = -level + 1;
-
- /* first image follows the palette */
- indices = (const GLubyte *) palette + info->palette_size * info->size;
-
- saved_align = ctx->Unpack.Alignment;
- align = saved_align;
-
- for (lvl = 0; lvl < num_levels; lvl++) {
- GLsizei w, h;
- GLuint num_texels;
- GLubyte *image = NULL;
-
- w = width >> lvl;
- if (!w)
- w = 1;
- h = height >> lvl;
- if (!h)
- h = 1;
- num_texels = w * h;
- if (w * info->size % align) {
- _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1);
- align = 1;
- }
-
- /* allocate and fill dest image buffer */
- if (palette) {
- image = (GLubyte *) malloc(num_texels * info->size);
- paletted_to_color(info, palette, indices, num_texels, image);
- }
-
- _mesa_TexImage2D(target, lvl, info->format, w, h, 0,
- info->format, info->type, image);
- if (image)
- free(image);
-
- /* advance index pointer to point to next src mipmap */
- if (info->palette_size == 16)
- indices += (num_texels + 1) / 2;
- else
- indices += num_texels;
- }
-
- if (saved_align != align)
- _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, saved_align);
-}
-
-#endif
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ **************************************************************************/
+
+
+/**
+ * Code to convert compressed/paletted texture images to ordinary images.
+ * See the GL_OES_compressed_paletted_texture spec at
+ * http://khronos.org/registry/gles/extensions/OES/OES_compressed_paletted_texture.txt
+ *
+ * XXX this makes it impossible to add hardware support...
+ */
+
+
+#include "glheader.h"
+#include "compiler.h" /* for ASSERT */
+#include "context.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "imports.h"
+#include "pixelstore.h"
+#include "teximage.h"
+#include "texpal.h"
+
+#if FEATURE_ES
+
+
+static const struct cpal_format_info {
+ GLenum cpal_format;
+ GLenum format;
+ GLenum type;
+ GLuint palette_size;
+ GLuint size;
+} formats[] = {
+ { GL_PALETTE4_RGB8_OES, GL_RGB, GL_UNSIGNED_BYTE, 16, 3 },
+ { GL_PALETTE4_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE, 16, 4 },
+ { GL_PALETTE4_R5_G6_B5_OES, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 16, 2 },
+ { GL_PALETTE4_RGBA4_OES, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 16, 2 },
+ { GL_PALETTE4_RGB5_A1_OES, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 16, 2 },
+ { GL_PALETTE8_RGB8_OES, GL_RGB, GL_UNSIGNED_BYTE, 256, 3 },
+ { GL_PALETTE8_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE, 256, 4 },
+ { GL_PALETTE8_R5_G6_B5_OES, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 256, 2 },
+ { GL_PALETTE8_RGBA4_OES, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 256, 2 },
+ { GL_PALETTE8_RGB5_A1_OES, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 256, 2 }
+};
+
+
+/**
+ * Get a color/entry from the palette.
+ */
+static GLuint
+get_palette_entry(const struct cpal_format_info *info, const GLubyte *palette,
+ GLuint index, GLubyte *pixel)
+{
+ memcpy(pixel, palette + info->size * index, info->size);
+ return info->size;
+}
+
+
+/**
+ * Convert paletted texture to color texture.
+ */
+static void
+paletted_to_color(const struct cpal_format_info *info, const GLubyte *palette,
+ const void *indices, GLuint num_pixels, GLubyte *image)
+{
+ GLubyte *pix = image;
+ GLuint remain, i;
+
+ if (info->palette_size == 16) {
+ /* 4 bits per index */
+ const GLubyte *ind = (const GLubyte *) indices;
+
+ /* two pixels per iteration */
+ remain = num_pixels % 2;
+ for (i = 0; i < num_pixels / 2; i++) {
+ pix += get_palette_entry(info, palette, (ind[i] >> 4) & 0xf, pix);
+ pix += get_palette_entry(info, palette, ind[i] & 0xf, pix);
+ }
+ if (remain) {
+ get_palette_entry(info, palette, (ind[i] >> 4) & 0xf, pix);
+ }
+ }
+ else {
+ /* 8 bits per index */
+ const GLubyte *ind = (const GLubyte *) indices;
+ for (i = 0; i < num_pixels; i++)
+ pix += get_palette_entry(info, palette, ind[i], pix);
+ }
+}
+
+
+static const struct cpal_format_info *
+cpal_get_info(GLint level, GLenum internalFormat,
+ GLsizei width, GLsizei height, GLsizei imageSize)
+{
+ const struct cpal_format_info *info;
+ GLint lvl, num_levels;
+ GLsizei w, h, expect_size;
+
+ info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
+ ASSERT(info->cpal_format == internalFormat);
+
+ if (level > 0) {
+ _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE,
+ "glCompressedTexImage2D(level=%d)", level);
+ return NULL;
+ }
+
+ num_levels = -level + 1;
+ expect_size = info->palette_size * info->size;
+ for (lvl = 0; lvl < num_levels; lvl++) {
+ w = width >> lvl;
+ if (!w)
+ w = 1;
+ h = height >> lvl;
+ if (!h)
+ h = 1;
+
+ if (info->palette_size == 16)
+ expect_size += (w * h + 1) / 2;
+ else
+ expect_size += w * h;
+ }
+ if (expect_size > imageSize) {
+ _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE,
+ "glCompressedTexImage2D(imageSize=%d)", imageSize);
+ return NULL;
+ }
+ return info;
+}
+
+/**
+ * Convert a call to glCompressedTexImage2D() where internalFormat is a
+ * compressed palette format into a regular GLubyte/RGBA glTexImage2D() call.
+ */
+void
+_mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
+ GLenum internalFormat,
+ GLsizei width, GLsizei height,
+ GLsizei imageSize, const void *palette)
+{
+ const struct cpal_format_info *info;
+ GLint lvl, num_levels;
+ const GLubyte *indices;
+ GLint saved_align, align;
+ GET_CURRENT_CONTEXT(ctx);
+
+ info = cpal_get_info(level, internalFormat, width, height, imageSize);
+ if (!info)
+ return;
+
+ info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
+ ASSERT(info->cpal_format == internalFormat);
+ num_levels = -level + 1;
+
+ /* first image follows the palette */
+ indices = (const GLubyte *) palette + info->palette_size * info->size;
+
+ saved_align = ctx->Unpack.Alignment;
+ align = saved_align;
+
+ for (lvl = 0; lvl < num_levels; lvl++) {
+ GLsizei w, h;
+ GLuint num_texels;
+ GLubyte *image = NULL;
+
+ w = width >> lvl;
+ if (!w)
+ w = 1;
+ h = height >> lvl;
+ if (!h)
+ h = 1;
+ num_texels = w * h;
+ if (w * info->size % align) {
+ _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ align = 1;
+ }
+
+ /* allocate and fill dest image buffer */
+ if (palette) {
+ image = (GLubyte *) malloc(num_texels * info->size);
+ paletted_to_color(info, palette, indices, num_texels, image);
+ }
+
+ _mesa_TexImage2D(target, lvl, info->format, w, h, 0,
+ info->format, info->type, image);
+ if (image)
+ free(image);
+
+ /* advance index pointer to point to next src mipmap */
+ if (info->palette_size == 16)
+ indices += (num_texels + 1) / 2;
+ else
+ indices += num_texels;
+ }
+
+ if (saved_align != align)
+ _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, saved_align);
+}
+
+#endif
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 996218b16..1d567e430 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -35,6 +35,8 @@
#include "main/context.h"
#include "main/formats.h"
#include "main/macros.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
#include "main/texcompress.h"
#include "main/texparam.h"
#include "main/teximage.h"
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 8759c33ae..1947d32e6 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -58,6 +58,8 @@
#include "image.h"
#include "macros.h"
#include "mipmap.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "pack.h"
#include "imports.h"
#include "pack.h"
@@ -2063,13 +2065,14 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
}
else {
/* general path */
- const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,
+ const GLfloat *tempImage = make_temp_float_image(ctx, dims,
baseInternalFormat,
baseFormat,
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr,
- srcPacking);
- const GLchan *src = tempImage;
+ srcPacking,
+ ctx->_ImageTransferState);
+ const GLfloat *src = tempImage;
GLint img, row, col;
if (!tempImage)
return GL_FALSE;
@@ -2080,24 +2083,29 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
+ dstXoffset * texelBytes;
if (baseInternalFormat == GL_RGBA) {
for (row = 0; row < srcHeight; row++) {
- GLuint *dstUS = (GLuint *) dstRow;
+ GLuint *dstUI = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_2101010( CHAN_TO_UBYTE(src[ACOMP]),
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
+ GLushort a,r,g,b;
+
+ UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+ dstUI[col] = PACK_COLOR_2101010_US(a, r, g, b);
src += 4;
}
dstRow += dstRowStride;
}
} else if (baseInternalFormat == GL_RGB) {
for (row = 0; row < srcHeight; row++) {
- GLuint *dstUS = (GLuint *) dstRow;
+ GLuint *dstUI = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- dstUS[col] = PACK_COLOR_2101010( 0xff,
- CHAN_TO_UBYTE(src[RCOMP]),
- CHAN_TO_UBYTE(src[GCOMP]),
- CHAN_TO_UBYTE(src[BCOMP]) );
+ GLushort r,g,b;
+
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+ UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+ dstUI[col] = PACK_COLOR_2101010_US(0xffff, r, g, b);
src += 4;
}
dstRow += dstRowStride;
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index 6368f9325..2ff262fc6 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -34,6 +34,8 @@
#include "bufferobj.h"
#include "context.h"
#include "hash.h"
+#include "mfeatures.h"
+#include "mtypes.h"
#include "transformfeedback.h"
#include "shaderapi.h"
#include "shaderobj.h"
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index a6fdabea7..e55f2f1c0 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -39,6 +39,8 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/dispatch.h"
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
#include "main/shaderapi.h"
#include "main/shaderobj.h"
#include "main/uniforms.h"
@@ -511,7 +513,7 @@ get_uniform_rows_cols(const struct gl_program_parameter *p,
*cols = p->Size;
}
else {
- *rows = p->Size / 4 + 1;
+ *rows = (p->Size + 3) / 4;
if (p->Size % 4 == 0)
*cols = 4;
else
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 92367a842..2d4a6b54b 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -33,6 +33,7 @@
#include "hash.h"
#include "image.h"
#include "macros.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "varray.h"
#include "arrayobj.h"
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 99dc8b350..f18fa5fcc 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -22,7 +22,8 @@
*/
-#include "context.h"
+#include "imports.h"
+#include "mtypes.h"
#include "version.h"
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index 0dff499ef..ffe21fea5 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.10
+ * Version: 7.11
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
@@ -33,9 +33,9 @@ struct gl_context;
/* Mesa version */
#define MESA_MAJOR 7
-#define MESA_MINOR 10
+#define MESA_MINOR 11
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.10-devel"
+#define MESA_VERSION_STRING "7.11-devel"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c
index 1b4e6c339..3c3b120e4 100644
--- a/mesalib/src/mesa/main/viewport.c
+++ b/mesalib/src/mesa/main/viewport.c
@@ -31,6 +31,7 @@
#include "context.h"
#include "macros.h"
+#include "mtypes.h"
#include "viewport.h"
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index 6fec7f09b..f5e10661c 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -30,6 +30,7 @@
#include "api_arrayelt.h"
#include "context.h"
#include "imports.h"
+#include "mfeatures.h"
#include "mtypes.h"
#include "vtxfmt.h"
#include "eval.h"
diff --git a/mesalib/src/mesa/main/vtxfmt.h b/mesalib/src/mesa/main/vtxfmt.h
index 235198747..d403669c2 100644
--- a/mesalib/src/mesa/main/vtxfmt.h
+++ b/mesalib/src/mesa/main/vtxfmt.h
@@ -34,6 +34,7 @@
#define _VTXFMT_H_
#include "compiler.h"
+#include "mfeatures.h"
#include "mtypes.h"
#if FEATURE_beginend
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index ff1f61afe..34dff79e7 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -147,7 +147,11 @@ void st_validate_state( struct st_context *st )
/*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
+#ifdef NDEBUG
+ if (0) {
+#else
if (1) {
+#endif
/* Debug version which enforces various sanity checks on the
* state flags which are generated and checked to help ensure
* state atoms are ordered correctly in the list.
diff --git a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
index 5672215f7..87a479a22 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_constbuf.c
@@ -56,7 +56,6 @@ void st_upload_constants( struct st_context *st,
unsigned shader_type)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_resource **cbuf = &st->state.constants[shader_type];
assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_FRAGMENT ||
@@ -64,6 +63,7 @@ void st_upload_constants( struct st_context *st,
/* update constants */
if (params && params->NumParameters) {
+ struct pipe_resource *cbuf;
const uint paramBytes = params->NumParameters * sizeof(GLfloat) * 4;
/* Update the constants which come from fixed-function state, such as
@@ -75,11 +75,12 @@ void st_upload_constants( struct st_context *st,
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization.
+ * Let's use a user buffer to avoid an unnecessary copy.
*/
- pipe_resource_reference(cbuf, NULL );
- *cbuf = pipe_buffer_create(pipe->screen,
- PIPE_BIND_CONSTANT_BUFFER,
- paramBytes );
+ cbuf = pipe_user_buffer_create(pipe->screen,
+ params->ParameterValues,
+ paramBytes,
+ PIPE_BIND_CONSTANT_BUFFER);
if (ST_DEBUG & DEBUG_CONSTANTS) {
debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n",
@@ -88,17 +89,15 @@ void st_upload_constants( struct st_context *st,
_mesa_print_parameter_list(params);
}
- /* load Mesa constants into the constant buffer */
- pipe_buffer_write(st->pipe, *cbuf,
- 0, paramBytes,
- params->ParameterValues);
+ st->pipe->set_constant_buffer(st->pipe, shader_type, 0, cbuf);
+ pipe_resource_reference(&cbuf, NULL);
- st->pipe->set_constant_buffer(st->pipe, shader_type, 0, *cbuf);
+ st->state.constants[shader_type].ptr = params->ParameterValues;
+ st->state.constants[shader_type].size = paramBytes;
}
- else if (*cbuf) {
- st->constants.tracked_state[shader_type].dirty.mesa = 0x0;
-
- pipe_resource_reference(cbuf, NULL);
+ else if (st->state.constants[shader_type].ptr) {
+ st->state.constants[shader_type].ptr = NULL;
+ st->state.constants[shader_type].size = 0;
st->pipe->set_constant_buffer(st->pipe, shader_type, 0, NULL);
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index 7dd63798d..3e27be271 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -470,13 +470,9 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
if (mask & (1 << b)) {
struct gl_renderbuffer *rb
= ctx->DrawBuffer->Attachment[b].Renderbuffer;
- struct st_renderbuffer *strb;
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
- assert(rb);
-
- strb = st_renderbuffer(rb);
-
- if (!strb->surface)
+ if (!strb || !strb->surface)
continue;
if (check_clear_color_with_quad( ctx, rb ))
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 8a63192d7..c348dd343 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -34,6 +34,7 @@
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
+#include "main/mtypes.h"
#include "main/pack.h"
#include "main/texformat.h"
#include "main/texstore.h"
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 4bc01100a..d6df2a204 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -61,7 +61,8 @@
* during window resize.
*/
static GLboolean
-st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
+st_renderbuffer_alloc_storage(struct gl_context * ctx,
+ struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
@@ -75,7 +76,8 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *r
if (strb->format != PIPE_FORMAT_NONE)
format = strb->format;
else
- format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples);
+ format = st_choose_renderbuffer_format(screen, internalFormat,
+ rb->NumSamples);
/* init renderbuffer fields */
strb->Base.Width = width;
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 4656930ac..593da8fa6 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -207,12 +207,6 @@ static void st_destroy_context_priv( struct st_context *st )
pipe_sampler_view_reference(&st->state.sampler_views[i], NULL);
}
- for (i = 0; i < Elements(st->state.constants); i++) {
- if (st->state.constants[i]) {
- pipe_resource_reference(&st->state.constants[i], NULL);
- }
- }
-
if (st->default_texture) {
st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture);
st->default_texture = NULL;
@@ -245,7 +239,6 @@ void st_destroy_context( struct st_context *st )
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
pipe->set_constant_buffer(pipe, i, 0, NULL);
- pipe_resource_reference(&st->state.constants[i], NULL);
}
_mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 348a5827d..492ee600e 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -92,7 +92,10 @@ struct st_context
struct pipe_sampler_state samplers[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state *sampler_list[PIPE_MAX_SAMPLERS];
struct pipe_clip_state clip;
- struct pipe_resource *constants[PIPE_SHADER_TYPES];
+ struct {
+ void *ptr;
+ unsigned size;
+ } constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
@@ -105,15 +108,6 @@ struct st_context
GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
} state;
- struct {
- struct st_tracked_state tracked_state[PIPE_SHADER_TYPES];
- } constants;
-
- /* XXX unused: */
- struct {
- struct gl_fragment_program *fragment_program;
- } cb;
-
char vendor[100];
char renderer[100];
diff --git a/mesalib/src/mesa/state_tracker/st_draw_feedback.c b/mesalib/src/mesa/state_tracker/st_draw_feedback.c
index b05e660ae..957912221 100644
--- a/mesalib/src/mesa/state_tracker/st_draw_feedback.c
+++ b/mesalib/src/mesa/state_tracker/st_draw_feedback.c
@@ -109,9 +109,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
struct pipe_index_buffer ibuffer;
struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS];
struct pipe_transfer *ib_transfer = NULL;
- struct pipe_transfer *cb_transfer;
GLuint attr, i;
- ubyte *mapped_constants;
const void *mapped_indices = NULL;
assert(draw);
@@ -242,14 +240,10 @@ st_feedback_draw_vbo(struct gl_context *ctx,
draw_set_mapped_index_buffer(draw, mapped_indices);
}
- /* map constant buffers */
- mapped_constants = pipe_buffer_map(pipe,
- st->state.constants[PIPE_SHADER_VERTEX],
- PIPE_TRANSFER_READ,
- &cb_transfer);
+ /* set the constant buffer */
draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, 0,
- mapped_constants,
- st->state.constants[PIPE_SHADER_VERTEX]->width0);
+ st->state.constants[PIPE_SHADER_VERTEX].ptr,
+ st->state.constants[PIPE_SHADER_VERTEX].size);
/* draw here */
@@ -258,9 +252,6 @@ st_feedback_draw_vbo(struct gl_context *ctx,
}
- /* unmap constant buffers */
- pipe_buffer_unmap(pipe, cb_transfer);
-
/*
* unmap vertex/index buffers
*/
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index c80811a07..574730120 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -224,6 +224,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.ARB_fragment_program = GL_TRUE;
+ ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_multisample = GL_TRUE;
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 74d402daa..7952bb6ff 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -513,7 +513,8 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
}
static boolean
-st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target,
+st_context_teximage(struct st_context_iface *stctxi,
+ enum st_texture_type target,
int level, enum pipe_format internal_format,
struct pipe_resource *tex, boolean mipmap)
{
@@ -865,7 +866,8 @@ st_manager_validate_framebuffers(struct st_context *st)
* Add a color renderbuffer on demand.
*/
boolean
-st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb,
+st_manager_add_color_renderbuffer(struct st_context *st,
+ struct gl_framebuffer *fb,
gl_buffer_index idx)
{
struct st_framebuffer *stfb = st_ws_framebuffer(fb);
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 59165be04..50beaa766 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -409,6 +409,7 @@ st_translate_fragment_program(struct st_context *st,
assert(!(key->bitmap && key->drawpixels));
+#if FEATURE_drawpix
if (key->bitmap) {
/* glBitmap drawing */
struct gl_fragment_program *fp;
@@ -434,6 +435,7 @@ st_translate_fragment_program(struct st_context *st,
}
stfp = st_fragment_program(fp);
}
+#endif
if (!stfp->tgsi.tokens) {
/* need to translate Mesa instructions to TGSI now */
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index f39bd8a38..503f5b732 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -27,7 +27,6 @@
#include "main/context.h"
#include "main/colormac.h"
#include "main/imports.h"
-#include "main/texformat.h"
#include "s_context.h"
#include "s_texfilter.h"
diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c
index 93826b7ce..10a1dc1c1 100644
--- a/mesalib/src/mesa/swrast/s_triangle.c
+++ b/mesalib/src/mesa/swrast/s_triangle.c
@@ -34,7 +34,7 @@
#include "main/colormac.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/texformat.h"
+#include "main/mtypes.h"
#include "program/prog_instruction.h"
#include "s_aatriangle.h"
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index 67a6091ba..bbf422f74 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -209,7 +209,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state )
{
- _ae_invalidate_state(ctx, new_state);
vbo_exec_invalidate_state(ctx, new_state);
}