[Bf-blender-cvs] [8098b87] opensubdiv-modifier: OpenSubdiv: Skip orcodm construction for now

Sergey Sharybin noreply at git.blender.org
Fri Jul 25 18:00:40 CEST 2014


Commit: 8098b87b82a7f1957b2b07869b982e4d5a75073b
Author: Sergey Sharybin
Date:   Fri Jul 25 21:59:34 2014 +0600
Branches: opensubdiv-modifier
https://developer.blender.org/rB8098b87b82a7f1957b2b07869b982e4d5a75073b

OpenSubdiv: Skip orcodm construction for now

This slows things down like a hell and we need to find a better
way dealing with the generated coordinates than doing it all on
poor CPU.

Also fixed crash when displaying object without UV map in textured
viewport.

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

M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/subsurf_ccg.c
M	source/blender/modifiers/intern/MOD_subsurf.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index ce7fbee..76a8831 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1547,6 +1547,23 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		}
 	}
 
+	/* TODO(sergey): Workaround to make GPU-side SS playback as fast as possible.
+	 *
+	 * Constructing orcodm on the CPU is hell of a lot slow business, so let's
+	 * skip it for now.
+	 */
+#ifdef WITH_OPENSUBDIV
+	{
+		ModifierData *last_md = ob->modifiers.last;
+		if (allow_gpu && last_md != NULL &&
+		    last_md->type == eModifierType_Subsurf &&
+		    !useRenderParams)
+		{
+			dataMask &= ~CD_MASK_ORCO;
+		}
+	}
+#endif
+
 	datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode, previewmd, previewmask);
 	curr = datamasks;
 
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index ea00bd5..28fd1a7 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2474,7 +2474,9 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
 			int mat_nr;
 			bool drawSmooth;
 
-			ME_MTEXFACE_CPY(&tmp_tf, &mtexpoly[index]);
+			if (mtexpoly != NULL) {
+				ME_MTEXFACE_CPY(&tmp_tf, &mtexpoly[index]);
+			}
 
 			if (faceFlags) {
 				drawSmooth = (lnors || (faceFlags[0].flag & ME_SMOOTH));
@@ -2487,7 +2489,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
 
 			glShadeModel(drawSmooth ? GL_SMOOTH : GL_FLAT);
 
-			if (drawParams != NULL)
+			if (drawParams != NULL && mtexpoly != NULL)
 				drawParams(&tmp_tf, (mcol != NULL), mat_nr);
 
 			ccgSubSurf_drawGLMesh(ss, true, i, 1);
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index 9d53d39..7d7c0cd 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -103,7 +103,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	const bool allow_gpu = (flag & MOD_APPLY_ALLOW_GPU) != 0;
 
 	/* TODO(sergey): Investigate whether we still need this. */
-	const bool do_cddm_convert = useRenderParams || !isFinalCalc;
+	const bool do_cddm_convert = useRenderParams;
 
 	if (useRenderParams)
 		subsurf_flags |= SUBSURF_USE_RENDER_PARAMS;




More information about the Bf-blender-cvs mailing list