Ejemplo n.º 1
0
        public int GetCachePosition(GpuCacheHandle handle)
        {
            FreeListHandle freeListHandle = handle.Value;

            _slots.ThrowIfInvalid(freeListHandle);
            return((int)freeListHandle.Index);
        }
Ejemplo n.º 2
0
        public GpuCacheHandle Insert(ref T value)
        {
            FreeListHandle slot   = _slots.Next();
            Span <Vector4> blocks = GetBlocks(slot.Index);

            value.WriteGpuBlocks(blocks);
            return(new GpuCacheHandle(slot));
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public AssetRef(ContentManager contentManager, string path, FreeListHandle handle)
 => (_contentManager, Path, Handle) = (contentManager, path, handle);
Ejemplo n.º 6
0
 public GpuCacheHandle(FreeListHandle freeListHandle)
 => Value = freeListHandle;