[Bf-blender-cvs] [17dda0b3e60] vamr-openxr-module: Rename types and functions for VAMR

Julian Eisel noreply at git.blender.org
Fri Aug 30 17:57:14 CEST 2019


Commit: 17dda0b3e60a79af39003242a105117aefa94265
Author: Julian Eisel
Date:   Fri Aug 30 17:55:44 2019 +0200
Branches: vamr-openxr-module
https://developer.blender.org/rB17dda0b3e60a79af39003242a105117aefa94265

Rename types and functions for VAMR

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

M	intern/vamr/VAMR_IContext.h
M	intern/vamr/VAMR_Types.h
M	intern/vamr/VAMR_capi.h
M	intern/vamr/intern/VAMR.cc
M	intern/vamr/intern/VAMR_Context.cc
M	intern/vamr/intern/VAMR_Context.h
M	intern/vamr/intern/VAMR_Event.cc
M	intern/vamr/intern/VAMR_Exception.h
M	intern/vamr/intern/VAMR_GraphicsBinding.cc
M	intern/vamr/intern/VAMR_IGraphicsBinding.h
M	intern/vamr/intern/VAMR_Session.cc
M	intern/vamr/intern/VAMR_Session.h
M	intern/vamr/intern/VAMR_intern.h

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

diff --git a/intern/vamr/VAMR_IContext.h b/intern/vamr/VAMR_IContext.h
index 80feda008cf..261bc0aa318 100644
--- a/intern/vamr/VAMR_IContext.h
+++ b/intern/vamr/VAMR_IContext.h
@@ -23,20 +23,20 @@
 
 #include "VAMR_Types.h"
 
-class GHOST_IXrContext {
+class VAMR_IContext {
  public:
-  virtual ~GHOST_IXrContext() = default;
+  virtual ~VAMR_IContext() = default;
 
-  virtual void startSession(const GHOST_XrSessionBeginInfo *begin_info) = 0;
+  virtual void startSession(const VAMR_SessionBeginInfo *begin_info) = 0;
   virtual void endSession() = 0;
   virtual bool isSessionRunning() const = 0;
   virtual void drawSessionViews(void *draw_customdata) = 0;
 
-  virtual void dispatchErrorMessage(const class GHOST_XrException *) const = 0;
+  virtual void dispatchErrorMessage(const class VAMR_Exception *) const = 0;
 
-  virtual void setGraphicsContextBindFuncs(GHOST_XrGraphicsContextBindFn bind_fn,
-                                           GHOST_XrGraphicsContextUnbindFn unbind_fn) = 0;
-  virtual void setDrawViewFunc(GHOST_XrDrawViewFn draw_view_fn) = 0;
+  virtual void setGraphicsContextBindFuncs(VAMR_GraphicsContextBindFn bind_fn,
+                                           VAMR_GraphicsContextUnbindFn unbind_fn) = 0;
+  virtual void setDrawViewFunc(VAMR_DrawViewFn draw_view_fn) = 0;
 };
 
 #endif  // __VAMR_ICONTEXT_H__
diff --git a/intern/vamr/VAMR_Types.h b/intern/vamr/VAMR_Types.h
index 2e6b1842ead..68b1cb545ce 100644
--- a/intern/vamr/VAMR_Types.h
+++ b/intern/vamr/VAMR_Types.h
@@ -21,9 +21,9 @@
 #ifndef __VAMR_TYPES_H__
 #define __VAMR_TYPES_H__
 
-typedef struct GHOST_XrContext *GHOST_XrContextHandle;
+typedef struct VAMR_Context *VAMR_ContextHandle;
 
-typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
+typedef enum { VAMR_Failure = 0, VAMR_Success } VAMR_TSuccess;
 
 /**
  * The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL. An
@@ -33,45 +33,45 @@ typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
  * This enum defines the possible graphics bindings to attempt to enable.
  */
 typedef enum {
-  GHOST_kXrGraphicsUnknown = 0,
-  GHOST_kXrGraphicsOpenGL,
+  VAMR_GraphicsBindingTypeUnknown = 0,
+  VAMR_GraphicsBindingTypeOpenGL,
 #ifdef WIN32
-  GHOST_kXrGraphicsD3D11,
+  VAMR_GraphicsBindingTypeD3D11,
 #endif
   /* For later */
-  //  GHOST_kXrGraphicsVulkan,
-} GHOST_TXrGraphicsBinding;
-/* An array of GHOST_TXrGraphicsBinding items defining the candidate bindings to use. The first
+  //  VAMR_GraphicsBindingVulkan,
+} VAMR_GraphicsBindingType;
+/* An array of VAMR_GraphicsBindingType items defining the candidate bindings to use. The first
  * available candidate will be chosen, so order defines priority. */
-typedef const GHOST_TXrGraphicsBinding *GHOST_XrGraphicsBindingCandidates;
+typedef const VAMR_GraphicsBindingType *VAMR_GraphicsBindingCandidates;
 
 typedef struct {
   float position[3];
   /* Blender convention (w, x, y, z) */
   float orientation_quat[4];
-} GHOST_XrPose;
+} VAMR_Pose;
 
 enum {
-  GHOST_kXrContextDebug = (1 << 0),
-  GHOST_kXrContextDebugTime = (1 << 1),
+  VAMR_ContextDebug = (1 << 0),
+  VAMR_ContextDebugTime = (1 << 1),
 };
 
 typedef struct {
-  const GHOST_XrGraphicsBindingCandidates gpu_binding_candidates;
+  const VAMR_GraphicsBindingCandidates gpu_binding_candidates;
   unsigned int gpu_binding_candidates_count;
 
   unsigned int context_flag;
-} GHOST_XrContextCreateInfo;
+} VAMR_ContextCreateInfo;
 
 typedef struct {
-  GHOST_XrPose base_pose;
-} GHOST_XrSessionBeginInfo;
+  VAMR_Pose base_pose;
+} VAMR_SessionBeginInfo;
 
 typedef struct {
   int ofsx, ofsy;
   int width, height;
 
-  GHOST_XrPose pose;
+  VAMR_Pose pose;
 
   struct {
     float angle_left, angle_right;
@@ -80,7 +80,7 @@ typedef struct {
 
   /** Set if the buffer should be submitted with a srgb transfer applied. */
   char expects_srgb_buffer;
-} GHOST_XrDrawViewInfo;
+} VAMR_DrawViewInfo;
 
 typedef struct {
   const char *user_message;
@@ -89,13 +89,13 @@ typedef struct {
   const char *source_location;
 
   void *customdata;
-} GHOST_XrError;
+} VAMR_Error;
 
-typedef void (*GHOST_XrErrorHandlerFn)(const GHOST_XrError *);
+typedef void (*VAMR_ErrorHandlerFn)(const VAMR_Error *);
 
-typedef void *(*GHOST_XrGraphicsContextBindFn)(GHOST_TXrGraphicsBinding graphics_lib);
-typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_TXrGraphicsBinding graphics_lib,
-                                                void *graphics_context);
-typedef void (*GHOST_XrDrawViewFn)(const GHOST_XrDrawViewInfo *draw_view, void *customdata);
+typedef void *(*VAMR_GraphicsContextBindFn)(VAMR_GraphicsBindingType graphics_lib);
+typedef void (*VAMR_GraphicsContextUnbindFn)(VAMR_GraphicsBindingType graphics_lib,
+                                             void *graphics_context);
+typedef void (*VAMR_DrawViewFn)(const VAMR_DrawViewInfo *draw_view, void *customdata);
 
 #endif  // __VAMR_TYPES_H__
diff --git a/intern/vamr/VAMR_capi.h b/intern/vamr/VAMR_capi.h
index 93475467cb4..796149b8b2f 100644
--- a/intern/vamr/VAMR_capi.h
+++ b/intern/vamr/VAMR_capi.h
@@ -11,28 +11,27 @@ extern "C" {
 
 /**
  * Set a custom callback to be executed whenever an error occurs. Should be set before calling
- * #GHOST_XrContextCreate().
+ * #VAMR_ContextCreate().
  */
-void GHOST_XrErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata);
+void VAMR_ErrorHandler(VAMR_ErrorHandlerFn handler_fn, void *customdata);
 
-GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info);
-void GHOST_XrContextDestroy(GHOST_XrContextHandle xr_context);
+VAMR_ContextHandle VAMR_ContextCreate(const VAMR_ContextCreateInfo *create_info);
+void VAMR_ContextDestroy(VAMR_ContextHandle xr_context);
 
-void GHOST_XrGraphicsContextBindFuncs(GHOST_XrContextHandle xr_context,
-                                      GHOST_XrGraphicsContextBindFn bind_fn,
-                                      GHOST_XrGraphicsContextUnbindFn unbind_fn);
+void VAMR_GraphicsContextBindFuncs(VAMR_ContextHandle xr_context,
+                                   VAMR_GraphicsContextBindFn bind_fn,
+                                   VAMR_GraphicsContextUnbindFn unbind_fn);
 
-void GHOST_XrDrawViewFunc(GHOST_XrContextHandle xr_context, GHOST_XrDrawViewFn draw_view_fn);
+void VAMR_DrawViewFunc(VAMR_ContextHandle xr_context, VAMR_DrawViewFn draw_view_fn);
 
 /* sessions */
-int GHOST_XrSessionIsRunning(const GHOST_XrContextHandle xr_context);
-void GHOST_XrSessionStart(GHOST_XrContextHandle xr_context,
-                          const GHOST_XrSessionBeginInfo *begin_info);
-void GHOST_XrSessionEnd(GHOST_XrContextHandle xr_context);
-void GHOST_XrSessionDrawViews(GHOST_XrContextHandle xr_context, void *customdata);
+int VAMR_SessionIsRunning(const VAMR_ContextHandle xr_context);
+void VAMR_SessionStart(VAMR_ContextHandle xr_context, const VAMR_SessionBeginInfo *begin_info);
+void VAMR_SessionEnd(VAMR_ContextHandle xr_context);
+void VAMR_SessionDrawViews(VAMR_ContextHandle xr_context, void *customdata);
 
 /* events */
-GHOST_TSuccess GHOST_XrEventsHandle(GHOST_XrContextHandle xr_context);
+VAMR_TSuccess VAMR_EventsHandle(VAMR_ContextHandle xr_context);
 
 #ifdef __cplusplus
 }
diff --git a/intern/vamr/intern/VAMR.cc b/intern/vamr/intern/VAMR.cc
index 6d5e9591181..501d871de9f 100644
--- a/intern/vamr/intern/VAMR.cc
+++ b/intern/vamr/intern/VAMR.cc
@@ -30,35 +30,35 @@
 #include "VAMR_Exception.h"
 
 /**
- * \brief Initialize the window manager XR-Context.
+ * \brief Initialize the XR-Context.
  * Includes setting up the OpenXR instance, querying available extensions and API layers,
  * enabling extensions (currently graphics binding extension only) and API layers.
  */
-GHOST_XrContextHandle GHOST_XrContextCreate(const GHOST_XrContextCreateInfo *create_info)
+VAMR_ContextHandle VAMR_ContextCreate(const VAMR_ContextCreateInfo *create_info)
 {
-  GHOST_XrContext *xr_context = new GHOST_XrContext(create_info);
+  VAMR_Context *xr_context = new VAMR_Context(create_info);
 
-  // TODO GHOST_XrContext's should probably be owned by the GHOST_System, which will handle context
+  // TODO VAMR_Context's should probably be owned by the GHOST_System, which will handle context
   // creation and destruction. Try-catch logic can be moved to C-API then.
   try {
     xr_context->initialize(create_info);
   }
-  catch (GHOST_XrException &e) {
+  catch (VAMR_Exception &e) {
     xr_context->dispatchErrorMessage(&e);
     delete xr_context;
 
     return nullptr;
   }
 
-  return (GHOST_XrContextHandle)xr_context;
+  return (VAMR_ContextHandle)xr_context;
 }
 
-void GHOST_XrContextDestroy(GHOST_XrContextHandle xr_contexthandle)
+void VAMR_ContextDestroy(VAMR_ContextHandle xr_contexthandle)
 {
-  delete (GHOST_XrContext *)xr_contexthandle;
+  delete (VAMR_Context *)xr_contexthandle;
 }
 
-void GHOST_XrErrorHandler(GHOST_XrErrorHandlerFn handler_fn, void *customdata)
+void VAMR_ErrorHandler(VAMR_ErrorHandlerFn handler_fn, void *customdata)
 {
-  GHOST_XrContext::setErrorHandler(handler_fn, customdata);
+  VAMR_Context::setErrorHandler(handler_fn, customdata);
 }
diff --git a/intern/vamr/intern/VAMR_Context.cc b/intern/vamr/intern/VAMR_Context.cc
index 036bdb317e7..9219b50d328 100644
--- a/intern/vamr/intern/VAMR_Context.cc
+++ b/intern/vamr/intern/VAMR_Context.cc
@@ -49,21 +49,21 @@ PFN_xrCreateDebugUtilsMessengerEXT OpenXRInstanceData::s_xrCreateDebugUtilsMesse
 PFN_xrDestroyDebugUtilsMessengerEXT OpenXRInstanceData::s_xrDestroyDebugUtilsMessengerEXT_fn =
     nullptr;
 
-GHOST_XrErrorHandlerFn GHOST_XrContext::s_error_handler = nullptr;
-void *GHOST_XrContext::s_error_handler_customdata = nullptr;
+VAMR_ErrorHandlerFn VAMR_Context::s_error_handler = nullptr;
+void *VAMR_Context::s_error_handler_customdata = nullptr;
 
 /* -------------------------------------------------------------------- */
 /** \name Create, Initialize and Destruct
  *
  * \{ */
 
-GHOST_XrContext::GHOST_XrContext(const GHOST_XrContextCreateInfo *create_info)
+VAMR_Context::VAMR_Context(const VAMR_ContextCreateInfo *create_info)
     : m_oxr(new OpenXRInstanceData()),
-      m_debug(create_info->context_flag & GHOST_kXrContextDebug),
-      m_debug_time(create_info->

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list