mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 04:31:30 +11:00
b4ffb88494
Previously the generated shader data structures were rooted in backend-specific top-level mods (`mod wgsl`, `mod msl`, etc). This made access to per-shader information that is common to all backends (e.g. workgroup sizes, shader name etc) awkward to access from backend agnostic code, especially when feature-gated conditional compilation is used on the client side. The data structures have been rearranged such that there is a top-level `ComputeShader` declaration for each stage under a `gen` mod. The `ComputeShader` struct declares feature-gated fields for backend shader sources, such that backend specific data is now a leaf node in the structure rather than the root. This has some additional benefits: 1. Common data doesn't have to be redeclared, saving on code size when multiple backends are enabled. 2. The backend specific source code was previously encoded as a `[u8]`. We can now use types that more closely match the expected format, for example `&str` for WGSL and MSL, `[u32]` for SPIR-V, etc. 3. If we ever need to expose additional backend-specific metadata in the future, we can bundle them alongside the source code in a backend-specific data structure at this level of the tree. |
||
---|---|---|
.. | ||
src | ||
build.rs | ||
Cargo.toml | ||
README.md |
The vello_shaders
crate provides a utility library to integrate the Vello shader modules into any
renderer project. The crate provides the necessary metadata to construct the individual compute
pipelines on any GPU API while leaving the responsibility of all API interactions (such as
resource management and command encoding) up to the client.
The shaders can be pre-compiled to any target shading language at build time based on feature flags. Currently only WGSL and Metal Shading Language are supported.