diff --git a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp index 4b12031..ef3c21d 100644 --- a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp +++ b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp @@ -391,9 +391,8 @@ static bool IsSupportedStorageTextureDescriptor(const ShaderRecompiler::IR::Imag const bool supported_swizzle = IsValidImageSwizzle(swizzle) && (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 && - supported_mip_view && descriptor.BaseLevel() == descriptor.LastLevel() && + descriptor.BaseLevel() == descriptor.LastLevel() && descriptor.LastLevel() <= descriptor.MaxMip() && descriptor.MinLod() == 0 && supported_swizzle && descriptor.BCSwizzle() == 0 && !descriptor.MsaaDepth(); } @@ -618,14 +617,15 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso const bool multisampled = IsMultisampledTexture(type); const auto levels = multisampled ? 1u : static_cast(descriptor.MaxMip()) + 1u; 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 = depth_tile || tile == Prospero::GpuEnumValue(Prospero::TileMode::kRenderTarget); const bool msaa_array = type == Prospero::ImageType::kColor2DMsaaArray; if ((!multisampled && (base_level > last_level || last_level >= levels)) || (multisampled && (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))))) { 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 " @@ -634,7 +634,8 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso static_cast(resource.kind), static_cast(resource.dimension), static_cast(resource.mip_mode), resource.read, resource.written, 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 view_levels = @@ -661,8 +662,8 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso TileSizeAlign size {}; if (multisampled) { const auto bytes = Prospero::NumBytesPerElement(format); - pitch = depth_tile ? TileGetDepthPitch(width, bytes, last_level) - : TileGetRenderTargetPitch(width, bytes, last_level); + pitch = depth_tile ? TileGetDepthPitch(width, bytes, last_level) + : TileGetRenderTargetPitch(width, bytes, last_level); if (pitch == 0 || !TileGetRenderTargetSize(width, height, pitch, bytes, size, last_level) || size.size > UINT32_MAX / image_layers) { EXIT("unsupported multisample texture layout\n"); @@ -679,8 +680,8 @@ RenderExecutor::ResolveTexture(const ShaderRecompiler::IR::ImageResource& reso ValidateStorageTexture(resource, descriptor, size.size); } - const auto pixel_format = TextureGetFormat(format); - const auto storage_view_format = + const auto pixel_format = TextureGetFormat(format); + const auto storage_view_format = storage && format == Prospero::GpuEnumValue(Prospero::BufferFormat::k32SInt) ? vk::Format::eR32Uint : SrgbStorageViewFormat(pixel_format); diff --git a/tests/ShaderRecompilerComputeTests.cpp b/tests/ShaderRecompilerComputeTests.cpp index 52c5112..ec7246c 100644 --- a/tests/ShaderRecompilerComputeTests.cpp +++ b/tests/ShaderRecompilerComputeTests.cpp @@ -15989,11 +15989,6 @@ ShaderTextureResource AtomicStorageTextureDescriptor() { resource = BasicArrayStorageTextureResource(); descriptor = BasicArrayStorageTextureDescriptor(); 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) { descriptor.fields[1] |= 1u << 29u; } else if (std::strcmp(kind, "uint-format") == 0) { @@ -16169,6 +16164,16 @@ void CheckBasicStorageTextureDescriptor() { array.DstSelXYZW() == DstSel(6, 5, 4, 7), "PPSA21268 2D-array storage descriptor fixture is malformed"); 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(); Require("BasicStorageTexture", "uint 2D-array descriptor", @@ -16329,7 +16334,6 @@ void CheckBasicStorageTextureDescriptor() { "yzwx-read", "reserved-swizzle", "array-base-out-of-range", - "array-mip-view", "reserved", "uint-format", "uint-resource-float-format",