metal, window: a minimised or covered window presents nothing instead of stalling #341
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/341"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T13:02:37Z.
What this changes
Refs #333.
While the game window is minimised or wholly covered, a present no longer waits for a drawable.
victory_metal::present::try_presentcounts the frame as shown and draws nothing, as in a headless run. The window's event loop reports its visibility each pass:isMiniaturized, orocclusionStatewithoutNSWindowOcclusionStateVisible. It does that throughvictory_gpu::set_window_hidden, a re-export ofvictory_metal::present::set_window_hidden, so the app gains no dependency andCargo.lockdoesn't change. A drawable acquisition already in flight is still taken. When the window can be seen again, presents go back to the layer. The change is logged once each way (present: the window's visibility changed hidden=…).How it was tested
Apple M5 Max, 36 GB, macOS 26.5, windowed,
--console series-s,VICTORY_COUNT_GREEN=1. The window was minimised from outside with System Events (AXMinimized) 12 s into the run and restored 30 s later:hidden=trueat 12:28:37,hidden=falseat 12:29:07. Presents kept going all the time it was minimised (22–30 per second), it drew normally once restored, and the run went on into the story load with no fault.Checks:
cargo test -p victory-metal --lib present(arm64): 3 passed. The new test isa_hidden_window_presents_without_a_drawable: with a drawable worker that never answers, three hidden presents returnOk(true)and count, and once visible again the present waits as before. Both present tests now take a lock, since the flag is process-wide.cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: all pass excepthost_posix::ucrt::tests::dlls_that_are_not_the_c_runtime_are_left_alone, which fails the same way on main at86786a72.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningscargo xtask policyChecklist
VICTORY_*variable and documented (no new diagnostics)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:15:19Z.
Merged in
4cf84c83. Before pushing I ran the tests (native arm64), Windows clippy, the policy check, a release build, and one headless game run of the exact tree (170 s, Series S): menus at 30 fps, the world entered at about 81 s and kept presenting to the end at about 1 frame a second, 0 GPU errors, no crash. The run was headless, so I did not try minimising a window. Thanks.