upload

fun upload(data: ByteBuffer): GpuBufferSlice

Upload data into the ring buffer and return a slice covering the written region.

Upload decision:

  1. If the current buffer has enough remaining space, append at currentOffset.

  2. Otherwise, if the buffer is large enough, rotate() and write from offset 0.

  3. If the buffer is still too small for this upload, grow the ring and write from 0.

Return

The uploaded GpuBufferSlice. Its lifetime is tied to the underlying ring buffer.

Parameters

data

The data to upload. Its remaining() bytes will be copied.