[Bf-blender-cvs] [24146563a01] soc-2019-openxr: Cleanup: Use CamelCase for XR functions/types

Julian Eisel noreply at git.blender.org
Fri Jun 21 22:28:15 CEST 2019


Commit: 24146563a01665dca292f16cc1385c23fcb53c82
Author: Julian Eisel
Date:   Fri Jun 21 21:51:03 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB24146563a01665dca292f16cc1385c23fcb53c82

Cleanup: Use CamelCase for XR functions/types

Also silence warnings.

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

M	intern/ghost/CMakeLists.txt
M	intern/ghost/GHOST_C-api.h
M	intern/ghost/intern/GHOST_ContextD3D.h
M	intern/ghost/intern/GHOST_ContextGLX.h
M	intern/ghost/intern/GHOST_ContextWGL.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	release/scripts/addons
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/windowmanager/intern/wm.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_window.c

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

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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list