vello_hybrid: Allow binding multiple external textures per draw call (#1858)

This PR adds support for binding up to 4 external textures in a single
draw call. This is achieved by simply making use of more shader slots
(which WebGL2 guarantees to support at least 16, so we are still well
below the limit) and changing the CPU batching algorithm to support
multiple external images in a single pass. This reduces the number of
draw calls emitted, but does make the shader more branchy. Once we move
to specialized shaders, we should carefully re-evaluate whether the
branching makes image rendering slower, but for our current uber shader
it does not seem to make a difference. And our previous experiments have
shown that the CPU-side overhead of draw calls can also be considerable,
so in this regard this PR is an improvement.

The main motivation for this PR however is to enable the follow-up PR
that removes 2D texure arrays to keep the draw count minimal.
5 files changed
tree: 1e9182e673eaab4aaabe7f61c8f0a14fe4ce93fd
  1. .cargo/
  2. .github/
  3. .vscode/
  4. doc/
  5. examples/
  6. glifo/
  7. sparse_strips/
  8. vello/
  9. vello_encoding/
  10. vello_shaders/
  11. vello_tests/
  12. xtask/
  13. .clippy.toml
  14. .gitattributes
  15. .gitignore
  16. .taplo.toml
  17. .typos.toml
  18. AUTHORS
  19. Cargo.lock
  20. Cargo.toml
  21. CHANGELOG.md
  22. LICENSE-APACHE
  23. LICENSE-MIT
  24. README.md
  25. rustfmt.toml
README.md

Vello

A GPU compute-centric 2D renderer

Linebender Zulip dependency status Apache 2.0 or MIT license. wgpu version

Crates.io Docs Build status

The Vello project is a set of high-performance vector renderers written in Rust:

  • Vello is an experimental renderer with a focus on doing as much work as possible with GPU compute.
  • Vello CPU is a pure Rust, CPU-only renderer optimized for multithreading and SIMD.
  • Vello Hybrid is a renderer that does heavy pre-processing on the CPU but still does most of the work on the GPU. It aims to be the main Vello implementation for production use-cases.

Quickstart to run an example program:

cargo run -p with_winit

image

Significant changes are documented in the changelog.

Motivation

Vello is meant to fill the same place in the graphics stack as other vector graphics renderers like Skia, Cairo, and its predecessor project Piet. On a basic level, that means it provides tools to render shapes, images, gradients, text, etc, using a PostScript-inspired API, the same that powers SVG files and the browser <canvas> element.

The selling point of Vello's implementations is that they get better performance than other renderers by better leveraging the SIMD, multithreading and the GPU.

Minimum supported Rust Version (MSRV)

This version of Vello has been verified to compile with Rust 1.89 and later.

Future versions of Vello might increase the Rust version requirement. It will not be treated as a breaking change and as such can even happen with small patch releases.

As time has passed, some of Vello‘s dependencies could have released versions with a higher Rust requirement. If you encounter a compilation issue due to a dependency and don’t want to upgrade your Rust toolchain, then you could downgrade the dependency.

# Use the problematic dependency's name and version
cargo update -p package_name --precise 0.1.1

Community

Discussion of Vello development happens in the Linebender Zulip, specifically the #vello channel. All public content can be read without logging in.

Contributions are welcome by pull request. The Rust code of conduct applies.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache 2.0 license, shall be licensed as noted in the License section, without any additional terms or conditions.

License

Licensed under either of

at your option.

In addition, all files in the vello_shaders/shader and vello_shaders/src/cpu directories and subdirectories thereof are alternatively licensed under the Unlicense (vello_shaders/shader/UNLICENSE or http://unlicense.org/). For clarity, these files are also licensed under either of the above licenses. The intent is for this research to be used in as broad a context as possible.

The files in subdirectories of the examples/assets directory are licensed solely under their respective licenses, available in the LICENSE file in their directories.