2019-03-18 05:52:32 +00:00
|
|
|
// Copyright 2018-2019, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Holds Vulkan specific session functions.
|
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @ingroup oxr_main
|
|
|
|
* @ingroup comp_client
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2019-03-21 20:19:52 +00:00
|
|
|
#include "util/u_misc.h"
|
|
|
|
|
2020-03-01 12:09:25 +00:00
|
|
|
#include "xrt/xrt_gfx_fd.h"
|
2019-03-18 05:52:32 +00:00
|
|
|
#include "xrt/xrt_gfx_vk.h"
|
|
|
|
|
|
|
|
#include "oxr_objects.h"
|
|
|
|
#include "oxr_logger.h"
|
|
|
|
#include "oxr_two_call.h"
|
2019-04-05 19:18:03 +00:00
|
|
|
#include "oxr_handle.h"
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
XrResult
|
2019-04-05 22:13:58 +00:00
|
|
|
oxr_session_populate_vk(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
2019-06-03 19:17:45 +00:00
|
|
|
XrGraphicsBindingVulkanKHR const *next,
|
2019-04-05 22:13:58 +00:00
|
|
|
struct oxr_session *sess)
|
2019-03-18 05:52:32 +00:00
|
|
|
{
|
2020-03-02 19:34:43 +00:00
|
|
|
struct xrt_compositor_fd *xcfd =
|
|
|
|
xrt_gfx_provider_create_fd(sys->head, false);
|
2020-03-01 12:09:25 +00:00
|
|
|
if (xcfd == NULL) {
|
|
|
|
return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,
|
|
|
|
" failed create a fd compositor");
|
|
|
|
}
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
struct xrt_compositor_vk *xcvk = xrt_gfx_vk_provider_create(
|
2020-03-01 12:09:25 +00:00
|
|
|
xcfd, next->instance, vkGetInstanceProcAddr, next->physicalDevice,
|
|
|
|
next->device, next->queueFamilyIndex, next->queueIndex);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
if (xcvk == NULL) {
|
2020-03-01 12:09:25 +00:00
|
|
|
xcfd->base.destroy(&xcfd->base);
|
2019-03-18 05:52:32 +00:00
|
|
|
return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,
|
2020-03-01 12:09:25 +00:00
|
|
|
" failed create a vk client compositor");
|
2019-03-18 05:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sess->compositor = &xcvk->base;
|
|
|
|
sess->create_swapchain = oxr_swapchain_vk_create;
|
|
|
|
|
|
|
|
return XR_SUCCESS;
|
|
|
|
}
|