[Bf-blender-cvs] [df28ba8] opensubdiv-modifier: OpenSubdiv: Don't construct evaluator if GPU visualization is used

Sergey Sharybin noreply at git.blender.org
Sat Jul 11 20:02:27 CEST 2015


Commit: df28ba8986342e5a2d32ded10aa6d871830b54b2
Author: Sergey Sharybin
Date:   Fri Jul 10 16:57:49 2015 +0200
Branches: opensubdiv-modifier
https://developer.blender.org/rBdf28ba8986342e5a2d32ded10aa6d871830b54b2

OpenSubdiv: Don't construct evaluator if GPU visualization is used

===================================================================

M	intern/opensubdiv/CMakeLists.txt
M	source/blender/blenkernel/intern/CCGSubSurf.c

===================================================================

diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index 08ee65a..1b75fec 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -62,7 +62,7 @@ endmacro()
 
 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
 # TODO(sergey): OpenCL is not tested and totally unstable atm.
-#OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
+# OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
 # TODO(sergey): CUDA stays disabled for util it's ported to drievr API.
 # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 2dda659..e019a3a 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -960,7 +960,6 @@ void ccgSubSurf_free(CCGSubSurf *ss)
 	CCGAllocatorHDL allocator = ss->allocator;
 #ifdef WITH_OPENSUBDIV
 	if (ss->osd_evaluator != NULL) {
-		/* TODO(sergey): Need proper port. */
 		openSubdiv_deleteEvaluatorDescr(ss->osd_evaluator);
 	}
 	if (ss->osd_mesh != NULL) {
@@ -3044,10 +3043,9 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
 
 	ss->osd_coords_invalid = true;
 
-
 	/* Make sure OSD evaluator is up-to-date. */
-	if (opensubdiv_ensureEvaluator(ss)) {
-		if (ss->skip_grids == false) {
+	if (ss->skip_grids == false) {
+		if (opensubdiv_ensureEvaluator(ss)) {
 			/* Update coarse points in the OpenSubdiv evaluator. */
 			opensubdiv_updateCoarsePositions(ss);
 
@@ -3055,12 +3053,21 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
 			opensubdiv_evaluateGrids(ss);
 		}
 		else {
-			BLI_assert(ss->meshIFC.numLayers == 3);
-			opensubdiv_updateCoarseNormals(ss);
+			BLI_assert(!"OpenSubdiv initializetion failed, should not happen.");
 		}
 	}
 	else {
-		BLI_assert(!"OpenSubdiv initializetion failed, should not happen.");
+		BLI_assert(ss->meshIFC.numLayers == 3);
+		/* TODO(sergey): De-duplicate with the case of evalautor. */
+		if (check_topology_changed(ss)) {
+			if (ss->osd_mesh) {
+				ss->osd_mesh_invalid = true;
+			}
+			ss->osd_uvs_invalid = true;
+			ss->osd_topology_changed = false;
+			ss->osd_compute = U.opensubdiv_compute_type;
+		}
+		opensubdiv_updateCoarseNormals(ss);
 	}
 
 #ifdef DUMP_RESULT_GRIDS




More information about the Bf-blender-cvs mailing list