summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/display.folk12
1 files changed, 12 insertions, 0 deletions
diff --git a/virtual-programs/display.folk b/virtual-programs/display.folk
index 222813a1..f7b70959 100644
--- a/virtual-programs/display.folk
+++ b/virtual-programs/display.folk
@@ -340,6 +340,18 @@ On process {
proc checkImCacheAndCopyIfNeeded {imDrawSet} {
variable imCache
variable IMCACHE_MAX_IMAGES
+
+ dict for {im v} $imDrawSet {
+ if {![dict exists $imCache $im]} { continue }
+ # Check for staleness and remove from cache if so.
+ lassign [dict get $imCache $im] gim expectedVersion
+ set version [Heap::folkHeapGetVersion [string map {uint8_t void} [::image_t data_ptr $im]]]
+ if {$expectedVersion != $version} {
+ Gpu::ImageManager::freeGpuImage $gim
+ dict unset imCache $im
+ }
+ }
+
set notInCache [dictset difference $imDrawSet $imCache]
set notInDrawSet [dictset difference $imCache $imDrawSet]