wgpu/naga
dependabot[bot] 4fd03caf9d
build(deps): bump the patch-updates group across 1 directory with 23 updates
Bumps the patch-updates group with 20 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.92` | `1.0.93` |
| [futures-lite](https://github.com/smol-rs/futures-lite) | `2.4.0` | `2.5.0` |
| [libc](https://github.com/rust-lang/libc) | `0.2.161` | `0.2.164` |
| [serde](https://github.com/serde-rs/serde) | `1.0.214` | `1.0.215` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.132` | `1.0.133` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.41.0` | `1.41.1` |
| [arbitrary](https://github.com/rust-fuzz/arbitrary) | `1.3.2` | `1.4.1` |
| [libfuzzer-sys](https://github.com/rust-fuzz/libfuzzer) | `0.4.7` | `0.4.8` |
| [allocator-api2](https://github.com/zakarumych/allocator-api2) | `0.2.18` | `0.2.20` |
| [anstream](https://github.com/rust-cli/anstyle) | `0.6.17` | `0.6.18` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.34` | `1.2.1` |
| [clap](https://github.com/clap-rs/clap) | `4.5.20` | `4.5.21` |
| [clap_lex](https://github.com/clap-rs/clap) | `0.7.2` | `0.7.3` |
| [fastrand](https://github.com/smol-rs/fastrand) | `2.1.1` | `2.2.0` |
| [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.34` | `1.0.35` |
| [polling](https://github.com/smol-rs/polling) | `3.7.3` | `3.7.4` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.38` | `0.38.40` |
| [tracy-client-sys](https://github.com/nagisa/rust_tracy_client) | `0.24.1` | `0.24.2` |
| [url](https://github.com/servo/rust-url) | `2.5.2` | `2.5.3` |
| [xml-rs](https://github.com/kornelski/xml-rs) | `0.8.22` | `0.8.23` |



Updates `anyhow` from 1.0.92 to 1.0.93
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.92...1.0.93)

Updates `futures-lite` from 2.4.0 to 2.5.0
- [Release notes](https://github.com/smol-rs/futures-lite/releases)
- [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/futures-lite/compare/v2.4.0...v2.5.0)

Updates `libc` from 0.2.161 to 0.2.164
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.161...0.2.164)

Updates `serde` from 1.0.214 to 1.0.215
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.214...v1.0.215)

Updates `serde_json` from 1.0.132 to 1.0.133
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.132...v1.0.133)

Updates `tokio` from 1.41.0 to 1.41.1
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.41.0...tokio-1.41.1)

Updates `arbitrary` from 1.3.2 to 1.4.1
- [Changelog](https://github.com/rust-fuzz/arbitrary/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-fuzz/arbitrary/compare/v1.3.2...v1.4.1)

Updates `libfuzzer-sys` from 0.4.7 to 0.4.8
- [Changelog](https://github.com/rust-fuzz/libfuzzer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-fuzz/libfuzzer/compare/0.4.7...0.4.8)

Updates `allocator-api2` from 0.2.18 to 0.2.20
- [Changelog](https://github.com/zakarumych/allocator-api2/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zakarumych/allocator-api2/commits)

Updates `anstream` from 0.6.17 to 0.6.18
- [Commits](https://github.com/rust-cli/anstyle/compare/anstream-v0.6.17...anstream-v0.6.18)

Updates `cc` from 1.1.34 to 1.2.1
- [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/cc-v1.1.34...cc-v1.2.1)

Updates `clap` from 4.5.20 to 4.5.21
- [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.20...clap_complete-v4.5.21)

Updates `clap_builder` from 4.5.20 to 4.5.21
- [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.20...v4.5.21)

Updates `clap_lex` from 0.7.2 to 0.7.3
- [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_lex-v0.7.2...clap_lex-v0.7.3)

Updates `derive_arbitrary` from 1.3.2 to 1.4.1
- [Changelog](https://github.com/rust-fuzz/arbitrary/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-fuzz/arbitrary/compare/v1.3.2...v1.4.1)

Updates `fastrand` from 2.1.1 to 2.2.0
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v2.1.1...v2.2.0)

Updates `flate2` from 1.0.34 to 1.0.35
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Changelog](https://github.com/rust-lang/flate2-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.34...1.0.35)

Updates `polling` from 3.7.3 to 3.7.4
- [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.3...v3.7.4)

Updates `rustix` from 0.38.38 to 0.38.40
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.38...v0.38.40)

Updates `serde_derive` from 1.0.214 to 1.0.215
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.214...v1.0.215)

Updates `tracy-client-sys` from 0.24.1 to 0.24.2
- [Commits](https://github.com/nagisa/rust_tracy_client/compare/tracy-client-sys-v0.24.1...tracy-client-sys-v0.24.2)

Updates `url` from 2.5.2 to 2.5.3
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.5.2...v2.5.3)

Updates `xml-rs` from 0.8.22 to 0.8.23
- [Changelog](https://github.com/kornelski/xml-rs/blob/main/Changelog.md)
- [Commits](https://github.com/kornelski/xml-rs/compare/0.8.22...0.8.23)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: futures-lite
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde
  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: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: arbitrary
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: libfuzzer-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: allocator-api2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: anstream
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-minor
  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_lex
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: derive_arbitrary
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: fastrand
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: flate2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: polling
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tracy-client-sys
  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: xml-rs
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 02:47:54 +00:00
..
.cargo Move naga to subfolder 2023-10-25 14:25:04 -04:00
fuzz build(deps): bump the patch-updates group across 1 directory with 23 updates 2024-11-18 02:47:54 +00:00
hlsl-snapshots chore: #[must_use] annotations on getters and ctors 2024-08-19 14:38:05 +01:00
src docs(diagnostic_filter): add more words to DiagnosticFilterMap 2024-11-15 16:11:07 -08:00
tests feat(wgsl-in): parse diagnostic attrs. on fns 2024-11-15 07:44:14 -05:00
xtask chore: format TOML files with taplo 0.9.3 2024-10-11 14:40:01 -04:00
.gitattributes Move naga to subfolder 2023-10-25 14:25:04 -04:00
.gitignore Move naga to subfolder 2023-10-25 14:25:04 -04:00
build.rs Introduce hlsl-out-if-target-windows feature to Naga 2024-07-09 09:53:39 +02:00
Cargo.toml build(deps): bump the patch-updates group across 1 directory with 23 updates 2024-11-18 02:47:54 +00:00
CHANGELOG.md build(deps): bump crate-ci/typos from 1.24.6 to 1.26.0 (#6399) 2024-10-21 00:23:43 +00:00
README.md Bump core MSRV to 1.76 2024-07-20 15:55:28 -04:00

Naga

Matrix Crates.io Docs.rs Build Status MSRV codecov.io

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