diff --git a/src/asahi/layout/layout.c b/src/asahi/layout/layout.c index 15204ab3f28..e13e10b7115 100644 --- a/src/asahi/layout/layout.c +++ b/src/asahi/layout/layout.c @@ -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"); } diff --git a/src/asahi/layout/layout.h b/src/asahi/layout/layout.h index 9d9baa79130..69eba327c64 100644 --- a/src/asahi/layout/layout.h +++ b/src/asahi/layout/layout.h @@ -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)); }