summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2012-06-25 10:52:39 -0700
committerJordan Justen <[email protected]>2012-07-21 16:49:42 -0700
commit9ad8f431b2a47060bf05517246ab0fa8d249c800 (patch)
tree579bb10a4bd1f1827ff4b38242f1b25d4e01fca0 /src/mesa
parente2e7b467d8a6567437823767af74004a396f1c82 (diff)
mesa: add glformats integer type/format detection routines
_mesa_is_integer_format is moved to formats.c and renamed as _mesa_is_enum_format_integer. _mesa_is_format_unsigned, _mesa_is_type_integer, _mesa_is_type_unsigned, and _mesa_is_enum_format_or_type_integer are added. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/SConscript1
-rw-r--r--src/mesa/main/drawpix.c3
-rw-r--r--src/mesa/main/formats.c13
-rw-r--r--src/mesa/main/formats.h4
-rw-r--r--src/mesa/main/glformats.c201
-rw-r--r--src/mesa/main/glformats.h57
-rw-r--r--src/mesa/main/image.c76
-rw-r--r--src/mesa/main/image.h3
-rw-r--r--src/mesa/main/pack.c9
-rw-r--r--src/mesa/main/readpix.c7
-rw-r--r--src/mesa/main/teximage.c11
-rw-r--r--src/mesa/sources.mak1
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c3
13 files changed, 295 insertions, 94 deletions
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 906c57962dd..a3cbc16de97 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -80,6 +80,7 @@ main_sources = [
'main/framebuffer.c',
'main/get.c',
'main/getstring.c',
+ 'main/glformats.c',
'main/hash.c',
'main/hint.c',
'main/histogram.c',
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index fdcbcccded2..49b078289c8 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -35,6 +35,7 @@
#include "pbo.h"
#include "state.h"
#include "dispatch.h"
+#include "glformats.h"
#if FEATURE_drawpix
@@ -89,7 +90,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
* input), NVIDIA's implementation also just returns this error despite
* exposing GL_EXT_texture_integer, just return an error regardless.
*/
- if (_mesa_is_integer_format(format)) {
+ if (_mesa_is_enum_format_integer(format)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(integer format)");
goto end;
}
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index c65c9c2e14f..5dd9f085a85 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -28,6 +28,7 @@
#include "formats.h"
#include "mfeatures.h"
#include "macros.h"
+#include "glformats.h"
/**
@@ -1712,6 +1713,17 @@ _mesa_is_format_integer_color(gl_format format)
/**
+ * Is the given format an unsigned integer format?
+ */
+GLboolean
+_mesa_is_format_unsigned(gl_format format)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ return _mesa_is_type_unsigned(info->DataType);
+}
+
+
+/**
* Return color encoding for given format.
* \return GL_LINEAR or GL_SRGB
*/
@@ -2933,3 +2945,4 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
return GL_FALSE;
}
+
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 3a694a813de..176e0fd18f6 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -311,6 +311,9 @@ _mesa_is_format_packed_depth_stencil(gl_format format);
extern GLboolean
_mesa_is_format_integer_color(gl_format format);
+extern GLboolean
+_mesa_is_format_unsigned(gl_format format);
+
extern GLenum
_mesa_get_format_color_encoding(gl_format format);
@@ -346,7 +349,6 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
GLenum format, GLenum type,
GLboolean swapBytes);
-
#ifdef __cplusplus
}
#endif
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
new file mode 100644
index 00000000000..5b5008ed6cc
--- /dev/null
+++ b/src/mesa/main/glformats.c
@@ -0,0 +1,201 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (c) 2008-2009 VMware, Inc.
+ * Copyright (c) 2012 Intel Corporation
+ *
+ * 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
+ * THE AUTHORS 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 "imports.h"
+#include "glformats.h"
+
+
+/**
+ * Test if the given format is an integer (non-normalized) format.
+ */
+GLboolean
+_mesa_is_enum_format_integer(GLenum format)
+{
+ switch (format) {
+ /* generic integer formats */
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ case GL_RG_INTEGER:
+ /* specific integer formats */
+ case GL_RGBA32UI_EXT:
+ case GL_RGB32UI_EXT:
+ case GL_RG32UI:
+ case GL_R32UI:
+ case GL_ALPHA32UI_EXT:
+ case GL_INTENSITY32UI_EXT:
+ case GL_LUMINANCE32UI_EXT:
+ case GL_LUMINANCE_ALPHA32UI_EXT:
+ case GL_RGBA16UI_EXT:
+ case GL_RGB16UI_EXT:
+ case GL_RG16UI:
+ case GL_R16UI:
+ case GL_ALPHA16UI_EXT:
+ case GL_INTENSITY16UI_EXT:
+ case GL_LUMINANCE16UI_EXT:
+ case GL_LUMINANCE_ALPHA16UI_EXT:
+ case GL_RGBA8UI_EXT:
+ case GL_RGB8UI_EXT:
+ case GL_RG8UI:
+ case GL_R8UI:
+ case GL_ALPHA8UI_EXT:
+ case GL_INTENSITY8UI_EXT:
+ case GL_LUMINANCE8UI_EXT:
+ case GL_LUMINANCE_ALPHA8UI_EXT:
+ case GL_RGBA32I_EXT:
+ case GL_RGB32I_EXT:
+ case GL_RG32I:
+ case GL_R32I:
+ case GL_ALPHA32I_EXT:
+ case GL_INTENSITY32I_EXT:
+ case GL_LUMINANCE32I_EXT:
+ case GL_LUMINANCE_ALPHA32I_EXT:
+ case GL_RGBA16I_EXT:
+ case GL_RGB16I_EXT:
+ case GL_RG16I:
+ case GL_R16I:
+ case GL_ALPHA16I_EXT:
+ case GL_INTENSITY16I_EXT:
+ case GL_LUMINANCE16I_EXT:
+ case GL_LUMINANCE_ALPHA16I_EXT:
+ case GL_RGBA8I_EXT:
+ case GL_RGB8I_EXT:
+ case GL_RG8I:
+ case GL_R8I:
+ case GL_ALPHA8I_EXT:
+ case GL_INTENSITY8I_EXT:
+ case GL_LUMINANCE8I_EXT:
+ case GL_LUMINANCE_ALPHA8I_EXT:
+ case GL_RGB10_A2UI:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given type is an integer (non-normalized) format.
+ */
+GLboolean
+_mesa_is_type_integer(GLenum type)
+{
+ switch (type) {
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Test if the given format or type is an integer (non-normalized) format.
+ */
+extern GLboolean
+_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type)
+{
+ return _mesa_is_enum_format_integer(format) || _mesa_is_type_integer(type);
+}
+
+
+GLboolean
+_mesa_is_type_unsigned(GLenum type)
+{
+ switch (type) {
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL_UNSIGNED_SHORT_8_8_MESA:
+ case GL_UNSIGNED_SHORT_8_8_REV_MESA:
+
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ return GL_TRUE;
+
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Convert various base formats to the cooresponding integer format.
+ */
+GLenum
+_mesa_base_format_to_integer_format(GLenum format)
+{
+ switch(format) {
+ case GL_RED:
+ return GL_RED_INTEGER;
+ case GL_GREEN:
+ return GL_GREEN_INTEGER;
+ case GL_BLUE:
+ return GL_BLUE_INTEGER;
+ case GL_RG:
+ return GL_RG_INTEGER;
+ case GL_RGB:
+ return GL_RGB_INTEGER;
+ case GL_RGBA:
+ return GL_RGBA_INTEGER;
+ case GL_BGR:
+ return GL_BGR_INTEGER;
+ case GL_BGRA:
+ return GL_BGRA_INTEGER;
+ case GL_ALPHA:
+ return GL_ALPHA_INTEGER;
+ case GL_LUMINANCE:
+ return GL_LUMINANCE_INTEGER_EXT;
+ case GL_LUMINANCE_ALPHA:
+ return GL_LUMINANCE_ALPHA_INTEGER_EXT;
+ }
+
+ return format;
+}
+
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
new file mode 100644
index 00000000000..d67ad54c00f
--- /dev/null
+++ b/src/mesa/main/glformats.h
@@ -0,0 +1,57 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (c) 2008-2009 VMware, Inc.
+ * Copyright (c) 2012 Intel Corporation
+ *
+ * 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
+ * THE AUTHORS 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 GLFORMATS_H
+#define GLFORMATS_H
+
+
+#include <GL/gl.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern GLboolean
+_mesa_is_type_integer(GLenum type);
+
+extern GLboolean
+_mesa_is_type_unsigned(GLenum type);
+
+extern GLboolean
+_mesa_is_enum_format_integer(GLenum format);
+
+extern GLboolean
+_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type);
+
+extern GLenum
+_mesa_base_format_to_integer_format(GLenum format);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GLFORMATS_H */
+
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 678dfeb2b07..798280f7310 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1058,82 +1058,6 @@ _mesa_is_dudv_format(GLenum format)
/**
- * Test if the given format is an integer (non-normalized) format.
- */
-GLboolean
-_mesa_is_integer_format(GLenum format)
-{
- switch (format) {
- /* generic integer formats */
- case GL_RED_INTEGER_EXT:
- case GL_GREEN_INTEGER_EXT:
- case GL_BLUE_INTEGER_EXT:
- case GL_ALPHA_INTEGER_EXT:
- case GL_RGB_INTEGER_EXT:
- case GL_RGBA_INTEGER_EXT:
- case GL_BGR_INTEGER_EXT:
- case GL_BGRA_INTEGER_EXT:
- case GL_LUMINANCE_INTEGER_EXT:
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- case GL_RG_INTEGER:
- /* specific integer formats */
- case GL_RGBA32UI_EXT:
- case GL_RGB32UI_EXT:
- case GL_RG32UI:
- case GL_R32UI:
- case GL_ALPHA32UI_EXT:
- case GL_INTENSITY32UI_EXT:
- case GL_LUMINANCE32UI_EXT:
- case GL_LUMINANCE_ALPHA32UI_EXT:
- case GL_RGBA16UI_EXT:
- case GL_RGB16UI_EXT:
- case GL_RG16UI:
- case GL_R16UI:
- case GL_ALPHA16UI_EXT:
- case GL_INTENSITY16UI_EXT:
- case GL_LUMINANCE16UI_EXT:
- case GL_LUMINANCE_ALPHA16UI_EXT:
- case GL_RGBA8UI_EXT:
- case GL_RGB8UI_EXT:
- case GL_RG8UI:
- case GL_R8UI:
- case GL_ALPHA8UI_EXT:
- case GL_INTENSITY8UI_EXT:
- case GL_LUMINANCE8UI_EXT:
- case GL_LUMINANCE_ALPHA8UI_EXT:
- case GL_RGBA32I_EXT:
- case GL_RGB32I_EXT:
- case GL_RG32I:
- case GL_R32I:
- case GL_ALPHA32I_EXT:
- case GL_INTENSITY32I_EXT:
- case GL_LUMINANCE32I_EXT:
- case GL_LUMINANCE_ALPHA32I_EXT:
- case GL_RGBA16I_EXT:
- case GL_RGB16I_EXT:
- case GL_RG16I:
- case GL_R16I:
- case GL_ALPHA16I_EXT:
- case GL_INTENSITY16I_EXT:
- case GL_LUMINANCE16I_EXT:
- case GL_LUMINANCE_ALPHA16I_EXT:
- case GL_RGBA8I_EXT:
- case GL_RGB8I_EXT:
- case GL_RG8I:
- case GL_R8I:
- case GL_ALPHA8I_EXT:
- case GL_INTENSITY8I_EXT:
- case GL_LUMINANCE8I_EXT:
- case GL_LUMINANCE_ALPHA8I_EXT:
- case GL_RGB10_A2UI:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
* Test if an image format is a supported compressed format.
* \param format the internal format token provided by the user.
* \return GL_TRUE if compressed, GL_FALSE if uncompressed
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index f1ed883794f..465f6c2c97a 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -79,9 +79,6 @@ extern GLboolean
_mesa_is_dudv_format(GLenum format);
extern GLboolean
-_mesa_is_integer_format(GLenum format);
-
-extern GLboolean
_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
extern GLboolean
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 5fd01c2f8ef..a674f683112 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -52,6 +52,7 @@
#include "pack.h"
#include "pixeltransfer.h"
#include "imports.h"
+#include "glformats.h"
#include "../../gallium/auxiliary/util/u_format_rgb9e5.h"
#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h"
@@ -558,7 +559,7 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
{
GLfloat *luminance;
const GLint comps = _mesa_components_in_format(dstFormat);
- const GLboolean intDstFormat = _mesa_is_integer_format(dstFormat);
+ const GLboolean intDstFormat = _mesa_is_enum_format_integer(dstFormat);
GLuint i;
if (dstFormat == GL_LUMINANCE ||
@@ -2489,7 +2490,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
stride = _mesa_components_in_format(srcFormat);
- intFormat = _mesa_is_integer_format(srcFormat);
+ intFormat = _mesa_is_enum_format_integer(srcFormat);
#define PROCESS(SRC_INDEX, DST_INDEX, DEFAULT_FLT, DEFAULT_INT, TYPE, CONVERSION) \
if ((SRC_INDEX) < 0) { \
@@ -3544,7 +3545,7 @@ _mesa_unpack_color_span_ubyte(struct gl_context *ctx,
const struct gl_pixelstore_attrib *srcPacking,
GLbitfield transferOps )
{
- GLboolean intFormat = _mesa_is_integer_format(srcFormat);
+ GLboolean intFormat = _mesa_is_enum_format_integer(srcFormat);
ASSERT(dstFormat == GL_ALPHA ||
dstFormat == GL_LUMINANCE ||
dstFormat == GL_LUMINANCE_ALPHA ||
@@ -3851,7 +3852,7 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
- GLboolean intFormat = _mesa_is_integer_format(srcFormat);
+ GLboolean intFormat = _mesa_is_enum_format_integer(srcFormat);
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 1381110495f..82d99fd21c9 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -36,6 +36,7 @@
#include "pack.h"
#include "pbo.h"
#include "state.h"
+#include "glformats.h"
/**
@@ -337,7 +338,7 @@ slow_read_rgba_pixels( struct gl_context *ctx,
goto done;
for (j = 0; j < height; j++) {
- if (_mesa_is_integer_format(format)) {
+ if (_mesa_is_enum_format_integer(format)) {
_mesa_unpack_uint_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba);
_mesa_rebase_rgba_uint(width, (GLuint (*)[4]) rgba,
rb->_BaseFormat);
@@ -378,7 +379,7 @@ read_rgba_pixels( struct gl_context *ctx,
return;
if ((ctx->Color._ClampReadColor == GL_TRUE || type != GL_FLOAT) &&
- !_mesa_is_integer_format(format)) {
+ !_mesa_is_enum_format_integer(format)) {
transferOps |= IMAGE_CLAMP_BIT;
}
@@ -713,7 +714,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
- const GLboolean dstInteger = _mesa_is_integer_format(format);
+ const GLboolean dstInteger = _mesa_is_enum_format_integer(format);
if (dstInteger != srcInteger) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glReadPixels(integer / non-integer format mismatch");
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 64b25a82dec..91df133312b 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -47,6 +47,7 @@
#include "texstate.h"
#include "texpal.h"
#include "mtypes.h"
+#include "glformats.h"
/**
@@ -1764,8 +1765,8 @@ texture_error_check( struct gl_context *ctx,
/* additional checks for integer textures */
if ((ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) &&
- (_mesa_is_integer_format(format) !=
- _mesa_is_integer_format(internalFormat))) {
+ (_mesa_is_enum_format_integer(format) !=
+ _mesa_is_enum_format_integer(internalFormat))) {
if (!isProxy) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexImage%dD(integer/non-integer format mismatch)",
@@ -1939,7 +1940,7 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
/* both source and dest must be integer-valued, or neither */
if (_mesa_is_format_integer_color(destTex->TexFormat) !=
- _mesa_is_integer_format(format)) {
+ _mesa_is_enum_format_integer(format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexSubImage%dD(integer/non-integer format mismatch)",
dimensions);
@@ -2042,8 +2043,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
if (_mesa_is_color_format(internalFormat)) {
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
- if (_mesa_is_integer_format(rb->InternalFormat) !=
- _mesa_is_integer_format(internalFormat)) {
+ if (_mesa_is_enum_format_integer(rb->InternalFormat) !=
+ _mesa_is_enum_format_integer(internalFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glCopyTexImage%dD(integer vs non-integer)", dimensions);
return GL_TRUE;
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index d22f0595c53..b124291312a 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -49,6 +49,7 @@ MAIN_FILES = \
$(SRCDIR)/main/framebuffer.c \
$(SRCDIR)/main/get.c \
$(SRCDIR)/main/getstring.c \
+ $(SRCDIR)/main/glformats.c \
$(SRCDIR)/main/hash.c \
$(SRCDIR)/main/hint.c \
$(SRCDIR)/main/histogram.c \
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index c5f36316b4c..f288a963244 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -43,6 +43,7 @@
#include "main/texformat.h"
#include "main/teximage.h"
#include "main/texstore.h"
+#include "main/glformats.h"
#include "program/program.h"
#include "program/prog_print.h"
#include "program/prog_instruction.h"
@@ -368,7 +369,7 @@ internal_format(struct gl_context *ctx, GLenum format, GLenum type)
return GL_STENCIL_INDEX;
default:
- if (_mesa_is_integer_format(format)) {
+ if (_mesa_is_enum_format_integer(format)) {
switch (type) {
case GL_BYTE:
return GL_RGBA8I;