mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-04 23:55:08 +01:00
Add quirk to avoid VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
on Adreno GPUs
Adreno GPUs have significant performance penalties from usage of `VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT` which require disabling UBWC and on Turnip, forces linear tiling. As a result, it's been made an optional quirk which doesn't supply the flag in `VkImageCreateInfo` and logs a warning if a view with a different Vulkan format from the original image is created.
This commit is contained in:
parent
731d06010d
commit
24d7066d8b
@ -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<TextureView>(shared_from_this(), type, range, pFormat, mapping)};
|
||||
views.push_back(view);
|
||||
return view;
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user