#43
Split the pipeline archive so it doesn't hang on startup
With "Pipeline archive" on, the game showed a black screen and never started once enough pipelines were recorded.
Metal loads an MTLBinaryArchive in time that grows with the square of its pipeline count. In a standalone test, 1,000 pipelines loaded in 0.7 s and 2,000 in 3.5 s. A 7,265-pipeline archive (415 MB) did not finish loading in 10 minutes, and the render thread waited for it.
- Prepare now writes the archive as
pipelines-NNNN.metalarfiles of 256 pipelines each and deletes the old files. 29 files load in about 3.6 s. - The game loads only
pipelines-*files, so an old singlepipelines.metalarfrom an earlier Prepare cannot stall it. - A chunk whose pipelines all failed gets no file.
This only changes the Metal 3 archive path (NX_PIPELINE_ARCHIVE), not the Metal 4 pipeline bases.
Tests
cargo test --workspacepasses.- Tested on macOS (M1) with update 4.0.1 before the rebase on the Metal 4 rework: Prepare wrote 30 archive files, the game loaded them in 3.6 to 5.5 s, prewarm took 6 s instead of 18 s, and 4 races had no hitches.
- After the rebase, the branch builds and passes tests.