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

Open
opened 2026-11-27 12:23:21 +00:00 by derz92 · 2 comments
derz92 commented 2026-11-27 12:23:21 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T12:23:21Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6646353673 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/333). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T12:23:21Z. --- ## 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 commented 2026-11-27 12:23:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T12:23:24Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7218184512 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/333#issuecomment-7218184512). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T12:23:24Z. --- /claim
LakshanSivakumar commented 2026-11-28 00:35:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-28T00:35:46Z.


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 (#341, 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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7231038019 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/333#issuecomment-7231038019). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-28T00:35:46Z. --- 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 (#341, 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.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#333
No description provided.