summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-04-13 22:38:20 +0200
committerLiam <byteslice@airmail.cc>2023-04-13 22:38:20 +0200
commite37e1d24f90acf8371de7af65ae4ed13b288cef4 (patch)
treec9e05ffb32cf4bf2ef5cdb8e3d8bf12e23c0ab9f /src/video_core/renderer_vulkan
parentMerge pull request #10008 from vonchenplus/texture_cache (diff)
downloadyuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.tar
yuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.tar.gz
yuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.tar.bz2
yuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.tar.lz
yuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.tar.xz
yuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.tar.zst
yuzu-e37e1d24f90acf8371de7af65ae4ed13b288cef4.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.cpp15
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
return extent;
}
+VkCompositeAlphaFlagBitsKHR ChooseAlphaFlags(const VkSurfaceCapabilitiesKHR& capabilities) {
+ if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR) {
+ return VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
+ } else if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR) {
+ return VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
+ } else {
+ LOG_ERROR(Render_Vulkan, "Unknown composite alpha flags value {:#x}",
+ capabilities.supportedCompositeAlpha);
+ return VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
+ }
+}
+
} // Anonymous namespace
Swapchain::Swapchain(VkSurfaceKHR surface_, const Device& device_, Scheduler& scheduler_,
@@ -155,6 +167,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, bo
const auto formats{physical_device.GetSurfaceFormatsKHR(surface)};
const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)};
+ const VkCompositeAlphaFlagBitsKHR alpha_flags{ChooseAlphaFlags(capabilities)};
const VkSurfaceFormatKHR surface_format{ChooseSwapSurfaceFormat(formats)};
present_mode = ChooseSwapPresentMode(present_modes);
@@ -185,7 +198,7 @@ void Swapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, bo
.queueFamilyIndexCount = 0,
.pQueueFamilyIndices = nullptr,
.preTransform = capabilities.currentTransform,
- .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
+ .compositeAlpha = alpha_flags,
.presentMode = present_mode,
.clipped = VK_FALSE,
.oldSwapchain = nullptr,