Skip to content

build: a dvui app of its own on fizzy's backend (fizzy.addDvui) - #329

Merged
foxnne merged 1 commit into
backend/viewport-picturefrom
build/dvui-app
Oct 10, 2026
Merged

foxnne merged 1 commit into
backend/viewport-picturefrom
build/dvui-app

Conversation

@foxnne

@foxnne foxnne commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Part of #281: what example-app's run-dvui builds on. Stacked on #326 (on #324); review those first. The example-app side is fizzyedit/example-app#4.

fizzy.addDvui(fizzy_dep, root_module, backend) gives an outside app's module dvui on one of two backends:

  • .fizzy: fizzy's own, where each floating window can be an OS window of its own;
  • .sdl3: dvui's own SDL3 backend, which has the main window only.

The module gets dvui (fizzy's pin), its backend, and viewports_none (#324), so the same app code builds on either:

const backend = @import("backend");
const viewports = if (@hasDecl(backend, "viewports")) backend.viewports else @import("viewports_none");

On fizzy's backend it also gets platform, and on macOS the backend's Objective-C compiled into it. build/exe.zig's backend switch is now nativeDvui, shared by fizzy's own executable and addDvui.

Two fixes a plain dvui app needed

  1. The main window's drawable was acquired with a copy pass still open (GpuRenderer.acquireSwapchain). The frame's texture uploads had left it open, and SDL asserted on every frame ("Cannot acquire a swapchain texture during a pass"). Fizzy never hit this because it draws its frame into a target first. Any dvui app draws straight into the window. The fix ends the copy pass before acquiring, as presentInto and clearPass already do.
  2. platform's menu-bar exports weren't emitted (FizzyMenu*). macos/menu_target.m calls them and is compiled into every macOS app on the backend, but Zig emits an export fn only when analysis reaches its file. Fizzy reaches platform/menu.zig through its menu bar; a dvui app with none failed to link. Now platform/root.zig references them, and they're pub.

Verification

  • Fizzy: zig build, test (514/515, 1 skipped), test-integration (358/358), check-web, test-sdk-version, the backend's tests (46/46), and the Windows and Linux cross-builds pass on macOS. The soak tape ends in a passing verdict (1,429 viewport presents, no leaks, nothing logged as an error).
  • example-app's run-dvui, built against this branch, on macOS:
    • On fizzy's backend: it opens its main window and two floating windows. Each is an OS window of its own, opened over its place in the main window (window list: main at 540,332; floats at 652,476 and 684,500, each 280×212). No assertions or warnings, and it quits cleanly on SIGTERM.
    • With -Ddvui-backend=sdl3: the same app shows only its main window, with the floating windows in it. No warnings.
    • Not seen: I couldn't screenshot, since this session has no screen-recording permission. Window positions and the logs are what I checked, not how they look.

🤖 Generated with Claude Code

`fizzy.addDvui(fizzy_dep, root_module, .fizzy | .sdl3)` gives a plain dvui app dvui, its backend
and `viewports_none`. Two things only such an app hit are fixed with it: the main window's drawable
was acquired with the uploads' copy pass still open, and platform's menu exports went unemitted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@foxnne
foxnne merged commit ef1ff78 into backend/viewport-picture Oct 10, 2026
10 checks passed
@foxnne
foxnne deleted the build/dvui-app branch October 10, 2026 13:04
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