[Bf-blender-cvs] [c699f0d] opensubdiv-modifier: Fix crash when compute type from user prefs is not supported by OpenSubdiv
Sergey Sharybin
noreply at git.blender.org
Mon May 12 20:09:05 CEST 2014
Commit: c699f0d61937d8544d7f7a9dcb3fb33e5ec39b48
Author: Sergey Sharybin
Date: Sun May 11 20:34:00 2014 +0200
https://developer.blender.org/rBc699f0d61937d8544d7f7a9dcb3fb33e5ec39b48
Fix crash when compute type from user prefs is not supported by OpenSubdiv
===================================================================
M source/blender/blenkernel/intern/CCGSubSurf.c
===================================================================
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 7d6d783..b1827f9 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -2341,6 +2341,12 @@ void ccgSubSurf_prepareGLMesh(CCGSubSurf *ss)
ss->osd_evaluator,
compute_type,
ss->subdivLevels);
+
+ if (UNLIKELY(ss->osd_mesh == NULL)) {
+ /* Most likely compute device is not available. */
+ return;
+ }
+
ccgSubSurf__updateGLMeshCoords(ss);
openSubdiv_osdGLMeshRefine(ss->osd_mesh);
@@ -2371,11 +2377,13 @@ void ccgSubSurf_prepareGLMesh(CCGSubSurf *ss)
void ccgSubSurf_drawGLMesh(CCGSubSurf *ss)
{
- openSubdiv_osdGLMeshBindvertexBuffer(ss->osd_mesh);
- glBindVertexArray(ss->osd_vao);
- openSubdiv_osdGLMeshDisplay(ss->osd_mesh);
- glBindVertexArray(0);
- glBindBuffer(GL_ARRAY_BUFFER, 0);
+ if (LIKELY(ss->osd_mesh != NULL)) {
+ openSubdiv_osdGLMeshBindvertexBuffer(ss->osd_mesh);
+ glBindVertexArray(ss->osd_vao);
+ openSubdiv_osdGLMeshDisplay(ss->osd_mesh);
+ glBindVertexArray(0);
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ }
}
void ccgSubSurf_setSkipGrids(CCGSubSurf *ss, bool skip_grids)
More information about the Bf-blender-cvs
mailing list