gfx-rs nuts and bolts

gfx-rs is a project bringing efficient cross-platform graphics to rust. This blog supposedly hosts the major milestones, concepts, and recaps of the project.


Release of wgpu v0.11 and naga v0.7

07 Oct 2021

gfx-rs community’s goal is to make graphics programming in Rust easy, fast, and reliable. Our main projects are:

  • wgpu is built on top of wgpu-hal and naga. It provides safety, accessibility, and portability for graphics applications.
  • naga translates shader programs between languages, including WGSL. It also provides shader validation and transformation, ensuring user code running on the GPU is safe and efficient.

Following our release cadence of every few months, we rolled out v0.11 through all of the gfx-rs projects! See wgpu v0.11 changelog and naga v0.7 changelog for the details.

This is our second release using our pure rust graphics stack. We’ve made a significant progress with shader translation and squashed many bugs in both wgpu and the underlying abstraction layer.

WebGL2

Thanks to the help of @Zicklag for spearheading the work on the WebGL2 backend. Through modifying the use of our OpenGL ES backend, they got WebGL2 working on the web. The backend is still in beta, so please test it out and file bugs! See the guide to running on the web for more information.

The following shows one of Bevy’s PBR examples running on the web.

bevy running on webgl2

Explicit Presentation

A long standing point of confusion when using wgpu was that dropping the surface frame caused presentation. This was confusing and often happened implicitly. With this new version, presentation is now marked explicitly by calling frame.present(). This makes very clear where the important action of presentation takes place.

More Robust Shader Translation

naga has made progress on all frontends and backends.

The most notable change was that @JCapucho, with the help of @jimb, completely rewrote the parsing of spirv’s control flow. spirv has notably complex control flow which has a large number of complicated edge cases. After multiple reworks, we have settled on this new style of control flow graph parsing. If you input spirv into wgpu, this will mean that even more spirv, especially optimized spirv, will properly validate and convert.

See the changelog for all the other awesome editions to naga.

Thank You!

Thanks to the countless contributors that helped out with this release! wgpu and naga’s momentum is truely incredible due to everyone’s contributions and we look forward to seeing the amazing places wgpu and naga will go as projects. If you are interested in helping, take a look at our good-first-issues, our issues with help wanted, or contact us on our matrix chat, we are always willing to help mentor first time and returning contributors.

Additionally, thank you to all the users who report new issues, ask for enhancements, or test the git version of wgpu. Keep it coming!

Happy rendering!