ac/surface: use align with NPOT for estimating surface size
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

ac_estimate_size() triggers an assertion because the block size isn't
aligned to a power of two for ASTC formats.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35879>
This commit is contained in:
Samuel Pitoiset 2025-07-02 14:37:36 +02:00 committed by Marge Bot
parent 25536c7d4d
commit cb6f2d9409

View file

@ -1205,8 +1205,8 @@ static uint64_t ac_estimate_size(const struct ac_surf_config *config,
assert(bpp);
unsigned num_samples = MAX2(1, config->info.samples);
unsigned bpe = bpp / 8;
unsigned width = align(in_width, align_width * blk_w);
unsigned height = align(in_height , align_height * blk_h);
unsigned width = util_align_npot(in_width, align_width * blk_w);
unsigned height = util_align_npot(in_height , align_height * blk_h);
unsigned depth = align(config->is_3d ? config->info.depth :
config->is_cube ? 6 : config->info.array_size, align_depth);
unsigned tile_size_bytes = align_width * align_height * align_depth * num_samples * bpe;