From 5126683e3b971ccfb51e50e560750ce44e86bae8 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 2 Apr 2010 05:23:32 +0200 Subject: 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. --- src/gallium/auxiliary/util/u_format_s3tc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/gallium/auxiliary/util/u_format_s3tc.c') diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c index 8a5e6f0c43..c1c844e420 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 } -- cgit v1.2.3