summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-04-24 19:34:57 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-04-28 14:05:18 -0400
commit7179a822628963d8cfa0817cf072c5acb70638a7 (patch)
tree454d57a7c685dbea8d4ae46306b11455259ffeb0 /src/mesa
parent08fae07f5246052dccdd89689e27dc8820a24ff7 (diff)
mesa: Move support for paletted textures to main/teximage.c
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/es/sources.mak2
-rw-r--r--src/mesa/main/APIspec.xml4
-rw-r--r--src/mesa/main/glheader.h13
-rw-r--r--src/mesa/main/teximage.c20
-rw-r--r--src/mesa/main/texpal.c (renamed from src/mesa/es/main/es_cpaltex.c)61
-rw-r--r--src/mesa/main/texpal.h38
-rw-r--r--src/mesa/sources.mak1
7 files changed, 90 insertions, 49 deletions
diff --git a/src/mesa/es/sources.mak b/src/mesa/es/sources.mak
index e02fce76fd..339912dfdc 100644
--- a/src/mesa/es/sources.mak
+++ b/src/mesa/es/sources.mak
@@ -4,7 +4,6 @@ include $(MESA)/sources.mak
LOCAL_ES1_SOURCES := \
main/drawtex.c \
- main/es_cpaltex.c \
main/es_query_matrix.c \
main/es_texgen.c \
glapi/glapi-es1/main/enums.c
@@ -23,7 +22,6 @@ LOCAL_ES1_INCLUDES := \
-I$(MESA)/state_tracker
LOCAL_ES2_SOURCES := \
- main/es_cpaltex.c \
glapi/glapi-es2/main/enums.c
LOCAL_ES2_GALLIUM_SOURCES := \
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 17eece1bb4..268bd5d3db 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -4040,7 +4040,7 @@
<!-- CompressedTexImage2D calls out to two different functions based on
whether the image is a paletted image or not -->
- <function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
+ <function name="CompressedTexImage2D" template="CompressedTexImage2D"/>
<function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
<function name="BlendFuncSeparateOES" template="BlendFuncSeparate"/>
@@ -4217,7 +4217,7 @@
<function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
- <function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
+ <function name="CompressedTexImage2D" template="CompressedTexImage2D"/>
<function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
<function name="BlendFuncSeparate" template="BlendFuncSeparate"/>
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 6d423eacee..5b8e2f2d81 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -94,6 +94,19 @@ typedef void *GLeglImageOES;
#define GL_TEXTURE_GEN_STR_OES 0x8D60
#endif
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif
+
/**
* Special, internal token
*/
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index b31ca86f11..0c583ed14d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -46,6 +46,7 @@
#include "texfetch.h"
#include "teximage.h"
#include "texstate.h"
+#include "texpal.h"
#include "mtypes.h"
@@ -3408,7 +3409,6 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
}
}
-
void GLAPIENTRY
_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
@@ -3424,6 +3424,24 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
_mesa_lookup_enum_by_nr(internalFormat),
width, height, border, imageSize, data);
+#if FEATURE_ES
+ switch (internalFormat) {
+ case GL_PALETTE4_RGB8_OES:
+ case GL_PALETTE4_RGBA8_OES:
+ case GL_PALETTE4_R5_G6_B5_OES:
+ case GL_PALETTE4_RGBA4_OES:
+ case GL_PALETTE4_RGB5_A1_OES:
+ case GL_PALETTE8_RGB8_OES:
+ case GL_PALETTE8_RGBA8_OES:
+ case GL_PALETTE8_R5_G6_B5_OES:
+ case GL_PALETTE8_RGBA4_OES:
+ case GL_PALETTE8_RGB5_A1_OES:
+ _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
+ width, height, imageSize, data);
+ return;
+ }
+#endif
+
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
diff --git a/src/mesa/es/main/es_cpaltex.c b/src/mesa/main/texpal.c
index 0c497774ff..a25e7aa4ff 100644
--- a/src/mesa/es/main/es_cpaltex.c
+++ b/src/mesa/main/texpal.c
@@ -15,21 +15,16 @@
*/
-#include "GLES/gl.h"
-#include "GLES/glext.h"
+#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"
-#include "main/compiler.h" /* for ASSERT */
-
-
-void GL_APIENTRY _es_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-
-void GL_APIENTRY _mesa_GetIntegerv(GLenum pname, GLint *params);
-void GL_APIENTRY _mesa_PixelStorei(GLenum pname, GLint param);
-void GL_APIENTRY _mesa_TexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-void GL_APIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-
-void *_mesa_get_current_context(void);
-void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
+#if FEATURE_ES
static const struct cpal_format_info {
@@ -141,15 +136,17 @@ cpal_get_info(GLint level, GLenum internalFormat,
* Convert a call to glCompressedTexImage2D() where internalFormat is a
* compressed palette format into a regular GLubyte/RGBA glTexImage2D() call.
*/
-static void
-cpal_compressed_teximage2d(GLenum target, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLsizei imageSize,
- const void *palette)
+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)
@@ -162,7 +159,7 @@ cpal_compressed_teximage2d(GLenum target, GLint level, GLenum internalFormat,
/* first image follows the palette */
indices = (const GLubyte *) palette + info->palette_size * info->size;
- _mesa_GetIntegerv(GL_UNPACK_ALIGNMENT, &saved_align);
+ saved_align = ctx->Unpack.Alignment;
align = saved_align;
for (lvl = 0; lvl < num_levels; lvl++) {
@@ -204,28 +201,4 @@ cpal_compressed_teximage2d(GLenum target, GLint level, GLenum internalFormat,
_mesa_PixelStorei(GL_UNPACK_ALIGNMENT, saved_align);
}
-
-void GL_APIENTRY
-_es_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat,
- GLsizei width, GLsizei height, GLint border,
- GLsizei imageSize, const GLvoid *data)
-{
- switch (internalFormat) {
- case GL_PALETTE4_RGB8_OES:
- case GL_PALETTE4_RGBA8_OES:
- case GL_PALETTE4_R5_G6_B5_OES:
- case GL_PALETTE4_RGBA4_OES:
- case GL_PALETTE4_RGB5_A1_OES:
- case GL_PALETTE8_RGB8_OES:
- case GL_PALETTE8_RGBA8_OES:
- case GL_PALETTE8_R5_G6_B5_OES:
- case GL_PALETTE8_RGBA4_OES:
- case GL_PALETTE8_RGB5_A1_OES:
- cpal_compressed_teximage2d(target, level, internalFormat,
- width, height, imageSize, data);
- break;
- default:
- _mesa_CompressedTexImage2DARB(target, level, internalFormat,
- width, height, border, imageSize, data);
- }
-}
+#endif
diff --git a/src/mesa/main/texpal.h b/src/mesa/main/texpal.h
new file mode 100644
index 0000000000..eeff5a9e24
--- /dev/null
+++ b/src/mesa/main/texpal.h
@@ -0,0 +1,38 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.8
+ *
+ * Copyright (C) 1999-2010 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 TEXPAL_H
+#define TEXPAL_H
+
+
+#include "main/glheader.h"
+extern void
+_mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
+ GLenum internalFormat,
+ GLsizei width, GLsizei height,
+ GLsizei imageSize, const void *palette);
+
+
+#endif /* TEXPAL_H */
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index df16e70c95..5e11192b44 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -80,6 +80,7 @@ MAIN_SOURCES = \
main/texgetimage.c \
main/teximage.c \
main/texobj.c \
+ main/texpal.c \
main/texparam.c \
main/texrender.c \
main/texstate.c \