Terrain arriving: frames upload chunk meshes for 6 ms instead of 2

Without the player's Chunk Updates or Upload Budget, a frame uploads
meshes for AUTO_UPLOAD_TIME (2 ms). While a view's terrain is still
arriving (ViewArrival, a world's open, a teleport) the meshes waiting are
that view, and up to ~1300 of them queued at the end of a world's open,
holding the full view back. Those frames now give them 6 ms.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
VaspyyyandClaude Opus 5.5 committed 2026-11-02 04:40:11 +01:00
1 parent 435730a405
commit a357026d64
1 file changed
+10 -1
+10 -1
View File
@@ -408,6 +408,10 @@ use winit::{
/// The time a frame spends uploading chunk meshes when the player set no
/// Chunk Updates or Upload Budget: a burst past it waits for the next frames.
const AUTO_UPLOAD_TIME: Duration = Duration::from_millis(2);
/// `AUTO_UPLOAD_TIME` while the view's terrain is still arriving (a world's
/// open, a teleport): the meshes waiting then are the view itself, not edits
/// to it, so a frame gives them more of its time to fill the view sooner.
const AUTO_UPLOAD_TIME_ARRIVING: Duration = Duration::from_millis(6);
/// A frame's finished meshes up to this many upload at once, unqueued.
const AUTO_UPLOADS_AT_ONCE: usize = 8;
@@ -16384,9 +16388,14 @@ impl Game<'_> {
// AUTO_UPLOAD_TIME of this frame (at least one goes): a burst of
// finished meshes spreads over frames, nearest first.
let auto = !budgeted;
let auto_time = if arriving {
AUTO_UPLOAD_TIME_ARRIVING
} else {
AUTO_UPLOAD_TIME
};
let started = Instant::now();
while let Some((_, mesh)) = pending.last() {
if auto && count > 0 && started.elapsed() >= AUTO_UPLOAD_TIME {
if auto && count > 0 && started.elapsed() >= auto_time {
break;
}
let size = ((mesh.solid.len() + mesh.translucent.len())