The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

st/oxr: Add helper for xrt_result_t checking

+32
+32
src/xrt/state_trackers/oxr/oxr_xret.h
··· 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)