Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-24 01:44:32 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-24 19:37:38 +0300
commit76019139f620a41839860e27abf9f02f9a7bc28b (patch)
tree414168199dd2f5b793c0922ef1b1d769626675b0 /intern
parent04ad9eab6ea9951ef70b5b60b16fd7868c2fb5dd (diff)
Cleanup: remove unused macOS GHOST OpenGL code
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.h18
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm85
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm17
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm16
4 files changed, 13 insertions, 123 deletions
diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h
index fd760837d45..b808effc795 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.h
+++ b/intern/ghost/intern/GHOST_ContextCGL.h
@@ -26,15 +26,6 @@
#include "GHOST_Context.h"
-#ifndef GHOST_OPENGL_CGL_CONTEXT_FLAGS
-# define GHOST_OPENGL_CGL_CONTEXT_FLAGS 0
-#endif
-
-#ifndef GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY
-# define GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY 0
-#endif
-
-@class NSWindow;
@class NSOpenGLView;
@class NSOpenGLContext;
@@ -43,14 +34,7 @@ class GHOST_ContextCGL : public GHOST_Context {
/**
* Constructor.
*/
- GHOST_ContextCGL(bool stereoVisual,
- NSWindow *window,
- NSOpenGLView *openGLView,
- int contextProfileMask,
- int contextMajorVersion,
- int contextMinorVersion,
- int contextFlags,
- int contextResetNotificationStrategy);
+ GHOST_ContextCGL(bool stereoVisual, NSOpenGLView *openGLView);
/**
* Destructor.
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 5b8bb643751..cfad6034be7 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -27,47 +27,20 @@
#include <Cocoa/Cocoa.h>
-//#define GHOST_MULTITHREADED_OPENGL
-
-#ifdef GHOST_MULTITHREADED_OPENGL
-# include <OpenGL/OpenGL.h>
-#endif
-
#include <vector>
#include <cassert>
NSOpenGLContext *GHOST_ContextCGL::s_sharedOpenGLContext = nil;
int GHOST_ContextCGL::s_sharedCount = 0;
-GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
- NSWindow *window,
- NSOpenGLView *openGLView,
- int contextProfileMask,
- int contextMajorVersion,
- int contextMinorVersion,
- int contextFlags,
- int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual),
- m_openGLView(openGLView),
- m_openGLContext(nil),
- m_debug(contextFlags)
+GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual, NSOpenGLView *openGLView)
+ : GHOST_Context(stereoVisual), m_openGLView(openGLView), m_openGLContext(nil), m_debug(false)
{
- // for now be very strict about OpenGL version requested
- switch (contextMajorVersion) {
- case 2:
- assert(contextMinorVersion == 1);
- assert(contextProfileMask == 0);
- m_coreProfile = false;
- break;
- case 3:
- // Apple didn't implement 3.0 or 3.1
- assert(contextMinorVersion == 3);
- assert(contextProfileMask == GL_CONTEXT_CORE_PROFILE_BIT);
- m_coreProfile = true;
- break;
- default:
- assert(false);
- }
+#if defined(WITH_GL_PROFILE_CORE)
+ m_coreProfile = true;
+#else
+ m_coreProfile = false;
+#endif
}
GHOST_ContextCGL::~GHOST_ContextCGL()
@@ -233,8 +206,6 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
std::vector<NSOpenGLPixelFormatAttribute> attribs;
attribs.reserve(40);
- NSOpenGLContext *prev_openGLContext = (m_openGLView) ? [m_openGLView openGLContext] : NULL;
-
#ifdef GHOST_OPENGL_ALPHA
static const bool needAlpha = true;
#else
@@ -265,38 +236,6 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER));
}
- if (major < 2 || (major == 2 && minor < 1)) {
- // fall back to software renderer if GL < 2.1
- fprintf(stderr, "OpenGL 2.1 is not supported on your hardware, falling back to software");
- softwareGL = true;
-
- // discard hardware GL context
- [NSOpenGLContext clearCurrentContext];
- [m_openGLContext release];
-
- // create software GL context
- makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
- pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
- m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
- shareContext:s_sharedOpenGLContext];
- [pixelFormat release];
-
- [m_openGLContext makeCurrentContext];
-
- getVersion(&major, &minor);
- if (m_debug) {
- fprintf(stderr, "OpenGL version %d.%d%s\n", major, minor, softwareGL ? " (software)" : "");
- fprintf(stderr, "Renderer: %s\n", glGetString(GL_RENDERER));
- }
- }
-
-#ifdef GHOST_MULTITHREADED_OPENGL
- // Switch openGL to multhreaded mode
- if (CGLEnable(CGLGetCurrentContext(), kCGLCEMPEngine) == kCGLNoError)
- if (m_debug)
- fprintf(stderr, "\nSwitched OpenGL to multithreaded mode\n");
-#endif
-
#ifdef GHOST_WAIT_FOR_VSYNC
{
GLint swapInt = 1;
@@ -310,26 +249,22 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
if (m_openGLView) {
[m_openGLView setOpenGLContext:m_openGLContext];
[m_openGLContext setView:m_openGLView];
+ initClearGL();
}
+ [m_openGLContext flushBuffer];
+
if (s_sharedCount == 0)
s_sharedOpenGLContext = m_openGLContext;
s_sharedCount++;
- initClearGL();
- [m_openGLContext flushBuffer];
-
[pool drain];
return GHOST_kSuccess;
error:
- if (m_openGLView) {
- [m_openGLView setOpenGLContext:prev_openGLContext];
- }
-
[pixelFormat release];
[pool drain];
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 49e01a983a0..f13c9d470a5 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -762,22 +762,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
*/
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext()
{
- GHOST_Context *context = new GHOST_ContextCGL(false,
- NULL,
- NULL,
-
-#if defined(WITH_GL_PROFILE_CORE)
- GL_CONTEXT_CORE_PROFILE_BIT,
- 3,
- 3,
-#else
- 0, // no profile bit
- 2,
- 1,
-#endif
- GHOST_OPENGL_CGL_CONTEXT_FLAGS,
- GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY);
-
+ GHOST_Context *context = new GHOST_ContextCGL(false, NULL);
if (context->initializeDrawingContext())
return context;
else
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index f257399fc9c..fc4ad3dba74 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -1018,21 +1018,7 @@ GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType ty
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
- GHOST_Context *context = new GHOST_ContextCGL(m_wantStereoVisual,
- m_window,
- m_openGLView,
-
-#if defined(WITH_GL_PROFILE_CORE)
- GL_CONTEXT_CORE_PROFILE_BIT,
- 3,
- 3,
-#else
- 0, // no profile bit
- 2,
- 1,
-#endif
- GHOST_OPENGL_CGL_CONTEXT_FLAGS,
- GHOST_OPENGL_CGL_RESET_NOTIFICATION_STRATEGY);
+ GHOST_Context *context = new GHOST_ContextCGL(m_wantStereoVisual, m_openGLView);
if (context->initializeDrawingContext())
return context;