luma.gl/docs/api-guide/gpu/gpu-buffers.md
2024-02-19 06:11:05 -05:00

19 lines
1.2 KiB
Markdown

# Using GPU Buffers
## Buffer Operations
The ability to copy memory between CPU, buffers and textures
| Dimension | WebGPU | WebGL2 | Description |
| --------------------- | ------ | ------ | ----------------------------------------------------- | |
| `writeBuffer` | ✅ | ✅ | Read a buffer synchronously |
| `readBuffer (sync)` | ❌ | ✅ | Read a buffer synchronously |
| `readBuffer (async)` | ✅ | ❌ \* | Read a buffer asynchronously |
| `copyBufferToBuffer` | ✅ | ✅ | Copy a buffer to another buffer without CPU roundtrip |
| `copyBufferToTexture` | ✅ | ✅ | Copy a buffer to a texture without CPU roundtrip |
| `copyTextureToBuffer` | ✅ | ✅ | Copy a buffer to a texture without CPU roundtrip |
Remarks:
- A WebGL extension does exist that enables asynchronous buffer reads, but it is not implemented on MacOS which is the primary development environment for luma.gl.
- Asynchronous reads are emulated by luma.gl by providing a Promise style API. The actual reads are still asynchronous though.