diff --git a/Source/Frameworks/gyroflow/inc/gyroflow.h b/Source/Frameworks/gyroflow/inc/gyroflow.h index 5417a9c0..bdf2a7a5 100644 --- a/Source/Frameworks/gyroflow/inc/gyroflow.h +++ b/Source/Frameworks/gyroflow/inc/gyroflow.h @@ -34,3 +34,5 @@ const char* processFrame( void *out_mtl_texture, void *command_queue ); + +uint32_t trashCache(); diff --git a/Source/Frameworks/gyroflow/src/lib.rs b/Source/Frameworks/gyroflow/src/lib.rs index 025591f2..913307d1 100644 --- a/Source/Frameworks/gyroflow/src/lib.rs +++ b/Source/Frameworks/gyroflow/src/lib.rs @@ -27,7 +27,25 @@ use std::sync::Mutex; // A mutual exclusion primitive usef // each pixel format: //--------------------------------------------------------- lazy_static! { - static ref MANAGER_CACHE: Mutex>> = Mutex::new(LruCache::new(std::num::NonZeroUsize::new(5).unwrap())); + static ref MANAGER_CACHE: Mutex>> = Mutex::new(LruCache::new(std::num::NonZeroUsize::new(8).unwrap())); +} + +//--------------------------------------------------------- +// The "Trash Cache" function that gets triggered from +// Objective-C Land: +//--------------------------------------------------------- +#[no_mangle] +pub extern "C" fn trashCache() -> u32 { + //--------------------------------------------------------- + // Trash the Cache: + //--------------------------------------------------------- + let mut cache = MANAGER_CACHE.lock().unwrap(); + cache.clear(); + + //--------------------------------------------------------- + // Return the Cache Size: + //--------------------------------------------------------- + cache.len() as u32 } //--------------------------------------------------------- diff --git a/Source/Gyroflow/Plugin/GyroflowPlugIn.m b/Source/Gyroflow/Plugin/GyroflowPlugIn.m index 3a432ae9..758e00c4 100644 --- a/Source/Gyroflow/Plugin/GyroflowPlugIn.m +++ b/Source/Gyroflow/Plugin/GyroflowPlugIn.m @@ -1378,6 +1378,13 @@ - (void)buttonLoadLastGyroflowProject { // BUTTON: 'Reload Gyroflow Project' //--------------------------------------------------------- - (void)buttonReloadGyroflowProject { + + //--------------------------------------------------------- + // Trash all the caches in Rust land: + //--------------------------------------------------------- + uint32_t cacheSize = trashCache(); + NSLog(@"[Gyroflow Toolbox Renderer]: Rust MANAGER_CACHE size after trashing (should be zero): %u", cacheSize); + //--------------------------------------------------------- // Load the Custom Parameter Action API: //---------------------------------------------------------