using System.Collections.Concurrent; namespace AcDream.App.Rendering.Wb; /// /// Thread-safe side-table mapping (gfxObjId, surfaceIdx) to /// . Populated when a GfxObj's mesh data /// is extracted; queried at draw time. /// /// /// Keyed by (gfxObjId, surfaceIdx) not by WB's runtime batch /// identity because batch objects can be evicted and re-loaded by WB's /// LRU; the (gfxObj, surface) pair is stable across cycles. /// /// public sealed class AcSurfaceMetadataTable { private readonly ConcurrentDictionary<(ulong gfxObjId, int surfaceIdx), AcSurfaceMetadata> _table = new(); public void Add(ulong gfxObjId, int surfaceIdx, AcSurfaceMetadata meta) => _table[(gfxObjId, surfaceIdx)] = meta; public bool TryLookup(ulong gfxObjId, int surfaceIdx, out AcSurfaceMetadata meta) => _table.TryGetValue((gfxObjId, surfaceIdx), out meta!); public void Clear() => _table.Clear(); }