Global cache of vulkan textures sourced from files.
More...
#include <RV_TextureCache.h>
|
static void | init () |
| Initialize the cache (only used by the system during startup) More...
|
|
static void | cleanup () |
| Destroy the cache (only used by the system during exit) More...
|
|
static void | clear () |
| Clear all images out of the cache. More...
|
|
static void | updateTextures () |
| Mark any textures as dirty if their file source has been modified. More...
|
|
static exint | cacheVersion () |
| The serial version of the cache. Incremented when a texture is added. More...
|
|
static exint | cacheRefresh () |
|
static bool | bindTexture (RV_Render *r, RV_TextureRef &map, const RV_TextureParms &map_parms, const UT_StringHolder &map_name, const UT_StringHolder &relative_to_node, RV_ImageDim tex_type, RV_ShaderVariableSet *set, const UT_StringHolder &sampler_name, bool deferred_load, bool &deferred_loaded, int &op_id, PlaceholderType missing=MISSING_WHITE_SOLID, UT_Vector4F *fallback_color=nullptr) |
|
static bool | bindTextureRef (RV_Render *r, RV_TextureRef &ref, RV_ShaderVariableSet *set, const UT_StringHolder &sampler_name) |
|
static bool | bindPlaceholder (RV_Render *r, RV_ImageDim tex_type, RV_ShaderVariableSet *set, const UT_StringHolder &sampler_name, PlaceholderType placeholder_type, const UT_Vector4F *fallbackcolor=nullptr) |
|
static bool | loadTextureRef (RV_Render *r, RV_TextureRef &map, const RV_TextureParms &map_parms, const UT_StringHolder &map_name, const UT_StringHolder &relative_to_node, RV_ImageDim tex_type, bool allow_deferred_load, bool &defer_load_finished, int &op_id, UT_Vector3i *resolution=nullptr) |
|
static bool | cacheAsTexture (RV_Render *r, RV_TextureRef &map, const PXL_Raster *source_image, const RV_TextureParms &map_parms, const UT_StringHolder &map_name) |
|
static bool | removeCachedTexture (RV_TextureRef &map) |
| Remove a cached 2D Image. More...
|
|
static bool | cacheImage (UT_UniquePtr< RV_VKImage > image, RV_TextureRef &map, const UT_StringHolder &map_name, UT_DimRect *udim_bounds=nullptr) |
|
static UT_UniquePtr< RV_VKImage > | uncacheImage (RV_TextureRef &map, UT_DimRect *udim_bounds=nullptr) |
|
static void | checkTextureDirty (RV_TextureRef &map, bool &dirty) |
|
static void | checkTextureHasAlpha (const RV_TextureRef &ref, bool &has_alpha) |
| Check if the texture has an alpha channel. More...
|
|
static const char * | getFileSeparator () |
|
static void | installHDACallback (RV_TextureHDAResolverCB resolver_func) |
| For resolving. More...
|
|
|
exint | resolveTexture (RV_Render *r, const UT_StringHolder &map_name, const UT_StringHolder &relative_to_node, const RV_TextureParms &tex_parms, RV_ImageDim tex_type, bool force_update, bool deferred_load, bool &defer_loaded, int &op_id, bool &missing_texture, UT_Vector3i *resolution) |
|
RV_TextureCache::Image | privGetTexture (exint id) |
|
virtual | ~RV_TextureCache () |
|
| UT_NonCopyable ()=default |
|
| ~UT_NonCopyable ()=default |
|
| UT_NonCopyable (const UT_NonCopyable &)=delete |
|
UT_NonCopyable & | operator= (const UT_NonCopyable &)=delete |
|
Global cache of vulkan textures sourced from files.
Definition at line 39 of file RV_TextureCache.h.
If the texture is missing, one of these generic placeholders is used.
Enumerator |
---|
MISSING_BLACK_CLEAR |
|
MISSING_BLACK_SOLID |
|
MISSING_WHITE_SOLID |
|
MISSING_RED_SOLID |
|
MISSING_NORMAL_MAP |
|
MISSING_FALLBACK |
|
MAX_PLACEHOLDER |
|
Definition at line 59 of file RV_TextureCache.h.
virtual RV_TextureCache::~RV_TextureCache |
( |
| ) |
|
|
protectedvirtual |
Bind a small placeholder texture (1x1) to 'sampler_name' in 'set'. The RGBA texture color is defined by the placeholder_type, or can be a custom/ color if the type is FALLBACK. The texture is 8b unorm RGBA.
static bool RV_TextureCache::bindTexture |
( |
RV_Render * |
r, |
|
|
RV_TextureRef & |
map, |
|
|
const RV_TextureParms & |
map_parms, |
|
|
const UT_StringHolder & |
map_name, |
|
|
const UT_StringHolder & |
relative_to_node, |
|
|
RV_ImageDim |
tex_type, |
|
|
RV_ShaderVariableSet * |
set, |
|
|
const UT_StringHolder & |
sampler_name, |
|
|
bool |
deferred_load, |
|
|
bool & |
deferred_loaded, |
|
|
int & |
op_id, |
|
|
PlaceholderType |
missing = MISSING_WHITE_SOLID , |
|
|
UT_Vector4F * |
fallback_color = nullptr |
|
) |
| |
|
static |
Load the map (if needed) and bind the resulting texture to 'sampler_name' in 'set'. If it cannot be loaded, bind a placeholder texture instead. This method is equivalent to calling loadTextureRef() and then bindTextureRef() or bindPlaceholder(). If the map is a reference to a mofr with op:, op_id will contain its unique ID.
Binds an existing texture ref to the set at 'sampler_name'. It should not be a placeholder image (use bindPlaceholder instead).
Cache an existing 2D Image. The name should be prefixed with exp: (explicitly cached).
Cache an existing image. The cache takes ownership (use std::move for the image). If the image is a UDIM, you can optionally pass the bounds. The map name should be prefixed with exp: (explicitly cached).
static exint RV_TextureCache::cacheRefresh |
( |
| ) |
|
|
static |
The serial refresh count of the cache. Incremented when the user explicity updates the textures
static exint RV_TextureCache::cacheVersion |
( |
| ) |
|
|
static |
The serial version of the cache. Incremented when a texture is added.
Check if the texture is out of date. Flag the ref and set dirty
if so. doesn't touch either if it's current.
static void RV_TextureCache::checkTextureHasAlpha |
( |
const RV_TextureRef & |
ref, |
|
|
bool & |
has_alpha |
|
) |
| |
|
static |
Check if the texture has an alpha channel.
static void RV_TextureCache::cleanup |
( |
| ) |
|
|
static |
Destroy the cache (only used by the system during exit)
static void RV_TextureCache::clear |
( |
| ) |
|
|
static |
Clear all images out of the cache.
static const char* RV_TextureCache::getFileSeparator |
( |
| ) |
|
|
inlinestatic |
For resolving a bunch of files to a 2D array, this is the separator character between the filenames.
Definition at line 155 of file RV_TextureCache.h.
static void RV_TextureCache::init |
( |
| ) |
|
|
static |
Initialize the cache (only used by the system during startup)
Load the map info a texture ref without binding it to a shader. If the map could not be loaded, map.isPlaceholder() will be true. If allow_deferred_load is true, background load the texture. Keep calling this in subsequent redraws until defer_load_finished is true.
static bool RV_TextureCache::removeCachedTexture |
( |
RV_TextureRef & |
map | ) |
|
|
static |
Remove a cached 2D Image.
exint RV_TextureCache::resolveTexture |
( |
RV_Render * |
r, |
|
|
const UT_StringHolder & |
map_name, |
|
|
const UT_StringHolder & |
relative_to_node, |
|
|
const RV_TextureParms & |
tex_parms, |
|
|
RV_ImageDim |
tex_type, |
|
|
bool |
force_update, |
|
|
bool |
deferred_load, |
|
|
bool & |
defer_loaded, |
|
|
int & |
op_id, |
|
|
bool & |
missing_texture, |
|
|
UT_Vector3i * |
resolution |
|
) |
| |
|
protected |
Remove a cached image from the cache, taking ownership of it. If udim_bounds is not null, write the bounds to it.
static void RV_TextureCache::updateTextures |
( |
| ) |
|
|
static |
Mark any textures as dirty if their file source has been modified.
The documentation for this class was generated from the following file: