From 428915fd8815d0d67386bf23f7cf6ace0c0b0cb5 Mon Sep 17 00:00:00 2001 From: MaranBr Date: Mon, 8 Sep 2025 09:07:14 -0400 Subject: [PATCH] Potential fix for PR 321 --- Test_patch_for_potential_321_fix.patch | 34 +++++++++++++++++++ .../renderer_vulkan/vk_texture_cache.cpp | 17 ++-------- 2 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 Test_patch_for_potential_321_fix.patch diff --git a/Test_patch_for_potential_321_fix.patch b/Test_patch_for_potential_321_fix.patch new file mode 100644 index 0000000000..fedae79f4c --- /dev/null +++ b/Test_patch_for_potential_321_fix.patch @@ -0,0 +1,34 @@ +Subject: [PATCH] Test patch for potential 321 fix +--- +Index: src/video_core/renderer_vulkan/vk_texture_cache.cpp +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp +--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp (revision 428249cb01f60668a1842d184e95fb68b68970c1) ++++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp (date 1756628527793) +@@ -2165,20 +2165,9 @@ + storage_views = std::make_unique(); + } + +- // Storage images MUST use identity component mapping. +- // Typeless: use the underlying image's native format. +- if (image_format == Shader::ImageFormat::Typeless) { +- auto& view = storage_views->unsigneds[static_cast(texture_type)]; +- if (view) { +- return *view; +- } +- const auto fmt_info = +- MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, /*is_image=*/true, format); +- const VkFormat vk_format = fmt_info.format; +- // Storage images are color-aspect only +- view = MakeView(vk_format, VK_IMAGE_ASPECT_COLOR_BIT); // identity components inside +- return *view; +- } ++ // For typeless, reuse the sampling view to preserve game expectations(just to test if it fixes the issue) ++ if (image_format == Shader::ImageFormat::Typeless) ++ return Handle(texture_type); + const bool is_signed = (image_format == Shader::ImageFormat::R8_SINT ||image_format == Shader::ImageFormat::R16_SINT); + auto& views = is_signed ? storage_views->signeds : storage_views->unsigneds; + auto& view = views[static_cast(texture_type)]; diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 1e89652f50..c9d4aca754 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -2165,20 +2165,9 @@ VkImageView ImageView::StorageView(Shader::TextureType texture_type, storage_views = std::make_unique(); } - // Storage images MUST use identity component mapping. - // Typeless: use the underlying image's native format. - if (image_format == Shader::ImageFormat::Typeless) { - auto& view = storage_views->unsigneds[static_cast(texture_type)]; - if (view) { - return *view; - } - const auto fmt_info = - MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, /*is_image=*/true, format); - const VkFormat vk_format = fmt_info.format; - // Storage images are color-aspect only - view = MakeView(vk_format, VK_IMAGE_ASPECT_COLOR_BIT); // identity components inside - return *view; - } + // For typeless, reuse the sampling view to preserve game expectations(just to test if it fixes the issue) + if (image_format == Shader::ImageFormat::Typeless) + return Handle(texture_type); const bool is_signed = (image_format == Shader::ImageFormat::R8_SINT ||image_format == Shader::ImageFormat::R16_SINT); auto& views = is_signed ? storage_views->signeds : storage_views->unsigneds; auto& view = views[static_cast(texture_type)];