private void ReturnFreeBuffer(CommandBufferPooledExclusiveUse buff) { int ccap; lock (_unavailable) ccap = _available.Count + _unavailable.Count; if (ccap > _capacity) { buff.Dispose(); return; } _available.Enqueue(buff); }
public void Return(CommandBufferPooledExclusiveUse buff) { buff.AssertValid(); Debug.Assert(!buff.IsBuilding, "Command buffer is currently building"); Debug.Assert(buff.CommandPool == this, "Command pool isn't this"); if (buff.IsSubmitted) { lock (_unavailable) _unavailable.Add(buff); } else { ReturnFreeBuffer(buff); } }