with-mapped-buffer-array ( ..a buffer access c-type quot: ( ..a array -- ..b ) -- ..b )
GPU-accelerated rendering ยป Buffer objects

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


Vocabulary
gpu.buffers

Inputs
buffera buffer
accessa buffer-access-mode
c-typea C type
quota quotation with stack effect ( ..a array -- ..b )


Outputs
None

Word description
Maps buffer into CPU address space with access for the dynamic extent of quot. quot is called with the pointer to the mapped memory wrapped in a specialized array of c-type.

Notes
The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the specialized-arrays vocabulary for details on the underlying sequence type constructed.

Definition


:: with-mapped-buffer-array
( ..a buffer access c-type quot: ( ..a array -- ..b ) -- ..b )
buffer buffer-size c-type heap-size /i :> len buffer access
[ len c-type <c-direct-array> quot call ] with-mapped-buffer
; inline