Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The mapAsync()
method of the GPUBuffer
interface maps the specified range of the GPUBuffer
. It returns a Promise
that resolves when the GPUBuffer
's content is ready to be accessed. While the GPUBuffer
is mapped it cannot be used in any GPU commands.
Once the buffer is successfully mapped (which can be checked via GPUBuffer.mapState
), calls to GPUBuffer.getMappedRange()
will return an ArrayBuffer
containing the GPUBuffer
's current values, to be read and updated by JavaScript as required.
When you have finished working with the GPUBuffer
values, call GPUBuffer.unmap()
to unmap it, making it accessible to the GPU again.