Interface SsboBuffer

All Superinterfaces:
GlslBuffer
All Known Subinterfaces:
AtomicCounterBuffer
All Known Implementing Classes:
AtomicCounterBufferImpl, SsboBufferImpl

public interface SsboBuffer extends GlslBuffer
Shader Storage Buffer Object (SSBO) buffer, i.e., the GL_SHADER_STORAGE_BUFFER OpenGL target.
  • Method Details

    • getUsage

      int getUsage()
      Returns buffer's usage type
      Returns:
      usage type
    • getItemSize

      long getItemSize()
      SSBO buffers typically store some amount of items of the same type (integers, floats, etc.). This method returns the size (number of bytes) of a single item.
      Returns:
      items' size
    • allocate

      void allocate(long items, boolean reset)
      Allocates memory for this SSBO buffer on GPU. Can be used multiple times to resize the buffer. You can allocate space for unbound buffer and vice versa. Resulting buffer will occupy items * getItemSize() bytes.
      Parameters:
      items - how many items are going to be stored in the buffer
      reset - if true, then the buffer is filled with zeros
    • allocate

      void allocate(long items, long extraSpace, boolean reset)
      Allocates memory for this SSBO buffer on GPU. Can be used multiple times to resize the buffer. You can allocate space for unbound buffer and vice versa. Resulting buffer will occpy items * getItemSize() + extraSpace bytes.
      Parameters:
      items - how many items are going to be stored in the buffer. Can be zero.
      extraSpace - extra space. Can be zero.
      reset - if true, then the buffer is filled with zeros
    • writeItemsTo

      void writeItemsTo(long offset, long numItems, Consumer<ByteBuffer> filler)
      Writes data to the buffer. The size of written data is numItemes * getItemSize(). Buffer must be already allocated and have sufficient size, otherwise GL error is thrown.
      Parameters:
      offset - numItems offset (numItems to be skipped). Can be zero
      numItems - how many numItems we want to write
      filler - filler that writes data to the buffer
    • writeBytesTo

      void writeBytesTo(long offset, long size, Consumer<ByteBuffer> filler)
      Writes data to the buffer. Buffer must be already allocated and have sufficient size, otherwise GL error is thrown.
      Parameters:
      offset - number of bytes to be skipped. Can be zero
      size - how many bytes to write
      filler - filler that writes data to the buffer
    • readFrom

      void readFrom(long offset, long items, Consumer<ByteBuffer> reader)
      Reads data from the buffer. Buffer must be already allocated and have sufficient size, otherwise GL error is thrown.
      Parameters:
      offset - items offset (items to be skipped). Can be zero
      items - how many items we want to read
      reader - reader that reads the data from the buffer