Crate webrender

source ·
Expand description

A GPU based renderer for the web.

It serves as an experimental render backend for Servo, but it can also be used as such in a standalone application.

§External dependencies

WebRender currently depends on FreeType

§Api Structure

The main entry point to WebRender is the crate::Renderer.

By calling Renderer::new(...) you get a Renderer, as well as a RenderApiSender. Your Renderer is responsible to render the previously processed frames onto the screen.

By calling yourRenderApiSender.create_api(), you’ll get a RenderApi instance, which is responsible for managing resources and documents. A worker thread is used internally to untie the workload from the application thread and therefore be able to make better use of multicore systems.


What is referred to as a frame, is the current geometry on the screen. A new Frame is created by calling set_display_list() on the RenderApi. When the geometry is processed, the application will be informed via a RenderNotifier, a callback which you pass to [Renderer::new]. More information about stacking contexts.

set_display_list() also needs to be supplied with BuiltDisplayLists. These are obtained by finalizing a DisplayListBuilder. These are used to draw your geometry. But it doesn’t only contain trivial geometry, it can also store another StackingContext, as they’re nestable.








  • Allows callers to hook into the main render_backend loop and provide additional frame ops for generate_frame transactions. These functions are all called from the render backend thread.
  • A Compositor variant that supports mapping tiles into CPU memory.
  • Defines an interface to a non-native (application-level) Compositor which handles partial present. This is required if webrender must query the backbuffer’s age. TODO: Use the Compositor trait for native and non-native compositors, and integrate this functionality there.
  • Defines the interface for hooking up an external profiler to WR.
  • The interfaces that an application can implement to handle ProgramCache update
  • Allows callers to hook in at certain points of the async scene build. These functions are all called from the scene builder thread.


Type Aliases§