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)
This commit is contained in:
Campbell Barton
2010-05-20 16:08:06 +00:00
parent 4d6d68bfa1
commit 0ac1564f68
3 changed files with 18 additions and 2 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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