Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
aurore::TextureCache Class Reference

#include <aurore/core/cache_helper.hpp>

Inheritance diagram for aurore::TextureCache:
aurore::Singleton< TextureCache >

Public Member Functions

 TextureCache ()
 
int getCache (const std::string &key)
 
void addCache (const std::string &key, size_t texture)
 
void removeCache (size_t texture)
 
void markDirty (size_t texture)
 
void updateCache (size_t old_tex, size_t new_tex)
 
void setMemoryBudget (size_t bytes)
 
size_t getTotalBytes () const
 
size_t getSize () const
 
void clean ()
 
void trimUnused ()
 
void debug ()
 
- Public Member Functions inherited from aurore::Singleton< TextureCache >
 Singleton (const Singleton &)=delete
 
Singleton & operator= (const Singleton)=delete
 

Public Attributes

LRUCache< std::string, size_t > cache = LRUCache<std::string, size_t>(200, 0)
 

Additional Inherited Members

- Static Public Member Functions inherited from aurore::Singleton< TextureCache >
static TextureCache & instance ()
 
- Protected Member Functions inherited from aurore::Singleton< TextureCache >
 Singleton ()
 

Constructor & Destructor Documentation

◆ TextureCache()

aurore::TextureCache::TextureCache ( )
inline

Member Function Documentation

◆ addCache()

void aurore::TextureCache::addCache ( const std::string &  key,
size_t  texture 
)
inline

Add cache

◆ clean()

void aurore::TextureCache::clean ( )
inline

◆ debug()

void aurore::TextureCache::debug ( )
inline

◆ getCache()

int aurore::TextureCache::getCache ( const std::string &  key)
inline

◆ getSize()

size_t aurore::TextureCache::getSize ( ) const
inline

◆ getTotalBytes()

size_t aurore::TextureCache::getTotalBytes ( ) const
inline

◆ markDirty()

void aurore::TextureCache::markDirty ( size_t  texture)
inline

◆ removeCache()

void aurore::TextureCache::removeCache ( size_t  texture)
inline

Subtract the matching texture cache counter by 1, and delete the cache if the counter returns to zero.

◆ setMemoryBudget()

void aurore::TextureCache::setMemoryBudget ( size_t  bytes)
inline

At most bytes of textures nothing shows are kept (0: no limit, the default); the least recently used go first. A texture weighs its width × height × 4.

◆ trimUnused()

void aurore::TextureCache::trimUnused ( )
inline

Free GPU memory for all textures whose reference count has reached zero. Safe to call at any time; in-use textures (count > 0) are left untouched.

◆ updateCache()

void aurore::TextureCache::updateCache ( size_t  old_tex,
size_t  new_tex 
)
inline

update texture id

Member Data Documentation

◆ cache

LRUCache<std::string, size_t> aurore::TextureCache::cache = LRUCache<std::string, size_t>(200, 0)

The documentation for this class was generated from the following file: