Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_api_verify.h
Go to the documentation of this file.
1// Copyright 2018-2024, Collabora, Ltd.
2// Copyright 2025-2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief File for verifying app input into api functions.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Korcan Hussein <korcan.hussein@collabora.com>
9 * @ingroup oxr_api
10 */
11
12#pragma once
13
14#include "xrt/xrt_limits.h"
15
16#include "oxr_frame_sync.h" // iwyu pragma: keep
17
18#include <stddef.h>
19
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25struct oxr_action_set;
27struct oxr_instance;
28struct oxr_system;
29struct oxr_logger;
31
32#define OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_thing, THING, name, lookup) \
33 do { \
34 oxr_log_init(log, name); \
35 if (thing == XR_NULL_HANDLE) { \
36 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #thing " == NULL)"); \
37 } \
38 new_thing = (struct oxr_thing *)((uintptr_t)thing); \
39 if (new_thing->handle.debug != OXR_XR_DEBUG_##THING) { \
40 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #thing " == %p)", (void *)new_thing); \
41 } \
42 if (new_thing->handle.state != OXR_HANDLE_STATE_LIVE) { \
43 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #thing " == %p) state == %s", \
44 (void *)new_thing, oxr_handle_state_to_string(new_thing->handle.state)); \
45 } \
46 oxr_log_set_instance(log, lookup); \
47 } while (0)
48
49#define OXR_VERIFY_PARENT_AND_SET_AND_INIT(log, thing, new_thing, oxr_thing, THING, name, lookup) \
50 do { \
51 oxr_log_init(log, name); \
52 if (thing == XR_NULL_HANDLE) { \
53 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #thing " == NULL)"); \
54 } \
55 new_thing = (struct oxr_thing *)((uintptr_t)thing); \
56 if (new_thing->handle.base.debug != OXR_XR_DEBUG_##THING) { \
57 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #thing " == %p)", (void *)new_thing); \
58 } \
59 if (new_thing->handle.base.state != OXR_HANDLE_STATE_LIVE) { \
60 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #thing " == %p) state == %s", \
61 (void *)new_thing, oxr_handle_state_to_string(new_thing->handle.base.state)); \
62 } \
63 oxr_log_set_instance(log, lookup); \
64 } while (0)
65
66#define OXR_VERIFY_SET(log, arg, new_arg, oxr_thing, THING) \
67 do { \
68 if (arg == XR_NULL_HANDLE) { \
69 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #arg " == NULL)"); \
70 } \
71 new_arg = (struct oxr_thing *)((uintptr_t)arg); \
72 if (new_arg->handle.debug != OXR_XR_DEBUG_##THING) { \
73 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #arg " == %p)", (void *)new_arg); \
74 } \
75 } while (0)
76
77#define OXR_VERIFY_PARENT_SET(log, arg, new_arg, oxr_thing, THING) \
78 do { \
79 if (arg == XR_NULL_HANDLE) { \
80 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #arg " == NULL)"); \
81 } \
82 new_arg = (struct oxr_thing *)((uintptr_t)arg); \
83 if (new_arg->handle.base.debug != OXR_XR_DEBUG_##THING) { \
84 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #arg " == %p)", (void *)new_arg); \
85 } \
86 } while (0)
87
88
89/*!
90 * @addtogroup oxr_api
91 * @{
92 */
93
94// clang-format off
95#define OXR_VERIFY_INSTANCE_AND_INIT_LOG(log, thing, new_thing, name) \
96 OXR_VERIFY_PARENT_AND_SET_AND_INIT(log, thing, new_thing, oxr_instance, INSTANCE, name, new_thing)
97#define OXR_VERIFY_MESSENGER_AND_INIT_LOG(log, thing, new_thing, name) \
98 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_messenger, MESSENGER, name, new_thing->inst)
99#define OXR_VERIFY_SESSION_AND_INIT_LOG(log, thing, new_thing, name) \
100 OXR_VERIFY_PARENT_AND_SET_AND_INIT(log, thing, new_thing, oxr_session, SESSION, name, new_thing->sys->inst)
101#define OXR_VERIFY_SPACE_AND_INIT_LOG(log, thing, new_thing, name) \
102 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_space, SPACE, name, new_thing->sess->sys->inst)
103#define OXR_VERIFY_ACTION_AND_INIT_LOG(log, thing, new_thing, name) \
104 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_action, ACTION, name, new_thing->act_set->inst)
105#define OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(log, thing, new_thing, name) \
106 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_swapchain, SWAPCHAIN, name, new_thing->sess->sys->inst)
107#define OXR_VERIFY_ACTIONSET_AND_INIT_LOG(log, thing, new_thing, name) \
108 OXR_VERIFY_PARENT_AND_SET_AND_INIT(log, thing, new_thing, oxr_action_set, ACTIONSET, name, new_thing->inst)
109#define OXR_VERIFY_HAND_TRACKER_AND_INIT_LOG(log, thing, new_thing, name) \
110 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_hand_tracker, HTRACKER, name, new_thing->sess->sys->inst)
111#define OXR_VERIFY_FORCE_FEEDBACK_AND_INIT_LOG(log, thing, new_thing, name) \
112 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_force_feedback, FFB, name, new_thing->sess->sys->inst)
113#define OXR_VERIFY_PASSTHROUGH_AND_INIT_LOG(log, thing, new_thing, name) \
114 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_passthrough, PASSTHROUGH, name, new_thing->sess->sys->inst)
115#define OXR_VERIFY_PASSTHROUGH_LAYER_AND_INIT_LOG(log, thing, new_thing, name) \
116 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_passthrough_layer, PASSTHROUGH_LAYER, name, new_thing->sess->sys->inst)
117#define OXR_VERIFY_FACE_TRACKER_HTC_AND_INIT_LOG(log, thing, new_thing, name) \
118 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_facial_tracker_htc, FTRACKER, name, new_thing->sess->sys->inst)
119#define OXR_VERIFY_FACE_TRACKER2_FB_AND_INIT_LOG(log, thing, new_thing, name) \
120 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_face_tracker2_fb, FTRACKER, name, new_thing->sess->sys->inst)
121#define OXR_VERIFY_BODY_TRACKER_FB_AND_INIT_LOG(log, thing, new_thing, name) \
122 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_body_tracker_fb, BTRACKER, name, new_thing->sess->sys->inst)
123#define OXR_VERIFY_BODY_TRACKER_BD_AND_INIT_LOG(log, thing, new_thing, name) \
124 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_body_tracker_bd, BTRACKER_BD, name, new_thing->sess->sys->inst)
125#define OXR_VERIFY_XDEVLIST_AND_INIT_LOG(log, thing, new_thing, name) \
126 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_xdev_list, XDEVLIST, name, new_thing->sess->sys->inst)
127#define OXR_VERIFY_PLANE_DETECTOR_AND_INIT_LOG(log, thing, new_thing, name) \
128 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_plane_detector_ext, PLANEDET, name, new_thing->sess->sys->inst)
129#define OXR_VERIFY_FUTURE_AND_INIT_LOG(log, thing, new_thing, name) \
130 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_future_ext, FUTURE, name, new_thing->inst); \
131 OXR_VERIFY_FUTURE_VALID(log, new_thing)
132#define OXR_VERIFY_FACE_TRACKER_ANDROID_AND_INIT_LOG(log, thing, new_thing, name) \
133 OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_face_tracker_android, FTRACKER, name, new_thing->sess->sys->inst)
134// clang-format on
135
136#define OXR_VERIFY_INSTANCE_NOT_NULL(log, arg, new_arg) \
137 OXR_VERIFY_PARENT_SET(log, arg, new_arg, oxr_instance, INSTANCE);
138#define OXR_VERIFY_MESSENGER_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_messenger, MESSENGER);
139#define OXR_VERIFY_SESSION_NOT_NULL(log, arg, new_arg) OXR_VERIFY_PARENT_SET(log, arg, new_arg, oxr_session, SESSION);
140#define OXR_VERIFY_SPACE_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_space, SPACE);
141#define OXR_VERIFY_ACTION_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_action, ACTION);
142#define OXR_VERIFY_SWAPCHAIN_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_swapchain, SWAPCHAIN);
143#define OXR_VERIFY_ACTIONSET_NOT_NULL(log, arg, new_arg) \
144 OXR_VERIFY_PARENT_SET(log, arg, new_arg, oxr_action_set, ACTIONSET);
145#define OXR_VERIFY_XDEVLIST_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_xdev_list, XDEVLIST);
146
147#define OXR_VERIFY_FUTURE_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_future_ext, FUTURE);
148/*!
149 * Checks if a required extension is enabled.
150 *
151 * mixed_case_name should be the extension name without the XR_ prefix.
152 */
153#define OXR_VERIFY_EXTENSION(log, inst, mixed_case_name) \
154 do { \
155 if (!(inst)->extensions.mixed_case_name) { \
156 return oxr_error((log), XR_ERROR_FUNCTION_UNSUPPORTED, \
157 "Requires XR_" #mixed_case_name " extension enabled"); \
158 } \
159 } while (false)
160
161/*!
162 * Checks if either one of two required extensions is enabled.
163 *
164 * mixed_case_name should be the extension name without the XR_ prefix.
165 */
166#define OXR_VERIFY_EXTENSIONS_OR(log, inst, mixed_case_name1, mixed_case_name2) \
167 do { \
168 if (!(inst)->extensions.mixed_case_name1 && !(inst)->extensions.mixed_case_name2) { \
169 return oxr_error((log), XR_ERROR_FUNCTION_UNSUPPORTED, \
170 "Requires XR_" #mixed_case_name1 "or XR_" #mixed_case_name2 \
171 " extension enabled"); \
172 } \
173 } while (false)
174
175/*!
176 * A condition if the instance is created with at least a given OpenXR version
177 */
178#define OXR_API_VERSION_AT_LEAST(inst, major, minor) \
179 ((inst)->openxr_version.major_minor >= XR_MAKE_VERSION(major, minor, 0))
180
181/*!
182 * Checks if the instance is created with at least a given OpenXR version
183 */
184#define OXR_VERIFY_API_VERSION_AT_LEAST(log, inst, major, minor) \
185 do { \
186 if (!OXR_VERSION_AT_LEAST(inst, major, minor)) { \
187 return oxr_error((log), XR_ERROR_FUNCTION_UNSUPPORTED, "Requires OpenXR version %d.%d.x", \
188 major, minor); \
189 } \
190 } while (false)
191
192#define OXR_VERIFY_ARG_NOT_NULL(log, arg) \
193 do { \
194 if (arg == NULL) { \
195 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "(" #arg " == NULL)"); \
196 } \
197 } while (false)
198
199#define OXR_VERIFY_ARG_NOT_ZERO(log, arg) \
200 do { \
201 if (arg == 0) { \
202 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "(" #arg " == 0) must be non-zero"); \
203 } \
204 } while (false)
205
206#define OXR_VERIFY_ARG_ZERO(log, arg) \
207 do { \
208 if (arg != 0) { \
209 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "(" #arg " == 0) must be zero"); \
210 } \
211 } while (false)
212
213#define OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum) \
214 do { \
215 if (arg != NULL && arg->type != type_enum) { \
216 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "(" #arg "->type == %u)", arg->type); \
217 } \
218 } while (false)
219
220#define OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(log, arg, type_enum) \
221 do { \
222 if (arg == NULL) { \
223 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "(" #arg " == NULL)"); \
224 } \
225 OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum); \
226 } while (false)
227
228/*!
229 * Must only be used with full typed arrays, aka non-basetyped arrays like that
230 * passed into xrEnumerateSwapchainImages.
231 */
232#define OXR_VERIFY_ARG_ARRAY_ELEMENT_TYPE(log, array, index, type_enum) \
233 do { \
234 if ((array)[index].type != type_enum) { \
235 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
236 "(" #array "[%u]->type == 0x%08x) expected 0x%08x", index, \
237 (array)[index].type, type_enum); \
238 } \
239 } while (false)
240
241#define OXR_VERIFY_TWO_CALL_ARRAY(log, inputCapacity, countOutput, array) \
242 do { \
243 OXR_VERIFY_ARG_NOT_NULL(log, countOutput); \
244 if (inputCapacity > 0) { \
245 OXR_VERIFY_ARG_NOT_NULL(log, array); \
246 } \
247 } while (false)
248
249#define OXR_VERIFY_TWO_CALL_ARRAY_AND_TYPE(log, inputCapacity, countOutput, array, type_enum) \
250 do { \
251 OXR_VERIFY_ARG_NOT_NULL(log, countOutput); \
252 if (inputCapacity > 0) { \
253 OXR_VERIFY_ARG_NOT_NULL(log, array); \
254 for (uint32_t i = 0; i < inputCapacity; ++i) { \
255 OXR_VERIFY_ARG_ARRAY_ELEMENT_TYPE(log, array, i, type_enum); \
256 } \
257 } \
258 } while (false)
259
260#define OXR_VERIFY_SUBACTION_PATHS(log, count, paths) \
261 do { \
262 if (count > 0 && paths == NULL) { \
263 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
264 "(" #count ") is not zero but " #paths " is NULL"); \
265 } \
266 } while (false)
267
268#define OXR_VERIFY_ARG_SINGLE_LEVEL_FIXED_LENGTH_PATH(log, path) \
269 do { \
270 XrResult verify_ret = oxr_verify_fixed_size_single_level_path(log, path, ARRAY_SIZE(path), #path); \
271 if (verify_ret != XR_SUCCESS) { \
272 return verify_ret; \
273 } \
274 } while (false)
275
276#define OXR_VERIFY_ARG_LOCALIZED_NAME(log, string) \
277 do { \
278 XrResult verify_ret = oxr_verify_localized_name(log, string, ARRAY_SIZE(string), #string); \
279 if (verify_ret != XR_SUCCESS) { \
280 return verify_ret; \
281 } \
282 } while (false)
283
284#define OXR_VERIFY_POSE(log, p) \
285 do { \
286 if (!math_quat_validate((struct xrt_quat *)&p.orientation)) { \
287 return oxr_error(log, XR_ERROR_POSE_INVALID, "(" #p ".orientation) is not a valid quat"); \
288 } \
289 \
290 if (!math_vec3_validate((struct xrt_vec3 *)&p.position)) { \
291 return oxr_error(log, XR_ERROR_POSE_INVALID, "(" #p ".position) is not valid"); \
292 } \
293 } while (false)
294
295#define OXR_VERIFY_FORM_FACTOR(log, form_factor) \
296 do { \
297 XrFormFactor _form_factor = (form_factor); \
298 if (_form_factor != XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY && \
299 _form_factor != XR_FORM_FACTOR_HANDHELD_DISPLAY) { \
300 \
301 return oxr_error(log, XR_ERROR_FORM_FACTOR_UNSUPPORTED, \
302 "(" #form_factor " == 0x%08x) is not a valid form factor", _form_factor); \
303 } \
304 } while (false)
305
306#define OXR_VERIFY_VIEW_CONFIG_TYPE(log, inst, view_conf) \
307 do { \
308 XrResult verify_ret = oxr_verify_view_config_type(log, inst, view_conf, #view_conf); \
309 if (verify_ret != XR_SUCCESS) { \
310 return verify_ret; \
311 } \
312 } while (false)
313
314#define OXR_VERIFY_VIEW_CONFIG_TYPE_SUPPORTED(log, sys, view_conf) \
315 do { \
316 XrResult verify_ret = oxr_verify_view_config_type_supported(log, sys, view_conf, #view_conf); \
317 if (verify_ret != XR_SUCCESS) { \
318 return verify_ret; \
319 } \
320 } while (false)
321
322#define OXR_VERIFY_VIEW_INDEX(log, index) \
323 do { \
324 if (index >= XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT) { \
325 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
326 "Invalid view index %d, only %d views supported", index, \
327 XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT); \
328 } \
329 } while (false)
330
331#define OXR_VERIFY_SWAPCHAIN_USAGE_FLAGS_NOT_MUTUALLY_EXCLUSIVE(log, flags, mutually_exclusive_a, \
332 mutually_exclusive_b) \
333 do { \
334 if (((flags) & (mutually_exclusive_a)) != 0 && ((flags) & (mutually_exclusive_b)) != 0) { \
335 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
336 "(" #flags ") Swapchain usage flags " #mutually_exclusive_a \
337 " and " #mutually_exclusive_b \
338 " are mutually exclusive in this graphics API"); \
339 } \
340 } while (false)
341
342#define OXR_VERIFY_SESSION_NOT_LOST(log, sess) \
343 do { \
344 if (sess->has_lost) { \
345 return oxr_error(log, XR_ERROR_SESSION_LOST, "Session is lost"); \
346 } \
347 } while (false)
348
349#define OXR_VERIFY_SESSION_RUNNING(log, sess) \
350 do { \
351 if (!oxr_frame_sync_is_session_running(&sess->frame_sync)) { \
352 return oxr_error(log, XR_ERROR_SESSION_NOT_RUNNING, "Session is not running"); \
353 } \
354 } while (false)
355
356#define OXR_VERIFY_PASSTHROUGH_FLAGS(log, flags) \
357 if (flags == 0 || \
358 (flags & (XR_PASSTHROUGH_IS_RUNNING_AT_CREATION_BIT_FB | XR_PASSTHROUGH_LAYER_DEPTH_BIT_FB)) == 0) \
359 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
360 "flags is not a valid combination of XrPassthroughFlagBitsFB values");
361
362#define OXR_VERIFY_PASSTHROUGH_LAYER_PURPOSE(log, purpose) \
363 if ((purpose != XR_PASSTHROUGH_LAYER_PURPOSE_RECONSTRUCTION_FB && \
364 purpose != XR_PASSTHROUGH_LAYER_PURPOSE_PROJECTED_FB && \
365 purpose != XR_PASSTHROUGH_LAYER_PURPOSE_TRACKED_KEYBOARD_HANDS_FB && \
366 purpose != XR_PASSTHROUGH_LAYER_PURPOSE_TRACKED_KEYBOARD_MASKED_HANDS_FB)) \
367 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
368 "purpose is not a valid XrPassthroughLayerPurposeFB value");
369
370#define OXR_VERIFY_PASSTHROUGH_LAYER_STYLE(log, style) \
371 do { \
372 uint32_t duplicate_check = 0; \
373 const XrPassthroughStyleFB *next = style->next; \
374 while (next) { \
375 if (next->type != XR_TYPE_PASSTHROUGH_COLOR_MAP_MONO_TO_RGBA_FB && \
376 next->type != XR_TYPE_PASSTHROUGH_COLOR_MAP_MONO_TO_MONO_FB && \
377 next->type != XR_TYPE_PASSTHROUGH_BRIGHTNESS_CONTRAST_SATURATION_FB) \
378 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
379 "style next structure chain contains invalid pointers"); \
380 if ((next->type & duplicate_check) != 0) \
381 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
382 "style next structure chain contains duplicate items"); \
383 duplicate_check |= next->type; \
384 next = (const XrPassthroughStyleFB *)next->next; \
385 } \
386 } while (false)
387
388#define OXR_VERIFY_HAND_TRACKING_DATA_SOURCE_OR_NULL(log, data_source_info) \
389 do { \
390 if (data_source_info != NULL) { \
391 XrResult verify_ret = oxr_verify_XrHandTrackingDataSourceInfoEXT(log, data_source_info); \
392 if (verify_ret != XR_SUCCESS) { \
393 return verify_ret; \
394 } \
395 } \
396 } while (false)
397
398#define OXR_VERIFY_FUTURE_VALID(LOG, OXR_FT) \
399 do { \
400 if (OXR_FT->xft == NULL) { \
401 return oxr_error(LOG, XR_ERROR_FUTURE_INVALID_EXT, "future is not valid"); \
402 } \
403 } while (false)
404
405#define OXR_VERIFY_ARG_TIME_NOT_ZERO(log, xr_time) \
406 do { \
407 if (xr_time <= (XrTime)0) { \
408 return oxr_error(log, XR_ERROR_TIME_INVALID, "(time == %" PRIi64 ") is not a valid time.", \
409 xr_time); \
410 } \
411 } while (false)
412
413
414/*
415 *
416 * Implementation in oxr_verify.cpp
417 *
418 */
419
420XrResult
421oxr_verify_full_path_c(struct oxr_logger *log, const char *path, const char *name);
422
423/*!
424 * Verify a full path.
425 *
426 * Length not including zero terminator character but must be there.
427 */
428XrResult
429oxr_verify_full_path(struct oxr_logger *log, const char *path, size_t length, const char *name);
430
431/*!
432 * Verify a single path level that sits inside of a fixed sized array.
433 */
434XrResult
436 const char *path,
437 uint32_t array_size,
438 const char *name);
439
440/*!
441 * Verify an arbitrary UTF-8 string that sits inside of a fixed sized array.
442 */
443XrResult
444oxr_verify_localized_name(struct oxr_logger * /*log*/, const char *string, uint32_t array_size, const char *name);
445
446/*!
447 * Verify a set of subaction paths for action creation.
448 */
449XrResult
451 struct oxr_instance *inst,
452 uint32_t countSubactionPaths,
453 const XrPath *subactionPaths,
454 const char *variable);
455
456/*!
457 * Verify a set of subaction paths for action sync.
458 */
459XrResult
461 const struct oxr_instance *inst,
462 const struct oxr_action_set *act_set,
463 XrPath path,
464 uint32_t index);
465
466/*!
467 * Verify a set of subaction paths for action state get.
468 */
469XrResult
471 struct oxr_instance *inst,
472 XrPath path,
473 const struct oxr_subaction_paths *act_subaction_paths,
474 struct oxr_subaction_paths *out_subaction_paths,
475 const char *variable);
476
477/*!
478 * Verify an array of action sets, the array must have at least one element.
479 *
480 * @param log Logger for error reporting.
481 * @param countActionSets Number of action sets in the array (must be > 0).
482 * @param actionSets Array of XrActionSet handles (must be non-NULL).
483 * @param variable_name Name of the argument for error messages (e.g. "bindInfo->actionSets" or
484 * "createInfo->actionSets").
485 */
486XrResult
488 uint32_t countActionSets,
489 const XrActionSet *actionSets,
490 const char *variable_name);
491
492/*!
493 * Verify an array of active action sets for xrSyncActions: each action set
494 * handle is valid and each subaction path is valid for that action set.
495 *
496 * @param log Logger for error reporting.
497 * @param inst Instance for path verification.
498 * @param countActiveActionSets Number of active action sets in the array.
499 * @param activeActionSets Array of XrActiveActionSet must be non-NULL.
500 * @param variable_name Name of the argument for error messages (e.g. "syncInfo->activeActionSets").
501 */
502XrResult
504 const struct oxr_instance *inst,
505 uint32_t countActiveActionSets,
506 const XrActiveActionSet *activeActionSets,
507 const char *variable_name);
508
509XrResult
510oxr_verify_extensions(struct oxr_logger *log, const struct oxr_extension_status *extensions);
511
512XrResult
513oxr_verify_view_config_type(struct oxr_logger *log,
514 struct oxr_instance *inst,
515 XrViewConfigurationType view_conf,
516 const char *view_conf_name);
517
518XrResult
519oxr_verify_view_config_type_supported(struct oxr_logger *log,
520 struct oxr_system *sys,
521 XrViewConfigurationType view_conf,
522 const char *view_conf_name);
523
524XrResult
525oxr_verify_XrSessionCreateInfo(struct oxr_logger * /*log*/,
526 const struct oxr_instance * /*inst*/,
527 const XrSessionCreateInfo * /*createInfo*/);
528
529#if defined(XR_USE_PLATFORM_XLIB) && defined(XR_USE_GRAPHICS_API_OPENGL)
530XrResult
531oxr_verify_XrGraphicsBindingOpenGLXlibKHR(struct oxr_logger * /*log*/, const XrGraphicsBindingOpenGLXlibKHR * /*next*/);
532#endif // defined(XR_USE_PLATFORM_XLIB) && defined(XR_USE_GRAPHICS_API_OPENGL)
533
534#if defined(XR_USE_PLATFORM_WIN32) && defined(XR_USE_GRAPHICS_API_OPENGL)
535XrResult
536oxr_verify_XrGraphicsBindingOpenGLWin32KHR(struct oxr_logger * /*log*/,
537 const XrGraphicsBindingOpenGLWin32KHR * /*next*/);
538#endif // defined(XR_USE_PLATFORM_WIN32) && defined(XR_USE_GRAPHICS_API_OPENGL)
539
540#if defined(XR_USE_GRAPHICS_API_VULKAN)
541XrResult
542oxr_verify_XrGraphicsBindingVulkanKHR(struct oxr_logger * /*log*/, const XrGraphicsBindingVulkanKHR * /*next*/);
543#endif // defined(XR_USE_GRAPHICS_API_VULKAN)
544
545#if defined(XR_USE_PLATFORM_EGL)
546XrResult
547oxr_verify_XrGraphicsBindingEGLMNDX(struct oxr_logger *log, const XrGraphicsBindingEGLMNDX *next);
548#endif // defined(XR_USE_PLATFORM_EGL)
549
550#if defined(XR_USE_PLATFORM_ANDROID) && defined(XR_USE_GRAPHICS_API_OPENGL_ES)
551XrResult
552oxr_verify_XrGraphicsBindingOpenGLESAndroidKHR(struct oxr_logger *, const XrGraphicsBindingOpenGLESAndroidKHR *);
553#endif // defined(XR_USE_PLATFORM_ANDROID) &&
554 // defined(XR_USE_GRAPHICS_API_OPENGL_ES)
555
556#if defined(XR_USE_GRAPHICS_API_D3D11)
557XrResult
558oxr_verify_XrGraphicsBindingD3D11KHR(struct oxr_logger *, const XrGraphicsBindingD3D11KHR *);
559#endif // defined(XR_USE_GRAPHICS_API_D3D11)
560
561#if defined(XR_USE_GRAPHICS_API_D3D12)
562XrResult
563oxr_verify_XrGraphicsBindingD3D12KHR(struct oxr_logger *, const XrGraphicsBindingD3D12KHR *);
564#endif // defined(XR_USE_GRAPHICS_API_D3D12)
565
566#ifdef XR_EXT_dpad_binding
567XrResult
568oxr_verify_XrInteractionProfileDpadBindingEXT(struct oxr_logger *,
569 const XrInteractionProfileDpadBindingEXT *,
570 const char *error_prefix);
571#endif // XR_EXT_dpad_binding
572
573#ifdef OXR_HAVE_EXT_hand_tracking_data_source
574XrResult
575oxr_verify_XrHandTrackingDataSourceInfoEXT(struct oxr_logger *, const XrHandTrackingDataSourceInfoEXT *);
576#endif // XR_EXT_hand_tracking_data_source
577
578/*!
579 * @}
580 */
581
582
583#ifdef __cplusplus
584}
585#endif
XrResult oxr_verify_subaction_paths_create(struct oxr_logger *log, struct oxr_instance *inst, uint32_t countSubactionPaths, const XrPath *subactionPaths, const char *variable)
Verify a set of subaction paths for action creation.
Definition oxr_verify.c:302
XrResult oxr_verify_subaction_path_sync(struct oxr_logger *log, const struct oxr_instance *inst, const struct oxr_action_set *act_set, XrPath path, uint32_t index)
Verify a set of subaction paths for action sync.
Definition oxr_verify.c:323
XrResult oxr_verify_fixed_size_single_level_path(struct oxr_logger *, const char *path, uint32_t array_size, const char *name)
Verify a single path level that sits inside of a fixed sized array.
Definition oxr_verify.c:67
XrResult oxr_verify_active_action_sets_sync(struct oxr_logger *log, const struct oxr_instance *inst, uint32_t countActiveActionSets, const XrActiveActionSet *activeActionSets, const char *variable_name)
Verify an array of active action sets for xrSyncActions: each action set handle is valid and each sub...
Definition oxr_verify.c:469
XrResult oxr_verify_subaction_path_get(struct oxr_logger *log, struct oxr_instance *inst, XrPath path, const struct oxr_subaction_paths *act_subaction_paths, struct oxr_subaction_paths *out_subaction_paths, const char *variable)
Verify a set of subaction paths for action state get.
Definition oxr_verify.c:353
XrResult oxr_verify_action_sets_array(struct oxr_logger *log, uint32_t countActionSets, const XrActionSet *actionSets, const char *variable_name)
Verify an array of action sets, the array must have at least one element.
Definition oxr_verify.c:441
XrResult oxr_verify_full_path(struct oxr_logger *log, const char *path, size_t length, const char *name)
Verify a full path.
Definition oxr_verify.c:142
XrResult oxr_verify_localized_name(struct oxr_logger *, const char *string, uint32_t array_size, const char *name)
Verify an arbitrary UTF-8 string that sits inside of a fixed sized array.
Definition oxr_verify.c:98
The objects that handle session running status and blocking of xrWaitFrame.
A group of actions.
Definition oxr_objects.h:1900
Structure tracking which extensions are enabled for a given instance.
Definition oxr_objects.h:1157
Main object that ties everything together.
Definition oxr_objects.h:1173
Logger struct that lives on the stack, one for each call client call.
Definition oxr_logger.h:44
A parsed equivalent of a list of sub-action paths.
Definition oxr_subaction.h:99
Single or multiple devices grouped together to form a system that sessions can be created from.
Definition oxr_objects.h:1083
Header for limits of the XRT interfaces.