Monado OpenXR Runtime
comp_vk_client.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Vulkan client side glue to compositor header.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
8 * @ingroup comp_client
9 */
10
11#pragma once
12
13#include "vk/vk_helpers.h"
14#include "vk/vk_cmd_pool.h"
15#include "xrt/xrt_gfx_vk.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
22/*
23 *
24 * Structs
25 *
26 */
27
29
30/*!
31 * Wraps the real compositor swapchain providing a Vulkan based interface.
32 *
33 * Almost a one to one mapping to a OpenXR swapchain.
34 *
35 * @ingroup comp_client
36 * @implements xrt_swapchain_vk
37 */
39{
41
42 //! Owning reference to the backing native swapchain.
44
45 //! Non-owning reference to our parent compositor.
47
48 // Memory
49 VkDeviceMemory mems[XRT_MAX_SWAPCHAIN_IMAGES];
50
51 // Prerecorded swapchain image ownership/layout transition barriers
52 VkCommandBuffer acquire[XRT_MAX_SWAPCHAIN_IMAGES];
53 VkCommandBuffer release[XRT_MAX_SWAPCHAIN_IMAGES];
54};
55
56/*!
57 * @class client_vk_compositor
58 *
59 * Wraps the real compositor providing a Vulkan based interface.
60 *
61 * @ingroup comp_client
62 * @implements xrt_compositor_vk
63 */
65{
67
68 //! Owning reference to the backing native compositor
70
71 struct
72 {
73 VkSemaphore semaphore;
74 struct xrt_compositor_semaphore *xcsem;
75 uint64_t value;
76 } sync;
77
78 struct vk_bundle vk;
79
80 struct vk_cmd_pool pool;
81
82 bool renderdoc_enabled;
83 VkCommandBuffer dcb;
84};
85
86
87/*
88 *
89 * Functions and helpers.
90 *
91 */
92
93
94/*!
95 * Create a new client_vk_compositor.
96 *
97 * Takes ownership of provided xcn.
98 *
99 * @public @memberof client_vk_compositor
100 * @see xrt_compositor_native
101 */
104 VkInstance instance,
105 PFN_vkGetInstanceProcAddr getProc,
106 VkPhysicalDevice physicalDevice,
107 VkDevice device,
108 bool external_fence_fd_enabled,
109 bool external_semaphore_fd_enabled,
110 bool timeline_semaphore_enabled,
111 bool debug_utils_enabled,
112 bool renderdoc_enabled,
113 uint32_t queueFamilyIndex,
114 uint32_t queueIndex);
115
116
117#ifdef __cplusplus
118}
119#endif
#define XRT_MAX_SWAPCHAIN_IMAGES
Max swapchain images, artificial limit.
Definition: xrt_limits.h:34
Wraps the real compositor providing a Vulkan based interface.
Definition: comp_vk_client.h:65
struct client_vk_compositor * client_vk_compositor_create(struct xrt_compositor_native *xcn, VkInstance instance, PFN_vkGetInstanceProcAddr getProc, VkPhysicalDevice physicalDevice, VkDevice device, bool external_fence_fd_enabled, bool external_semaphore_fd_enabled, bool timeline_semaphore_enabled, bool debug_utils_enabled, bool renderdoc_enabled, uint32_t queueFamilyIndex, uint32_t queueIndex)
Create a new client_vk_compositor.
Definition: comp_vk_client.c:811
struct xrt_compositor_native * xcn
Owning reference to the backing native compositor.
Definition: comp_vk_client.h:69
Wraps the real compositor swapchain providing a Vulkan based interface.
Definition: comp_vk_client.h:39
struct client_vk_compositor * c
Non-owning reference to our parent compositor.
Definition: comp_vk_client.h:46
struct xrt_swapchain_native * xscn
Owning reference to the backing native swapchain.
Definition: comp_vk_client.h:43
Definition: u_worker.c:49
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code.
Definition: vk_helpers.h:49
Small helper to manage lock around a command pool.
Definition: vk_cmd_pool.h:33
Main compositor server interface.
Definition: xrt_compositor.h:2224
Compositor semaphore used for synchronization, needs to be as capable as a Vulkan pipeline semaphore.
Definition: xrt_compositor.h:788
Base class for a Vulkan client compositor.
Definition: xrt_compositor.h:2019
struct xrt_compositor base
Base.
Definition: xrt_compositor.h:2021
Base class for a swapchain that exposes a native buffer handle to be imported into a client API.
Definition: xrt_compositor.h:2191
Base class for a Vulkan client swapchain.
Definition: xrt_compositor.h:2004
struct xrt_swapchain base
Base.
Definition: xrt_compositor.h:2006
Command pool helpers.
Common Vulkan code header.
Header defining an XRT graphics provider.