The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/main: pick composite alpha from surface caps in swapchain creation

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2332>

authored by

Simon Zeni and committed by
Rylie Pavlik
c6c7a004 a944cfdc

+15 -1
+15 -1
src/xrt/compositor/main/comp_target_swapchain.c
··· 731 731 // Get the image count. 732 732 uint32_t image_count = select_image_count(cts, surface_caps, preferred_at_least_image_count); 733 733 734 + /* 735 + * VUID-VkSwapchainCreateInfoKHR-compositeAlpha-01280 736 + * compositeAlpha must be one of the bits present in the supportedCompositeAlpha member of the 737 + * VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface. 738 + */ 739 + VkCompositeAlphaFlagsKHR composite_alpha = 0; 740 + if (surface_caps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR) { 741 + composite_alpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; 742 + } else if (surface_caps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR) { 743 + composite_alpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR; 744 + } else { 745 + COMP_ERROR(ct->c, "Unsupported composite alpha"); 746 + goto error_print_and_free; 747 + } 734 748 735 749 /* 736 750 * Do the creation. ··· 753 767 .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, 754 768 .queueFamilyIndexCount = 0, 755 769 .preTransform = surface_caps.currentTransform, 756 - .compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, 770 + .compositeAlpha = composite_alpha, 757 771 .presentMode = cts->present_mode, 758 772 .clipped = VK_TRUE, 759 773 .oldSwapchain = old_swapchain_handle,