Repository navigation
feat(platform): add owned SurfaceTarget seam for GPU renderer attachment - #24
Merged
Merged
Conversation
Implements CTX-0017 per ADR-0004 (GPU rendering strategy touches only bitty-render and bitty-platform) and closes the CTX-0015 deferral of window-surface attachment. - surface::SurfaceTarget: Bitty-owned attachment point derived from WindowHandle::surface_target(); winit stays behind a private SurfaceSource trait so headless unit tests drive the seam with constructed inputs (same pattern as the event translation seam). - SurfaceTarget::with_raw_handles lends raw display/window handles to a caller closure for wgpu surface creation. raw-window-handle types are unavoidable at this boundary, so the dependency is pinned exactly to the version wgpu 25 consumes (=0.6.2, already in Cargo.lock) and re-exported at the crate root; rationale documented in crate ownership rules. - DPI-size refresh hook: WindowHandle::logical_to_physical and SurfaceTarget::logical_to_physical; resize->surface-extent flow documented on PlatformEvent/WindowEventKind and the surface module, with map_resize_to_surface_extent returning None for zero extents (minimized windows) so renderers skip configuration. - PlatformError::SurfaceHandle for owned handle-failure reporting. - gui-tests display smoke extended: live window yields both handles and its size maps to a usable surface extent. Headless unit tests cover handle plumbing, error paths without invoking configure, clone identity sharing, extent mapping, and DPI refresh math; 32 crate tests green. just check green. Closes #23 CarryCtx: CTX-0017 (team core-foundation)
This was referenced Oct 15, 2026
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23
Implements CarryCtx task CTX-0017 (team core-foundation, agent core-implementer).
Outcome
Adds the owned
SurfaceTargetGPU-attachment seam tobitty-platformso a future renderer slice can attach a wgpu surface without winit/raw-window-handle types leaking through the public API — except the single documented exception below.surface::SurfaceTarget: derived fromWindowHandle::surface_target(); winit stays behind a privateSurfaceSourcetrait (headless test seam).SurfaceTarget::with_raw_handles: lends raw display/window handles for wgpu surface creation.WindowHandle::logical_to_physical,SurfaceTarget::logical_to_physical.PlatformEvent/WindowEventKind; pure mappermap_resize_to_surface_extentreturnsNonefor zero extents.PlatformError::SurfaceHandle.Boundary-type decision
raw-window-handle types are unavoidable at the surface handoff boundary: wgpu 25 (
bitty-render, ADR-0004) consumes raw display/window handles as its creation payload. Per the task's fallback clause the dependency is pinned exactly (=0.6.2, matching the version already locked via wgpu 25.0.2 — zero lock drift) and re-exported at the crate root (bitty_platform::raw_window_handle) so consumers share one version instead of adding their own. No winit type escapes; rationale documented in crate ownership rules andsrc/surface.rs.Security/performance impact
None beyond surface: zero unsafe added (crate forbids it); no new attack surface (handles are lent only to an in-process caller closure). Performance-neutral; no hot-path code.
Docs synchronization
Crate/module/variant docs updated in-repo (
lib.rsownership rules + limitations,surfacemodule flow, event resize-flow docs). Cross-repobitty-docssync is tracked by the owning task lifecycle per documentation rules; no canonical doc in bitty-docs describes this API yet.Validation
just checkgreen locally: fmt-check, clippy-D warnings(workspace, all targets), workspace tests, actionlint, markdownlint.Merge order
None; single-repository change scoped to
crates/bitty-platform/**+ manifest/lock pin.