mesa: add ATI_texture_compression_3dc
authorMarek Olšák <maraeo@gmail.com>
Mon, 7 Mar 2011 01:18:49 +0000 (02:18 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 8 Mar 2011 22:52:37 +0000 (23:52 +0100)
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
src/mesa/main/glheader.h
src/mesa/main/image.c
src/mesa/main/mtypes.h
src/mesa/main/texcompress.c
src/mesa/main/texformat.c
src/mesa/main/teximage.c

index 519e94fec12cc59083c7bdd22b728cabc4186fe6..68740e24cc197e3b86e278a0031719273f86e515 100644 (file)
@@ -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;
index 08ad5f320183a969d37cee759e328893b5c6da3b..0df811986617e5288be62fe295115675c914d5d9 100644 (file)
@@ -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
 
 
 /**
index 18abf2882af009a8683729c546adc81eafb151f0..bbde3800e8c9b5df4d8590508251db3dc503c3b0 100644 (file)
@@ -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;
    }
index d10bb05b9ab12fd1f5aa20003994d56e8d95a938..695d936527d07cd0fed35781711c3294b44adddc 100644 (file)
@@ -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;
index 942d996695e15ddb3aa2df61d3025d8270b1f83c..d820ae92747c5f7a2135a301a25b697285ee597f 100644 (file)
@@ -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;
index 521b9a04b71beae62da1fe42f4a8120c2c7bab4b..5eabf2aa527325ea5cb48c01e0f1cbd7f686a830 100644 (file)
@@ -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;
 }
index 6ec66100e7abb64817f48f10af6793bc7cf7949f..2a3037f6189c27ff75b67c3efc0122c4c753c81a 100644 (file)
@@ -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 */
 }