Uploads decoded image Tensors to OpenGL textures, keyed and cached by an arbitrary integer key (e.g. a Dataset index) so a scrolling image grid doesn't re-upload the same image every frame.
More...
#include <texture_cache.hpp>
Uploads decoded image Tensors to OpenGL textures, keyed and cached by an arbitrary integer key (e.g. a Dataset index) so a scrolling image grid doesn't re-upload the same image every frame.
- Note
- All real pixel-format conversion logic (Tensor -> interleaved RGB bytes) lives in plot_data.hpp's ToRgbImageBuffer, which is unit-tested; this class's only job is the GL-specific glGenTextures/glTexImage2D calls, which are not meaningfully unit-testable – see plans/okay-we-have-now-buzzing-moth.md Testing Strategy.
◆ TextureCache() [1/2]
| pulsatrix::TextureCache::TextureCache |
( |
| ) |
|
|
default |
◆ ~TextureCache()
| pulsatrix::TextureCache::~TextureCache |
( |
| ) |
|
◆ TextureCache() [2/2]
| pulsatrix::TextureCache::TextureCache |
( |
const TextureCache & |
| ) |
|
|
delete |
◆ Clear()
| void pulsatrix::TextureCache::Clear |
( |
| ) |
|
Deletes every cached GL texture and clears the cache.
◆ GetOrUpload()
| TextureId pulsatrix::TextureCache::GetOrUpload |
( |
int64_t |
key, |
|
|
const Tensor & |
image_chw |
|
) |
| |
Returns the cached texture for key, uploading image_chw first if not cached.
- Parameters
-
| key | Cache key (e.g. a Dataset sample index). |
| image_chw | A rank-3 (C,H,W) or batch-1 rank-4 (1,C,H,W) image tensor – see ToRgbImageBuffer's shape contract. |
◆ operator=()
The documentation for this class was generated from the following file: