mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-29 22:36:52 +01:00
renderer: allow array storage views at nonzero mips
This commit is contained in:
@@ -391,9 +391,8 @@ static bool IsSupportedStorageTextureDescriptor(const ShaderRecompiler::IR::Imag
|
|||||||
const bool supported_swizzle =
|
const bool supported_swizzle =
|
||||||
IsValidImageSwizzle(swizzle) &&
|
IsValidImageSwizzle(swizzle) &&
|
||||||
(swizzle == DstSel(4, 5, 6, 7) || !resource.read || resource.atomic);
|
(swizzle == DstSel(4, 5, 6, 7) || !resource.read || resource.atomic);
|
||||||
const bool supported_mip_view = descriptor.BaseLevel() == 0 || is_1d || is_2d;
|
|
||||||
return (is_1d || is_1d_array || is_2d || is_2d_array || is_3d) && supported_tile &&
|
return (is_1d || is_1d_array || is_2d || is_2d_array || is_3d) && supported_tile &&
|
||||||
supported_mip_view && descriptor.BaseLevel() == descriptor.LastLevel() &&
|
descriptor.BaseLevel() == descriptor.LastLevel() &&
|
||||||
descriptor.LastLevel() <= descriptor.MaxMip() && descriptor.MinLod() == 0 &&
|
descriptor.LastLevel() <= descriptor.MaxMip() && descriptor.MinLod() == 0 &&
|
||||||
supported_swizzle && descriptor.BCSwizzle() == 0 && !descriptor.MsaaDepth();
|
supported_swizzle && descriptor.BCSwizzle() == 0 && !descriptor.MsaaDepth();
|
||||||
}
|
}
|
||||||
@@ -618,14 +617,15 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso
|
|||||||
const bool multisampled = IsMultisampledTexture(type);
|
const bool multisampled = IsMultisampledTexture(type);
|
||||||
const auto levels = multisampled ? 1u : static_cast<uint32_t>(descriptor.MaxMip()) + 1u;
|
const auto levels = multisampled ? 1u : static_cast<uint32_t>(descriptor.MaxMip()) + 1u;
|
||||||
const auto tile = descriptor.TileMode();
|
const auto tile = descriptor.TileMode();
|
||||||
const bool depth_tile = tile == Prospero::GpuEnumValue(Prospero::TileMode::kDepth);
|
const bool depth_tile = tile == Prospero::GpuEnumValue(Prospero::TileMode::kDepth);
|
||||||
const bool msaa_tile =
|
const bool msaa_tile =
|
||||||
depth_tile || tile == Prospero::GpuEnumValue(Prospero::TileMode::kRenderTarget);
|
depth_tile || tile == Prospero::GpuEnumValue(Prospero::TileMode::kRenderTarget);
|
||||||
const bool msaa_array = type == Prospero::ImageType::kColor2DMsaaArray;
|
const bool msaa_array = type == Prospero::ImageType::kColor2DMsaaArray;
|
||||||
if ((!multisampled && (base_level > last_level || last_level >= levels)) ||
|
if ((!multisampled && (base_level > last_level || last_level >= levels)) ||
|
||||||
(multisampled &&
|
(multisampled &&
|
||||||
(base_level != 0 || last_level == 0 || last_level > 3 ||
|
(base_level != 0 || last_level == 0 || last_level > 3 ||
|
||||||
descriptor.MaxMip() != last_level || !msaa_tile || (descriptor.MsaaDepth() && !depth_tile) ||
|
descriptor.MaxMip() != last_level || !msaa_tile ||
|
||||||
|
(descriptor.MsaaDepth() && !depth_tile) ||
|
||||||
(!msaa_array && (descriptor.Depth() != 0 || descriptor.BaseArray5() != 0))))) {
|
(!msaa_array && (descriptor.Depth() != 0 || descriptor.BaseArray5() != 0))))) {
|
||||||
EXIT("unsupported texture mip view: base=%u last=%u levels=%u max=%u type=%u tile=%u "
|
EXIT("unsupported texture mip view: base=%u last=%u levels=%u max=%u type=%u tile=%u "
|
||||||
"kind=%u dimension=%u mip_mode=%u read=%d written=%d "
|
"kind=%u dimension=%u mip_mode=%u read=%d written=%d "
|
||||||
@@ -634,7 +634,8 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso
|
|||||||
static_cast<uint32_t>(resource.kind), static_cast<uint32_t>(resource.dimension),
|
static_cast<uint32_t>(resource.kind), static_cast<uint32_t>(resource.dimension),
|
||||||
static_cast<uint32_t>(resource.mip_mode), resource.read, resource.written,
|
static_cast<uint32_t>(resource.mip_mode), resource.read, resource.written,
|
||||||
descriptor.fields[0], descriptor.fields[1], descriptor.fields[2], descriptor.fields[3],
|
descriptor.fields[0], descriptor.fields[1], descriptor.fields[2], descriptor.fields[3],
|
||||||
descriptor.fields[4], descriptor.fields[5], descriptor.fields[6], descriptor.fields[7]);
|
descriptor.fields[4], descriptor.fields[5], descriptor.fields[6],
|
||||||
|
descriptor.fields[7]);
|
||||||
}
|
}
|
||||||
const auto samples = multisampled ? 1u << last_level : 1u;
|
const auto samples = multisampled ? 1u << last_level : 1u;
|
||||||
const auto view_levels =
|
const auto view_levels =
|
||||||
@@ -661,8 +662,8 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso
|
|||||||
TileSizeAlign size {};
|
TileSizeAlign size {};
|
||||||
if (multisampled) {
|
if (multisampled) {
|
||||||
const auto bytes = Prospero::NumBytesPerElement(format);
|
const auto bytes = Prospero::NumBytesPerElement(format);
|
||||||
pitch = depth_tile ? TileGetDepthPitch(width, bytes, last_level)
|
pitch = depth_tile ? TileGetDepthPitch(width, bytes, last_level)
|
||||||
: TileGetRenderTargetPitch(width, bytes, last_level);
|
: TileGetRenderTargetPitch(width, bytes, last_level);
|
||||||
if (pitch == 0 || !TileGetRenderTargetSize(width, height, pitch, bytes, size, last_level) ||
|
if (pitch == 0 || !TileGetRenderTargetSize(width, height, pitch, bytes, size, last_level) ||
|
||||||
size.size > UINT32_MAX / image_layers) {
|
size.size > UINT32_MAX / image_layers) {
|
||||||
EXIT("unsupported multisample texture layout\n");
|
EXIT("unsupported multisample texture layout\n");
|
||||||
@@ -679,8 +680,8 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso
|
|||||||
ValidateStorageTexture(resource, descriptor, size.size);
|
ValidateStorageTexture(resource, descriptor, size.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto pixel_format = TextureGetFormat(format);
|
const auto pixel_format = TextureGetFormat(format);
|
||||||
const auto storage_view_format =
|
const auto storage_view_format =
|
||||||
storage && format == Prospero::GpuEnumValue(Prospero::BufferFormat::k32SInt)
|
storage && format == Prospero::GpuEnumValue(Prospero::BufferFormat::k32SInt)
|
||||||
? vk::Format::eR32Uint
|
? vk::Format::eR32Uint
|
||||||
: SrgbStorageViewFormat(pixel_format);
|
: SrgbStorageViewFormat(pixel_format);
|
||||||
|
|||||||
@@ -15989,11 +15989,6 @@ ShaderTextureResource AtomicStorageTextureDescriptor() {
|
|||||||
resource = BasicArrayStorageTextureResource();
|
resource = BasicArrayStorageTextureResource();
|
||||||
descriptor = BasicArrayStorageTextureDescriptor();
|
descriptor = BasicArrayStorageTextureDescriptor();
|
||||||
descriptor.fields[4] |= 1u << 16u;
|
descriptor.fields[4] |= 1u << 16u;
|
||||||
} else if (std::strcmp(kind, "array-mip-view") == 0) {
|
|
||||||
resource = BasicArrayStorageTextureResource();
|
|
||||||
descriptor = BasicArrayStorageTextureDescriptor();
|
|
||||||
descriptor.fields[3] |= (1u << 12u) | (1u << 16u);
|
|
||||||
descriptor.fields[5] |= 1u << 4u;
|
|
||||||
} else if (std::strcmp(kind, "reserved") == 0) {
|
} else if (std::strcmp(kind, "reserved") == 0) {
|
||||||
descriptor.fields[1] |= 1u << 29u;
|
descriptor.fields[1] |= 1u << 29u;
|
||||||
} else if (std::strcmp(kind, "uint-format") == 0) {
|
} else if (std::strcmp(kind, "uint-format") == 0) {
|
||||||
@@ -16169,6 +16164,16 @@ void CheckBasicStorageTextureDescriptor() {
|
|||||||
array.DstSelXYZW() == DstSel(6, 5, 4, 7),
|
array.DstSelXYZW() == DstSel(6, 5, 4, 7),
|
||||||
"PPSA21268 2D-array storage descriptor fixture is malformed");
|
"PPSA21268 2D-array storage descriptor fixture is malformed");
|
||||||
ValidateStorageTexture(BasicArrayStorageTextureResource(), array, 0x10000);
|
ValidateStorageTexture(BasicArrayStorageTextureResource(), array, 0x10000);
|
||||||
|
const ShaderTextureResource mip_array {{0x20268d00u, 0xc4700000u, 0x001fc01fu,
|
||||||
|
0xd1b11facu, 0x00000000u, 0x00700070u,
|
||||||
|
0x00000000u, 0x00000000u}};
|
||||||
|
Require("BasicStorageTexture", "PPSA14457 mip-one 2D-array descriptor",
|
||||||
|
mip_array.BaseLevel() == 1 && mip_array.LastLevel() == 1 &&
|
||||||
|
mip_array.MaxMip() == 7 &&
|
||||||
|
mip_array.Type() == Prospero::GpuEnumValue(Prospero::ImageType::kColor2DArray) &&
|
||||||
|
mip_array.Depth() == 0 && mip_array.BaseArray5() == 0,
|
||||||
|
"PPSA14457 mip-one 2D-array storage descriptor fixture is malformed");
|
||||||
|
ValidateStorageTexture(BasicArrayStorageTextureResource(), mip_array, 0x30000);
|
||||||
|
|
||||||
const auto uint_array = BasicUintArrayStorageTextureDescriptor();
|
const auto uint_array = BasicUintArrayStorageTextureDescriptor();
|
||||||
Require("BasicStorageTexture", "uint 2D-array descriptor",
|
Require("BasicStorageTexture", "uint 2D-array descriptor",
|
||||||
@@ -16329,7 +16334,6 @@ void CheckBasicStorageTextureDescriptor() {
|
|||||||
"yzwx-read",
|
"yzwx-read",
|
||||||
"reserved-swizzle",
|
"reserved-swizzle",
|
||||||
"array-base-out-of-range",
|
"array-base-out-of-range",
|
||||||
"array-mip-view",
|
|
||||||
"reserved",
|
"reserved",
|
||||||
"uint-format",
|
"uint-format",
|
||||||
"uint-resource-float-format",
|
"uint-resource-float-format",
|
||||||
|
|||||||
Reference in New Issue
Block a user