MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ acquire()

std::shared_ptr< Core::VKImage > MayaFlux::Portal::Graphics::ImageCacheSet::acquire ( TextureLoom &  loom,
const ImageKey &  key 
)

Definition at line 517 of file TextureLoom.cpp.

519{
520 if (m_last_entry && m_last_key == key)
521 return m_last_entry->cache.image;
522
523 auto found = m_entries.find(key);
524 if (found != m_entries.end()) {
525 m_last_key = key;
526 m_last_entry = &found->second;
527 return found->second.cache.image;
528 }
529
530 ImageCacheEntry cache;
531 auto image = loom.acquire_cached_image(cache, key);
532 if (!image)
533 return nullptr;
534
535 m_last_key.reset();
536 m_last_entry = nullptr;
537
538 auto [added, inserted] = m_entries.emplace(key, Entry { .cache = std::move(cache) });
539 if (!inserted)
540 return added->second.cache.image;
541
542 m_cached_bytes += image->get_size_bytes();
544 m_budget_warned = true;
546 "Image cache holds {} bytes, exceeding its {}-byte warning threshold",
548 }
549
550 m_last_key = key;
551 m_last_entry = &added->second;
552 return image;
553}
#define MF_WARN(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:47
std::unordered_map< ImageKey, Entry, ImageKeyHash > m_entries
@ ImageProcessing
Image processing tasks (filters, transformations)
@ Portal
High-level user-facing API layer.
std::shared_ptr< Core::VKImage > image

References MayaFlux::Portal::Graphics::TextureLoom::acquire_cached_image(), MayaFlux::Portal::Graphics::ImageCacheSet::Entry::cache, image, MayaFlux::Portal::Graphics::ImageCacheEntry::image, MayaFlux::Journal::ImageProcessing, m_budget_warned, m_byte_budget, m_cached_bytes, m_entries, m_last_entry, m_last_key, MF_WARN, and MayaFlux::Journal::Portal.

Referenced by MayaFlux::Yantra::TextureExecutionContext::acquire_output_image().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: