gfx-rs / wgpu-rs

Rust bindings to wgpu native library
https://wgpu.rs
Mozilla Public License 2.0
1.68k stars 186 forks source link

Is this API capable of AAA graphics? #419

Closed MarioSieg closed 4 years ago

MarioSieg commented 4 years ago

Hey I'm the lead engine and graphics programmer from a small gamedev studio. We are recreating our engine in Rust (used C++ with bgfx before) and I just wanted to know if there are any overheads for the web support. We are not interested in web support only for desktop. Also we need a library with LTS and a good community. I know that AAA graphics are mady by good shaders, models and algorithms BUT I'm scared that the web-stuff already slows it down since it's made for web were gpu power is limited.

Best Regards, Mario

kvark commented 4 years ago

Hi Mario, thank you for reaching out!

I believe WebGPU makes a lot of sense on native-only, regardless of the Web, and I expressed this PoV in detail at http://kvark.github.io/web/gpu/native/2020/05/03/point-of-webgpu-native.html . Many users (seen on #wgpu:matrix.org) only care about the native, including @cwfitzgerald who recently implemented a number of interesting native-only extensions.

We don't know exactly what the overhead is, just yet. There are strong engineers in WebGPU community group, so we have an idea of what to expect (noticeable but small CPU overhead), but we don't have the numbers yet. We are working on integrating CPU tracing into wgpu-core as well as exposing GPU timing for things like wgpu-bench, which will shed more light on the overhead.

Finally, the community here is wonderful, and in terms of LTS we are shipping wgpu-core inside Firefox (for implementing WebGPU), so we are aiming for this code base to perform well and live long.

cwfitzgerald commented 4 years ago

(I am a wgpu user who liked it enough to start working on wgpu)

I think that if you need something on the level of bgfx, this is exactly the thing to reach for. We provide a cross-platform, safe api to the various modern graphics apis. I fully expect that the overhead doesn't significantly exceed something like bgfx. All the overhead comes from either converting to the underlying api (adding barriers and such) or from validating the inputs we are given, there is no overhead that is directly caused by it being also used on the web. You can think of wgpu as a safe api wrapper that happens to be used for the implementation of webgpu on the web.

As @kvark mentioned, I exclusively use wgpu targeting native, using higher end desktop hardware. The extensions I've worked on allow me to use some of the newest rendering techniques which reduce cpu usage enough that any wgpu overhead is basically irrelevant. Even without those techniques, I have not noticed any significant overhead that caused me to ever question my decision to go with wgpu.

I'd love to discuss my experiences with wgpu more at length on our matrix, as well as address any additional concerns you have. We're a quite friendly crowd, so come say hi some day 😄

MarioSieg commented 4 years ago

Hello, thanks for your comments! Alright that sounds like this library is exactly what I've been looking for! Here I can again feel the wonderful Rust community :) I will now use wgpu-rs in our engine and once I've learned it I would love to contribute and help (I could create some examples for example). And that it does not have any big overhead sounds nice! Of course there is some by translating to native graphics backends as you said, but I expected that. I was just a little confused by the name - I wasn't sure if it's maybe just a library for web rendering supporting desktop just for fun.

PS: Yes I will come and say hi ^^

Best Regards, Mario

kvark commented 4 years ago

Alright, sounds like we can close this and continue on the Matrix :)