2019-03-18 05:52:32 +00:00
|
|
|
// Copyright 2019, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Vulkan client side glue to compositor header.
|
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
|
|
|
|
* @ingroup comp_client
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-23 12:30:26 +00:00
|
|
|
#include "vk/vk_helpers.h"
|
2019-03-18 05:52:32 +00:00
|
|
|
#include "xrt/xrt_gfx_vk.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Structs
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct client_vk_compositor;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Wraps the real compositor swapchain providing a Vulkan based interface.
|
|
|
|
*
|
|
|
|
* Almost a one to one mapping to a OpenXR swapchain.
|
|
|
|
*
|
|
|
|
* @ingroup comp_client
|
2020-06-03 16:43:30 +00:00
|
|
|
* @implements xrt_swapchain_vk
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct client_vk_swapchain
|
|
|
|
{
|
|
|
|
struct xrt_swapchain_vk base;
|
2020-06-03 16:43:30 +00:00
|
|
|
|
2020-07-14 22:13:07 +00:00
|
|
|
//! Owning reference to the backing native swapchain.
|
|
|
|
struct xrt_swapchain_native *xscn;
|
2020-06-03 16:43:30 +00:00
|
|
|
|
|
|
|
//! Non-owning reference to our parent compositor.
|
2019-03-18 05:52:32 +00:00
|
|
|
struct client_vk_compositor *c;
|
2020-07-10 09:08:23 +00:00
|
|
|
|
|
|
|
// Memory
|
|
|
|
VkDeviceMemory mems[XRT_MAX_SWAPCHAIN_IMAGES];
|
|
|
|
|
|
|
|
// Prerecorded swapchain image ownership/layout transition barriers
|
|
|
|
VkCommandBuffer acquire[XRT_MAX_SWAPCHAIN_IMAGES];
|
|
|
|
VkCommandBuffer release[XRT_MAX_SWAPCHAIN_IMAGES];
|
2021-08-16 13:45:48 +00:00
|
|
|
VkFence acquire_release_fence[XRT_MAX_SWAPCHAIN_IMAGES];
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-03 16:43:30 +00:00
|
|
|
* @class client_vk_compositor
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* Wraps the real compositor providing a Vulkan based interface.
|
|
|
|
*
|
|
|
|
* @ingroup comp_client
|
2020-06-03 16:43:30 +00:00
|
|
|
* @implements xrt_compositor_vk
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct client_vk_compositor
|
|
|
|
{
|
|
|
|
struct xrt_compositor_vk base;
|
|
|
|
|
2020-07-14 22:13:07 +00:00
|
|
|
//! Owning reference to the backing native compositor
|
|
|
|
struct xrt_compositor_native *xcn;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
struct vk_bundle vk;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Functions and helpers.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Create a new client_vk_compositor.
|
|
|
|
*
|
2020-07-14 22:13:07 +00:00
|
|
|
* Takes owenership of provided xcn.
|
2020-06-03 17:04:06 +00:00
|
|
|
*
|
2020-06-03 16:43:30 +00:00
|
|
|
* @public @memberof client_vk_compositor
|
2021-03-26 16:19:42 +00:00
|
|
|
* @see xrt_compositor_native
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct client_vk_compositor *
|
2020-07-14 22:13:07 +00:00
|
|
|
client_vk_compositor_create(struct xrt_compositor_native *xcn,
|
2019-03-18 05:52:32 +00:00
|
|
|
VkInstance instance,
|
|
|
|
PFN_vkGetInstanceProcAddr getProc,
|
|
|
|
VkPhysicalDevice physicalDevice,
|
|
|
|
VkDevice device,
|
|
|
|
uint32_t queueFamilyIndex,
|
|
|
|
uint32_t queueIndex);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|