VTK: Rendering/OpenXR/XrGraphicsExtensions.h Source File

| VTK 9.3.1

XrGraphicsExtensions.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
21 #ifndef XrGraphicsExtensions_h
22 #define XrGraphicsExtensions_h
23
24 #ifdef XR_USE_PLATFORM_WIN32
25 #define FOR_EACH_WIN32_EXTENSION_FUNCTION(_) _(xrConvertWin32PerformanceCounterToTimeKHR)
26 #else
27 #define FOR_EACH_WIN32_EXTENSION_FUNCTION(_)
28 #endif
29
30 #ifdef XR_USE_GRAPHICS_API_D3D11
31 #define FOR_EACH_D3D11_EXTENSION_FUNCTION(_) _(xrGetD3D11GraphicsRequirementsKHR)
32 #else
33 #define FOR_EACH_D3D11_EXTENSION_FUNCTION(_)
34 #endif
35
36 #ifdef XR_USE_GRAPHICS_API_OPENGL
37 #define FOR_EACH_OPENGL_EXTENSION_FUNCTION(_) _(xrGetOpenGLGraphicsRequirementsKHR)
38 #else
39 #define FOR_EACH_OPENGL_EXTENSION_FUNCTION(_)
40 #endif
41
42 #define FOR_EACH_EXTENSION_FUNCTION(_) \
43 FOR_EACH_WIN32_EXTENSION_FUNCTION(_) \
44 FOR_EACH_OPENGL_EXTENSION_FUNCTION(_) \
45 FOR_EACH_D3D11_EXTENSION_FUNCTION(_)
46
47 #define GET_INSTANCE_PROC_ADDRESS(name) \
48 (void)xrGetInstanceProcAddr( \
49 instance, #name, reinterpret_cast<PFN_xrVoidFunction*>(const_cast<PFN_##name*>(&name)));
50 #define DEFINE_PROC_MEMBER(name) PFN_##name name{ nullptr };
51
52 namespace xr
53 {
54 VTK_ABI_NAMESPACE_BEGIN
55 struct GraphicsExtensionDispatchTable
56 {
57 FOR_EACH_EXTENSION_FUNCTION(DEFINE_PROC_MEMBER);
58
59 GraphicsExtensionDispatchTable() = default;
60 void PopulateDispatchTable(XrInstance instance)
61 {
62 FOR_EACH_EXTENSION_FUNCTION(GET_INSTANCE_PROC_ADDRESS);
63 }
64 };
65 VTK_ABI_NAMESPACE_END
66 } // namespace xr
67
68 #undef DEFINE_PROC_MEMBER
69 #undef GET_INSTANCE_PROC_ADDRESS
70 #undef FOR_EACH_EXTENSION_FUNCTION
71
72 #endif
DEFINE_PROC_MEMBER
#define DEFINE_PROC_MEMBER(name)
Definition: XrGraphicsExtensions.h:50
GET_INSTANCE_PROC_ADDRESS
#define GET_INSTANCE_PROC_ADDRESS(name)
Definition: XrGraphicsExtensions.h:47
xr
Definition: XrExtensions.h:119
xr::GraphicsExtensionDispatchTable
Definition: XrGraphicsExtensions.h:56
xr::GraphicsExtensionDispatchTable::FOR_EACH_EXTENSION_FUNCTION
FOR_EACH_EXTENSION_FUNCTION(DEFINE_PROC_MEMBER)
xr::GraphicsExtensionDispatchTable::GraphicsExtensionDispatchTable
GraphicsExtensionDispatchTable()=default
xr::GraphicsExtensionDispatchTable::PopulateDispatchTable
void PopulateDispatchTable(XrInstance instance)
Definition: XrGraphicsExtensions.h:60