From fedd1a43355d45b71f5b75c1f2814fb6207ec22e Mon Sep 17 00:00:00 2001 From: nmzik Date: Thu, 20 Aug 2026 23:47:31 +0200 Subject: [PATCH] gpu: describe packed 11-11-10 uint textures --- src/graphics/guest_gpu/gpu_format.cpp | 1 + tests/ShaderRecompilerComputeTests.cpp | 32 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/graphics/guest_gpu/gpu_format.cpp b/src/graphics/guest_gpu/gpu_format.cpp index c8ac55868..84898b5fd 100644 --- a/src/graphics/guest_gpu/gpu_format.cpp +++ b/src/graphics/guest_gpu/gpu_format.cpp @@ -38,6 +38,7 @@ constexpr FormatInfo kFormatInfo[] = { {BufferFormat::k16_16UInt, 4, 0, 4, true, true}, {BufferFormat::k16_16SInt, 4, 0, 4, false, false}, {BufferFormat::k16_16Float, 4, 0, 4, true, false}, + {BufferFormat::k11_11_10UInt, 4, 0, 4, true, true}, {BufferFormat::k11_11_10Float, 4, 0, 4, true, false}, {BufferFormat::k10_10_10_2UNorm, 4, 0, 4, true, false}, {BufferFormat::k10_10_10_2UInt, 4, 0, 4, true, true}, diff --git a/tests/ShaderRecompilerComputeTests.cpp b/tests/ShaderRecompilerComputeTests.cpp index 4e1695e30..64bb000c9 100644 --- a/tests/ShaderRecompilerComputeTests.cpp +++ b/tests/ShaderRecompilerComputeTests.cpp @@ -9940,6 +9940,38 @@ public: Require(name, "format coverage", format_cases != 0, "no CPU-supported standard formats were tested"); + { + constexpr auto format = Prospero::BufferFormat::k11_11_10UInt; + constexpr auto tile = Prospero::TileMode::kStandard64KB; + constexpr u32 width = 128, height = 128, levels = 8; + TileSurfaceLayout surface{}; + const TileSurfaceDescription description{ + format, tile, TileSurfaceDimension::Dim2D, width, height, 1, levels, 1}; + TileSizeAlign total{}; + TileGetTextureTotalSize(format, width, height, 1, levels, tile, false, + total); + const bool built = TileGetTiledTextureLayout(description, surface); + constexpr u32 tail_xy[7][2] = { + {64, 0}, {0, 64}, {32, 0}, {0, 32}, {16, 0}, {8, 16}, {0, 24}}; + bool valid = built && Prospero::NumBytesPerElement(format) == 4 && + Prospero::BlockCompressedBytesPerBlock(format) == 0 && + Prospero::IsSupportedTextureFormat(format) && + Prospero::IsUintTextureFormat(format) && + surface.texture.block.block_width == 128 && + surface.texture.block.block_height == 128 && + surface.texture.block.block_depth == 1 && + surface.first_tail_level == 1 && + surface.mips[0].offset == 0x10000 && total.size == 0x20000 && + total.align == 0x10000; + for (u32 level = 1; level < levels && valid; level++) { + valid &= surface.mips[level].offset == 0 && + surface.mips[level].tail_x == tail_xy[level - 1][0] && + surface.mips[level].tail_y == tail_xy[level - 1][1]; + } + Require(name, "11_11_10 uint layout", valid, + "PS5 packed integer texture metadata or Standard64KB mip tail changed"); + } + { constexpr auto format = Prospero::BufferFormat::k32_32_32Float; TileTextureElementLayout element{};