feat(render): unify physical residency accounting

This commit is contained in:
Erik 2026-07-24 16:20:48 +02:00
parent 1866ea0c6d
commit 3e18fc2730
25 changed files with 642 additions and 48 deletions

View file

@ -133,6 +133,8 @@ internal sealed class MeshUploadStagingQueue
public int ClaimCount { get { lock (_gate) return _generationById.Count; } }
public long QueuedBytes { get { lock (_gate) return _queuedBytes; } }
public long ClaimedBytes { get { lock (_gate) return _claimedBytes; } }
public int MaximumCount => _maximumCount;
public long MaximumBytes => _maximumBytes;
public bool IsAtHighWater
{
get
@ -249,6 +251,11 @@ internal sealed class MeshOwnershipCounter
public bool IsOwned(ulong id) => Count(id) > 0;
public int OwnedIdCount => _counts.Count(pair => pair.Value > 0);
public int TotalReferenceCount => _counts.Sum(
pair => Math.Max(0, pair.Value));
/// <summary>
/// Reports whether freshly uploaded data has a live owner. This is a query,
/// not an acquire: upload existence and logical ownership are independent.
@ -297,6 +304,8 @@ internal sealed class CpuMeshUploadCache
internal int Count { get { lock (_data) return _data.Count; } }
internal long ResidentBytes { get { lock (_data) return _residentBytes; } }
internal int Capacity => _capacity;
internal long ByteCapacity => _byteCapacity;
public bool TryGetAndStage(
ulong id,