diff options
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 11 |
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, | |||
| 179 | swapchain_ci.queueFamilyIndexCount = static_cast<u32>(queue_indices.size()); | 179 | swapchain_ci.queueFamilyIndexCount = static_cast<u32>(queue_indices.size()); |
| 180 | swapchain_ci.pQueueFamilyIndices = queue_indices.data(); | 180 | swapchain_ci.pQueueFamilyIndices = queue_indices.data(); |
| 181 | } | 181 | } |
| 182 | static constexpr std::array view_formats{VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SRGB}; | ||
| 183 | VkImageFormatListCreateInfo format_list{ | ||
| 184 | .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR, | ||
| 185 | .pNext = nullptr, | ||
| 186 | .viewFormatCount = static_cast<u32>(view_formats.size()), | ||
| 187 | .pViewFormats = view_formats.data(), | ||
| 188 | }; | ||
| 189 | if (device.IsKhrSwapchainMutableFormatEnabled()) { | ||
| 190 | format_list.pNext = std::exchange(swapchain_ci.pNext, &format_list); | ||
| 191 | swapchain_ci.flags |= VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR; | ||
| 192 | } | ||
| 182 | // Request the size again to reduce the possibility of a TOCTOU race condition. | 193 | // Request the size again to reduce the possibility of a TOCTOU race condition. |
| 183 | const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface); | 194 | const auto updated_capabilities = physical_device.GetSurfaceCapabilitiesKHR(surface); |
| 184 | swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height); | 195 | swapchain_ci.imageExtent = ChooseSwapExtent(updated_capabilities, width, height); |