-
Why does this ṕeace of code work when compiling to native version but not when compiling to wasm? https://github.com/jaankaup/jaankaup-engine/blob/main/jaankaup_core/src/buffer.rs#L61 This web page crashes at the code (line 61) (DOMException: GPUBuffer.getMappedRange: Buffer is not mapped). This is an example of the marching cubes algorithm that seems to work on the latest version of Firefox Nightly (NVidia/win10/ubuntu). It works because I used draw_indirect to get around the map_async and get_mapped_range problem. However, It would be nice to read from buffers to the host program when compiling to wasm. Not only once when calling async function but on every frame update. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Instead you'll need to |
Beta Was this translation helpful? Give feedback.
poll
no-ops on the web (see https://docs.rs/wgpu/latest/wgpu/struct.Device.html#method.poll), so you won't be able to wait/synchronously block on the buffer to be mapped like you can natively.Instead you'll need to
await
map_async
for this to work on the web.