10 #ifndef RV_TextureCache_h
11 #define RV_TextureCache_h
30 #define RV_INVALID_OP_ID -1
38 class RV_TextureResolver;
53 static void updateTextures();
56 static exint cacheVersion();
59 static exint cacheRefresh();
61 static exint currentSizeBytes();
101 bool &deferred_loaded,
103 TexturePriority priority = PRIORITY_NORMAL,
104 PlaceholderType missing=MISSING_WHITE_SOLID,
121 PlaceholderType placeholder_type,
134 bool allow_deferred_load,
135 bool &defer_load_finished,
137 TexturePriority priority = PRIORITY_NORMAL,
166 static void checkTextureDirty(
RV_TextureRef &map,
bool &dirty);
169 static void checkTextureHasAlpha(
const RV_TextureRef &
ref,
bool &has_alpha);
175 static void setSingleTexMemLimitMB(
exint mem_in_mb);
176 static exint singleTexMemLimitMB();
178 static void setCacheSize(
exint mem_in_bytes);
205 bool check_alpha =
false;
212 bool loading =
false;
239 bool &missing_texture,
256 const
char *utGetCacheName()
const override
257 {
return "Vulkan Texture Cache"; }
259 {
return myCurrentSize; }
261 {
return freeTextures(amount,
true,
false); }
263 int64 utGetMaxSize()
const override;
269 exint freeTextures(
exint needed_to_free,
bool free_used,
bool must_free);
270 exint cachedSizeBytes()
const;
277 const char *
name()
const override
278 {
return "Vulkan Texture Cache";}
284 exint &freed_amount_in_bytes)
override;
287 exint &cached_bytes)
override;
289 ~GraphicsMemoryClient()
override {}
296 GraphicsMemoryClient myResource;
315 exint myCurrentSize = 0;
316 fpreal myReductionFactor = 1.0;
A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)
int64 utGetCurrentSize() const override
required - return the current cache size, in bytes
UT_StringHolder op_relative
Opaque reference to a texture stored in the RV_TextureCache.
GLenum GLenum GLsizei void * image
UT_SharedPtr< RV_TextureRef::CacheData > refs
bool utHasMaxSize() const override
optional - override if the cache has a well defined maximum size
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum GLenum type
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
constexpr auto set(type rhs) -> int
T reduce(RangeT range, const T &identity, const FuncT &func, const JoinT &join)
UT_Array< UT_UniquePtr< PXL_Raster > > rasters
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLfloat GLfloat GLfloat alpha
void utSetMaxSize(int64) override
HUSD_API const char * resolution()
GLuint const GLchar * name
UT_StringHolder cache_name
PlaceholderType
If the texture is missing, one of these generic placeholders is used.
Handle to the main interface of Vulkan.
Common base class for various caches.
static const char * getFileSeparator()
FS_API bool cleanup(UT_StringArray &removed, UT_StringArray &error_files, exint &memory_freed, bool dry_run, const char *override_path=nullptr)
GLint GLint GLsizei GLsizei GLsizei depth
GT_API const UT_StringHolder version
Global cache of vulkan textures sourced from files.
Wrapper for a client of a limit memory resource.
void(* RV_TextureHDAResolverCB)(const char *optable_optype, const char *pattern, UT_StringArray &files)
int64 utReduceCacheSizeBy(int64 amount) override
UT_UniquePtr< RV_VKImage > image