Runtime preview: add a performance recipe (about 4 fps in the world on an M5 Pro) #11

Manually merged
github merged 1 commit from github-bot/gh-11 into gh-pr/11/base 2026-11-27 09:06:21 +00:00 AGit
Owner

@⁠jgrizon on GitHub · 2026-11-27 08:33 UTC · original
jgrizon:perf/runtime-preview-perf-recipe → main · +9120 −6 · 7 files · 1 commits · merged 2026-11-27 09:05 UTC

Changes

Adds a third runtime-preview recipe, ./build.sh --perf. In the Series S intro on a 24 GB M5 Pro it runs the game world at about 4 fps, up from about 1 fps.

runtime-preview/
  build.sh                           adds --perf, and SCARLETTMAC_BUILD_PROFILE=release|diag (default diag, as before)
  perf/UPSTREAM                      halfwave50/VIctory-macOS-halfwave @ 8616bd6
  perf/patches/0001-perf-main.patch  37 files, +6164 / -521
  BUILD.md, SOURCE-NOTICES.md, README.md   docs and attribution

The patch changes four things:

  • Fewer DirectStorage reader threads. It uses 6 instead of one per core (18 here). Wine serializes the memory-map calls these threads make, so 18 readers mostly waited on each other. This alone roughly doubled the frame rate.
  • The memory guard runs under D3DMetal. D3DMetal reports separate video memory on a unified-memory Mac, so the RAM guard never started. Large textures now load their top mip at half size; VICTORY_TEXTURE_DROP_MIPS=0 restores full detail.
  • Write faults are healed instead of crashing. This covers faults where Wine reports extra protection bits, and faults on pages that were reserved first and committed later.
  • One more compute shader translates. The shader reads a buffer's size from its descriptor and was dropped before.

The work builds on halfwave50's VIctory-macOS fork, which is GPL-3.0-or-later. So the recipe pins that fork instead of pragyaangaur/VIctory-macOS. Rebasing onto the latter would have meant a 71k-line patch. The default and checkpoint recipes are unchanged.

Verification

Hardware and software: Apple M5 Pro, 24 GB, macOS 27.3, CrossOver 26.3.0.39832, D3DMetal 3.0. Wine was CrossOver 26.3's Wine 11.0, rebuilt with the two patches in the prepared source's tools/macos/build-crossover-wine.sh.

  • zsh -n scripts/build.sh && zsh -n scripts/run.sh && sh -n runtime-preview/build.sh passed.
  • LLVM_MINGW_ROOT=… SCARLETTMAC_BUILD_PROFILE=release runtime-preview/build.sh --perf NEW_DIR built victory.exe from a fresh directory (exit 0).
  • victory-gpu's Windows unit tests, run under that Wine: 586 passed; 0 failed; 21 ignored.
  • The game, as a release build with tools/macos/play-main-mac.sh settings. "World frames" are frames drawn in the first 120 s after the world appears:
Build World frames in 120 s Median frame Slowest 5%
Same source before these changes about 140 to 160 860 to 1100 ms several seconds
This recipe (5 runs) 474, 509, 508, 508, 528 225 to 255 ms 0.32 to 0.40 s

There were no crashes in the last 13 runs with these settings, including one 10-minute run.

Not verified or still open:

  • After 4 to 5 minutes, swap grows again by about 2 GB, and some minutes drop to about 1 fps.
  • The opening credits show a flat green panel where a video should play.
  • Only one Mac was tested.
  • runtime-preview/run.sh was not tried with this recipe. The numbers come from the source's own play-main-mac.sh.
  • VICTORY_COPY_FAST and VICTORY_ALIAS_BUFFERS are in the patch but off by default, because both still crash.
**@⁠jgrizon** on GitHub · 2026-11-27 08:33 UTC · [original](https://github.com/paveledits/ScarlettMac/pull/11) `jgrizon:perf/runtime-preview-perf-recipe` → `main` · +9120 −6 · 7 files · 1 commits · merged 2026-11-27 09:05 UTC ## Changes Adds a third runtime-preview recipe, `./build.sh --perf`. In the Series S intro on a 24 GB M5 Pro it runs the game world at about 4 fps, up from about 1 fps. ```text runtime-preview/ build.sh adds --perf, and SCARLETTMAC_BUILD_PROFILE=release|diag (default diag, as before) perf/UPSTREAM halfwave50/VIctory-macOS-halfwave @ 8616bd6 perf/patches/0001-perf-main.patch 37 files, +6164 / -521 BUILD.md, SOURCE-NOTICES.md, README.md docs and attribution ``` The patch changes four things: - **Fewer DirectStorage reader threads.** It uses 6 instead of one per core (18 here). Wine serializes the memory-map calls these threads make, so 18 readers mostly waited on each other. This alone roughly doubled the frame rate. - **The memory guard runs under D3DMetal.** D3DMetal reports separate video memory on a unified-memory Mac, so the RAM guard never started. Large textures now load their top mip at half size; `VICTORY_TEXTURE_DROP_MIPS=0` restores full detail. - **Write faults are healed instead of crashing.** This covers faults where Wine reports extra protection bits, and faults on pages that were reserved first and committed later. - **One more compute shader translates.** The shader reads a buffer's size from its descriptor and was dropped before. The work builds on [halfwave50's VIctory-macOS fork](https://github.com/halfwave50/VIctory-macOS-halfwave), which is GPL-3.0-or-later. So the recipe pins that fork instead of `pragyaangaur/VIctory-macOS`. Rebasing onto the latter would have meant a 71k-line patch. The default and checkpoint recipes are unchanged. ## Verification Hardware and software: Apple M5 Pro, 24 GB, macOS 27.3, CrossOver 26.3.0.39832, D3DMetal 3.0. Wine was CrossOver 26.3's Wine 11.0, rebuilt with the two patches in the prepared source's `tools/macos/build-crossover-wine.sh`. - `zsh -n scripts/build.sh && zsh -n scripts/run.sh && sh -n runtime-preview/build.sh` passed. - `LLVM_MINGW_ROOT=… SCARLETTMAC_BUILD_PROFILE=release runtime-preview/build.sh --perf NEW_DIR` built `victory.exe` from a fresh directory (exit 0). - victory-gpu's Windows unit tests, run under that Wine: `586 passed; 0 failed; 21 ignored`. - The game, as a release build with `tools/macos/play-main-mac.sh` settings. "World frames" are frames drawn in the first 120 s after the world appears: | Build | World frames in 120 s | Median frame | Slowest 5% | | --- | --- | --- | --- | | Same source before these changes | about 140 to 160 | 860 to 1100 ms | several seconds | | This recipe (5 runs) | 474, 509, 508, 508, 528 | 225 to 255 ms | 0.32 to 0.40 s | There were no crashes in the last 13 runs with these settings, including one 10-minute run. Not verified or still open: - After 4 to 5 minutes, swap grows again by about 2 GB, and some minutes drop to about 1 fps. - The opening credits show a flat green panel where a video should play. - Only one Mac was tested. - `runtime-preview/run.sh` was not tried with this recipe. The numbers come from the source's own `play-main-mac.sh`. - `VICTORY_COPY_FAST` and `VICTORY_ALIAS_BUFFERS` are in the patch but off by default, because both still crash.
Pins halfwave50's VIctory-macOS fork at 8616bd6 and applies one patch with
the memory guard under D3DMetal, fewer DirectStorage readers, write-fault
heals and a translated descriptor-size shader. build.sh takes --perf and
SCARLETTMAC_BUILD_PROFILE=release. Series S intro on a 24 GB M5 Pro: about
4 fps in the game world, up from about 1 fps.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 08:33:55 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-27 08:33 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-27 08:33 UTC · [original](https://github.com/paveledits/ScarlettMac/pull/11#pullrequestreview-6085433317) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
github-bot changed target branch from main to gh-pr/11/base 2026-11-27 09:06:19 +00:00
github manually merged commit 4921b7e6b6 into gh-pr/11/base 2026-11-27 09:06:21 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.