public static void ReleaseBuffer(BufferInstance buffer) { lock (typeof(BufferManager)) { if (!c_usedBuffers.ContainsKey(buffer)) { throw new Exception("attempted to release a buffer that is not in use"); } c_usedBuffers.Remove(buffer); var bufferList = GetAvailableBuffers(buffer.Length, true); bufferList.Push(buffer); } if (UNPIN_ON_RELEASE && buffer.Pinned) { buffer.UnpinBuffer(); } }
public static void ReleaseBuffer(BufferInstance buffer) { lock (typeof(BufferManager)) { if (!c_usedBuffers.ContainsKey(buffer)) throw new Exception("attempted to release a buffer that is not in use"); c_usedBuffers.Remove(buffer); var bufferList = GetAvailableBuffers(buffer.Length, true); bufferList.Push(buffer); } if (UNPIN_ON_RELEASE && buffer.Pinned) buffer.UnpinBuffer(); }