[Bf-blender-cvs] [433e3db8d89] blender2.8: Revert "GHOST: Delay opengl context initialization"
Clément Foucault
noreply at git.blender.org
Tue Jul 3 13:36:14 CEST 2018
Commit: 433e3db8d89130531424e2468dedcfb36f6eb592
Author: Clément Foucault
Date: Mon Jul 2 19:39:50 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB433e3db8d89130531424e2468dedcfb36f6eb592
Revert "GHOST: Delay opengl context initialization"
This reverts commit 128926a41b368e166af63515370d9c9367e3dda2.
===================================================================
M intern/gawain/src/gwn_vertex_array_id.cpp
M intern/ghost/intern/GHOST_ContextGLX.cpp
M intern/ghost/intern/GHOST_ContextGLX.h
M source/blender/draw/intern/draw_manager.c
===================================================================
diff --git a/intern/gawain/src/gwn_vertex_array_id.cpp b/intern/gawain/src/gwn_vertex_array_id.cpp
index 2ab38a8fe18..ad60dea7542 100644
--- a/intern/gawain/src/gwn_vertex_array_id.cpp
+++ b/intern/gawain/src/gwn_vertex_array_id.cpp
@@ -18,7 +18,7 @@
#include <mutex>
#include <unordered_set>
-#if 0
+#if TRUST_NO_ONE
extern "C" {
extern int BLI_thread_is_main(void); // Blender-specific function
}
@@ -68,8 +68,7 @@ static void clear_orphans(Gwn_Context* ctx)
Gwn_Context* GWN_context_create(void)
{
#if TRUST_NO_ONE
- /* We cannot rely on this anymore. */
- // assert(thread_is_main());
+ assert(thread_is_main());
#endif
Gwn_Context* ctx = new Gwn_Context;
glGenVertexArrays(1, &ctx->default_vao);
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 1365a1a9c24..815189b9098 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -110,9 +110,6 @@ GHOST_TSuccess GHOST_ContextGLX::swapBuffers()
GHOST_TSuccess GHOST_ContextGLX::activateDrawingContext()
{
- if (m_init == false) {
- initContext();
- }
if (m_display) {
return ::glXMakeCurrent(m_display, m_window, m_context) ? GHOST_kSuccess : GHOST_kFailure;
}
@@ -187,8 +184,7 @@ const bool GLXEW_ARB_create_context_robustness =
glxewInit();
#endif /* USE_GLXEW_INIT_WORKAROUND */
- /* Only init the non-offscreen context directly */
- const bool do_init = (m_window != None);
+
if (GLXEW_ARB_create_context) {
int profileBitCore = m_contextProfileMask & GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
@@ -308,27 +304,12 @@ const bool GLXEW_ARB_create_context_robustness =
GHOST_TSuccess success;
if (m_context != NULL) {
+ const unsigned char *version;
+
if (!s_sharedContext)
s_sharedContext = m_context;
s_sharedCount++;
- }
-
- if (do_init) {
- success = initContext();
- }
-
- GHOST_X11_ERROR_HANDLERS_RESTORE(handler_store);
-
- return success;
-}
-
-GHOST_TSuccess GHOST_ContextGLX::initContext()
-{
- GHOST_TSuccess success;
-
- if (m_context != NULL) {
- const unsigned char *version;
glXMakeCurrent(m_display, m_window, m_context);
@@ -360,12 +341,13 @@ GHOST_TSuccess GHOST_ContextGLX::initContext()
success = GHOST_kFailure;
}
- /* We tag as init even if it fails. */
- m_init = true;
+
+ GHOST_X11_ERROR_HANDLERS_RESTORE(handler_store);
return success;
}
+
GHOST_TSuccess GHOST_ContextGLX::releaseNativeHandles()
{
m_window = 0;
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h
index b4d6a841d72..ded1b293659 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -116,7 +116,6 @@ public:
private:
void initContextGLXEW();
- GHOST_TSuccess initContext();
Display *m_display;
GLXFBConfig m_fbconfig;
@@ -129,7 +128,6 @@ private:
const int m_contextResetNotificationStrategy;
GLXContext m_context;
- bool m_init;
/** The first created OpenGL context (for sharing display lists) */
static GLXContext s_sharedContext;
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 504e53fd206..b7326ca5842 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2184,8 +2184,6 @@ void DRW_opengl_context_create(void)
}
/* This changes the active context. */
DST.gl_context = WM_opengl_context_create();
- /* Make the context active for this thread (main thread) */
- WM_opengl_context_activate(DST.gl_context);
/* Be sure to create gawain.context too. */
DST.gwn_context = GWN_context_create();
if (!G.background) {
More information about the Bf-blender-cvs
mailing list