diff options
-rw-r--r-- | intern/ghost/CMakeLists.txt | 12 | ||||
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 44 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ContextD3D.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ContextGLX.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ContextWGL.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XR.cpp | 44 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XREvent.cpp | 10 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XRSession.cpp | 38 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XR_intern.h | 23 | ||||
m--------- | release/scripts/addons | 0 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_windowmanager_types.h | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 33 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 2 |
14 files changed, 104 insertions, 114 deletions
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 61b8649db15..912888bbce6 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -349,13 +349,13 @@ endif() if(WITH_OPENXR) list(APPEND SRC - intern/GHOST_XR.cpp - intern/GHOST_XREvent.cpp - intern/GHOST_XRSession.cpp + intern/GHOST_Xr.cpp + intern/GHOST_XrEvent.cpp + intern/GHOST_XrSession.cpp - intern/GHOST_XR_intern.h - intern/GHOST_XR_openxr_includes.h -# intern/GHOST_XRSession.h + intern/GHOST_Xr_intern.h + intern/GHOST_Xr_openxr_includes.h +# intern/GHOST_XrSession.h ) list(APPEND INC ) diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index c9794205fa6..f13c80a029b 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -964,10 +964,6 @@ extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle, extern void GHOST_EndIME(GHOST_WindowHandle windowhandle); #ifdef WITH_OPENXR -# if !defined(WITH_OPENXR) -// TODO -static_assert(false, "WITH_OPENXR not defined, but GHOST_XR.c is being compiled."); -# endif /** * The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL. An @@ -977,42 +973,42 @@ static_assert(false, "WITH_OPENXR not defined, but GHOST_XR.c is being compiled. * This enum defines the possible graphics bindings to attempt to enable. */ typedef enum { - GHOST_kXRGraphicsUnknown = 0, - GHOST_kXRGraphicsOpenGL, + GHOST_kXrGraphicsUnknown = 0, + GHOST_kXrGraphicsOpenGL, # ifdef WIN32 - GHOST_kXRGraphicsD3D11, + GHOST_kXrGraphicsD3D11, # endif /* For later */ - // GHOST_kXRGraphicsVulkan, -} GHOST_TGraphicsBinding; -/* An array of GHOST_TGraphicsBinding items defining the candidate bindings to use. The first + // GHOST_kXrGraphicsVulkan, +} GHOST_TXrGraphicsBinding; +/* An array of GHOST_TXrGraphicsBinding items defining the candidate bindings to use. The first * available candidate will be chosen, so order defines priority. */ -typedef const GHOST_TGraphicsBinding *GHOST_XRGraphicsBindingCandidates; +typedef const GHOST_TXrGraphicsBinding *GHOST_XrGraphicsBindingCandidates; typedef struct { - const GHOST_XRGraphicsBindingCandidates gpu_binding_candidates; + const GHOST_XrGraphicsBindingCandidates gpu_binding_candidates; unsigned int gpu_binding_candidates_count; -} GHOST_XRContextCreateInfo; +} GHOST_XrContextCreateInfo; /* xr-context */ -struct GHOST_XRContext *GHOST_XR_context_create(const GHOST_XRContextCreateInfo *create_info); -void GHOST_XR_context_destroy(struct GHOST_XRContext *xr_context); +struct GHOST_XrContext *GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info); +void GHOST_XrContextDestroy(struct GHOST_XrContext *xr_context); -typedef void *(*GHOST_XRGraphicsContextBindFn)(GHOST_TGraphicsBinding graphics_lib); -typedef void (*GHOST_XRGraphicsContextUnbindFn)(GHOST_TGraphicsBinding graphics_lib, +typedef void *(*GHOST_XrGraphicsContextBindFn)(GHOST_TXrGraphicsBinding graphics_lib); +typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_TXrGraphicsBinding graphics_lib, void *graphics_context); -void GHOST_XR_graphics_context_bind_funcs(struct GHOST_XRContext *xr_context, - GHOST_XRGraphicsContextBindFn bind_fn, - GHOST_XRGraphicsContextUnbindFn unbind_fn); +void GHOST_XrGraphicsContextBindFuncs(struct GHOST_XrContext *xr_context, + GHOST_XrGraphicsContextBindFn bind_fn, + GHOST_XrGraphicsContextUnbindFn unbind_fn); /* sessions */ -GHOST_TSuccess GHOST_XR_session_is_running(const struct GHOST_XRContext *xr_context); -void GHOST_XR_session_start(struct GHOST_XRContext *xr_context); -void GHOST_XR_session_end(struct GHOST_XRContext *xr_context); +GHOST_TSuccess GHOST_XrSessionIsRunning(const struct GHOST_XrContext *xr_context); +void GHOST_XrSessionStart(struct GHOST_XrContext *xr_context); +void GHOST_XrSessionEnd(struct GHOST_XrContext *xr_context); /* events */ -GHOST_TSuccess GHOST_XR_events_handle(struct GHOST_XRContext *xr_context); +GHOST_TSuccess GHOST_XrEventsHandle(struct GHOST_XrContext *xr_context); #endif #ifdef __cplusplus diff --git a/intern/ghost/intern/GHOST_ContextD3D.h b/intern/ghost/intern/GHOST_ContextD3D.h index c187dba757a..407684cf643 100644 --- a/intern/ghost/intern/GHOST_ContextD3D.h +++ b/intern/ghost/intern/GHOST_ContextD3D.h @@ -32,7 +32,7 @@ class GHOST_ContextD3D : public GHOST_Context { /* XR code needs low level graphics data to send to OpenXR. */ - friend class GHOST_XRGraphicsBinding; + friend class GHOST_XrGraphicsBinding; public: GHOST_ContextD3D(bool stereoVisual, HWND hWnd); diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h index 69a7246a238..96777fb2983 100644 --- a/intern/ghost/intern/GHOST_ContextGLX.h +++ b/intern/ghost/intern/GHOST_ContextGLX.h @@ -39,7 +39,7 @@ class GHOST_ContextGLX : public GHOST_Context { /* XR code needs low level graphics data to send to OpenXR. */ - friend class GHOST_XRGraphicsBinding; + friend class GHOST_XrGraphicsBinding; public: /** diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h index e1b43d36d4c..08450b388cb 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.h +++ b/intern/ghost/intern/GHOST_ContextWGL.h @@ -36,7 +36,7 @@ class GHOST_ContextWGL : public GHOST_Context { /* XR code needs low level graphics data to send to OpenXR. */ - friend class GHOST_XRGraphicsBinding; + friend class GHOST_XrGraphicsBinding; public: /** diff --git a/intern/ghost/intern/GHOST_XR.cpp b/intern/ghost/intern/GHOST_XR.cpp index c769ebac280..94759e53a3b 100644 --- a/intern/ghost/intern/GHOST_XR.cpp +++ b/intern/ghost/intern/GHOST_XR.cpp @@ -122,16 +122,16 @@ static bool openxr_extension_is_available(const OpenXRData *oxr, const std::stri return false; } -static const char *openxr_ext_name_from_wm_gpu_binding(GHOST_TGraphicsBinding binding) +static const char *openxr_ext_name_from_wm_gpu_binding(GHOST_TXrGraphicsBinding binding) { switch (binding) { - case GHOST_kXRGraphicsOpenGL: + case GHOST_kXrGraphicsOpenGL: return XR_KHR_OPENGL_ENABLE_EXTENSION_NAME; #ifdef WIN32 - case GHOST_kXRGraphicsD3D11: + case GHOST_kXrGraphicsD3D11: return XR_KHR_D3D11_ENABLE_EXTENSION_NAME; #endif - case GHOST_kXRGraphicsUnknown: + case GHOST_kXrGraphicsUnknown: assert(false); return nullptr; } @@ -141,16 +141,16 @@ static const char *openxr_ext_name_from_wm_gpu_binding(GHOST_TGraphicsBinding bi /** * Decide which graphics binding extension to use based on - * #GHOST_XRContextCreateInfo.gpu_binding_candidates and available extensions. + * #GHOST_XrContextCreateInfo.gpu_binding_candidates and available extensions. */ -static GHOST_TGraphicsBinding openxr_graphics_extension_to_enable_get( - const OpenXRData *oxr, const GHOST_XRContextCreateInfo *create_info) +static GHOST_TXrGraphicsBinding openxr_graphics_extension_to_enable_get( + const OpenXRData *oxr, const GHOST_XrContextCreateInfo *create_info) { assert(create_info->gpu_binding_candidates != NULL); assert(create_info->gpu_binding_candidates_count > 0); for (uint32_t i = 0; i < create_info->gpu_binding_candidates_count; i++) { - assert(create_info->gpu_binding_candidates[i] != GHOST_kXRGraphicsUnknown); + assert(create_info->gpu_binding_candidates[i] != GHOST_kXrGraphicsUnknown); const char *ext_name = openxr_ext_name_from_wm_gpu_binding( create_info->gpu_binding_candidates[i]); if (openxr_extension_is_available(oxr, ext_name)) { @@ -158,17 +158,17 @@ static GHOST_TGraphicsBinding openxr_graphics_extension_to_enable_get( } } - return GHOST_kXRGraphicsUnknown; + return GHOST_kXrGraphicsUnknown; } /** * Gather an array of names for the extensions to enable. */ -static void openxr_extensions_to_enable_get(const GHOST_XRContext *context, +static void openxr_extensions_to_enable_get(const GHOST_XrContext *context, const OpenXRData *oxr, std::vector<const char *> &r_ext_names) { - assert(context->gpu_binding_type != GHOST_kXRGraphicsUnknown); + assert(context->gpu_binding_type != GHOST_kXrGraphicsUnknown); const char *gpu_binding = openxr_ext_name_from_wm_gpu_binding(context->gpu_binding_type); const static std::vector<std::string> try_ext; /* None yet */ @@ -187,7 +187,7 @@ static void openxr_extensions_to_enable_get(const GHOST_XRContext *context, } } -static bool openxr_instance_create(GHOST_XRContext *context) +static bool openxr_instance_create(GHOST_XrContext *context) { XrInstanceCreateInfo create_info{}; OpenXRData *oxr = &context->oxr; @@ -222,9 +222,9 @@ static void openxr_instance_log_print(OpenXRData *oxr) * Includes setting up the OpenXR instance, querying available extensions and API layers, enabling * extensions (currently graphics binding extension only) and API layers. */ -GHOST_XRContext *GHOST_XR_context_create(const GHOST_XRContextCreateInfo *create_info) +GHOST_XrContext *GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info) { - GHOST_XRContext *xr_context = new GHOST_XRContext(); + GHOST_XrContext *xr_context = new GHOST_XrContext(); OpenXRData *oxr = &xr_context->oxr; #ifdef USE_EXT_LAYER_PRINTS @@ -249,12 +249,12 @@ GHOST_XRContext *GHOST_XR_context_create(const GHOST_XRContextCreateInfo *create return xr_context; } -void GHOST_XR_context_destroy(GHOST_XRContext *xr_context) +void GHOST_XrContextDestroy(GHOST_XrContext *xr_context) { OpenXRData *oxr = &xr_context->oxr; /* Unbinding may involve destruction, so call here too */ - GHOST_XR_graphics_context_unbind(*xr_context); + GHOST_XrGraphicsContextUnbind(*xr_context); delete xr_context->gpu_binding; if (oxr->session != XR_NULL_HANDLE) { @@ -275,23 +275,23 @@ void GHOST_XR_context_destroy(GHOST_XRContext *xr_context) * \param bind_fn Function to retrieve (possibly create) a graphics context. * \param unbind_fn Function to release (possibly free) a graphics context. */ -void GHOST_XR_graphics_context_bind_funcs(GHOST_XRContext *xr_context, - GHOST_XRGraphicsContextBindFn bind_fn, - GHOST_XRGraphicsContextUnbindFn unbind_fn) +void GHOST_XrGraphicsContextBindFuncs(GHOST_XrContext *xr_context, + GHOST_XrGraphicsContextBindFn bind_fn, + GHOST_XrGraphicsContextUnbindFn unbind_fn) { - GHOST_XR_graphics_context_unbind(*xr_context); + GHOST_XrGraphicsContextUnbind(*xr_context); xr_context->gpu_ctx_bind_fn = bind_fn; xr_context->gpu_ctx_unbind_fn = unbind_fn; } -void GHOST_XR_graphics_context_bind(GHOST_XRContext &xr_context) +void GHOST_XrGraphicsContextBind(GHOST_XrContext &xr_context) { assert(xr_context.gpu_ctx_bind_fn); xr_context.gpu_ctx = static_cast<GHOST_Context *>( xr_context.gpu_ctx_bind_fn(xr_context.gpu_binding_type)); } -void GHOST_XR_graphics_context_unbind(GHOST_XRContext &xr_context) +void GHOST_XrGraphicsContextUnbind(GHOST_XrContext &xr_context) { if (xr_context.gpu_ctx_unbind_fn) { xr_context.gpu_ctx_unbind_fn(xr_context.gpu_binding_type, xr_context.gpu_ctx); diff --git a/intern/ghost/intern/GHOST_XREvent.cpp b/intern/ghost/intern/GHOST_XREvent.cpp index 09e05aef74a..891df19a967 100644 --- a/intern/ghost/intern/GHOST_XREvent.cpp +++ b/intern/ghost/intern/GHOST_XREvent.cpp @@ -23,7 +23,7 @@ #include "GHOST_C-api.h" #include "GHOST_XR_intern.h" -static bool GHOST_XR_event_poll_next(OpenXRData *oxr, XrEventDataBuffer &r_event_data) +static bool GHOST_XrEventPollNext(OpenXRData *oxr, XrEventDataBuffer &r_event_data) { /* (Re-)initialize as required by specification */ r_event_data.type = XR_TYPE_EVENT_DATA_BUFFER; @@ -32,21 +32,21 @@ static bool GHOST_XR_event_poll_next(OpenXRData *oxr, XrEventDataBuffer &r_event return (xrPollEvent(oxr->instance, &r_event_data) == XR_SUCCESS); } -GHOST_TSuccess GHOST_XR_events_handle(GHOST_XRContext *xr_context) +GHOST_TSuccess GHOST_XrEventsHandle(GHOST_XrContext *xr_context) { OpenXRData *oxr = &xr_context->oxr; XrEventDataBuffer event_buffer; /* structure big enought to hold all possible events */ - if (!GHOST_XR_session_is_running(xr_context)) { + if (!GHOST_XrSessionIsRunning(xr_context)) { return GHOST_kFailure; } - while (GHOST_XR_event_poll_next(oxr, event_buffer)) { + while (GHOST_XrEventPollNext(oxr, event_buffer)) { XrEventDataBaseHeader &event = (XrEventDataBaseHeader &)event_buffer; /* base event struct */ switch (event.type) { case XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED: - GHOST_XR_session_state_change(oxr, (XrEventDataSessionStateChanged &)event); + GHOST_XrSessionStateChange(oxr, (XrEventDataSessionStateChanged &)event); return GHOST_kSuccess; default: diff --git a/intern/ghost/intern/GHOST_XRSession.cpp b/intern/ghost/intern/GHOST_XRSession.cpp index f7f2095cc3c..1d205bd1d55 100644 --- a/intern/ghost/intern/GHOST_XRSession.cpp +++ b/intern/ghost/intern/GHOST_XRSession.cpp @@ -36,7 +36,7 @@ * \ingroup wm */ -GHOST_TSuccess GHOST_XR_session_is_running(const GHOST_XRContext *xr_context) +GHOST_TSuccess GHOST_XrSessionIsRunning(const GHOST_XrContext *xr_context) { if ((xr_context == nullptr) || (xr_context->oxr.session == XR_NULL_HANDLE)) { return GHOST_kFailure; @@ -55,7 +55,7 @@ GHOST_TSuccess GHOST_XR_session_is_running(const GHOST_XRContext *xr_context) * A system in OpenXR the combination of some sort of HMD plus controllers and whatever other * devices are managed through OpenXR. So this attempts to init the HMD and the other devices. */ -static void GHOST_XR_system_init(OpenXRData *oxr) +static void GHOST_XrSystemInit(OpenXRData *oxr) { assert(oxr->instance != XR_NULL_HANDLE); assert(oxr->system_id == XR_NULL_SYSTEM_ID); @@ -67,11 +67,11 @@ static void GHOST_XR_system_init(OpenXRData *oxr) xrGetSystem(oxr->instance, &system_info, &oxr->system_id); } -void GHOST_XRGraphicsBinding::initFromGhostContext(GHOST_TGraphicsBinding type, +void GHOST_XrGraphicsBinding::initFromGhostContext(GHOST_TXrGraphicsBinding type, GHOST_Context *ghost_ctx) { switch (type) { - case GHOST_kXRGraphicsOpenGL: { + case GHOST_kXrGraphicsOpenGL: { #if defined(WITH_X11) GHOST_ContextGLX *ctx_glx = static_cast<GHOST_ContextGLX *>(ghost_ctx); XVisualInfo *visual_info = glXGetVisualFromFBConfig(ctx_glx->m_display, ctx_glx->m_fbconfig); @@ -93,7 +93,7 @@ void GHOST_XRGraphicsBinding::initFromGhostContext(GHOST_TGraphicsBinding type, break; } #ifdef WIN32 - case GHOST_kXRGraphicsD3D11: { + case GHOST_kXrGraphicsD3D11: { GHOST_ContextD3D *ctx_d3d = static_cast<GHOST_ContextD3D *>(ghost_ctx); oxr_binding.d3d11.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR; @@ -107,7 +107,7 @@ void GHOST_XRGraphicsBinding::initFromGhostContext(GHOST_TGraphicsBinding type, } } -void GHOST_XR_session_start(GHOST_XRContext *xr_context) +void GHOST_XrSessionStart(GHOST_XrContext *xr_context) { OpenXRData *oxr = &xr_context->oxr; @@ -116,23 +116,22 @@ void GHOST_XR_session_start(GHOST_XRContext *xr_context) if (xr_context->gpu_ctx_bind_fn == nullptr) { fprintf(stderr, "Invalid API usage: No way to bind graphics context to the XR session. Call " - "GHOST_XR_graphics_context_bind_funcs() with valid parameters before starting the " - "session (through GHOST_XR_session_start())."); + "GHOST_XrGraphicsContextBindFuncs() with valid parameters before starting the " + "session (through GHOST_XrSessionStart())."); return; } - GHOST_XR_system_init(oxr); + GHOST_XrSystemInit(oxr); - GHOST_XR_graphics_context_bind(*xr_context); + GHOST_XrGraphicsContextBind(*xr_context); if (xr_context->gpu_ctx == nullptr) { - fprintf( - stderr, - "Invalid API usage: No graphics context returned through the callback set with " - "GHOST_XR_graphics_context_bind_funcs(). This is required for session starting (through " - "GHOST_XR_session_start()).\n"); + fprintf(stderr, + "Invalid API usage: No graphics context returned through the callback set with " + "GHOST_XrGraphicsContextBindFuncs(). This is required for session starting (through " + "GHOST_XrSessionStart()).\n"); return; } - xr_context->gpu_binding = new GHOST_XRGraphicsBinding(); + xr_context->gpu_binding = new GHOST_XrGraphicsBinding(); xr_context->gpu_binding->initFromGhostContext(xr_context->gpu_binding_type, xr_context->gpu_ctx); XrSessionCreateInfo create_info{}; @@ -143,15 +142,14 @@ void GHOST_XR_session_start(GHOST_XRContext *xr_context) xrCreateSession(oxr->instance, &create_info, &oxr->session); } -void GHOST_XR_session_end(GHOST_XRContext *xr_context) +void GHOST_XrSessionEnd(GHOST_XrContext *xr_context) { xrEndSession(xr_context->oxr.session); - GHOST_XR_graphics_context_unbind(*xr_context); + GHOST_XrGraphicsContextUnbind(*xr_context); delete xr_context->gpu_binding; } -void GHOST_XR_session_state_change(OpenXRData *oxr, - const XrEventDataSessionStateChanged &lifecycle) +void GHOST_XrSessionStateChange(OpenXRData *oxr, const XrEventDataSessionStateChanged &lifecycle) { oxr->session_state = lifecycle.state; diff --git a/intern/ghost/intern/GHOST_XR_intern.h b/intern/ghost/intern/GHOST_XR_intern.h index da0cad54712..1e4897d4265 100644 --- a/intern/ghost/intern/GHOST_XR_intern.h +++ b/intern/ghost/intern/GHOST_XR_intern.h @@ -36,7 +36,7 @@ typedef struct OpenXRData { XrSessionState session_state; } OpenXRData; -class GHOST_XRGraphicsBinding { +class GHOST_XrGraphicsBinding { public: union { #if defined(WITH_X11) @@ -47,30 +47,29 @@ class GHOST_XRGraphicsBinding { #endif } oxr_binding; - void initFromGhostContext(GHOST_TGraphicsBinding type, class GHOST_Context *ghost_ctx); + void initFromGhostContext(GHOST_TXrGraphicsBinding type, class GHOST_Context *ghost_ctx); }; -typedef struct GHOST_XRContext { +typedef struct GHOST_XrContext { OpenXRData oxr; /** Active graphics binding type. */ - GHOST_TGraphicsBinding gpu_binding_type; - class GHOST_XRGraphicsBinding *gpu_binding; + GHOST_TXrGraphicsBinding gpu_binding_type; + class GHOST_XrGraphicsBinding *gpu_binding; /** Function to retrieve (possibly create) a graphics context */ - GHOST_XRGraphicsContextBindFn gpu_ctx_bind_fn; + GHOST_XrGraphicsContextBindFn gpu_ctx_bind_fn; /** Function to release (possibly free) a graphics context */ - GHOST_XRGraphicsContextUnbindFn gpu_ctx_unbind_fn; + GHOST_XrGraphicsContextUnbindFn gpu_ctx_unbind_fn; /** Active Ghost graphic context. */ class GHOST_Context *gpu_ctx; /** Names of enabled extensions */ std::vector<const char *> enabled_extensions; -} GHOST_XRContext; +} GHOST_XrContext; -void GHOST_XR_graphics_context_bind(GHOST_XRContext &xr_context); -void GHOST_XR_graphics_context_unbind(GHOST_XRContext &xr_context); +void GHOST_XrGraphicsContextBind(GHOST_XrContext &xr_context); +void GHOST_XrGraphicsContextUnbind(GHOST_XrContext &xr_context); -void GHOST_XR_session_state_change(OpenXRData *oxr, - const XrEventDataSessionStateChanged &lifecycle); +void GHOST_XrSessionStateChange(OpenXRData *oxr, const XrEventDataSessionStateChanged &lifecycle); #endif /* __GHOST_XR_INTERN_H__ */ diff --git a/release/scripts/addons b/release/scripts/addons -Subproject b154bd63c0fd87bbb4679c2635f3fc5701f86ae +Subproject a5a236df5f6630ea17958e3006070ef609c6a4b diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index e420ec27f7f..a67eb7388d7 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -42,7 +42,7 @@ struct wmKeyMap; struct wmMsgBus; struct wmOperator; struct wmOperatorType; -struct GHOST_XRContext; +struct GHOST_XrContext; /* forwards */ struct PointerRNA; @@ -180,7 +180,7 @@ typedef struct wmWindowManager { struct wmMsgBus *message_bus; //#ifdef WITH_OPENXR - struct GHOST_XRContext *xr_context; + struct GHOST_XrContext *xr_context; //#endif } wmWindowManager; diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index ddb4dfe2a4a..913b939bb87 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -379,7 +379,7 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm) #ifdef WITH_OPENXR if (wm->xr_context != NULL) { - GHOST_XR_context_destroy(wm->xr_context); + GHOST_XrContextDestroy(wm->xr_context); } #endif diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7debf2ce5c6..a5b0687f05d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3539,17 +3539,17 @@ static void WM_OT_stereo3d_set(wmOperatorType *ot) } #ifdef WITH_OPENXR -static void *xr_session_gpu_binding_context_create(GHOST_TGraphicsBinding graphics_lib) +static void *xr_session_gpu_binding_context_create(GHOST_TXrGraphicsBinding graphics_lib) { # ifndef WIN32 - BLI_assert(graphics_lib == GHOST_kXRGraphicsOpenGL); + BLI_assert(graphics_lib == GHOST_kXrGraphicsOpenGL); # endif switch (graphics_lib) { - case GHOST_kXRGraphicsOpenGL: + case GHOST_kXrGraphicsOpenGL: return WM_opengl_context_create(); # ifdef WIN32 - case GHOST_kXRGraphicsD3D11: { + case GHOST_kXrGraphicsD3D11: { wmWindowManager *wm = G_MAIN->wm.first; for (wmWindow *win = wm->windows.first; win; win = win->next) { /* TODO better lookup? For now only one D3D window possible, but later? */ @@ -3565,13 +3565,13 @@ static void *xr_session_gpu_binding_context_create(GHOST_TGraphicsBinding graphi } } -static void xr_session_gpu_binding_context_destroy(GHOST_TGraphicsBinding graphics_lib, +static void xr_session_gpu_binding_context_destroy(GHOST_TXrGraphicsBinding graphics_lib, void *context) { GHOST_ContextHandle ghost_context = context; switch (graphics_lib) { - case GHOST_kXRGraphicsOpenGL: + case GHOST_kXrGraphicsOpenGL: WM_opengl_context_dispose(ghost_context); default: return; @@ -3629,14 +3629,11 @@ static void xr_session_window_create(bContext *C) if (win->ghostwin) { GHOST_SetTitle(win->ghostwin, "Blender VR Session View"); - return win; } else { /* very unlikely! but opening a new window can fail */ wm_window_close(C, CTX_wm_manager(C), win); CTX_wm_window_set(C, win_prev); - - return NULL; } } # endif /* WIN32 */ @@ -3647,17 +3644,17 @@ static bool wm_xr_ensure_context(wmWindowManager *wm) return true; } - const GHOST_TGraphicsBinding gpu_bindings_candidates[] = { - GHOST_kXRGraphicsOpenGL, + const GHOST_TXrGraphicsBinding gpu_bindings_candidates[] = { + GHOST_kXrGraphicsOpenGL, # ifdef WIN32 - GHOST_kXRGraphicsD3D11, + GHOST_kXrGraphicsD3D11, # endif }; - const GHOST_XRContextCreateInfo create_info = { + const GHOST_XrContextCreateInfo create_info = { .gpu_binding_candidates = gpu_bindings_candidates, .gpu_binding_candidates_count = ARRAY_SIZE(gpu_bindings_candidates)}; - wm->xr_context = GHOST_XR_context_create(&create_info); + wm->xr_context = GHOST_XrContextCreate(&create_info); return wm->xr_context != NULL; } @@ -3670,18 +3667,18 @@ static int wm_xr_session_toggle_exec(bContext *C, wmOperator *UNUSED(op)) if (wm_xr_ensure_context(wm) == false) { return OPERATOR_CANCELLED; } - if (GHOST_XR_session_is_running(wm->xr_context)) { - GHOST_XR_session_end(wm->xr_context); + if (GHOST_XrSessionIsRunning(wm->xr_context)) { + GHOST_XrSessionEnd(wm->xr_context); } else { # if defined(WIN32) xr_session_window_create(C); # endif - GHOST_XR_graphics_context_bind_funcs(wm->xr_context, + GHOST_XrGraphicsContextBindFuncs(wm->xr_context, xr_session_gpu_binding_context_create, xr_session_gpu_binding_context_destroy); - GHOST_XR_session_start(wm->xr_context); + GHOST_XrSessionStart(wm->xr_context); } return OPERATOR_FINISHED; } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 0e2b5f26675..842fa5394bd 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1657,7 +1657,7 @@ void wm_window_process_events(const bContext *C) } hasevent |= wm_window_timer(C); #ifdef WITH_OPENXR - hasevent |= GHOST_XR_events_handle(CTX_wm_manager(C)->xr_context); + hasevent |= GHOST_XrEventsHandle(CTX_wm_manager(C)->xr_context); #endif /* no event, we sleep 5 milliseconds */ |