Fix T78537: too much memory usage rendering animation with persistent images
For still images, always return 0 for the current frame number. This ensures Cycles can detects that the image did not change. Based on patch by Vincent Blankfield. Differential Revision: https://developer.blender.org/D8242
This commit is contained in:
parent
f47f9a04b1
commit
a71490c4b2
Notes:
blender-bot
2023-02-14 10:54:29 +01:00
Referenced by issue #79952, Cycles video texture bug (fixed in 2.90 beta and 2.91 alpha -- 2.83 LTS issue) Referenced by issue #78537, High Memory Usage when render animation with Persistant Images enabled, and using Fix (T77734) reproducible with Latest 2.90 Blender Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
|
@ -5180,24 +5180,32 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_ran
|
|||
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
|
||||
{
|
||||
if (iuser) {
|
||||
bool is_in_range;
|
||||
const int framenr = BKE_image_user_frame_get(iuser, cfra, &is_in_range);
|
||||
if (ima && BKE_image_is_animated(ima)) {
|
||||
/* Compute current frame for animated image. */
|
||||
bool is_in_range;
|
||||
const int framenr = BKE_image_user_frame_get(iuser, cfra, &is_in_range);
|
||||
|
||||
if (is_in_range) {
|
||||
iuser->flag |= IMA_USER_FRAME_IN_RANGE;
|
||||
if (is_in_range) {
|
||||
iuser->flag |= IMA_USER_FRAME_IN_RANGE;
|
||||
}
|
||||
else {
|
||||
iuser->flag &= ~IMA_USER_FRAME_IN_RANGE;
|
||||
}
|
||||
|
||||
iuser->framenr = framenr;
|
||||
}
|
||||
else {
|
||||
iuser->flag &= ~IMA_USER_FRAME_IN_RANGE;
|
||||
/* Set fixed frame number for still image. */
|
||||
iuser->framenr = 0;
|
||||
iuser->flag |= IMA_USER_FRAME_IN_RANGE;
|
||||
}
|
||||
|
||||
iuser->framenr = framenr;
|
||||
|
||||
if (ima && BKE_image_is_animated(ima) && ima->gpuframenr != framenr) {
|
||||
if (ima && ima->gpuframenr != iuser->framenr) {
|
||||
/* Note: a single texture and refresh doesn't really work when
|
||||
* multiple image users may use different frames, this is to
|
||||
* be improved with perhaps a GPU texture cache. */
|
||||
ima->gpuflag |= IMA_GPU_REFRESH;
|
||||
ima->gpuframenr = framenr;
|
||||
ima->gpuframenr = iuser->framenr;
|
||||
}
|
||||
|
||||
if (iuser->ok == 0) {
|
||||
|
|
Loading…
Reference in New Issue