From c39ca7007f46bb57ff80768eadf0870a68c650f4 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Mon, 28 Nov 2022 16:39:28 +0900 Subject: [PATCH] ail: Fix logic for buffer alignment It turns out that specifically Z/S single-layer textures have the main miptree padded to the page size, but not others. Signed-off-by: Asahi Lina Part-of: --- src/asahi/layout/layout.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/asahi/layout/layout.c b/src/asahi/layout/layout.c index 4a472ace14c..e88cdaa0c83 100644 --- a/src/asahi/layout/layout.c +++ b/src/asahi/layout/layout.c @@ -163,12 +163,12 @@ ail_initialize_twiddled(struct ail_layout *layout) poth_el = u_minify(poth_el, 1); } - /* Arrays and cubemaps have the entire miptree duplicated and page aligned, - * but only when mipmaps are enabled and the layer is larger than one page. - */ - if ((layout->levels != 1 && layout->depth_px != 1 && offset_B > AIL_PAGESIZE) - || layout->tiling != AIL_TILING_TWIDDLED_COMPRESSED) - layout->page_aligned_layers = true; + /* Align layer size if we have mipmaps and one miptree is larger than one page */ + layout->page_aligned_layers = layout->levels != 1 && offset_B > AIL_PAGESIZE; + + /* Single-layer images are not padded unless they are Z/S */ + if (layout->depth_px == 1 && !util_format_is_depth_or_stencil(layout->format)) + layout->page_aligned_layers = false; if (layout->page_aligned_layers) layout->layer_stride_B = ALIGN_POT(offset_B, AIL_PAGESIZE);