ail: Add layout->mipmapped_z input

For 3D images, the full miptree depends on the depth of the image, in contrast
to 2D arrays. We need to account for this to calculate the correct layer
strides.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21114>
This commit is contained in:
Alyssa Rosenzweig 2023-02-03 18:46:20 -05:00 committed by Marge Bot
parent 60d7e15a7e
commit c2bf66ab87
2 changed files with 12 additions and 2 deletions

View file

@ -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 &&

View file

@ -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;