From 69f16accd0aa3b8d414092a5e52ccc99649da01a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 7 Mar 2011 02:18:49 +0100 Subject: [PATCH] mesa: add ATI_texture_compression_3dc LUMINANCE_ALPHA_LATC2 = LUMINANCE_ALPHA_3DC, so this is easy. Note that there is no specification for 3DC, just a few white papers from ATI. --- src/mesa/main/extensions.c | 2 ++ src/mesa/main/glheader.h | 4 ++++ src/mesa/main/image.c | 3 +++ src/mesa/main/mtypes.h | 1 + src/mesa/main/texcompress.c | 1 + src/mesa/main/texformat.c | 10 ++++++++++ src/mesa/main/teximage.c | 9 +++++++++ 7 files changed, 30 insertions(+) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 519e94fec12..68740e24cc1 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -259,6 +259,7 @@ static const struct extension extension_table[] = { { "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GL }, { "GL_ATI_fragment_shader", o(ATI_fragment_shader), GL }, { "GL_ATI_separate_stencil", o(ATI_separate_stencil), GL }, + { "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), GL }, { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GL }, { "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL }, { "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL }, @@ -449,6 +450,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) #if FEATURE_ATI_fragment_shader ctx->Extensions.ATI_fragment_shader = GL_TRUE; #endif + ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE; ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE; ctx->Extensions.ATI_texture_mirror_once = GL_TRUE; ctx->Extensions.ATI_separate_stencil = GL_TRUE; diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 08ad5f32018..0df81198661 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -121,6 +121,10 @@ typedef void *GLeglImageOES; #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD #endif +#ifndef GL_ATI_texture_compression_3dc +#define GL_ATI_texture_compression_3dc 1 +#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 +#endif /** diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 18abf2882af..bbde3800e8c 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -747,6 +747,7 @@ _mesa_is_color_format(GLenum format) case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: + case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: /* signed, normalized texture formats */ case GL_RGBA_SNORM: case GL_RGBA8_SNORM: @@ -1034,6 +1035,8 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format) case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return ctx->Extensions.EXT_texture_compression_latc; + case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: + return ctx->Extensions.ATI_texture_compression_3dc; default: return GL_FALSE; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d10bb05b9ab..695d936527d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2828,6 +2828,7 @@ struct gl_extensions GLboolean APPLE_vertex_array_object; GLboolean APPLE_object_purgeable; GLboolean ATI_envmap_bumpmap; + GLboolean ATI_texture_compression_3dc; GLboolean ATI_texture_mirror_once; GLboolean ATI_texture_env_combine3; GLboolean ATI_fragment_shader; diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 942d996695e..d820ae92747 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -178,6 +178,7 @@ _mesa_glenum_to_compressed_format(GLenum format) case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: return MESA_FORMAT_SIGNED_L_LATC1; case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: + case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: return MESA_FORMAT_LA_LATC2; case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: return MESA_FORMAT_SIGNED_LA_LATC2; diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 521b9a04b71..5eabf2aa527 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -640,6 +640,16 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, } } + if (ctx->Extensions.ATI_texture_compression_3dc) { + switch (internalFormat) { + case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2); + break; + default: + ; /* fallthrough */ + } + } + _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); return MESA_FORMAT_NONE; } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 6ec66100e7a..2a3037f6189 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -522,6 +522,15 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) } } + if (ctx->Extensions.ATI_texture_compression_3dc) { + switch (internalFormat) { + case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: + return GL_LUMINANCE_ALPHA; + default: + ; /* fallthrough */ + } + } + return -1; /* error */ } -- 2.30.2