Skip to content

fix/292 : Fix multiwindow#299

Merged
kolkov merged 3 commits into
gogpu:mainfrom
lkmavi:fix/292-gless-dead-frame
Jun 14, 2026
Merged

fix/292 : Fix multiwindow#299
kolkov merged 3 commits into
gogpu:mainfrom
lkmavi:fix/292-gless-dead-frame

Conversation

@lkmavi

@lkmavi lkmavi commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
  1. macOS — only 1 window shown (window_manager.go:354): NewWindow() was creating the platform window but never calling
    platWindow.Show(). The v0.41.5 "hidden-then-show" refactor moved Show() out of CreateWindow(), but only wired it up in the
    primary window path (app.go). Fixed: platWindow.Show() is now called after GPU surface configuration in NewWindow().
  2. Wayland — first window infinite loading (libwayland_xdg.go, libwayland_input.go): Global callback handles
    (xdgCallbackHandle, inputCallbackHandle) were overwritten when the second window's LibwaylandHandle was created, so the
    first window's xdg configure acks were sent to the wrong surface — the compositor never mapped the first surface. Fixed:
    replaced both globals with per-proxy maps (xdgSurfaceHndls, xdgWmBaseHndls, toplevelHandles) keyed by C proxy pointer.
  3. Wayland — closing one window closes both (platform_linux.go): p.primaryWindowID was overwritten to the secondary
    window's ID on the second CreateWindow() call, and ShouldClose() shared state across windows. Fixed: secondary windows get
    independent Wayland connections via createSecondaryConn(), with their own shouldClose flag; ShouldClose() and Destroy()
    dispatch to the secondary's own state when w.secondary != nil.
  4. Wayland — secondary events missed during blocking wait (platform_linux.go:WaitEvents): WaitEvents() only polled the
    primary connection's FD. Fixed: secondary connection FDs are appended to the unix.Poll set so the main loop unblocks for
    any window's compositor events.

@kolkov remove replay before merge

@lkmavi lkmavi requested a review from kolkov as a code owner June 8, 2026 16:32
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
window_manager.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kolkov kolkov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lkmavi Enterprise code review of PR #299 (multiwindow fix). Great work — 4 real bugs fixed.

Architecture: ✅ Sound

Independent Wayland connections per secondary window (secondaryWaylandConn) is the right approach. Each window gets its own wl_display + wl_surface + xdg_toplevel. Input stays on primary seat (comment at line 184). This matches how GLFW handles multi-window Wayland.

Per-proxy callback routing: ✅ Correct

Replacing global xdgCallbackHandle / inputCallbackHandle with per-proxy maps (xdgSurfaceHndls, xdgWmBaseHndls, toplevelHandles) keyed by C proxy pointer — clean solution. Mutex-protected, unregistered in Close().

Thread panic propagation: ✅ Nice catch

threadResult with recover() in Call/CallVoid re-panics on caller. Prevents silent goroutine death on render thread.

macOS GetPoint buffer: ✅ Correct

[2]float64[4]float64 for goffi HFA return — matches Go 1.26 checkptr with -race.

Show() in NewWindow: ✅ Our regression fixed

platWindow.Show() added in window_manager.go:354 — fixes the hidden-then-show regression from v0.41.5 where we added Show() for primary window but forgot secondary.

Items to address before merge:

  1. replace directive in go.mod (line 8) — replace github.com/gogpu/wgpu => github.com/lkmavi/wgpu ... must be removed. Please rebase on main which now has wgpu v0.29.13 + naga v0.17.14 (v0.41.8 just released).

  2. PR body says "remove replay before merge" — is there debug/replay code still in the PR that needs cleanup?

  3. No CSD for secondary windowscreateSecondaryConn passes decorName/decorVersion to OpenLibwayland for SSD. Without SSD, secondary windows have no decorations. This is a reasonable first implementation, but worth a brief comment in createSecondaryConn noting that CSD for secondaries is deferred (separate subsurface + pointer routing per window is complex).

  4. Defensive: WaitEvents secondary FD iteration (line 2566) — secs := p.secondaries copies slice header under RLock, then iterates after RUnlock. Currently safe (main thread is single-threaded), but a brief comment noting the safety assumption would help future readers.

  5. naga v0.17.13 in go.sum — resolves after rebase on v0.41.8.

Summary

Solid multiwindow implementation. Main blocker: remove replace directive and rebase on v0.41.8 (wgpu v0.29.13 + naga v0.17.14). Rest are minor suggestions. CI 9/9 pass.

lkmavi added 3 commits June 13, 2026 14:53
fix/292 : Fix golint

fix(gles): re-add wgpu-local replace for GLES MakeCurrent fix

Restore the local wgpu replace directive to pick up the fix for
glFenceSync OOM + eglSwapBuffers EGL_BAD_SURFACE on Wayland GLES 3.0.

The wgpu-local commit b8b98f3 adds MakeCurrent in Submit() and
MakeCurrentSurface in Present(), matching Rust wgpu-hal's explicit EGL
context management pattern. This fix must land in wgpu-local before it
can be published as wgpu v0.29.13.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

fix/292 : Return objc format Add deep copy slice

fix/292 : Add temporary replay

# Conflicts:
#	go.sum
@lkmavi lkmavi force-pushed the fix/292-gless-dead-frame branch from 450c28a to 3635f0f Compare June 13, 2026 11:13
@lkmavi

lkmavi commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

@kolkov fixed on after rewiew

@kolkov kolkov merged commit 29e4c18 into gogpu:main Jun 14, 2026
9 of 10 checks passed
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.

2 participants