Retains editor presentation textures for composited tiles and Layers thumbnails. More...
#include "donner/editor/GlTextureCache.h"
Classes | |
| struct | ThumbnailTextureView |
| ImGui texture handle and UV range for valid thumbnail content. More... | |
| struct | TileView |
| One cached tile's ImGui texture handle and paint-order geometry. More... | |
| struct | RasterCoverageGroup |
| Owner-indexed coverage and paint bounds in one immutable raster coordinate system. More... | |
| class | PresentationResources |
| Immutable resource manifest published only after complete preparation succeeds. More... | |
Public Member Functions | |
| GlTextureCache (std::shared_ptr<::donner::geode::GeodeDevice > geodeDevice=nullptr) | |
| Construct a cache for the selected presentation backend. | |
| GlTextureCache (const GlTextureCache &)=delete | |
| GlTextureCache & | operator= (const GlTextureCache &)=delete |
| void | initialize () |
| Compatibility initialization hook; presentation resources are allocated lazily. | |
| bool | uploadComposited (const RenderResult::CompositedPreview &preview, std::optional< EditorRasterViewport > rasterViewport=std::nullopt, const RenderResult *overview=nullptr, std::shared_ptr< const CapturedPresentation > capture=nullptr) |
| Register or upload each worker tile for the selected presentation backend. Reuse unchanged tile identities and evict payloads absent from the new snapshot. | |
| bool | uploadCompositedOverview (const RenderResult::CompositedPreview &preview, const EditorRasterViewport &rasterViewport, std::shared_ptr< const CapturedPresentation > capture=nullptr) |
| Upload a full-document overview preview without replacing active viewport-bounded tiles. | |
| void | advancePresentationFrame () |
| Advance one presentation frame, retiring WGPU texture snapshots whose handles have aged past the backend's frames-in-flight window. | |
| void | resetComposited () |
| Clear active and overview composited tiles while retaining thumbnail entries. | |
| ThumbnailTextureView | uploadThumbnail (std::uint64_t key, const svg::RendererBitmap &bitmap) |
| Upload a Donner-rendered Layers thumbnail, reusing the row's unchanged texture. The bitmap is keyed by row id and content fingerprint; ImGui only blits its pixels. | |
| ThumbnailTextureView | retainThumbnailTextureSnapshot (std::uint64_t key, std::shared_ptr< const svg::RendererTextureSnapshot > textureSnapshot) |
| Retain a renderer-owned GPU snapshot as a Layers thumbnail on Geode builds. The OpenGL path returns an empty view; use uploadThumbnail there. | |
| void | setDocumentCompositeBytes (std::uint64_t bytes) |
| Report bytes retained by the non-WGPU explicit document compositor. | |
| void | retainThumbnailsOnly (const std::vector< std::uint64_t > &liveKeys) |
Evict every cached thumbnail texture whose key is not in liveKeys, freeing the backing GL/WGPU texture. Called after each Layers-panel render so thumbnails for removed rows do not leak across refreshes. | |
| std::size_t | thumbnailTextureCount () const |
| Number of thumbnail textures currently retained (testing/diagnostics). | |
| std::shared_ptr< const PresentationResources > | presentationResources () const |
| Obtain one complete resource/geometry binding; failed candidates never replace it. | |
| const std::vector< TileView > & | tiles () const |
| Paint-order tile view; metadata-only direct-surface entries have a zero texture handle. Empty when no composited preview has been uploaded yet (or the preview was cleared via resetComposited). | |
| const std::vector< TileView > & | overviewTiles () const |
| Last retained unbounded full-document tile set, drawn underneath viewport-bounded tiles as a coherent zoom-out fallback. | |
| bool | activeTilesViewportBounded () const |
| True when the active tile set was rendered from a viewport-bounded raster target. | |
| int | metadataOnlyMissCount () const |
| Number of metadata-only tiles skipped during the most recent composited upload because their cached texture identity was absent or stale. | |
| int | duplicateLiveTextureCount () const |
| Number of duplicate live texture handles found in the most recent composited upload across different tile ids. | |
| const FrameCostBreakdown::CompositedUpload & | lastCompositedUploadCost () const |
| Cost counters for the most recent composited upload. | |
| PresentationResourceStats | presentationResourceStats () const |
| Resource counters for the textures currently retained by this cache. | |
| PresentationCoverageDiagnostics | coverageDiagnostics () const |
| Coverage counters for active bounded tiles and retained overview infill. | |
Friends | |
| struct | FramePresentationTestAccess |
Retains editor presentation textures for composited tiles and Layers thumbnails.
Stable tile ids and generations let metadata-only previews reuse prior payloads. Geode builds register renderer snapshots with the UI texture registry and upload CPU bitmaps into runtime textures; the desktop OpenGL path owns GL textures. Removed tiles and superseded GPU snapshots are released after their presentation lifetime, while thumbnail entries are retained by row key.
| struct donner::editor::GlTextureCache::ThumbnailTextureView |
| struct donner::editor::GlTextureCache::TileView |
One cached tile's ImGui texture handle and paint-order geometry.
| Class Members | ||
|---|---|---|
| Vector2d | bitmapDimsDoc = Vector2d::Zero() | Document-space tile dimensions. |
| Vector2i | bitmapDimsPx = Vector2i::Zero() | Valid texture payload dimensions in pixels. |
| Vector2d | canvasOffsetDoc = Vector2d::Zero() | Document-space tile origin. |
| Transform2d | documentFromCachedDocument | Transform from cached-document to current-document space. |
| Vector2d | dragTranslationDoc | Document-space drag offset for presentation. |
| uint64_t | generation = 0 | Generation of the tile payload. |
| shared_ptr< const GLuint > | glTextureLifetime | Shared GL allocation retained by every frame referencing this tile. |
| string | id | Stable composited tile identifier. |
| bool | isDragTarget = false | Whether this tile is the active drag target. |
| Kind | kind | Composited tile category. |
| Entity | layerEntity = entt::null | Layer entity when this is a promoted layer. |
| bool | metadataOnly = false | True when the tile carries no new texture payload. |
| Vector2i | rasterCanvasSize = Vector2i::Zero() | Raster canvas size that produced this tile. |
| ImTextureID | texture | ImGui handle for this tile, or zero when no cached payload can be reused. |
| shared_ptr< const RendererTextureSnapshot > | textureSnapshot | Retained GPU snapshot backing a Geode tile. |
| shared_ptr< const void > | uiTextureLifetime | Registration owned by all published users. |
| Vector2d | uvBottomRight = Vector2d(1.0, 1.0) | Bottom-right UV of valid texture content. |
| struct donner::editor::GlTextureCache::RasterCoverageGroup |
Owner-indexed coverage and paint bounds in one immutable raster coordinate system.
| Class Members | ||
|---|---|---|
| Transform2d | documentFromRaster | |
| vector< Box2d > | paintBounds | |
| vector< Box2d > | tileBounds | |
|
explicit |
Construct a cache for the selected presentation backend.
| geodeDevice | Shared Geode context, or null for the OpenGL path. |
| void donner::editor::GlTextureCache::retainThumbnailsOnly | ( | const std::vector< std::uint64_t > & | liveKeys | ) |
Evict every cached thumbnail texture whose key is not in liveKeys, freeing the backing GL/WGPU texture. Called after each Layers-panel render so thumbnails for removed rows do not leak across refreshes.
| liveKeys | Stable ids of the rows currently shown by the panel. |
| ThumbnailTextureView donner::editor::GlTextureCache::retainThumbnailTextureSnapshot | ( | std::uint64_t | key, |
| std::shared_ptr< const svg::RendererTextureSnapshot > | textureSnapshot ) |
Retain a renderer-owned GPU snapshot as a Layers thumbnail on Geode builds. The OpenGL path returns an empty view; use uploadThumbnail there.
| key | Stable id of the Layers row. |
| textureSnapshot | Renderer snapshot to retain until replacement or eviction. |
| bool donner::editor::GlTextureCache::uploadComposited | ( | const RenderResult::CompositedPreview & | preview, |
| std::optional< EditorRasterViewport > | rasterViewport = std::nullopt, | ||
| const RenderResult * | overview = nullptr, | ||
| std::shared_ptr< const CapturedPresentation > | capture = nullptr ) |
Register or upload each worker tile for the selected presentation backend. Reuse unchanged tile identities and evict payloads absent from the new snapshot.
| preview | Paint-ordered worker tiles and metadata. |
| rasterViewport | Raster coverage represented by the preview, when known. |
| overview | Optional same-scene overview that must be prepared in the same transaction. |
| capture | Geometry captured with the preview's pixels, published with the installed set. |
| bool donner::editor::GlTextureCache::uploadCompositedOverview | ( | const RenderResult::CompositedPreview & | preview, |
| const EditorRasterViewport & | rasterViewport, | ||
| std::shared_ptr< const CapturedPresentation > | capture = nullptr ) |
Upload a full-document overview preview without replacing active viewport-bounded tiles.
| ThumbnailTextureView donner::editor::GlTextureCache::uploadThumbnail | ( | std::uint64_t | key, |
| const svg::RendererBitmap & | bitmap ) |
Upload a Donner-rendered Layers thumbnail, reusing the row's unchanged texture. The bitmap is keyed by row id and content fingerprint; ImGui only blits its pixels.
| key | Stable id of the Layers row. |
| bitmap | Donner-rendered RGBA thumbnail bitmap. |