From: Matt Turner Date: Thu, 28 Sep 2017 21:16:18 +0000 (-0700) Subject: gallium: Remove util_format_s3tc_enabled X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3a8a5e77e8f992aaa3539e060885138c2fcddad1;p=mesa.git gallium: Remove util_format_s3tc_enabled Reviewed-by: Nicolai Hähnle Reviewed-by: Emil Velikov --- diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index a6d42a428dc..0fc32316548 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -242,10 +242,6 @@ util_format_is_supported(enum pipe_format format, unsigned bind) return FALSE; } - if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) { - return FALSE; - } - #ifndef TEXTURE_FLOAT_ENABLED if ((bind & PIPE_BIND_RENDER_TARGET) && format != PIPE_FORMAT_R9G9B9E5_FLOAT && diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c index 8c4f2150bef..031255f2b3f 100644 --- a/src/gallium/auxiliary/util/u_format_s3tc.c +++ b/src/gallium/auxiliary/util/u_format_s3tc.c @@ -28,17 +28,7 @@ #include "u_format.h" #include "u_format_s3tc.h" #include "util/format_srgb.h" - - -#if defined(_WIN32) || defined(WIN32) -#define DXTN_LIBNAME "dxtn.dll" -#elif defined(__CYGWIN__) -#define DXTN_LIBNAME "cygtxc_dxtn.dll" -#elif defined(__APPLE__) -#define DXTN_LIBNAME "libtxc_dxtn.dylib" -#else -#define DXTN_LIBNAME "libtxc_dxtn.so" -#endif +#include "../../../mesa/main/texcompress_s3tc_tmp.h" static void @@ -93,8 +83,6 @@ util_format_dxtn_pack_stub(int src_comps, } -boolean util_format_s3tc_enabled = FALSE; - util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = util_format_dxt1_rgb_fetch_stub; util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = util_format_dxt1_rgba_fetch_stub; util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = util_format_dxt3_rgba_fetch_stub; @@ -107,56 +95,16 @@ void util_format_s3tc_init(void) { static boolean first_time = TRUE; - struct util_dl_library *library = NULL; - util_dl_proc fetch_2d_texel_rgb_dxt1; - util_dl_proc fetch_2d_texel_rgba_dxt1; - util_dl_proc fetch_2d_texel_rgba_dxt3; - util_dl_proc fetch_2d_texel_rgba_dxt5; - util_dl_proc tx_compress_dxtn; if (!first_time) return; first_time = FALSE; - if (util_format_s3tc_enabled) - return; - - library = util_dl_open(DXTN_LIBNAME); - if (!library) { - debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn " - "compression/decompression unavailable\n"); - return; - } - - fetch_2d_texel_rgb_dxt1 = - util_dl_get_proc_address(library, "fetch_2d_texel_rgb_dxt1"); - fetch_2d_texel_rgba_dxt1 = - util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt1"); - fetch_2d_texel_rgba_dxt3 = - util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt3"); - fetch_2d_texel_rgba_dxt5 = - util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt5"); - tx_compress_dxtn = - util_dl_get_proc_address(library, "tx_compress_dxtn"); - - if (!util_format_dxt1_rgb_fetch || - !util_format_dxt1_rgba_fetch || - !util_format_dxt3_rgba_fetch || - !util_format_dxt5_rgba_fetch || - !util_format_dxtn_pack) { - debug_printf("couldn't reference all symbols in " DXTN_LIBNAME - ", software DXTn compression/decompression " - "unavailable\n"); - util_dl_close(library); - return; - } - util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgb_dxt1; util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1; util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3; util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5; util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn; - util_format_s3tc_enabled = TRUE; } diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h index ae20010cdf8..42e62bdbb26 100644 --- a/src/gallium/auxiliary/util/u_format_s3tc.h +++ b/src/gallium/auxiliary/util/u_format_s3tc.h @@ -58,8 +58,6 @@ typedef void uint8_t *dst, int dst_stride); -extern boolean util_format_s3tc_enabled; - extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch; extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch; extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 53171162a54..7b694b57551 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -532,10 +532,6 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, format != PIPE_FORMAT_ETC1_RGB8) return FALSE; - if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { - return util_format_s3tc_enabled; - } - /* * Everything can be supported by u_format * (those without fetch_rgba_float might be not but shouldn't hit that) diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 9b16162131f..fd79087287e 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -383,11 +383,6 @@ test_all(unsigned verbose, FILE *fp) if (util_format_is_pure_integer(format)) continue; - if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC && - !util_format_s3tc_enabled) { - continue; - } - /* only have util fetch func for etc1 */ if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC && format != PIPE_FORMAT_ETC1_RGB8) { diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 0c3e097535d..6d6b5fb74ab 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -127,7 +127,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) /* r300 cannot do swizzling of compressed textures. Supported otherwise. */ case PIPE_CAP_TEXTURE_SWIZZLE: - return util_format_s3tc_enabled ? r300screen->caps.dxtc_swizzle : 1; + return r300screen->caps.dxtc_swizzle; /* We don't support color clamping on r500, so that we can use color * intepolators for generic varyings. */ diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 8873c54ebce..0658205f879 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -250,10 +250,6 @@ uint32_t r300_translate_texformat(enum pipe_format format, /* S3TC formats. */ if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { - if (!util_format_s3tc_enabled) { - return ~0; /* Unsupported. */ - } - switch (format) { case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 7e2b34bf798..0e8c5d666ef 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -2405,10 +2405,6 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, } if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { - if (!util_format_s3tc_enabled) { - goto out_unknown; - } - switch (format) { case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 4965a8374ff..67cd1746277 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -1712,10 +1712,6 @@ static uint32_t si_translate_texformat(struct pipe_screen *screen, if (!enable_compressed_formats) goto out_unknown; - if (!util_format_s3tc_enabled) { - goto out_unknown; - } - switch (format) { case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 7e9d9e6592f..50eefe65af7 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -460,10 +460,6 @@ softpipe_is_format_supported( struct pipe_screen *screen, * All other operations (sampling, transfer, etc). */ - if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { - return util_format_s3tc_enabled; - } - /* * Everything else should be supported by u_format. */ diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index ee7782d648d..3ae56f52d5f 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -147,10 +147,6 @@ swr_is_format_supported(struct pipe_screen *_screen, return FALSE; } - if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { - return util_format_s3tc_enabled; - } - return TRUE; } diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 935ce2f9b0a..f2636aac382 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -486,9 +486,7 @@ virgl_is_format_supported( struct pipe_screen *screen, */ if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC) { - if (util_format_s3tc_enabled) - goto out_lookup; - return FALSE; + goto out_lookup; } if (format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC) { goto out_lookup; diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 1d9f441223e..803264a58f1 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -505,19 +505,6 @@ dri_init_screen_helper(struct dri_screen *screen, else screen->target = PIPE_TEXTURE_RECT; - /* Handle force_s3tc_enable. */ - if (!util_format_s3tc_enabled && screen->options.force_s3tc_enable) { - /* Ensure libtxc_dxtn has been loaded if available. - * Forcing S3TC on before calling this would prevent loading - * the library. - * This is just a precaution, the driver should have called it - * already. - */ - util_format_s3tc_init(); - - util_format_s3tc_enabled = TRUE; - } - dri_postprocessing_init(screen); screen->st_api->query_versions(screen->st_api, &screen->base, diff --git a/src/gallium/tests/unit/u_format_test.c b/src/gallium/tests/unit/u_format_test.c index 69d6c7dd3a2..2152b227f6a 100644 --- a/src/gallium/tests/unit/u_format_test.c +++ b/src/gallium/tests/unit/u_format_test.c @@ -722,11 +722,6 @@ test_all(void) assert(format_desc->block.height <= UTIL_FORMAT_MAX_UNPACKED_HEIGHT); assert(format_desc->block.width <= UTIL_FORMAT_MAX_UNPACKED_WIDTH); - if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC && - !util_format_s3tc_enabled) { - continue; - } - # define TEST_ONE_FUNC(name) \ if (format_desc->name) { \ if (!test_one_func(format_desc, &test_format_##name, #name)) { \