diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-18 21:16:52 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-12-18 21:16:52 +0300 |
commit | 82921ce42002901791d786890c232dc6768c8e62 (patch) | |
tree | f4fd36aabfaf058d8abdd2b40d96520cdbc72e9a | |
parent | 672f2efbe68ff6e75b0994358fa0269fc7105f43 (diff) |
OpenSubdiv: Avoid having bad-level call
This is always asking for problems. Additionally, that call was leading
to OpenGL calls happening from threads.
-rw-r--r-- | intern/opensubdiv/opensubdiv_capi.cc | 2 | ||||
-rw-r--r-- | intern/opensubdiv/opensubdiv_capi.h | 5 | ||||
-rw-r--r-- | intern/opensubdiv/opensubdiv_utils_capi.cc | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c | 3 |
4 files changed, 14 insertions, 6 deletions
diff --git a/intern/opensubdiv/opensubdiv_capi.cc b/intern/opensubdiv/opensubdiv_capi.cc index 6c226d6cf6b..9b9f4baa39e 100644 --- a/intern/opensubdiv/opensubdiv_capi.cc +++ b/intern/opensubdiv/opensubdiv_capi.cc @@ -296,7 +296,7 @@ const struct OpenSubdiv_TopologyRefinerDescr *openSubdiv_getGLMeshTopologyRefine int openSubdiv_supportGPUDisplay(void) { // TODO: simplify extension check once Blender adopts GL 3.2 - return GPU_legacy_support() && + return openSubdiv_gpu_legacy_support() && (GLEW_VERSION_3_2 || (GLEW_VERSION_3_1 && GLEW_EXT_geometry_shader4) || (GLEW_VERSION_3_0 && GLEW_EXT_geometry_shader4 && GLEW_ARB_uniform_buffer_object && (GLEW_ARB_texture_buffer_object || GLEW_EXT_texture_buffer_object))); diff --git a/intern/opensubdiv/opensubdiv_capi.h b/intern/opensubdiv/opensubdiv_capi.h index 9d1c1b3795c..b40505b197d 100644 --- a/intern/opensubdiv/opensubdiv_capi.h +++ b/intern/opensubdiv/opensubdiv_capi.h @@ -141,10 +141,9 @@ void openSubdiv_osdGLMeshDisplay(OpenSubdiv_GLMesh *gl_mesh, /* ** Utility functions ** */ int openSubdiv_supportGPUDisplay(void); int openSubdiv_getAvailableEvaluators(void); -void openSubdiv_init(void); +void openSubdiv_init(bool gpu_legacy_support); void openSubdiv_cleanup(void); - -extern bool GPU_legacy_support(void); +bool openSubdiv_gpu_legacy_support(void); #ifdef __cplusplus } diff --git a/intern/opensubdiv/opensubdiv_utils_capi.cc b/intern/opensubdiv/opensubdiv_utils_capi.cc index c993e347587..ae5592367dd 100644 --- a/intern/opensubdiv/opensubdiv_utils_capi.cc +++ b/intern/opensubdiv/opensubdiv_utils_capi.cc @@ -41,6 +41,8 @@ # include "opensubdiv_device_context_cuda.h" #endif /* OPENSUBDIV_HAS_CUDA */ +static bool gpu_legacy_support_global = false; + int openSubdiv_getAvailableEvaluators(void) { if (!openSubdiv_supportGPUDisplay()) { @@ -80,13 +82,19 @@ int openSubdiv_getAvailableEvaluators(void) return flags; } -void openSubdiv_init(void) +void openSubdiv_init(bool gpu_legacy_support) { /* Ensure all OpenGL strings are cached. */ (void)openSubdiv_getAvailableEvaluators(); + gpu_legacy_support_global = gpu_legacy_support; } void openSubdiv_cleanup(void) { openSubdiv_osdGLDisplayDeinit(); } + +bool openSubdiv_gpu_legacy_support(void) +{ + return gpu_legacy_support_global; +} diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c index 0f61a50ed13..2bb55c2d1ed 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c @@ -44,6 +44,7 @@ #include "opensubdiv_converter_capi.h" #include "GL/glew.h" +#include "GPU_extensions.h" #define OSD_LOG if (false) printf @@ -987,7 +988,7 @@ void ccgSubSurf__delete_pending(void) void BKE_subsurf_osd_init(void) { - openSubdiv_init(); + openSubdiv_init(GPU_legacy_support()); BLI_spin_init(&delete_spin); } |