Buffer objects
GPU-accelerated rendering

Prev:GPU state
Next:Texture objects


The gpu.buffers vocabulary provides words for creating, allocating, updating, and reading GPU data buffers.
buffer

<buffer> ( upload: buffer-upload-pattern usage: buffer-usage-pattern kind: buffer-kind size: integer initial-data -- buffer: buffer )

byte-array>buffer ( byte-array upload: buffer-upload-pattern usage: buffer-usage-pattern kind: buffer-kind -- buffer: buffer )


Declaring buffer usage:
buffer-kind

buffer-upload-pattern

buffer-usage-pattern


Referencing buffer data:
buffer-ptr

buffer-range


Manipulating buffer data:
allocate-buffer ( buffer size initial-data -- )

allocate-byte-array ( buffer byte-array -- )

grow-buffer ( buffer: buffer target-size: integer -- )

update-buffer ( buffer-ptr: buffer-ptr size: integer data -- )

read-buffer ( buffer-ptr: buffer-ptr size: integer -- data: byte-array )

copy-buffer ( to-buffer-ptr: buffer-ptr from-buffer-ptr: buffer-ptr size: integer -- )

with-mapped-buffer ( ..a buffer access quot: ( ..a alien -- ..b ) -- ..b )

with-mapped-buffer-array ( ..a buffer access c-type quot: ( ..a array -- ..b ) -- ..b )