diff --git a/src/mesa/main/tests/disable_windows_include.c b/src/mesa/main/tests/disable_windows_include.c index 3f85d716881..5ea32dcee62 100644 --- a/src/mesa/main/tests/disable_windows_include.c +++ b/src/mesa/main/tests/disable_windows_include.c @@ -112,7 +112,6 @@ #include #include #include -#include #include #include #include @@ -257,6 +256,7 @@ #include #include #include +#include #include #include #include diff --git a/src/mesa/meson.build b/src/mesa/meson.build index bfce1af9c1c..2b801082eac 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -200,8 +200,6 @@ files_libmesa = files( 'main/syncobj.h', 'main/texcompress.c', 'main/texcompress.h', - 'main/texcompress_astc.cpp', - 'main/texcompress_astc.h', 'main/texcompress_bptc.c', 'main/texcompress_bptc.h', 'main/texcompress_cpal.c', diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f2466cfc983..4773350e3d3 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -45,7 +45,7 @@ #include "main/pixeltransfer.h" #include "main/renderbuffer.h" #include "main/texcompress.h" -#include "main/texcompress_astc.h" +#include "util/texcompress_astc.h" #include "main/texcompress_bptc.h" #include "main/texcompress_etc.h" #include "main/texcompress_rgtc.h" diff --git a/src/mesa/state_tracker/st_texcompress_compute.c b/src/mesa/state_tracker/st_texcompress_compute.c index c0bfb083cec..e750ac016a7 100644 --- a/src/mesa/state_tracker/st_texcompress_compute.c +++ b/src/mesa/state_tracker/st_texcompress_compute.c @@ -32,7 +32,7 @@ #include "main/context.h" #include "main/shaderapi.h" #include "main/shaderobj.h" -#include "main/texcompress_astc.h" +#include "util/texcompress_astc.h" #include "util/texcompress_astc_luts_wrap.h" #include "main/uniforms.h" diff --git a/src/util/meson.build b/src/util/meson.build index 14b3af1176d..a60fbc7b660 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -130,6 +130,8 @@ files_mesa_util = files( 'texcompress_astc_luts.h', 'texcompress_astc_luts_wrap.cpp', 'texcompress_astc_luts_wrap.h', + 'texcompress_astc.cpp', + 'texcompress_astc.h', 'timespec.h', 'u_atomic.c', 'u_atomic.h', diff --git a/src/mesa/main/texcompress_astc.cpp b/src/util/texcompress_astc.cpp similarity index 99% rename from src/mesa/main/texcompress_astc.cpp rename to src/util/texcompress_astc.cpp index 4f8f4f50922..8441cce4f5d 100644 --- a/src/mesa/main/texcompress_astc.cpp +++ b/src/util/texcompress_astc.cpp @@ -38,6 +38,7 @@ #include "util/half_float.h" #include #include // for abort() on windows +#include static bool VERBOSE_DECODE = false; static bool VERBOSE_WRITE = false; @@ -1810,13 +1811,15 @@ _mesa_unpack_astc_2d_ldr(uint8_t *dst_row, unsigned src_stride, unsigned src_width, unsigned src_height, - mesa_format format) + enum pipe_format format) { - assert(_mesa_is_format_astc_2d(format)); - bool srgb = _mesa_is_format_srgb(format); + const struct util_format_description *desc = + util_format_description(format); + assert(desc && desc->layout == UTIL_FORMAT_LAYOUT_ASTC && + desc->block.depth == 1); + bool srgb = util_format_is_srgb(format); - unsigned blk_w, blk_h; - _mesa_get_format_block_size(format, &blk_w, &blk_h); + unsigned blk_w = desc->block.width, blk_h = desc->block.height; const unsigned block_size = 16; unsigned x_blocks = (src_width + blk_w - 1) / blk_w; diff --git a/src/mesa/main/texcompress_astc.h b/src/util/texcompress_astc.h similarity index 94% rename from src/mesa/main/texcompress_astc.h rename to src/util/texcompress_astc.h index 9f9c5281dda..b26436d82d2 100644 --- a/src/mesa/main/texcompress_astc.h +++ b/src/util/texcompress_astc.h @@ -25,7 +25,7 @@ #define TEXCOMPRESS_ASTC_H #include -#include "texcompress.h" +#include "util/format/u_format.h" #ifdef __cplusplus extern "C" { @@ -38,7 +38,7 @@ _mesa_unpack_astc_2d_ldr(uint8_t *dst_row, unsigned src_stride, unsigned src_width, unsigned src_height, - mesa_format format); + enum pipe_format format); #ifdef __cplusplus }