monado/src/xrt/compositor/client/comp_vk_client.h

103 lines
2.1 KiB
C
Raw Normal View History

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
#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
//! 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;
// 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];
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;
//! 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.
*
* Takes owenership of provided xcn.
*
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 *
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