VTK  9.3.0
XrExtensions.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) Microsoft
3// SPDX-License-Identifier: BSD-3-Clause AND Apache-2.0
19#ifndef XrExtensions_h
20#define XrExtensions_h
21
22#if XR_KHR_visibility_mask
23#define FOR_EACH_VISIBILITY_MASK_FUNCTION(_) _(xrGetVisibilityMaskKHR)
24#else
25#define FOR_EACH_VISIBILITY_MASK_FUNCTION(_)
26#endif
27
28#ifdef XR_MSFT_controller_model
29#define FOR_EACH_CONTROLLER_MODEL_EXTENSION_FUNCTION(_) \
30 _(xrGetControllerModelKeyMSFT) \
31 _(xrLoadControllerModelMSFT) \
32 _(xrGetControllerModelPropertiesMSFT) \
33 _(xrGetControllerModelStateMSFT)
34#else
35#define FOR_EACH_CONTROLLER_MODEL_EXTENSION_FUNCTION(_)
36#endif
37
38#if XR_MSFT_perception_anchor_interop && defined(XR_USE_PLATFORM_WIN32)
39#define FOR_EACH_PERCEPTION_ANCHOR_INTEROP_FUNCTION(_) \
40 _(xrCreateSpatialAnchorFromPerceptionAnchorMSFT) \
41 _(xrTryGetPerceptionAnchorFromSpatialAnchorMSFT)
42#else
43#define FOR_EACH_PERCEPTION_ANCHOR_INTEROP_FUNCTION(_)
44#endif
45
46#if XR_MSFT_spatial_anchor
47#define FOR_EACH_SPATIAL_ANCHOR_FUNCTION(_) \
48 _(xrCreateSpatialAnchorMSFT) \
49 _(xrCreateSpatialAnchorSpaceMSFT) \
50 _(xrDestroySpatialAnchorMSFT)
51#else
52#define FOR_EACH_SPATIAL_ANCHOR_FUNCTION(_)
53#endif
54
55#if XR_EXT_hand_tracking
56#define FOR_EACH_HAND_TRACKING_FUNCTION(_) \
57 _(xrCreateHandTrackerEXT) \
58 _(xrDestroyHandTrackerEXT) \
59 _(xrLocateHandJointsEXT)
60#else
61#define FOR_EACH_HAND_TRACKING_FUNCTION(_)
62#endif
63
64#if XR_MSFT_hand_tracking_mesh
65#define FOR_EACH_HAND_TRACKING_MESH_FUNCTION(_) \
66 _(xrCreateHandMeshSpaceMSFT) \
67 _(xrUpdateHandMeshMSFT)
68#else
69#define FOR_EACH_HAND_TRACKING_MESH_FUNCTION(_)
70#endif
71
72#if XR_MSFT_spatial_graph_bridge
73#define FOR_EACH_SPATIAL_GRAPH_BRIDGE_FUNCTION(_) _(xrCreateSpatialGraphNodeSpaceMSFT)
74#else
75#define FOR_EACH_SPATIAL_GRAPH_BRIDGE_FUNCTION(_)
76#endif
77
78#if XR_MSFT_scene_understanding_preview2
79#define FOR_EACH_SCENE_UNDERSTANDING_FUNCTION(_) \
80 _(xrCreateSceneObserverMSFT) \
81 _(xrDestroySceneObserverMSFT) \
82 _(xrCreateSceneMSFT) \
83 _(xrDestroySceneMSFT) \
84 _(xrComputeNewSceneMSFT) \
85 _(xrGetSceneComputeStateMSFT) \
86 _(xrGetSceneComponentsMSFT) \
87 _(xrLocateSceneComponentsMSFT) \
88 _(xrGetSceneMeshBuffersMSFT)
89#else
90#define FOR_EACH_SCENE_UNDERSTANDING_FUNCTION(_)
91#endif
92
93#if XR_MSFT_scene_understanding_serialization_preview
94#define FOR_EACH_SCENE_UNDERSTANDING_SERIALIZATION_FUNCTION(_) \
95 _(xrDeserializeSceneMSFT) \
96 _(xrGetSceneSerializedDataMSFT)
97
98#else
99#define FOR_EACH_SCENE_UNDERSTANDING_SERIALIZATION_FUNCTION(_)
100#endif
101
102#define FOR_EACH_EXTENSION_FUNCTION(_) \
103 FOR_EACH_VISIBILITY_MASK_FUNCTION(_) \
104 FOR_EACH_HAND_TRACKING_FUNCTION(_) \
105 FOR_EACH_HAND_TRACKING_MESH_FUNCTION(_) \
106 FOR_EACH_SPATIAL_GRAPH_BRIDGE_FUNCTION(_) \
107 FOR_EACH_SPATIAL_ANCHOR_FUNCTION(_) \
108 FOR_EACH_CONTROLLER_MODEL_EXTENSION_FUNCTION(_) \
109 FOR_EACH_PERCEPTION_ANCHOR_INTEROP_FUNCTION(_) \
110 FOR_EACH_SCENE_UNDERSTANDING_FUNCTION(_) \
111 FOR_EACH_SCENE_UNDERSTANDING_SERIALIZATION_FUNCTION(_)
112
113#define GET_INSTANCE_PROC_ADDRESS(name) \
114 (void)xrGetInstanceProcAddr( \
115 instance, #name, reinterpret_cast<PFN_xrVoidFunction*>(const_cast<PFN_##name*>(&name)));
116#define DEFINE_PROC_MEMBER(name) PFN_##name name{ nullptr };
117
118namespace xr
119{
120VTK_ABI_NAMESPACE_BEGIN
122{
124
126 void PopulateDispatchTable(XrInstance instance)
127 {
129 }
130};
131VTK_ABI_NAMESPACE_END
132} // namespace xr
133
134#undef DEFINE_PROC_MEMBER
135#undef GET_INSTANCE_PROC_ADDRESS
136#undef FOR_EACH_EXTENSION_FUNCTION
137
138#endif
#define DEFINE_PROC_MEMBER(name)
#define FOR_EACH_EXTENSION_FUNCTION(_)
#define GET_INSTANCE_PROC_ADDRESS(name)
void PopulateDispatchTable(XrInstance instance)
FOR_EACH_EXTENSION_FUNCTION(DEFINE_PROC_MEMBER)