Monado OpenXR Runtime
u_verify.h
Go to the documentation of this file.
1// Copyright 2021, Collabora, Ltd.
2// Copyright 2021, Moses Turner.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Tiny file to verify things
7 * @author Moses Turner <mosesturner@protonmail.com>
8 * @author Jakob Bornecrantz <jakob@collabora.com>
9 * @ingroup aux_util
10 */
11
12#pragma once
13#include "xrt/xrt_defines.h"
14#include "xrt/xrt_device.h"
15#include "xrt/xrt_compositor.h"
16
17static inline bool
18u_verify_blend_mode_valid(enum xrt_blend_mode blend_mode)
19{
20 return ((blend_mode == XRT_BLEND_MODE_OPAQUE) || (blend_mode == XRT_BLEND_MODE_ADDITIVE) ||
21 (blend_mode == XRT_BLEND_MODE_ALPHA_BLEND));
22}
23
24static inline bool
25u_verify_blend_mode_supported(struct xrt_device *xdev, enum xrt_blend_mode blend_mode)
26{
27 for (size_t i = 0; i < xdev->hmd->blend_mode_count; i++) {
28 if (xdev->hmd->blend_modes[i] == blend_mode) {
29 return true;
30 }
31 }
32 return false;
33}
34
35static inline bool
36u_verify_blend_factor_valid(enum xrt_blend_factor blend_factor)
37{
38 return (blend_factor == XRT_BLEND_FACTOR_ZERO) || (blend_factor == XRT_BLEND_FACTOR_ONE) ||
39 (blend_factor == XRT_BLEND_FACTOR_SRC_ALPHA) || (blend_factor == XRT_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA) ||
40 (blend_factor == XRT_BLEND_FACTOR_DST_ALPHA) || (blend_factor == XRT_BLEND_FACTOR_ONE_MINUS_DST_ALPHA);
41}
xrt_blend_mode
Blend mode that the device supports, exact mirror of XrEnvironmentBlendMode.
Definition: xrt_defines.h:109
xrt_blend_factor
Blend factors.
Definition: xrt_compositor.h:170
A single HMD or input device.
Definition: xrt_device.h:241
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition: xrt_device.h:253
enum xrt_blend_mode blend_modes[XRT_MAX_DEVICE_BLEND_MODES]
Array of supported blend modes.
Definition: xrt_device.h:116
Header declaring XRT graphics interfaces.
Common defines and enums for XRT.
Header defining an xrt display or controller device.