Monado OpenXR Runtime
oxr_xret.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief File holding helper for @ref xrt_result_t results.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup oxr_main
8 */
9
10#pragma once
11
12#include "xrt/xrt_results.h"
13#include "oxr_objects.h"
14
15
16/*!
17 * Helper define to check results from 'xrt_` functions (@ref xrt_result_t) and
18 * also set any needed state.
19 *
20 * @ingroup oxr_main
21 */
22#define OXR_CHECK_XRET(LOG, SESS, RESULTS, FUNCTION) \
23 do { \
24 xrt_result_t check_ret = (RESULTS); \
25 if (check_ret == XRT_ERROR_IPC_FAILURE) { \
26 (SESS)->has_lost = true; \
27 return oxr_error(log, XR_ERROR_INSTANCE_LOST, "Call to " #FUNCTION " failed"); \
28 } \
29 if (check_ret != XRT_SUCCESS) { \
30 return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "Call to " #FUNCTION " failed"); \
31 } \
32 } while (false)
The objects representing OpenXR handles, and prototypes for internal functions used in the state trac...
Internal result type for XRT.