|
|
Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
|
Owns the GL textures the advanced editor uses for overlay and composited presentation. More...
#include "donner/editor/GlTextureCache.h"
Classes | |
| struct | TileView |
| One composite-tile entry as the presenter sees it: the GL texture handle (resolved from the upload cache) plus the geometry fields the presenter needs to blit in paint order. More... | |
Public Member Functions | |
| GlTextureCache (std::shared_ptr<::donner::geode::GeodeDevice > geodeDevice=nullptr) | |
| GlTextureCache (const GlTextureCache &)=delete | |
| GlTextureCache & | operator= (const GlTextureCache &)=delete |
| void | initialize () |
| void | uploadOverlay (const svg::RendererBitmap &bitmap) |
| void | uploadOverlayTexture (std::shared_ptr< const svg::RendererTextureSnapshot > textureSnapshot) |
| Register an overlay texture snapshot without CPU readback/upload. | |
| void | uploadComposited (const RenderResult::CompositedPreview &preview, std::optional< EditorRasterViewport > rasterViewport=std::nullopt) |
| Upload the worker's tile snapshot into per-tile GL textures. Allocates/reuses one texture per tile id; bumps a per-tile upload-generation so identity uploads short-circuit; evicts textures whose tile is absent from the snapshot. | |
| void | uploadCompositedOverview (const RenderResult::CompositedPreview &preview, const EditorRasterViewport &rasterViewport) |
| 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 | clearOverlay () |
| void | resetComposited () |
| ImTextureID | overlayTexture () const |
| int | overlayWidth () const |
| int | overlayHeight () const |
| const Vector2d & | overlayUvBottomRight () const |
| Bottom-right UV for sampling the valid overlay payload from its backing texture. | |
| const std::optional< Box2d > & | overlayScreenRect () const |
| Screen rect for viewport-space overlay textures. | |
| void | setOverlayScreenRect (std::optional< Box2d > screenRect) |
| Record the screen-space placement for the currently uploaded overlay. | |
| const std::vector< TileView > & | tiles () const |
| Paint-order tile view; 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. | |
| const FrameCostBreakdown::Overlay & | lastOverlayUploadCost () const |
| Cost counters for the most recent overlay upload or clear. | |
| 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. | |
Owns the GL textures the advanced editor uses for overlay and composited presentation.
The cache is intentionally dumb: callers decide when textures should update; this class only owns the texture names, uploads pixel buffers, and tracks the currently-valid dimensions.
Composited preview rendering follows design doc 0033 §M2C: instead of three named bg/promoted/fg textures, the cache owns one GL texture per CompositedTile (keyed on the tile id), allocated lazily on first upload and freed when the tile leaves the snapshot. The editor's RenderPanePresenter iterates tiles() in paint order and blits each tile at its (canvasOffsetDoc + dragTranslationDoc) * pixelsPerDocUnit origin.
| struct donner::editor::GlTextureCache::TileView |
One composite-tile entry as the presenter sees it: the GL texture handle (resolved from the upload cache) plus the geometry fields the presenter needs to blit in paint order.
| Class Members | ||
|---|---|---|
| Vector2d | bitmapDimsDoc = Vector2d::Zero() | |
| Vector2i | bitmapDimsPx = Vector2i::Zero() | |
| Vector2d | canvasOffsetDoc = Vector2d::Zero() | |
| Transform2d | documentFromCachedDocument = Transform2d() | |
| Vector2d | dragTranslationDoc = Vector2d::Zero() | |
| uint64_t | generation = 0 | |
| string | id | |
| bool | isDragTarget = false | |
| Kind | kind = RenderResult::CompositedTile::Kind::Segment | |
| Entity | layerEntity = entt::null | |
| bool | metadataOnly = false | |
| Vector2i | rasterCanvasSize = Vector2i::Zero() | |
| ImTextureID | texture = 0 | |
| Vector2d | uvBottomRight = Vector2d(1.0, 1.0) | |
|
inlinenodiscard |
Screen rect for viewport-space overlay textures.
Nullopt means the overlay texture uses the legacy document-viewBox placement path.
| void donner::editor::GlTextureCache::setOverlayScreenRect | ( | std::optional< Box2d > | screenRect | ) |
Record the screen-space placement for the currently uploaded overlay.
| screenRect | ImGui screen rect covered by the overlay texture, or nullopt to use the legacy document-viewBox placement path. |