Monado OpenXR Runtime
xrt_visibility_mask.h
Go to the documentation of this file.
1// Copyright 2023, Collabora, Ltd.
2// Copyright 2025-2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Header defining visibility mask helper struct.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup xrt_iface
9 */
10
11#pragma once
12
13#include "xrt/xrt_defines.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*!
20 * Visibility mask helper, the indices and vertices are tightly packed after
21 * this struct.
22 *
23 * @ingroup xrt_iface
24 */
26{
28 uint32_t index_count;
29 uint32_t vertex_count;
30};
31
32/*!
33 * Visibility mask helper function to get the indices.
34 *
35 * @ingroup xrt_iface
36 */
37XRT_NONNULL_ALL static inline uint32_t *
39{
40 return (uint32_t *)&mask[1];
41}
42
43/*!
44 * Visibility mask helper function to get the vertices.
45 *
46 * @ingroup xrt_iface
47 */
48XRT_NONNULL_ALL static inline struct xrt_vec2 *
50{
51 const uint32_t *indices = xrt_visibility_mask_get_indices(mask);
52 return (struct xrt_vec2 *)&indices[mask->index_count];
53}
54
55/*!
56 * Visibility mask helper function to get the total size of the struct.
57 *
58 * @ingroup xrt_iface
59 */
60XRT_NONNULL_ALL static inline size_t
62{
63 return sizeof(*mask) + //
64 sizeof(uint32_t) * mask->index_count + //
65 sizeof(struct xrt_vec2) * mask->vertex_count; //
66}
67
68#ifdef __cplusplus
69}
70#endif
xrt_visibility_mask_type
Visibility mask, mirror of XrVisibilityMaskKHR.
Definition: xrt_defines.h:2355
static XRT_NONNULL_ALL struct xrt_vec2 * xrt_visibility_mask_get_vertices(const struct xrt_visibility_mask *mask)
Visibility mask helper function to get the vertices.
Definition: xrt_visibility_mask.h:49
static XRT_NONNULL_ALL size_t xrt_visibility_mask_get_size(const struct xrt_visibility_mask *mask)
Visibility mask helper function to get the total size of the struct.
Definition: xrt_visibility_mask.h:61
static XRT_NONNULL_ALL uint32_t * xrt_visibility_mask_get_indices(const struct xrt_visibility_mask *mask)
Visibility mask helper function to get the indices.
Definition: xrt_visibility_mask.h:38
A 2 element vector with single floats.
Definition: xrt_defines.h:268
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition: xrt_visibility_mask.h:26
Common defines and enums for XRT.