|
|
Donner 0.8.0-pre
Embeddable browser-grade SVG2 engine
|
AsyncRenderer owns a svg::Renderer and runs compositor rendering plus any final presentation snapshot handoff on a dedicated worker thread so heavy renders don't block the UI thread. More...
#include <atomic>#include <chrono>#include <condition_variable>#include <cstdint>#include <functional>#include <memory>#include <mutex>#include <optional>#include <string>#include <thread>#include <unordered_map>#include <variant>#include <vector>#include "donner/base/EcsRegistry.h"#include "donner/base/Transform.h"#include "donner/base/Vector2.h"#include "donner/editor/ViewportState.h"#include "donner/svg/SVGDocument.h"#include "donner/svg/SVGElement.h"#include "donner/svg/compositor/CompositorController.h"#include "donner/svg/compositor/ScopedCompositorHint.h"#include "donner/svg/renderer/Renderer.h"#include "donner/svg/renderer/RendererInterface.h"Classes | |
| struct | donner::editor::RenderLease |
| Non-null renderer/document handoff for a render request. More... | |
| struct | donner::editor::RenderRequest |
| Per-request handoff data captured at render-request time so the worker has everything it needs without touching live UI state. More... | |
| struct | donner::editor::RenderRequest::DragPreview |
| struct | donner::editor::PresentationSnapshotPlan |
| Final full-canvas snapshot work needed after compositor rendering. More... | |
| struct | donner::editor::RenderResult |
| Presentation payload plus the document version it was rendered from. More... | |
| struct | donner::editor::RenderResult::WorkerTimingBreakdown |
| Internal timing split for one async worker iteration. More... | |
| struct | donner::editor::RenderResult::CompositedTile |
| One composite tile from the worker's CompositorController::
snapshotCompositorTiles() snapshot (design doc 0033 §M2C). The editor uploads one GL texture per tile (keyed on id) and blits each tile at its canvas offset. Immediate tiles intentionally use transient ids and always carry a fresh payload. Geometry fields are doc-unit quantities so the editor can scale them by the current pixelsPerDocUnit during canvas-resize debouncing. More... | |
| struct | donner::editor::RenderResult::CompositedPreview |
| class | donner::editor::AsyncRenderer |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
| namespace | donner::svg |
| Donner SVG library, which can load, manipulate and render SVG files. | |
Functions | |
| PresentationSnapshotPlan | donner::editor::ChoosePresentationSnapshotPlan (bool hasCompositedPreview, bool requiresTextureSnapshotPresentation) |
| Choose final full-canvas snapshot work for a render result. | |
AsyncRenderer owns a svg::Renderer and runs compositor rendering plus any final presentation snapshot handoff on a dedicated worker thread so heavy renders don't block the UI thread.
The worker thread owns the Renderer for its entire lifetime. Backends with thread-affined GPU objects depend on device, pipeline, texture, and readback use staying on that thread.
The worker additionally takes exclusive ownership of the SVGDocument during an active render. The UI thread must not mutate the document while a render is in flight.
UI thread flow per frame:
The safety invariant: between requestRender() and a non-nullopt return from pollResult(), the UI thread must not mutate the SVGDocument. Registry-reading UI paths should normally gate on !isBusy() unless they are using guarded access for immediate overlay presentation. The UI thread must not call any method on the worker Renderer at any time — it lives on the worker.
| struct donner::editor::RenderRequest::DragPreview |
| Class Members | ||
|---|---|---|
| Transform2d | documentFromCachedDocument = Transform2d() | Active affine transform represented by this request. Selection prewarms use identity. |
| uint64_t | dragGeneration = 0 | Monotonic id for the active drag gesture. Selection prewarms use zero. |
| Entity | entity = entt::null | |
| vector< Entity > | extraEntities | Additional entities moving with entity under the same active drag transform. |
| InteractionHint | interactionKind = svg::compositor::InteractionHint::ActiveDrag | Which interaction phase drove this preview. Selection means the editor is pre-warming a layer for the selected entity before any drag begins. ActiveDrag means the user is actively dragging — the DOM's transform attribute already reflects the cursor delta. The compositor stamps the correct InteractionHint on the entity based on this field so downstream introspection stays accurate. |
| Vector2d | translation = Vector2d::Zero() | Active drag translation represented by this request. Selection prewarms use zero. |
| struct donner::editor::RenderResult::WorkerTimingBreakdown |
Internal timing split for one async worker iteration.
|
nodiscard |
Choose final full-canvas snapshot work for a render result.
| hasCompositedPreview | True when compositor tiles already provide the presented pixels. |
| requiresTextureSnapshotPresentation | True when presentation must remain on GPU textures. |