54 VkPhysicalDevice physical_device;
55 int physical_device_index;
57 uint32_t queue_family_index;
60#if defined(VK_KHR_video_encode_queue)
61 uint32_t encode_queue_family_index;
62 uint32_t encode_queue_index;
70#if defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_WIN32_HANDLE)
71 bool color_image_import_opaque_win32;
72 bool color_image_export_opaque_win32;
73 bool depth_image_import_opaque_win32;
74 bool depth_image_export_opaque_win32;
76 bool color_image_import_d3d11;
77 bool color_image_export_d3d11;
78 bool depth_image_import_d3d11;
79 bool depth_image_export_d3d11;
81#elif defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_FD)
82 bool color_image_import_opaque_fd;
83 bool color_image_export_opaque_fd;
84 bool depth_image_import_opaque_fd;
85 bool depth_image_export_opaque_fd;
87#elif defined(XRT_GRAPHICS_BUFFER_HANDLE_IS_AHARDWAREBUFFER)
88 bool color_image_import_opaque_fd;
89 bool color_image_export_opaque_fd;
90 bool depth_image_import_opaque_fd;
91 bool depth_image_export_opaque_fd;
93 bool color_image_import_ahardwarebuffer;
94 bool color_image_export_ahardwarebuffer;
95 bool depth_image_import_ahardwarebuffer;
96 bool depth_image_export_ahardwarebuffer;
99#if defined(XRT_GRAPHICS_SYNC_HANDLE_IS_FD)
101 bool fence_opaque_fd;
103 bool binary_semaphore_sync_fd;
104 bool binary_semaphore_opaque_fd;
106 bool timeline_semaphore_sync_fd;
107 bool timeline_semaphore_opaque_fd;
108#elif defined(XRT_GRAPHICS_SYNC_HANDLE_IS_WIN32_HANDLE)
109 bool fence_win32_handle;
111 bool binary_semaphore_d3d12_fence;
112 bool binary_semaphore_win32_handle;
114 bool timeline_semaphore_d3d12_fence;
115 bool timeline_semaphore_win32_handle;
117#error "Need port for fence sync handles checkers"
122 bool has_EXT_display_surface_counter;
123 bool has_EXT_swapchain_colorspace;
124 bool has_EXT_debug_utils;
128 bool has_KHR_external_fence_fd;
129 bool has_KHR_external_semaphore_fd;
130 bool has_KHR_format_feature_flags2;
131 bool has_KHR_global_priority;
132 bool has_KHR_image_format_list;
133 bool has_KHR_maintenance1;
134 bool has_KHR_maintenance2;
135 bool has_KHR_maintenance3;
136 bool has_KHR_maintenance4;
137 bool has_KHR_synchronization2;
138 bool has_KHR_timeline_semaphore;
139 bool has_EXT_calibrated_timestamps;
140 bool has_EXT_display_control;
141 bool has_EXT_external_memory_dma_buf;
142 bool has_EXT_global_priority;
143 bool has_EXT_image_drm_format_modifier;
144 bool has_EXT_robustness2;
145 bool has_GOOGLE_display_timing;
176 VkDebugReportCallbackEXT debug_report_cb;
178 VkPhysicalDeviceMemoryProperties device_memory_props;
181 PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
182 PFN_vkCreateInstance vkCreateInstance;
183 PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
186 PFN_vkDestroyInstance vkDestroyInstance;
187 PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
188 PFN_vkCreateDevice vkCreateDevice;
189 PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
191 PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT;
192 PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
194 PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
195 PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
196 PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2;
197 PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2;
198 PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
199 PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties;
200 PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
201 PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
202 PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
203 PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR;
204 PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties;
205 PFN_vkGetPhysicalDeviceFormatProperties2KHR vkGetPhysicalDeviceFormatProperties2;
206 PFN_vkGetPhysicalDeviceImageFormatProperties2 vkGetPhysicalDeviceImageFormatProperties2;
207 PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR vkGetPhysicalDeviceExternalBufferPropertiesKHR;
208 PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR vkGetPhysicalDeviceExternalFencePropertiesKHR;
209 PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR vkGetPhysicalDeviceExternalSemaphorePropertiesKHR;
210 PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties;
211 PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties;
213#if defined(VK_EXT_calibrated_timestamps)
214 PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT vkGetPhysicalDeviceCalibrateableTimeDomainsEXT;
218#if defined(VK_USE_PLATFORM_DISPLAY_KHR)
219 PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR;
220 PFN_vkGetDisplayPlaneCapabilitiesKHR vkGetDisplayPlaneCapabilitiesKHR;
221 PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vkGetPhysicalDeviceDisplayPropertiesKHR;
222 PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vkGetPhysicalDeviceDisplayPlanePropertiesKHR;
223 PFN_vkGetDisplayModePropertiesKHR vkGetDisplayModePropertiesKHR;
224 PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT;
228#if defined(VK_USE_PLATFORM_XCB_KHR)
229 PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR;
233#if defined(VK_USE_PLATFORM_WAYLAND_KHR)
234 PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR;
238#if defined(VK_USE_PLATFORM_WAYLAND_KHR) && defined(VK_EXT_acquire_drm_display)
239 PFN_vkAcquireDrmDisplayEXT vkAcquireDrmDisplayEXT;
240 PFN_vkGetDrmDisplayEXT vkGetDrmDisplayEXT;
244#if defined(VK_USE_PLATFORM_XLIB_XRANDR_EXT)
245 PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT;
246 PFN_vkAcquireXlibDisplayEXT vkAcquireXlibDisplayEXT;
250#if defined(VK_USE_PLATFORM_ANDROID_KHR)
251 PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR;
255#if defined(VK_USE_PLATFORM_WIN32_KHR)
256 PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR;
260#if defined(VK_EXT_display_surface_counter)
261 PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT;
265#if defined(VK_EXT_debug_utils)
266 PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT;
267 PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT;
268 PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT;
274 PFN_vkDestroyDevice vkDestroyDevice;
275 PFN_vkDeviceWaitIdle vkDeviceWaitIdle;
276 PFN_vkAllocateMemory vkAllocateMemory;
277 PFN_vkFreeMemory vkFreeMemory;
278 PFN_vkMapMemory vkMapMemory;
279 PFN_vkUnmapMemory vkUnmapMemory;
281 PFN_vkCreateBuffer vkCreateBuffer;
282 PFN_vkDestroyBuffer vkDestroyBuffer;
283 PFN_vkBindBufferMemory vkBindBufferMemory;
285 PFN_vkCreateImage vkCreateImage;
286 PFN_vkDestroyImage vkDestroyImage;
287 PFN_vkBindImageMemory vkBindImageMemory;
289 PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
290 PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
291 PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
292 PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2;
293 PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout;
295 PFN_vkCreateImageView vkCreateImageView;
296 PFN_vkDestroyImageView vkDestroyImageView;
298 PFN_vkCreateSampler vkCreateSampler;
299 PFN_vkDestroySampler vkDestroySampler;
301 PFN_vkCreateShaderModule vkCreateShaderModule;
302 PFN_vkDestroyShaderModule vkDestroyShaderModule;
304 PFN_vkCreateQueryPool vkCreateQueryPool;
305 PFN_vkDestroyQueryPool vkDestroyQueryPool;
306 PFN_vkGetQueryPoolResults vkGetQueryPoolResults;
308 PFN_vkCreateCommandPool vkCreateCommandPool;
309 PFN_vkDestroyCommandPool vkDestroyCommandPool;
310 PFN_vkResetCommandPool vkResetCommandPool;
312 PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers;
313 PFN_vkBeginCommandBuffer vkBeginCommandBuffer;
314 PFN_vkCmdBeginQuery vkCmdBeginQuery;
315 PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults;
316 PFN_vkCmdEndQuery vkCmdEndQuery;
317 PFN_vkCmdResetQueryPool vkCmdResetQueryPool;
318 PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp;
319 PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier;
320 PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass;
321 PFN_vkCmdSetScissor vkCmdSetScissor;
322 PFN_vkCmdSetViewport vkCmdSetViewport;
323 PFN_vkCmdClearColorImage vkCmdClearColorImage;
324 PFN_vkCmdEndRenderPass vkCmdEndRenderPass;
325 PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets;
326 PFN_vkCmdBindPipeline vkCmdBindPipeline;
327 PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers;
328 PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer;
329 PFN_vkCmdDraw vkCmdDraw;
330 PFN_vkCmdDrawIndexed vkCmdDrawIndexed;
331 PFN_vkCmdDispatch vkCmdDispatch;
332 PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
333 PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage;
334 PFN_vkCmdCopyImage vkCmdCopyImage;
335 PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer;
336 PFN_vkCmdBlitImage vkCmdBlitImage;
337 PFN_vkCmdPushConstants vkCmdPushConstants;
338 PFN_vkEndCommandBuffer vkEndCommandBuffer;
339 PFN_vkFreeCommandBuffers vkFreeCommandBuffers;
341 PFN_vkCreateRenderPass vkCreateRenderPass;
342 PFN_vkDestroyRenderPass vkDestroyRenderPass;
344 PFN_vkCreateFramebuffer vkCreateFramebuffer;
345 PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
347 PFN_vkCreatePipelineCache vkCreatePipelineCache;
348 PFN_vkDestroyPipelineCache vkDestroyPipelineCache;
350 PFN_vkResetDescriptorPool vkResetDescriptorPool;
351 PFN_vkCreateDescriptorPool vkCreateDescriptorPool;
352 PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool;
354 PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets;
355 PFN_vkFreeDescriptorSets vkFreeDescriptorSets;
357 PFN_vkCreateComputePipelines vkCreateComputePipelines;
358 PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines;
359 PFN_vkDestroyPipeline vkDestroyPipeline;
361 PFN_vkCreatePipelineLayout vkCreatePipelineLayout;
362 PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout;
364 PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout;
365 PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets;
366 PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout;
368 PFN_vkGetDeviceQueue vkGetDeviceQueue;
369 PFN_vkQueueSubmit vkQueueSubmit;
370 PFN_vkQueueWaitIdle vkQueueWaitIdle;
372 PFN_vkCreateSemaphore vkCreateSemaphore;
373#if defined(VK_KHR_timeline_semaphore)
374 PFN_vkSignalSemaphoreKHR vkSignalSemaphore;
375 PFN_vkWaitSemaphoresKHR vkWaitSemaphores;
376 PFN_vkGetSemaphoreCounterValueKHR vkGetSemaphoreCounterValue;
379 PFN_vkDestroySemaphore vkDestroySemaphore;
381 PFN_vkCreateFence vkCreateFence;
382 PFN_vkWaitForFences vkWaitForFences;
383 PFN_vkGetFenceStatus vkGetFenceStatus;
384 PFN_vkDestroyFence vkDestroyFence;
385 PFN_vkResetFences vkResetFences;
387 PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR;
388 PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
389 PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
390 PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
391 PFN_vkQueuePresentKHR vkQueuePresentKHR;
393#if defined(VK_USE_PLATFORM_WIN32_KHR)
394 PFN_vkGetMemoryWin32HandleKHR vkGetMemoryWin32HandleKHR;
395 PFN_vkGetFenceWin32HandleKHR vkGetFenceWin32HandleKHR;
396 PFN_vkGetSemaphoreWin32HandleKHR vkGetSemaphoreWin32HandleKHR;
397 PFN_vkImportFenceWin32HandleKHR vkImportFenceWin32HandleKHR;
398 PFN_vkImportSemaphoreWin32HandleKHR vkImportSemaphoreWin32HandleKHR;
402#if !defined(VK_USE_PLATFORM_WIN32_KHR)
403 PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR;
404 PFN_vkGetFenceFdKHR vkGetFenceFdKHR;
405 PFN_vkGetSemaphoreFdKHR vkGetSemaphoreFdKHR;
406 PFN_vkImportFenceFdKHR vkImportFenceFdKHR;
407 PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR;
411#if defined(VK_USE_PLATFORM_ANDROID_KHR)
412 PFN_vkGetMemoryAndroidHardwareBufferANDROID vkGetMemoryAndroidHardwareBufferANDROID;
413 PFN_vkGetAndroidHardwareBufferPropertiesANDROID vkGetAndroidHardwareBufferPropertiesANDROID;
417#if defined(VK_EXT_calibrated_timestamps)
418 PFN_vkGetCalibratedTimestampsEXT vkGetCalibratedTimestampsEXT;
422 PFN_vkGetPastPresentationTimingGOOGLE vkGetPastPresentationTimingGOOGLE;
424#if defined(VK_EXT_display_control)
425 PFN_vkGetSwapchainCounterEXT vkGetSwapchainCounterEXT;
426 PFN_vkRegisterDeviceEventEXT vkRegisterDeviceEventEXT;
427 PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT;
431#if defined(VK_EXT_image_drm_format_modifier)
432 PFN_vkGetImageDrmFormatModifierPropertiesEXT vkGetImageDrmFormatModifierPropertiesEXT;
436#if defined(VK_EXT_debug_utils)
437 PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT;
438 PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT;
439 PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT;
440 PFN_vkQueueBeginDebugUtilsLabelEXT vkQueueBeginDebugUtilsLabelEXT;
441 PFN_vkQueueEndDebugUtilsLabelEXT vkQueueEndDebugUtilsLabelEXT;
442 PFN_vkQueueInsertDebugUtilsLabelEXT vkQueueInsertDebugUtilsLabelEXT;
443 PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT;
444 PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT;
453 VkDeviceMemory memory;
480#define VK_CHK_AND_RET(RET, FUNC_STR) \
482 VkResult _ret = RET; \
483 if (_ret != VK_SUCCESS) { \
484 vk_print_result(vk, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
505#define VK_CHK_WITH_RET(RET, FUNC_STR, TO_RET) \
507 VkResult _ret = RET; \
508 if (_ret != VK_SUCCESS) { \
509 vk_print_result(vk, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
531#define VK_CHK_WITH_GOTO(RET, FUNC_STR, GOTO) \
533 VkResult _ret = RET; \
534 if (_ret != VK_SUCCESS) { \
535 vk_print_result(vk, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
547XRT_CHECK_RESULT
const char *
548vk_result_string(VkResult code);
550XRT_CHECK_RESULT
const char *
551vk_object_type_string(VkObjectType type);
553XRT_CHECK_RESULT
const char *
554vk_physical_device_type_string(VkPhysicalDeviceType device_type);
556XRT_CHECK_RESULT
const char *
557vk_format_string(VkFormat code);
559XRT_CHECK_RESULT
const char *
560vk_sharing_mode_string(VkSharingMode code);
562XRT_CHECK_RESULT
const char *
563vk_present_mode_string(VkPresentModeKHR code);
565XRT_CHECK_RESULT
const char *
566vk_color_space_string(VkColorSpaceKHR code);
568XRT_CHECK_RESULT
const char *
569vk_power_state_string(VkDisplayPowerStateEXT code);
582XRT_CHECK_RESULT
const char *
589XRT_CHECK_RESULT
const char *
596XRT_CHECK_RESULT
const char *
603XRT_CHECK_RESULT
const char *
611XRT_CHECK_RESULT
const char *
612vk_display_plane_alpha_flag_string(VkDisplayPlaneAlphaFlagBitsKHR bits,
bool null_on_unknown);
619XRT_CHECK_RESULT
const char *
629#define VK_TRACE(d, ...) U_LOG_IFL_T(d->log_level, __VA_ARGS__)
630#define VK_DEBUG(d, ...) U_LOG_IFL_D(d->log_level, __VA_ARGS__)
631#define VK_INFO(d, ...) U_LOG_IFL_I(d->log_level, __VA_ARGS__)
632#define VK_WARN(d, ...) U_LOG_IFL_W(d->log_level, __VA_ARGS__)
633#define VK_ERROR(d, ...) U_LOG_IFL_E(d->log_level, __VA_ARGS__)
642#if defined(VK_EXT_debug_utils) || defined(XRT_DOXYGEN)
658#define VK_NAME_OBJ(VK, TYPE, SUFFIX, OBJ, NAME) \
660 if ((VK)->has_EXT_debug_utils) { \
662 vk_name_object(VK, VK_OBJECT_TYPE_##SUFFIX, (uint64_t)_thing, NAME); \
669#define VK_NAME_OBJ(VK, TYPE, SUFFIX, OBJ, NAME) VK_NAME_OBJ_DISABLED(VK, TYPE, OBJ)
688#define VK_NAME_OBJ_DISABLED(VK, TYPE, OBJ) \
690 XRT_MAYBE_UNUSED TYPE _thing = OBJ; \
695#define VK_NAME_INSTANCE(VK, OBJ, NAME) VK_NAME_OBJ_DISABLED(VK, VkInstance, OBJ)
696#define VK_NAME_PHYSICAL_DEVICE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkPhysicalDevice, PHYSICAL_DEVICE, OBJ, NAME)
697#define VK_NAME_DEVICE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkDevice, DEVICE, OBJ, NAME)
698#define VK_NAME_QUEUE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkQueue, QUEUE, OBJ, NAME)
699#define VK_NAME_SEMAPHORE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkSemaphore, SEMAPHORE, OBJ, NAME)
700#define VK_NAME_COMMAND_BUFFER(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkCommandBuffer, COMMAND_BUFFER, OBJ, NAME)
701#define VK_NAME_FENCE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkFence, FENCE, OBJ, NAME)
702#define VK_NAME_DEVICE_MEMORY(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkDeviceMemory, DEVICE_MEMORY, OBJ, NAME)
703#define VK_NAME_BUFFER(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkBuffer, BUFFER, OBJ, NAME)
704#define VK_NAME_IMAGE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkImage, IMAGE, OBJ, NAME)
705#define VK_NAME_EVENT(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkEvent, EVENT, OBJ, NAME)
706#define VK_NAME_QUERY_POOL(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkQueryPool, QUERY_POOL, OBJ, NAME)
707#define VK_NAME_BUFFER_VIEW(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkBufferView, BUFFER_VIEW, OBJ, NAME)
708#define VK_NAME_IMAGE_VIEW(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkImageView, IMAGE_VIEW, OBJ, NAME)
709#define VK_NAME_SHADER_MODULE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkShaderModule, SHADER_MODULE, OBJ, NAME)
710#define VK_NAME_PIPELINE_CACHE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkPipelineCache, PIPELINE_CACHE, OBJ, NAME)
711#define VK_NAME_PIPELINE_LAYOUT(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkPipelineLayout, PIPELINE_LAYOUT, OBJ, NAME)
712#define VK_NAME_RENDER_PASS(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkRenderPass, RENDER_PASS, OBJ, NAME)
713#define VK_NAME_PIPELINE(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkPipeline, PIPELINE, OBJ, NAME)
714#define VK_NAME_DESCRIPTOR_SET_LAYOUT(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkDescriptorSetLayout, DESCRIPTOR_SET_LAYOUT, OBJ, NAME)
715#define VK_NAME_SAMPLER(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkSampler, SAMPLER, OBJ, NAME)
716#define VK_NAME_DESCRIPTOR_POOL(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkDescriptorPool, DESCRIPTOR_POOL, OBJ, NAME)
717#define VK_NAME_DESCRIPTOR_SET(VK, OBJ, NAME) VK_NAME_OBJ_DISABLED(VK, VkDescriptorSet, OBJ)
718#define VK_NAME_FRAMEBUFFER(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkFramebuffer, FRAMEBUFFER, OBJ, NAME)
719#define VK_NAME_COMMAND_POOL(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkCommandPool, COMMAND_POOL, OBJ, NAME)
721#define VK_NAME_SURFACE(VK, OBJ, NAME) VK_NAME_OBJ_DISABLED(VK, VkSurfaceKHR, OBJ)
722#define VK_NAME_SWAPCHAIN(VK, OBJ, NAME) VK_NAME_OBJ(VK, VkSwapchainKHR, SWAPCHAIN_KHR, OBJ, NAME)
740 struct vk_bundle *vk,
const char *file,
int line,
const char *calling_func, VkResult ret,
const char *called_func);
751 const VkPhysicalDeviceProperties *pdp,
789vk_print_display_surface_create_info(
struct vk_bundle *vk,
790 VkDisplaySurfaceCreateInfoKHR *i,
809 const char *layer_name,
810 uint32_t *out_prop_count,
811 VkExtensionProperties **out_props);
821 uint32_t *out_physical_device_count,
822 VkPhysicalDevice **out_physical_devices);
832 VkPhysicalDevice physical_device,
833 const char *layer_name,
834 uint32_t *out_prop_count,
835 VkExtensionProperties **out_props);
837#if defined(VK_KHR_surface) || defined(XRT_DOXYGEN)
846 VkSurfaceKHR surface,
847 uint32_t *out_format_count,
848 VkSurfaceFormatKHR **out_formats);
857 VkSurfaceKHR surface,
858 uint32_t *out_present_mode_count,
859 VkPresentModeKHR **out_present_modes);
862#if defined(VK_KHR_swapchain) || defined(XRT_DOXYGEN)
870 VkSwapchainKHR swapchain,
871 uint32_t *out_image_count,
872 VkImage **out_images);
875#if defined(VK_USE_PLATFORM_DISPLAY_KHR) || defined(XRT_DOXYGEN)
883 VkPhysicalDevice physical_device,
884 uint32_t *out_prop_count,
885 VkDisplayPropertiesKHR **out_props);
894 VkPhysicalDevice physical_device,
895 uint32_t *out_prop_count,
896 VkDisplayPlanePropertiesKHR **out_props);
906 VkPhysicalDevice physical_device,
907 VkDisplayKHR display,
908 uint32_t *out_prop_count,
909 VkDisplayModePropertiesKHR **out_props);
992 bool shader_image_gather_extended;
993 bool shader_storage_image_write_without_format;
994 bool null_descriptor;
995 bool timeline_semaphore;
996 bool synchronization_2;
1004XRT_CHECK_RESULT VkResult
1008 VkQueueGlobalPriorityEXT global_priority,
1037XRT_CHECK_RESULT VkResult
1039 PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
1040 VkInstance instance,
1041 VkPhysicalDevice physical_device,
1043 uint32_t queue_family_index,
1044 uint32_t queue_index,
1045 bool external_fence_fd_enabled,
1046 bool external_semaphore_fd_enabled,
1047 bool timeline_semaphore_enabled,
1048 bool debug_utils_enabled,
1062vk_get_memory_type(
struct vk_bundle *vk, uint32_t type_bits, VkMemoryPropertyFlags memory_props, uint32_t *out_type_id);
1100XRT_CHECK_RESULT VkResult
1104 const void *pNext_for_allocate,
1105 const char *caller_name,
1106 VkDeviceMemory *out_mem,
1107 VkDeviceSize *out_size);
1130XRT_CHECK_RESULT VkResult
1135 VkDeviceMemory *out_mem);
1150XRT_CHECK_RESULT VkResult
1152 VkDeviceMemory device_memory,
1163 VkImageUsageFlags usage,
1164 VkDeviceMemory *out_mem,
1165 VkImage *out_image);
1175 struct vk_bundle *vk, VkExtent2D extent, VkImageUsageFlags usage, VkDeviceMemory *out_mem, VkImage *out_image);
1185 VkImageTiling image_tiling,
1186 VkImageUsageFlags image_usage_flags,
1187 VkMemoryPropertyFlags memory_property_flags,
1188 VkDeviceMemory *out_mem,
1189 VkImage *out_image);
1195vk_create_sampler(
struct vk_bundle *vk, VkSamplerAddressMode clamp_mode, VkSampler *out_sampler);
1210 VkImageViewType type,
1212 VkImageSubresourceRange subresource_range,
1213 VkImageView *out_view);
1219vk_create_view_swizzle(
struct vk_bundle *vk,
1221 VkImageViewType type,
1223 VkImageSubresourceRange subresource_range,
1224 VkComponentMapping components,
1225 VkImageView *out_view);
1236 VkImageViewType type,
1238 VkImageUsageFlags image_usage,
1239 VkImageSubresourceRange subresource_range,
1240 VkImageView *out_view);
1250vk_init_descriptor_pool(
struct vk_bundle *vk,
1251 const VkDescriptorPoolSize *pool_sizes,
1252 uint32_t pool_size_count,
1254 VkDescriptorPool *out_descriptor_pool);
1257vk_allocate_descriptor_sets(
struct vk_bundle *vk,
1258 VkDescriptorPool descriptor_pool,
1260 const VkDescriptorSetLayout *set_layout,
1261 VkDescriptorSet *sets);
1273 VkBufferUsageFlags usage,
1274 VkMemoryPropertyFlags properties,
1275 VkBuffer *out_buffer,
1276 VkDeviceMemory *out_mem);
1282vk_update_buffer(
struct vk_bundle *vk,
float *buffer,
size_t buffer_size, VkDeviceMemory memory);
1300 VkCommandBuffer cmd_buffer,
1302 VkAccessFlags src_access_mask,
1303 VkAccessFlags dst_access_mask,
1304 VkImageLayout old_image_layout,
1305 VkImageLayout new_image_layout,
1306 VkPipelineStageFlags src_stage_mask,
1307 VkPipelineStageFlags dst_stage_mask,
1308 VkImageSubresourceRange subresource_range);
1319 VkCommandBuffer cmd_buffer,
1321 VkAccessFlags src_access_mask,
1322 VkAccessFlags dst_access_mask,
1323 VkImageLayout old_layout,
1324 VkImageLayout new_layout,
1325 VkImageSubresourceRange subresource_range);
1327#if defined(VK_EXT_debug_utils) || defined(XRT_DOXYGEN)
1371 VkDescriptorPool *out_descriptor_pool);
1380 VkDescriptorPool descriptor_pool,
1381 VkDescriptorSetLayout descriptor_layout,
1382 VkDescriptorSet *out_descriptor_set);
1391 VkDescriptorSetLayout descriptor_set_layout,
1392 VkPipelineLayout *out_pipeline_layout);
1409 VkPipelineCache pipeline_cache,
1410 VkShaderModule shader,
1411 VkPipelineLayout pipeline_layout,
1412 const VkSpecializationInfo *specialization_info,
1413 VkPipeline *out_compute_pipeline);
1427VkExternalMemoryHandleTypeFlags
1453#define VK_CSCI_FORMATS(THING_COLOR, THING_DS, THING_D, THING_S) \
1455 THING_COLOR(R16G16B16A16_UNORM) \
1456 THING_COLOR(R16G16B16A16_SFLOAT) \
1457 THING_COLOR(R16G16B16_UNORM) \
1458 THING_COLOR(R16G16B16_SFLOAT) \
1459 THING_COLOR(R8G8B8A8_SRGB) \
1460 THING_COLOR(B8G8R8A8_SRGB) \
1461 THING_COLOR(R8G8B8_SRGB) \
1462 THING_COLOR(R8G8B8A8_UNORM) \
1463 THING_COLOR(B8G8R8A8_UNORM) \
1464 THING_COLOR(R8G8B8_UNORM) \
1465 THING_COLOR(B8G8R8_UNORM) \
1466 THING_COLOR(R5G6B5_UNORM_PACK16) \
1467 THING_COLOR(R32_SFLOAT) \
1469 THING_D(D32_SFLOAT) \
1470 THING_D(D16_UNORM) \
1471 THING_D(X8_D24_UNORM_PACK32) \
1473 THING_DS(D24_UNORM_S8_UINT) \
1474 THING_DS(D32_SFLOAT_S8_UINT) \
1541VkExternalMemoryHandleTypeFlags
1551 VkFormat image_format,
1553 VkExternalMemoryHandleTypeFlags handle_type,
1554 bool *out_importable,
1555 bool *out_exportable);
1570XRT_CHECK_RESULT
bool
1583XRT_CHECK_RESULT VkResult
1601XRT_CHECK_RESULT VkResult
1621XRT_CHECK_RESULT VkResult
1624#if defined(VK_KHR_timeline_semaphore) || defined(XRT_DOXYGEN)
1631XRT_CHECK_RESULT VkResult
1632vk_create_timeline_semaphore_and_native(
struct vk_bundle *vk,
1633 VkSemaphore *out_sem,
1649XRT_CHECK_RESULT VkResult
1652#if defined(VK_KHR_timeline_semaphore) || defined(XRT_DOXYGEN)
1659XRT_CHECK_RESULT VkResult
1670#if defined(VK_EXT_calibrated_timestamps) || defined(XRT_DOXYGEN)
1690XRT_CHECK_RESULT VkResult
u_logging_level
Logging level enum.
Definition: u_logging.h:40
VkResult vk_enumerate_display_mode_properties(struct vk_bundle *vk, VkPhysicalDevice physical_device, VkDisplayKHR display, uint32_t *out_prop_count, VkDisplayModePropertiesKHR **out_props)
Enumerate the mode properties of the given VkDisplayKHR, which belongs to the given VkPhysicalDevice.
VkResult vk_enumerate_physical_device_extension_properties(struct vk_bundle *vk, VkPhysicalDevice physical_device, const char *layer_name, uint32_t *out_prop_count, VkExtensionProperties **out_props)
Enumerate the extension properties of the given VkPhysicalDevice for the named layer_name,...
Definition: vk_enumerate.c:102
VkResult vk_create_image_advanced(struct vk_bundle *vk, VkExtent3D extent, VkFormat format, VkImageTiling image_tiling, VkImageUsageFlags image_usage_flags, VkMemoryPropertyFlags memory_property_flags, VkDeviceMemory *out_mem, VkImage *out_image)
Helper to create a VkImage, with more options for tiling and memory storage.
Definition: vk_helpers.c:984
VkResult vk_enumerate_physical_display_plane_properties(struct vk_bundle *vk, VkPhysicalDevice physical_device, uint32_t *out_prop_count, VkDisplayPlanePropertiesKHR **out_props)
Enumerate the display plane properties of the given VkPhysicalDevice.
XRT_CHECK_RESULT VkResult vk_create_device(struct vk_bundle *vk, int forced_index, bool only_compute, VkQueueGlobalPriorityEXT global_priority, struct u_string_list *required_device_ext_list, struct u_string_list *optional_device_ext_list, const struct vk_device_features *optional_device_features)
Creates a VkDevice and initialises the VkQueue.
Definition: vk_bundle_init.c:1118
void vk_cmd_image_barrier_gpu_locked(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)
Inserts a image barrier command specifically for GPU commands, doesn't take any locks,...
Definition: vk_helpers.c:1650
VkResult vk_create_image_mutable_rgba(struct vk_bundle *vk, VkExtent2D extent, VkImageUsageFlags usage, VkDeviceMemory *out_mem, VkImage *out_image)
Helper to create a mutable RG88B8A8 VkImage that specializes in the two UNORM and SRGB variants of th...
Definition: vk_helpers.c:947
XRT_CHECK_RESULT VkResult vk_convert_timestamps_to_host_ns(struct vk_bundle *vk, uint32_t count, uint64_t *in_out_timestamps)
Convert timestamps in GPU ticks (as return by VkQueryPool timestamp queries) into host CPU nanosecond...
XRT_CHECK_RESULT VkResult vk_create_semaphore_from_native(struct vk_bundle *vk, xrt_graphics_sync_handle_t native, VkSemaphore *out_sem)
Creates a Vulkan semaphore from a native graphics sync handle.
Definition: vk_sync_objects.c:461
void vk_cmd_image_barrier_locked(struct vk_bundle *vk, VkCommandBuffer cmd_buffer, VkImage image, VkAccessFlags src_access_mask, VkAccessFlags dst_access_mask, VkImageLayout old_image_layout, VkImageLayout new_image_layout, VkPipelineStageFlags src_stage_mask, VkPipelineStageFlags dst_stage_mask, VkImageSubresourceRange subresource_range)
Inserts a image barrier command, doesn't take any locks, the calling code will need hold the lock for...
Definition: vk_helpers.c:1613
VkResult vk_enumerate_physical_device_display_properties(struct vk_bundle *vk, VkPhysicalDevice physical_device, uint32_t *out_prop_count, VkDisplayPropertiesKHR **out_props)
Enumerate the display properties of the given VkPhysicalDevice.
XRT_CHECK_RESULT VkResult vk_create_timeline_semaphore_from_native(struct vk_bundle *vk, xrt_graphics_sync_handle_t native, VkSemaphore *out_sem)
Creates a Vulkan timeline semaphore from a native graphics sync handle, see vk_create_semaphore_from_...
VkResult vk_create_image_simple(struct vk_bundle *vk, VkExtent2D extent, VkFormat format, VkImageUsageFlags usage, VkDeviceMemory *out_mem, VkImage *out_image)
Helper to create a VkImage.
Definition: vk_helpers.c:926
VkResult vk_select_physical_device(struct vk_bundle *vk, int forced_index)
Setup the physical device, this is called by vk_create_device but has uses for outside of that.
Definition: vk_bundle_init.c:1112
void vk_print_device_info(struct vk_bundle *vk, enum u_logging_level log_level, const VkPhysicalDeviceProperties *pdp, uint32_t gpu_index, const char *title)
Print device information to the logger at the given logging level, if the vk_bundle has that level en...
Definition: vk_print.c:75
VkResult vk_enumerate_swapchain_images(struct vk_bundle *vk, VkSwapchainKHR swapchain, uint32_t *out_image_count, VkImage **out_images)
Enumerate the images of the given VkSwapchainKHR.
VkResult vk_deinit_mutex(struct vk_bundle *vk)
De-initialize mutexes in the vk_bundle.
Definition: vk_bundle_init.c:1333
XRT_CHECK_RESULT VkResult vk_create_semaphore_and_native(struct vk_bundle *vk, VkSemaphore *out_sem, xrt_graphics_sync_handle_t *out_native)
Creates a Vulkan semaphore and a native graphics sync handle.
Definition: vk_sync_objects.c:282
XRT_CHECK_RESULT VkResult vk_create_and_submit_fence_native(struct vk_bundle *vk, xrt_graphics_sync_handle_t *out_native)
Creates a Vulkan fence, submits it to the default VkQueue and return its native graphics sync handle.
Definition: vk_sync_objects.c:105
VkResult vk_enumerate_surface_present_modes(struct vk_bundle *vk, VkSurfaceKHR surface, uint32_t *out_present_mode_count, VkPresentModeKHR **out_present_modes)
Enumerate the present modes of the given VkSurfaceKHR.
XRT_CHECK_RESULT VkResult vk_create_image_from_native(struct vk_bundle *vk, const struct xrt_swapchain_create_info *info, struct xrt_image_native *image_native, VkImage *out_image, VkDeviceMemory *out_mem)
Creates a Vulkan device memory and image from a native graphics buffer handle.
Definition: vk_helpers.c:1080
VkResult vk_get_loader_functions(struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g)
Can be done on a completely bare bundle.
Definition: vk_function_loaders.c:43
XRT_CHECK_RESULT bool vk_can_import_and_export_timeline_semaphore(struct vk_bundle *vk)
Is there a good likelihood that the import/export of a timeline semaphore will succeed,...
Definition: vk_sync_objects.c:77
VkResult vk_enumerate_physical_devices(struct vk_bundle *vk, uint32_t *out_physical_device_count, VkPhysicalDevice **out_physical_devices)
Enumerate the physical devices of the VkInstance that has been opened on the given vk_bundle.
Definition: vk_enumerate.c:79
XRT_CHECK_RESULT VkResult vk_create_fence_sync_from_native(struct vk_bundle *vk, xrt_graphics_sync_handle_t native, VkFence *out_fence)
Creates a Vulkan fence from a native graphics sync handle.
Definition: vk_sync_objects.c:338
XRT_CHECK_RESULT VkResult vk_alloc_and_bind_image_memory(struct vk_bundle *vk, VkImage image, size_t max_size, const void *pNext_for_allocate, const char *caller_name, VkDeviceMemory *out_mem, VkDeviceSize *out_size)
Allocate memory for an image and bind it to that image.
Definition: vk_helpers.c:807
VkResult vk_enumerate_instance_extensions_properties(struct vk_bundle *vk, const char *layer_name, uint32_t *out_prop_count, VkExtensionProperties **out_props)
Return the VkExtensionProperties of the given layer_name, NULL means the "base" driver instance.
Definition: vk_enumerate.c:55
VkResult vk_create_view_usage(struct vk_bundle *vk, VkImage image, VkImageViewType type, VkFormat format, VkImageUsageFlags image_usage, VkImageSubresourceRange subresource_range, VkImageView *out_view)
Creates a image with a specific subset of usage, useful for a mutable images where one format might n...
Definition: vk_helpers.c:1435
struct u_string_list * vk_build_instance_extensions(struct vk_bundle *vk, struct u_string_list *required_instance_ext_list, struct u_string_list *optional_instance_ext_list)
Only requires vk_get_loader_functions to have been called.
Definition: vk_bundle_init.c:135
VkResult vk_enumerate_surface_formats(struct vk_bundle *vk, VkSurfaceKHR surface, uint32_t *out_format_count, VkSurfaceFormatKHR **out_formats)
Enumerate the surface formats of the given VkSurfaceKHR, returns a list of VkSurfaceFormatKHR,...
void vk_name_object(struct vk_bundle *vk, VkObjectType type, uint64_t object, const char *name)
Uses VK_EXT_debug_utils to set a name for an object, for easier debugging.
void vk_print_opened_device_info(struct vk_bundle *vk, enum u_logging_level log_level)
Print device information about the device that bundle manages at the given logging level if the vk_bu...
Definition: vk_print.c:103
XRT_CHECK_RESULT 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, bool external_fence_fd_enabled, bool external_semaphore_fd_enabled, bool timeline_semaphore_enabled, bool debug_utils_enabled, enum u_logging_level log_level)
Initialize a bundle with objects given to us by client code, used by client_vk_compositor in Composit...
Definition: vk_bundle_init.c:1347
VkResult vk_check_required_instance_extensions(struct vk_bundle *vk, struct u_string_list *required_instance_ext_list)
Check if the required instance extensions are supported, if not print error message with all extensio...
Definition: vk_bundle_init.c:81
VkResult vk_get_device_functions(struct vk_bundle *vk)
Requires a device to have been created and set on the bundle.
Definition: vk_function_loaders.c:153
XRT_CHECK_RESULT VkResult vk_get_native_handle_from_device_memory(struct vk_bundle *vk, VkDeviceMemory device_memory, xrt_graphics_buffer_handle_t *out_handle)
Given a DeviceMemory handle created to be exportable, outputs the native buffer type (FD on desktop L...
Definition: vk_helpers.c:1292
VkResult vk_get_instance_functions(struct vk_bundle *vk)
Requires a instance to have been created and set on the bundle.
Definition: vk_function_loaders.c:57
void vk_cmd_insert_label(struct vk_bundle *vk, VkCommandBuffer cmd_buffer, const char *name)
Uses VK_EXT_debug_utils to insert debug label into a VkCommandBuffer.
void vk_print_result(struct vk_bundle *vk, const char *file, int line, const char *calling_func, VkResult ret, const char *called_func)
Print the result of a function, info level if ret == VK_SUCCESS and error level otherwise.
Definition: vk_print.c:49
VkResult vk_init_mutex(struct vk_bundle *vk)
Initialize mutexes in the vk_bundle.
Definition: vk_bundle_init.c:1324
xrt_swapchain_usage_bits
Usage of the swapchain images.
Definition: xrt_compositor.h:506
Wrapper around OS threading native functions.
A wrapper around a native mutex.
Definition: os_threading.h:55
Definition: u_string_list.cpp:19
Definition: vk_helpers.h:451
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code.
Definition: vk_helpers.h:49
bool synchronization_2
Was synchronization2 requested, available, and enabled?
Definition: vk_helpers.h:169
bool timeline_semaphore
Were timeline semaphore requested, available, and enabled?
Definition: vk_helpers.h:160
uint32_t timestamp_valid_bits
Valid bits in the queue selected.
Definition: vk_helpers.h:157
uint32_t max_per_stage_descriptor_storage_images
Per stage limit on storage images.
Definition: vk_helpers.h:166
bool is_tegra
Is the GPU a tegra device.
Definition: vk_helpers.h:173
bool timestamp_compute_and_graphics
Are timestamps available for compute and graphics queues?
Definition: vk_helpers.h:151
uint32_t max_per_stage_descriptor_sampled_images
Per stage limit on sampled images (includes combined).
Definition: vk_helpers.h:163
float timestamp_period
Nanoseconds per gpu tick.
Definition: vk_helpers.h:154
Arguments to vk_create_descriptor_pool function.
Definition: vk_helpers.h:1350
uint32_t descriptor_count
The max count of created descriptors.
Definition: vk_helpers.h:1357
uint32_t uniform_per_descriptor_count
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER.
Definition: vk_helpers.h:1351
bool freeable
Are descriptors freeable, or must vkResetDescriptorPool be used.
Definition: vk_helpers.h:1360
uint32_t sampler_per_descriptor_count
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER.
Definition: vk_helpers.h:1352
uint32_t storage_image_per_descriptor_count
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE.
Definition: vk_helpers.h:1353
uint32_t storage_buffer_per_descriptor_count
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER.
Definition: vk_helpers.h:1354
Used to enable device features as a argument vk_create_device.
Definition: vk_helpers.h:991
A single image of a swapchain based on native buffer handles.
Definition: xrt_compositor.h:2156
Swapchain creation info.
Definition: xrt_compositor.h:876
Basic logging functionality.
A collection of strings, like a list of extensions to enable.
VkImageAspectFlags vk_csci_get_barrier_aspect_mask(VkFormat format)
Return the barrier aspect mask for this format, this is intended for the barriers that flush the data...
Definition: vk_compositor_flags.c:128
VkResult vk_create_descriptor_set(struct vk_bundle *vk, VkDescriptorPool descriptor_pool, VkDescriptorSetLayout descriptor_layout, VkDescriptorSet *out_descriptor_set)
Creates a descriptor set.
Definition: vk_state_creators.c:88
void vk_print_external_handles_info(struct vk_bundle *vk, enum u_logging_level log_level)
Print external handle features to the logger at the given logging level, if the vk_bundle has that le...
Definition: vk_print.c:127
VkExternalMemoryHandleTypeFlags vk_cb_get_buffer_external_handle_type(struct vk_bundle *vk)
Return the extern handle type that a buffer should be created with.
Definition: vk_compositor_flags.c:62
void vk_fill_in_has_instance_extensions(struct vk_bundle *vk, struct u_string_list *ext_list)
Fills in has_* in vk_bundle given a string of prefiltered instance extensions.
Definition: vk_bundle_init.c:186
XRT_CHECK_RESULT const char * vk_surface_transform_flag_string(VkSurfaceTransformFlagBitsKHR bits, bool null_on_unknown)
Returns the surface transform flag if one valid bit is set, if multiple bits are set,...
Definition: vk_helpers.c:698
XRT_CHECK_RESULT const char * xrt_swapchain_usage_flag_string(enum xrt_swapchain_usage_bits bits, bool null_on_unknown)
Returns xrt swapchain_usage flag if one valid bit is set, if multiple bits are set,...
Definition: vk_helpers.c:743
VkExternalMemoryHandleTypeFlags vk_csci_get_image_external_handle_type(struct vk_bundle *vk, struct xrt_image_native *xin)
Return the extern handle type that a image should be created with.
Definition: vk_compositor_flags.c:211
VkResult vk_create_pipeline_cache(struct vk_bundle *vk, VkPipelineCache *out_pipeline_cache)
Creates a pipeline cache.
Definition: vk_state_creators.c:147
VkResult vk_create_descriptor_pool(struct vk_bundle *vk, const struct vk_descriptor_pool_info *info, VkDescriptorPool *out_descriptor_pool)
Creates a descriptor pool, made for a single layout.
Definition: vk_state_creators.c:16
void vk_print_swapchain_create_info(struct vk_bundle *vk, VkSwapchainCreateInfoKHR *i, enum u_logging_level log_level)
Print a VkSwapchainCreateInfoKHR, used to log during creation.
Definition: vk_print.c:228
XRT_CHECK_RESULT const char * vk_image_usage_flag_string(VkImageUsageFlagBits bits, bool null_on_unknown)
Returns the image usage flag if one valid bit is set, if multiple bits are set, will return 'MULTIPLE...
Definition: vk_helpers.c:627
VkAccessFlags vk_csci_get_barrier_access_mask(enum xrt_swapchain_usage_bits bits)
Returns the access flags for the compositor to app barriers.
Definition: vk_compositor_flags.c:76
XRT_CHECK_RESULT const char * vk_format_feature_flag_string(VkFormatFeatureFlagBits bits, bool null_on_unknown)
Returns the format feature flag if one valid bit is set, if multiple bits are set,...
Definition: vk_helpers.c:606
void vk_csci_get_image_external_support(struct vk_bundle *vk, VkFormat image_format, enum xrt_swapchain_usage_bits bits, VkExternalMemoryHandleTypeFlags handle_type, bool *out_importable, bool *out_exportable)
Get whether a given image can be imported/exported for a handle type.
Definition: vk_compositor_flags.c:226
XRT_CHECK_RESULT const char * vk_composite_alpha_flag_string(VkCompositeAlphaFlagBitsKHR bits, bool null_on_unknown)
Returns the composite alpha flag if one valid bit is set, if multiple bits are set,...
Definition: vk_helpers.c:679
VkResult vk_create_compute_pipeline(struct vk_bundle *vk, VkPipelineCache pipeline_cache, VkShaderModule shader, VkPipelineLayout pipeline_layout, const VkSpecializationInfo *specialization_info, VkPipeline *out_compute_pipeline)
Creates a compute pipeline, assumes entry function is called 'main'.
Definition: vk_state_creators.c:172
void vk_print_features_info(struct vk_bundle *vk, enum u_logging_level log_level)
Print device features to the logger at the given logging level, if the vk_bundle has that level enabl...
Definition: vk_print.c:112
VkImageLayout vk_csci_get_barrier_optimal_layout(VkFormat format)
Return the optimal layout for this format, this is the layout as given to the app so is bound to the ...
Definition: vk_compositor_flags.c:109
VkImageUsageFlags vk_csci_get_image_usage_flags(struct vk_bundle *vk, VkFormat format, enum xrt_swapchain_usage_bits bits)
Returns the usage bits for a given selected format and usage.
Definition: vk_compositor_flags.c:174
VkResult vk_create_pipeline_layout(struct vk_bundle *vk, VkDescriptorSetLayout descriptor_set_layout, VkPipelineLayout *out_pipeline_layout)
Creates a pipeline layout from a single descriptor set layout.
Definition: vk_state_creators.c:118
VkImageAspectFlags vk_csci_get_image_view_aspect(VkFormat format, enum xrt_swapchain_usage_bits bits)
For images views created by the compositor to sample the images, what aspect should be set.
Definition: vk_compositor_flags.c:151
Header holding common defines.
Header declaring XRT graphics interfaces.
int xrt_graphics_buffer_handle_t
The type underlying buffers shared between compositor clients and the main compositor.
Definition: xrt_handles.h:246
int xrt_graphics_sync_handle_t
The type underlying synchronization primitives (semaphores, etc) shared between compositor clients an...
Definition: xrt_handles.h:348
Include all of the Vulkan headers in one place, and cope with any "messy" includes implied by it.