4 releases (breaking)

0.61.0 Jan 15, 2020
0.60.0 Feb 18, 2019
0.58.0 Jan 3, 2019
0.57.2 Aug 14, 2018

#36 in Rendering engine

Download history 44/week @ 2024-02-12 7/week @ 2024-02-19 26/week @ 2024-02-26 9/week @ 2024-03-04 13/week @ 2024-03-11 18/week @ 2024-03-18

69 downloads per month
Used in 2 crates (via webrender)

MPL-2.0 license

265KB
5.5K SLoC

WebRender

Version

WebRender is a GPU-based 2D rendering engine written in Rust. Firefox, the research web browser Servo, and other GUI frameworks draw with it. It currently uses the OpenGL API internally.

Note that the canonical home for this code is in gfx/wr folder of the mozilla-central repository at https://hg.mozilla.org/mozilla-central. The Github repository at https://github.com/servo/webrender should be considered a downstream mirror, although it contains additional metadata (such as Github wiki pages) that do not exist in mozilla-central. Pull requests against the Github repository are still being accepted, although once reviewed, they will be landed on mozilla-central first and then mirrored back. If you are familiar with the mozilla-central contribution workflow, filing bugs in Bugzilla and submitting patches there would be preferred.

Update as a Dependency

After updating shaders in WebRender, go to servo and:

  • Go to the servo directory and do ./mach update-cargo -p webrender
  • Create a pull request to servo

Use WebRender with Servo

To use a local copy of WebRender with servo, go to your servo build directory and:

  • Edit Cargo.toml
  • Add at the end of the file:
[patch."https://github.com/servo/webrender"]
"webrender" = { path = "<path>/webrender" }
"webrender_api" = { path = "<path>/webrender_api" }

where <path> is the path to your local copy of WebRender.

  • Build as normal

Documentation

The Wiki has a few pages describing the internals and conventions of WebRender.

Testing

Tests run using OSMesa to get consistent rendering across platforms.

Still there may be differences depending on font libraries on your system, for example.

See this gist for how to make the text tests useful in Fedora, for example.


lib.rs:

The webrender_api crate contains an assortment types and functions used by WebRender consumers as well as, in many cases, WebRender itself.

This separation allows Servo to parallelize compilation across webrender and other crates that depend on webrender_api. So in practice, we put things in this crate when Servo needs to use them. Firefox depends on the webrender crate directly, and so this distinction is not really relevant there.

Dependencies

~3–14MB
~177K SLoC