The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: Refactor some things into oxr_defines.h

+103 -74
+102
src/xrt/state_trackers/oxr/oxr_defines.h
··· 1 + // Copyright 2018-2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Shared internal defines and enums in the state tracker. 6 + * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @ingroup oxr_main 8 + */ 9 + 10 + #pragma once 11 + 12 + #include "xrt/xrt_compiler.h" 13 + 14 + 15 + // For corruption and layer checking. 16 + // clang-format off 17 + #define OXR_XR_DEBUG_INSTANCE (*(uint64_t *)"oxrinst\0") 18 + #define OXR_XR_DEBUG_SESSION (*(uint64_t *)"oxrsess\0") 19 + #define OXR_XR_DEBUG_SPACE (*(uint64_t *)"oxrspac\0") 20 + #define OXR_XR_DEBUG_PATH (*(uint64_t *)"oxrpath\0") 21 + #define OXR_XR_DEBUG_ACTION (*(uint64_t *)"oxracti\0") 22 + #define OXR_XR_DEBUG_SWAPCHAIN (*(uint64_t *)"oxrswap\0") 23 + #define OXR_XR_DEBUG_ACTIONSET (*(uint64_t *)"oxraset\0") 24 + #define OXR_XR_DEBUG_MESSENGER (*(uint64_t *)"oxrmess\0") 25 + #define OXR_XR_DEBUG_SOURCESET (*(uint64_t *)"oxrsrcs\0") 26 + #define OXR_XR_DEBUG_SOURCE (*(uint64_t *)"oxrsrc_\0") 27 + #define OXR_XR_DEBUG_HTRACKER (*(uint64_t *)"oxrhtra\0") 28 + // clang-format on 29 + 30 + /*! 31 + * State of a handle base, to reduce likelihood of going "boom" on 32 + * out-of-order destruction or other unsavory behavior. 33 + * 34 + * @ingroup oxr_main 35 + */ 36 + enum oxr_handle_state 37 + { 38 + /*! State during/before oxr_handle_init, or after failure */ 39 + OXR_HANDLE_STATE_UNINITIALIZED = 0, 40 + 41 + /*! State after successful oxr_handle_init */ 42 + OXR_HANDLE_STATE_LIVE, 43 + 44 + /*! State after successful oxr_handle_destroy */ 45 + OXR_HANDLE_STATE_DESTROYED, 46 + }; 47 + 48 + /*! 49 + * Sub action paths. 50 + * 51 + * @ingroup oxr_main 52 + */ 53 + enum oxr_subaction_path 54 + { 55 + OXR_SUB_ACTION_PATH_USER, 56 + OXR_SUB_ACTION_PATH_HEAD, 57 + OXR_SUB_ACTION_PATH_LEFT, 58 + OXR_SUB_ACTION_PATH_RIGHT, 59 + OXR_SUB_ACTION_PATH_GAMEPAD, 60 + }; 61 + 62 + /*! 63 + * Region of a dpad binding that an input is mapped to 64 + * 65 + * @ingroup oxr_main 66 + */ 67 + enum oxr_dpad_region 68 + { 69 + OXR_DPAD_REGION_CENTER = 0u, 70 + OXR_DPAD_REGION_UP = (1u << 0u), 71 + OXR_DPAD_REGION_DOWN = (1u << 1u), 72 + OXR_DPAD_REGION_LEFT = (1u << 2u), 73 + OXR_DPAD_REGION_RIGHT = (1u << 3u), 74 + }; 75 + 76 + /*! 77 + * Tracks the state of a image that belongs to a @ref oxr_swapchain. 78 + * 79 + * @ingroup oxr_main 80 + */ 81 + enum oxr_image_state 82 + { 83 + OXR_IMAGE_STATE_READY, 84 + OXR_IMAGE_STATE_ACQUIRED, 85 + OXR_IMAGE_STATE_WAITED, 86 + }; 87 + 88 + /*! 89 + * Internal enum for the type of space, lets us reason about action spaces. 90 + * 91 + * @ingroup oxr_main 92 + */ 93 + enum oxr_space_type 94 + { 95 + OXR_SPACE_TYPE_REFERENCE_VIEW = 1, 96 + OXR_SPACE_TYPE_REFERENCE_LOCAL = 2, 97 + OXR_SPACE_TYPE_REFERENCE_STAGE = 3, 98 + OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT, 99 + OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO, 100 + 101 + OXR_SPACE_TYPE_ACTION, 102 + };
+1 -74
src/xrt/state_trackers/oxr/oxr_objects.h
··· 28 28 29 29 #include "oxr_extension_support.h" 30 30 #include "oxr_subaction.h" 31 + #include "oxr_defines.h" 31 32 32 33 #if defined(XRT_HAVE_D3D11) || defined(XRT_HAVE_D3D12) 33 34 #include <dxgi.h> ··· 86 87 * @{ 87 88 */ 88 89 89 - // For corruption and layer checking. 90 - // clang-format off 91 - #define OXR_XR_DEBUG_INSTANCE (*(uint64_t *)"oxrinst\0") 92 - #define OXR_XR_DEBUG_SESSION (*(uint64_t *)"oxrsess\0") 93 - #define OXR_XR_DEBUG_SPACE (*(uint64_t *)"oxrspac\0") 94 - #define OXR_XR_DEBUG_PATH (*(uint64_t *)"oxrpath\0") 95 - #define OXR_XR_DEBUG_ACTION (*(uint64_t *)"oxracti\0") 96 - #define OXR_XR_DEBUG_SWAPCHAIN (*(uint64_t *)"oxrswap\0") 97 - #define OXR_XR_DEBUG_ACTIONSET (*(uint64_t *)"oxraset\0") 98 - #define OXR_XR_DEBUG_MESSENGER (*(uint64_t *)"oxrmess\0") 99 - #define OXR_XR_DEBUG_SOURCESET (*(uint64_t *)"oxrsrcs\0") 100 - #define OXR_XR_DEBUG_SOURCE (*(uint64_t *)"oxrsrc_\0") 101 - #define OXR_XR_DEBUG_HTRACKER (*(uint64_t *)"oxrhtra\0") 102 - // clang-format on 103 - 104 90 105 91 /* 106 92 * ··· 145 131 */ 146 132 typedef XrResult (*oxr_handle_destroyer)(struct oxr_logger *log, struct oxr_handle_base *hb); 147 133 148 - /*! 149 - * State of a handle base, to reduce likelihood of going "boom" on 150 - * out-of-order destruction or other unsavory behavior. 151 - */ 152 - enum oxr_handle_state 153 - { 154 - /*! State during/before oxr_handle_init, or after failure */ 155 - OXR_HANDLE_STATE_UNINITIALIZED = 0, 156 - 157 - /*! State after successful oxr_handle_init */ 158 - OXR_HANDLE_STATE_LIVE, 159 - 160 - /*! State after successful oxr_handle_destroy */ 161 - OXR_HANDLE_STATE_DESTROYED, 162 - }; 163 - 164 - /*! 165 - * Sub action paths. 166 - */ 167 - enum oxr_subaction_path 168 - { 169 - OXR_SUB_ACTION_PATH_USER, 170 - OXR_SUB_ACTION_PATH_HEAD, 171 - OXR_SUB_ACTION_PATH_LEFT, 172 - OXR_SUB_ACTION_PATH_RIGHT, 173 - OXR_SUB_ACTION_PATH_GAMEPAD, 174 - }; 175 - 176 - /*! 177 - * Region of a dpad binding that an input is mapped to 178 - */ 179 - enum oxr_dpad_region 180 - { 181 - OXR_DPAD_REGION_CENTER = 0u, 182 - OXR_DPAD_REGION_UP = (1u << 0u), 183 - OXR_DPAD_REGION_DOWN = (1u << 1u), 184 - OXR_DPAD_REGION_LEFT = (1u << 2u), 185 - OXR_DPAD_REGION_RIGHT = (1u << 3u), 186 - }; 187 - 188 - /*! 189 - * Tracks the state of a image that belongs to a @ref oxr_swapchain. 190 - */ 191 - enum oxr_image_state 192 - { 193 - OXR_IMAGE_STATE_READY, 194 - OXR_IMAGE_STATE_ACQUIRED, 195 - OXR_IMAGE_STATE_WAITED, 196 - }; 197 134 198 135 199 136 /* ··· 2013 1950 * @} 2014 1951 */ 2015 1952 2016 - enum oxr_space_type 2017 - { 2018 - OXR_SPACE_TYPE_REFERENCE_VIEW = 1, 2019 - OXR_SPACE_TYPE_REFERENCE_LOCAL = 2, 2020 - OXR_SPACE_TYPE_REFERENCE_STAGE = 3, 2021 - OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT, 2022 - OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO, 2023 - 2024 - OXR_SPACE_TYPE_ACTION, 2025 - }; 2026 1953 2027 1954 static inline bool 2028 1955 oxr_space_type_is_reference(enum oxr_space_type space_type)