Repository navigation
Mesh-card capture: one render pass per frame instead of one per axis - #198
Conversation
Each captured axis had its own render pass into a 64x64 scratch plus two texture copies into the atlases: 120 render passes and 120 blit encoders per frame at the capture budget. On Metal every encoder holds about 1 MB of driver memory until the frame retires, which showed as ~400 x 1 MB IOAccelerator regions while a scene loaded. The scratch targets are now a grid (one row per captured mesh, one column per axis). All captures of a frame draw into their cells in a single pass with a viewport and scissor per draw, then the cells are copied to their atlas slots in one run. The Deep, peak memory footprint through load: about 2920 MB -> 2400 MB (3 runs each). Output: under 0.01% of pixels differ, max channel delta 8. Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Loading a scene with SSGI on spiked the process footprint by about 1 GB for the first seconds. Part of that is mesh-card capture.
Cause
Each captured axis had its own render pass into a 64×64 scratch target plus two texture copies into the atlases. At the per-frame budget (20 meshes × 6 axes) that is 120 render passes and 120 blit encoders in one command buffer. On Metal each encoder holds about 1 MB of driver memory until the frame retires:
vmmapshowed 413 one-megabyte IOAccelerator regions at the peak against 40 at steady state.Change
The scratch targets become a grid, one row per captured mesh and one column per axis (384×1280). All captures of a frame draw into their cells in a single render pass, with a viewport and scissor per draw, and the cells are then copied to their atlas slots in one run of copies. The pass lives in
renderer/card_capture_pass.rs.Result
The Deep (85 static nodes), peak memory footprint from launch to frame 200, three runs each, same game source:
One run on main reported 847 MB; I treated it as an outlier and left it out.
Output with deterministic autoplay: frame 20 identical apart from 2 LSB on a handful of pixels; frames 60 and 300 differ on under 0.01% of pixels, max channel delta 8.
Not addressed
About 700 MB of load-time spike remains above the steady footprint. I have not attributed it yet.
Tests
cargo test --releaseinnative/shared: same result asmain(onlyvisibility_shading_matches_forward_referencefails, as onmain).ci-check.sh --quicklint and contracts pass locally.🤖 Generated with Claude Code
Summary by CodeRabbit