Maps readBuffer for CPU access, copies its contents into a new typed array, then unmaps. The .slice() is required — getMappedRange() returns a view into the mapped GPU memory which becomes invalid after unmap(), so we copy it out before unmapping.
readBuffer
.slice()
getMappedRange()
unmap()
a MAP_READ buffer produced by stageReadback
MAP_READ
stageReadback
Optional
typed array constructor for the result
Maps
readBufferfor CPU access, copies its contents into a new typed array, then unmaps. The.slice()is required —getMappedRange()returns a view into the mapped GPU memory which becomes invalid afterunmap(), so we copy it out before unmapping.