swrast: add RGTC support
authorDave Airlie <airlied@redhat.com>
Thu, 24 Feb 2011 04:27:18 +0000 (14:27 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 28 Feb 2011 03:35:35 +0000 (13:35 +1000)
src/mesa/main/extensions.c
src/mesa/main/texformat.c

index 7504b8a85db6589724e729a6cec81f8aac684d4b..310740b0dd139e1834bde104b39d8139e1c06edc 100644 (file)
@@ -428,6 +428,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
    ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
    ctx->Extensions.ARB_texture_rg = GL_TRUE;
+   ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE;
    ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
 #if FEATURE_ARB_vertex_program
    ctx->Extensions.ARB_vertex_program = GL_TRUE;
index 2542cea856b65154e1b15504bc523b1b65b2b7f0..72025cf828e8b1b36a5923c0f8496f532cd43cb0 100644 (file)
@@ -602,6 +602,25 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
       }
    }
 
+   if (ctx->Extensions.ARB_texture_compression_rgtc) {
+      switch (internalFormat) {
+         case GL_COMPRESSED_RED_RGTC1:
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
+           break;
+         case GL_COMPRESSED_SIGNED_RED_RGTC1:
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RED_RGTC1);
+           break;
+         case GL_COMPRESSED_RG_RGTC2:
+           RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
+           break;
+         case GL_COMPRESSED_SIGNED_RG_RGTC2:
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG_RGTC2);
+           break;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
    _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
    return MESA_FORMAT_NONE;
 }