Monado OpenXR Runtime
Macros | Functions
vk_helpers.c File Reference

Common Vulkan code. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "vk/vk_helpers.h"
Include dependency graph for vk_helpers.c:

Macros

#define ENUM_TO_STR(r)   case r: return #r
 
#define ENUM_TO_STR(r)   case r: return #r
 
#define GET_PROC(vk, name)   (PFN_##name) vk->vkGetInstanceProcAddr(NULL, #name);
 
#define GET_INS_PROC(vk, name)   (PFN_##name) vk->vkGetInstanceProcAddr(vk->instance, #name);
 
#define GET_DEV_PROC(vk, name)   (PFN_##name) vk->vkGetDeviceProcAddr(vk->device, #name);
 

Functions

const char * vk_result_string (VkResult code)
 
const char * vk_color_format_string (VkFormat code)
 
const char * vk_present_mode_string (VkPresentModeKHR code)
 
const char * vk_power_state_string (VkDisplayPowerStateEXT code)
 
const char * vk_color_space_string (VkColorSpaceKHR code)
 
bool vk_get_memory_type (struct vk_bundle *vk, uint32_t type_bits, VkMemoryPropertyFlags memory_props, uint32_t *out_type_id)
 
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. More...
 
VkResult vk_create_image_simple (struct vk_bundle *vk, uint32_t width, uint32_t height, VkFormat format, VkDeviceMemory *out_mem, VkImage *out_image)
 
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)
 
VkResult vk_create_sampler (struct vk_bundle *vk, VkSampler *out_sampler)
 
VkResult vk_create_view (struct vk_bundle *vk, VkImage image, VkFormat format, VkImageSubresourceRange subresource_range, VkImageView *out_view)
 
VkResult vk_init_cmd_buffer (struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer)
 
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)
 
VkResult vk_submit_cmd_buffer (struct vk_bundle *vk, VkCommandBuffer cmd_buffer)
 
VkResult vk_init_cmd_pool (struct vk_bundle *vk)
 
void vk_init_validation_callback (struct vk_bundle *vk)
 
void vk_destroy_validation_callback (struct vk_bundle *vk)
 
VkResult vk_get_loader_functions (struct vk_bundle *vk, PFN_vkGetInstanceProcAddr g)
 
VkResult vk_get_instance_functions (struct vk_bundle *vk)
 
VkResult vk_create_device (struct vk_bundle *vk, int forced_index)
 
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 Compositor client code. More...
 

Detailed Description

Common Vulkan code.

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

Macro Definition Documentation

◆ ENUM_TO_STR [1/2]

#define ENUM_TO_STR (   r)    case r: return #r

◆ ENUM_TO_STR [2/2]

#define ENUM_TO_STR (   r)    case r: return #r

◆ GET_DEV_PROC

#define GET_DEV_PROC (   vk,
  name 
)    (PFN_##name) vk->vkGetDeviceProcAddr(vk->device, #name);

◆ GET_INS_PROC

#define GET_INS_PROC (   vk,
  name 
)    (PFN_##name) vk->vkGetInstanceProcAddr(vk->instance, #name);

◆ GET_PROC

#define GET_PROC (   vk,
  name 
)    (PFN_##name) vk->vkGetInstanceProcAddr(NULL, #name);

Function Documentation

◆ vk_color_format_string()

const char* vk_color_format_string ( VkFormat  code)

References ENUM_TO_STR.

◆ vk_color_space_string()

const char* vk_color_space_string ( VkColorSpaceKHR  code)

References ENUM_TO_STR.

◆ vk_power_state_string()

const char* vk_power_state_string ( VkDisplayPowerStateEXT  code)

References ENUM_TO_STR.

◆ vk_present_mode_string()

const char* vk_present_mode_string ( VkPresentModeKHR  code)

References ENUM_TO_STR.

◆ vk_result_string()

const char* vk_result_string ( VkResult  code)