Monado OpenXR Runtime
|
Common Vulkan code. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util/u_debug.h"
#include "util/u_handles.h"
#include "util/u_misc.h"
#include "vk/vk_helpers.h"
#include <xrt/xrt_handles.h>
Macros | |
#define | CHAIN(STRUCT, NEXT) |
#define | ENUM_TO_STR(r) case r: return #r |
Functions | |
XRT_CHECK_RESULT const char * | vk_result_string (VkResult code) |
XRT_CHECK_RESULT const char * | vk_object_type_string (VkObjectType type) |
XRT_CHECK_RESULT const char * | vk_physical_device_type_string (VkPhysicalDeviceType device_type) |
XRT_CHECK_RESULT const char * | vk_format_string (VkFormat code) |
XRT_CHECK_RESULT const char * | vk_sharing_mode_string (VkSharingMode code) |
XRT_CHECK_RESULT const char * | vk_present_mode_string (VkPresentModeKHR code) |
XRT_CHECK_RESULT const char * | vk_color_space_string (VkColorSpaceKHR code) |
XRT_CHECK_RESULT const char * | vk_power_state_string (VkDisplayPowerStateEXT code) |
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'. More... | |
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'. More... | |
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'. More... | |
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'. More... | |
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, will return 'MULTIPLE BIT SET'. More... | |
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. More... | |
static VkResult | create_image_simple (struct vk_bundle *vk, VkExtent2D extent, VkFormat format, VkImageCreateFlags create, VkImageUsageFlags usage, VkBaseInStructure *next_chain, VkDeviceMemory *out_mem, VkImage *out_image) |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
VkResult | vk_create_sampler (struct vk_bundle *vk, VkSamplerAddressMode clamp_mode, VkSampler *out_sampler) |
static VkResult | create_view (struct vk_bundle *vk, VkImage image, VkImageViewType type, VkFormat format, VkImageSubresourceRange subresource_range, VkComponentMapping components, VkBaseInStructure *next_chain, VkImageView *out_view) |
static VkResult | create_view_default_swizzle (struct vk_bundle *vk, VkImage image, VkImageViewType type, VkFormat format, VkImageSubresourceRange subresource_range, VkBaseInStructure *next_chain, VkImageView *out_view) |
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_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. More... | |
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. More... | |
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. More... | |
Common Vulkan code.
Note that some sections of this are generated by scripts/generate_vk_helpers.py
- lists of functions and of optional extensions to check for. In those, please update the script and run it, instead of editing directly in this file. The generated parts are delimited by special comments.
#define CHAIN | ( | STRUCT, | |
NEXT | |||
) |
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_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_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'.
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, will return 'MULTIPLE BIT SET'.