diff --git a/src/asahi/layout/tests/test-layout.cpp b/src/asahi/layout/tests/test-layout.cpp index 9285cda9aa7..1cc7c436793 100644 --- a/src/asahi/layout/tests/test-layout.cpp +++ b/src/asahi/layout/tests/test-layout.cpp @@ -42,6 +42,30 @@ TEST(Cubemap, Nonmipmapped) EXPECT_EQ(layout.size_B, ALIGN_POT(512 * 512 * 4 * 6, 0x4000)); } +TEST(Cubemap, RoundsToOnePage) +{ + struct ail_layout layout = { + .width_px = 63, + .height_px = 63, + .depth_px = 6, + .sample_count_sa = 1, + .levels = 6, + .tiling = AIL_TILING_TWIDDLED, + .format = PIPE_FORMAT_R32_FLOAT, + }; + + ail_make_miptree(&layout); + + EXPECT_EQ(layout.level_offsets_B[0], 0); + EXPECT_EQ(layout.level_offsets_B[1], 0x4000); + EXPECT_EQ(layout.level_offsets_B[2], 0x5000); + EXPECT_EQ(layout.level_offsets_B[3], 0x5400); + EXPECT_EQ(layout.level_offsets_B[4], 0x5500); + EXPECT_TRUE(layout.page_aligned_layers); + EXPECT_EQ(layout.layer_stride_B, 0x8000); + EXPECT_EQ(layout.size_B, 0x30000); +} + TEST(Linear, SmokeTestBuffer) { struct ail_layout layout = {