7#include <openxr/openxr.h>
8#include <openxr/openxr_platform.h>
9#include <openxr/openxr_reflection.h>
26#define XR_DISPATCH_TABLE_MEMBER(name) PFN_##name name{nullptr};
27#define XR_DISPATCH_TABLE_MEMBER_VOID(name) PFN_xrVoidFunction name{nullptr};
31#undef XR_DISPATCH_TABLE_DEFINE_MEMBER
32#undef XR_DISPATCH_TABLE_MEMBER_VOID
34 void Initialize(XrInstance instance, PFN_xrGetInstanceProcAddr getInstanceProcAddr) {
35 auto getFunctionPointer = [&](
const char* name) -> PFN_xrVoidFunction {
36 PFN_xrVoidFunction function =
nullptr;
37 (void)getInstanceProcAddr(instance, name, &function);
41#define XR_DISPATCH_TABLE_GET_PROC_ADDRESS(name) name = reinterpret_cast<PFN_##name>(getFunctionPointer(#name));
42#define XR_DISPATCH_TABLE_SET_NO_OP(name)
46#undef XR_DISPATCH_TABLE_GET_PROC_ADDRESS
47#undef XR_DISPATCH_TABLE_SET_NO_OP
53#ifdef ENABLE_GLOBAL_XR_DISPATCH_TABLE
56 inline DispatchTable g_dispatchTable{};
59 #define XR_DISPATCH_TABLE_GLOBAL(name) inline const PFN_##name& name = xr::g_dispatchTable. name;
60 #define XR_DISPATCH_TABLE_NO_OP(name)
62 #if !defined(XR_NO_PROTOTYPES)
69 #if !defined(XR_NO_PROTOTYPES) && defined(XR_EXTENSION_PROTOTYPES)
76 #undef XR_DISPATCH_TABLE_GLOBAL
77 #undef XR_DISPATCH_TABLE_NO_OP
#define XR_DISPATCH_TABLE_MEMBER(name)
#define XR_DISPATCH_TABLE_GET_PROC_ADDRESS(name)
#define XR_DISPATCH_TABLE_SET_NO_OP(name)
#define XR_DISPATCH_TABLE_MEMBER_VOID(name)
#define XR_LIST_FUNCTIONS_OPENXR_EXTENSIONS(_, __)
#define XR_LIST_FUNCTIONS_OPENXR_FUNCTIONS(_)
The xr::DispatchTable struct contains all available PFN pointers to xr functions including those in a...
XR_LIST_FUNCTIONS_OPENXR_FUNCTIONS(XR_DISPATCH_TABLE_MEMBER)
XR_LIST_FUNCTIONS_OPENXR_EXTENSIONS(XR_DISPATCH_TABLE_MEMBER, XR_DISPATCH_TABLE_MEMBER_VOID)
void Initialize(XrInstance instance, PFN_xrGetInstanceProcAddr getInstanceProcAddr)