Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-05-20 20:08:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-05-20 20:08:06 +0400
commit0ac1564f681aea3af7c0cb72d5c88637fc436503 (patch)
treead1da46c9d6d0dc0a877184ea4ba43aa4b75c1d0 /source
parent4d6d68bfa16fd3d55455b12495bf21b82ea8cb11 (diff)
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)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c8
-rw-r--r--source/blender/gpu/GPU_draw.h1
-rw-r--r--source/blender/gpu/intern/gpu_draw.c11
3 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 9f9733bc80c..53fd0125329 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1965,7 +1965,10 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* 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) {
@@ -2030,7 +2033,8 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* 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;
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index e233a3f3d94..92bf43e9a5a 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -117,6 +117,7 @@ int GPU_update_image_time(struct Image *ima, double time);
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);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6eb3e13c4e2..9a5a6704428 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -851,6 +851,17 @@ void GPU_free_images(void)
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