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.13 and Call for Testing

30 Jun 2022

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

  • wgpu is a portable graphics api. It provides safe, accessible, and portable access to the GPU.
  • 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.

After a long gap between releases, we have just rolled out v0.13 of wgpu and v0.9 of naga! See wgpu v0.13 changelog and naga v0.9 changelog for the details and migration guide.

While it’s been a long time between releases, we’ve been hard at work improving both wgpu’s implementation and its user facing experience.

Performance and Correctness

This release we’ve focused on improving both our performance and correctness. One of our biggest bottlenecks, tracking performance, has been significantly improved and is no longer the biggest bottleneck. There are more performance improvements coming in the near future.

There have been many bugs fixed in this release on all backends.

naga Improvements

naga, our shader translator, has improved substantially.

All backends and frontends have gotten even more solidly tested with a truly massive amount of bugs being fixed.

Additionally naga now supports the newest rendition of the wgsl spec, bringing it back inline with other WebGPU projects. See the wgpu changelog for transition details.

Presentation and Pipelining

We have focused some of our attention on improving the interface for surface managment and presentation. Most importantly we now allow a greater set of presentation modes (Mailbox, Fifo, FifoRelaxed, and Immediate) and have removed implicit fallback over explicit “Automatic” modes which have defined fallback paths (AutoVsync and AutoNoVsync). Additionally, surfaces now expose the full set of texture formats that can be used on them, not just their most preferred format. This should be paving the way for HDR and more explicit color space support.

Additionally we have changed BufferSlice::map_async from returning a future that resolves when the mapping is complete to calling a callback when the mapping is complete. We have received a sizable amount of feedback about how hard the futures based api was to use and how easily it leads to deadlocks or very poor performance. The callback based api makes it more clear what is actually happening under the hood and discourages the usage patterns that caused issues.

Call for Testing: DX12

For a variety of performance and stability reasons we are looking at making wgpu’s default backend on windows DX12 instead of vulkan. As part of this push we need people to test their wgpu 0.13 code on the DX12 backend. The easiest way to do this (for testing purposes) is, when you create your instance to pass in DX12 as the only available backend.

let instance = wgpu::Instance::new(wgpu::Backends::DX12);

If you find any inconsistencies, bugs, or crashes with this, please file a bug report!

For more information on this change, please see the tracking issue: #2719.

Release Schedule

We’ve slipped significantly from our original cadence of a release every 3 to 4 months with this release being nearly 7 months after the last release. As part of the effort to make releases less substantial and easier on both us and our users, we’re going to be attempting to follow a stricter 3 month (90 day) release cadence. This way contributors can be sure their changes get released in a timely fashion and release management easier on us.

Thank You!

Thanks to the countless contributors that helped out with this release! wgpu and naga’s momentum is truly incredible due to everyone’s contributions and we look forward to seeing the amazing places wgpu and naga will go. 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!