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 <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20031>
This commit is contained in:
Asahi Lina 2022-11-28 16:39:28 +09:00 committed by Marge Bot
parent ecdcb3e1aa
commit c39ca7007f

View file

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