diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-31 20:56:04 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 01:30:36 +0300 |
commit | 058d29ed9a3e971049c0d9d99f1cf571bfb0efae (patch) | |
tree | 04e045feec7bd75728b4e3f49bd978ad5b0e1596 /intern | |
parent | 13b0a697a07e84abe5a62168ba75f38d325d3f22 (diff) |
GHOST: Enable debug context on offscreen context too
This was a long standing TODO. This was also preventing debug callbacks
form other context than the main window.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 3 | ||||
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 5 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemNULL.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemSDL.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemSDL.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWayland.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 4 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.h | 2 |
15 files changed, 25 insertions, 21 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index f23742a9166..2046b55c97f 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -202,7 +202,8 @@ extern GHOST_WindowHandle GHOST_CreateDialogWindow(GHOST_SystemHandle systemhand * \param platform_support_callback An optional callback to check platform support * \return A handle to the new context ( == NULL if creation failed). */ -extern GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle); +extern GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle, + GHOST_GLSettings glSettings); /** * Dispose of a context. diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 04e9d5e4e14..63018a9cee8 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -265,7 +265,7 @@ class GHOST_ISystem { * Never explicitly delete the context, use disposeContext() instead. * \return The new context (or 0 if creation failed). */ - virtual GHOST_IContext *createOffscreenContext() = 0; + virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0; /** * Dispose of a context. diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 843684b6d2e..e4bb908fec8 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -135,11 +135,12 @@ void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle, system->getAllDisplayDimensions(*width, *height); } -GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle) +GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle, + GHOST_GLSettings glSettings) { GHOST_ISystem *system = (GHOST_ISystem *)systemhandle; - return (GHOST_ContextHandle)system->createOffscreenContext(); + return (GHOST_ContextHandle)system->createOffscreenContext(glSettings); } GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle, diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index e29a9ba0c29..d5b23d76016 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -115,7 +115,7 @@ class GHOST_System : public GHOST_ISystem { * Never explicitly delete the context, use disposeContext() instead. * \return The new context (or 0 if creation failed). */ - virtual GHOST_IContext *createOffscreenContext() = 0; + virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0; /** * Returns whether a window is valid. diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index 8e36cebb88a..b89edf8835d 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -116,7 +116,7 @@ class GHOST_SystemCocoa : public GHOST_System { * Never explicitly delete the context, use disposeContext() instead. * \return The new context (or 0 if creation failed). */ - GHOST_IContext *createOffscreenContext(); + GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings); /** * Dispose of a context. diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 5592078e20e..467f59defea 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -765,7 +765,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title, * Never explicitly delete the context, use #disposeContext() instead. * \return The new context (or 0 if creation failed). */ -GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext() +GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_GLSettings glSettings) { GHOST_Context *context = new GHOST_ContextCGL(false, NULL, NULL, NULL); if (context->initializeDrawingContext()) diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h index 5becf110b15..faeffffed9e 100644 --- a/intern/ghost/intern/GHOST_SystemNULL.h +++ b/intern/ghost/intern/GHOST_SystemNULL.h @@ -81,7 +81,7 @@ class GHOST_SystemNULL : public GHOST_System { void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const { /* nop */ } - GHOST_IContext *createOffscreenContext() + GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) { return NULL; } diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index b32ec4306e8..1769c432d96 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -139,7 +139,7 @@ GHOST_TUns8 GHOST_SystemSDL::getNumDisplays() const return SDL_GetNumVideoDisplays(); } -GHOST_IContext *GHOST_SystemSDL::createOffscreenContext() +GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_GLSettings glSettings) { GHOST_Context *context = new GHOST_ContextSDL(0, NULL, diff --git a/intern/ghost/intern/GHOST_SystemSDL.h b/intern/ghost/intern/GHOST_SystemSDL.h index 4b2c52f8282..57e8d17861d 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.h +++ b/intern/ghost/intern/GHOST_SystemSDL.h @@ -72,7 +72,7 @@ class GHOST_SystemSDL : public GHOST_System { void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const; - GHOST_IContext *createOffscreenContext(); + GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings); GHOST_TSuccess disposeContext(GHOST_IContext *context); diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 31110694ea6..81d9824ed26 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -1481,7 +1481,7 @@ void GHOST_SystemWayland::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUn getMainDisplayDimensions(width, height); } -GHOST_IContext *GHOST_SystemWayland::createOffscreenContext() +GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glSettings) { /* Create new off-screen window. */ wl_surface *os_surface = wl_compositor_create_surface(compositor()); diff --git a/intern/ghost/intern/GHOST_SystemWayland.h b/intern/ghost/intern/GHOST_SystemWayland.h index 30ee7679287..10b9ef6bd62 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.h +++ b/intern/ghost/intern/GHOST_SystemWayland.h @@ -62,7 +62,7 @@ class GHOST_SystemWayland : public GHOST_System { void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const override; - GHOST_IContext *createOffscreenContext() override; + GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) override; GHOST_TSuccess disposeContext(GHOST_IContext *context) override; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index f59b106afd6..533e51db355 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -328,9 +328,9 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title, * Never explicitly delete the window, use #disposeContext() instead. * \return The new context (or 0 if creation failed). */ -GHOST_IContext *GHOST_SystemWin32::createOffscreenContext() +GHOST_IContext *GHOST_SystemWin32::createOffscreenContext(GHOST_GLSettings glSettings) { - bool debug_context = false; /* TODO: inform as a parameter */ + const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0; GHOST_Context *context; diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 24925b9c403..86916b3aeeb 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -142,7 +142,7 @@ class GHOST_SystemWin32 : public GHOST_System { * Never explicitly delete the window, use disposeContext() instead. * \return The new context (or 0 if creation failed). */ - GHOST_IContext *createOffscreenContext(); + GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings); /** * Dispose of a context. diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index c0676618101..2a07e02706b 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -394,7 +394,7 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title, * Never explicitly delete the context, use disposeContext() instead. * \return The new context (or 0 if creation failed). */ -GHOST_IContext *GHOST_SystemX11::createOffscreenContext() +GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSettings) { // During development: // try 4.x compatibility profile @@ -406,6 +406,8 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext() // try 3.3 core profile // no fallbacks + const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0; + #if defined(WITH_GL_PROFILE_CORE) { const char *version_major = (char *)glewGetString(GLEW_VERSION_MAJOR); @@ -446,7 +448,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext() 4, minor, GHOST_OPENGL_EGL_CONTEXT_FLAGS | - (false ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0), + (debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0), GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY, EGL_OPENGL_API); #else @@ -458,7 +460,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext() 4, minor, GHOST_OPENGL_GLX_CONTEXT_FLAGS | - (false ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), + (debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY); #endif @@ -476,7 +478,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext() 3, 3, GHOST_OPENGL_EGL_CONTEXT_FLAGS | - (false ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0), + (debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0), GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY, EGL_OPENGL_API); #else @@ -488,7 +490,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext() 3, 3, GHOST_OPENGL_GLX_CONTEXT_FLAGS | - (false ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), + (debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY); #endif diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index ad58138d416..a852675acfb 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -153,7 +153,7 @@ class GHOST_SystemX11 : public GHOST_System { * Never explicitly delete the context, use disposeContext() instead. * \return The new context (or 0 if creation failed). */ - GHOST_IContext *createOffscreenContext(); + GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings); /** * Dispose of a context. |