summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-02-22 10:35:15 +1000
committerDave Airlie <[email protected]>2011-02-28 13:35:34 +1000
commit8d47c919859e9cd90cfc04eb220ac8a5aa87048e (patch)
tree4f7a1e4148d8268f32f2d0ca63becf50da56181a /src/mesa/main/texcompress.c
parente792e79f5ae6be008d9521eccf1c647492cd682a (diff)
mesa: Add RGTC texture store/fetch support.
This adds support for the RGTC unsigned and signed texture storage and fetch methods. the code is a port of the DXT5 alpha compression code. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/texcompress.c')
-rw-r--r--src/mesa/main/texcompress.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index 7a0b522a2d8..82d02ed0ecf 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -64,6 +64,7 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean a
n += 2;
}
}
+ /* don't return RGTC - ARB_texture_compression_rgtc query 19 */
if (ctx->Extensions.EXT_texture_compression_s3tc) {
if (formats) {
formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
@@ -163,6 +164,15 @@ _mesa_glenum_to_compressed_format(GLenum format)
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
return MESA_FORMAT_SRGBA_DXT5;
+ case GL_COMPRESSED_RED_RGTC1:
+ return MESA_FORMAT_RED_RGTC1;
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
+ return MESA_FORMAT_SIGNED_RED_RGTC1;
+ case GL_COMPRESSED_RG_RGTC2:
+ return MESA_FORMAT_RG_RGTC2;
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
+ return MESA_FORMAT_SIGNED_RG_RGTC2;
+
default:
return MESA_FORMAT_NONE;
}
@@ -209,6 +219,16 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
#endif
#endif
+
+ case MESA_FORMAT_RED_RGTC1:
+ return GL_COMPRESSED_RED_RGTC1;
+ case MESA_FORMAT_SIGNED_RED_RGTC1:
+ return GL_COMPRESSED_SIGNED_RED_RGTC1;
+ case MESA_FORMAT_RG_RGTC2:
+ return GL_COMPRESSED_RG_RGTC2;
+ case MESA_FORMAT_SIGNED_RG_RGTC2:
+ return GL_COMPRESSED_SIGNED_RG_RGTC2;
+
default:
_mesa_problem(ctx, "Unexpected mesa texture format in"
" _mesa_compressed_format_to_glenum()");