java.lang.Object
dev.engine_room.flywheel.backend.engine.indirect.StagingBuffer

public class StagingBuffer extends Object
  • Constructor Details

  • Method Details

    • enqueueCopy

      public void enqueueCopy(long size, int dstVbo, long dstOffset, LongConsumer write)
      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 to flush().
      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 to enqueueCopy(long, int, long, java.util.function.LongConsumer) if this returns null.
      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 null if there is not enough contiguous space.
    • flush

      public void flush()
    • reclaim

      public void reclaim()
    • delete

      public void delete()
    • getScratch

      public MemoryBlock getScratch(long size)