Class StagingBuffer
java.lang.Object
dev.engine_room.flywheel.backend.engine.indirect.StagingBuffer
-
Constructor Summary
ConstructorsConstructorDescriptionStagingBuffer(long capacity, IndirectPrograms programs) StagingBuffer(IndirectPrograms programs) -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()voidenqueueCopy(long size, int dstVbo, long dstOffset, LongConsumer write) Enqueue a copy of a known size to the given VBO.voidenqueueCopy(long ptr, long size, int dstVbo, long dstOffset) Enqueue a copy from the given pointer to the given VBO.voidflush()getScratch(long size) voidreclaim()longreserveForCopy(long size, int dstVbo, long dstOffset) Reserve space in this buffer for a transfer to another VBO.
-
Constructor Details
-
StagingBuffer
-
StagingBuffer
-
-
Method Details
-
enqueueCopy
Enqueue a copy of a known size to the given VBO.
The consumer will receive a pointer to a block of memory of the given size, and is expected to write to the complete range. The initial contents of the memory block are undefined.- Parameters:
size- The size in bytes of the copy.dstVbo- The VBO to copy to.dstOffset- The offset in the destination VBO.write- A consumer that will receive a pointer to the memory block.
-
enqueueCopy
public void enqueueCopy(long ptr, long size, int dstVbo, long dstOffset) Enqueue a copy from the given pointer to the given VBO.- Parameters:
ptr- The pointer to copy from.size- The size of the copy.dstVbo- The VBO to copy to.dstOffset- The offset in the destination VBO.
-
reserveForCopy
public long reserveForCopy(long size, int dstVbo, long dstOffset) Reserve space in this buffer for a transfer to another VBO.
You must ensure that your writes are complete before the next call toflush().
This will generally be a more efficient way to transfer data as it avoids a copy, however, this method does not allow for non-contiguous writes, so you should fall back toenqueueCopy(long, int, long, java.util.function.LongConsumer)if this returnsnull.- Parameters:
size- The size of the transfer you wish to make.dstVbo- The VBO you wish to transfer to.dstOffset- The offset in the destination VBO.- Returns:
- A pointer to the reserved space, or
nullif there is not enough contiguous space.
-
flush
public void flush() -
reclaim
public void reclaim() -
delete
public void delete() -
getScratch
-