Monado OpenXR Runtime
Loading...
Searching...
No Matches
u_native_images.h
Go to the documentation of this file.
1// Copyright 2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Helpers for fixed arrays of @ref xrt_image_native.
6 * @ingroup aux_util
7 */
8
9#pragma once
10
11#include "xrt/xrt_compositor.h"
12
13#include "util/u_handles.h"
14#include "util/u_misc.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/*!
21 * Initialise every entry to cleared / invalid handles, the structs should not
22 * have been populated with valid values before calling this function.
23 *
24 * @ingroup aux_util
25 */
26static inline void
28{
29 for (size_t i = 0; i < count; i++) {
30 U_ZERO(&images[i]);
32 }
33}
34
35/*!
36 * Unref every buffer handle and clear each entry, recommended to have called
37 * @ref u_native_images_init_invalid before calling this function.
38 *
39 * @ingroup aux_util
40 */
41static inline void
42u_native_images_unref_all(struct xrt_image_native *images, size_t count)
43{
44 for (size_t i = 0; i < count; i++) {
45 u_graphics_buffer_unref(&images[i].handle);
46 U_ZERO(&images[i]);
47 }
48}
49
50#ifdef __cplusplus
51}
52#endif
static void u_native_images_init_invalid(struct xrt_image_native *images, size_t count)
Initialise every entry to cleared / invalid handles, the structs should not have been populated with ...
Definition u_native_images.h:27
static void u_native_images_unref_all(struct xrt_image_native *images, size_t count)
Unref every buffer handle and clear each entry, recommended to have called u_native_images_init_inval...
Definition u_native_images.h:42
#define U_ZERO(PTR)
Zeroes the correct amount of memory based on the type pointed-to by the argument.
Definition u_misc.h:68
A single image of a swapchain based on native buffer handles.
Definition xrt_compositor.h:2186
xrt_graphics_buffer_handle_t handle
Native buffer handle.
Definition xrt_compositor.h:2190
Functions for dealing generically with various handle types defined in xrt_handles....
Very small misc utils.
Header declaring XRT graphics interfaces.
#define XRT_GRAPHICS_BUFFER_HANDLE_INVALID
An invalid value for a graphics buffer.
Definition xrt_handles.h:288