[Bf-blender-cvs] [2a5dc454f63] master: Cleanup: minor comment cleanups in GHOST

Brecht Van Lommel noreply at git.blender.org
Sun Jun 2 13:07:06 CEST 2019


Commit: 2a5dc454f63a4c3442d0ff0715cbd3d135bb5ca7
Author: Brecht Van Lommel
Date:   Sat Jun 1 20:03:09 2019 +0200
Branches: master
https://developer.blender.org/rB2a5dc454f63a4c3442d0ff0715cbd3d135bb5ca7

Cleanup: minor comment cleanups in GHOST

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

M	intern/ghost/intern/GHOST_ContextCGL.mm
M	intern/ghost/intern/GHOST_SystemPathsCocoa.mm
M	intern/ghost/intern/GHOST_SystemPathsUnix.cpp

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

diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index cfad6034be7..5fe40cb04a0 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -188,24 +188,10 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
   attribs.push_back((NSOpenGLPixelFormatAttribute)0);
 }
 
-// TODO(merwin): make this available to all platforms
-static void getVersion(int *major, int *minor)
-{
-#if 1  // legacy GL
-  sscanf((const char *)glGetString(GL_VERSION), "%d.%d", major, minor);
-#else  // 3.0+
-  glGetIntegerv(GL_MAJOR_VERSION, major);
-  glGetIntegerv(GL_MINOR_VERSION, minor);
-#endif
-}
-
 GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 {
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-  std::vector<NSOpenGLPixelFormatAttribute> attribs;
-  attribs.reserve(40);
-
 #ifdef GHOST_OPENGL_ALPHA
   static const bool needAlpha = true;
 #else
@@ -213,16 +199,15 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 #endif
 
   static bool softwareGL = getenv("BLENDER_SOFTWAREGL");  // command-line argument would be better
-  GLint major = 0, minor = 0;
-  NSOpenGLPixelFormat *pixelFormat;
-  // TODO: keep pixel format for subsequent windows/contexts instead of recreating each time
 
+  std::vector<NSOpenGLPixelFormatAttribute> attribs;
+  attribs.reserve(40);
   makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
 
-  pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
-
-  if (pixelFormat == nil)
+  NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
+  if (pixelFormat == nil) {
     goto error;
+  }
 
   m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
                                                shareContext:s_sharedOpenGLContext];
@@ -230,8 +215,10 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
 
   [m_openGLContext makeCurrentContext];
 
-  getVersion(&major, &minor);
   if (m_debug) {
+    GLint major = 0, minor = 0;
+    glGetIntegerv(GL_MAJOR_VERSION, &major);
+    glGetIntegerv(GL_MINOR_VERSION, &minor);
     fprintf(stderr, "OpenGL version %d.%d%s\n", major, minor, softwareGL ? " (software)" : "");
     fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER));
   }
diff --git a/intern/ghost/intern/GHOST_SystemPathsCocoa.mm b/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
index 232ef048351..830d58ba42c 100644
--- a/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemPathsCocoa.mm
@@ -110,5 +110,5 @@ const GHOST_TUns8 *GHOST_SystemPathsCocoa::getBinaryDir() const
 
 void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char *filename) const
 {
-  /* XXXXX TODO: Implementation for X11 if possible */
+  /* TODO: implement for macOS */
 }
diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
index 94e48f98510..9514edb7404 100644
--- a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
@@ -115,5 +115,5 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getBinaryDir() const
 
 void GHOST_SystemPathsUnix::addToSystemRecentFiles(const char * /*filename*/) const
 {
-  /* XXXXX TODO: Implementation for X11 if possible */
+  /* TODO: implement for X11 */
 }



More information about the Bf-blender-cvs mailing list