Blender V4.3
GHOST_Xr.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#include <cassert>
12#include <string>
13
14#include "GHOST_C-api.h"
15
16#include "GHOST_XrContext.hh"
17#include "GHOST_XrException.hh"
18#include "GHOST_Xr_intern.hh"
19
20GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info)
21{
22 auto xr_context = std::make_unique<GHOST_XrContext>(create_info);
23
24 /* TODO GHOST_XrContext's should probably be owned by the GHOST_System, which will handle context
25 * creation and destruction. Try-catch logic can be moved to C-API then. */
26 try {
27 xr_context->initialize(create_info);
28 }
29 catch (GHOST_XrException &e) {
30 xr_context->dispatchErrorMessage(&e);
31 return nullptr;
32 }
33
34 /* Give ownership to the caller. */
35 return (GHOST_XrContextHandle)xr_context.release();
36}
37
38void GHOST_XrContextDestroy(GHOST_XrContextHandle xr_contexthandle)
39{
40 delete (GHOST_XrContext *)xr_contexthandle;
41}
42
43void GHOST_XrErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata)
44{
45 GHOST_XrContext::setErrorHandler(handler_fn, customdata);
46}
GHOST C-API function and type declarations.
GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info)
Definition GHOST_Xr.cc:20
void GHOST_XrContextDestroy(GHOST_XrContextHandle xr_contexthandle)
Definition GHOST_Xr.cc:38
void GHOST_XrErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata)
Definition GHOST_Xr.cc:43
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
Main GHOST container to manage OpenXR through.
static void setErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata)