[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28890] trunk/blender/source/blender: opengl render was freeing all images from the graphics card each update.

Campbell Barton ideasman42 at gmail.com
Thu May 20 18:08:07 CEST 2010


Revision: 28890
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28890
Author:   campbellbarton
Date:     2010-05-20 18:08:06 +0200 (Thu, 20 May 2010)

Log Message:
-----------
opengl render was freeing all images from the graphics card each update.
with some 4x4k and 4x8k textures this becomes very slow.

only free animated textures (movies and sequences)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/gpu/GPU_draw.h
    trunk/blender/source/blender/gpu/intern/gpu_draw.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2010-05-20 15:34:44 UTC (rev 28889)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2010-05-20 16:08:06 UTC (rev 28890)
@@ -1965,8 +1965,11 @@
 
 	/* set flags */
 	G.f |= G_RENDER_OGL;
-	GPU_free_images();
 
+	/* free images which can have changed on frame-change
+	 * warning! can be slow so only free animated images - campbell */
+	GPU_free_images_anim();
+
 	/* set background color, fallback on the view background color */
 	if(scene->world) {
 		glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0);
@@ -2030,7 +2033,8 @@
 	/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
 	draw_gpencil_view3d_ext(scene, ar, 0);
 
-	GPU_free_images();
+	/* freeing the images again here could be done after the operator runs, leaving for now */
+	GPU_free_images_anim();
 
 	/* restore size */
 	ar->winx= bwinx;

Modified: trunk/blender/source/blender/gpu/GPU_draw.h
===================================================================
--- trunk/blender/source/blender/gpu/GPU_draw.h	2010-05-20 15:34:44 UTC (rev 28889)
+++ trunk/blender/source/blender/gpu/GPU_draw.h	2010-05-20 16:08:06 UTC (rev 28890)
@@ -117,6 +117,7 @@
 int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap);
 void GPU_free_image(struct Image *ima);
 void GPU_free_images(void);
+void GPU_free_images_anim(void);
 
 /* smoke drawing functions */
 void GPU_free_smoke(struct SmokeModifierData *smd);

Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_draw.c	2010-05-20 15:34:44 UTC (rev 28889)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c	2010-05-20 16:08:06 UTC (rev 28890)
@@ -851,6 +851,17 @@
 			GPU_free_image(ima);
 }
 
+/* same as above but only free animated images */
+void GPU_free_images_anim(void)
+{
+	Image* ima;
+
+	if(G.main)
+		for(ima=G.main->image.first; ima; ima=ima->id.next)
+			if(ELEM(ima->type, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+				GPU_free_image(ima);
+}
+
 /* OpenGL Materials */
 
 #define FIXEDMAT	8





More information about the Bf-blender-cvs mailing list