graphics: support more depth-tiled storage image formats

This commit is contained in:
nmzik
2026-07-27 02:51:30 +02:00
parent 93774ee37c
commit c3b2ae9733
2 changed files with 50 additions and 14 deletions
+6 -13
View File
@@ -276,15 +276,6 @@ static void ValidateDepthTargetBinding(const ShaderRecompiler::IR::ImageResource
descriptor.fields[5], descriptor.fields[6], descriptor.fields[7]);
}
static bool IsSupportedStorageDepthTile(const ShaderTextureResource& descriptor) {
const auto type = static_cast<Prospero::ImageType>(descriptor.Type());
return descriptor.Depth() == 0 &&
((descriptor.Format() == Prospero::GpuEnumValue(Prospero::BufferFormat::k8UInt) &&
type == Prospero::ImageType::kColor2DArray) ||
(descriptor.Format() == Prospero::GpuEnumValue(Prospero::BufferFormat::k32UInt) &&
type == Prospero::ImageType::kColor2D));
}
static bool IsSupportedStorageTextureDescriptor(const ShaderRecompiler::IR::ImageResource& resource,
const ShaderTextureResource& descriptor) {
const auto tile = descriptor.TileMode();
@@ -297,10 +288,12 @@ static bool IsSupportedStorageTextureDescriptor(const ShaderRecompiler::IR::Imag
descriptor.BaseArray5() <= descriptor.Depth();
const bool is_3d = resource.dimension == ShaderRecompiler::Decoder::ImageDimension::Dim3D &&
descriptor.Type() == Prospero::GpuEnumValue(Prospero::ImageType::kColor3D);
TileBlockLayout depth_block {};
const auto depth_bpe = Prospero::RenderTargetBytesPerElement(descriptor.Format());
const bool supported_depth_tile =
tile == Prospero::GpuEnumValue(Prospero::TileMode::kDepth) && !resource.read &&
resource.kind == ShaderRecompiler::IR::ResourceKind::StorageImageUint &&
IsSupportedStorageDepthTile(descriptor);
!Prospero::IsFmaskTextureFormat(descriptor.Format()) && (is_2d || is_2d_array) &&
TileGetBlockLayout(TileBlockFamily::Depth64KB, depth_bpe, depth_block);
const bool supported_volume_tile =
is_3d && tile == Prospero::GpuEnumValue(Prospero::TileMode::kStandard4KB);
const bool supported_tile = tile == Prospero::GpuEnumValue(Prospero::TileMode::kLinear) ||
@@ -349,7 +342,7 @@ void ValidateStorageTexture(const ShaderRecompiler::IR::ImageResource& resource,
EXIT("unsupported storage texture: resource=%d descriptor=%d encoding=%d format=%d "
"kind=%u dimension=%u mip_mode=%u atomic=%d compare=%d "
"base_level=%u last_level=%u max_mip=%u min_lod=%u base_array=%u bc=%u msaa=%d "
"depth_tile_shape=%d swizzle_ok=%d "
"depth_tile_bpe=%u swizzle_ok=%d "
"addr=0x%016" PRIx64 " size=0x%016" PRIx64
" extent=%ux%ux%u type=%u format=%u tile=%u swizzle=0x%03x read=%d written=%d "
"dwords=%08x,%08x,%08x,%08x,%08x,%08x,%08x,%08x\n",
@@ -357,7 +350,7 @@ void ValidateStorageTexture(const ShaderRecompiler::IR::ImageResource& resource,
static_cast<uint32_t>(resource.dimension), static_cast<uint32_t>(resource.mip_mode),
resource.atomic, resource.depth_compare, descriptor.BaseLevel(), descriptor.LastLevel(),
descriptor.MaxMip(), descriptor.MinLod(), descriptor.BaseArray5(), descriptor.BCSwizzle(),
descriptor.MsaaDepth(), IsSupportedStorageDepthTile(descriptor),
descriptor.MsaaDepth(), Prospero::RenderTargetBytesPerElement(format),
IsValidImageSwizzle(descriptor.DstSelXYZW()),
descriptor.Base40(), size, static_cast<uint32_t>(descriptor.Width5()) + 1u,
static_cast<uint32_t>(descriptor.Height5()) + 1u,
+44 -1
View File
@@ -15610,6 +15610,11 @@ ShaderTextureResource Ppsa14053DepthTileStorageTextureDescriptor() {
0x00700000u, 0x00000000u, 0x00000000u}};
}
ShaderTextureResource Ppsa10112D16StorageTextureDescriptor() {
return {{0x205b9000u, 0xc0700000u, 0x0021803bu, 0xd1800204u, 0x00000000u,
0x00700000u, 0x00000000u, 0x00000000u}};
}
ShaderRecompiler::IR::ImageResource BasicUintVolumeStorageTextureResource() {
auto resource = BasicStorageTextureResource();
resource.kind = ShaderRecompiler::IR::ResourceKind::StorageImageUint;
@@ -15690,7 +15695,17 @@ ShaderTextureResource BasicUintVolumeStorageTextureDescriptor() {
} else if (std::strcmp(kind, "depth-tile-extent") == 0) {
resource = Ppsa14053DepthTileStorageTextureResource();
descriptor = Ppsa14053DepthTileStorageTextureDescriptor();
resource.dimension = ShaderRecompiler::Decoder::ImageDimension::Dim2D;
descriptor.fields[3] =
(descriptor.fields[3] & 0x0fffffffu) |
(Prospero::GpuEnumValue(Prospero::ImageType::kColor2D) << 28u);
descriptor.fields[4] |= 1u;
} else if (std::strcmp(kind, "depth-tile-fmask") == 0) {
resource = BasicArrayStorageTextureResource();
descriptor = Ppsa10112D16StorageTextureDescriptor();
descriptor.fields[1] =
(descriptor.fields[1] & ~(0x1ffu << 20u)) |
(Prospero::GpuEnumValue(Prospero::BufferFormat::kFmask8_S4_F4) << 20u);
} else {
std::_Exit(0x7e);
}
@@ -15935,6 +15950,34 @@ void CheckBasicStorageTextureDescriptor() {
"malformed");
ValidateStorageTexture(Ppsa14053DepthTileStorageTextureResource(), depth_tile,
0x10000);
const auto d16_depth_tile = Ppsa10112D16StorageTextureDescriptor();
Require("BasicStorageTexture", "PPSA10112 D16 depth-tile descriptor",
d16_depth_tile.Base40() == 0x205b900000ull &&
d16_depth_tile.Width5() + 1u == 240 &&
d16_depth_tile.Height5() + 1u == 135 &&
d16_depth_tile.Depth() + 1u == 1 &&
d16_depth_tile.Type() ==
Prospero::GpuEnumValue(Prospero::ImageType::kColor2DArray) &&
d16_depth_tile.Format() ==
Prospero::GpuEnumValue(Prospero::BufferFormat::k16UNorm) &&
d16_depth_tile.TileMode() ==
Prospero::GpuEnumValue(Prospero::TileMode::kDepth) &&
d16_depth_tile.DstSelXYZW() == DstSel(4, 0, 0, 1),
"PPSA10112 writable D16 depth-plane descriptor fixture is malformed");
const auto d16_pitch = TileGetTexturePitch(
d16_depth_tile.Format(), d16_depth_tile.Width5() + 1u, 1,
d16_depth_tile.TileMode());
TileSizeAlign d16_size{};
TileGetTextureTotalSize(
d16_depth_tile.Format(), d16_depth_tile.Width5() + 1u,
d16_depth_tile.Height5() + 1u, d16_depth_tile.Depth() + 1u, d16_pitch, 1,
d16_depth_tile.TileMode(), false, d16_size);
Require("BasicStorageTexture", "PPSA10112 D16 depth-tile footprint",
d16_pitch == 256 && d16_size.size == 0x20000 &&
d16_size.align == 0x10000,
"PPSA10112 writable D16 depth-plane footprint is incorrect");
ValidateStorageTexture(BasicArrayStorageTextureResource(), d16_depth_tile,
d16_size.size);
auto depth_tile_r32 = depth_tile;
depth_tile_r32.fields[1] =
(depth_tile_r32.fields[1] & ~(0x1ffu << 20u)) |
@@ -15959,7 +16002,7 @@ void CheckBasicStorageTextureDescriptor() {
"bgra-read", "r16-float-read", "r8-unorm-read", "yzwx-read",
"reserved-swizzle", "array-base-view", "array-mip-view", "reserved",
"uint-format", "uint-resource-float-format",
"depth-tile-read", "depth-tile-extent"}) {
"depth-tile-read", "depth-tile-extent", "depth-tile-fmask"}) {
std::string command = std::string("\"") + path +
"\" --storage-texture-descriptor-death " + kind;
std::vector<char> mutable_command(command.begin(), command.end());