From 2dd4698441271bf9a1b61580e240e1614bf9028a Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 30 Oct 2022 16:24:43 +0000 Subject: [PATCH] Adjust texture matching hacks --- app/src/main/cpp/skyline/gpu/texture/texture.cpp | 5 +++++ app/src/main/cpp/skyline/gpu/texture/texture.h | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.cpp b/app/src/main/cpp/skyline/gpu/texture/texture.cpp index 1fc919e3..7ca2ff01 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.cpp +++ b/app/src/main/cpp/skyline/gpu/texture/texture.cpp @@ -857,6 +857,11 @@ namespace skyline::gpu { if (gpu.traits.quirks.vkImageMutableFormatCostly && viewFormat != textureFormat && (!gpu.traits.quirks.adrenoRelaxedFormatAliasing || !texture::IsAdrenoAliasCompatible(viewFormat, textureFormat))) Logger::Warn("Creating a view of a texture with a different format without mutable format: {} - {}", vk::to_string(viewFormat), vk::to_string(textureFormat)); + if ((pFormat->vkAspect & format->vkAspect) == vk::ImageAspectFlagBits{}) { + pFormat = format; // If the requested format doesn't share any aspects then fallback to the texture's format in the hope it's more likely to function + range.aspectMask = format->Aspect(mapping.r == vk::ComponentSwizzle::eR); + } + return std::make_shared(shared_from_this(), type, range, pFormat, mapping); } diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.h b/app/src/main/cpp/skyline/gpu/texture/texture.h index b8b38150..331987e9 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.h +++ b/app/src/main/cpp/skyline/gpu/texture/texture.h @@ -115,7 +115,6 @@ namespace skyline::gpu { constexpr bool IsCompatible(const FormatBase &other) const { return vkFormat == other.vkFormat || (vkFormat == vk::Format::eD32Sfloat && other.vkFormat == vk::Format::eR32Sfloat) - || (vkFormat == vk::Format::eR32Sfloat && other.vkFormat == vk::Format::eD32Sfloat) || (componentCount(vkFormat) == componentCount(other.vkFormat) && ranges::all_of(ranges::views::iota(u8{0}, componentCount(vkFormat)), [this, other](auto i) { return componentBits(vkFormat, i) == componentBits(other.vkFormat, i);