linebender/vello

GitHub: linebender/vello

Vello 是一款基于 GPU 计算着色器的 Rust 2D 渲染引擎,通过并行化传统顺序渲染流程实现高性能矢量图形绘制。

Stars: 4201 | Forks: 271

## 平台 我们的目标是支持所有能够满足 [默认限制](https://www.w3.org/TR/webgpu/#limits) 的 WebGPU 环境。 我们将这种支持委托给 [`wgpu`] 处理。 其他平台则更为棘手,可能需要特殊的构建/运行流程。 ### Web 由于 Vello 严重依赖计算着色器,我们依赖新兴的 WebGPU 标准在网络上运行。 浏览器对 WebGPU 的支持仍在不断发展中。 Vello 已在正式版 Chrome 中通过测试,但 Firefox 和 Safari 对 WebGPU 的支持仍处于实验阶段。 可能需要使用开发版浏览器并显式启用 WebGPU。 以下命令用于构建并运行 [winit 演示](#winit) 的 Web 版本。 它使用 [`cargo-run-wasm`](https://github.com/rukai/cargo-run-wasm) 为 Web 构建示例,并为其托管一个本地服务器 ``` # 确保 Rust toolchain 支持 wasm32 target rustup target add wasm32-unknown-unknown # 还必须显式提供二进制文件名称,因为它与 package 名称不同 cargo run_wasm -p with_winit --bin with_winit_bin ``` 在支持 WebGPU 的浏览器上,还有[一个可在此处访问的 Web 演示](https://linebender.github.io/vello)。 ### Android [`with_winit`](#winit) 示例支持使用 [cargo apk](https://crates.io/crates/cargo-apk) 在 Android 上运行。 ``` cargo apk run -p with_winit --lib ``` ``` [package.metadata.android.signing.release] path = "$HOME/.android/debug.keystore" keystore_password = "android" ``` 例如(使用 Unix shell 环境变量语法): ``` VELLO_STATIC_LOG="vello=trace" VELLO_STATIC_ARGS="--test-scenes" cargo apk run -p with_winit --lib ``` ## 最低支持的 Rust 版本 (MSRV) 此版本的 Vello 已验证可使用 **Rust 1.88** 及更高版本进行编译。 未来版本的 Vello 可能会提高对 Rust 版本的要求。 这不会被视为破坏性更新,因此甚至可能发生在小型的补丁发布中。
如果编译失败,请单击此处。 随着时间的推移,Vello 的某些依赖项可能发布了具有更高 Rust 要求的版本。 如果你由于依赖项问题遇到编译错误,且不想升级 Rust 工具链,那么你可以降级该依赖项。 ``` # 使用有问题的 dependency 的名称和版本 cargo update -p package_name --precise 0.1.1 ```
## 历史 Vello 前身名为 `piet-gpu`。 早期版本使用了自定义的跨 API 硬件抽象层(称为 `piet-gpu-hal`),而不是 [`wgpu`]。 该版本的归档可在 [`custom-hal-archive-with-shaders`] 和 [`custom-hal-archive`] 分支中找到。 它继承了之前的原型 [piet-metal],并包含了改编自 [piet-dx12] 的工作。 放弃 `piet-gpu-hal` 转而支持 WebGPU 的决定,在博客文章 [Requiem for piet-gpu-hal] 中有详细讨论。 一份日期为 2020 年 12 月的[愿景](https://github.com/linebender/vello/tree/main/doc/vision.md)文档解释了该项目的长期目标,以及我们可能如何实现这些目标。 其中许多项目已经过时或已完成,但它仍然可能提供一些有用的背景信息。 ## 相关项目 Vello 从许多其他渲染项目中汲取了灵感,包括: - [Pathfinder](https://github.com/servo/pathfinder) - [Spinel](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/) - [Forma](https://github.com/google/forma) - [大规模并行矢量图形](https://w3.impa.br/~diego/projects/GanEtAl14/) - [通用矢量图形的随机访问渲染](https://hhoppe.com/proj/ravg/) ## 许可证 根据以下任一许可证授权: - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) 或 ) - MIT license ([LICENSE-MIT](LICENSE-MIT) 或 ) 由你选择。 此外,[`vello_shaders/shader`](https://github.com/linebender/vello/tree/main/vello_shaders/shader) 和 [`vello_shaders/src/cpu`](https://github.com/linebender/vello/tree/main/vello_shaders/src/cpu) 目录及其子目录中的所有文件,作为备选方案,均采用 Unlicense ([vello_shaders/shader/UNLICENSE](https://github.com/linebender/vello/tree/main/vello_shaders/shader/UNLICENSE) 或 ) 进行授权。 为明确起见,这些文件同样也受上述任一许可证的授权。 这样做的目的是为了让这项研究能够在尽可能广泛的场景中被使用。 [`examples/assets`](https://github.com/linebender/vello/tree/main/examples/assets) 目录的子目录中的文件仅受其各自的许可证授权,具体请参阅它们目录中的 `LICENSE` 文件。
标签:2D渲染, GPU计算, Rust, 信息收集, 可视化界面, 图形引擎, 图形渲染, 矢量图形, 网络流量审计, 通知系统