EditorWindow - RAII wrapper around GLFW + OpenGL + Dear ImGui. Keeps the main binary thin by encapsulating everything that would otherwise be boilerplate: GLFW init, window creation, context current, glad loader, ImGui context, imgui_impl_glfw + imgui_impl_opengl3 setup, plus texture upload from a RendererBitmap. More...
#include <array>#include <atomic>#include <chrono>#include <concepts>#include <cstdint>#include <deque>#include <functional>#include <memory>#include <optional>#include <ostream>#include <string>#include <string_view>#include <vector>#include "donner/base/Vector2.h"#include "donner/gpu/DeviceLost.h"#include "donner/svg/renderer/RendererInterface.h"Classes | |
| struct | donner::editor::gui::internal::WgpuSurfaceRetryDecision |
| Frame scheduling and reconfiguration actions after surface acquisition fails. More... | |
| struct | donner::editor::gui::internal::WgpuDiagnosticReadbackDecision |
| Retry and completion actions for one diagnostic readback result. More... | |
| struct | donner::editor::gui::UiScaleConfig |
| HiDPI settings derived from the native window/display scale. More... | |
| class | donner::editor::gui::internal::PresentationSubmissionQueue |
| Bounds pending UI submissions while retaining only the most recent input request. More... | |
| struct | donner::editor::gui::internal::PresentationSubmissionQueue::Fence |
| One submitted UI frame: the GPU serial that retires it and the input it presented. More... | |
| struct | donner::editor::gui::internal::PresentationSubmissionQueue::CompletionObservation |
| Serial and clock read after a bounded GPU completion confirmation. More... | |
| struct | donner::editor::gui::internal::PresentationDeviceLossRecord |
| Immutable first observation of settled presentation-device loss diagnostics. More... | |
| struct | donner::editor::gui::internal::PresentationDeviceLossRecord::Observation |
| Expensive owner-thread details acquired only for the first settled loss. More... | |
| struct | donner::editor::gui::EditorWindowOptions |
| Window creation settings and host UI configuration. More... | |
| struct | donner::editor::gui::EditorWindowFrameTiming |
| Host-frame timing captured by EditorWindow. More... | |
| struct | donner::editor::gui::EditorWindowFonts |
| Fonts loaded into this window's ImGui context for the editor shell. More... | |
| struct | donner::editor::gui::EditorWindowInputOverride |
| ImGui input state to inject for deterministic editor replay. More... | |
| class | donner::editor::gui::EditorWindow |
| Initializes GLFW + GL + ImGui when constructed, tears everything down in the destructor. One instance per process - ImGui's global state means we can't easily have two at once. More... | |
| struct | donner::editor::gui::EditorWindow::PresentedDocumentFrameIdentity |
| Stable document identity committed only after a complete framebuffer presentation. More... | |
Namespaces | |
| namespace | donner |
| Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css. | |
Typedefs | |
| using | GLFWscrollfun = void (*)(GLFWwindow*, double, double) |
| GLFW-compatible callback for horizontal and vertical scroll offsets. | |
Enumerations | |
| enum class | donner::editor::gui::internal::WgpuSurfaceFailureKind { Timeout , OutdatedOrLost , Setup , Fatal } |
| Classification used to choose surface recovery behavior. | |
Functions | |
| constexpr std::array< float, 4 > | donner::editor::gui::internal::WasmSurfaceClearColor (std::array< float, 4 > transparentClearColor, bool premultipliedAlphaSupported) noexcept |
| Pick the browser UI surface's clear color. | |
| constexpr WgpuSurfaceRetryDecision | donner::editor::gui::internal::WgpuSurfaceRetryDecisionFor (WgpuSurfaceFailureKind failure, unsigned consecutiveFailures) noexcept |
| Bound retries so a permanently lost/device-fatal surface cannot turn the event-driven Wasm loop back into a hot spin. | |
| constexpr WgpuDiagnosticReadbackDecision | donner::editor::gui::internal::WgpuDiagnosticReadbackDecisionFor (bool captureSucceeded, unsigned consecutiveFailuresBeforeAttempt) noexcept |
| Diagnostic readback is deliberately best-effort. A transient capture failure, including setup before mapAsync, gets two retries, while a successful capture or third consecutive failure completes the request so the event-driven browser loop cannot become a permanent readback spin. | |
| constexpr bool | donner::editor::gui::internal::ShouldRecheckPendingWgpuReadbackRequestsAfterCompletion (bool callbackAlive, WgpuDiagnosticReadbackDecision decision) noexcept |
| Once the map callback releases the in-flight gate, every live completion must recheck the JavaScript request counters. A transient failure needs another attempt, while a successful or terminal attempt may have a newer request waiting behind it. The JavaScript wake helper filters completed requests, so this recheck does not create idle frames. | |
| std::string | donner::editor::gui::internal::BoundedPresentationDeviceLossReason (std::string_view reason) |
| Copies a browser loss reason into the bounded payload retained for failure evidence. | |
| UiScaleConfig | donner::editor::gui::ComputeUiScaleConfig (int logicalWindowWidth, int framebufferWidth, double contentScaleX) |
| Derive UI scaling from window size, framebuffer size, and the platform content scale hint. Prefers the framebuffer/logical ratio when available. | |
Variables | |
| constexpr std::array< float, 4 > | donner::editor::gui::internal::kWasmOpaqueSurfaceClearColor |
| Opaque fallback clear color for the browser UI surface, matching the page background painted behind the canvas (donner/editor/wasm/editor.css: background: #101317). | |
| constexpr std::size_t | donner::editor::gui::internal::kMaximumPresentationDeviceLossReasonBytes = 1024 |
| Bound on the retained browser loss reason; a copy keeps at most one byte fewer than this. | |
EditorWindow - RAII wrapper around GLFW + OpenGL + Dear ImGui. Keeps the main binary thin by encapsulating everything that would otherwise be boilerplate: GLFW init, window creation, context current, glad loader, ImGui context, imgui_impl_glfw + imgui_impl_opengl3 setup, plus texture upload from a RendererBitmap.
The class is intentionally narrow - it exposes only what the main binary needs:
Any code that wants to draw ImGui widgets happens between beginFrame() and endFrame() on the caller's side - this class doesn't own the widget tree, just the hosting surface.
| struct donner::editor::gui::internal::PresentationSubmissionQueue::Fence |
One submitted UI frame: the GPU serial that retires it and the input it presented.
| struct donner::editor::gui::internal::PresentationSubmissionQueue::CompletionObservation |
| struct donner::editor::gui::internal::PresentationDeviceLossRecord::Observation |
Expensive owner-thread details acquired only for the first settled loss.
| Class Members | ||
|---|---|---|
| RcString | browserReason | |
| uint64_t | completedSerial = 0 | |
| time_point | observedAt | |
| uint64_t | oldestSerial = 0 | |
| uint64_t | submittedSerial = 0 | |
|
nodiscardconstexprnoexcept |
Pick the browser UI surface's clear color.
The Wasm UI surface clears uncovered render-pane pixels to alpha 0 so the worker's document canvas composites underneath it. That only produces transparency when the configured surface honors the alpha channel; a surface composited as opaque turns the same clear into solid black and blanks the whole editor area until real content covers it. Keep the transparent clear only when the surface actually reports premultiplied alpha; otherwise clear to the page background so the result matches what the page already paints behind the canvas.
|
inlineconstexpr |
Opaque fallback clear color for the browser UI surface, matching the page background painted behind the canvas (donner/editor/wasm/editor.css: background: #101317).