[Bf-blender-cvs] [0da0f29adec] temp-ghost_openxr: Rename of XR types (WM -> GHOST)

Julian Eisel noreply at git.blender.org
Wed Jun 19 01:03:27 CEST 2019


Commit: 0da0f29adec14173ca32464f5d2aaf607f059496
Author: Julian Eisel
Date:   Wed Jun 19 00:57:50 2019 +0200
Branches: temp-ghost_openxr
https://developer.blender.org/rB0da0f29adec14173ca32464f5d2aaf607f059496

Rename of XR types (WM -> GHOST)

===================================================================

M	intern/ghost/GHOST_C-api.h
M	intern/ghost/intern/GHOST_XR.cpp
M	intern/ghost/intern/GHOST_XREvent.cpp
M	intern/ghost/intern/GHOST_XRSession.cpp
M	intern/ghost/intern/GHOST_XR_intern.h
M	source/blender/blenkernel/BKE_context.h
M	source/blender/blenkernel/intern/context.c
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 3c6a684f054..c9794205fa6 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -977,42 +977,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 {
-  WM_XR_GRAPHICS_UNKNOWN = 0,
-  WM_XR_GRAPHICS_OPENGL,
+  GHOST_kXRGraphicsUnknown = 0,
+  GHOST_kXRGraphicsOpenGL,
 #  ifdef WIN32
-  WM_XR_GRAPHICS_D3D11,
+  GHOST_kXRGraphicsD3D11,
 #  endif
   /* For later */
-  //  WM_XR_GRAPHICS_VULKAN,
-} eWM_xrGraphicsBinding;
-/* An array of eWM_xrGraphicsBinding items defining the candidate bindings to use. The first
+  //  GHOST_kXRGraphicsVulkan,
+} GHOST_TGraphicsBinding;
+/* An array of GHOST_TGraphicsBinding items defining the candidate bindings to use. The first
  * available candidate will be chosen, so order defines priority. */
-typedef const eWM_xrGraphicsBinding *wmXRGraphicsBindingCandidates;
+typedef const GHOST_TGraphicsBinding *GHOST_XRGraphicsBindingCandidates;
 
 typedef struct {
-  const wmXRGraphicsBindingCandidates gpu_binding_candidates;
+  const GHOST_XRGraphicsBindingCandidates gpu_binding_candidates;
   unsigned int gpu_binding_candidates_count;
-} wmXRContextCreateInfo;
+} GHOST_XRContextCreateInfo;
 
 /* xr-context */
-struct wmXRContext *GHOST_XR_context_create(const wmXRContextCreateInfo *create_info);
-void GHOST_XR_context_destroy(struct wmXRContext *xr_context);
+struct GHOST_XRContext *GHOST_XR_context_create(const GHOST_XRContextCreateInfo *create_info);
+void GHOST_XR_context_destroy(struct GHOST_XRContext *xr_context);
 
-typedef void *(*wmXRGraphicsContextBindFn)(eWM_xrGraphicsBinding graphics_lib);
-typedef void (*wmXRGraphicsContextUnbindFn)(eWM_xrGraphicsBinding graphics_lib,
-                                            void *graphics_context);
+typedef void *(*GHOST_XRGraphicsContextBindFn)(GHOST_TGraphicsBinding graphics_lib);
+typedef void (*GHOST_XRGraphicsContextUnbindFn)(GHOST_TGraphicsBinding graphics_lib,
+                                                void *graphics_context);
 
-void GHOST_XR_graphics_context_bind_funcs(struct wmXRContext *xr_context,
-                                          wmXRGraphicsContextBindFn bind_fn,
-                                          wmXRGraphicsContextUnbindFn unbind_fn);
+void GHOST_XR_graphics_context_bind_funcs(struct GHOST_XRContext *xr_context,
+                                          GHOST_XRGraphicsContextBindFn bind_fn,
+                                          GHOST_XRGraphicsContextUnbindFn unbind_fn);
 
 /* sessions */
-GHOST_TSuccess GHOST_XR_session_is_running(const struct wmXRContext *xr_context);
-void GHOST_XR_session_start(struct wmXRContext *xr_context);
-void GHOST_XR_session_end(struct wmXRContext *xr_context);
+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);
 
 /* events */
-GHOST_TSuccess GHOST_XR_events_handle(struct wmXRContext *xr_context);
+GHOST_TSuccess GHOST_XR_events_handle(struct GHOST_XRContext *xr_context);
 #endif
 
 #ifdef __cplusplus
diff --git a/intern/ghost/intern/GHOST_XR.cpp b/intern/ghost/intern/GHOST_XR.cpp
index 810c850ef4f..d5376892ee7 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(eWM_xrGraphicsBinding binding)
+static const char *openxr_ext_name_from_wm_gpu_binding(GHOST_TGraphicsBinding binding)
 {
   switch (binding) {
-    case WM_XR_GRAPHICS_OPENGL:
+    case GHOST_kXRGraphicsOpenGL:
       return XR_KHR_OPENGL_ENABLE_EXTENSION_NAME;
 #ifdef WIN32
-    case WM_XR_GRAPHICS_D3D11:
+    case GHOST_kXRGraphicsD3D11:
       return XR_KHR_D3D11_ENABLE_EXTENSION_NAME;
 #endif
-    case WM_XR_GRAPHICS_UNKNOWN:
+    case GHOST_kXRGraphicsUnknown:
       assert(false);
       return nullptr;
   }
@@ -141,16 +141,16 @@ static const char *openxr_ext_name_from_wm_gpu_binding(eWM_xrGraphicsBinding bin
 
 /**
  * Decide which graphics binding extension to use based on
- * #wmXRContextCreateInfo.gpu_binding_candidates and available extensions.
+ * #GHOST_XRContextCreateInfo.gpu_binding_candidates and available extensions.
  */
-static eWM_xrGraphicsBinding openxr_graphics_extension_to_enable_get(
-    const OpenXRData *oxr, const wmXRContextCreateInfo *create_info)
+static GHOST_TGraphicsBinding 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] != WM_XR_GRAPHICS_UNKNOWN);
+    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 eWM_xrGraphicsBinding openxr_graphics_extension_to_enable_get(
     }
   }
 
-  return WM_XR_GRAPHICS_UNKNOWN;
+  return GHOST_kXRGraphicsUnknown;
 }
 
 /**
  * Gather an array of names for the extensions to enable.
  */
-static void openxr_extensions_to_enable_get(const wmXRContext *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 != WM_XR_GRAPHICS_UNKNOWN);
+  assert(context->gpu_binding != GHOST_kXRGraphicsUnknown);
 
   const char *gpu_binding = openxr_ext_name_from_wm_gpu_binding(context->gpu_binding);
   const static std::vector<std::string> try_ext; /* None yet */
@@ -187,7 +187,7 @@ static void openxr_extensions_to_enable_get(const wmXRContext *context,
   }
 }
 
-static bool openxr_instance_create(wmXRContext *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.
  */
-wmXRContext *GHOST_XR_context_create(const wmXRContextCreateInfo *create_info)
+GHOST_XRContext *GHOST_XR_context_create(const GHOST_XRContextCreateInfo *create_info)
 {
-  wmXRContext *xr_context = new wmXRContext();
+  GHOST_XRContext *xr_context = new GHOST_XRContext();
   OpenXRData *oxr = &xr_context->oxr;
 
 #ifdef USE_EXT_LAYER_PRINTS
@@ -249,7 +249,7 @@ wmXRContext *GHOST_XR_context_create(const wmXRContextCreateInfo *create_info)
   return xr_context;
 }
 
-void GHOST_XR_context_destroy(wmXRContext *xr_context)
+void GHOST_XR_context_destroy(GHOST_XRContext *xr_context)
 {
   OpenXRData *oxr = &xr_context->oxr;
 
@@ -274,23 +274,23 @@ void GHOST_XR_context_destroy(wmXRContext *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(wmXRContext *xr_context,
-                                       wmXRGraphicsContextBindFn bind_fn,
-                                       wmXRGraphicsContextUnbindFn unbind_fn)
+void GHOST_XR_graphics_context_bind_funcs(GHOST_XRContext *xr_context,
+                                          GHOST_XRGraphicsContextBindFn bind_fn,
+                                          GHOST_XRGraphicsContextUnbindFn unbind_fn)
 {
   GHOST_XR_graphics_context_unbind(*xr_context);
   xr_context->gpu_ctx_bind_fn = bind_fn;
   xr_context->gpu_ctx_unbind_fn = unbind_fn;
 }
 
-void GHOST_XR_graphics_context_bind(wmXRContext &xr_context)
+void GHOST_XR_graphics_context_bind(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));
 }
 
-void GHOST_XR_graphics_context_unbind(wmXRContext &xr_context)
+void GHOST_XR_graphics_context_unbind(GHOST_XRContext &xr_context)
 {
   if (xr_context.gpu_ctx_unbind_fn) {
     xr_context.gpu_ctx_unbind_fn(xr_context.gpu_binding, xr_context.gpu_ctx);
diff --git a/intern/ghost/intern/GHOST_XREvent.cpp b/intern/ghost/intern/GHOST_XREvent.cpp
index 7901bd144f2..09e05aef74a 100644
--- a/intern/ghost/intern/GHOST_XREvent.cpp
+++ b/intern/ghost/intern/GHOST_XREvent.cpp
@@ -32,7 +32,7 @@ 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(wmXRContext *xr_context)
+GHOST_TSuccess GHOST_XR_events_handle(GHOST_XRContext *xr_context)
 {
   OpenXRData *oxr = &xr_context->oxr;
   XrEventDataBuffer event_buffer; /* structure big enought to hold all possible events */
diff --git a/intern/ghost/intern/GHOST_XRSession.cpp b/intern/ghost/intern/GHOST_XRSession.cpp
index be1a82bc1d8..bf36732aa89 100644
--- a/intern/ghost/intern/GHOST_XRSession.cpp
+++ b/intern/ghost/intern/GHOST_XRSession.cpp
@@ -30,7 +30,7 @@
  * \ingroup wm
  */
 
-GHOST_TSuccess GHOST_XR_session_is_running(const wmXRContext *xr_context)
+GHOST_TSuccess GHOST_XR_session_is_running(const GHOST_XRContext *xr_context)
 {
   if ((xr_context == nullptr) || (xr_context->oxr.session == XR_NULL_HANDLE)) {
     return GHOST_kFailure;
@@ -61,7 +61,7 @@ static void GHOST_XR_system_init(OpenXRData *oxr)
   xrGetSystem(oxr->instance, &system_info, &oxr->system_id);
 }
 
-static void *openxr_graphics_binding_create(const wmXRContext *xr_context,
+static void *openxr_graphics_binding_create(const GHOST_XRContext *xr_context,
                    

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list