diff --git a/src/asahi/layout/layout.c b/src/asahi/layout/layout.c index 280466ed524..8ad7514c7e2 100644 --- a/src/asahi/layout/layout.c +++ b/src/asahi/layout/layout.c @@ -249,8 +249,12 @@ ail_make_miptree(struct ail_layout *layout) * allocate them all. */ if (layout->levels > 1) { - layout->levels = - util_logbase2(MAX2(layout->width_px, layout->height_px)) + 1; + unsigned major_axis_px = MAX2(layout->width_px, layout->height_px); + + if (layout->mipmapped_z) + major_axis_px = MAX2(major_axis_px, layout->depth_px); + + layout->levels = util_logbase2(major_axis_px) + 1; } assert(util_format_get_blockdepth(layout->format) == 1 && diff --git a/src/asahi/layout/layout.h b/src/asahi/layout/layout.h index d0d97a16fd1..fcb57cee8b2 100644 --- a/src/asahi/layout/layout.h +++ b/src/asahi/layout/layout.h @@ -79,6 +79,12 @@ struct ail_layout { /** Number of miplevels. 1 if no mipmapping is used. */ uint8_t levels; + /** Should this image be mipmapped along the Z-axis in addition to the X- and + * Y-axes? This should be set for API-level 3D images, but not 2D arrays or + * cubes. + */ + bool mipmapped_z; + /** Tiling mode used */ enum ail_tiling tiling;