Skip to content

wgpu-native support #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
braheezy opened this issue Apr 22, 2025 · 0 comments
Open

wgpu-native support #13

braheezy opened this issue Apr 22, 2025 · 0 comments

Comments

@braheezy
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant