From 294351ff77c5a656bfacb339878e97156398f397 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 3 Feb 2023 18:47:53 -0500 Subject: [PATCH] ail: Test mipmapped_z behaviour The mipmapped_z = true case is checked against Metal, the false case is smoke testing the old behaviour (which is still used for 2D arrays). Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/layout/tests/test-layout.cpp | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/asahi/layout/tests/test-layout.cpp b/src/asahi/layout/tests/test-layout.cpp index 44b16c9..9285cda 100644 --- a/src/asahi/layout/tests/test-layout.cpp +++ b/src/asahi/layout/tests/test-layout.cpp @@ -92,3 +92,40 @@ TEST(Miptree, SomeMipLevels) EXPECT_EQ(layout.size_B, 0x555680); } + +TEST(Miptree, SmallPartialMiptree2DArray) +{ + struct ail_layout layout = { + .width_px = 32, + .height_px = 16, + .depth_px = 64, + .sample_count_sa = 1, + .levels = 4, + .tiling = AIL_TILING_TWIDDLED, + .format = PIPE_FORMAT_R32_FLOAT, + }; + + ail_make_miptree(&layout); + + EXPECT_EQ(layout.layer_stride_B, 0xc00); + EXPECT_EQ(layout.size_B, 0x30000); +} + +TEST(Miptree, SmallPartialMiptree3D) +{ + struct ail_layout layout = { + .width_px = 32, + .height_px = 16, + .depth_px = 64, + .sample_count_sa = 1, + .levels = 4, + .mipmapped_z = true, + .tiling = AIL_TILING_TWIDDLED, + .format = PIPE_FORMAT_R32_FLOAT, + }; + + ail_make_miptree(&layout); + + EXPECT_EQ(layout.layer_stride_B, 0xc80); + EXPECT_EQ(layout.size_B, 0x32000); +} -- 2.7.4