Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::editor::RenderCoordinator Class Reference

Owns the advanced editor's renderer-side orchestration: async rendering, overlay rasterization, composited drag presentation, and selection-bounds cache promotion. More...

#include "donner/editor/RenderCoordinator.h"

Public Member Functions

 RenderCoordinator (std::shared_ptr<::donner::geode::GeodeDevice > geodeDevice=nullptr)
AsyncRendererasyncRenderer ()
const AsyncRendererasyncRenderer () const
svg::Rendererrenderer ()
const SelectionBoundsCacheselectionBoundsCache () const
CompositedPresentationcompositedPresentation ()
const CompositedPresentationcompositedPresentation () const
std::uint64_t displayedDocVersion () const
const FrameCostBreakdownlastFrameCostBreakdown () const
 Latest editor rendering cost counters observed by this coordinator.
void beginFrameCostTracking ()
 Clear the per-frame cost accumulator before a new UI frame starts.
void addImmediateOverlayDrawCost (double drawMs)
 Add immediate presenter-side overlay draw-list time to the current frame counters.
bool setSourceHoverElements (std::vector< svg::SVGElement > elements)
 Replace transient source-hover chrome elements.
void resetForLoadedDocument ()
void refreshSelectionBoundsCache (EditorApp &app)
void promoteSelectionBoundsIfReady ()
bool rasterizeOverlayForCurrentSelection (EditorApp &app, const ViewportState &viewport, GlTextureCache &textures, const std::optional< Box2d > &marqueeRectDoc, std::optional< SelectTool::ActiveDragPreview > representedDragPreview=std::nullopt, std::optional< SelectTool::ActiveTransformBoundsPreview > activeBoundsPreview=std::nullopt, std::optional< SelectionChromeDetail > selectionDetail=std::nullopt, std::optional< SelectTool::ActiveDragPreview > liveDragPreview=std::nullopt)
 Capture the editor chrome (path outlines, selection AABBs, marquee) for immediate presentation. marqueeRectDoc is the active marquee rectangle in document space (nullopt when the user isn't marquee-dragging). The snapshot is drawn directly by RenderPanePresenter so selected chrome does not allocate, rasterize, snapshot, or upload an overlay texture.
bool rasterizeOverlayForPresentation (EditorApp &app, SelectTool &selectTool, const ViewportState &viewport, GlTextureCache &textures, std::optional< SelectTool::ActiveDragPreview > activeDragPreview, std::optional< SelectTool::ActiveDragPreview > representedDragPreview)
 Rasterize the current UI-frame overlay immediately before presentation.
void pollRenderResult (EditorApp &app, const ViewportState &viewport, GlTextureCache &textures, FrameHistory *frameHistory=nullptr)
 Drain the latest async-render result into the editor's UI state. If a frameHistory is supplied, its latest slot is stamped with the backend (worker) ms reported by AsyncRenderer so the frame graph can plot backend time alongside ImGui frame time. nullptr is allowed for callers that don't care about backend timing.
void maybeRequestRender (EditorApp &app, SelectTool &selectTool, const ViewportState &viewport, GlTextureCache *textures=nullptr)
void invalidatePresentationAfterDocumentFlush (const AsyncSVGDocument::FlushResult &flushResult)
 Record that a document mutation requires a current-version presentation handoff.
Entity suppressedCompositedLayerEntity (EditorApp &app)
 Return the selected layer whose cached pixels should be hidden while editor chrome remains visible.
bool selectedElementIsDisplayNone (EditorApp &app) const
 Return true when the live selected graphics element is hidden by display:none.
const std::optional< SelectionChromeSnapshot > & immediateOverlaySnapshot () const
 Latest race-free overlay chrome snapshot for immediate screen-space presentation.

Detailed Description

Owns the advanced editor's renderer-side orchestration: async rendering, overlay rasterization, composited drag presentation, and selection-bounds cache promotion.

Member Function Documentation

◆ addImmediateOverlayDrawCost()

void donner::editor::RenderCoordinator::addImmediateOverlayDrawCost ( double drawMs)
inline

Add immediate presenter-side overlay draw-list time to the current frame counters.

Parameters
drawMsMilliseconds spent issuing immediate overlay draw-list commands.

◆ invalidatePresentationAfterDocumentFlush()

void donner::editor::RenderCoordinator::invalidatePresentationAfterDocumentFlush ( const AsyncSVGDocument::FlushResult & flushResult)

Record that a document mutation requires a current-version presentation handoff.

Parameters
flushResultMetadata from the just-flushed editor command batch.

◆ rasterizeOverlayForPresentation()

bool donner::editor::RenderCoordinator::rasterizeOverlayForPresentation ( EditorApp & app,
SelectTool & selectTool,
const ViewportState & viewport,
GlTextureCache & textures,
std::optional< SelectTool::ActiveDragPreview > activeDragPreview,
std::optional< SelectTool::ActiveDragPreview > representedDragPreview )

Rasterize the current UI-frame overlay immediately before presentation.

Unlike content render scheduling, overlay chrome is intentionally not gated on worker availability: drag, zoom, and marquee feedback must track the viewport used by the presented frame.

◆ setSourceHoverElements()

bool donner::editor::RenderCoordinator::setSourceHoverElements ( std::vector< svg::SVGElement > elements)

Replace transient source-hover chrome elements.

Parameters
elementsElements to highlight as source-hover preview chrome.
Returns
true if the hover preview changed.

◆ suppressedCompositedLayerEntity()

Entity donner::editor::RenderCoordinator::suppressedCompositedLayerEntity ( EditorApp & app)
nodiscard

Return the selected layer whose cached pixels should be hidden while editor chrome remains visible.

This is used when the live selected element is display:none: hit-testing and the next render already treat it as non-rendering, so the presenter must not keep drawing a stale promoted texture for that entity. If a source reparse remapped the selected element to a new entity, this returns the currently cached pre-reparse entity so that stale texture is hidden. Deleted selected layers are also suppressed while the next render catches up so detached cached tiles cannot remain visible.

Parameters
appEditor application state containing the live selection.
Returns
Entity whose cached layer should be suppressed, or entt::null if no suppression is needed.

The documentation for this class was generated from the following file: