webatintel / aquarium

BSD 3-Clause "New" or "Revised" License
24 stars 7 forks source link

Refactor buffer mapping async algorithm #90

Closed JiangYizhou closed 4 years ago

JiangYizhou commented 4 years ago

1.Take care of upper limit of the buffer pool. If buffer and size is enough in the buffer pool, create a new buffer. If size reach the limit of the buffer pool, force wait for the buffer on mapping. 2.Use a ring buffer to upload data for all of the constant buffers. Return the buffer and its offset when allocate the buffer from the pool. Get the last one from the MappedBufferQueue and check if the ring buffer is full. If the buffer can hold extra size space, use the last one directly. 3.Return null if size reach the limit or no available buffer, this means small bubbles in some of the ring buffers and we haven't deal with the problem now.