diff options
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 85fdce6e5..b1465e35c 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -65,6 +65,18 @@ VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 wi | |||
| 65 | return extent; | 65 | return extent; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | VkCompositeAlphaFlagBitsKHR ChooseAlphaFlags(const VkSurfaceCapabilitiesKHR& capabilities) { | ||
| 69 | if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR) { | ||
| 70 | return VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; | ||
| 71 | } else if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR) { | ||
| 72 | return VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR; | ||
| 73 | } else { | ||
| 74 | LOG_ERROR(Render_Vulkan, "Unknown composite alpha flags value {:#x}", | ||
| 75 | capabilities.supportedCompositeAlpha); | ||
| 76 | return VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 68 | } // Anonymous namespace | 80 | } // Anonymous namespace |
| 69 | 81 | ||
| 70 | Swapchain::Swapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_, | 82 | Swapchain::Swapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_, |
| @@ -155,6 +167,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, bo | |||
| 155 | const auto formats{physical_device.GetSurfaceFormatsKHR(surface)}; | 167 | const auto formats{physical_device.GetSurfaceFormatsKHR(surface)}; |
| 156 | const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; | 168 | const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; |
| 157 | 169 | ||
| 170 | const VkCompositeAlphaFlagBitsKHR alpha_flags{ChooseAlphaFlags(capabilities)}; | ||
| 158 | const VkSurfaceFormatKHR surface_format{ChooseSwapSurfaceFormat(formats)}; | 171 | const VkSurfaceFormatKHR surface_format{ChooseSwapSurfaceFormat(formats)}; |
| 159 | present_mode = ChooseSwapPresentMode(present_modes); | 172 | present_mode = ChooseSwapPresentMode(present_modes); |
| 160 | 173 | ||
| @@ -185,7 +198,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, bo | |||
| 185 | .queueFamilyIndexCount = 0, | 198 | .queueFamilyIndexCount = 0, |
| 186 | .pQueueFamilyIndices = nullptr, | 199 | .pQueueFamilyIndices = nullptr, |
| 187 | .preTransform = capabilities.currentTransform, | 200 | .preTransform = capabilities.currentTransform, |
| 188 | .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, | 201 | .compositeAlpha = alpha_flags, |
| 189 | .presentMode = present_mode, | 202 | .presentMode = present_mode, |
| 190 | .clipped = VK_FALSE, | 203 | .clipped = VK_FALSE, |
| 191 | .oldSwapchain = nullptr, | 204 | .oldSwapchain = nullptr, |