A minimised or covered window stalls presents, then the title stops #333

Open
opened 2026-11-27 12:26:57 +00:00 by github-bot · 2 comments
Owner

@⁠derz92 on GitHub · 2026-11-27 12:23 UTC · original

Summary

If the game window is minimised (or the run starts minimised), the title stalls within seconds and then dies. While the window is in the Dock, nextDrawable hands out few or no drawables. A present then stays at the head of the present FIFO waiting for one, the title's presents back up behind it, and the title stops.

How it looked

Apple M5 Max, macOS 26.5. The window was miniaturised just after it opened (VICTORY_COUNT_GREEN=1 pacing):

  • Presents ran at ~18/s for about 5 s and then stopped. DirectStorage status polls kept spinning, and the process ended at 36 s with Illegal instruction: 4, at frame 32. Caveat: that Mac was also short of memory at the time (a GPU reset earlier had left ~20 GB held by the driver), so the exit itself may have had more than one cause. The stop in presents while minimised did not.

With the change below, the same minimised start keeps ~30 presents a second and runs normally (present: the window's visibility changed hidden=true is logged).

Proposed change

While the window is minimised or wholly covered (isMiniaturized, or occlusionState without NSWindowOcclusionStateVisible, read in the window's event loop), try_present counts the frame as presented and draws nothing, as a headless run does. A drawable acquisition already in flight is left to finish. When the window can be seen again, presents go back to the layer.

I'd like to take this one and will send a PR.

**@⁠derz92** on GitHub · 2026-11-27 12:23 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/333) ## Summary If the game window is minimised (or the run starts minimised), the title stalls within seconds and then dies. While the window is in the Dock, `nextDrawable` hands out few or no drawables. A present then stays at the head of the present FIFO waiting for one, the title's presents back up behind it, and the title stops. ## How it looked Apple M5 Max, macOS 26.5. The window was miniaturised just after it opened (`VICTORY_COUNT_GREEN=1` pacing): - Presents ran at ~18/s for about 5 s and then stopped. DirectStorage status polls kept spinning, and the process ended at 36 s with `Illegal instruction: 4`, at frame 32. Caveat: that Mac was also short of memory at the time (a GPU reset earlier had left ~20 GB held by the driver), so the exit itself may have had more than one cause. The stop in presents while minimised did not. With the change below, the same minimised start keeps ~30 presents a second and runs normally (`present: the window's visibility changed hidden=true` is logged). ## Proposed change While the window is minimised or wholly covered (`isMiniaturized`, or `occlusionState` without `NSWindowOcclusionStateVisible`, read in the window's event loop), `try_present` counts the frame as presented and draws nothing, as a headless run does. A drawable acquisition already in flight is left to finish. When the window can be seen again, presents go back to the layer. I'd like to take this one and will send a PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 12:26:57 +00:00
Author
Owner

@⁠derz92 on GitHub · 2026-11-27 12:23 UTC · original

/claim

**@⁠derz92** on GitHub · 2026-11-27 12:23 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/333#issuecomment-7218184512) /claim
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-28 00:35 UTC · original

Thank you for the report and the fix. While the window is minimised or fully covered, presents now count as shown and draw nothing, so the present queue does not back up (#342, on main). I am not sure it is fixed for your whole case: the original run also ended with "Illegal instruction" on a Mac short of memory, and I have not minimised the window myself. Could you retest a minimised start on a6a58361 and tell me if the title keeps running? I will close it when you say yes.

**@⁠LakshanSivakumar** on GitHub · 2026-11-28 00:35 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/333#issuecomment-7231038019) Thank you for the report and the fix. While the window is minimised or fully covered, presents now count as shown and draw nothing, so the present queue does not back up (#342, on main). I am not sure it is fixed for your whole case: the original run also ended with "Illegal instruction" on a Mac short of memory, and I have not minimised the window myself. Could you retest a minimised start on a6a58361 and tell me if the title keeps running? I will close it when you say yes.
This discussion has been locked. Commenting is limited to contributors.
No description provided.