Monado OpenXR Runtime
Loading...
Searching...
No Matches
xrt_allocation_collection Struct Reference

A collection of allocations, these can be images, buffers or general memory. More...

#include <xrt/xrt_allocation_collection.h>

Collaboration diagram for xrt_allocation_collection:

Static Public Member Functions

static xrt_result_t xrt_allocation_collection_get_swapchain_info (struct xrt_allocation_collection *xac, struct xrt_swapchain_create_info *out_info)
 Typed helper to get the XRT_ALLOCATION_PROPERTY_SWAPCHAIN_INFO property.
 
static xrt_result_t xrt_allocation_collection_get_native_images (struct xrt_allocation_collection *xac, struct xrt_image_native *out_images)
 Typed helper to get all the native images from an allocation collection, see XRT_ALLOCATION_TYPE_NATIVE_IMAGE for ownership transfer semantics.
 
static xrt_result_t xrt_allocation_collection_get_vk_device (struct xrt_allocation_collection *xac, VkDevice *out_device)
 Typed helper to get the XRT_ALLOCATION_PROPERTY_VK_DEVICE property.
 
static xrt_result_t xrt_allocation_collection_get_vk_images (struct xrt_allocation_collection *xac, VkDevice device, VkImage *out_images)
 Typed helper to get all the VkImages from an allocation collection, see XRT_ALLOCATION_TYPE_VULKAN_IMAGE for lifetime.
 

Data Fields

struct xrt_reference reference
 Reference helper.
 
uint32_t image_count
 Number of images in the collection, this is the total number of images in the collection, not the number of images of a given type.
 
struct { 
 
   enum xrt_allocation_property   property 
 
} supported_properties [XRT_MAX_ALLOCATION_PROPERTY_COUNT] 
 Supported properties that can be queried from the get_property function.
 
uint32_t supported_properties_count
 Number of supported properties.
 
struct { 
 
   enum xrt_allocation_type   type 
 
} supported_types [XRT_MAX_ALLOCATION_TYPE_COUNT] 
 Supported allocation types that can be queried from the get_all function.
 
uint32_t supported_types_count
 Number of supported allocation types.
 
xrt_result_t(* get_property_raw )(struct xrt_allocation_collection *xac, enum xrt_allocation_property prop, void *ptr)
 Get a property from the allocation collection.
 
xrt_result_t(* get_all_raw )(struct xrt_allocation_collection *xac, enum xrt_allocation_type type, void *ptr)
 Get all images of a given type.
 
void(* destroy )(struct xrt_allocation_collection *xac)
 Destroy the allocation collection, called when the reference count reaches zero.
 

Related Symbols

(Note that these are not member symbols.)

static void xrt_allocation_collection_reference (struct xrt_allocation_collection **dst, struct xrt_allocation_collection *src)
 Update the reference counts on allocation collection(s).
 

Detailed Description

A collection of allocations, these can be images, buffers or general memory.

This object is meant to be simple, just a container that more complex objects like xrt_swapchain are built on top of. Its main purpose is to share common code between those objects, such as sending handles over IPC, importing into Vulkan and OpenGL, and converting between allocation types.

The properties of the collection are immutable after creation, unless otherwise noted. The collection may be "virtual", like the IPC client one which refers to allocations living in the service.

Implementations can be fairly high level and may change the layout or even the backing storage of the memory, what matters is that the objects returned by xrt_allocation_collection::get_all_raw keep referring to the same allocations.

This interface does not synchronize the contents of the allocations, that is done by wrapper objects such as xrt_swapchain.

Field Documentation

◆ destroy

void(* xrt_allocation_collection::destroy) (struct xrt_allocation_collection *xac)

Destroy the allocation collection, called when the reference count reaches zero.

Referenced by ipc_client_allocation_collection_create(), u_native_images_xac_create(), and xrt_allocation_collection_reference().

◆ get_all_raw

xrt_result_t(* xrt_allocation_collection::get_all_raw) (struct xrt_allocation_collection *xac, enum xrt_allocation_type type, void *ptr)

Get all images of a given type.

This function is type-erased and internal, users MUST use the typed helper function noted on each xrt_allocation_type.

Parameters
xacThe allocation collection.
typeThe type of the images to get.
ptrThe pointer to the images.

Referenced by ipc_client_allocation_collection_create(), u_native_images_xac_create(), xrt_allocation_collection_get_native_images(), and xrt_allocation_collection_get_vk_images().

◆ get_property_raw

xrt_result_t(* xrt_allocation_collection::get_property_raw) (struct xrt_allocation_collection *xac, enum xrt_allocation_property prop, void *ptr)

Get a property from the allocation collection.

This function is type-erased and internal, users MUST use the typed helper function noted on each xrt_allocation_property.

Parameters
xacThe allocation collection.
propThe property to get.
ptrPointer to write the property value to (cast as needed per property).

Referenced by ipc_client_allocation_collection_create(), u_native_images_xac_create(), xrt_allocation_collection_get_swapchain_info(), and xrt_allocation_collection_get_vk_device().

◆ image_count

uint32_t xrt_allocation_collection::image_count

Number of images in the collection, this is the total number of images in the collection, not the number of images of a given type.

All images are guaranteed to be of the types supported by the supported_types array.

Referenced by a_allocator_ensure_vk_images(), client_gl_eglimage_swapchain_create(), client_gl_memobj_swapchain_create(), ipc_client_allocation_collection_create(), move_native_images(), ogl_import_from_allocation_collection(), and u_native_images_xac_create().

◆ reference

struct xrt_reference xrt_allocation_collection::reference

◆ [struct]

struct { ... } xrt_allocation_collection::supported_properties[XRT_MAX_ALLOCATION_PROPERTY_COUNT]

Supported properties that can be queried from the get_property function.

The supported_properties_count field is the number of supported properties.

Referenced by a_allocator_ensure_vk_images(), ipc_client_allocation_collection_create(), u_allocation_collection_supports_property(), and u_native_images_xac_create().

◆ supported_properties_count

uint32_t xrt_allocation_collection::supported_properties_count

◆ [struct]

struct { ... } xrt_allocation_collection::supported_types[XRT_MAX_ALLOCATION_TYPE_COUNT]

Supported allocation types that can be queried from the get_all function.

Each types have different element size and semantics, which the caller needs to know about. The supported_types_count field is the number of supported types.

Referenced by a_allocator_ensure_vk_images(), ipc_client_allocation_collection_create(), u_allocation_collection_supports_type(), and u_native_images_xac_create().

◆ supported_types_count

uint32_t xrt_allocation_collection::supported_types_count

The documentation for this struct was generated from the following files: