Skip to content

BloomView: implement live rendering on all platforms (macOS, iOS, GTK4/Linux, Android, visionOS, tvOS/watchOS) #5519

Description

@proggeramlug

Follow-up to #2395 (BloomView) / #5518.

Current state

BloomView now links and creates a real native render-surface view on every target (#5518): a child HWND on Windows, an NSView/UIView on macOS/iOS/visionOS, a GtkDrawingArea on GTK4, an android.view.View on Android (tvOS/watchOS are link-stability stubs). bloomViewGetHwnd(view) returns the platform's native handle.

But live rendering only works on Windows. The Bloom engine can only build its surface on an HWND (bloom_attach_hwnd, Bloom-Engine/engine#70). On the other platforms the view is created and a handle is handed out, but no renderer attaches to it yet.

Goal

Make a BloomView actually render a Bloom scene on every platform Bloom supports, not just Windows.

Work breakdown

Engine side (Bloom-Engine/engine) — ✅ landed in Bloom-Engine/engine#71

The engine exposes one platform-neutral ABI symbol bloom_attach_native(handle, w, h) (each platform interprets handle as its own NSView*/UIView*/ANativeWindow*/HWND) rather than distinct bloom_attach_nsview/uiview/surface names — the function manifest is shared and CI requires every platform to export every entry, so one symbol beats N stubs. A shared attach_engine() helper factors the wgpu bring-up out of every bloom_init_window (macOS was refactored onto it). TS exposes the named wrappers attachToNSView / attachToUIView / attachToSurface + attachToNativeView. Also added real cross-platform bloom_resize. Verified: macOS renders a scene end-to-end headless; iOS cross-compiles.

Perry UI side (PerryTS/perry)

  • Sizing: BloomView reserves a fixed size on Windows; the other backends create the view but don't yet apply the requested dimensions. Wire size via Auto Layout (Apple), set_size_request is done for GTK4, LayoutParams (Android).
  • Android: switch the widget from android.view.View to a SurfaceView/TextureView and expose its Surface (currently bloomViewGetHwnd echoes the registry token).
  • tvOS / watchOS: promote from stubs to real views if Bloom targets them (watchOS likely stays a stub).
  • Input / focus routing per platform (Windows subclasses the HWND for keyboard/mouse; Apple/GTK/Android need their own).
  • Per-platform demo + verification: extend embed-perry/ (feat(windows): embed Bloom in a host window via bloom_attach_hwnd (Perry UI BloomView, #2395) Bloom-Engine/engine#70) with a build per target, and confirm a live scene renders inside a Perry UI app on each.

Naming

  • Consider renaming the Windows-centric bloomViewGetHwnd to a platform-neutral bloomViewGetNativeHandle (with a deprecated alias) now that it returns NSView*/UIView*/GtkWidget*/etc.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions