10 #ifndef RV_TextureCache_h
11 #define RV_TextureCache_h
32 #define RV_INVALID_OP_ID -1
40 class RV_TextureResolver;
60 static void updateTextures();
63 static exint cacheVersion();
66 static exint cacheRefresh();
68 static exint currentSizeBytes();
70 static exint totalTextureCount();
72 static exint maxSizeBytes();
112 bool &deferred_loaded,
114 TexturePriority priority = PRIORITY_NORMAL,
115 PlaceholderType missing=MISSING_WHITE_SOLID,
132 PlaceholderType placeholder_type,
145 bool allow_deferred_load,
146 bool &defer_load_finished,
148 TexturePriority priority = PRIORITY_NORMAL,
178 static void checkTextureDirty(
RV_TextureRef &map,
bool &dirty);
181 static void checkTextureHasAlpha(
const RV_TextureRef &
ref,
bool &has_alpha);
187 static void setSingleTexMemLimitMB(
exint mem_in_mb);
188 static exint singleTexMemLimitMB();
190 static void setCacheSize(
exint mem_in_bytes);
222 bool check_alpha =
false;
231 bool loading =
false;
259 bool &missing_texture,
277 const
char *utGetCacheName()
const override
278 {
return "Vulkan Texture Cache"; }
280 {
return myCurrentSize; }
282 {
return freeTextures(amount,
true,
false); }
284 int64 utGetMaxSize()
const override;
290 exint freeTextures(
exint needed_to_free,
bool free_used,
bool must_free);
291 exint cachedSizeBytes()
const;
298 const char *
name()
const override
299 {
return "Vulkan Texture Cache";}
305 exint &freed_amount_in_bytes)
override;
308 exint &cached_bytes)
override;
310 ~GraphicsMemoryClient()
override {}
317 GraphicsMemoryClient myResource;
328 ResolveEntry(exint
id,
329 TexturePriority priority,
331 : id{
id}, priority{priority}, refs{refs}
338 {
return myInUseCount > 0; }
342 { --myInUseCount;
UT_ASSERT(myInUseCount >= 0); }
344 int myInUseCount = 0;
355 exint myCurrentSize = 0;
356 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
UT_UniquePtr< IMG_Stat > stat
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
UT_UniquePtr< IMG_FileParms > file_parms
Global cache of vulkan textures sourced from files.
File options for manipulating image data on load or save. This class allows you to modify the incomin...
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
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_Array< std::pair< UT_StringHolder, UT_Vector2i > > udim_tiles
UT_UniquePtr< RV_VKImage > image
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)