refactor: store-owned diff snapshot and drop dead ChunkJob.ExistingChunk

TryGetDiff now returns an independent copy so callers can safely retain the
reference; removes the defensive copy from ChunkStreamer.DispatchLoad.
ChunkJob.ExistingChunk was never populated (DispatchRemesh uses closures
instead), so the field is removed along with its misleading record-level
comment.
This commit is contained in:
2026-06-01 13:31:05 +02:00
parent 6b148362c0
commit 34f923cbca
3 changed files with 9 additions and 13 deletions

View File

@@ -3,12 +3,12 @@ using VoxelEngine.World.Chunk;
namespace VoxelEngine.World.Streaming;
// Job dispatched to an IJobExecutor. For a fresh load, ExistingChunk is null
// and the worker generates + applies diff + meshes. For a remesh-only job,
// ExistingChunk holds the chunk and the worker only meshes (no generation).
// Job dispatched to an IJobExecutor for a fresh chunk load. The worker
// generates the chunk, applies any modification diff, and meshes the result.
// Remesh-only jobs are dispatched separately by DispatchRemesh and capture
// their state via closures, so they do not use this record.
internal sealed record ChunkJob(
Vector3i Pos,
Chunk.Chunk? ExistingChunk,
NeighborSnapshots Neighbors,
IReadOnlyDictionary<int, ushort>? Diff);