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.
§Frame
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
BuiltDisplayList
s. 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.
Re-exports§
pub extern crate api;
pub extern crate euclid;
pub use crate::intern::ItemUid;
pub use api as webrender_api;
pub use crate::render_api::*;
Modules§
- intern
- The interning module provides a generic data structure interning container. It is similar in concept to a traditional string interning container, but it is specialized to the WR thread model.
- render_
api
Macros§
- c_str
- enumerate_
interners - Meta-macro to enumerate the various interner identifiers and types.
Structs§
- Async
Screenshot Handle - A handle to a screenshot that is being asynchronously captured and scaled.
- CpuProfile
- Debug
Flags - Flags to enable/disable various builtin debugging tools.
- Device
- Dirty
Tile Debug Info - Debug information about a tile that was dirty and was rasterized
- Format
Desc - GpuProfile
- Graphics
ApiInfo - Mapped
Tile Info - Information about the underlying data buffer of a mapped tile.
- Native
Surface Id - An arbitrary identifier for a native (OS compositor) surface
- Native
Surface Info - Information about a bound surface that the native compositor returns to WR.
- Native
Tile Id - Picture
Cache Debug Info - Debug information about a set of picture cache slices, exposed via RenderResults
- Pipeline
Info - Primitive
Debug Id - Program
Binary - Program
Cache - Program
Source Digest - Recorded
Frame Handle - A handle to a recorded frame that was captured.
- Render
Results - Return type from render(), which contains some repr(C) statistics as well as some non-repr(C) data.
- Renderer
- The renderer is responsible for submitting to the GPU the work prepared by the RenderBackend.
- Renderer
Options - Renderer
Stats - Some basic statistics about the rendered scene, used in Gecko, as well as in wrench reftests to ensure that tests are batching and/or allocating on render targets as we expect them to.
- SWGL
Composite Surface Info - Descriptor for a locked surface that will be directly composited by SWGL.
- Shader
Precache Flags - Flags that control how shaders are pre-cached, if at all.
- Shaders
- Shared
HitTester - Slice
Debug Info - Debug information about a set of picture cache tiles, exposed via RenderResults
- Texture
Cache Config - Startup parameters for the texture cache.
- Tile
Cache Instance Serializer - A minimal subset of TileCacheInstance for debug capturing
- Tile
Cache Logger Update Lists - Tile
Descriptor - Uniquely describes the content of this tile, in a way that can be (reasonably) efficiently hashed and compared.
- TileId
- A stable ID for a given tile, to help debugging. These are also used as unique identifiers for tile surfaces when using a native compositor.
- Tile
Node - A node in the dirty rect tracking quadtree.
- Tile
Serializer - A minimal subset of Tile for debug capturing
Enums§
- Chase
Primitive - Compare
Helper Result - Optional extra information returned by is_same when logging is enabled.
- Graphics
Api - Invalidation
Reason - Debugging information about why a tile was invalidated
- Primitive
Compare Result - The result of a primitive dependency comparison. Size is a u8 since this is a hot path in the code, and keeping the data small is a performance win.
- Primitive
Compare Result Detail - A more detailed version of PrimitiveCompareResult used when debug logging is enabled.
- Renderer
Error - Tile
Debug Info - Debug information about the state of a tile
- Tile
Node Kind - Details for a node in a quadtree that tracks dirty rects for a tile.
- Upload
Method - Method of uploading texel data from CPU to GPU.
- Vertex
Usage Hint
Constants§
- MAX_
VERTEX_ TEXTURE_ WIDTH - ONE_
TIME_ USAGE_ HINT - Use this hint for all vertex data re-initialization. This allows the driver to better re-use RBOs internally.
Traits§
- Async
Property Sampler - 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.
- Mappable
Compositor - A Compositor variant that supports mapping tiles into CPU memory.
- Partial
Present Compositor - 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.
- Profiler
Hooks - Defines the interface for hooking up an external profiler to WR.
- Program
Cache Observer - The interfaces that an application can implement to handle ProgramCache update
- Scene
Builder Hooks - Allows callers to hook in at certain points of the async scene build. These functions are all called from the scene builder thread.
Functions§
- get_
gl_ target - get_
unoptimized_ shader_ source - set_
profiler_ hooks - Set the profiler callbacks, or None to disable the profiler. This function must only ever be called before any WR instances have been created, or the hooks will not be set.