-
-
Notifications
You must be signed in to change notification settings - Fork 809
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
Switch to webgpu-rs for rendering backend #14
Comments
Are we set on gfx-rs, or is something like wgpu an option? That's supposed to be web compatible soon, and feels much easier to switch to (and easier to maintain, I hope). Will also be easier to integrate a UI library if we want fancy debugging stuff in the future. |
I've been keeping an eye on wgpu, it's just a question of what is actually usable and actionable in the present. I expect it will be at least a year before WebGPU is solidified and has good browser compatibility. Meanwhile, gfx-rs has a WebGL backend today. That said, I don't see any reason why we can't try both, and then switch from one to the other as things settle. We could even use wgpu for desktop and call WebGL directly on web for now. Our renderer is simple enough that it's easy to experiment. |
My biggest concern is the amount of work (now, and in the future as we bring in more complexity) required. gfx-rs is entirely DIY and wgpu is slightly less so (it's a layer on top of gfx-rs). It also means we can easily bring in UI frameworks without needing to write our own renderer for them. |
Web support was just merged into wgpu. |
@Herschel this issue is assigned to you, are you actively working on it? I'd like to tinker with a wgpu backend for desktop |
I've actually been working on the WebGL side, so if you want to team up and start on the WebGPU side for desktop, that'd be great. I think this is the best path:
I've got a branch where I've pulled out the rendering backends and common tessellation code into subcrates; WebGPU could be another backend under here. I'll push it to my fork this weekend. |
I have a working wgpu backend locally now save for one thing: we can't do the same stencil operations as we do in GL, the stencil data needs to be set at creation of the pipeline and not during actual render-time. GFX seems to support dynamic stencil data but wGPU doesn't. Will investigate further. Good idea on pulling out rendering into another crate. I'll see how to get my stuff and your PR working nicely together! |
For most modern APIs, you can still set at least the stencil reference value at render-time, is that true for webgpu too?
|
I like 3 the most but it looks like copying depth/stencil buffers is prohibited. :( https://github.com/gfx-rs/wgpu/blob/bc065e4/wgpu-core/src/device/mod.rs#L351 If we just use a fresh buffer for each mask group, we'd forget about the parent mask info and start overwriting already reserved pixels. I'm really scared to go with option 1 because that's a lot of pipelines to create, honestly. 513 * 3 (color, gradient, bitmap) sounds so very expensive. I'm positive we can merge the 3 separate draw types into just one later (I have lots of ideas on how to improve our rendering), but still... oof. |
Added in #527. |
I started with glium just to get something up and running quickly, but ideally we'd use gfx-rs for the rendering backend on desktop platforms. wasm support also just landed in gfx-rs thanks to glow, so maybe this backend could also be used on web.
edit 4-25: Instead of gfx-rs, we could use webgpu-rs, which will soon have browser support, and is a better level of abstraction for us.
The text was updated successfully, but these errors were encountered: