Monado OpenXR Runtime
xrt_swapchain Interface Reference

Common swapchain interface/base. More...

#include <xrt/xrt_compositor.h>

Inheritance diagram for xrt_swapchain:
Collaboration diagram for xrt_swapchain:

Static Public Member Functions

static xrt_result_t xrt_swapchain_acquire_image (struct xrt_swapchain *xsc, uint32_t *out_index)
 Obtain the index of the next image to use, without blocking on being able to write to it. More...
 
static xrt_result_t xrt_swapchain_inc_image_use (struct xrt_swapchain *xsc, uint32_t index)
 Increments the use counter of a swapchain image. More...
 
static xrt_result_t xrt_swapchain_dec_image_use (struct xrt_swapchain *xsc, uint32_t index)
 Decrements the use counter of a swapchain image. More...
 
static xrt_result_t xrt_swapchain_wait_image (struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
 Wait until image index is available for exclusive use, or until timeout_ns expires. More...
 
static xrt_result_t xrt_swapchain_barrier_image (struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
 Do any barrier transitions to and from the application. More...
 
static xrt_result_t xrt_swapchain_release_image (struct xrt_swapchain *xsc, uint32_t index)
 See xrReleaseSwapchainImage, state tracker needs to track index. More...
 

Data Fields

struct xrt_reference reference
 Reference helper. More...
 
uint32_t image_count
 Number of images. More...
 
void(* destroy )(struct xrt_swapchain *xsc)
 dec_image_use must have been called as often as inc_image_use. More...
 
xrt_result_t(* acquire_image )(struct xrt_swapchain *xsc, uint32_t *out_index)
 Obtain the index of the next image to use, without blocking on being able to write to it. More...
 
xrt_result_t(* inc_image_use )(struct xrt_swapchain *xsc, uint32_t index)
 Increments the use counter of a swapchain image. More...
 
xrt_result_t(* dec_image_use )(struct xrt_swapchain *xsc, uint32_t index)
 Decrements the use counter of a swapchain image. More...
 
xrt_result_t(* wait_image )(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
 Wait until image index is available for exclusive use, or until timeout_ns expires. More...
 
xrt_result_t(* barrier_image )(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
 Do any barrier transitions to and from the application. More...
 
xrt_result_t(* release_image )(struct xrt_swapchain *xsc, uint32_t index)
 See xrReleaseSwapchainImage, state tracker needs to track index. More...
 

Related Functions

(Note that these are not member functions.)

static void xrt_swapchain_reference (struct xrt_swapchain **dst, struct xrt_swapchain *src)
 Update the reference counts on swapchain(s). More...
 

Detailed Description

Common swapchain interface/base.

Swapchains are owned by the xrt_compositor that they where created from, it's the state trackers job to ensure all swapchains are destroyed before destroying the xrt_compositor.

Field Documentation

◆ acquire_image

xrt_result_t(* xrt_swapchain::acquire_image) (struct xrt_swapchain *xsc, uint32_t *out_index)

Obtain the index of the next image to use, without blocking on being able to write to it.

See xrAcquireSwapchainImage.

Caller must make sure that no image is acquired before calling xrt_swapchain_acquire_image.

Parameters
xscSelf pointer
[out]out_indexImage index to use next

Call xrt_swapchain_wait_image before writing to the image index output from this function.

Referenced by xrt_swapchain_acquire_image().

◆ barrier_image

xrt_result_t(* xrt_swapchain::barrier_image) (struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)

Do any barrier transitions to and from the application.

Parameters
xscSelf pointer
directionDirection of the barrier transition.
indexImage index to barrier transition.

◆ dec_image_use

xrt_result_t(* xrt_swapchain::dec_image_use) (struct xrt_swapchain *xsc, uint32_t index)

Decrements the use counter of a swapchain image.

wait_image will return once the image use counter is 0.

Referenced by xrt_swapchain_dec_image_use().

◆ destroy

void(* xrt_swapchain::destroy) (struct xrt_swapchain *xsc)

dec_image_use must have been called as often as inc_image_use.

Referenced by client_gl_memobj_swapchain_create(), and xrt_swapchain_reference().

◆ image_count

uint32_t xrt_swapchain::image_count

Number of images.

The images themselves are on the subclasses.

Referenced by comp_swapchain_get_create_properties(), do_post_create_vulkan_setup(), oxr_swapchain_common_acquire(), and u_swapchain_debug_set().

◆ inc_image_use

xrt_result_t(* xrt_swapchain::inc_image_use) (struct xrt_swapchain *xsc, uint32_t index)

Increments the use counter of a swapchain image.

Referenced by xrt_swapchain_inc_image_use().

◆ reference

struct xrt_reference xrt_swapchain::reference

Reference helper.

Referenced by xrt_swapchain_reference().

◆ release_image

xrt_result_t(* xrt_swapchain::release_image) (struct xrt_swapchain *xsc, uint32_t index)

See xrReleaseSwapchainImage, state tracker needs to track index.

Referenced by xrt_swapchain_release_image().

◆ wait_image

xrt_result_t(* xrt_swapchain::wait_image) (struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)

Wait until image index is available for exclusive use, or until timeout_ns expires.

See xrWaitSwapchainImage, which is the basis for this API. The state tracker needs to track image index, which should have come from xrt_swapchain_acquire_image

Parameters
xscSelf pointer
timeout_nsTimeout in nanoseconds,
indexImage index to wait for.

Referenced by xrt_swapchain_wait_image().


The documentation for this interface was generated from the following file: