OpenGL: remove use of GLEW MX
MX (Multiple conteXt) support was dropped from the GLEW 2.0 library to make core profile support cleaner. Our WITH_GLEW_MX build option was OFF by default already; this commit removes the inactive code paths. I'm working on a plan for multiple GPUs, contexts, resource sharing, etc. This commit gives us a cleaner starting point for that upcoming work. Tested on Mac, will test on Linux & Windows immediately after pushing.
This commit is contained in:
parent
1beed61b76
commit
ef640ecf10
|
@ -466,7 +466,6 @@ endif()
|
|||
|
||||
# OpenGL
|
||||
|
||||
option(WITH_GLEW_MX "Support multiple GLEW contexts (experimental)" OFF )
|
||||
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
|
||||
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
|
||||
option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
|
||||
|
@ -474,7 +473,6 @@ option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.3+ 'core' profile."
|
|||
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
||||
|
||||
mark_as_advanced(
|
||||
WITH_GLEW_MX
|
||||
WITH_GLEW_ES
|
||||
WITH_GL_EGL
|
||||
WITH_GL_PROFILE_COMPAT
|
||||
|
@ -1224,10 +1222,6 @@ endif()
|
|||
#-----------------------------------------------------------------------------
|
||||
# Configure GLEW
|
||||
|
||||
if(WITH_GLEW_MX)
|
||||
list(APPEND GL_DEFINITIONS -DWITH_GLEW_MX)
|
||||
endif()
|
||||
|
||||
if(WITH_SYSTEM_GLEW)
|
||||
find_package(GLEW)
|
||||
|
||||
|
@ -1237,11 +1231,7 @@ if(WITH_SYSTEM_GLEW)
|
|||
message(FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW.")
|
||||
endif()
|
||||
|
||||
if(WITH_GLEW_MX)
|
||||
set(BLENDER_GLEW_LIBRARIES ${GLEW_MX_LIBRARY})
|
||||
else()
|
||||
set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
|
||||
endif()
|
||||
set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
|
||||
else()
|
||||
if(WITH_GLEW_ES)
|
||||
set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#
|
||||
# also defined,
|
||||
# GLEW_LIBRARY, where to find the Glew library.
|
||||
# GLEW_MX_LIBRARY, where to find the GlewMX library.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2014 Blender Foundation.
|
||||
|
@ -50,16 +49,6 @@ FIND_LIBRARY(GLEW_LIBRARY
|
|||
lib64 lib
|
||||
)
|
||||
|
||||
|
||||
FIND_LIBRARY(GLEW_MX_LIBRARY
|
||||
NAMES
|
||||
GLEWmx
|
||||
HINTS
|
||||
${_glew_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
@ -73,7 +62,6 @@ ENDIF(GLEW_FOUND)
|
|||
MARK_AS_ADVANCED(
|
||||
GLEW_INCLUDE_DIR
|
||||
GLEW_LIBRARY
|
||||
GLEW_MX_LIBRARY
|
||||
)
|
||||
|
||||
UNSET(_glew_SEARCH_DIRS)
|
||||
|
|
|
@ -49,9 +49,4 @@ set(SRC
|
|||
|
||||
add_definitions(${GL_DEFINITIONS})
|
||||
|
||||
if(WITH_GLEW_MX)
|
||||
add_definitions(-DGLEW_MX)
|
||||
endif()
|
||||
|
||||
|
||||
blender_add_lib(extern_glew_es "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
|
|
@ -48,8 +48,4 @@ set(SRC
|
|||
|
||||
add_definitions(${GL_DEFINITIONS})
|
||||
|
||||
if(WITH_GLEW_MX)
|
||||
add_definitions(-DGLEW_MX)
|
||||
endif()
|
||||
|
||||
blender_add_lib(extern_glew "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
|
|
@ -710,17 +710,8 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
|||
params.shadingsystem = SHADINGSYSTEM_OSL;
|
||||
|
||||
/* color managagement */
|
||||
#ifdef GLEW_MX
|
||||
/* When using GLEW MX we need to check whether we've got an OpenGL
|
||||
* context for current window. This is because command line rendering
|
||||
* doesn't have OpenGL context actually.
|
||||
*/
|
||||
if(glewGetContext() != NULL)
|
||||
#endif
|
||||
{
|
||||
params.display_buffer_linear = GLEW_ARB_half_float_pixel &&
|
||||
b_engine.support_display_space_shader(b_scene);
|
||||
}
|
||||
params.display_buffer_linear = GLEW_ARB_half_float_pixel &&
|
||||
b_engine.support_display_space_shader(b_scene);
|
||||
|
||||
if(b_engine.is_preview()) {
|
||||
/* For preview rendering we're using same timeout as
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
/* OpenGL header includes, used everywhere we use OpenGL, to deal with
|
||||
* platform differences in one central place. */
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
# include "glew-mx.h"
|
||||
#else
|
||||
# include <GL/glew.h>
|
||||
# define mxCreateContext() glewInit()
|
||||
# define mxMakeCurrentContext(x) (x)
|
||||
#endif
|
||||
#include <GL/glew.h>
|
||||
|
||||
#endif /* __UTIL_OPENGL_H__ */
|
||||
|
|
|
@ -252,7 +252,7 @@ void view_main_loop(const char *title, int width, int height,
|
|||
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
|
||||
glutCreateWindow(title);
|
||||
|
||||
mxMakeCurrentContext(mxCreateContext());
|
||||
glewInit();
|
||||
|
||||
view_reshape(width, height);
|
||||
|
||||
|
|
|
@ -143,11 +143,7 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
|
|||
|
||||
void GHOST_Context::initContextGLEW()
|
||||
{
|
||||
mxDestroyContext(m_mxContext); // no-op if m_mxContext is NULL
|
||||
|
||||
mxMakeCurrentContext(mxCreateContext());
|
||||
|
||||
m_mxContext = mxGetCurrentContext();
|
||||
GLEW_CHK(glewInit());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,15 +50,13 @@ public:
|
|||
*/
|
||||
GHOST_Context(bool stereoVisual, GHOST_TUns16 numOfAASamples)
|
||||
: m_stereoVisual(stereoVisual),
|
||||
m_numOfAASamples(numOfAASamples),
|
||||
m_mxContext(NULL)
|
||||
m_numOfAASamples(numOfAASamples)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~GHOST_Context() {
|
||||
mxDestroyContext(m_mxContext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,19 +126,12 @@ public:
|
|||
protected:
|
||||
void initContextGLEW();
|
||||
|
||||
inline void activateGLEW() const {
|
||||
mxMakeCurrentContext(m_mxContext);
|
||||
}
|
||||
|
||||
bool m_stereoVisual;
|
||||
|
||||
GHOST_TUns16 m_numOfAASamples;
|
||||
|
||||
static void initClearGL();
|
||||
|
||||
private:
|
||||
MXContext *m_mxContext;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Context")
|
||||
#endif
|
||||
|
|
|
@ -34,10 +34,6 @@
|
|||
|
||||
#include "GHOST_Context.h"
|
||||
|
||||
//#define cglewGetContext() cglewContext
|
||||
//#include <GL/cglew.h>
|
||||
//extern "C" CGLEWContext *cglewContext;
|
||||
|
||||
#ifndef GHOST_OPENGL_CGL_CONTEXT_FLAGS
|
||||
#define GHOST_OPENGL_CGL_CONTEXT_FLAGS 0
|
||||
#endif
|
||||
|
@ -120,14 +116,7 @@ public:
|
|||
*/
|
||||
GHOST_TSuccess updateDrawingContext();
|
||||
|
||||
//protected:
|
||||
// inline void activateCGLEW() const {
|
||||
// cglewContext = m_cglewContext;
|
||||
// }
|
||||
|
||||
private:
|
||||
//void initContextCGLEW()
|
||||
|
||||
/** The openGL view */
|
||||
NSOpenGLView *m_openGLView;
|
||||
|
||||
|
@ -136,8 +125,6 @@ private:
|
|||
|
||||
bool m_coreProfile;
|
||||
|
||||
//static CGLEWContext *s_cglewContext;
|
||||
|
||||
const bool m_debug;
|
||||
|
||||
/** The first created OpenGL context (for sharing display lists) */
|
||||
|
|
|
@ -159,9 +159,6 @@ GHOST_TSuccess GHOST_ContextCGL::activateDrawingContext()
|
|||
if (m_openGLContext != nil) {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
[m_openGLContext makeCurrentContext];
|
||||
|
||||
activateGLEW();
|
||||
|
||||
[pool drain];
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
|
|
@ -42,11 +42,6 @@
|
|||
#include <cstring>
|
||||
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
EGLEWContext *eglewContext = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
#define CASE_CODE_RETURN_STR(code) case code: return #code;
|
||||
|
||||
static const char *get_egl_error_enum_string(EGLenum error)
|
||||
|
@ -168,13 +163,8 @@ static bool egl_chk(bool result, const char *file = NULL, int line = 0, const ch
|
|||
|
||||
static inline bool bindAPI(EGLenum api)
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
if (eglewContext != NULL)
|
||||
#endif
|
||||
{
|
||||
if (EGLEW_VERSION_1_2) {
|
||||
return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
|
||||
}
|
||||
if (EGLEW_VERSION_1_2) {
|
||||
return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -238,9 +228,6 @@ GHOST_ContextEGL::GHOST_ContextEGL(
|
|||
m_surface(EGL_NO_SURFACE),
|
||||
m_display(EGL_NO_DISPLAY),
|
||||
m_swap_interval(1),
|
||||
#ifdef WITH_GLEW_MX
|
||||
m_eglewContext(NULL),
|
||||
#endif
|
||||
m_sharedContext(choose_api(api, s_gl_sharedContext, s_gles_sharedContext, s_vg_sharedContext)),
|
||||
m_sharedCount (choose_api(api, s_gl_sharedCount, s_gles_sharedCount, s_vg_sharedCount))
|
||||
{
|
||||
|
@ -252,7 +239,6 @@ GHOST_ContextEGL::GHOST_ContextEGL(
|
|||
GHOST_ContextEGL::~GHOST_ContextEGL()
|
||||
{
|
||||
if (m_display != EGL_NO_DISPLAY) {
|
||||
activateEGLEW();
|
||||
|
||||
bindAPI(m_api);
|
||||
|
||||
|
@ -276,10 +262,6 @@ GHOST_ContextEGL::~GHOST_ContextEGL()
|
|||
EGL_CHK(::eglDestroySurface(m_display, m_surface));
|
||||
|
||||
EGL_CHK(::eglTerminate(m_display));
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
delete m_eglewContext;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,9 +303,6 @@ GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
|
|||
GHOST_TSuccess GHOST_ContextEGL::activateDrawingContext()
|
||||
{
|
||||
if (m_display) {
|
||||
activateEGLEW();
|
||||
activateGLEW();
|
||||
|
||||
bindAPI(m_api);
|
||||
|
||||
return EGL_CHK(::eglMakeCurrent(m_display, m_surface, m_surface, m_context)) ? GHOST_kSuccess : GHOST_kFailure;
|
||||
|
@ -336,14 +315,6 @@ GHOST_TSuccess GHOST_ContextEGL::activateDrawingContext()
|
|||
|
||||
void GHOST_ContextEGL::initContextEGLEW()
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
eglewContext = new EGLEWContext;
|
||||
memset(eglewContext, 0, sizeof(EGLEWContext));
|
||||
|
||||
delete m_eglewContext;
|
||||
m_eglewContext = eglewContext;
|
||||
#endif
|
||||
|
||||
if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK)
|
||||
fprintf(stderr, "Warning! EGLEW failed to initialize properly.\n");
|
||||
}
|
||||
|
|
|
@ -34,17 +34,8 @@
|
|||
|
||||
#include "GHOST_Context.h"
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
# define eglewGetContext() eglewContext
|
||||
#endif
|
||||
|
||||
#include <GL/eglew.h>
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
extern "C" EGLEWContext *eglewContext;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef GHOST_OPENGL_EGL_CONTEXT_FLAGS
|
||||
#define GHOST_OPENGL_EGL_CONTEXT_FLAGS 0
|
||||
#endif
|
||||
|
@ -116,13 +107,6 @@ public:
|
|||
*/
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut);
|
||||
|
||||
protected:
|
||||
inline void activateEGLEW() const {
|
||||
#ifdef WITH_GLEW_MX
|
||||
eglewContext = m_eglewContext;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
void initContextEGLEW();
|
||||
|
||||
|
@ -143,10 +127,6 @@ private:
|
|||
|
||||
EGLint m_swap_interval;
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
EGLEWContext *m_eglewContext;
|
||||
#endif
|
||||
|
||||
EGLContext &m_sharedContext;
|
||||
EGLint &m_sharedCount;
|
||||
|
||||
|
|
|
@ -48,10 +48,6 @@ static GLuint _glewStrLen(const GLubyte *s);
|
|||
static GLboolean _glewSearchExtension(const char *name, const GLubyte *start, const GLubyte *end);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
GLXEWContext *glxewContext = NULL;
|
||||
#endif
|
||||
|
||||
GLXContext GHOST_ContextGLX::s_sharedContext = None;
|
||||
int GHOST_ContextGLX::s_sharedCount = 0;
|
||||
|
||||
|
@ -79,10 +75,6 @@ GHOST_ContextGLX::GHOST_ContextGLX(
|
|||
m_contextFlags(contextFlags),
|
||||
m_contextResetNotificationStrategy(contextResetNotificationStrategy),
|
||||
m_context(None)
|
||||
#ifdef WITH_GLEW_MX
|
||||
,
|
||||
m_glxewContext(NULL)
|
||||
#endif
|
||||
{
|
||||
assert(m_window != 0);
|
||||
assert(m_display != NULL);
|
||||
|
@ -109,11 +101,6 @@ GHOST_ContextGLX::~GHOST_ContextGLX()
|
|||
::glXDestroyContext(m_display, m_context);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
if (m_glxewContext)
|
||||
delete m_glxewContext;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,9 +116,6 @@ GHOST_TSuccess GHOST_ContextGLX::swapBuffers()
|
|||
GHOST_TSuccess GHOST_ContextGLX::activateDrawingContext()
|
||||
{
|
||||
if (m_display) {
|
||||
activateGLXEW();
|
||||
activateGLEW();
|
||||
|
||||
return ::glXMakeCurrent(m_display, m_window, m_context) ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
else {
|
||||
|
@ -141,15 +125,6 @@ GHOST_TSuccess GHOST_ContextGLX::activateDrawingContext()
|
|||
|
||||
void GHOST_ContextGLX::initContextGLXEW()
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
glxewContext = new GLXEWContext;
|
||||
memset(glxewContext, 0, sizeof(GLXEWContext));
|
||||
|
||||
if (m_glxewContext)
|
||||
delete m_glxewContext;
|
||||
m_glxewContext = glxewContext;
|
||||
#endif
|
||||
|
||||
initContextGLEW();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,16 +34,8 @@
|
|||
|
||||
#include "GHOST_Context.h"
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
# define glxewGetContext() glxewContext
|
||||
#endif
|
||||
|
||||
#include <GL/glxew.h>
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
extern "C" GLXEWContext *glxewContext;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef GHOST_OPENGL_GLX_CONTEXT_FLAGS
|
||||
/* leave as convenience define for the future */
|
||||
|
@ -117,13 +109,6 @@ public:
|
|||
*/
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut);
|
||||
|
||||
protected:
|
||||
inline void activateGLXEW() const {
|
||||
#ifdef WITH_GLEW_MX
|
||||
glxewContext = m_glxewContext;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
void initContextGLXEW();
|
||||
|
||||
|
@ -140,10 +125,6 @@ private:
|
|||
|
||||
GLXContext m_context;
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
GLXEWContext *m_glxewContext;
|
||||
#endif
|
||||
|
||||
/** The first created OpenGL context (for sharing display lists) */
|
||||
static GLXContext s_sharedContext;
|
||||
static int s_sharedCount;
|
||||
|
|
|
@ -97,8 +97,6 @@ GHOST_TSuccess GHOST_ContextSDL::swapBuffers()
|
|||
GHOST_TSuccess GHOST_ContextSDL::activateDrawingContext()
|
||||
{
|
||||
if (m_context) {
|
||||
activateGLEW();
|
||||
|
||||
return SDL_GL_MakeCurrent(m_window, m_context) ? GHOST_kSuccess : GHOST_kFailure;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
WGLEWContext *wglewContext = NULL;
|
||||
#endif
|
||||
|
||||
HGLRC GHOST_ContextWGL::s_sharedHGLRC = NULL;
|
||||
int GHOST_ContextWGL::s_sharedCount = 0;
|
||||
|
||||
|
@ -82,10 +78,6 @@ GHOST_ContextWGL::GHOST_ContextWGL(
|
|||
m_alphaBackground(alphaBackground),
|
||||
m_contextResetNotificationStrategy(contextResetNotificationStrategy),
|
||||
m_hGLRC(NULL)
|
||||
#ifdef WITH_GLEW_MX
|
||||
,
|
||||
m_wglewContext(NULL)
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
,
|
||||
m_dummyVendor(NULL),
|
||||
|
@ -116,10 +108,6 @@ GHOST_ContextWGL::~GHOST_ContextWGL()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
delete m_wglewContext;
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
free((void*)m_dummyRenderer);
|
||||
free((void*)m_dummyVendor);
|
||||
|
@ -158,7 +146,6 @@ GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut)
|
|||
GHOST_TSuccess GHOST_ContextWGL::activateDrawingContext()
|
||||
{
|
||||
if (WIN32_CHK(::wglMakeCurrent(m_hDC, m_hGLRC))) {
|
||||
activateGLEW();
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
else {
|
||||
|
@ -338,15 +325,6 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
|
|||
|
||||
int iPixelFormat;
|
||||
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
wglewContext = new WGLEWContext;
|
||||
memset(wglewContext, 0, sizeof(WGLEWContext));
|
||||
|
||||
delete m_wglewContext;
|
||||
m_wglewContext = wglewContext;
|
||||
#endif
|
||||
|
||||
SetLastError(NO_ERROR);
|
||||
|
||||
prevHDC = ::wglGetCurrentDC();
|
||||
|
@ -385,13 +363,8 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
|
|||
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
|
||||
goto finalize;
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
if (GLEW_CHK(wglewInit()) != GLEW_OK)
|
||||
fprintf(stderr, "Warning! WGLEW failed to initialize properly.\n");
|
||||
#else
|
||||
if (GLEW_CHK(glewInit()) != GLEW_OK)
|
||||
fprintf(stderr, "Warning! Dummy GLEW/WGLEW failed to initialize properly.\n");
|
||||
#endif
|
||||
|
||||
// the following are not technially WGLEW, but they also require a context to work
|
||||
|
||||
|
@ -828,8 +801,6 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
|
|||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
activateWGLEW();
|
||||
|
||||
if (WGLEW_ARB_create_context) {
|
||||
int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
|
|
|
@ -36,16 +36,8 @@
|
|||
|
||||
#include "GHOST_Context.h"
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
#define wglewGetContext() wglewContext
|
||||
#endif
|
||||
|
||||
#include <GL/wglew.h>
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
extern "C" WGLEWContext *wglewContext;
|
||||
#endif
|
||||
|
||||
#ifndef GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
|
||||
#define GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY 0
|
||||
#endif
|
||||
|
@ -113,13 +105,6 @@ public:
|
|||
*/
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut);
|
||||
|
||||
protected:
|
||||
inline void activateWGLEW() const {
|
||||
#ifdef WITH_GLEW_MX
|
||||
wglewContext = m_wglewContext;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
int choose_pixel_format(
|
||||
bool stereoVisual,
|
||||
|
@ -163,10 +148,6 @@ private:
|
|||
const int m_contextResetNotificationStrategy;
|
||||
|
||||
HGLRC m_hGLRC;
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
WGLEWContext *m_wglewContext;
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
const char *m_dummyVendor;
|
||||
|
|
|
@ -49,12 +49,6 @@
|
|||
#ifndef __GLEW_MX_H__
|
||||
#define __GLEW_MX_H__
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
/* glew itself expects this */
|
||||
# define GLEW_MX 1
|
||||
# define glewGetContext() (&(_mx_context->glew_context))
|
||||
#endif
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
|
||||
|
@ -62,23 +56,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* MXContext is used instead of GLEWContext directly so that
|
||||
extending what data is held by a context is easier.
|
||||
*/
|
||||
typedef struct MXContext {
|
||||
#ifdef WITH_GLEW_MX
|
||||
GLEWContext glew_context;
|
||||
#endif
|
||||
|
||||
int reserved; /* structs need at least one member */
|
||||
|
||||
} MXContext;
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
extern MXContext *_mx_context;
|
||||
#endif
|
||||
|
||||
|
||||
#include "intern/symbol-binding.h"
|
||||
|
||||
|
||||
|
@ -89,12 +66,6 @@ extern MXContext *_mx_context;
|
|||
# include "intern/gl-deprecated.h"
|
||||
#endif
|
||||
|
||||
|
||||
MXContext *mxCreateContext (void);
|
||||
MXContext *mxGetCurrentContext (void);
|
||||
void mxMakeCurrentContext(MXContext *ctx);
|
||||
void mxDestroyContext (MXContext *ctx);
|
||||
|
||||
GLenum glew_chk(GLenum error, const char *file, int line, const char *text);
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
|
|
@ -84,61 +84,3 @@ GLenum glew_chk(GLenum error, const char *file, int line, const char *text)
|
|||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_GLEW_MX
|
||||
MXContext *_mx_context = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
MXContext *mxCreateContext(void)
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
MXContext* new_ctx = calloc(1, sizeof(MXContext));
|
||||
|
||||
if (new_ctx != NULL) {
|
||||
MXContext* cur_ctx = _mx_context;
|
||||
_mx_context = new_ctx;
|
||||
GLEW_CHK(glewInit());
|
||||
_mx_context = cur_ctx;
|
||||
}
|
||||
|
||||
return new_ctx;
|
||||
#else
|
||||
GLEW_CHK(glewInit());
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
MXContext *mxGetCurrentContext(void)
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
return _mx_context;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void mxMakeCurrentContext(MXContext *ctx)
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
_mx_context = ctx;
|
||||
#else
|
||||
(void)ctx;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void mxDestroyContext(MXContext *ctx)
|
||||
{
|
||||
#ifdef WITH_GLEW_MX
|
||||
if (_mx_context == ctx)
|
||||
_mx_context = NULL;
|
||||
|
||||
free(ctx);
|
||||
#else
|
||||
(void)ctx;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -161,21 +161,21 @@ void gpu_debug_init(void)
|
|||
fprintf(stderr, "Using %s\n", GLEW_VERSION_4_3 ? "OpenGL 4.3 debug facilities" : "KHR_debug extension");
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback((GLDEBUGPROC)gpu_debug_proc, mxGetCurrentContext());
|
||||
glDebugMessageCallback((GLDEBUGPROC)gpu_debug_proc, NULL);
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
GPU_string_marker(success);
|
||||
}
|
||||
else if (GLEW_ARB_debug_output) {
|
||||
fprintf(stderr, "Using ARB_debug_output extension\n");
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)gpu_debug_proc, mxGetCurrentContext());
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)gpu_debug_proc, NULL);
|
||||
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
GPU_string_marker(success);
|
||||
}
|
||||
# if LEGACY_DEBUG
|
||||
else if (GLEW_AMD_debug_output) {
|
||||
fprintf(stderr, "Using AMD_debug_output extension\n");
|
||||
glDebugMessageCallbackAMD(gpu_debug_proc_amd, mxGetCurrentContext());
|
||||
glDebugMessageCallbackAMD(gpu_debug_proc_amd, NULL);
|
||||
glDebugMessageEnableAMD(GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
GPU_string_marker(success);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue