#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
}
-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;
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;
}
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,