10#include <unordered_map>
17class ITextureRenderResources;
96 std::string
UploadTextureToRAM(std::string textureFileName, std::vector<uint8_t>
const& fileBytes);
171 std::unordered_map<std::string, std::shared_ptr<ImageDataGpu>>
mTextures;
Interface for observing renderer resource lifecycle events.
Defines an abstract interface for rendering backends.
Interface for backend-specific GPU texture resource management.
Represents raw 2D image data stored in memory.
Manages texture loading, GPU uploading, and caching for reuse.
void OnRenderResourcesRelease() override
Renderer callback: release all GPU resources (used during device loss/reset).
std::unordered_map< std::string, std::shared_ptr< ImageDataGpu > > mTextures
void LoadTexturesFromPackage()
Loads all textures from the packed asset archive.
void ReleaseAll()
Fully clears the texture cache, including both RAM and GPU resources.
void ReleaseTextureFromGPU(std::string textureName)
Releases a texture from GPU memory.
void OnRenderResourcesRebuild() override
Renderer callback: re-upload or recreate all GPU resources (used after device reset/rebuild).
std::shared_ptr< ImageDataGpu > GetTextureResources(std::string filename)
Retrieves the full texture resource wrapper from cache.
void ReleaseAllFromGPU()
Releases all cached textures from GPU memory.
std::string UploadTextureToRAM(std::string path)
Loads a single texture into RAM from the given file path.
ITextureRenderResources * GetTextureRenderResources(std::string filename)
Retrieves only the GPU render resources of a cached texture.
void LoadTexture(std::string textureName, ImageData imageData)
size_t GetSizeInRAM() const
Gets the total size of all currently cached textures in RAM.
void LoadTexturesFromFolder(std::string pathToFolder)
Loads all supported texture files (*.jpg, *.png) from a specified folder into RAM and uploads them to...
TextureCache(IRenderer *renderer)
Constructs the TextureCache with a reference to the renderer.
size_t GetSizeInGPU() const
Gets the total size of all textures currently uploaded to GPU.
void UploadTextureToGPU(std::string textureName)
Uploads a texture (previously loaded into RAM) to GPU.