8901a49d0b
Queue::write_buffer creates a staging buffer for every call: on Metal a kernel call to make the buffer, then page faults while the mesh is copied into fresh memory. While exploring at render distance 32 the render thread made two such writes per uploaded section, plus one for its flat-draw ids. Section meshes and flat ids now go through their own StagingBelt (4 MiB mapped buffers, reused once the GPU has read them) into one encoder that the frame's submission runs ahead of its own commands. A page of the section arena that grows records its copy into that encoder too, so copies recorded before the grow reach the grown buffer. A frame that is not drawn still submits the copies, and more than 64 MiB of them are submitted early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>