Mesa (master): swrast: add RGTC support

Dave Airlie airlied at kemper.freedesktop.org
Mon Feb 28 03:38:30 UTC 2011


Module: Mesa
Branch: master
Commit: 903726d2859d6ce51e4bc96038be1830bd276f1a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=903726d2859d6ce51e4bc96038be1830bd276f1a

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Feb 24 14:27:18 2011 +1000

swrast: add RGTC support

---

 src/mesa/main/extensions.c |    1 +
 src/mesa/main/texformat.c  |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 7504b8a..310740b 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -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;
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 2542cea..72025cf 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -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;
 }




More information about the mesa-commit mailing list