Monado OpenXR Runtime
comp_vk_client.h
Go to the documentation of this file.
1 // Copyright 2019, 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 "xrt/xrt_gfx_vk.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 
21 /*
22  *
23  * Structs
24  *
25  */
26 
28 
29 /*!
30  * Wraps the real compositor swapchain providing a Vulkan based interface.
31  *
32  * Almost a one to one mapping to a OpenXR swapchain.
33  *
34  * @ingroup comp_client
35  */
37 {
38  struct xrt_swapchain_vk base;
39  struct xrt_swapchain_fd *xscfd;
40  struct client_vk_compositor *c;
41 };
42 
43 /*!
44  * Wraps the real compositor providing a Vulkan based interface.
45  *
46  * @ingroup comp_client
47  */
49 {
50  struct xrt_compositor_vk base;
51 
52  struct xrt_compositor_fd *xcfd;
53 
54  struct vk_bundle vk;
55 };
56 
57 
58 /*
59  *
60  * Functions and helpers.
61  *
62  */
63 
64 /*!
65  * Convinence function to convert a xrt_swapchain to a client_vk_swapchain.
66  *
67  * @ingroup comp_client
68  */
69 static inline struct client_vk_swapchain *
71 {
72  return (struct client_vk_swapchain *)xsc;
73 }
74 
75 /*!
76  * Convinence function to convert a xrt_compositor to a client_vk_compositor.
77  *
78  * @ingroup comp_client
79  */
80 static inline struct client_vk_compositor *
82 {
83  return (struct client_vk_compositor *)xc;
84 }
85 
86 /*!
87  * Create a new client_vk_compositor.
88  *
89  * @ingroup comp_client
90  */
91 struct client_vk_compositor *
93  VkInstance instance,
94  PFN_vkGetInstanceProcAddr getProc,
95  VkPhysicalDevice physicalDevice,
96  VkDevice device,
97  uint32_t queueFamilyIndex,
98  uint32_t queueIndex);
99 
100 
101 #ifdef __cplusplus
102 }
103 #endif
struct client_vk_compositor * client_vk_compositor_create(struct xrt_compositor_fd *xcfd, VkInstance instance, PFN_vkGetInstanceProcAddr getProc, VkPhysicalDevice physicalDevice, VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex)
Create a new client_vk_compositor.
Definition: comp_vk_client.c:245
Main compositor.
Definition: xrt_compositor.h:474
Base class for a Vulkan client compositor.
Definition: xrt_compositor.h:421
A swapchain that exposes fd to be imported into a client API.
Definition: xrt_compositor.h:462
Base class for a Vulkan client swapchain.
Definition: xrt_compositor.h:408
Wraps the real compositor swapchain providing a Vulkan based interface.
Definition: comp_vk_client.h:36
Common swapchain base.
Definition: xrt_compositor.h:75
Common compositor base.
Definition: xrt_compositor.h:116
Wraps the real compositor providing a Vulkan based interface.
Definition: comp_vk_client.h:48
Header defining a XRT graphics provider.
Common Vulkan code header.
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code...
Definition: vk_helpers.h:34