Expand description
A GPU renderer for 2D vector graphics with CPU-side preprocessing.
Vello GPU uses the Sparse Strips architecture to divide work between CPU preprocessing and GPU rendering:
- The CPU processes paths, tiles, and schedules sparse strips.
- The GPU rasterizes those strips and performs compositing.
- The compact strip representation limits data transfer between them.
§Key Features
- Efficient path rendering with CPU-side processing
- GPU-accelerated compositing and blending
- Support for both windowed and headless rendering
§Feature Flags
wgpu(enabled by default): Enables the GPU rendering backend via wgpu and includes the required Vello GPU shaders.wgpu_default(enabled by default): Enables wgpu with its default hardware backends (such as Vulkan, Metal, and DX12).text(enabled by default): Enables glyph rendering (Scene::glyph_run).webgl: Enables the WebGL rendering backend for browser support, using GLSL shaders for compatibility.
If you need to customize the set of enabled wgpu features, disable this crate’s
default features then enable its wgpu feature. You can then depend on wgpu
directly, setting the specific features you require. Don’t forget to also
disable wgpu’s default features.
§Architecture
The renderer is split into several key components:
Scene: Manages the render context and path processing on the CPURendererorWebGlRenderer: Handles GPU resource management and executes draw operations
See the individual module documentation for more details on usage and implementation.
§Current state
Vello GPU is a solid GPU-accelerated 2D renderer with broad, reliable feature
support. Although it does not match the compute-centric vello renderer’s raw
performance on dynamic and vector-heavy workloads, it provides excellent
performance on workloads that benefit from GPU acceleration, such as images,
gradients, and filters. Overall, we still consider it to be slightly less mature
than its CPU-only counterpart Vello CPU.
Vello GPU remains under active development. Known limitations include:
- The following features are not yet supported and will panic: Mask layers, complex filter graphs as well as certain blend modes for non-isolated blending.
- Parts of the API and its documentation are still suboptimal, for example the
lifecycle and ownership of external resources through
Resources. - Some exposed features remain experimental and are not recommended for use, including glyph caching. Experimental APIs are identified in their method documentation.
- Parts of the rendering pipeline are not yet fully optimized, particularly the wgpu backend, but also other aspects.
- Some failures panic instead of being reported through a user-facing error.
With that said, we are continuously improving Vello GPU and will address these and other limitations in future releases.
§Package rename
This package was previously named vello_hybrid. New dependencies and Rust
imports should use vello_gpu; no compatibility re-export package is provided
in this repository. Existing crates.io releases under vello_hybrid remain
available, and publication under the new name may lag behind the repository
rename.
Re-exports§
pub use text::GlyphRunBuilder;pub use util::DimensionConstraints;
Modules§
- filter_
effects - Filter effects API based on the W3C Filter Effects specification.
- geometry
- Geometry utilities.
- peniko
- A Rust 2D graphics type library
- util
- A number of utility helper methods.
Structs§
- Atlas
Config - Configuration for multiple atlas support.
- AtlasId
- Unique identifier for an atlas.
- Atlas
Layer Diagnostics - Free-space details for one atlas texture-array layer.
- Atlas
Texture Info - Current allocation state of the WebGL image/glyph atlas textures.
- Cell
Statistics - Summary of the differences between one expected and actual probe cell.
- Config
- Configuration for the GPU renderer.
- GpuStrip
- A GPU strip instance for rendering.
- ImageId
- Opaque image handle
- Layers
Config - Configuration for temporary textures used to render layers and effects.
- Mask
- A mask.
- Memory
Settings - Settings controlling usage of GPU memory.
- Pixel
Metadata - Metadata about the pixels of an image.
- Pixmap
- A pixmap of premultiplied RGBA8 values backed by
u8. - Probe
Result - Probe failure output.
- RectU16
- An axis-aligned rectangle with
u16coordinates, stored as two corners(x0, y0)and(x1, y1). - Render
Settings - Settings to apply to the render context.
- Render
Size - Dimensions of the rendering target.
- Render
State - A render state which contains the style properties for path rendering.
- Render
Target Config - Options for the renderer
- Renderer
- Vello GPU’s renderer.
- Resources
- Persistent resources required by Vello GPU for rendering.
- Scene
- A render context for GPU rendering.
- SizeU16
- A size represented by two 16-bit unsigned integers.
- Texture
Bindings - Runtime bindings for externally owned textures sampled by image paints.
- Texture
Id - A handle to an external, user-provided texture.
- Tint
- A tint applied to image paints.
- Transforms
- Context for holding transforms for paths and paints.
- WebGl
Pending Probe - A WebGL probe whose pixel readback has been queued but not completed.
- WebGl
Renderer - Vello GPU’s WebGL2 renderer.
- WebGl
Renderer Init - WebGL renderer initialization that may still be compiling shader programs.
- WebGl
Texture Bindings - Runtime bindings for externally owned textures sampled by image paints.
- WebGl
Texture With Dimensions - Wrapper for
WebGlTexturewith known dimensions.
Enums§
- Allocation
Strategy - Strategy for allocating images across multiple atlases.
- Atlas
Error - Errors that can occur during atlas operations.
- Atlas
Space Diagnostics - Free-space details collected after an atlas allocation fails.
- Clear
Settings - Controls how the output target is cleared before drawing.
- Image
Source - Bitmap source used by
Image. - Incompatible
Context Reason - Reasons a WebGL context can be incompatible with the renderer.
- Intermediate
Texture Error - Errors that can occur while allocating intermediate textures.
- Level
- The level enum with the specific SIMD capabilities available.
- Pixels
- The result of attempting to extract RGB8 data from a
Pixmap. - Probe
- Result of running the renderer probe.
- Probe
Feature - A feature exercised by the renderer probe.
- Render
Error - Errors that can occur during rendering.
- Tint
Mode - How tint color is applied to an image.
- WebGl
Context Operation - WebGL context operations.
- WebGl
Data Transfer Operation - WebGL data-transfer operations.
- WebGl
Error - Errors produced by the WebGL backend.
- WebGl
Operation - A fallible operation performed by the WebGL backend.
- WebGl
Probe Error - Error returned while running a WebGL probe.
- WebGl
Probe Operation - WebGL renderer probe operations.
- WebGl
Probe Status - Result of polling the WebGL probe.
- WebGl
Renderer Init Status - Result of polling WebGL renderer initialization.
- WebGl
Resource Kind - Kinds of WebGL resources.
- WebGl
Shader Interface Operation - Shader interface operations.
- WebGl
Shader Program Operation - Shader compilation and program linking operations.
- WebGl
Shader Stage - WebGL shader stages.
Constants§
- ALL_
PROBE_ ELEMENTS - All elements available for use in a probe.
Traits§
- Atlas
Writer - Trait for types that can write image data directly to the atlas texture.
- WebGl
Atlas Writer - Trait for types that can write image data directly to the atlas texture in WebGL.
Type Aliases§
- Glyph
RunBuilder - A glyph run builder.
- Image
- An image.
- Paint
Type - A kind of paint that can be used for filling and stroking shapes.
- Target
Init - Controls whether existing target contents are preserved or cleared before drawing.