public int GetCachePosition(GpuCacheHandle handle) { FreeListHandle freeListHandle = handle.Value; _slots.ThrowIfInvalid(freeListHandle); return((int)freeListHandle.Index); }
public GpuCacheHandle Insert(ref T value) { FreeListHandle slot = _slots.Next(); Span <Vector4> blocks = GetBlocks(slot.Index); value.WriteGpuBlocks(blocks); return(new GpuCacheHandle(slot)); }
public void Free(ref GpuCacheHandle handle) { FreeListHandle freeListHandle = handle.Value; _slots.ThrowIfInvalid(freeListHandle); Span <Vector4> blocks = GetBlocks(freeListHandle.Index, freeing: true); blocks.Clear(); _slots.Free(ref freeListHandle); handle = GpuCacheHandle.Invalid; }
public void Upsert(ref GpuCacheHandle handle, ref T value) { FreeListHandle freeListHandle = handle.Value; if (_slots.ValidateHandle(freeListHandle)) { Span <Vector4> blocks = GetBlocks(freeListHandle.Index); value.WriteGpuBlocks(blocks); return; } handle = Insert(ref value); }
public AssetRef(ContentManager contentManager, string path, FreeListHandle handle) => (_contentManager, Path, Handle) = (contentManager, path, handle);
public GpuCacheHandle(FreeListHandle freeListHandle) => Value = freeListHandle;