Skip to content

Reuse enclosing title buffers and offer 256 KiB loose windows on macOS - #165

Merged
pragyaangaur merged 3 commits into
pragyaangaur:mainfrom
gdemontalivet:perf/macos-loose-windows
Nov 26, 2026
Merged

pragyaangaur merged 3 commits into
pragyaangaur:mainfrom
gdemontalivet:perf/macos-loose-windows

Conversation

@gdemontalivet

Copy link
Copy Markdown
Contributor

Backport of Marvisak/VIctory #402 and #2088, with a macOS switch for the window size. A lookup can now find a registered parent buffer past more than 64 smaller children. A request outside those buffers can reuse a loose window covering its full byte range. Creating a new window requires a committed first byte.

Set VICTORY_SMALL_LOOSE_WINDOWS=1 for 256 KiB loose windows. The default is 4 MiB. Smaller windows can reduce retained host memory while increasing the number of D3D12 resource views. Either size uses the corrected enclosing-buffer lookup.

On an M5 Max, two integration builds started from copies of the same prologue checkpoint and initial cache under CrossOver Preview / D3DMetal. The control used the previous lookup and 4 MiB windows. The backport used 256 KiB windows. Both reached world frame +90 at 720p.

Last reported metric Control Backport with 256 KiB
Host copies of title memory 5,224 12,421
Memory in those copies 7,071 MB 4,028 MB
Process working set 22,174 MB 17,878 MB
FPS over world +8 to +48 1.14 1.26
FPS over world +48 to +90 0.81 0.69

These are single runs. The observed benefit was lower memory use. The frame-rate result varied by interval.

On the public backport, the full debug Windows GPU suite under CrossOver passed 234 tests with one ignored. All 14 release shadow tests passed separately at each window size. The full release GPU suite had two failures. The UAV vtable function-address assertion also failed on the unmodified upstream GPU source in release mode. The frame-timing assertion passed on an isolated retry. The native GPU suite passed 79 tests with one ignored, and the staged asset check passed.

Backport the enclosing lookup and smaller-copy experiments from Marvisak/VIctory#402 and #2088. The 256 KiB setting is opt-in on macOS because prologue measurements show a lower footprint and mixed frame times.

Co-authored-by: KaiserBloo <kaiserbloo@protonmail.com>
Co-authored-by: desp <me@desp.lol>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@pragyaangaur

Copy link
Copy Markdown
Owner

Thanks. Three requests. First, the new shadow tests that call writing, copy_back and loose should hold the submission lock, as #150 does, to avoid the flake in #31. Second, this conflicts with #169 over find and BUFFERS, so please agree an order with that PR and rebase. Third, please note the cost of the wider lookup when a big parent holds thousands of children, and run cargo fmt on the new code.

@pragyaangaur
pragyaangaur merged commit c023ec2 into pragyaangaur:main Nov 26, 2026
1 check passed
@pragyaangaur

Copy link
Copy Markdown
Owner

I merged main in (no conflicts). The overlapping windows test calls writing, copy_back and loose, so it now holds the submission lock the way the mark tests from #150 do. I also added a note on the cost of the enclosing lookup: it walks the entries starting within the longest buffer's length below the address, where the old search stopped after 64. CI passed and the PR is merged.

@pragyaangaur pragyaangaur added area:gpu Host GPU runtime: resources, copies, presenting area:title The game's own startup and runtime behaviour d3dmetal A difference in Apple's D3DMetal labels Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Host GPU runtime: resources, copies, presenting area:title The game's own startup and runtime behaviour d3dmetal A difference in Apple's D3DMetal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants