Skip to content

feat: make custom renderer updates demand driven - #47

Open
tomaszbk wants to merge 3 commits into
vlang:masterfrom
tomaszbk:feat/on-demand-rendering
Open

tomaszbk wants to merge 3 commits into
vlang:masterfrom
tomaszbk:feat/on-demand-rendering

Conversation

@tomaszbk

@tomaszbk tomaszbk commented Sep 30, 2026 •

Copy link
Copy Markdown

The custom renderer builds the initial scene and then updates it when input, model actions, surface changes, animations, deadlines or queued worker work invalidate the window. Idle callbacks reuse the retained tree; on-demand scheduling is the renderer contract.

The coordinator coalesces requests, preserves invalidation raised during a frame, suspends visual work while iconified, restores the surface and rejects work posted through a closed window's dispatcher. Control setters request paint without rebuilding the application. render_stats() exposes callbacks, builds, draws and pending work; ui_dispatcher() delivers worker callbacks on the UI thread.

Metal skips idle draws. GL/EGL/D3D repaint the retained tree when their platform callback presents the swapchain. Native controls use their platform refresh mechanisms.

The scheduler, VML runner configurations and acceptance fixture now use automatic on-demand scheduling. The public guide explains invalidation and the backend presentation behavior; the branch includes the current upstream master.

Validation on macOS arm64 with V e96232c, the C backend, default Boehm GC and compiler fallback disabled:

  • Scheduler, custom lifecycle/setters, tooltip, animation and scrolling test files pass.
  • The real-window acceptance fixture passes static reuse, worker delivery, coalescing, invalidation during a build, animation completion, minimize/restore and closed-dispatcher checks. Its three-second idle sample records zero builds and zero draws on Metal.
  • macOS, Linux, Windows and custom backend typechecks pass. Cross-target checks are typechecks.
  • Public Markdown and the complete PR diff pass their checks.

Add an opt-in on_demand render policy for the custom renderer. Static
windows skip builds (and, on Metal, draws) until input, animations,
tooltips, refresh() or dispatcher work invalidate them. Continuous
rendering stays the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomaszbk tomaszbk changed the title feat: add demand-driven custom renderer scheduling feat: make custom renderer updates demand driven Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant