What does HackerNews think of wgpu?

Safe and portable GPU abstraction in Rust, implementing WebGPU API.

Language: Rust

#41 in Hacktoberfest
#3 in OpenGL
#32 in Rust
Funnily enough, we've never actually been on WebGL! The runtime's built against wgpu [0], which is an abstraction layer that supports the native rendering APIs, WebGPU, and yes, WebGL.

However, our renderer was built with native capabilities in mind (compute shaders!), so we would have had to rewrite it to support WebGL. We decided we'd keep up with WebGPU and see where it takes us :)

In the future, we may write a fallback renderer that's compatible with WebGL/older GPUs, but we wanted to focus on getting our existing renderer working first.

[0]: https://github.com/gfx-rs/wgpu

Consider learning Rust instead, and use wgpu [1].

[1] https://github.com/gfx-rs/wgpu/

WebGPU can be used outside of the browser through native libraries:

https://github.com/gfx-rs/wgpu

https://dawn.googlesource.com/dawn

(these are the libraries that are used in Firefox and Chrome to provide the WebGPU implementation, don't know if Apple/WebKit also has open-sourced theirs)

Some non-browser WASM runtimes also have WebGPU support already, but unfortunately only for offscreen rendering or compute tasks (e.g. for writing cross-platform windowed apps as WASM blobs, there's a window system glue layer missing).

Gecko engine looks pretty healthy to me overall. And WebGPU in particular is the least of a concern, given that Firefox's implementation is based on wgpu [1], which has great community and a lot of users within and outside of Rust ecosystem. I'm confident Firefox can ship it soon (tm).

[1] https://github.com/gfx-rs/wgpu

are you confusing it with WebGL?

we're talking about https://github.com/gfx-rs/wgpu which has Vulkan, Metal and DX12 backends

If you are just getting into graphics, also consider checking out wgpu https://github.com/gfx-rs/wgpu the Rust implementation of the WebGPU standard.

Conceptually it's the same as Vulkan it's just a lot less pain in the ass to work with.

So far so good!

Putting the UI in a canvas elements have some distinct drawbacks (https://github.com/emilk/egui/tree/master/crates/eframe#prob...) but for us it is definitely worth it. Having one unified codebase for our web app and native app, and having it all in Rust, is just amazing.

We're currently working on a 3D renderer based on wgpu (https://github.com/gfx-rs/wgpu) that we will likewise use for both web and desktop.

> do you think vulkan will progress into being easier and easier to use?

I don't think that is the goal for Vulkan, nor should it be. Vulkan is a low-level, high-performance API that can be used as the backend for high-level, high-performance libraries and frameworks.

> is it mature enough?

Mature enough for what? It's mature and stable enough that you can develop high-level libraries on top of it. wgpu [1], for example, has a Vulkan backend.

[1] wgpu is a WebGPU implementation; https://github.com/gfx-rs/wgpu

I have a few production apps in the GIS/mapping space and I think the big area for growth is a truly cross-platform mapping solution that works across all platforms. Right now Mapbox's (and Maplibre's) options are the closest to this, but web and the two mobile platforms still differ quite a bit, and there's only support for macOS on the desktop.

Maplibre-rs is something to keep an eye on, but it's very much a proof of concept and early going. It's using wgpu (https://github.com/gfx-rs/wgpu), which is a rust-based "implementation" of the WebGPU api, so to speak, which of course would support running via wasm in the browser as well as having support for pretty much all the other platforms.