Description
Hello! I recently learned webgpu and used zgpu
as my bridge to webgpu. I noticed it all sits on a precompiled version of Dawn from years ago and started looking into what it takes to get an updated version.
After lots of research I found https://github.com/bronter/wgpu_native_zig that provides binding to wgpu-native instead of Dawn. I was able to get zgpu
working with the wgpu bindings provided in that project and that got me to thinking if it's possible to support both Dawn and wgpu as backends.
This project lets people in C++ land uses both Dawn or wgpu, statically link or dynamic, and for Dawn, from source or pre-compiled. This seems like the best of all worlds and maybe Zigland could have these capabilities too.
I have a fork here where I add support for wgpu as a backend: https://github.com/braheezy/zgpu
It doesn't quite work, after a few frames I get a crash in submit()
thread '<unnamed>' panicked at src/lib.rs:586:5:
Error in wgpuQueueSubmit: Validation Error
Caused by:
Buffer Id(5,1,mtl) is still mapped
I've isolated the behavior to the uniform staging buffers and the mapAsync
happening there. This is where I got stuck and not understanding webgpu enough or nuanced differences between Dawn and wgpu implementations and how they approach mapping buffers. I tried various versions of wgpu_native and they crashed earlier. If I rewrite things to not use the efficient staging uniforms approach, I can get things to render.
I was going to call it quits here and throw out the work, but I figured I'd reach out to see if you:
- had any interest in extending
zgpu
to support wgpu and Dawn, or know roadblocks that prevent it - knew what was causing this issue or how I might get around it