Interface StreamingBuffer
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
GlStreamingBuffer, WgpuStreamingBuffer
A streaming buffer for per-frame data uploads.
Uses triple-buffering internally: while the GPU reads from one region, the CPU writes to another. Fences ensure no overlap.
Backend-specific implementations use persistent mapping (GL) or staging buffers (Vulkan/WebGPU).
-
Method Summary
Modifier and TypeMethodDescriptionvoidadvance()Advances to the next frame.Begins writing for the current frame.voidclose()longReturns the byte offset into the buffer for the current frame's data.voidendWrite()Finishes writing.longSize of a single frame's region.handle()The underlying GPU buffer handle.longsize()Total buffer size in bytes.
-
Method Details
-
handle
Handle<BufferResource> handle()The underlying GPU buffer handle. -
size
long size()Total buffer size in bytes. -
frameSize
long frameSize()Size of a single frame's region. -
beginWrite
NativeMemory beginWrite()Begins writing for the current frame. Returns aNativeMemorypointing to the current frame's region. The memory is valid untilendWrite()is called. -
endWrite
void endWrite()Finishes writing. The data becomes available to the GPU. -
currentOffset
long currentOffset()Returns the byte offset into the buffer for the current frame's data. Use this for glBindBufferRange offset. -
advance
void advance()Advances to the next frame. Must be called once per frame. -
close
void close()- Specified by:
closein interfaceAutoCloseable
-