/// <summary> /// Removes a fence from the holder. /// </summary> /// <param name="cbIndex">Command buffer index of the command buffer that owns the fence</param> /// <param name="fence">Fence to be removed</param> public void RemoveFence(int cbIndex, FenceHolder fence) { lock (_fences) { _fences.Remove(fence); } }
/// <summary> /// Adds a fence to the holder. /// </summary> /// <param name="cbIndex">Command buffer index of the command buffer that owns the fence</param> /// <param name="fence">Fence to be added</param> public void AddFence(int cbIndex, FenceHolder fence) { lock (_fences) { _fences.TryAdd(fence, cbIndex); } }
private void FreeCompleted() { FenceHolder signalledFence = null; while (_pendingCopies.TryPeek(out var pc) && (pc.Fence == signalledFence || pc.Fence.IsSignaled())) { signalledFence = pc.Fence; // Already checked - don't need to do it again. var dequeued = _pendingCopies.Dequeue(); Debug.Assert(dequeued.Fence == pc.Fence); _freeSize += pc.Size; pc.Fence.Put(); } }
public PendingCopy(FenceHolder fence, int size) { Fence = fence; Size = size; fence.Get(); }