Monado OpenXR Runtime
Loading...
Searching...
No Matches
vk_helpers.h File Reference

Common Vulkan code header. More...

#include "xrt/xrt_compiler.h"
#include "xrt/xrt_compositor.h"
#include "xrt/xrt_vulkan_includes.h"
#include "xrt/xrt_handles.h"
#include "util/u_logging.h"
#include "util/u_extension_list.h"
#include "vk/vk_print.h"
#include "os/os_threading.h"
#include "vk_helpers_h_ext.h.inc"
#include "vk_helpers_h_funcs.h.inc"
Include dependency graph for vk_helpers.h:

Go to the source code of this file.

Data Structures

struct  vk_queue_pair
 
struct  vk_bundle_queue
 
struct  vk_bundle
 A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code. More...
 
struct  vk_buffer
 
struct  vk_device_features
 Used to enable device features as a argument vk_create_device. More...
 
struct  vk_descriptor_pool_info
 Arguments to vk_create_descriptor_pool function. More...
 

Macros

#define VK_BUNDLE_MAX_QUEUES   3
 
#define VK_NULL_QUEUE_PAIR
 
#define VK_CHK_ONLY_PRINT(RET, FUNC_STR)
 This define will print if RET is not VK_SUCCESS, printing out that the FUNC_STR string has failed.
 
#define VK_CHK_AND_RET(RET, FUNC_STR)
 This define will error if RET is not VK_SUCCESS, printing out that the FUNC_STR string has failed, then returns RET.
 
#define VK_CHK_WITH_RET(RET, FUNC_STR, TO_RET)
 This define will error if RET is not VK_SUCCESS, printing out that the FUNC_STR string has failed, then returns TO_RET.
 
#define VK_CHK_WITH_GOTO(RET, FUNC_STR, GOTO)
 This define will error if RET is not VK_SUCCESS, printing out that the FUNC_STR string has failed, then goto GOTO.
 
#define XVK_CHK_AND_RET(...)   U_LOG_CHK_AND_RET(vk->log_level, __VA_ARGS__)
 For xrt_result_t, see VK_CHK_AND_RET.
 
#define XVK_CHK_WITH_GOTO(...)   U_LOG_CHK_WITH_GOTO(vk->log_level, __VA_ARGS__)
 For xrt_result_t, see VK_CHK_WITH_GOTO.
 
#define XVK_CHK_WITH_RET(...)   U_LOG_CHK_WITH_RET(vk->log_level, __VA_ARGS__)
 For xrt_result_t, see VK_CHK_WITH_RET.
 
#define XVK_CHK_ONLY_PRINT(...)   U_LOG_CHK_ONLY_PRINT(vk->log_level, __VA_ARGS__)
 For xrt_result_t, see VK_CHK_ONLY_PRINT.
 
#define XVK_CHK_ALWAYS_RET(...)   U_LOG_CHK_ALWAYS_RET(vk->log_level, __VA_ARGS__)
 For xrt_result_t, see VK_CHK_ALWAYS_RET.
 
#define VK_TRACE(d, ...)   U_LOG_IFL_T(d->log_level, __VA_ARGS__)
 
#define VK_DEBUG(d, ...)   U_LOG_IFL_D(d->log_level, __VA_ARGS__)
 
#define VK_INFO(d, ...)   U_LOG_IFL_I(d->log_level, __VA_ARGS__)
 
#define VK_WARN(d, ...)   U_LOG_IFL_W(d->log_level, __VA_ARGS__)
 
#define VK_ERROR(d, ...)   U_LOG_IFL_E(d->log_level, __VA_ARGS__)
 
#define VK_NAME_OBJ(VK, TYPE, SUFFIX, OBJ, NAME)
 Small helper for vk_name_object that makes use of pre-process to avoid writing out long type names.
 
#define VK_NAME_OBJ_DISABLED(VK, TYPE, OBJ)
 Some combinations of Vulkan implementation and types are broken, we still want type safety so we have this define.
 
#define VK_NAME_INSTANCE(VK, OBJ, NAME)   VK_NAME_OBJ_DISABLED(VK, VkInstance, (uintptr_t)OBJ)
 
#define VK_NAME_PHYSICAL_DEVICE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkPhysicalDevice, PHYSICAL_DEVICE, (uintptr_t)OBJ, NAME)
 
#define VK_NAME_DEVICE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkDevice, DEVICE, (uintptr_t)OBJ, NAME)
 
#define VK_NAME_QUEUE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkQueue, QUEUE, (uintptr_t)OBJ, NAME)
 
#define VK_NAME_COMMAND_BUFFER(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkCommandBuffer, COMMAND_BUFFER, (uintptr_t)OBJ, NAME)
 
#define VK_NAME_SEMAPHORE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkSemaphore, SEMAPHORE, OBJ, NAME)
 
#define VK_NAME_FENCE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkFence, FENCE, OBJ, NAME)
 
#define VK_NAME_DEVICE_MEMORY(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkDeviceMemory, DEVICE_MEMORY, OBJ, NAME)
 
#define VK_NAME_BUFFER(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkBuffer, BUFFER, OBJ, NAME)
 
#define VK_NAME_IMAGE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkImage, IMAGE, OBJ, NAME)
 
#define VK_NAME_EVENT(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkEvent, EVENT, OBJ, NAME)
 
#define VK_NAME_QUERY_POOL(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkQueryPool, QUERY_POOL, OBJ, NAME)
 
#define VK_NAME_BUFFER_VIEW(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkBufferView, BUFFER_VIEW, OBJ, NAME)
 
#define VK_NAME_IMAGE_VIEW(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkImageView, IMAGE_VIEW, OBJ, NAME)
 
#define VK_NAME_SHADER_MODULE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkShaderModule, SHADER_MODULE, OBJ, NAME)
 
#define VK_NAME_PIPELINE_CACHE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkPipelineCache, PIPELINE_CACHE, OBJ, NAME)
 
#define VK_NAME_PIPELINE_LAYOUT(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkPipelineLayout, PIPELINE_LAYOUT, OBJ, NAME)
 
#define VK_NAME_RENDER_PASS(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkRenderPass, RENDER_PASS, OBJ, NAME)
 
#define VK_NAME_PIPELINE(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkPipeline, PIPELINE, OBJ, NAME)
 
#define VK_NAME_DESCRIPTOR_SET_LAYOUT(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkDescriptorSetLayout, DESCRIPTOR_SET_LAYOUT, OBJ, NAME)
 
#define VK_NAME_SAMPLER(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkSampler, SAMPLER, OBJ, NAME)
 
#define VK_NAME_DESCRIPTOR_POOL(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkDescriptorPool, DESCRIPTOR_POOL, OBJ, NAME)
 
#define VK_NAME_DESCRIPTOR_SET(VK, OBJ, NAME)   VK_NAME_OBJ_DISABLED(VK, VkDescriptorSet, OBJ)
 
#define VK_NAME_FRAMEBUFFER(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkFramebuffer, FRAMEBUFFER, OBJ, NAME)
 
#define VK_NAME_COMMAND_POOL(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkCommandPool, COMMAND_POOL, OBJ, NAME)
 
#define VK_NAME_SURFACE(VK, OBJ, NAME)   VK_NAME_OBJ_DISABLED(VK, VkSurfaceKHR, OBJ)
 
#define VK_NAME_SWAPCHAIN(VK, OBJ, NAME)   VK_NAME_OBJ(VK, VkSwapchainKHR, SWAPCHAIN_KHR, OBJ, NAME)
 

Functions

static void vk_append_to_pnext_chain (VkBaseInStructure *head, VkBaseInStructure *new_struct)
 
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, will return 'MULTIPLE BIT SET'.
 
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 BIT SET'.
 
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, will return 'MULTIPLE BIT SET'.
 
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, will return 'MULTIPLE BIT SET'.
 
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.
 
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.
 
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.
 
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, NULL means the "base" driver physical device.
 
void vk_get_physical_device_queue_family_properties (struct vk_bundle *vk, VkPhysicalDevice physical_device, uint32_t *out_prop_count, VkQueueFamilyProperties **out_props)
 Get the queue family properties of the given VkPhysicalDevice, note this function does not return a result, it will assert if it can not allocate the array of properties.
 
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, not VkFormat.
 
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.
 
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_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.
 
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.
 
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_get_loader_functions (struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g)
 Can be done on a completely bare bundle.
 
VkResult vk_get_instance_functions (struct vk_bundle *vk)
 Requires a instance to have been created and set on the bundle.
 
VkResult vk_get_device_functions (struct vk_bundle *vk)
 Requires a device to have been created and set on the bundle.
 
VkResult vk_check_required_instance_extensions (struct vk_bundle *vk, struct u_extension_list *required_instance_ext_list)
 Check if the required instance extensions are supported, if not print error message with all extensions missing, returns VK_ERROR_EXTENSION_NOT_PRESENT if not all extensions are supported.
 
VkResult vk_build_instance_extensions (struct vk_bundle *vk, struct u_extension_list *required_instance_ext_list, struct u_extension_list *optional_instance_ext_list, struct u_extension_list **out_instance_ext_list)
 Build instance extensions from required and optional instance extensions.
 
void vk_fill_in_has_instance_extensions (struct vk_bundle *vk, struct u_extension_list *ext_list)
 Fills in has_* in vk_bundle given a string of prefiltered instance extensions.
 
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.
 
XRT_CHECK_RESULT VkResult vk_create_device (struct vk_bundle *vk, int forced_index, bool only_compute, VkQueueGlobalPriorityEXT global_priority, struct u_extension_list *required_device_ext_list, struct u_extension_list *optional_device_ext_list, const struct vk_device_features *optional_device_features)
 Creates a VkDevice and initialises the VkQueue.
 
VkResult vk_init_mutex (struct vk_bundle *vk)
 Initialize mutexes in the vk_bundle.
 
VkResult vk_deinit_mutex (struct vk_bundle *vk)
 De-initialize mutexes in the vk_bundle.
 
static void vk_queue_lock (struct vk_bundle_queue *q)
 
static int vk_queue_trylock (struct vk_bundle_queue *q)
 
static void vk_queue_unlock (struct vk_bundle_queue *q)
 
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 image_format_list_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 Compositor client code.
 
bool vk_get_memory_type (struct vk_bundle *vk, uint32_t type_bits, VkMemoryPropertyFlags memory_props, uint32_t *out_type_id)
 
XRT_CHECK_RESULT VkResult vk_alloc_and_bind_image_memory (struct vk_bundle *vk, VkImage image, const VkMemoryRequirements *requirements, const void *pNext_for_allocate, const char *caller_name, VkDeviceMemory *out_mem)
 Allocate memory for an image and bind it to that image.
 
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.
 
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 Linux) equivalent.
 
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.
 
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 that formats.
 
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.
 
VkResult vk_create_sampler (struct vk_bundle *vk, VkSamplerAddressMode clamp_mode, VkSampler *out_sampler)
 
VkResult vk_create_view (struct vk_bundle *vk, VkImage image, VkImageViewType type, VkFormat format, VkImageSubresourceRange subresource_range, VkImageView *out_view)
 
VkResult vk_create_view_swizzle (struct vk_bundle *vk, VkImage image, VkImageViewType type, VkFormat format, VkImageSubresourceRange subresource_range, VkComponentMapping components, VkImageView *out_view)
 
VkResult vk_create_view_swizzle_usage (struct vk_bundle *vk, VkImage image, VkImageViewType type, VkFormat format, VkImageUsageFlags image_usage, VkImageSubresourceRange subresource_range, VkComponentMapping components, VkImageView *out_view)
 Creates a swizzled image view with a specific subset of usage, useful for a mutable image where one format might not support all usages defined by the image.
 
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 not support all usages defined by the image.
 
bool vk_init_descriptor_pool (struct vk_bundle *vk, const VkDescriptorPoolSize *pool_sizes, uint32_t pool_size_count, uint32_t set_count, VkDescriptorPool *out_descriptor_pool)
 
bool vk_allocate_descriptor_sets (struct vk_bundle *vk, VkDescriptorPool descriptor_pool, uint32_t count, const VkDescriptorSetLayout *set_layout, VkDescriptorSet *sets)
 
bool vk_buffer_init (struct vk_bundle *vk, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer *out_buffer, VkDeviceMemory *out_mem)
 
void vk_buffer_destroy (struct vk_buffer *self, struct vk_bundle *vk)
 
bool vk_update_buffer (struct vk_bundle *vk, float *buffer, size_t buffer_size, VkDeviceMemory memory)
 
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 the pool that cmd_buffer is from or ensure it is externally synchronized.
 
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, the calling code will need hold the lock for the pool that cmd_buffer is from or ensure it is externally synchronized.
 
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.
 
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.
 
VkResult vk_create_descriptor_set (struct vk_bundle *vk, VkDescriptorPool descriptor_pool, VkDescriptorSetLayout descriptor_layout, VkDescriptorSet *out_descriptor_set)
 Creates a descriptor set.
 
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.
 
VkResult vk_create_pipeline_cache (struct vk_bundle *vk, VkPipelineCache *out_pipeline_cache)
 Creates a pipeline cache.
 
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'.
 
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, in other words will the below functions work.
 
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.
 
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.
 
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.
 
XRT_CHECK_RESULT VkResult vk_create_timeline_semaphore_and_native (struct vk_bundle *vk, VkSemaphore *out_sem, xrt_graphics_sync_handle_t *out_native)
 
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.
 
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_native for more details.
 
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 nanoseconds, same time domain as os_monotonic_get_ns.
 

Detailed Description

Common Vulkan code header.

Note that some functionality in this file is generated by the script src/xrt/auxiliary/vk/vk_generate_inc_files.py. The generated parts are included via .h.inc files.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m
Lubosz Sarnecki lubos.nosp@m.z.sa.nosp@m.rneck.nosp@m.i@co.nosp@m.llabo.nosp@m.ra.c.nosp@m.om
Moshi Turner moshi.nosp@m.turn.nosp@m.er@pr.nosp@m.oton.nosp@m.mail..nosp@m.com
Korcan Hussein korca.nosp@m.n.hu.nosp@m.ssein.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Macro Definition Documentation

◆ VK_NULL_QUEUE_PAIR

#define VK_NULL_QUEUE_PAIR
Value:
XRT_C11_COMPOUND(struct vk_queue_pair) \
{ \
.family_index = VK_QUEUE_FAMILY_IGNORED, .index = (uint32_t)-1, \
}
Definition vk_helpers.h:48

◆ XVK_CHK_ALWAYS_RET

#define XVK_CHK_ALWAYS_RET (   ...)    U_LOG_CHK_ALWAYS_RET(vk->log_level, __VA_ARGS__)

For xrt_result_t, see VK_CHK_ALWAYS_RET.

◆ XVK_CHK_AND_RET

#define XVK_CHK_AND_RET (   ...)    U_LOG_CHK_AND_RET(vk->log_level, __VA_ARGS__)

For xrt_result_t, see VK_CHK_AND_RET.

◆ XVK_CHK_ONLY_PRINT

#define XVK_CHK_ONLY_PRINT (   ...)    U_LOG_CHK_ONLY_PRINT(vk->log_level, __VA_ARGS__)

For xrt_result_t, see VK_CHK_ONLY_PRINT.

◆ XVK_CHK_WITH_GOTO

#define XVK_CHK_WITH_GOTO (   ...)    U_LOG_CHK_WITH_GOTO(vk->log_level, __VA_ARGS__)

For xrt_result_t, see VK_CHK_WITH_GOTO.

◆ XVK_CHK_WITH_RET

#define XVK_CHK_WITH_RET (   ...)    U_LOG_CHK_WITH_RET(vk->log_level, __VA_ARGS__)

For xrt_result_t, see VK_CHK_WITH_RET.

Function Documentation

◆ vk_composite_alpha_flag_string()

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, will return 'MULTIPLE BIT SET'.

Referenced by vk_print_surface_info(), and vk_print_swapchain_create_info().

◆ vk_create_compute_pipeline()

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'.

Does error logging.

Referenced by comp_mirror_to_debug_gui::comp_mirror_init(), and render_resources::render_resources_init().

◆ vk_create_descriptor_pool()

◆ vk_create_descriptor_set()

VkResult vk_create_descriptor_set ( struct vk_bundle vk,
VkDescriptorPool  descriptor_pool,
VkDescriptorSetLayout  descriptor_layout,
VkDescriptorSet *  out_descriptor_set 
)

◆ vk_create_pipeline_cache()

VkResult vk_create_pipeline_cache ( struct vk_bundle vk,
VkPipelineCache *  out_pipeline_cache 
)

Creates a pipeline cache.

Does error logging.

Referenced by comp_mirror_to_debug_gui::comp_mirror_init(), and render_resources::render_resources_init().

◆ vk_create_pipeline_layout()

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.

Does error logging.

Referenced by render_resources::render_resources_init().

◆ vk_fill_in_has_instance_extensions()

void vk_fill_in_has_instance_extensions ( struct vk_bundle vk,
struct u_extension_list ext_list 
)

Fills in has_* in vk_bundle given a string of prefiltered instance extensions.

◆ vk_format_feature_flag_string()

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, will return 'MULTIPLE BIT SET'.

◆ vk_image_usage_flag_string()

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 BIT SET'.

Referenced by vk_print_surface_info(), and vk_print_swapchain_create_info().

◆ vk_surface_transform_flag_string()

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, will return 'MULTIPLE BIT SET'.

Referenced by vk_print_surface_info(), and vk_print_swapchain_create_info().