Hi there! Another gfx newsletter incoming.

Glenn and Sotaro’s work on integrating WebRender with DirectComposition on Windows is close to being ready. We hope to let it ride the trains for Firefox 75. This will lead to lower GPU usage and energy consumption. Once this is done we plan to follow up with enabling WebRender by default for Windows users with (some subset of) Intel integrated GPUs, which is both challenging (these integrated GPUs are usually slower than discrete GPUs and we have run into a number of driver bugs with them on Windows) and rewarding as it represents a very large part of the user base.

Edit: Thanks to Robert in the comments section of this post for mentioning the Linux/Wayland progress! I copy-pasted it here:

Some additional highlights for the Linux folks: Martin Stránský is making good progress on the Wayland front, especially concerning DMABUF. It will allow better performance for WebGL and hardware decoding for video (eventually). Quoting from https://bugzilla.mozilla.org/show_bug.cgi?id=1586696#c2: > there’s a WIP dmabuf backend patch for WebGL, I see 100% performance boost with it for simple WebGL samples at GL compositor (it’s even faster than chrome/chromium on my box). And there is active work on partial damage to reduce power consumption: https://bugzilla.mozilla.org/show_bug.cgi?id=1484812

What’s new in gfx

Handyman fixed fixed a crash in the async plugin infrastructure.

Botond fixed (2) various data races in the APZ code.

Sean Feng fixed another race condition in APZ code.

Andrew fixed a crash with OMTP and image decoding.

Sotaro fixed a crash with the GL compositor on Wayland.

Botond worked with Facebook developers to resolve a scrolling-related usability problem affecting Firefox users on messenger.com, primarily on MacOS.

Botond fixed (2) divisions by zero various parts of the APZ.

Sean Feng added some telemetry for touch input latency.

Timothy made sure all uses of APZCTreeManager::mGeckoFixedLayerMargins are protected by the proper mutex.

are protected by the proper mutex. Boris Chiou moved animations of transforms with preserve-3d off the main thread

Jamie clamped some scale transforms at 32k to avoid excessively large rasterized areas.

Jonathan Kew reduced the emboldening strength used for synthetic-bold faces with FreeType.

Andrew implemented NEON accelerated methods for unpacking RGB to RGBA/BGRA.

Alex Henrie fixed a bug in Moz2D’s Skia backend.

What’s new in WebRender

WebRender is a GPU based 2D rendering engine for the web written in Rust, currently powering Firefox‘s rendering engine as well as Mozilla’s research web browser servo.

Miko avoided calculating snapped bounds twice for some display items.

Kris fixed snapping and rounding errors causing picture caching invalidation when zoomed in.

Glenn fixed a picture caching invalidation bug.

Kvark ensured shader programs are bound after changing the blend mode. While not necessary for OpenGL, this makes it easier to efficiently implement backends for vulkan and other modern GPU APIs.

Glenn refactored the OS compositor abstraction.

Jamie implemented a texture upload path that plays better with Adreno OpenGL drivers.

Jonathan Kew reduced the emboldening strength used for synthetic-bold faces with FreeType.

Nical prevented invalid glyphs from generating expensive rasterization requests every frame.

Nical reduced the number of memory allocations associated with clip chain stacks.

Nical reduced the number of memory allocations in various parts of the picture caching code.

Glenn fixed a picture caching invalidation issue when scrollbars are disabled.

Glenn and Andrew adjusted tradeoffs between text rendering quality and performance.

Miko simplified some of the scene building code.

Jamie switched to local raster space when animating a double tap zoom to avoid uploading glyphs continuously on Android.

Glenn fixed an intermittent compositor surface creation bug.

Andrew fixed a shader compilation error on some Android devices.

Bert improved the way picture cache tile sizes are selected for scroll bars.

Gankra removed some unsafe code in wrench.

Glenn fixed an issue with picture cache tile merging heuristics.

Glenn fixed tile opacity getting out of sync with compositor surfaces.

Glenn added an API for tagging image descriptors as candidates for native compositor surfaces (typically video frames).

Sotaro followed up by tagging the approriate image descriptors on the content side.

Andrew removed removed pixel snapping from most shaders, now that it is handled earlier in the pipeline.

Glenn improved the invalidation logic for images with picture caching.

Glenn improved the logic to detect identical frames and skip composition.

Glenn fixed the shader implementation of rounded rectangles with very small radii.

Kris fixed misplaced text selection popup with GeckoView.

Markus fixed a ton of issues with WebRender/CoreAnimation integration.

Markus shared the depth buffer between OS compositor tiles on MacOS to save memory.

Sotaro fixed image bitmap canvases with WebRender.

Sotaro fixed a crash at the intersection between picture-in-picture and WebRender frame throttling.

Timothy implemented support for respecting fixed layer margins during hit-testing.

Timothy implemented GeckoView’s setVerticalClipping API for WebRender.

API for WebRender. Jeff fixed an SVG rendering bug.

Jamie fixed an issue where the screen would remain black after resuming Firefox for Android.

To enable WebRender in Firefox, in the about:config page, enable the pref gfx.webrender.all and restart the browser.

WebRender is available under the MPLv2 license as a standalone crate on crates.io (documentation) for use in your own rust projects.

What’s new in Wgpu

Kvark implemented buffer creation and mapping, with an ability to both provide data and read it back from the GPU.

Kvark set up the synchronization from Mozilla Central to Github repository.

jdashg created a separate category for WebGPU mochitests.

Kvark heavily reworked lifetime and usage tracking of resources.

Many fixes and improvements were made by the contributors to wgpu (thank you!)