summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-08-29 07:52:09 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-08-29 08:03:36 +0200
commit27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48 (patch)
tree3c4d2b8e421252c5f674606d9d9ab372b1552ee8 /src/video_core/renderer_vulkan
parentvk_swapchain: Prefer linear swapchain format when presenting sRGB images (diff)
downloadyuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.tar
yuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.tar.gz
yuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.tar.bz2
yuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.tar.lz
yuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.tar.xz
yuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.tar.zst
yuzu-27f8f3333f8e87e87c7b7dfebdc466bb96ab0a48.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp
index d0a731660..e5318e52d 100644
--- a/src/video_core/renderer_vulkan/vk_swapchain.cpp
+++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp
@@ -179,6 +179,17 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities,
swapchain_ci.queueFamilyIndexCount = static_cast<u32>(queue_indices.size());
swapchain_ci.pQueueFamilyIndices = queue_indices.data();
}
+ static constexpr std::array view_formats{VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SRGB};
+ VkImageFormatListCreateInfo format_list{
+ .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR,
+ .pNext = nullptr,
+ .viewFormatCount = static_cast<u32>(view_formats.size()),
+ .pViewFormats = view_formats.data(),
+ };
+ if (device.IsKhrSwapchainMutableFormatEnabled()) {
+ format_list.pNext = std::exchange(swapchain_ci.pNext, &format_list);
+ swapchain_ci.flags |= VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR;
+ }
// Request the size again to reduce the possibility of a TOCTOU race condition.
const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface);
swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height);