Monado OpenXR Runtime
Loading...
Searching...
No Matches
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)
33
34
#define OXR_CHECK_XRET_ALWAYS_RET(LOG, SESS, RESULTS, FUNCTION) \
35
do { \
36
OXR_CHECK_XRET(LOG, SESS, RESULTS, FUNCTION); \
37
return XR_SUCCESS; \
38
} while (false)
39
40
#define OXR_CHECK_XRET_GOTO(LOG, SESS, RESULTS, FUNCTION, XR_RES, GOTO_LABEL) \
41
do { \
42
xrt_result_t check_ret = (RESULTS); \
43
if (check_ret == XRT_ERROR_IPC_FAILURE) { \
44
(SESS)->has_lost = true; \
45
XR_RES = oxr_error(LOG, XR_ERROR_INSTANCE_LOST, "Call to " #FUNCTION " failed"); \
46
goto GOTO_LABEL; \
47
} \
48
if (check_ret != XRT_SUCCESS) { \
49
XR_RES = oxr_error(LOG, XR_ERROR_RUNTIME_FAILURE, "Call to " #FUNCTION " failed"); \
50
goto GOTO_LABEL; \
51
} \
52
} while (false)
oxr_objects.h
The objects representing OpenXR handles, and prototypes for internal functions used in the state trac...
xrt_results.h
Internal result type for XRT.
state_trackers
oxr
oxr_xret.h
Generated by
1.9.8