ail: Support linear 2D arrays

These are straightforward.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20446>
This commit is contained in:
Alyssa Rosenzweig
2022-12-20 20:57:21 -05:00
parent 35494ea83e
commit d703c2887d
2 changed files with 8 additions and 5 deletions

View File

@@ -36,7 +36,11 @@ ail_initialize_linear(struct ail_layout *layout)
assert((layout->linear_stride_B % 16) == 0 && "Strides must be aligned");
layout->size_B = layout->linear_stride_B * layout->height_px;
/* Layer stride must be cache line aligned to pack linear 2D arrays */
layout->layer_stride_B =
ALIGN_POT(layout->linear_stride_B * layout->height_px, AIL_CACHELINE);
layout->size_B = layout->layer_stride_B * layout->depth_px;
}
/*
@@ -224,9 +228,9 @@ ail_make_miptree(struct ail_layout *layout)
{
assert(layout->width_px >= 1 && "Invalid dimensions");
assert(layout->height_px >= 1 && "Invalid dimensions");
assert(layout->depth_px >= 1 && "Invalid dimensions");
if (layout->tiling == AIL_TILING_LINEAR) {
assert(layout->depth_px == 1 && "Invalid linear layout");
assert(layout->levels == 1 && "Invalid linear layout");
assert(layout->sample_count_sa == 1 &&
"Multisampled linear layouts not supported");
@@ -236,7 +240,6 @@ ail_make_miptree(struct ail_layout *layout)
"Strided linear block formats unsupported");
} else {
assert(layout->linear_stride_B == 0 && "Invalid nonlinear layout");
assert(layout->depth_px >= 1 && "Invalid dimensions");
assert(layout->levels >= 1 && "Invalid dimensions");
assert(layout->sample_count_sa >= 1 && "Invalid sample count");
}

View File

@@ -181,7 +181,6 @@ ail_get_linear_pixel_B(struct ail_layout *layout, ASSERTED unsigned level,
uint32_t x_px, uint32_t y_px, uint32_t z_px)
{
assert(level == 0 && "Strided linear mipmapped textures are unsupported");
assert(z_px == 0 && "Strided linear 3D textures are unsupported");
assert(util_format_get_blockwidth(layout->format) == 1 &&
"Strided linear block formats unsupported");
assert(util_format_get_blockheight(layout->format) == 1 &&
@@ -189,7 +188,8 @@ ail_get_linear_pixel_B(struct ail_layout *layout, ASSERTED unsigned level,
assert(layout->sample_count_sa == 1 &&
"Strided linear multisampling unsupported");
return (y_px * ail_get_linear_stride_B(layout, level)) +
return ail_get_layer_offset_B(layout, z_px) +
(y_px * ail_get_linear_stride_B(layout, level)) +
(x_px * util_format_get_blocksize(layout->format));
}