Files
velzieandClaude Opus 5.5 327c4f6669 gexgl, page: a paced swap hands its frame over without waiting
eglSwapBuffers at a swap interval above 0 waited for the host to replay
the whole frame on the compositor's Worker before returning: Noita's main
thread spent 13% of its time in that round trip (edger profile, 2026-10-13,
gl-bridge #exchange under wglSwapBuffers), about 11 ms a frame.

Now it goes through GEX_GL_PRESENT_ASYNC (0xc0086705): the batch is copied
and the call returns the frames the surface had shown as of the swap
before, which the host has finished by then. The pacing allows one frame
more in flight than a waited swap. A host without the call says ENOTTY
once and every later swap waits, as before (the native host's way).
GEXGL_SYNC_PRESENT is gone: one present path in the browser.

The page now releases an unwaited batch's claim on the ring itself once
the batch has run (gl-bridge ASYNC word). It used to be held until the
client's next submit, so a client that swapped and went idle held every
other GL client for up to thirty seconds. What an unwaited batch has to
say (frames shown, or that it failed) goes to its client's slot in the
control buffer. The failure is reported by that client's next submit, which
is not run. The single-thread build answers frames shown from the reply in
place.

tests/integration/programs/gl44-twoclients-probe.c (tests/gl44-probe.sh
twoclients): A swaps once and idles 6 s, while B swaps 30 frames and must
be done before A wakes. MP page, software WebGPU (gooner): PASS, 4 of 4.
With HEAD's gl-bridge, FAIL ("A woke before B was done", 32.8 s). SP:
single-callout and single-page gears ok.

Noita, edger, 300 s, alternating, wine relinked against this gexgl (A =
the waited swap, GEXGL_SYNC_PRESENT=1 at the time):

  unwaited swap: 17.3, 18.3 world frames/s
  waited swap:   15.4, 16.3 world frames/s

That is 1.12x faster than the waited swap (17.8 vs 15.85 world frames/s,
medians).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_ea9f71488b6e448da93d6c2dabf4879c
2026-10-13 05:16:01 -04:00
..