mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 07:20:16 +01:00
gallium: Remove util_format_s3tc_enabled
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
f6c56e07fc
commit
3a8a5e77e8
14 changed files with 3 additions and 110 deletions
|
|
@ -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 &&
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)) { \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue