[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60850] branches/soc-2013-depsgraph_mt/ source/blender: Avoid spawning local evaluation contexts

Sergey Sharybin sergey.vfx at gmail.com
Sat Oct 19 01:18:40 CEST 2013


Revision: 60850
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60850
Author:   nazgul
Date:     2013-10-18 23:18:40 +0000 (Fri, 18 Oct 2013)
Log Message:
-----------
Avoid spawning local evaluation contexts

Instead of creating local one, make sure either context
from Render or G.main is used.

Modified Paths:
--------------
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_anim.h
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_library.h
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_main.h
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_scene.h
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_sequencer.h
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/anim.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/blender.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/dynamicpaint.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/library.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/object.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/pointcache.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/scene.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/smoke.c
    branches/soc-2013-depsgraph_mt/source/blender/blenloader/intern/readfile.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/mesh/editmesh_extrude.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/mesh/editmesh_utils.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/object/object_add.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/render/render_opengl.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/screen/screen_edit.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/sound/sound_ops.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/space_view3d/view3d_view.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/transform/transform_conversions.c
    branches/soc-2013-depsgraph_mt/source/blender/editors/transform/transform_snap.c
    branches/soc-2013-depsgraph_mt/source/blender/gpu/intern/gpu_material.c
    branches/soc-2013-depsgraph_mt/source/blender/makesrna/intern/rna_scene_api.c
    branches/soc-2013-depsgraph_mt/source/blender/render/intern/source/convertblender.c
    branches/soc-2013-depsgraph_mt/source/blender/render/intern/source/external_engine.c
    branches/soc-2013-depsgraph_mt/source/blender/render/intern/source/pipeline.c
    branches/soc-2013-depsgraph_mt/source/blender/windowmanager/intern/wm_event_system.c
    branches/soc-2013-depsgraph_mt/source/blender/windowmanager/intern/wm_operators.c

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_anim.h
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_anim.h	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_anim.h	2013-10-18 23:18:40 UTC (rev 60850)
@@ -68,7 +68,6 @@
 
 struct ListBase *object_duplilist_ex(struct EvaluationContext *evaluation_context, struct Scene *sce, struct Object *ob, bool update);
 struct ListBase *object_duplilist(struct EvaluationContext *evaluation_context, struct Scene *sce, struct Object *ob);
-struct ListBase *object_duplilist_viewport(struct Scene *scene, struct Object *object);
 void free_object_duplilist(struct ListBase *lb);
 int count_duplilist(struct Object *ob);
 

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_library.h
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_library.h	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_library.h	2013-10-18 23:18:40 UTC (rev 60850)
@@ -76,6 +76,8 @@
 void BKE_libblock_free(struct ListBase *lb, void *idv);
 void BKE_libblock_free_us(struct ListBase *lb, void *idv);
 void BKE_libblock_free_data(struct ID *id);
+
+struct Main *BKE_main_allocate(void);
 void free_main(struct Main *mainvar);
 
 void tag_main_idcode(struct Main *mainvar, const short type, const short tag);

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_main.h
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_main.h	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_main.h	2013-10-18 23:18:40 UTC (rev 60850)
@@ -46,6 +46,7 @@
 extern "C" {
 #endif
 
+struct EvaluationContext;
 struct Library;
 
 typedef struct Main {
@@ -91,6 +92,9 @@
 	ListBase linestyle;
 
 	char id_tag_update[256];
+
+	/* Evaluation context used by viewport */
+	struct EvaluationContext *evaluation_context;
 } Main;
 
 #define MAIN_VERSION_ATLEAST(main, ver, subver) \

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_scene.h
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_scene.h	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_scene.h	2013-10-18 23:18:40 UTC (rev 60850)
@@ -126,9 +126,6 @@
 void BKE_scene_update_for_newframe_ex(struct EvaluationContext *evaluation_context, struct Main *bmain, struct Scene *sce, unsigned int lay, bool use_threads);
 void BKE_scene_update_for_newframe(struct EvaluationContext *evaluation_context, struct Main *bmain, struct Scene *sce, unsigned int lay);
 
-void BKE_scene_update_for_newframe_viewport(struct Main *bmain, struct Scene *sce, unsigned int lay);
-void BKE_scene_update_for_newframe_render(struct Main *bmain, struct Scene *sce, unsigned int lay);
-
 struct SceneRenderLayer *BKE_scene_add_render_layer(struct Scene *sce, const char *name);
 int BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
 

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_sequencer.h
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_sequencer.h	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/BKE_sequencer.h	2013-10-18 23:18:40 UTC (rev 60850)
@@ -31,6 +31,7 @@
  */
 
 struct bContext;
+struct EvaluationContext;
 struct StripColorBalance;
 struct Editing;
 struct ImBuf;
@@ -89,6 +90,7 @@
 	}
 
 typedef struct SeqRenderData {
+	struct EvaluationContext *evaluation_context;
 	struct Main *bmain;
 	struct Scene *scene;
 	int rectx;
@@ -98,8 +100,8 @@
 	float motion_blur_shutter;
 } SeqRenderData;
 
-SeqRenderData BKE_sequencer_new_render_data(struct Main *bmain, struct Scene *scene, int rectx, int recty,
-                                            int preview_render_size);
+SeqRenderData BKE_sequencer_new_render_data(struct EvaluationContext *evaluation_context, struct Main *bmain,
+                                            struct Scene *scene, int rectx, int recty, int preview_render_size);
 
 /* Wipe effect */
 enum {

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/anim.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/anim.c	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/anim.c	2013-10-18 23:18:40 UTC (rev 60850)
@@ -368,7 +368,7 @@
 	   *    that doesn't force complete update, but for now, this is the
 	   *    most accurate way!
 	   */
-	BKE_scene_update_for_newframe_viewport(G.main, scene, scene->lay); /* XXX this is the best way we can get anything moving */
+	BKE_scene_update_for_newframe(G.main->evaluation_context, G.main, scene, scene->lay); /* XXX this is the best way we can get anything moving */
 #endif
 }
 
@@ -1748,16 +1748,6 @@
 	return object_duplilist_ex(evaluation_context, sce, ob, true);
 }
 
-/* Utility function to get duplilist for viewport,
- * only used for stuff out of DAG update and render pipeline.
- */
-ListBase *object_duplilist_viewport(Scene *scene, Object *object)
-{
-	EvaluationContext evaluation_context;
-	evaluation_context.for_render = false;
-	return object_duplilist(&evaluation_context, scene, object);
-}
-
 void free_object_duplilist(ListBase *lb)
 {
 	DupliObject *dob;

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/blender.c	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/blender.c	2013-10-18 23:18:40 UTC (rev 60850)
@@ -138,7 +138,7 @@
 	
 	U.savetime = 1;
 
-	G.main = MEM_callocN(sizeof(Main), "initglobals");
+	G.main = BKE_main_allocate();
 
 	strcpy(G.ima, "//");
 

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/dynamicpaint.c	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/dynamicpaint.c	2013-10-18 23:18:40 UTC (rev 60850)
@@ -557,13 +557,10 @@
 	ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
 	BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM);
 	if (flags & UPDATE_MESH) {
-		EvaluationContext evaluation_context;
-		evaluation_context.for_render = false;
-
 		/* ignore cache clear during subframe updates
 		 *  to not mess up cache validity */
 		object_cacheIgnoreClear(ob, 1);
-		BKE_object_handle_update(&evaluation_context, scene, ob);
+		BKE_object_handle_update(G.main->evaluation_context, scene, ob);
 		object_cacheIgnoreClear(ob, 0);
 	}
 	else

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/library.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/library.c	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/library.c	2013-10-18 23:18:40 UTC (rev 60850)
@@ -1004,6 +1004,12 @@
 	}
 }
 
+Main *BKE_main_allocate(void)
+{
+	Main *bmain = MEM_callocN(sizeof(Main), "new main");
+	bmain->evaluation_context = MEM_callocN(sizeof(EvaluationContext), "EvaluationCintext");
+	return bmain;
+}
 
 void free_main(Main *mainvar)
 {
@@ -1064,6 +1070,7 @@
 		}
 	}
 
+	MEM_freeN(mainvar->evaluation_context);
 	MEM_freeN(mainvar);
 }
 

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/object.c	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/object.c	2013-10-18 23:18:40 UTC (rev 60850)
@@ -2539,10 +2539,7 @@
 	else {
 		ListBase *lb;
 		DupliObject *dob;
-		EvaluationContext evaluation_context;
-		evaluation_context.for_render = false;
-
-		lb = object_duplilist(&evaluation_context, scene, ob);
+		lb = object_duplilist(G.main->evaluation_context, scene, ob);
 		for (dob = lb->first; dob; dob = dob->next) {
 			if ((use_hidden == false) && (dob->no_draw != 0)) {
 				/* pass */
@@ -2619,7 +2616,7 @@
 				ListBase *lb;
 				DupliObject *dob;
 
-				lb = object_duplilist_viewport(scene, ob);
+				lb = object_duplilist(G.main->evaluation_context, scene, ob);
 				for (dob = lb->first; dob; dob = dob->next) {
 					if (dob->no_draw == 0) {
 						BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data);

Modified: branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/pointcache.c	2013-10-18 22:15:09 UTC (rev 60849)
+++ branches/soc-2013-depsgraph_mt/source/blender/blenkernel/intern/pointcache.c	2013-10-18 23:18:40 UTC (rev 60850)
@@ -1408,11 +1408,8 @@
 
 	if (scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
 		ListBase *lb_dupli_ob;
-		EvaluationContext evaluation_context;
-		evaluation_context.for_render = false;
-
 		/* don't update the dupli groups, we only want their pid's */
-		if ((lb_dupli_ob = object_duplilist_ex(&evaluation_context, scene, ob, FALSE))) {
+		if ((lb_dupli_ob = object_duplilist_ex(G.main->evaluation_context, scene, ob, FALSE))) {
 			DupliObject *dob;
 			for (dob= lb_dupli_ob->first; dob; dob= dob->next) {
 				if (dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
@@ -3161,7 +3158,7 @@
 	efra = data->endframe;
 
 	for (; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) {
-		BKE_scene_update_for_newframe_viewport(data->main, data->scene, data->scene->lay);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list