summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format_s3tc.c
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-04-02 05:23:32 +0200
committerLuca Barbieri <luca@luca-barbieri.com>2010-04-02 06:16:30 +0200
commit5126683e3b971ccfb51e50e560750ce44e86bae8 (patch)
treeccdb7104752d266653a1201a97e551bed94ecd23 /src/gallium/auxiliary/util/u_format_s3tc.c
parent52e9b990a192a9329006d5f7dd2ac222effea5a5 (diff)
gallium/util: add util_format_is_supported to check for pack/unpack
This improves the code by making it more readable, and removes special knowledge of S3TC and other formats from softpipe.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_s3tc.c')
-rw-r--r--src/gallium/auxiliary/util/u_format_s3tc.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
index 8a5e6f0c437..c1c844e420e 100644
--- a/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -86,7 +86,6 @@ void util_format_dxtn_pack_stub( int src_comps,
util_format_dxtn_pack_stub(src_comps, width, height, src, dst_format, dst, dst_stride);
}
-boolean util_format_s3tc_enabled = FALSE;
boolean util_format_s3tc_inited = FALSE;
util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = util_format_dxt1_rgb_fetch_stub;
@@ -141,12 +140,23 @@ util_format_s3tc_do_init(void)
!is_nop(util_format_dxt5_rgba_fetch) &&
!is_nop(util_format_dxtn_pack)) {
debug_printf("software DXTn compression/decompression available");
- util_format_s3tc_enabled = TRUE;
} else
debug_printf("couldn't reference all symbols in "
- DXTN_LIBNAME ", software DXTn compression/decompression "
- "unavailable");
+ DXTN_LIBNAME ", software DXTn compression/decompression "
+ "unavailable or partially available");
}
+
+#define DO(n, a, A) \
+ ((struct util_format_description *)util_format_description(PIPE_FORMAT_DXT##n##_SRGB##A))->is_supported = \
+ ((struct util_format_description *)util_format_description(PIPE_FORMAT_DXT##n##_RGB##A))->is_supported = \
+ !is_nop(util_format_dxt##n##_rgb##a##_fetch);
+
+ DO(1,,);
+ DO(1,a,A);
+ DO(3,a,A);
+ DO(5,a,A);
+
+#undef DO
}