Blender  V3.3
GHOST_XrContext.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
9 #include <algorithm>
10 #include <cassert>
11 #include <sstream>
12 #include <string>
13 #include <string_view>
14 
15 #include "GHOST_Types.h"
16 #include "GHOST_XrException.h"
17 #include "GHOST_XrSession.h"
18 #include "GHOST_Xr_intern.h"
19 
20 #include "GHOST_XrContext.h"
21 
23  XrInstance instance = XR_NULL_HANDLE;
24  XrInstanceProperties instance_properties = {};
25 
26  std::vector<XrExtensionProperties> extensions;
27  std::vector<XrApiLayerProperties> layers;
28 
29  static PFN_xrCreateDebugUtilsMessengerEXT s_xrCreateDebugUtilsMessengerEXT_fn;
30  static PFN_xrDestroyDebugUtilsMessengerEXT s_xrDestroyDebugUtilsMessengerEXT_fn;
31 
32  XrDebugUtilsMessengerEXT debug_messenger = XR_NULL_HANDLE;
33 };
34 
35 PFN_xrCreateDebugUtilsMessengerEXT OpenXRInstanceData::s_xrCreateDebugUtilsMessengerEXT_fn =
36  nullptr;
37 PFN_xrDestroyDebugUtilsMessengerEXT OpenXRInstanceData::s_xrDestroyDebugUtilsMessengerEXT_fn =
38  nullptr;
39 
40 GHOST_XrErrorHandlerFn GHOST_XrContext::s_error_handler = nullptr;
41 void *GHOST_XrContext::s_error_handler_customdata = nullptr;
42 
43 /* -------------------------------------------------------------------- */
47 GHOST_XrContext::GHOST_XrContext(const GHOST_XrContextCreateInfo *create_info)
48  : m_oxr(std::make_unique<OpenXRInstanceData>()),
49  m_debug(create_info->context_flag & GHOST_kXrContextDebug),
50  m_debug_time(create_info->context_flag & GHOST_kXrContextDebugTime)
51 {
52 }
53 
55 {
56  /* Destroy session data first. Otherwise xrDestroyInstance will implicitly do it, before the
57  * session had a chance to do so explicitly. */
58  m_session = nullptr;
59 
60  if (m_oxr->debug_messenger != XR_NULL_HANDLE) {
61  assert(m_oxr->s_xrDestroyDebugUtilsMessengerEXT_fn != nullptr);
62  m_oxr->s_xrDestroyDebugUtilsMessengerEXT_fn(m_oxr->debug_messenger);
63  }
64  if (m_oxr->instance != XR_NULL_HANDLE) {
65  CHECK_XR_ASSERT(xrDestroyInstance(m_oxr->instance));
66  m_oxr->instance = XR_NULL_HANDLE;
67  }
68 }
69 
70 void GHOST_XrContext::initialize(const GHOST_XrContextCreateInfo *create_info)
71 {
72  initApiLayers();
73  initExtensions();
74  if (isDebugMode()) {
75  printSDKVersion();
76  printAvailableAPILayersAndExtensionsInfo();
77  }
78 
79  /* Multiple graphics binding extensions can be enabled, but only one will actually be used
80  * (determined later on). */
81  const std::vector<GHOST_TXrGraphicsBinding> graphics_binding_types =
82  determineGraphicsBindingTypesToEnable(create_info);
83 
84  assert(m_oxr->instance == XR_NULL_HANDLE);
85  createOpenXRInstance(graphics_binding_types);
86  storeInstanceProperties();
87 
88  /* Multiple bindings may be enabled. Now that we know the runtime in use, settle for one. */
89  m_gpu_binding_type = determineGraphicsBindingTypeToUse(graphics_binding_types, create_info);
90 
91  printInstanceInfo();
92  if (isDebugMode()) {
93  initDebugMessenger();
94  }
95 }
96 
97 void GHOST_XrContext::createOpenXRInstance(
98  const std::vector<GHOST_TXrGraphicsBinding> &graphics_binding_types)
99 {
100  XrInstanceCreateInfo create_info = {XR_TYPE_INSTANCE_CREATE_INFO};
101 
102  std::string("Blender").copy(create_info.applicationInfo.applicationName,
103  XR_MAX_APPLICATION_NAME_SIZE);
104  create_info.applicationInfo.apiVersion = XR_CURRENT_API_VERSION;
105 
106  getAPILayersToEnable(m_enabled_layers);
107  getExtensionsToEnable(graphics_binding_types, m_enabled_extensions);
108  create_info.enabledApiLayerCount = m_enabled_layers.size();
109  create_info.enabledApiLayerNames = m_enabled_layers.data();
110  create_info.enabledExtensionCount = m_enabled_extensions.size();
111  create_info.enabledExtensionNames = m_enabled_extensions.data();
112  if (isDebugMode()) {
113  printExtensionsAndAPILayersToEnable();
114  }
115 
116  CHECK_XR(xrCreateInstance(&create_info, &m_oxr->instance),
117  "Failed to connect to an OpenXR runtime.");
118 }
119 
120 void GHOST_XrContext::storeInstanceProperties()
121 {
122  const std::map<std::string, GHOST_TXrOpenXRRuntimeID> runtime_map = {
123  {"Monado(XRT) by Collabora et al", OPENXR_RUNTIME_MONADO},
124  {"Oculus", OPENXR_RUNTIME_OCULUS},
125  {"SteamVR/OpenXR", OPENXR_RUNTIME_STEAMVR},
126  {"Windows Mixed Reality Runtime", OPENXR_RUNTIME_WMR},
127  {"Varjo OpenXR Runtime", OPENXR_RUNTIME_VARJO}};
128  decltype(runtime_map)::const_iterator runtime_map_iter;
129 
130  m_oxr->instance_properties.type = XR_TYPE_INSTANCE_PROPERTIES;
131  CHECK_XR(xrGetInstanceProperties(m_oxr->instance, &m_oxr->instance_properties),
132  "Failed to get OpenXR runtime information. Do you have an active runtime set up?");
133 
134  runtime_map_iter = runtime_map.find(m_oxr->instance_properties.runtimeName);
135  if (runtime_map_iter != runtime_map.end()) {
136  m_runtime_id = runtime_map_iter->second;
137  }
138 }
139  /* Create, Initialize and Destruct */
141 
142 /* -------------------------------------------------------------------- */
146 void GHOST_XrContext::printSDKVersion()
147 {
148  const XrVersion sdk_version = XR_CURRENT_API_VERSION;
149 
150  printf("OpenXR SDK Version: %u.%u.%u\n",
151  XR_VERSION_MAJOR(sdk_version),
152  XR_VERSION_MINOR(sdk_version),
153  XR_VERSION_PATCH(sdk_version));
154 }
155 
156 void GHOST_XrContext::printInstanceInfo()
157 {
158  assert(m_oxr->instance != XR_NULL_HANDLE);
159 
160  printf("Connected to OpenXR runtime: %s (Version %u.%u.%u)\n",
161  m_oxr->instance_properties.runtimeName,
162  XR_VERSION_MAJOR(m_oxr->instance_properties.runtimeVersion),
163  XR_VERSION_MINOR(m_oxr->instance_properties.runtimeVersion),
164  XR_VERSION_PATCH(m_oxr->instance_properties.runtimeVersion));
165 }
166 
167 void GHOST_XrContext::printAvailableAPILayersAndExtensionsInfo()
168 {
169  puts("Available OpenXR API-layers/extensions:");
170  for (XrApiLayerProperties &layer_info : m_oxr->layers) {
171  printf("Layer: %s\n", layer_info.layerName);
172  }
173  for (XrExtensionProperties &ext_info : m_oxr->extensions) {
174  printf("Extension: %s\n", ext_info.extensionName);
175  }
176 }
177 
178 void GHOST_XrContext::printExtensionsAndAPILayersToEnable()
179 {
180  for (const char *layer_name : m_enabled_layers) {
181  printf("Enabling OpenXR API-Layer: %s\n", layer_name);
182  }
183  for (const char *ext_name : m_enabled_extensions) {
184  printf("Enabling OpenXR Extension: %s\n", ext_name);
185  }
186 }
187 
188 static XrBool32 debug_messenger_func(XrDebugUtilsMessageSeverityFlagsEXT /*messageSeverity*/,
189  XrDebugUtilsMessageTypeFlagsEXT /*messageTypes*/,
190  const XrDebugUtilsMessengerCallbackDataEXT *callbackData,
191  void * /*userData*/)
192 {
193  puts("OpenXR Debug Message:");
194  puts(callbackData->message);
195  return XR_FALSE; /* OpenXR spec suggests always returning false. */
196 }
197 
198 void GHOST_XrContext::initDebugMessenger()
199 {
200  XrDebugUtilsMessengerCreateInfoEXT create_info = {XR_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT};
201 
202  /* Extension functions need to be obtained through xrGetInstanceProcAddr(). */
203  if (XR_FAILED(xrGetInstanceProcAddr(
204  m_oxr->instance,
205  "xrCreateDebugUtilsMessengerEXT",
206  (PFN_xrVoidFunction *)&m_oxr->s_xrCreateDebugUtilsMessengerEXT_fn)) ||
207  XR_FAILED(xrGetInstanceProcAddr(
208  m_oxr->instance,
209  "xrDestroyDebugUtilsMessengerEXT",
210  (PFN_xrVoidFunction *)&m_oxr->s_xrDestroyDebugUtilsMessengerEXT_fn))) {
211  m_oxr->s_xrCreateDebugUtilsMessengerEXT_fn = nullptr;
212  m_oxr->s_xrDestroyDebugUtilsMessengerEXT_fn = nullptr;
213 
214  fprintf(stderr,
215  "Could not use XR_EXT_debug_utils to enable debug prints. Not a fatal error, "
216  "continuing without the messenger.\n");
217  return;
218  }
219 
220  create_info.messageSeverities = XR_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
221  XR_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
222  XR_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
223  XR_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
224  create_info.messageTypes = XR_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
225  XR_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
226  XR_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
227  create_info.userCallback = debug_messenger_func;
228 
229  if (XR_FAILED(m_oxr->s_xrCreateDebugUtilsMessengerEXT_fn(
230  m_oxr->instance, &create_info, &m_oxr->debug_messenger))) {
231  fprintf(stderr,
232  "Failed to create OpenXR debug messenger. Not a fatal error, continuing without the "
233  "messenger.\n");
234  return;
235  }
236 }
237  /* Debug Printing */
239 
240 /* -------------------------------------------------------------------- */
245 {
246  GHOST_XrError error;
247 
248  error.user_message = exception->m_msg.data();
249  error.customdata = s_error_handler_customdata;
250 
251  if (isDebugMode()) {
252  fprintf(stderr,
253  "Error: \t%s\n\tOpenXR error value: %i\n",
254  error.user_message,
255  exception->m_result);
256  }
257 
258  /* Potentially destroys GHOST_XrContext */
259  s_error_handler(&error);
260 }
261 
262 void GHOST_XrContext::setErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata)
263 {
264  s_error_handler = handler_fn;
265  s_error_handler_customdata = customdata;
266 }
267  /* Error handling */
269 
270 /* -------------------------------------------------------------------- */
277 void GHOST_XrContext::initExtensionsEx(std::vector<XrExtensionProperties> &extensions,
278  const char *layer_name)
279 {
280  uint32_t extension_count = 0;
281 
282  /* Get count for array creation/init first. */
283  CHECK_XR(xrEnumerateInstanceExtensionProperties(layer_name, 0, &extension_count, nullptr),
284  "Failed to query OpenXR runtime information. Do you have an active runtime set up?");
285 
286  if (extension_count == 0) {
287  /* Extensions are optional, can successfully exit. */
288  return;
289  }
290 
291  for (uint32_t i = 0; i < extension_count; i++) {
292  XrExtensionProperties ext = {XR_TYPE_EXTENSION_PROPERTIES};
293  extensions.push_back(ext);
294  }
295 
296  /* Actually get the extensions. */
297  CHECK_XR(xrEnumerateInstanceExtensionProperties(
298  layer_name, extension_count, &extension_count, extensions.data()),
299  "Failed to query OpenXR runtime information. Do you have an active runtime set up?");
300 }
301 
302 void GHOST_XrContext::initExtensions()
303 {
304  initExtensionsEx(m_oxr->extensions, nullptr);
305 }
306 
307 void GHOST_XrContext::initApiLayers()
308 {
309  uint32_t layer_count = 0;
310 
311  /* Get count for array creation/init first. */
312  CHECK_XR(xrEnumerateApiLayerProperties(0, &layer_count, nullptr),
313  "Failed to query OpenXR runtime information. Do you have an active runtime set up?");
314 
315  if (layer_count == 0) {
316  /* Layers are optional, can safely exit. */
317  return;
318  }
319 
320  m_oxr->layers = std::vector<XrApiLayerProperties>(layer_count);
321  for (XrApiLayerProperties &layer : m_oxr->layers) {
322  layer.type = XR_TYPE_API_LAYER_PROPERTIES;
323  }
324 
325  /* Actually get the layers. */
326  CHECK_XR(xrEnumerateApiLayerProperties(layer_count, &layer_count, m_oxr->layers.data()),
327  "Failed to query OpenXR runtime information. Do you have an active runtime set up?");
328  for (XrApiLayerProperties &layer : m_oxr->layers) {
329  /* Each layer may have own extensions. */
330  initExtensionsEx(m_oxr->extensions, layer.layerName);
331  }
332 }
333 
334 static bool openxr_layer_is_available(const std::vector<XrApiLayerProperties> &layers_info,
335  const std::string &layer_name)
336 {
337  for (const XrApiLayerProperties &layer_info : layers_info) {
338  if (layer_info.layerName == layer_name) {
339  return true;
340  }
341  }
342 
343  return false;
344 }
345 
347  const std::vector<XrExtensionProperties> &extensions_info,
348  const std::string_view &extension_name)
349 {
350  for (const XrExtensionProperties &ext_info : extensions_info) {
351  if (ext_info.extensionName == extension_name) {
352  return true;
353  }
354  }
355 
356  return false;
357 }
358 
362 void GHOST_XrContext::getAPILayersToEnable(std::vector<const char *> &r_ext_names)
363 {
364  static std::vector<std::string> try_layers;
365 
366  try_layers.clear();
367 
368  if (isDebugMode()) {
369  try_layers.push_back("XR_APILAYER_LUNARG_core_validation");
370  }
371 
372  r_ext_names.reserve(try_layers.size());
373 
374  for (const std::string &layer : try_layers) {
375  if (openxr_layer_is_available(m_oxr->layers, layer)) {
376  r_ext_names.push_back(layer.data());
377  }
378  }
379 }
380 
381 static const char *openxr_ext_name_from_wm_gpu_binding(GHOST_TXrGraphicsBinding binding)
382 {
383  switch (binding) {
384  case GHOST_kXrGraphicsOpenGL:
385  return XR_KHR_OPENGL_ENABLE_EXTENSION_NAME;
386 #ifdef WIN32
387  case GHOST_kXrGraphicsD3D11:
388  return XR_KHR_D3D11_ENABLE_EXTENSION_NAME;
389 #endif
390  case GHOST_kXrGraphicsUnknown:
391  assert(!"Could not identify graphics binding to choose.");
392  return nullptr;
393  }
394 
395  return nullptr;
396 }
397 
401 void GHOST_XrContext::getExtensionsToEnable(
402  const std::vector<GHOST_TXrGraphicsBinding> &graphics_binding_types,
403  std::vector<const char *> &r_ext_names)
404 {
405  std::vector<std::string_view> try_ext;
406 
407  /* Try enabling debug extension. */
408  if (isDebugMode()) {
409  try_ext.push_back(XR_EXT_DEBUG_UTILS_EXTENSION_NAME);
410  }
411 
412  /* Interaction profile extensions. */
413  try_ext.push_back(XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
414  try_ext.push_back(XR_HTC_VIVE_COSMOS_CONTROLLER_INTERACTION_EXTENSION_NAME);
415 #ifdef XR_HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME
416  try_ext.push_back(XR_HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME);
417 #endif
418  try_ext.push_back(XR_HUAWEI_CONTROLLER_INTERACTION_EXTENSION_NAME);
419 
420  /* Controller model extension. */
421  try_ext.push_back(XR_MSFT_CONTROLLER_MODEL_EXTENSION_NAME);
422 
423  /* Varjo quad view extension. */
424  try_ext.push_back(XR_VARJO_QUAD_VIEWS_EXTENSION_NAME);
425 
426  /* Varjo foveated extension. */
427  try_ext.push_back(XR_VARJO_FOVEATED_RENDERING_EXTENSION_NAME);
428 
429  r_ext_names.reserve(try_ext.size() + graphics_binding_types.size());
430 
431  /* Add graphics binding extensions (may be multiple ones, we'll settle for one to use later, once
432  * we have more info about the runtime). */
433  for (GHOST_TXrGraphicsBinding type : graphics_binding_types) {
434  const char *gpu_binding = openxr_ext_name_from_wm_gpu_binding(type);
435  assert(openxr_extension_is_available(m_oxr->extensions, gpu_binding));
436  r_ext_names.push_back(gpu_binding);
437  }
438 
439 #if defined(WITH_GHOST_X11) && defined(WITH_GL_EGL)
440  assert(openxr_extension_is_available(m_oxr->extensions, XR_MNDX_EGL_ENABLE_EXTENSION_NAME));
441  r_ext_names.push_back(XR_MNDX_EGL_ENABLE_EXTENSION_NAME);
442 #endif
443 
444  for (const std::string_view &ext : try_ext) {
445  if (openxr_extension_is_available(m_oxr->extensions, ext)) {
446  r_ext_names.push_back(ext.data());
447  }
448  }
449 }
450 
455 std::vector<GHOST_TXrGraphicsBinding> GHOST_XrContext::determineGraphicsBindingTypesToEnable(
456  const GHOST_XrContextCreateInfo *create_info)
457 {
458  std::vector<GHOST_TXrGraphicsBinding> result;
459  assert(create_info->gpu_binding_candidates != NULL);
460  assert(create_info->gpu_binding_candidates_count > 0);
461 
462  for (uint32_t i = 0; i < create_info->gpu_binding_candidates_count; i++) {
463  assert(create_info->gpu_binding_candidates[i] != GHOST_kXrGraphicsUnknown);
464  const char *ext_name = openxr_ext_name_from_wm_gpu_binding(
465  create_info->gpu_binding_candidates[i]);
466  if (openxr_extension_is_available(m_oxr->extensions, ext_name)) {
467  result.push_back(create_info->gpu_binding_candidates[i]);
468  }
469  }
470 
471  if (result.empty()) {
472  throw GHOST_XrException("No supported graphics binding found.");
473  }
474 
475  return result;
476 }
477 
478 GHOST_TXrGraphicsBinding GHOST_XrContext::determineGraphicsBindingTypeToUse(
479  const std::vector<GHOST_TXrGraphicsBinding> &enabled_types,
480  const GHOST_XrContextCreateInfo *create_info)
481 {
482  /* Return the first working type. */
483  for (GHOST_TXrGraphicsBinding type : enabled_types) {
484 #ifdef WIN32
485  /* The SteamVR OpenGL backend currently fails for NVIDIA GPU's. Disable it and allow falling
486  * back to the DirectX one. */
487  if ((m_runtime_id == OPENXR_RUNTIME_STEAMVR) && (type == GHOST_kXrGraphicsOpenGL) &&
488  ((create_info->context_flag & GHOST_kXrContextGpuNVIDIA) != 0)) {
489  continue;
490  }
491 #else
492  ((void)create_info);
493 #endif
494 
495  assert(type != GHOST_kXrGraphicsUnknown);
496  return type;
497  }
498 
499  throw GHOST_XrException("Failed to determine a graphics binding to use.");
500 }
501  /* OpenXR API-Layers and Extensions */
503 
504 /* -------------------------------------------------------------------- */
510 void GHOST_XrContext::startSession(const GHOST_XrSessionBeginInfo *begin_info)
511 {
512  m_custom_funcs.session_create_fn = begin_info->create_fn;
513  m_custom_funcs.session_exit_fn = begin_info->exit_fn;
514  m_custom_funcs.session_exit_customdata = begin_info->exit_customdata;
515 
516  if (m_session == nullptr) {
517  m_session = std::make_unique<GHOST_XrSession>(*this);
518  }
519  m_session->start(begin_info);
520 }
521 
523 {
524  if (m_session) {
525  if (m_session->isRunning()) {
526  m_session->requestEnd();
527  }
528  else {
529  m_session = nullptr;
530  }
531  }
532 }
533 
535 {
536  return m_session && m_session->isRunning();
537 }
538 
539 void GHOST_XrContext::drawSessionViews(void *draw_customdata)
540 {
541  m_session->draw(draw_customdata);
542 }
543 
547 void GHOST_XrContext::handleSessionStateChange(const XrEventDataSessionStateChanged &lifecycle)
548 {
549  if (m_session &&
550  m_session->handleStateChangeEvent(lifecycle) == GHOST_XrSession::SESSION_DESTROY) {
551  m_session = nullptr;
552  }
553 }
554  /* Session Management */
556 
557 /* -------------------------------------------------------------------- */
564 {
565  return m_session.get();
566 }
567 
569 {
570  return m_session.get();
571 }
572 
573 void GHOST_XrContext::setGraphicsContextBindFuncs(GHOST_XrGraphicsContextBindFn bind_fn,
574  GHOST_XrGraphicsContextUnbindFn unbind_fn)
575 {
576  if (m_session) {
577  m_session->unbindGraphicsContext();
578  }
579  m_custom_funcs.gpu_ctx_bind_fn = bind_fn;
580  m_custom_funcs.gpu_ctx_unbind_fn = unbind_fn;
581 }
582 
583 void GHOST_XrContext::setDrawViewFunc(GHOST_XrDrawViewFn draw_view_fn)
584 {
585  m_custom_funcs.draw_view_fn = draw_view_fn;
586 }
587 
589 {
590  /* Must only be called after the session was started */
591  assert(m_session);
592  return m_session->needsUpsideDownDrawing();
593 }
594  /* Public Accessors and Mutators */
596 
597 /* -------------------------------------------------------------------- */
602 {
603  return m_runtime_id;
604 }
605 
607 {
608  return m_custom_funcs;
609 }
610 
611 GHOST_TXrGraphicsBinding GHOST_XrContext::getGraphicsBindingType() const
612 {
613  return m_gpu_binding_type;
614 }
615 
617 {
618  return m_oxr->instance;
619 }
620 
622 {
623  return m_debug;
624 }
625 
627 {
628  return m_debug_time;
629 }
630 
631 bool GHOST_XrContext::isExtensionEnabled(const char *ext) const
632 {
633  bool contains = std::find(m_enabled_extensions.begin(), m_enabled_extensions.end(), ext) !=
634  m_enabled_extensions.end();
635  return contains;
636 }
637  /* Ghost Internal Accessors and Mutators */
static XrBool32 debug_messenger_func(XrDebugUtilsMessageSeverityFlagsEXT, XrDebugUtilsMessageTypeFlagsEXT, const XrDebugUtilsMessengerCallbackDataEXT *callbackData, void *)
static bool openxr_layer_is_available(const std::vector< XrApiLayerProperties > &layers_info, const std::string &layer_name)
static const char * openxr_ext_name_from_wm_gpu_binding(GHOST_TXrGraphicsBinding binding)
static bool openxr_extension_is_available(const std::vector< XrExtensionProperties > &extensions_info, const std::string_view &extension_name)
GHOST_TXrOpenXRRuntimeID
@ OPENXR_RUNTIME_MONADO
@ OPENXR_RUNTIME_OCULUS
@ OPENXR_RUNTIME_STEAMVR
@ OPENXR_RUNTIME_WMR
@ OPENXR_RUNTIME_VARJO
#define CHECK_XR_ASSERT(call)
#define CHECK_XR(call, error_msg)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
XrInstance getInstance() const
GHOST_TXrOpenXRRuntimeID getOpenXRRuntimeID() const
void setGraphicsContextBindFuncs(GHOST_XrGraphicsContextBindFn bind_fn, GHOST_XrGraphicsContextUnbindFn unbind_fn) override
GHOST_TXrGraphicsBinding getGraphicsBindingType() const
void drawSessionViews(void *draw_customdata) override
void handleSessionStateChange(const XrEventDataSessionStateChanged &lifecycle)
const GHOST_XrCustomFuncs & getCustomFuncs() const
void dispatchErrorMessage(const class GHOST_XrException *exception) const override
bool isDebugTimeMode() const
void setDrawViewFunc(GHOST_XrDrawViewFn draw_view_fn) override
bool needsUpsideDownDrawing() const override
bool isSessionRunning() const override
void startSession(const GHOST_XrSessionBeginInfo *begin_info) override
void endSession() override
bool isExtensionEnabled(const char *ext) const
GHOST_XrContext(const GHOST_XrContextCreateInfo *create_info)
bool isDebugMode() const
void initialize(const GHOST_XrContextCreateInfo *create_info)
static void setErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata)
GHOST_XrSession * getSession() override
SyclQueue void void size_t num_bytes void
static void error(const char *str)
Definition: meshlaplacian.c:51
bool contains(const void *owner, const blender::bke::AttributeIDRef &attribute_id)
unsigned int uint32_t
Definition: stdint.h:80
GHOST_XrDrawViewFn draw_view_fn
GHOST_XrSessionExitFn session_exit_fn
GHOST_XrSessionCreateFn session_create_fn
GHOST_XrGraphicsContextUnbindFn gpu_ctx_unbind_fn
GHOST_XrGraphicsContextBindFn gpu_ctx_bind_fn
XrDebugUtilsMessengerEXT debug_messenger
XrInstanceProperties instance_properties
std::vector< XrExtensionProperties > extensions
static PFN_xrDestroyDebugUtilsMessengerEXT s_xrDestroyDebugUtilsMessengerEXT_fn
std::vector< XrApiLayerProperties > layers
static PFN_xrCreateDebugUtilsMessengerEXT s_xrCreateDebugUtilsMessengerEXT_fn