luma.gl/docs/api-guide/buffers.md
2023-05-29 07:13:17 -04:00

19 lines
1.3 KiB
Markdown

# Using GPU Buffers
## Buffer Operations
The ability to copy memory between CPU, buffers and textures
| Dimension | WebGPU | WebGL2 | WebGL1 | Description |
| --------------------- | ------ | ------ | ------ | ------------------------------------------------ |
| `writeBuffe` | ✅ | ✅ | ✅ | 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.