Page MenuHome

Images: Cache failed load attempts in MovieCache instead of in `ok` flag.
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Oct 21 2021, 7:33 PM.

Details

Summary

This removes ImageTile->ok and ImageUser->ok.
They had three possible values which (probably) had the following meanings:

  • 0: There was an error while loading the image. Don't try to load again.
  • 1: Default value. It will try to load the image.
  • 2: The image was loaded successfully.

This image-wide flag did not make sense unfortunately, because loading may work for some frames of an image sequence but not for others.

My current understand is that the ->ok flags only existed as an optimization to avoid checking the file system over and over again when a file is missing.
To get this optimization back, the patch is changing MovieCache so that it can also cache failed load attempts. As a consequence, ibuf is allowed to be NULL in a few more places. I added the appropriate null checks.

This would be useful to avoid a hacky solution in D12827.

Diff Detail

Repository
rB Blender
Branch
remove-image-ok (branched from master)
Build Status
Buildable 18088
Build 18088: arc lint + arc unit

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Oct 21 2021, 7:33 PM
Jacques Lucke (JacquesLucke) created this revision.
Jacques Lucke (JacquesLucke) retitled this revision from Images: Remove image ok flag (WIP). to Images: Remove image ok flag..Oct 21 2021, 7:46 PM
Jacques Lucke (JacquesLucke) edited the summary of this revision. (Show Details)
Jacques Lucke (JacquesLucke) edited the summary of this revision. (Show Details)

This is an important optimization, that if missing can cause Blender to hang repeatedly loading corrupt files. We should not remove the flag without an alternative solution.

Alright, will try to find the places where loading can fail and add back the optimization.

I think the better solution would be to add NULL entries to the image cache when the file failed to load, but I have not looked into all the implications of the changes in this patch.

  • Merge branch 'master' into remove-image-ok
  • quiet warning
  • bring back optimization by also caching failed load attempts
Jacques Lucke (JacquesLucke) retitled this revision from Images: Remove image ok flag. to Images: Cache failed load attempts in MovieCache instead of in `ok` flag..Oct 22 2021, 1:31 PM

I tried to carefully review the code and tried to break it with invalid image files etc, seems to be working fine.

Nice to get rid of this finally.

This revision is now accepted and ready to land.Nov 1 2021, 8:01 PM