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

Vocabulary
gpu.buffers

Inputs

buffer a buffer
access a buffer-access-mode
quot a quotation with stack effect ( ..a alien -- ..b )

Outputs
None

Word description
Maps buffer into CPU address space with access for the dynamic extent of quot. quot is called with a pointer to the mapped memory on top of the stack.

See also
allocate-buffer, allocate-byte-array, buffer-size, update-buffer, read-buffer, copy-buffer

Definition

USING: gpu.buffers.private kernel opengl.gl ;

IN: gpu.buffers

:: with-mapped-buffer
( ..a buffer access quot: ( ..a alien -- ..b ) -- ..b )
buffer bind-buffer :> target target access gl-access
glMapBuffer quot call target glUnmapBuffer drop ; inline