[Bf-blender-cvs] [daff18dd286] master: Fix T63349: image texture garbage collection causing freezes
Brecht Van Lommel
noreply at git.blender.org
Mon Jul 15 17:24:39 CEST 2019
Commit: daff18dd286920c0636329c704c3758f90be0013
Author: Brecht Van Lommel
Date: Mon Jul 15 15:40:09 2019 +0200
Branches: master
https://developer.blender.org/rBdaff18dd286920c0636329c704c3758f90be0013
Fix T63349: image texture garbage collection causing freezes
Images were being freed often because the tagging for when the image was last
used was missing.
Differential Revision: https://developer.blender.org/D5252
===================================================================
M source/blender/editors/space_image/image_draw.c
M source/blender/gpu/intern/gpu_draw.c
===================================================================
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 86db6d50fcc..38253890624 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -797,6 +797,9 @@ void draw_image_main(const bContext *C, ARegion *ar)
ima = ED_space_image(sima);
ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
+ /* Tag image as in active use for garbage collector. */
+ BKE_image_tag_time(ima);
+
show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) &&
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index d1d5e1d89a2..be3655648f5 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -475,6 +475,9 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int textarget
ima->gpuflag &= ~IMA_GPU_REFRESH;
}
+ /* Tag as in active use for garbage collector. */
+ BKE_image_tag_time(ima);
+
/* Test if we already have a texture. */
GPUTexture **tex = gpu_get_image_gputexture(ima, textarget);
if (*tex) {
More information about the Bf-blender-cvs
mailing list