diff options
author | marha <marha@users.sourceforge.net> | 2009-12-22 17:33:44 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-12-22 17:33:44 +0000 |
commit | b729d9e1cc1c60e415da24143cabcbaccb525ed7 (patch) | |
tree | 54fc81d1a046dc5ec6f4aa2a2d8a2ad015c423fd /mesalib/src/mesa/main/texcompress.c | |
parent | 0695dfb71ca6fe132d15a4d0890e8a868183adf9 (diff) | |
download | vcxsrv-b729d9e1cc1c60e415da24143cabcbaccb525ed7.tar.gz vcxsrv-b729d9e1cc1c60e415da24143cabcbaccb525ed7.tar.bz2 vcxsrv-b729d9e1cc1c60e415da24143cabcbaccb525ed7.zip |
Updated to mesa_7_6_1_rc1
Diffstat (limited to 'mesalib/src/mesa/main/texcompress.c')
-rw-r--r-- | mesalib/src/mesa/main/texcompress.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c index c1b8c7675..2cda4dd85 100644 --- a/mesalib/src/mesa/main/texcompress.c +++ b/mesalib/src/mesa/main/texcompress.c @@ -360,3 +360,53 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, return addr; } + + +/** + * Given a compressed MESA_FORMAT_x value, return the corresponding + * GLenum for that format. + * This is needed for glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT) + * which must return the specific texture format used when the user might + * have originally specified a generic compressed format in their + * glTexImage2D() call. + * For non-compressed textures, we always return the user-specified + * internal format unchanged. + */ +GLenum +_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat) +{ + switch (mesaFormat) { +#if FEATURE_texture_fxt1 + case MESA_FORMAT_RGB_FXT1: + return GL_COMPRESSED_RGB_FXT1_3DFX; + case MESA_FORMAT_RGBA_FXT1: + return GL_COMPRESSED_RGBA_FXT1_3DFX; +#endif +#if FEATURE_texture_s3tc + case MESA_FORMAT_RGB_DXT1: + return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; + case MESA_FORMAT_RGBA_DXT1: + return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + case MESA_FORMAT_RGBA_DXT3: + return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + case MESA_FORMAT_RGBA_DXT5: + return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; + case MESA_FORMAT_SRGBA_DXT1: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; + case MESA_FORMAT_SRGBA_DXT3: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; + case MESA_FORMAT_SRGBA_DXT5: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; +#endif +#endif + default: + _mesa_problem(ctx, "Unexpected mesa texture format in" + " _mesa_compressed_format_to_glenum()"); + return 0; + } +} + + |