Monado OpenXR Runtime
vk_helpers.h
Go to the documentation of this file.
1 // Copyright 2019-2020, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Common Vulkan code header.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
8  * @ingroup aux_vk
9  */
10 
11 #pragma once
12 
13 #include "xrt/xrt_compositor.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 
21 /*
22  *
23  * Structs
24  *
25  */
26 
27 /*!
28  * A bundle of Vulkan functions and objects, used by both @ref comp and @ref
29  * comp_client. Note that they both have different instances of the object and
30  * as such VkInstance and so on.
31  *
32  * @ingroup aux_vk
33  */
34 struct vk_bundle
35 {
36  bool print;
37 
38  VkInstance instance;
39  VkPhysicalDevice physical_device;
40  VkDevice device;
42  uint32_t queue_index;
43 
44  VkDebugReportCallbackEXT debug_report_cb;
45 
46  VkPhysicalDeviceMemoryProperties device_memory_props;
47 
48  VkCommandPool cmd_pool;
49 
50  // clang-format off
51  // Loader functions
52  PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
53  PFN_vkCreateInstance vkCreateInstance;
54 
55  // Instance functions.
56  PFN_vkDestroyInstance vkDestroyInstance;
57  PFN_vkCreateDevice vkCreateDevice;
58  PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT;
59  PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
60  PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
61  PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
62 
63 #ifdef VK_USE_PLATFORM_XCB_KHR
64  PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR;
65 #endif
66 
67 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
68  PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR;
69 #endif
70 
71 #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
72  PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR;
73  PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR;
74 
75  // This doesn't strictly require VK_USE_PLATFORM_XLIB_XRANDR_EXT,
76  // but it's only used in the NVIDIA X direct mode path that does require it.
77  PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR;
78  PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR;
79  PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR;
80  PFN_vkAcquireXlibDisplayEXT vkAcquireXlibDisplayEXT;
81  PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT;
82  PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT;
83 #endif
84 
85 
86  // Physical device functions.
87  PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
88  PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties;
89  PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
90 
91  PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
92  PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
93  PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
94  PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR;
95 
96 
97  // Device functions.
98  PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
99  PFN_vkDestroyDevice vkDestroyDevice;
100  PFN_vkDeviceWaitIdle vkDeviceWaitIdle;
101 
102  PFN_vkAllocateMemory vkAllocateMemory;
103  PFN_vkFreeMemory vkFreeMemory;
104  PFN_vkMapMemory vkMapMemory;
105  PFN_vkUnmapMemory vkUnmapMemory;
106  PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR;
107 
108  PFN_vkCreateBuffer vkCreateBuffer;
109  PFN_vkDestroyBuffer vkDestroyBuffer;
110  PFN_vkBindBufferMemory vkBindBufferMemory;
111  PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
112 
113  PFN_vkCreateImage vkCreateImage;
114  PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
115  PFN_vkBindImageMemory vkBindImageMemory;
116  PFN_vkDestroyImage vkDestroyImage;
117  PFN_vkCreateImageView vkCreateImageView;
118  PFN_vkDestroyImageView vkDestroyImageView;
119 
120  PFN_vkCreateSampler vkCreateSampler;
121  PFN_vkDestroySampler vkDestroySampler;
122 
123  PFN_vkCreateShaderModule vkCreateShaderModule;
124  PFN_vkDestroyShaderModule vkDestroyShaderModule;
125 
126  PFN_vkCreateCommandPool vkCreateCommandPool;
127  PFN_vkDestroyCommandPool vkDestroyCommandPool;
128  PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers;
129  PFN_vkBeginCommandBuffer vkBeginCommandBuffer;
130  PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier;
131  PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass;
132  PFN_vkCmdSetScissor vkCmdSetScissor;
133  PFN_vkCmdSetViewport vkCmdSetViewport;
134  PFN_vkCmdClearColorImage vkCmdClearColorImage;
135  PFN_vkCmdEndRenderPass vkCmdEndRenderPass;
136  PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets;
137  PFN_vkCmdBindPipeline vkCmdBindPipeline;
138  PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers;
139  PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer;
140  PFN_vkCmdDraw vkCmdDraw;
141  PFN_vkCmdDrawIndexed vkCmdDrawIndexed;
142  PFN_vkEndCommandBuffer vkEndCommandBuffer;
143  PFN_vkFreeCommandBuffers vkFreeCommandBuffers;
144 
145  PFN_vkCreateRenderPass vkCreateRenderPass;
146  PFN_vkDestroyRenderPass vkDestroyRenderPass;
147  PFN_vkCreateFramebuffer vkCreateFramebuffer;
148  PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
149  PFN_vkCreatePipelineCache vkCreatePipelineCache;
150  PFN_vkDestroyPipelineCache vkDestroyPipelineCache;
151  PFN_vkCreateDescriptorPool vkCreateDescriptorPool;
152  PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool;
153  PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets;
154  PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines;
155  PFN_vkDestroyPipeline vkDestroyPipeline;
156  PFN_vkCreatePipelineLayout vkCreatePipelineLayout;
157  PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout;
158  PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout;
159  PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets;
160  PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout;
161 
162  PFN_vkGetDeviceQueue vkGetDeviceQueue;
163  PFN_vkQueueSubmit vkQueueSubmit;
164  PFN_vkQueueWaitIdle vkQueueWaitIdle;
165 
166  PFN_vkCreateSemaphore vkCreateSemaphore;
167  PFN_vkDestroySemaphore vkDestroySemaphore;
168 
169  PFN_vkCreateFence vkCreateFence;
170  PFN_vkWaitForFences vkWaitForFences;
171  PFN_vkDestroyFence vkDestroyFence;
172  PFN_vkResetFences vkResetFences;
173 
174  PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR;
175  PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
176  PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
177  PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
178  PFN_vkQueuePresentKHR vkQueuePresentKHR;
179  // clang-format on
180 };
181 
182 
183 /*
184  *
185  * String helper functions.
186  *
187  */
188 
189 const char *
190 vk_result_string(VkResult code);
191 
192 const char *
193 vk_color_format_string(VkFormat code);
194 
195 const char *
196 vk_present_mode_string(VkPresentModeKHR code);
197 
198 const char *
199 vk_power_state_string(VkDisplayPowerStateEXT code);
200 
201 const char *
202 vk_color_space_string(VkColorSpaceKHR code);
203 
204 
205 /*
206  *
207  * Function and helpers.
208  *
209  */
210 
211 #define VK_DEBUG(vk, ...) \
212  do { \
213  if (vk->print) { \
214  fprintf(stderr, "%s - ", __func__); \
215  fprintf(stderr, __VA_ARGS__); \
216  fprintf(stderr, "\n"); \
217  } \
218  } while (false)
219 
220 #define VK_ERROR(vk, ...) \
221  do { \
222  fprintf(stderr, "%s - ", __func__); \
223  fprintf(stderr, __VA_ARGS__); \
224  fprintf(stderr, "\n"); \
225  } while (false)
226 
227 /*!
228  * @ingroup aux_vk
229  */
230 void
232 
233 /*!
234  * @ingroup aux_vk
235  */
236 void
238 
239 /*!
240  * @ingroup aux_vk
241  */
242 VkResult
243 vk_get_loader_functions(struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g);
244 
245 /*!
246  * @ingroup aux_vk
247  */
248 VkResult
250 
251 /*!
252  * @ingroup aux_vk
253  */
254 VkResult
255 vk_init_cmd_pool(struct vk_bundle *vk);
256 
257 /*!
258  * @ingroup aux_vk
259  */
260 VkResult
261 vk_create_device(struct vk_bundle *vk, int forced_index);
262 
263 /*!
264  * Initialize a bundle with objects given to us by client code,
265  * used by @ref client_vk_compositor in @ref comp_client.
266  *
267  * @ingroup aux_vk
268  */
269 VkResult
270 vk_init_from_given(struct vk_bundle *vk,
271  PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
272  VkInstance instance,
273  VkPhysicalDevice physical_device,
274  VkDevice device,
275  uint32_t queue_family_index,
276  uint32_t queue_index);
277 
278 /*!
279  * @ingroup aux_vk
280  */
281 bool
282 vk_get_memory_type(struct vk_bundle *vk,
283  uint32_t type_bits,
284  VkMemoryPropertyFlags memory_props,
285  uint32_t *out_type_id);
286 
287 /*!
288  * Allocate memory for an image and bind it to that image.
289  *
290  * Handles the following steps:
291  *
292  * - calling vkGetImageMemoryRequirements
293  * - comparing against the max_size
294  * - getting the memory type (as dictated by the VkMemoryRequirements and
295  * VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)
296  * - calling vkAllocateMemory
297  * - calling vkBindImageMemory
298  * - calling vkDestroyMemory in case of an error.
299  *
300  * If this fails, it cleans up the VkDeviceMemory.
301  *
302  * @param vk Vulkan bundle
303  * @param image The VkImage to allocate for and bind.
304  * @param max_size The maximum value you'll allow for
305  * VkMemoryRequirements::size. Pass SIZE_MAX if you will accept any size
306  * that works.
307  * @param pNext_for_allocate (Optional) a pointer to use in the pNext chain of
308  * VkMemoryAllocateInfo.
309  * @param out_mem Output parameter: will be set to the allocated memory if
310  * everything succeeds. Not modified if there is an error.
311  * @param out_size (Optional) pointer to receive the value of
312  * VkMemoryRequirements::size.
313  *
314  * If this fails, you may want to destroy your VkImage as well, since this
315  * routine is usually used in combination with vkCreateImage.
316  *
317  * @ingroup aux_vk
318  */
319 VkResult
321  VkImage image,
322  size_t max_size,
323  const void *pNext_for_allocate,
324  VkDeviceMemory *out_mem,
325  VkDeviceSize *out_size);
326 
327 /*!
328  * @ingroup aux_vk
329  */
330 VkResult
332  enum xrt_swapchain_usage_bits swapchain_usage,
333  int64_t format,
334  uint32_t width,
335  uint32_t height,
336  uint32_t array_size,
337  uint32_t mip_count,
338  struct xrt_image_fd *image_fd,
339  VkImage *out_image,
340  VkDeviceMemory *out_mem);
341 
342 /*!
343  * @ingroup aux_vk
344  */
345 VkResult
347  uint32_t width,
348  uint32_t height,
349  VkFormat format,
350  VkDeviceMemory *out_mem,
351  VkImage *out_image);
352 
353 /*!
354  * @ingroup aux_vk
355  */
356 VkResult
357 vk_create_sampler(struct vk_bundle *vk, VkSampler *out_sampler);
358 
359 /*!
360  * @ingroup aux_vk
361  */
362 VkResult
363 vk_create_view(struct vk_bundle *vk,
364  VkImage image,
365  VkFormat format,
366  VkImageSubresourceRange subresource_range,
367  VkImageView *out_view);
368 
369 /*!
370  * @ingroup aux_vk
371  */
372 VkResult
373 vk_init_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer);
374 
375 /*!
376  * @ingroup aux_vk
377  */
378 VkResult
379 vk_set_image_layout(struct vk_bundle *vk,
380  VkCommandBuffer cmd_buffer,
381  VkImage image,
382  VkAccessFlags src_access_mask,
383  VkAccessFlags dst_access_mask,
384  VkImageLayout old_layout,
385  VkImageLayout new_layout,
386  VkImageSubresourceRange subresource_range);
387 
388 /*!
389  * @ingroup aux_vk
390  */
391 VkResult
392 vk_submit_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer cmd_buffer);
393 
394 
395 #ifdef __cplusplus
396 }
397 #endif
PFN_vkAllocateMemory vkAllocateMemory
Definition: vk_helpers.h:102
VkResult vk_create_image_simple(struct vk_bundle *vk, uint32_t width, uint32_t height, VkFormat format, VkDeviceMemory *out_mem, VkImage *out_image)
Definition: vk_helpers.c:209
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR
Definition: vk_helpers.h:64
PFN_vkDestroyShaderModule vkDestroyShaderModule
Definition: vk_helpers.h:124
PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass
Definition: vk_helpers.h:131
PFN_vkDestroyFramebuffer vkDestroyFramebuffer
Definition: vk_helpers.h:148
PFN_vkQueueSubmit vkQueueSubmit
Definition: vk_helpers.h:163
PFN_vkCmdEndRenderPass vkCmdEndRenderPass
Definition: vk_helpers.h:135
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements
Definition: vk_helpers.h:114
Include all of the Vulkan headers in one place.
PFN_vkCmdDrawIndexed vkCmdDrawIndexed
Definition: vk_helpers.h:141
PFN_vkDestroyPipeline vkDestroyPipeline
Definition: vk_helpers.h:155
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR
Definition: vk_helpers.h:77
const char * vk_color_format_string(VkFormat code)
Definition: vk_helpers.c:64
const char * vk_result_string(VkResult code)
Definition: vk_helpers.c:31
PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT
Definition: vk_helpers.h:81
PFN_vkCreateRenderPass vkCreateRenderPass
Definition: vk_helpers.h:145
PFN_vkDestroyInstance vkDestroyInstance
Definition: vk_helpers.h:56
VkResult vk_init_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer)
Definition: vk_helpers.c:418
PFN_vkCreateDevice vkCreateDevice
Definition: vk_helpers.h:57
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties
Definition: vk_helpers.h:89
bool vk_get_memory_type(struct vk_bundle *vk, uint32_t type_bits, VkMemoryPropertyFlags memory_props, uint32_t *out_type_id)
Definition: vk_helpers.c:126
VkResult vk_get_instance_functions(struct vk_bundle *vk)
Definition: vk_helpers.c:667
PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR
Definition: vk_helpers.h:79
uint64_t VkImage
Definition: xrt_compositor.h:452
VkDevice device
Definition: vk_helpers.h:40
uint32_t queue_family_index
Definition: vk_helpers.h:41
PFN_vkCreateImageView vkCreateImageView
Definition: vk_helpers.h:117
PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool
Definition: vk_helpers.h:152
PFN_vkDestroyImage vkDestroyImage
Definition: vk_helpers.h:116
PFN_vkMapMemory vkMapMemory
Definition: vk_helpers.h:104
PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers
Definition: vk_helpers.h:128
PFN_vkEndCommandBuffer vkEndCommandBuffer
Definition: vk_helpers.h:142
PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR
Definition: vk_helpers.h:176
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR
Definition: vk_helpers.h:78
const char * vk_power_state_string(VkDisplayPowerStateEXT code)
Definition: vk_helpers.c:99
PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer
Definition: vk_helpers.h:139
PFN_vkUnmapMemory vkUnmapMemory
Definition: vk_helpers.h:105
VkResult vk_create_view(struct vk_bundle *vk, VkImage image, VkFormat format, VkImageSubresourceRange subresource_range, VkImageView *out_view)
Definition: vk_helpers.c:375
PFN_vkCreateSampler vkCreateSampler
Definition: vk_helpers.h:120
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR
Definition: vk_helpers.h:91
PFN_vkGetDeviceQueue vkGetDeviceQueue
Definition: vk_helpers.h:162
PFN_vkBindImageMemory vkBindImageMemory
Definition: vk_helpers.h:115
PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets
Definition: vk_helpers.h:136
PFN_vkDestroyBuffer vkDestroyBuffer
Definition: vk_helpers.h:109
PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier
Definition: vk_helpers.h:130
VkResult vk_init_cmd_pool(struct vk_bundle *vk)
Definition: vk_helpers.c:547
xrt_swapchain_usage_bits
Usage of the swapchain images.
Definition: xrt_compositor.h:48
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR
Definition: vk_helpers.h:93
PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR
Definition: vk_helpers.h:94
PFN_vkFreeCommandBuffers vkFreeCommandBuffers
Definition: vk_helpers.h:143
PFN_vkDestroyPipelineCache vkDestroyPipelineCache
Definition: vk_helpers.h:150
PFN_vkCmdDraw vkCmdDraw
Definition: vk_helpers.h:140
PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines
Definition: vk_helpers.h:154
PFN_vkCreateFence vkCreateFence
Definition: vk_helpers.h:169
PFN_vkDestroySampler vkDestroySampler
Definition: vk_helpers.h:121
PFN_vkQueueWaitIdle vkQueueWaitIdle
Definition: vk_helpers.h:164
PFN_vkCreateDescriptorPool vkCreateDescriptorPool
Definition: vk_helpers.h:151
PFN_vkDestroyCommandPool vkDestroyCommandPool
Definition: vk_helpers.h:127
PFN_vkQueuePresentKHR vkQueuePresentKHR
Definition: vk_helpers.h:178
PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements
Definition: vk_helpers.h:111
PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR
Definition: vk_helpers.h:73
PFN_vkCreateShaderModule vkCreateShaderModule
Definition: vk_helpers.h:123
PFN_vkCreateImage vkCreateImage
Definition: vk_helpers.h:113
VkPhysicalDevice physical_device
Definition: vk_helpers.h:39
PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout
Definition: vk_helpers.h:160
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr
Definition: vk_helpers.h:52
VkInstance instance
Definition: vk_helpers.h:38
PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets
Definition: vk_helpers.h:159
VkResult vk_create_image_from_fd(struct vk_bundle *vk, enum xrt_swapchain_usage_bits swapchain_usage, int64_t format, uint32_t width, uint32_t height, uint32_t array_size, uint32_t mip_count, struct xrt_image_fd *image_fd, VkImage *out_image, VkDeviceMemory *out_mem)
Definition: vk_helpers.c:262
PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR
Definition: vk_helpers.h:174
PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR
Definition: vk_helpers.h:72
Header defining a XRT graphics provider.
VkCommandPool cmd_pool
Definition: vk_helpers.h:48
PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout
Definition: vk_helpers.h:157
void vk_destroy_validation_callback(struct vk_bundle *vk)
Definition: vk_helpers.c:630
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR
Definition: vk_helpers.h:92
uint64_t VkDeviceMemory
Definition: xrt_compositor.h:453
PFN_vkCreateInstance vkCreateInstance
Definition: vk_helpers.h:53
VkDebugReportCallbackEXT debug_report_cb
Definition: vk_helpers.h:44
PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets
Definition: vk_helpers.h:153
PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr
Definition: vk_helpers.h:98
PFN_vkResetFences vkResetFences
Definition: vk_helpers.h:172
PFN_vkFreeMemory vkFreeMemory
Definition: vk_helpers.h:103
PFN_vkCmdSetScissor vkCmdSetScissor
Definition: vk_helpers.h:132
VkPhysicalDeviceMemoryProperties device_memory_props
Definition: vk_helpers.h:46
PFN_vkDestroyDevice vkDestroyDevice
Definition: vk_helpers.h:99
PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices
Definition: vk_helpers.h:60
PFN_vkCreateSemaphore vkCreateSemaphore
Definition: vk_helpers.h:166
const char * vk_color_space_string(VkColorSpaceKHR code)
Definition: vk_helpers.c:110
PFN_vkCreatePipelineLayout vkCreatePipelineLayout
Definition: vk_helpers.h:156
PFN_vkCreateCommandPool vkCreateCommandPool
Definition: vk_helpers.h:126
PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR
Definition: vk_helpers.h:106
const char * vk_present_mode_string(VkPresentModeKHR code)
Definition: vk_helpers.c:85
PFN_vkBeginCommandBuffer vkBeginCommandBuffer
Definition: vk_helpers.h:129
uint32_t queue_index
Definition: vk_helpers.h:42
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR
Definition: vk_helpers.h:61
PFN_vkDestroyImageView vkDestroyImageView
Definition: vk_helpers.h:118
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR
Definition: vk_helpers.h:68
VkResult vk_alloc_and_bind_image_memory(struct vk_bundle *vk, VkImage image, size_t max_size, const void *pNext_for_allocate, VkDeviceMemory *out_mem, VkDeviceSize *out_size)
Allocate memory for an image and bind it to that image.
Definition: vk_helpers.c:150
PFN_vkDestroyFence vkDestroyFence
Definition: vk_helpers.h:171
PFN_vkAcquireXlibDisplayEXT vkAcquireXlibDisplayEXT
Definition: vk_helpers.h:80
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR
Definition: vk_helpers.h:177
VkResult vk_get_loader_functions(struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g)
Definition: vk_helpers.c:654
PFN_vkCmdClearColorImage vkCmdClearColorImage
Definition: vk_helpers.h:134
PFN_vkDestroyRenderPass vkDestroyRenderPass
Definition: vk_helpers.h:146
PFN_vkCreateBuffer vkCreateBuffer
Definition: vk_helpers.h:108
PFN_vkCmdBindPipeline vkCmdBindPipeline
Definition: vk_helpers.h:137
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT
Definition: vk_helpers.h:59
VkResult vk_create_device(struct vk_bundle *vk, int forced_index)
Definition: vk_helpers.c:914
PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT
Definition: vk_helpers.h:58
PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties
Definition: vk_helpers.h:88
VkResult vk_init_from_given(struct vk_bundle *vk, PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr, VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family_index, uint32_t queue_index)
Initialize a bundle with objects given to us by client code, used by client_vk_compositor in Composit...
Definition: vk_helpers.c:981
PFN_vkCreateFramebuffer vkCreateFramebuffer
Definition: vk_helpers.h:147
bool print
Definition: vk_helpers.h:36
VkResult vk_set_image_layout(struct vk_bundle *vk, VkCommandBuffer cmd_buffer, VkImage image, VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_layout, VkImageLayout new_layout, VkImageSubresourceRange subresource_range)
Definition: vk_helpers.c:462
PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout
Definition: vk_helpers.h:158
PFN_vkDestroySemaphore vkDestroySemaphore
Definition: vk_helpers.h:167
PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties
Definition: vk_helpers.h:87
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code...
Definition: vk_helpers.h:34
PFN_vkWaitForFences vkWaitForFences
Definition: vk_helpers.h:170
PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers
Definition: vk_helpers.h:138
PFN_vkCmdSetViewport vkCmdSetViewport
Definition: vk_helpers.h:133
PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR
Definition: vk_helpers.h:175
PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT
Definition: vk_helpers.h:82
PFN_vkDeviceWaitIdle vkDeviceWaitIdle
Definition: vk_helpers.h:100
VkResult vk_create_sampler(struct vk_bundle *vk, VkSampler *out_sampler)
Definition: vk_helpers.c:346
void vk_init_validation_callback(struct vk_bundle *vk)
Definition: vk_helpers.c:607
A single image of a fd based swapchain.
Definition: xrt_compositor.h:503
PFN_vkCreatePipelineCache vkCreatePipelineCache
Definition: vk_helpers.h:149
VkResult vk_submit_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer cmd_buffer)
Definition: vk_helpers.c:491
PFN_vkBindBufferMemory vkBindBufferMemory
Definition: vk_helpers.h:110