summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-04-23 12:01:50 -0600
committerBrian Paul <[email protected]>2010-04-23 12:29:31 -0600
commitc34feadd1c2fa5c62022c1f48ee675b25a985ac6 (patch)
tree11b0de3a43792126ce521091debf6239a8e30abc /src/mesa/main
parent3643841079a1413695172d0e5dd5e0a5f2e22945 (diff)
mesa: make is_compressed_format() non-static
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/image.c34
-rw-r--r--src/mesa/main/image.h2
-rw-r--r--src/mesa/main/teximage.c42
3 files changed, 40 insertions, 38 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index dc8d97728bf..8aef306fd81 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -751,6 +751,40 @@ _mesa_is_dudv_format(GLenum format)
/**
+ * 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
+ */
+GLboolean
+_mesa_is_compressed_format(GLcontext *ctx, GLenum format)
+{
+ switch (format) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ return ctx->Extensions.EXT_texture_compression_s3tc;
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ return ctx->Extensions.S3_s3tc;
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ return ctx->Extensions.EXT_texture_sRGB
+ && ctx->Extensions.EXT_texture_compression_s3tc;
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ return ctx->Extensions.TDFX_texture_compression_FXT1;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
* Return the address of a specific pixel in an image (1D, 2D or 3D).
*
* Pixel unpacking/packing parameters are observed according to \p packing.
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index 9b34be0dfaa..3947bbc2786 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -75,6 +75,8 @@ _mesa_is_depthstencil_format(GLenum format);
extern GLboolean
_mesa_is_dudv_format(GLenum format);
+extern GLboolean
+_mesa_is_compressed_format(GLcontext *ctx, GLenum format);
extern GLvoid *
_mesa_image_address( GLuint dimensions,
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index b7cd5ab2f9a..e0c5cf9c375 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -358,40 +358,6 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
/**
- * Test if a texture format is a supported compressed format.
- * \param internalFormat the internal format token provided by the user.
- * \return GL_TRUE if compressed, GL_FALSE if uncompressed
- */
-static GLboolean
-is_compressed_format(GLcontext *ctx, GLenum internalFormat)
-{
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return ctx->Extensions.EXT_texture_compression_s3tc;
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return ctx->Extensions.S3_s3tc;
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return ctx->Extensions.EXT_texture_sRGB
- && ctx->Extensions.EXT_texture_compression_s3tc;
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return ctx->Extensions.TDFX_texture_compression_FXT1;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
* For cube map faces, return a face index in [0,5].
* For other targets return 0;
*/
@@ -1355,7 +1321,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
}
/* additional checks for compressed textures */
- if (is_compressed_format(ctx, internalFormat)) {
+ if (_mesa_is_compressed_format(ctx, internalFormat)) {
if (!target_can_be_compressed(ctx, target) && !isProxy) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage%d(target)", dimensions);
@@ -1721,7 +1687,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions,
return GL_TRUE;
}
- if (is_compressed_format(ctx, internalFormat)) {
+ if (_mesa_is_compressed_format(ctx, internalFormat)) {
if (!target_can_be_compressed(ctx, target)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glCopyTexImage%d(target)", dimensions);
@@ -3119,7 +3085,7 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
maxTextureSize = 1 << (maxLevels - 1);
/* This will detect any invalid internalFormat value */
- if (!is_compressed_format(ctx, internalFormat))
+ if (!_mesa_is_compressed_format(ctx, internalFormat))
return GL_INVALID_ENUM;
/* This should really never fail */
@@ -3224,7 +3190,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
maxTextureSize = 1 << (maxLevels - 1);
/* this will catch any invalid compressed format token */
- if (!is_compressed_format(ctx, format))
+ if (!_mesa_is_compressed_format(ctx, format))
return GL_INVALID_ENUM;
if (width < 1 || width > maxTextureSize)