mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
a641ce8955
Mention that oxr_xr* function prototypes go into src/xrt/state_trackers/oxr/oxr_api_funcs.h and move all other details after the bullet points about functions.
1.7 KiB
1.7 KiB
Implementing OpenXR extensions
Khronos often adds new functionality to the OpenXR specification as extensions.
The general steps to implement an OpenXR extension in Monado are as follows.
- Edit scripts/generate_oxr_ext_support.py. Usually you only need to add an
entry to the
EXTENSIONS
list at the top. - Run the script
python scripts/generate_oxr_ext_support.py
. - Format the regenerated file with
clang-format -i src/xrt/state_trackers/oxr/oxr_extension_support.h
. - Add entry points for each new function in
src/xrt/state_trackers/oxr/oxr_api_negotiate.c
. - Add Monado internal prototypes for the new functions in
src/xrt/state_trackers/oxr/oxr_api_funcs.h
. The Monado implementations of OpenXR functions are prefixed withoxr_
and use theXRAPI_ATTR
andXRAPI_CALL
macros to satisfy calling conventions for all platforms. - Implement the
oxr_
Monado internal functions in an appropriate source filesrc/state_trackers/oxr/oxr_api_*.c
. Trivial functions can be implemented right there along with the usual parameter checks. More complex functions that access more internal monado state should call functions implemented in the relevantoxr_*.c
file (without_api_
). The definitions for those functions go intosrc/xrt/state_trackers/oxr/oxr_objects.h
. - Monado internal implementations of "objects" (think XrSession or
XrHandTracker) go into
src/xrt/state_trackers/oxr/oxr_objects.h
. - Enums, defines and types go into
src/xrt/include/xrt/xrt_defines.h
. OpenXR types are typically not used outside of theoxr_api_*
files, instead equivalents with the prefixXRT_
are defined here.