Monado OpenXR Runtime
vk_bundle_init.c File Reference

Functions to init various parts of the vk_bundle. More...

#include "util/u_pretty_print.h"
#include "vk/vk_helpers.h"
#include <stdio.h>
Include dependency graph for vk_bundle_init.c:

Macros

#define CHECK(feature, DEV_FEATURE)   device_features->feature = optional_device_features->feature && (DEV_FEATURE)
 

Functions

static void append_to_pnext_chain (VkBaseInStructure *head, VkBaseInStructure *new_struct)
 
static bool should_skip_optional_instance_ext (struct vk_bundle *vk, struct u_string_list *required_instance_ext_list, struct u_string_list *optional_instance_ext_listconst, const char *ext)
 
static bool is_instance_ext_supported (VkExtensionProperties *props, uint32_t prop_count, const char *ext)
 
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 extensions missing, returns VK_ERROR_EXTENSION_NOT_PRESENT if not all extensions are supported. More...
 
struct u_string_listvk_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. More...
 
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. More...
 
static void fill_in_device_features (struct vk_bundle *vk)
 
static void get_external_image_support (struct vk_bundle *vk, bool depth, VkExternalMemoryHandleTypeFlagBits handle_type, bool *out_importable, bool *out_exportable)
 
static bool is_fence_bit_supported (struct vk_bundle *vk, VkExternalFenceHandleTypeFlagBits handle_type)
 
static void get_binary_semaphore_bit_support (struct vk_bundle *vk, VkExternalSemaphoreHandleTypeFlagBits handle_type, bool *out_importable, bool *out_exportable)
 
static bool is_binary_semaphore_bit_supported (struct vk_bundle *vk, VkExternalSemaphoreHandleTypeFlagBits handle_type)
 
static void get_timeline_semaphore_bit_support (struct vk_bundle *vk, VkExternalSemaphoreHandleTypeFlagBits handle_type, bool *out_importable, bool *out_exportable)
 
static bool is_timeline_semaphore_bit_supported (struct vk_bundle *vk, VkExternalSemaphoreHandleTypeFlagBits handle_type)
 
static void fill_in_external_object_properties (struct vk_bundle *vk)
 
static int device_type_priority (VkPhysicalDeviceType device_type)
 
static bool device_is_preferred (VkPhysicalDeviceProperties *l_device, VkPhysicalDeviceProperties *r_device)
 
static void device_debug_print (struct vk_bundle *vk, const VkPhysicalDeviceProperties *pdp, uint32_t index)
 
static uint32_t select_preferred_device (struct vk_bundle *vk, VkPhysicalDevice *devices, uint32_t device_count)
 
static VkResult select_physical_device (struct vk_bundle *vk, int forced_index)
 
static VkResult find_graphics_queue_family (struct vk_bundle *vk, uint32_t *out_graphics_queue_family)
 
static VkResult find_queue_family (struct vk_bundle *vk, VkQueueFlags required_flags, uint32_t *out_queue_family)
 
static bool check_extension (struct vk_bundle *vk, VkExtensionProperties *props, uint32_t prop_count, const char *ext)
 
static void fill_in_has_device_extensions (struct vk_bundle *vk, struct u_string_list *ext_list)
 
static bool should_skip_optional_device_ext (struct vk_bundle *vk, struct u_string_list *required_device_ext_list, struct u_string_list *optional_device_ext_listconst, const char *ext)
 
static bool build_device_extensions (struct vk_bundle *vk, VkPhysicalDevice physical_device, struct u_string_list *required_device_ext_list, struct u_string_list *optional_device_ext_list, struct u_string_list **out_device_ext_list)
 
static void filter_device_features (struct vk_bundle *vk, VkPhysicalDevice physical_device, const struct vk_device_features *optional_device_features, struct vk_device_features *device_features)
 Sets fields in device_features to true if and only if they are available and they are true in optional_device_features (indicating a desire for that feature) More...
 
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. More...
 
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. More...
 
VkResult vk_init_mutex (struct vk_bundle *vk)
 Initialize mutexes in the vk_bundle. More...
 
VkResult vk_deinit_mutex (struct vk_bundle *vk)
 De-initialize mutexes in the vk_bundle. More...
 
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 Compositor client code. More...
 

Detailed Description

Functions to init various parts of the vk_bundle.

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.

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
Moses Turner moses.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ filter_device_features()

static void filter_device_features ( struct vk_bundle vk,
VkPhysicalDevice  physical_device,
const struct vk_device_features optional_device_features,
struct vk_device_features device_features 
)
static

Sets fields in device_features to true if and only if they are available and they are true in optional_device_features (indicating a desire for that feature)

Parameters
vkself
physical_deviceThe physical device to query
[in]optional_device_featuresThe features to request if available
[out]device_featuresPopulated with the subset of optional_device_features that are actually available.

◆ vk_fill_in_has_instance_extensions()

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.

References u_string_list::u_string_list_get_data(), and u_string_list::u_string_list_get_size().