(not a tutorial for the innards, just the environment)
If you need help or have questions about any of this, please ask on #servo
on irc.mozilla.org
.
WebRender is written in the Rust programming language. There are a number of great resources for learning Rust, but you probably want to start with "The Book" and perhaps work through Rust by Example.
This document assumes that you have your preferred way of cloning git
repositories from github
, and that you have your platform's native compiler toolchain installed (e.g., Visual Studio 2015 on Windows).
First, obtain a current Rust setup. Use rustup.rs to get this going on all platforms.
- Visit rustup.rs to obtain step 1 for your platform.
- Install the nightly toolchain:
rustup toolchain install nightly-msvc
- Install the std lib sources (to make debugging much nicer):
rustup component add rust-src
- Make the nightly toolchain the default:
rustup default nightly-msvc
- To update the toolchain in the future:
rustup update
If you prefer to develop using Visual Studio, check out the Visual Rust extension, or nightly versions from their github project.
Visual Studio Code also provides a great development environment (without debugger); check out the Rusty Code extension. (Newer versions of Rusty Code than what might be in the marketplace are likely going to give a better experience. Ask for help if you'd like to try these out.)
Finally, check out the WebRender sources from https://github.com/servo/webrender
. Use whichever git
your prefer (Visual Studio, VS Code, GitHub Desktop client, command line git, etc.).
This step can be done through the various IDEs, but I'll show the command line steps because they are cross-platform. Inside the webrender
checkout, there are a few subdirectories representing different components:
webrender
-- the core rendering backend targetting OpenGLwebrender_traits
-- the "front end" that decouples the backend from applications that use WebRenderwrench
-- a debugging and testing tool, with frame recording and replay capabilities (among others)sample
-- a sample program that uses WebRender to display content
Build and run the sample:
cd webrender/sample
cargo build
cargo run
-- note, the actual generated binary will be in../target/debug/wr-sample[.exe]
. You can run that directly as well.
Build and run wrench
, this time in release mode:
cd webrender/wrench
cargo build --release
cargo run --release -- show res/test.yaml
- While running, press
h
to show onscreen help; e.g.,p
to toggle the profiler display. - There are many more options; try
cargo run -- --help
(or../target/release/wrench --help
). One day soon there will be awrench/README.md
.
Some documentation for WebRender is available.
In general, after making changes, just cargo build
again, or cargo run
if using cargo to run (it'll rebuild if necessary).
To hack on WebRender by itself, you'll likely want to obtain a number of traces for replay via wrench
. These can be built by someone else and sent to you, or you can create some yourself (if Servo can properly lay out the content) by building Servo and then running with the -Z wr-record
flag to create a binary recording. That binary recording can then be replayed using wrench
.
Issues, pull requests, etc. are all handled via github, using the normal mechanisms.