9d12a0a122
Bumps the patch-updates group with 24 updates in the / directory: | Package | From | To | | --- | --- | --- | | [bit-vec](https://github.com/contain-rs/bit-vec) | `0.6.3` | `0.7.0` | | [bitflags](https://github.com/bitflags/bitflags) | `2.5.0` | `2.6.0` | | [bytemuck](https://github.com/Lokathor/bytemuck) | `1.16.0` | `1.16.1` | | [libloading](https://github.com/nagisa/rust_libloading) | `0.8.3` | `0.8.4` | | [log](https://github.com/rust-lang/log) | `0.4.21` | `0.4.22` | | [serde_json](https://github.com/serde-rs/json) | `1.0.117` | `1.0.119` | | [bit-set](https://github.com/contain-rs/bit-set) | `0.5.3` | `0.6.0` | | [syn](https://github.com/dtolnay/syn) | `2.0.66` | `2.0.68` | | [ab_glyph](https://github.com/alexheretic/ab-glyph) | `0.2.26` | `0.2.27` | | [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.72` | `0.3.73` | | [cc](https://github.com/rust-lang/cc-rs) | `1.0.99` | `1.0.103` | | [clap](https://github.com/clap-rs/clap) | `4.5.6` | `4.5.8` | | [deno_unsync](https://github.com/denoland/deno_unsync) | `0.3.4` | `0.3.5` | | [derive_more](https://github.com/JelteF/derive_more) | `0.99.17` | `0.99.18` | | [either](https://github.com/rayon-rs/either) | `1.12.0` | `1.13.0` | | [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) | `1.4.0` | `1.5.0` | | [memchr](https://github.com/BurntSushi/memchr) | `2.7.2` | `2.7.4` | | [miniz_oxide](https://github.com/Frommi/miniz_oxide) | `0.7.3` | `0.7.4` | | [num-bigint](https://github.com/rust-num/num-bigint) | `0.4.5` | `0.4.6` | | [polling](https://github.com/smol-rs/polling) | `3.7.1` | `3.7.2` | | [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.85` | `1.0.86` | | [tinyvec](https://github.com/Lokathor/tinyvec) | `1.6.0` | `1.6.1` | | [url](https://github.com/servo/rust-url) | `2.5.0` | `2.5.2` | | [uuid](https://github.com/uuid-rs/uuid) | `1.8.0` | `1.9.1` | Updates `bit-vec` from 0.6.3 to 0.7.0 - [Commits](https://github.com/contain-rs/bit-vec/commits) Updates `bitflags` from 2.5.0 to 2.6.0 - [Release notes](https://github.com/bitflags/bitflags/releases) - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md) - [Commits](https://github.com/bitflags/bitflags/compare/2.5.0...2.6.0) Updates `bytemuck` from 1.16.0 to 1.16.1 - [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md) - [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.0...v1.16.1) Updates `libloading` from 0.8.3 to 0.8.4 - [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.3...0.8.4) Updates `log` from 0.4.21 to 0.4.22 - [Release notes](https://github.com/rust-lang/log/releases) - [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/log/compare/0.4.21...0.4.22) Updates `serde_json` from 1.0.117 to 1.0.119 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.117...v1.0.119) Updates `bit-set` from 0.5.3 to 0.6.0 - [Release notes](https://github.com/contain-rs/bit-set/releases) - [Commits](https://github.com/contain-rs/bit-set/commits) Updates `syn` from 2.0.66 to 2.0.68 - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.66...2.0.68) Updates `ab_glyph` from 0.2.26 to 0.2.27 - [Release notes](https://github.com/alexheretic/ab-glyph/releases) - [Commits](https://github.com/alexheretic/ab-glyph/compare/ab-glyph-0.2.26...ab-glyph-0.2.27) Updates `backtrace` from 0.3.72 to 0.3.73 - [Release notes](https://github.com/rust-lang/backtrace-rs/releases) - [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.72...0.3.73) Updates `cc` from 1.0.99 to 1.0.103 - [Release notes](https://github.com/rust-lang/cc-rs/releases) - [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.99...cc-v1.0.103) Updates `clap` from 4.5.6 to 4.5.8 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.6...v4.5.8) Updates `clap_builder` from 4.5.6 to 4.5.8 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.5.6...v4.5.8) Updates `clap_derive` from 4.5.5 to 4.5.8 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.5.5...v4.5.8) Updates `deno_unsync` from 0.3.4 to 0.3.5 - [Commits](https://github.com/denoland/deno_unsync/commits) Updates `derive_more` from 0.99.17 to 0.99.18 - [Release notes](https://github.com/JelteF/derive_more/releases) - [Changelog](https://github.com/JelteF/derive_more/blob/v0.99.18/CHANGELOG.md) - [Commits](https://github.com/JelteF/derive_more/compare/v0.99.17...v0.99.18) Updates `either` from 1.12.0 to 1.13.0 - [Commits](https://github.com/rayon-rs/either/compare/1.12.0...1.13.0) Updates `lazy_static` from 1.4.0 to 1.5.0 - [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases) - [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.4.0...1.5.0) Updates `memchr` from 2.7.2 to 2.7.4 - [Commits](https://github.com/BurntSushi/memchr/compare/2.7.2...2.7.4) Updates `miniz_oxide` from 0.7.3 to 0.7.4 - [Changelog](https://github.com/Frommi/miniz_oxide/blob/master/CHANGELOG.md) - [Commits](https://github.com/Frommi/miniz_oxide/commits) Updates `num-bigint` from 0.4.5 to 0.4.6 - [Changelog](https://github.com/rust-num/num-bigint/blob/master/RELEASES.md) - [Commits](https://github.com/rust-num/num-bigint/compare/num-bigint-0.4.5...num-bigint-0.4.6) Updates `object` from 0.35.0 to 0.36.1 - [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md) - [Commits](https://github.com/gimli-rs/object/compare/0.35.0...0.36.1) Updates `polling` from 3.7.1 to 3.7.2 - [Release notes](https://github.com/smol-rs/polling/releases) - [Changelog](https://github.com/smol-rs/polling/blob/master/CHANGELOG.md) - [Commits](https://github.com/smol-rs/polling/compare/v3.7.1...v3.7.2) Updates `proc-macro2` from 1.0.85 to 1.0.86 - [Release notes](https://github.com/dtolnay/proc-macro2/releases) - [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.85...1.0.86) Updates `tinyvec` from 1.6.0 to 1.6.1 - [Changelog](https://github.com/Lokathor/tinyvec/blob/main/CHANGELOG.md) - [Commits](https://github.com/Lokathor/tinyvec/compare/v1.6.0...v1.6.1) Updates `url` from 2.5.0 to 2.5.2 - [Release notes](https://github.com/servo/rust-url/releases) - [Commits](https://github.com/servo/rust-url/compare/v2.5.0...v2.5.2) Updates `uuid` from 1.8.0 to 1.9.1 - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](https://github.com/uuid-rs/uuid/compare/1.8.0...1.9.1) --- updated-dependencies: - dependency-name: bit-vec dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: bitflags dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: bytemuck dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: libloading dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: log dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: bit-set dependency-type: direct:production update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: ab_glyph dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: backtrace dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: cc dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: clap dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: clap_builder dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: clap_derive dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: deno_unsync dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: derive_more dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: either dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: lazy_static dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: memchr dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: miniz_oxide dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: num-bigint dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: object dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates - dependency-name: polling dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: proc-macro2 dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: tinyvec dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: url dependency-type: indirect update-type: version-update:semver-patch dependency-group: patch-updates - dependency-name: uuid dependency-type: indirect update-type: version-update:semver-minor dependency-group: patch-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
.cargo | ||
fuzz | ||
hlsl-snapshots | ||
src | ||
tests | ||
xtask | ||
.gitattributes | ||
.gitignore | ||
Cargo.toml | ||
CHANGELOG.md | ||
README.md |
Naga
The shader translation library for the needs of wgpu.
Supported end-points
Front-end | Status | Feature | Notes |
---|---|---|---|
SPIR-V (binary) | ✅ | spv-in | |
WGSL | ✅ | wgsl-in | Fully validated |
GLSL | 🆗 | glsl-in | GLSL 440+ and Vulkan semantics only |
Back-end | Status | Feature | Notes |
---|---|---|---|
SPIR-V | ✅ | spv-out | |
WGSL | 🆗 | wgsl-out | |
Metal | ✅ | msl-out | |
HLSL | ✅ | hlsl-out | Shader Model 5.0+ (DirectX 11+) |
GLSL | 🆗 | glsl-out | GLSL 330+ and GLSL ES 300+ |
AIR | |||
DXIL/DXIR | |||
DXBC | |||
DOT (GraphViz) | 🆗 | dot-out | Not a shading language |
✅ = Primary support — 🆗 = Secondary support — 🚧 = Unsupported, but support in progress
Conversion tool
Naga can be used as a CLI, which allows testing the conversion of different code paths.
First, install naga-cli
from crates.io or directly from GitHub.
# release version
cargo install naga-cli
# development version
cargo install naga-cli --git https://github.com/gfx-rs/wgpu.git
Then, you can run naga
command.
naga my_shader.wgsl # validate only
naga my_shader.spv my_shader.txt # dump the IR module into a file
naga my_shader.spv my_shader.metal --flow-dir flow-dir # convert the SPV to Metal, also dump the SPIR-V flow graph to `flow-dir`
naga my_shader.wgsl my_shader.vert --profile es310 # convert the WGSL to GLSL vertex stage under ES 3.20 profile
As naga includes a default binary target, you can also use cargo run
without installation. This is useful when you develop naga itself or investigate the behavior of naga at a specific commit (e.g. wgpu might pin a different version of naga than the HEAD
of this repository).
cargo run my_shader.wgsl
Development workflow
The main instrument aiding the development is the good old cargo test --all-features --workspace
,
which will run the unit tests and also update all the snapshots. You'll see these
changes in git before committing the code.
If working on a particular front-end or back-end, it may be convenient to
enable the relevant features in Cargo.toml
, e.g.
default = ["spv-out"] #TEMP!
This allows IDE basic checks to report errors there unless your IDE is sufficiently configurable already.
Finally, when changes to the snapshots are made, we should verify that the produced shaders are indeed valid for the target platforms they are compiled for:
cargo xtask validate spv # for Vulkan shaders, requires SPIRV-Tools installed
cargo xtask validate msl # for Metal shaders, requires XCode command-line tools installed
cargo xtask validate glsl # for OpenGL shaders, requires GLSLang installed
cargo xtask validate dot # for dot files, requires GraphViz installed
cargo xtask validate wgsl # for WGSL shaders
cargo xtask validate hlsl dxc # for HLSL shaders via DXC
cargo xtask validate hlsl fxc # for HLSL shaders via FXC