OpenSubdiv: Fix crash caused by accessing OpenGL vendor from non-main thread
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 16 Sep 2015 17:23:07 +0000 (22:23 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 16 Sep 2015 17:25:13 +0000 (22:25 +0500)
intern/opensubdiv/opensubdiv_capi.h
intern/opensubdiv/opensubdiv_utils_capi.cc
source/blender/windowmanager/intern/wm_init_exit.c

index ef6db92b1e8fe6a6378dd9c1a017a10b5722b223..8010c39647d62fc1105320fd8b6718b224293a70 100644 (file)
@@ -141,6 +141,7 @@ void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh,
 /* ** Utility functions ** */
 int openSubdiv_supportGPUDisplay(void);
 int openSubdiv_getAvailableEvaluators(void);
+void openSubdiv_init(void);
 void openSubdiv_cleanup(void);
 
 #ifdef __cplusplus
index 6bbe747634a5da700e436e42937f580872ceb8c9..a945484ba61dfa25815c4eea98ea9f45c4b6c074 100644 (file)
@@ -98,6 +98,12 @@ int openSubdiv_getAvailableEvaluators(void)
        return flags;
 }
 
+void openSubdiv_init(void)
+{
+       /* Ensure all OpenGL strings are cached. */
+       (void)openSubdiv_getAvailableEvaluators();
+}
+
 void openSubdiv_cleanup(void)
 {
        openSubdiv_osdGLDisplayDeinit();
index 724c779a0073f90309cc7666da67b0f727e6b78a..a0ac945b647e637cbcb61585ad202da5c752238f 100644 (file)
@@ -191,6 +191,10 @@ void WM_init(bContext *C, int argc, const char **argv)
                GPU_set_anisotropic(U.anisotropic_filter);
                GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
 
+#ifdef WITH_OPENSUBDIV
+               openSubdiv_init();
+#endif
+
                UI_init();
        }
        else {