Is it possible to use storage buffers for web apps? #4124
-
Hi, I'm wondering if there is anyway I can use storage buffers for a web application and wgpu code compiled to wasm. I'm sitting on a Macbook Pro M2. My app works fine when I compile to native and metal as backend. But when I compile to wasm and run the app in a browser I get the following error message in the console: "In Device::create_bind_group_layout The backend has defaulted to Gl. Is there anyway at this time I can use storage buffers in a web app? Or do we only have native support for storage buffers at this time? Many thanks for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
WebGL2 doesn't suppe ort storage buffers at all. If you want to use storage buffers on the web, you need to use WebGPU. WebGPU is only supported onh chrome (on windows, mac, and chromeos) currently. To do so, you need to remove the webgl feature from thw wgpu crate. we will then run on top of WebGPU, which does support storage buffers. |
Beta Was this translation helpful? Give feedback.
-
When I remove the "webgl" feature I get a lot of errors such as "
|
Beta Was this translation helpful? Give feedback.
-
This worked! Many thanks for your help and support. |
Beta Was this translation helpful? Give feedback.
You need to activate a
cfg
flag forweb-sys
to export all these types.E.g.
RUSTFLAGS=--cfg=web_sys_unstable_apis
.