mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-28 07:01:21 +01:00
st/oxr: Tidy Swapchain API file
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2619>
This commit is contained in:
1 parent
cc88dcec71
commit
7da4d6571c
1 file changed
+25
-3
@@ -1,4 +1,5 @@
|
||||
// Copyright 2019-2020, Collabora, Ltd.
|
||||
// Copyright 2024-2025, NVIDIA CORPORATION.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
@@ -82,6 +83,12 @@ oxr_xrCreateSwapchain(XrSession session, const XrSwapchainCreateInfo *createInfo
|
||||
|
||||
// Short hand.
|
||||
struct oxr_instance *inst = sess->sys->inst;
|
||||
struct xrt_compositor_info *xc_info = &sess->compositor->info;
|
||||
|
||||
|
||||
/*
|
||||
* Usage flags.
|
||||
*/
|
||||
|
||||
XrSwapchainUsageFlags flags = 0;
|
||||
flags |= XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
@@ -102,10 +109,15 @@ oxr_xrCreateSwapchain(XrSession session, const XrSwapchainCreateInfo *createInfo
|
||||
"(createInfo->usageFlags == 0x%04" PRIx64 ") contains invalid flags",
|
||||
createInfo->usageFlags);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Format.
|
||||
*/
|
||||
|
||||
bool format_supported = false;
|
||||
struct xrt_compositor *c = sess->compositor;
|
||||
for (uint32_t i = 0; i < c->info.format_count; i++) {
|
||||
if (c->info.formats[i] == createInfo->format) {
|
||||
for (uint32_t i = 0; i < xc_info->format_count; i++) {
|
||||
if (xc_info->formats[i] == createInfo->format) {
|
||||
format_supported = true;
|
||||
break;
|
||||
}
|
||||
@@ -116,6 +128,11 @@ oxr_xrCreateSwapchain(XrSession session, const XrSwapchainCreateInfo *createInfo
|
||||
"(createInfo->format == 0x%04" PRIx64 ") is not supported", createInfo->format);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Format list.
|
||||
*/
|
||||
|
||||
#ifdef OXR_HAVE_KHR_vulkan_swapchain_format_list
|
||||
const XrVulkanSwapchainFormatListCreateInfoKHR *format_list = NULL;
|
||||
if (sess->sys->inst->extensions.KHR_vulkan_swapchain_format_list) {
|
||||
@@ -137,6 +154,11 @@ oxr_xrCreateSwapchain(XrSession session, const XrSwapchainCreateInfo *createInfo
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Validation done.
|
||||
*/
|
||||
|
||||
ret = sess->create_swapchain(&log, sess, createInfo, &sc);
|
||||
if (ret != XR_SUCCESS) {
|
||||
return ret;
|
||||
|
||||
Reference in new issue
Block a user