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
This commit is contained in:
Brecht Van Lommel 2019-07-15 15:40:09 +02:00
parent 846e5f1dc0
commit daff18dd28
Notes: blender-bot 2023-02-14 03:06:24 +01:00
Referenced by issue #63349, Eevee Texture Time Out Causes Freezing
2 changed files with 6 additions and 0 deletions

View File

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

View File

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