From ace10fdba34cb40ef1a333efed858806bda8ca0c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 16:09:54 +0000 Subject: [PATCH] feat(agc): detile the display, T and 4 KiB XOR swizzle modes Textures in SW_256B_D, SW_4KB_D, SW_64KB_D, SW_64KB_S_T, SW_64KB_D_T, SW_4KB_S_X and SW_4KB_D_X (tile modes 2, 6, 10, 17, 18, 21 and 22) threw while their T# was decoded. They are detiled with address equations generated from AMD addrlib's GFX10 swizzle patterns for the same 16-pipe non-RB+ configuration as the 64 KiB XOR table, and share the block shape and mip tail placement of the standard mode of their block size. The pipe/bank XOR base check of the XOR and T modes now uses the block size. Co-Authored-By: Claude Opus 5.5 --- .../Graphics/include/GuestTextureResource.hpp | 20 +++++++++ .../include/TextureSwizzleEquations.hpp | 37 ++++++++++++++- .../Graphics/src/GuestTextureResource.cpp | 9 +++- .../Graphics/src/TextureDetiler.cpp | 13 ++++-- .../Graphics/src/TextureTiling.cpp | 22 +++++++-- .../tests/GuestTextureResource.cpp | 16 ++++++- .../libSceAgcDriver/tests/TextureDetiler.cpp | 4 ++ .../libSceAgcDriver/tests/TextureTiling.cpp | 45 +++++++++++++++++++ 8 files changed, 156 insertions(+), 10 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp b/core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp index ff748b63d..6397574f3 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp @@ -17,6 +17,13 @@ enum class TextureTileMode { kS64KBX, kD64KBX, kR64KBX, + kD256B, + kD4KB, + kD64KB, + kS64KBT, + kD64KBT, + kS4KBX, + kD4KBX, // Upstream's name for SW_64KB_R_X (tile mode 0x1b). RenderTarget64KB = kR64KBX }; @@ -28,10 +35,23 @@ constexpr std::uint32_t XorSwizzleMode(TextureTileMode mode) { case TextureTileMode::kS64KBX: return 25u; case TextureTileMode::kD64KBX: return 26u; case TextureTileMode::kR64KBX: return 27u; + case TextureTileMode::kS64KBT: return 17u; + case TextureTileMode::kD64KBT: return 18u; + case TextureTileMode::kS4KBX: return 21u; + case TextureTileMode::kD4KBX: return 22u; default: return 0u; } } +constexpr std::uint32_t EquationSwizzleMode(TextureTileMode mode) { + switch (mode) { + case TextureTileMode::kD256B: return 2u; + case TextureTileMode::kD4KB: return 6u; + case TextureTileMode::kD64KB: return 10u; + default: return XorSwizzleMode(mode); + } +} + enum class TextureDimension { k1D, k2D, diff --git a/core/libs/prx/libSceAgcDriver/Graphics/include/TextureSwizzleEquations.hpp b/core/libs/prx/libSceAgcDriver/Graphics/include/TextureSwizzleEquations.hpp index b144a43a8..aa49c3148 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/include/TextureSwizzleEquations.hpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/include/TextureSwizzleEquations.hpp @@ -6,7 +6,7 @@ namespace AgcDriver::Graphics { -// Address equations of the 64 KiB XOR swizzle modes (SW_64KB_Z_X, S_X, D_X, R_X) for the PS5 GPU, a +// Address equations of the 64 KiB XOR swizzle modes (SW_64KB_Z_X, S_X, D_X, R_X), the display, T and 4 KiB XOR modes for the PS5 GPU, a // Navi1x-class part with 16 pipes. Generated from AMD addrlib's GFX10 non-RB+ swizzle pattern tables // (the 32 bpp R_X entry reproduces the scanout layout in ColorTargetLayout). // Each entry gives, for byte-address bit 0..15 inside a block, the element-coordinate bits XORed into it: @@ -38,6 +38,41 @@ inline constexpr TextureSwizzleEquation kTextureSwizzleEquations[] = { {27u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x08008008u, 0x04010010u, 0x02020040u, 0x01040020u, 0x00008000u, 0x00000010u, 0x00040000u, 0x00000040u}}, {27u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00000004u, 0x00002000u, 0x08008008u, 0x04010010u, 0x02020040u, 0x01040020u, 0x00004000u, 0x00000008u, 0x00010000u, 0x00000040u}}, {27u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00002000u, 0x08008008u, 0x04010010u, 0x02020040u, 0x01040020u, 0x00004000u, 0x00000004u, 0x00008000u, 0x00000010u}}, + {2u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00001000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {2u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {2u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {2u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {2u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00002000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {6u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00001000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00010000u, 0x00000010u, 0x00020000u, 0x00000020u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {6u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00000010u, 0x00010000u, 0x00000020u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {6u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00008000u, 0x00000008u, 0x00010000u, 0x00000010u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {6u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00000010u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {6u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00008000u, 0x00000008u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {10u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00001000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00010000u, 0x00000010u, 0x00020000u, 0x00000020u, 0x00040000u, 0x00000040u, 0x00080000u, 0x00000080u}}, + {10u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00000010u, 0x00010000u, 0x00000020u, 0x00020000u, 0x00000040u, 0x00040000u, 0x00000080u}}, + {10u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00008000u, 0x00000008u, 0x00010000u, 0x00000010u, 0x00020000u, 0x00000020u, 0x00040000u, 0x00000040u}}, + {10u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00000010u, 0x00010000u, 0x00000020u, 0x00020000u, 0x00000040u}}, + {10u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00008000u, 0x00000008u, 0x00010000u, 0x00000010u, 0x00020000u, 0x00000020u}}, + {17u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00000008u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00008000u, 0x00010080u, 0x00080010u, 0x00020040u, 0x00040020u, 0x00040000u, 0x00000040u, 0x00080000u, 0x00000080u}}, + {17u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00008080u, 0x00040010u, 0x00010040u, 0x00020020u, 0x00020000u, 0x00000040u, 0x00040000u, 0x00000080u}}, + {17u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00008040u, 0x00040008u, 0x00010020u, 0x00020010u, 0x00020000u, 0x00000020u, 0x00040000u, 0x00000040u}}, + {17u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00002000u, 0x00000002u, 0x00000004u, 0x00004040u, 0x00020008u, 0x00008020u, 0x00010010u, 0x00010000u, 0x00000020u, 0x00020000u, 0x00000040u}}, + {17u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00001000u, 0x00002000u, 0x00000001u, 0x00000002u, 0x00004020u, 0x00020004u, 0x00008010u, 0x00010008u, 0x00010000u, 0x00000010u, 0x00020000u, 0x00000020u}}, + {18u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00001000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x00010080u, 0x00080010u, 0x00020040u, 0x00040020u, 0x00040000u, 0x00000040u, 0x00080000u, 0x00000080u}}, + {18u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x00008080u, 0x00040010u, 0x00010040u, 0x00020020u, 0x00020000u, 0x00000040u, 0x00040000u, 0x00000080u}}, + {18u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x00008040u, 0x00040008u, 0x00010020u, 0x00020010u, 0x00020000u, 0x00000020u, 0x00040000u, 0x00000040u}}, + {18u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00004040u, 0x00020008u, 0x00008020u, 0x00010010u, 0x00010000u, 0x00000020u, 0x00020000u, 0x00000040u}}, + {18u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00002000u, 0x00004020u, 0x00020004u, 0x00008010u, 0x00010008u, 0x00010000u, 0x00000010u, 0x00020000u, 0x00000020u}}, + {21u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00000008u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00008000u, 0x08010080u, 0x04080010u, 0x02020040u, 0x01040020u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {21u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x08008080u, 0x04040010u, 0x02010040u, 0x01020020u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {21u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x08008040u, 0x04040008u, 0x02010020u, 0x01020010u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {21u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00002000u, 0x00000002u, 0x00000004u, 0x08004040u, 0x04020008u, 0x02008020u, 0x01010010u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {21u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00001000u, 0x00002000u, 0x00000001u, 0x00000002u, 0x08004020u, 0x04020004u, 0x02008010u, 0x01010008u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {22u, 1u, {0x00000001u, 0x00000002u, 0x00000004u, 0x00002000u, 0x00001000u, 0x00004000u, 0x00000008u, 0x00008000u, 0x08010080u, 0x04080010u, 0x02020040u, 0x01040020u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {22u, 2u, {0x00000000u, 0x00000001u, 0x00000002u, 0x00000004u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000008u, 0x08008080u, 0x04040010u, 0x02010040u, 0x01020020u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {22u, 4u, {0x00000000u, 0x00000000u, 0x00000001u, 0x00000002u, 0x00001000u, 0x00002000u, 0x00004000u, 0x00000004u, 0x08008040u, 0x04040008u, 0x02010020u, 0x01020010u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {22u, 8u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00000004u, 0x00002000u, 0x08004040u, 0x04020008u, 0x02008020u, 0x01010010u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, + {22u, 16u, {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00001000u, 0x00000002u, 0x00002000u, 0x08004020u, 0x04020004u, 0x02008010u, 0x01010008u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, // Thick (3D) standard swizzles SW_4KB_S, SW_64KB_S and SW_64KB_S_X use the S3 patterns, keyed 0x100 | SW_MODE. {0x105u, 1u, {0x00000001u, 0x00000002u, 0x01000000u, 0x00001000u, 0x02000000u, 0x00002000u, 0x00000004u, 0x04000000u, 0x00004000u, 0x00000008u, 0x08000000u, 0x00008000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, {0x105u, 2u, {0x00000000u, 0x00000001u, 0x01000000u, 0x00001000u, 0x02000000u, 0x00002000u, 0x00000002u, 0x04000000u, 0x00004000u, 0x00000004u, 0x08000000u, 0x00008000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u}}, diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp index 41fe6f452..d3f6a96da 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/GuestTextureResource.cpp @@ -18,8 +18,15 @@ TextureTileMode resolveTileMode(std::uint32_t raw) { switch (raw) { case 0x00: return TextureTileMode::kLinear; case 0x01: return TextureTileMode::kStandard256B; + case 0x02: return TextureTileMode::kD256B; case 0x05: return TextureTileMode::kStandard4KB; + case 0x06: return TextureTileMode::kD4KB; case 0x09: return TextureTileMode::kStandard64KB; + case 0x0a: return TextureTileMode::kD64KB; + case 0x11: return TextureTileMode::kS64KBT; + case 0x12: return TextureTileMode::kD64KBT; + case 0x15: return TextureTileMode::kS4KBX; + case 0x16: return TextureTileMode::kD4KBX; case 0x18: return TextureTileMode::kZ64KBX; case 0x19: return TextureTileMode::kS64KBX; case 0x1a: return TextureTileMode::kD64KBX; @@ -135,7 +142,7 @@ GuestTextureResource DecodeTextureResource(std::span words) // hardware never addresses them, so the view ends at the surface's last level. if (baseLevel <= maxMip) lastLevel = std::min(lastLevel, maxMip); // XOR swizzles fold a pipe/bank XOR into the low address bits; only unmodified 64 KiB bases are modeled. - Require(XorSwizzleMode(tileMode) == 0 || (baseAddress & 0xffffu) == 0, "guest texture descriptor combines an XOR swizzle with a pipe/bank XOR base which is not implemented"); + Require(XorSwizzleMode(tileMode) == 0 || (baseAddress & (tileMode == TextureTileMode::kS4KBX || tileMode == TextureTileMode::kD4KBX ? 0xfffu : 0xffffu)) == 0, "guest texture descriptor combines an XOR swizzle with a pipe/bank XOR base which is not implemented"); switch (dimension) { case TextureDimension::k1D: diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp index 0b4b2202d..b065119d1 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp @@ -36,9 +36,16 @@ struct Push { std::uint32_t BlockBytesFor(TextureTileMode tileMode) { switch (tileMode) { case TextureTileMode::kLinear: return 0u; - case TextureTileMode::kStandard256B: return 256u; - case TextureTileMode::kStandard4KB: return 4096u; + case TextureTileMode::kStandard256B: + case TextureTileMode::kD256B: return 256u; + case TextureTileMode::kStandard4KB: + case TextureTileMode::kD4KB: + case TextureTileMode::kS4KBX: + case TextureTileMode::kD4KBX: return 4096u; case TextureTileMode::kStandard64KB: + case TextureTileMode::kD64KB: + case TextureTileMode::kS64KBT: + case TextureTileMode::kD64KBT: case TextureTileMode::kZ64KBX: case TextureTileMode::kS64KBX: case TextureTileMode::kD64KBX: @@ -117,7 +124,7 @@ VkPipeline TextureDetiler::pipeline(TextureTileMode tileMode, std::uint32_t elem const auto extent = ThickBlockExtent(tileMode, elementBytes); values[20] = extent[0]; values[21] = extent[1]; - } else if (const auto mode = XorSwizzleMode(tileMode); mode != 0) { + } else if (const auto mode = EquationSwizzleMode(tileMode); mode != 0) { const auto* equation = FindTextureSwizzleEquation(mode, elementBytes); if (equation == nullptr) Require(false, "no swizzle equation for tile mode " + std::to_string(mode) + " at " + std::to_string(elementBytes) + " bytes per element"); values[2] = 2u; diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp index cae645674..0c87d3653 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp @@ -44,9 +44,16 @@ BlockLayout GetBlockLayout(TextureTileMode tileMode, std::uint32_t bytesPerEleme const auto index = static_cast(std::countr_zero(bytesPerElement)); switch (tileMode) { case TextureTileMode::kLinear: throw std::runtime_error("AGC graphics: GetBlockLayout does not apply to linear tiling"); - case TextureTileMode::kStandard256B: return {256u, 1u << kLog2BlockThin256B[index].width, 1u << kLog2BlockThin256B[index].height}; - case TextureTileMode::kStandard4KB: return {4096u, 1u << kLog2BlockThin4KB[index].width, 1u << kLog2BlockThin4KB[index].height}; + case TextureTileMode::kStandard256B: + case TextureTileMode::kD256B: return {256u, 1u << kLog2BlockThin256B[index].width, 1u << kLog2BlockThin256B[index].height}; + case TextureTileMode::kStandard4KB: + case TextureTileMode::kD4KB: + case TextureTileMode::kS4KBX: + case TextureTileMode::kD4KBX: return {4096u, 1u << kLog2BlockThin4KB[index].width, 1u << kLog2BlockThin4KB[index].height}; case TextureTileMode::kStandard64KB: + case TextureTileMode::kD64KB: + case TextureTileMode::kS64KBT: + case TextureTileMode::kD64KBT: case TextureTileMode::kZ64KBX: case TextureTileMode::kS64KBX: case TextureTileMode::kD64KBX: @@ -92,11 +99,18 @@ bool GetMipTailLayout(TextureTileMode tileMode, const BlockLayout& block, std::u const auto index = static_cast(std::countr_zero(bytesPerElement)); switch (tileMode) { case TextureTileMode::kLinear: - case TextureTileMode::kStandard256B: return false; + case TextureTileMode::kStandard256B: + case TextureTileMode::kD256B: return false; case TextureTileMode::kStandard4KB: + case TextureTileMode::kD4KB: + case TextureTileMode::kS4KBX: + case TextureTileMode::kD4KBX: out = MakeMipTailLayout(kMipTailThin4KB[index], block.blockWidth >> 1u, block.blockHeight); return true; case TextureTileMode::kStandard64KB: + case TextureTileMode::kD64KB: + case TextureTileMode::kS64KBT: + case TextureTileMode::kD64KBT: case TextureTileMode::kZ64KBX: case TextureTileMode::kS64KBX: case TextureTileMode::kD64KBX: @@ -247,7 +261,7 @@ std::array ThickBlockExtent(TextureTileMode tileMode, std::uin case TextureTileMode::kStandard4KB: return {1u << thick4KB[index][0], 1u << thick4KB[index][1], 1u << thick4KB[index][2]}; case TextureTileMode::kStandard64KB: case TextureTileMode::kS64KBX: return {1u << thick64KB[index][0], 1u << thick64KB[index][1], 1u << thick64KB[index][2]}; - default: throw std::runtime_error("AGC graphics: thick 3D textures are only supported in SW_4KB_S, SW_64KB_S and SW_64KB_S_X, not in XOR swizzle " + std::to_string(XorSwizzleMode(tileMode)) + " at " + std::to_string(bytesPerElement) + " bytes per element"); + default: throw std::runtime_error("AGC graphics: thick 3D textures are only supported in SW_4KB_S, SW_64KB_S and SW_64KB_S_X, not in swizzle mode " + std::to_string(EquationSwizzleMode(tileMode)) + " at " + std::to_string(bytesPerElement) + " bytes per element"); } } diff --git a/core/libs/prx/libSceAgcDriver/tests/GuestTextureResource.cpp b/core/libs/prx/libSceAgcDriver/tests/GuestTextureResource.cpp index bb9345a2e..f8023b972 100644 --- a/core/libs/prx/libSceAgcDriver/tests/GuestTextureResource.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/GuestTextureResource.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace { @@ -118,8 +119,21 @@ void RunGuestTextureResourceTests() { rejectFields(tileModes, "pipe/bank XOR base"); tileModes.base40 = 0x120000ull; Require(DecodeTextureResource(pack(tileModes)).tileMode == TextureTileMode::RenderTarget64KB, "tile mode 0x1b must decode to render target 64KB"); + constexpr std::array, 7> added{{{0x02, TextureTileMode::kD256B}, {0x06, TextureTileMode::kD4KB}, {0x0a, TextureTileMode::kD64KB}, {0x11, TextureTileMode::kS64KBT}, {0x12, TextureTileMode::kD64KBT}, {0x15, TextureTileMode::kS4KBX}, {0x16, TextureTileMode::kD4KBX}}}; + for (const auto& [raw, mode] : added) { + tileModes.tileModeRaw = raw; + Require(DecodeTextureResource(pack(tileModes)).tileMode == mode, "tile mode " + std::to_string(raw) + " decoded to the wrong swizzle"); + } + tileModes.tileModeRaw = 0x16; + tileModes.base40 = 0x120010ull; + Require(DecodeTextureResource(pack(tileModes)).tileMode == TextureTileMode::kD4KBX, "a 4 KiB XOR swizzle must accept a 4 KiB aligned base"); + tileModes.base40 = 0x120011ull; + rejectFields(tileModes, "pipe/bank XOR base"); + tileModes.tileModeRaw = 0x12; + tileModes.base40 = 0x120010ull; + rejectFields(tileModes, "pipe/bank XOR base"); tileModes.base40 = base.base40; - tileModes.tileModeRaw = 0x02; + tileModes.tileModeRaw = 0x03; rejectFields(tileModes, "unsupported tile mode"); Fields oneD = base; diff --git a/core/libs/prx/libSceAgcDriver/tests/TextureDetiler.cpp b/core/libs/prx/libSceAgcDriver/tests/TextureDetiler.cpp index 5b4779f8a..02183e982 100644 --- a/core/libs/prx/libSceAgcDriver/tests/TextureDetiler.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/TextureDetiler.cpp @@ -163,6 +163,10 @@ void RunTextureDetilerTests(const Context& context, const TextureDetilerTestAcce const auto specialization = access.lastSpecialization(); Require(specialization[0] == 4 && specialization[1] == 65536 && specialization[2] == 2, "render target detiling must select its own swizzle family"); + detiler.Dispatch(commands, TextureTileMode::kD4KBX, 4, source, 0, destination, 0, layout, false, 0); + const auto equationSpecialization = access.lastSpecialization(); + Require(equationSpecialization[0] == 4 && equationSpecialization[1] == 4096 && equationSpecialization[2] == 2, "SW_4KB_D_X detiling must select the equation family over 4 KiB blocks"); + reject([&] { detiler.Dispatch(VK_NULL_HANDLE, TextureTileMode::kStandard4KB, 4, source, 0, destination, 0, layout, 0); }, "active command buffer"); reject([&] { detiler.Dispatch(commands, TextureTileMode::kStandard4KB, 4, VK_NULL_HANDLE, 0, destination, 0, layout, 0); }, "source and destination buffers"); reject([&] { detiler.Dispatch(commands, TextureTileMode::kStandard4KB, 4, source, 0, VK_NULL_HANDLE, 0, layout, 0); }, "source and destination buffers"); diff --git a/core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp b/core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp index 2057d04be..95b4b4c38 100644 --- a/core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp @@ -1,4 +1,5 @@ #include "GraphicsTests.hpp" +#include "prx/libSceAgcDriver/Graphics/include/TextureFormat.hpp" #include "prx/libSceAgcDriver/Graphics/include/TextureSwizzleEquations.hpp" #include "prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp" #include @@ -76,6 +77,33 @@ void requireThickAddresses(const GuestTextureResource& resource, std::uint32_t b } } +void requireThinAddresses(TextureTileMode tileMode, std::uint32_t format, std::uint32_t width, std::uint32_t height, std::uint32_t mipCount, std::uint32_t slices, std::uint64_t guestBytes, std::uint64_t layerBytes, std::span expected, const std::string& what) { + GuestTextureResource resource{}; + resource.width = width; + resource.height = height; + resource.depthOrLastArray = slices - 1u; + resource.mipCount = mipCount; + resource.tileMode = tileMode; + resource.dimension = slices > 1u ? TextureDimension::k2DArray : TextureDimension::k2D; + resource.format = format; + const auto geometry = DescribeSurface(resource); + Require(geometry.guestBytes == guestBytes && geometry.layerBytes == layerBytes, what + ": surface or slice size differs from addrlib"); + const auto bytesPerElement = BytesPerElement(format); + const auto* equation = FindTextureSwizzleEquation(EquationSwizzleMode(tileMode), bytesPerElement); + Require(equation != nullptr, what + ": missing swizzle equation"); + const auto block = ThinBlockLayout(tileMode, bytesPerElement); + for (const auto& element : expected) { + const auto& mip = geometry.mips.at(element.mip); + auto address = geometry.GuestLayerOffset(element.z) + mip.tiledOffset; + if (mip.tail) { + address += equationOffset(*equation, element.x + mip.tailX, element.y + mip.tailY, element.z); + } else { + address += (static_cast(element.y / block[2]) * mip.blocksPerRow + element.x / block[1]) * block[0] + equationOffset(*equation, element.x, element.y, element.z); + } + Require(address == element.address, what + ": mip " + std::to_string(element.mip) + " element (" + std::to_string(element.x) + ", " + std::to_string(element.y) + ", " + std::to_string(element.z) + ") detiles from " + std::to_string(address) + " instead of addrlib's " + std::to_string(element.address)); + } +} + void requireSliceAddresses(const GuestTextureResource& resource, std::uint32_t bytesPerElement, std::uint64_t guestBytes, std::span expected, const std::string& what) { const auto geometry = DescribeSurface(resource); Require(!geometry.thick && geometry.mips.size() == resource.mipCount && geometry.guestBytes == guestBytes, what + ": guest size differs from addrlib"); @@ -238,6 +266,23 @@ void RunTextureTilingTests() { requireSliceAddresses(thickVolume(TextureTileMode::kZ64KBX, 71, 33, 20, 12, 6), 8, 786432, xorZx64, "thin SW_64KB_Z_X 64 bpp 33x20x12, 6 levels"); } + { + constexpr ElementAddress atD256B[] = {{0, 0, 0, 0, 0x300}, {0, 39, 19, 0, 0x81f}, {0, 20, 6, 0, 0x42c}, {0, 39, 0, 0, 0x507}, {0, 0, 19, 0, 0x618}, {1, 0, 0, 0, 0x100}, {1, 19, 9, 0, 0x293}, {1, 10, 3, 0, 0x15a}, {1, 19, 0, 0, 0x203}, {1, 0, 9, 0, 0x190}, {2, 0, 0, 0, 0x0}, {2, 9, 4, 0, 0x61}, {2, 5, 1, 0, 0x15}, {2, 9, 0, 0, 0x41}, {2, 0, 4, 0, 0x20}}; + requireThinAddresses(TextureTileMode::kD256B, 1, 40, 20, 3, 1, 2304, 2304, atD256B, "swizzle mode 2, 1 bytes, 40x20, 3 levels, 1 slices"); + constexpr ElementAddress atD4KB[] = {{0, 0, 0, 0, 0x6000}, {0, 99, 59, 0, 0x154b8}, {0, 50, 20, 0, 0xb920}, {0, 99, 0, 0, 0x9028}, {0, 0, 59, 0, 0x12490}, {1, 0, 0, 0, 0x2000}, {1, 49, 29, 0, 0x5d18}, {1, 25, 10, 0, 0x2e88}, {1, 49, 0, 0, 0x3808}, {1, 0, 29, 0, 0x4510}, {2, 0, 0, 0, 0x1000}, {2, 24, 14, 0, 0x1f80}, {2, 12, 5, 0, 0x1350}, {2, 24, 0, 0, 0x1a00}, {2, 0, 14, 0, 0x1580}, {3, 0, 0, 0, 0x800}, {3, 11, 6, 0, 0xba8}, {3, 6, 2, 0, 0x8e0}, {3, 11, 0, 0, 0xa28}, {3, 0, 6, 0, 0x980}, {4, 0, 0, 0, 0x600}, {4, 5, 2, 0, 0x6c8}, {4, 3, 1, 0, 0x638}, {4, 5, 0, 0, 0x648}, {4, 0, 2, 0, 0x680}, {5, 0, 0, 0, 0x500}, {5, 2, 0, 0, 0x520}, {5, 1, 0, 0, 0x508}, {5, 2, 0, 0, 0x520}, {5, 0, 0, 0, 0x500}, {6, 0, 0, 0, 0x400}, {6, 0, 0, 0, 0x400}, {6, 0, 0, 0, 0x400}, {6, 0, 0, 0, 0x400}, {6, 0, 0, 0, 0x400}}; + requireThinAddresses(TextureTileMode::kD4KB, 71, 100, 60, 7, 1, 90112, 90112, atD4KB, "swizzle mode 6, 8 bytes, 100x60, 7 levels, 1 slices"); + constexpr ElementAddress atD64KB[] = {{0, 0, 0, 0, 0x20000}, {0, 199, 149, 0, 0x584dc}, {0, 100, 50, 0, 0x2b4a0}, {0, 199, 0, 0, 0x3808c}, {0, 0, 149, 0, 0x40450}, {1, 0, 0, 0, 0x10000}, {1, 99, 74, 0, 0x1e12c}, {1, 50, 25, 0, 0x12d18}, {1, 99, 0, 0, 0x1a00c}, {1, 0, 74, 0, 0x14120}, {2, 0, 0, 0, 0x8000}, {2, 49, 36, 0, 0xb844}, {2, 25, 12, 0, 0x8b44}, {2, 49, 0, 0, 0xa804}, {2, 0, 36, 0, 0x9040}, {3, 0, 0, 0, 0x4000}, {3, 24, 17, 0, 0x4e10}, {3, 12, 6, 0, 0x42e0}, {3, 24, 0, 0, 0x4a00}, {3, 0, 17, 0, 0x4410}, {4, 0, 0, 0, 0x2000}, {4, 11, 8, 0, 0x230c}, {4, 6, 3, 0, 0x20b8}, {4, 11, 0, 0, 0x220c}, {4, 0, 8, 0, 0x2100}, {5, 0, 0, 0, 0x1000}, {5, 5, 3, 0, 0x10b4}, {5, 3, 1, 0, 0x101c}, {5, 5, 0, 0, 0x1084}, {5, 0, 3, 0, 0x1030}}; + requireThinAddresses(TextureTileMode::kD64KB, 56, 200, 150, 6, 1, 393216, 393216, atD64KB, "swizzle mode 10, 4 bytes, 200x150, 6 levels, 1 slices"); + constexpr ElementAddress atS64KBT[] = {{0, 0, 0, 0, 0x90000}, {0, 519, 259, 0, 0x1700bc}, {0, 260, 86, 0, 0xb46e0}, {0, 519, 0, 0, 0xd008c}, {0, 0, 259, 0, 0x130030}, {0, 0, 0, 1, 0x210000}, {0, 519, 259, 1, 0x2f00bc}, {0, 260, 86, 1, 0x2346e0}, {0, 519, 0, 1, 0x25008c}, {0, 0, 259, 1, 0x2b0030}, {0, 0, 0, 2, 0x390000}, {0, 519, 259, 2, 0x4700bc}, {0, 260, 86, 2, 0x3b46e0}, {0, 519, 0, 2, 0x3d008c}, {0, 0, 259, 2, 0x430030}, {1, 0, 0, 0, 0x30000}, {1, 259, 129, 0, 0x8001c}, {1, 130, 43, 0, 0x41938}, {1, 259, 0, 0, 0x5000c}, {1, 0, 129, 0, 0x60010}, {1, 0, 0, 1, 0x1b0000}, {1, 259, 129, 1, 0x20001c}, {1, 130, 43, 1, 0x1c1938}, {1, 259, 0, 1, 0x1d000c}, {1, 0, 129, 1, 0x1e0010}, {1, 0, 0, 2, 0x330000}, {1, 259, 129, 2, 0x38001c}, {1, 130, 43, 2, 0x341938}, {1, 259, 0, 2, 0x35000c}, {1, 0, 129, 2, 0x360010}, {2, 0, 0, 0, 0x10000}, {2, 129, 64, 0, 0x24204}, {2, 65, 21, 0, 0x18554}, {2, 129, 0, 0, 0x20004}, {2, 0, 64, 0, 0x14200}, {2, 0, 0, 1, 0x190000}, {2, 129, 64, 1, 0x1a4204}, {2, 65, 21, 1, 0x198554}, {2, 129, 0, 1, 0x1a0004}, {2, 0, 64, 1, 0x194200}, {2, 0, 0, 2, 0x310000}, {2, 129, 64, 2, 0x324204}, {2, 65, 21, 2, 0x318554}, {2, 129, 0, 2, 0x320004}, {2, 0, 64, 2, 0x314200}, {3, 0, 0, 0, 0x0}, {3, 64, 31, 0, 0x8470}, {3, 32, 10, 0, 0x2520}, {3, 64, 0, 0, 0x8100}, {3, 0, 31, 0, 0x570}, {3, 0, 0, 1, 0x180000}, {3, 64, 31, 1, 0x188470}, {3, 32, 10, 1, 0x182520}, {3, 64, 0, 1, 0x188100}, {3, 0, 31, 1, 0x180570}, {3, 0, 0, 2, 0x300000}, {3, 64, 31, 2, 0x308470}, {3, 32, 10, 2, 0x302520}, {3, 64, 0, 2, 0x308100}, {3, 0, 31, 2, 0x300570}}; + requireThinAddresses(TextureTileMode::kS64KBT, 56, 520, 260, 4, 3, 4718592, 1572864, atS64KBT, "swizzle mode 17, 4 bytes, 520x260, 4 levels, 3 slices"); + constexpr ElementAddress atD64KBT[] = {{0, 0, 0, 0, 0x10000}, {0, 63, 39, 0, 0x1ecf0}, {0, 32, 13, 0, 0x18420}, {0, 63, 0, 0, 0x1af50}, {0, 0, 39, 0, 0x143a0}, {0, 0, 0, 1, 0x30000}, {0, 63, 39, 1, 0x3ecf0}, {0, 32, 13, 1, 0x38420}, {0, 63, 0, 1, 0x3af50}, {0, 0, 39, 1, 0x343a0}, {1, 0, 0, 0, 0x8100}, {1, 31, 19, 0, 0xb7f0}, {1, 16, 6, 0, 0xa480}, {1, 31, 0, 0, 0xaf50}, {1, 0, 19, 0, 0x99a0}, {1, 0, 0, 1, 0x28100}, {1, 31, 19, 1, 0x2b7f0}, {1, 16, 6, 1, 0x2a480}, {1, 31, 0, 1, 0x2af50}, {1, 0, 19, 1, 0x299a0}, {2, 0, 0, 0, 0x4200}, {2, 15, 9, 0, 0x4c70}, {2, 8, 3, 0, 0x4aa0}, {2, 15, 0, 0, 0x4850}, {2, 0, 9, 0, 0x4620}, {2, 0, 0, 1, 0x24200}, {2, 15, 9, 1, 0x24c70}, {2, 8, 3, 1, 0x24aa0}, {2, 15, 0, 1, 0x24850}, {2, 0, 9, 1, 0x24620}, {3, 0, 0, 0, 0x2400}, {3, 7, 4, 0, 0x2750}, {3, 4, 1, 0, 0x2620}, {3, 7, 0, 0, 0x2650}, {3, 0, 4, 0, 0x2500}, {3, 0, 0, 1, 0x22400}, {3, 7, 4, 1, 0x22750}, {3, 4, 1, 1, 0x22620}, {3, 7, 0, 1, 0x22650}, {3, 0, 4, 1, 0x22500}, {4, 0, 0, 0, 0x1800}, {4, 3, 1, 0, 0x1870}, {4, 2, 0, 0, 0x1840}, {4, 3, 0, 0, 0x1850}, {4, 0, 1, 0, 0x1820}, {4, 0, 0, 1, 0x21800}, {4, 3, 1, 1, 0x21870}, {4, 2, 0, 1, 0x21840}, {4, 3, 0, 1, 0x21850}, {4, 0, 1, 1, 0x21820}}; + requireThinAddresses(TextureTileMode::kD64KBT, 77, 64, 40, 5, 2, 262144, 131072, atD64KBT, "swizzle mode 18, 16 bytes, 64x40, 5 levels, 2 slices"); + constexpr ElementAddress atS4KBX[] = {{0, 0, 0, 0, 0x2000}, {0, 99, 69, 0, 0x5453}, {0, 50, 23, 0, 0x2b72}, {0, 99, 0, 0, 0x3c03}, {0, 0, 69, 0, 0x4850}, {0, 0, 0, 1, 0x8800}, {0, 99, 69, 1, 0xbc53}, {0, 50, 23, 1, 0x8372}, {0, 99, 0, 1, 0x9403}, {0, 0, 69, 1, 0xa050}, {0, 0, 0, 2, 0xe400}, {0, 99, 69, 2, 0x11053}, {0, 50, 23, 2, 0xef72}, {0, 99, 0, 2, 0xf803}, {0, 0, 69, 2, 0x10c50}, {1, 0, 0, 0, 0x1000}, {1, 49, 34, 0, 0x1e21}, {1, 25, 11, 0, 0x12b9}, {1, 49, 0, 0, 0x1a01}, {1, 0, 34, 0, 0x1420}, {1, 0, 0, 1, 0x7800}, {1, 49, 34, 1, 0x7621}, {1, 25, 11, 1, 0x7ab9}, {1, 49, 0, 1, 0x7201}, {1, 0, 34, 1, 0x7c20}, {1, 0, 0, 2, 0xd400}, {1, 49, 34, 2, 0xda21}, {1, 25, 11, 2, 0xd6b9}, {1, 49, 0, 2, 0xde01}, {1, 0, 34, 2, 0xd020}, {2, 0, 0, 0, 0x800}, {2, 24, 16, 0, 0xb08}, {2, 12, 5, 0, 0x85c}, {2, 24, 0, 0, 0xa08}, {2, 0, 16, 0, 0x900}, {2, 0, 0, 1, 0x6000}, {2, 24, 16, 1, 0x6308}, {2, 12, 5, 1, 0x605c}, {2, 24, 0, 1, 0x6208}, {2, 0, 16, 1, 0x6100}, {2, 0, 0, 2, 0xcc00}, {2, 24, 16, 2, 0xcf08}, {2, 12, 5, 2, 0xcc5c}, {2, 24, 0, 2, 0xce08}, {2, 0, 16, 2, 0xcd00}, {3, 0, 0, 0, 0x600}, {3, 11, 7, 0, 0x67b}, {3, 6, 2, 0, 0x626}, {3, 11, 0, 0, 0x60b}, {3, 0, 7, 0, 0x670}, {3, 0, 0, 1, 0x6e00}, {3, 11, 7, 1, 0x6e7b}, {3, 6, 2, 1, 0x6e26}, {3, 11, 0, 1, 0x6e0b}, {3, 0, 7, 1, 0x6e70}, {3, 0, 0, 2, 0xc200}, {3, 11, 7, 2, 0xc27b}, {3, 6, 2, 2, 0xc226}, {3, 11, 0, 2, 0xc20b}, {3, 0, 7, 2, 0xc270}, {4, 0, 0, 0, 0x500}, {4, 5, 3, 0, 0x535}, {4, 3, 1, 0, 0x513}, {4, 5, 0, 0, 0x505}, {4, 0, 3, 0, 0x530}, {4, 0, 0, 1, 0x6d00}, {4, 5, 3, 1, 0x6d35}, {4, 3, 1, 1, 0x6d13}, {4, 5, 0, 1, 0x6d05}, {4, 0, 3, 1, 0x6d30}, {4, 0, 0, 2, 0xc100}, {4, 5, 3, 2, 0xc135}, {4, 3, 1, 2, 0xc113}, {4, 5, 0, 2, 0xc105}, {4, 0, 3, 2, 0xc130}, {5, 0, 0, 0, 0x400}, {5, 2, 1, 0, 0x412}, {5, 1, 0, 0, 0x401}, {5, 2, 0, 0, 0x402}, {5, 0, 1, 0, 0x410}, {5, 0, 0, 1, 0x6c00}, {5, 2, 1, 1, 0x6c12}, {5, 1, 0, 1, 0x6c01}, {5, 2, 0, 1, 0x6c02}, {5, 0, 1, 1, 0x6c10}, {5, 0, 0, 2, 0xc000}, {5, 2, 1, 2, 0xc012}, {5, 1, 0, 2, 0xc001}, {5, 2, 0, 2, 0xc002}, {5, 0, 1, 2, 0xc010}}; + requireThinAddresses(TextureTileMode::kS4KBX, 1, 100, 70, 6, 3, 73728, 24576, atS4KBX, "swizzle mode 21, 1 bytes, 100x70, 6 levels, 3 slices"); + constexpr ElementAddress atD4KBX[] = {{0, 0, 0, 0, 0x2000}, {0, 32, 19, 0, 0x3030}, {0, 16, 6, 0, 0x2860}, {0, 32, 0, 0, 0x3400}, {0, 0, 19, 0, 0x2430}, {0, 0, 0, 1, 0x6800}, {0, 32, 19, 1, 0x7830}, {0, 16, 6, 1, 0x6060}, {0, 32, 0, 1, 0x7c00}, {0, 0, 19, 1, 0x6c30}, {1, 0, 0, 0, 0x1000}, {1, 15, 9, 0, 0x139c}, {1, 8, 3, 0, 0x1230}, {1, 15, 0, 0, 0x128c}, {1, 0, 9, 0, 0x1110}, {1, 0, 0, 1, 0x5800}, {1, 15, 9, 1, 0x5b9c}, {1, 8, 3, 1, 0x5a30}, {1, 15, 0, 1, 0x5a8c}, {1, 0, 9, 1, 0x5910}, {2, 0, 0, 0, 0x800}, {2, 7, 4, 0, 0x8cc}, {2, 4, 1, 0, 0x890}, {2, 7, 0, 0, 0x88c}, {2, 0, 4, 0, 0x840}, {2, 0, 0, 1, 0x4000}, {2, 7, 4, 1, 0x40cc}, {2, 4, 1, 1, 0x4090}, {2, 7, 0, 1, 0x408c}, {2, 0, 4, 1, 0x4040}, {3, 0, 0, 0, 0x600}, {3, 3, 1, 0, 0x61c}, {3, 2, 0, 0, 0x608}, {3, 3, 0, 0, 0x60c}, {3, 0, 1, 0, 0x610}, {3, 0, 0, 1, 0x4e00}, {3, 3, 1, 1, 0x4e1c}, {3, 2, 0, 1, 0x4e08}, {3, 3, 0, 1, 0x4e0c}, {3, 0, 1, 1, 0x4e10}}; + requireThinAddresses(TextureTileMode::kD4KBX, 56, 33, 20, 4, 2, 32768, 16384, atD4KBX, "swizzle mode 22, 4 bytes, 33x20, 4 levels, 2 slices"); + } + { // CoveredMipBytes against the XOR address equations: every element slot of a covered range // holds exactly one element of the mip, and every tile block left out holds a slot no