Files
horizon-airdef/crates
chexit 94b572cd24 Uploads: round oversized staging allocations up to a power of two
Uploads staged every buffer write through wgpu's StagingBelt, which gives a
write larger than its chunk a buffer of exactly that size, keeps it for good
and only reuses it for writes that fit. The entity batch outgrows the 1 MiB
chunk with a few hundred mobs and grows a little each tick while more appear,
so every tick took a new buffer: about 1 GB more per hundred mobs past ~750,
never given back, until the game was killed (upstream #2826).

Writes larger than the chunk now take a power-of-two slice and copy only
their bytes, so the buffers the belt keeps are reused: one per doubling.

Backport of horizon-rust/horizon@f7b77fbc88,
whose file moved from crates/horizon-client-render/src/gfx/upload.rs to
crates/horizon-client/src/gfx/upload.rs. Takes its growth test
(growing_large_writes_reuse_the_belt_buffers) and the kept_buffers helper as
written. Fork issue: #130.

Co-Authored-By: Kimi Code <noreply@moonshot.cn>
2026-11-14 17:22:37 +03:00
..