Monado OpenXR Runtime
Loading...
Searching...
No Matches
Auxiliary allocation utilities
Collaboration diagram for Auxiliary allocation utilities:

Files

file  a_allocator.c
 Auxiliary allocation collection helpers.
 

Functions

xrt_result_t a_allocator_allocate (struct vk_bundle *vk, const struct xrt_swapchain_create_info *xscci, uint32_t image_count, struct xrt_allocation_collection **out_xac)
 Allocates a new allocation collection for the given swapchain create info.
 
xrt_result_t a_allocator_import_from_native_images (struct vk_bundle *vk, const struct xrt_swapchain_create_info *xscci, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_allocation_collection **out_xac)
 Imports native images into a new allocation collection.
 
xrt_result_t a_allocator_ensure_vk_images (struct vk_bundle *vk, struct xrt_allocation_collection *xac, struct xrt_allocation_collection **out_xac)
 Ensures the allocation collection supports retrieving VkImages.
 

Detailed Description

Function Documentation

◆ a_allocator_allocate()

xrt_result_t a_allocator_allocate ( struct vk_bundle *  vk,
const struct xrt_swapchain_create_info *  xscci,
uint32_t  image_count,
struct xrt_allocation_collection **  out_xac 
)

#include <auxiliary/allocation/a_allocator.h>

Allocates a new allocation collection for the given swapchain create info.

Abstracts platform-specific differences (e.g., Metal on macOS, Vulkan elsewhere).

Parameters
vkVulkan bundle.
xscciSwapchain creation info describing the images.
image_countNumber of images to allocate.
out_xacPointer to receive the new allocation collection.
Returns
XRT_SUCCESS on success, or an appropriate error code.

References vk_xac_allocate(), XRT_ERROR_ALLOCATION, and XVK_CHK_ALWAYS_RET.

Referenced by comp_swapchain_create_init().

◆ a_allocator_ensure_vk_images()

xrt_result_t a_allocator_ensure_vk_images ( struct vk_bundle *  vk,
struct xrt_allocation_collection *  xac,
struct xrt_allocation_collection **  out_xac 
)

#include <auxiliary/allocation/a_allocator.h>

Ensures the allocation collection supports retrieving VkImages.

Takes an existing allocation collection and returns one that supports getting VkImages. The conversion logic is as follows:

Parameters
vkVulkan bundle.
xacExisting allocation collection to convert.
out_xacPointer to receive the allocation collection with VkImage support.
Returns
XRT_SUCCESS on success, or an appropriate error code.

References a_allocator_import_from_native_images(), xrt_image_native::handle, xrt_allocation_collection::image_count, xrt_allocation_collection::supported_properties, xrt_allocation_collection::supported_properties_count, xrt_allocation_collection::supported_types, xrt_allocation_collection::supported_types_count, U_LOG_E, U_TYPED_ARRAY_CALLOC, XRT_ALLOCATION_PROPERTY_METAL_DEVICE, XRT_ALLOCATION_PROPERTY_SWAPCHAIN_INFO, XRT_ALLOCATION_PROPERTY_VK_DEVICE, XRT_ALLOCATION_TYPE_IOSURFACE, XRT_ALLOCATION_TYPE_METAL_TEXTURE, XRT_ALLOCATION_TYPE_NATIVE_IMAGE, XRT_ALLOCATION_TYPE_VULKAN_IMAGE, XRT_ERROR_ALLOCATION, XRT_SUCCESS, XVK_CHK_AND_RET, and XVK_CHK_ONLY_PRINT.

Referenced by client_vk_swapchain_create().

◆ a_allocator_import_from_native_images()

xrt_result_t a_allocator_import_from_native_images ( struct vk_bundle *  vk,
const struct xrt_swapchain_create_info *  xscci,
struct xrt_image_native *  native_images,
uint32_t  image_count,
struct xrt_allocation_collection **  out_xac 
)

#include <auxiliary/allocation/a_allocator.h>

Imports native images into a new allocation collection.

Takes ownership of the native handles in the native_images array. On success, the handles are consumed and should not be used by the caller. On failure, the handles remain valid and owned by the caller. This is an all-or-nothing operation.

Parameters
vkVulkan bundle.
xscciSwapchain creation info describing the images.
native_imagesArray of native image handles to import (ownership transferred on success).
image_countNumber of images to import.
out_xacPointer to receive the new allocation collection.
Returns
XRT_SUCCESS on success, or an appropriate error code.

References vk_xac_from_native_images(), and XRT_ERROR_ALLOCATION.

Referenced by a_allocator_ensure_vk_images(), and comp_swapchain_import_init().