diff --git a/app/src/main/cpp/skyline/gpu/texture/texture.cpp b/app/src/main/cpp/skyline/gpu/texture/texture.cpp index ba362914..6058a983 100644 --- a/app/src/main/cpp/skyline/gpu/texture/texture.cpp +++ b/app/src/main/cpp/skyline/gpu/texture/texture.cpp @@ -307,7 +307,7 @@ namespace skyline::gpu { usage |= vk::ImageUsageFlagBits::eDepthStencilAttachment; vk::ImageCreateInfo imageCreateInfo{ - .flags = vk::ImageCreateFlagBits::eMutableFormat, + .flags = gpu.traits.quirks.vkImageMutableFormatCostly ? vk::ImageCreateFlags{} : vk::ImageCreateFlagBits::eMutableFormat, .imageType = guest->dimensions.GetType(), .format = *guest->format, .extent = guest->dimensions, @@ -528,6 +528,9 @@ namespace skyline::gpu { ++viewIt; } + if (gpu.traits.quirks.vkImageMutableFormatCostly && pFormat->vkFormat != format->vkFormat) + Logger::Warn("Creating a view of a texture with a different format without mutable format"); + auto view{std::make_shared(shared_from_this(), type, range, pFormat, mapping)}; views.push_back(view); return view; diff --git a/app/src/main/cpp/skyline/gpu/trait_manager.cpp b/app/src/main/cpp/skyline/gpu/trait_manager.cpp index e55889aa..4efa5e26 100644 --- a/app/src/main/cpp/skyline/gpu/trait_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/trait_manager.cpp @@ -131,6 +131,12 @@ namespace skyline::gpu { switch (driverProperties.driverID) { case vk::DriverId::eQualcommProprietary: { needsIndividualTextureBindingWrites = true; + vkImageMutableFormatCostly = true; // Disables UBWC + break; + } + + case vk::DriverId::eMesaTurnip: { + vkImageMutableFormatCostly = true; // Disables UBWC and forces linear tiling break; } @@ -141,8 +147,8 @@ namespace skyline::gpu { std::string TraitManager::QuirkManager::Summary() { return fmt::format( - "\n* Needs Individual Texture Binding Writes: {}", - needsIndividualTextureBindingWrites + "\n* Needs Individual Texture Binding Writes: {}\n* VkImage Mutable Format is costly: {}", + needsIndividualTextureBindingWrites, vkImageMutableFormatCostly ); } diff --git a/app/src/main/cpp/skyline/gpu/trait_manager.h b/app/src/main/cpp/skyline/gpu/trait_manager.h index a69c693d..0f68e5ac 100644 --- a/app/src/main/cpp/skyline/gpu/trait_manager.h +++ b/app/src/main/cpp/skyline/gpu/trait_manager.h @@ -40,6 +40,7 @@ namespace skyline::gpu { */ struct QuirkManager { bool needsIndividualTextureBindingWrites{}; //!< [Adreno Proprietary] A bug that requires descriptor set writes for VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER to be done individually with descriptorCount = 1 rather than batched + bool vkImageMutableFormatCostly{}; //!< [Adreno Proprietary/Freedreno] An indication that VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT is costly and should not be enabled unless absolutely necessary (Disables UBWC on Adreno GPUs) QuirkManager() = default;