wgpu/naga
dependabot[bot] 73738afa82
build(deps): bump the patch-updates group with 35 updates (#5507)
Bumps the patch-updates group with 35 updates:

| Package | From | To |
| --- | --- | --- |
| [bitflags](https://github.com/bitflags/bitflags) | `2.4.2` | `2.5.0` |
| [futures-lite](https://github.com/smol-rs/futures-lite) | `2.2.0` | `2.3.0` |
| [getrandom](https://github.com/rust-random/getrandom) | `0.2.12` | `0.2.13` |
| [glam](https://github.com/bitshifter/glam-rs) | `0.25.0` | `0.27.0` |
| [heck](https://github.com/withoutboats/heck) | `0.4.1` | `0.5.0` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.114` | `1.0.115` |
| [smallvec](https://github.com/servo/rust-smallvec) | `1.13.1` | `1.13.2` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.36.0` | `1.37.0` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.2.5` | `2.2.6` |
| [syn](https://github.com/dtolnay/syn) | `2.0.52` | `2.0.58` |
| [ab_glyph](https://github.com/alexheretic/ab-glyph) | `0.2.23` | `0.2.24` |
| [aho-corasick](https://github.com/BurntSushi/aho-corasick) | `1.1.2` | `1.1.3` |
| [async-trait](https://github.com/dtolnay/async-trait) | `0.1.77` | `0.1.79` |
| [autocfg](https://github.com/cuviper/autocfg) | `1.1.0` | `1.2.0` |
| [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.69` | `0.3.71` |
| [bytes](https://github.com/tokio-rs/bytes) | `1.5.0` | `1.6.0` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.0.90` | `1.0.91` |
| [clap](https://github.com/clap-rs/clap) | `4.5.2` | `4.5.4` |
| [clap_derive](https://github.com/clap-rs/clap) | `4.5.0` | `4.5.4` |
| [downcast-rs](https://github.com/marcianx/downcast-rs) | `1.2.0` | `1.2.1` |
| [fastrand](https://github.com/smol-rs/fastrand) | `2.0.1` | `2.0.2` |
| [half](https://github.com/starkat99/half-rs) | `2.4.0` | `2.4.1` |
| [itoa](https://github.com/dtolnay/itoa) | `1.0.10` | `1.0.11` |
| [memchr](https://github.com/BurntSushi/memchr) | `2.7.1` | `2.7.2` |
| [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | `0.2.13` | `0.2.14` |
| [polling](https://github.com/smol-rs/polling) | `3.5.0` | `3.6.0` |
| [rayon](https://github.com/rayon-rs/rayon) | `1.9.0` | `1.10.0` |
| [regex](https://github.com/rust-lang/regex) | `1.10.3` | `1.10.4` |
| [regex-syntax](https://github.com/rust-lang/regex) | `0.8.2` | `0.8.3` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.31` | `0.38.32` |
| [rustversion](https://github.com/dtolnay/rustversion) | `1.0.14` | `1.0.15` |
| [uuid](https://github.com/uuid-rs/uuid) | `1.7.0` | `1.8.0` |
| [widestring](https://github.com/starkat99/widestring-rs) | `1.0.2` | `1.1.0` |
| [xml-rs](https://github.com/kornelski/xml-rs) | `0.8.19` | `0.8.20` |

Updates `bitflags` from 2.4.2 to 2.5.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.4.2...2.5.0)

Updates `futures-lite` from 2.2.0 to 2.3.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.2.0...v2.3.0)

Updates `getrandom` from 0.2.12 to 0.2.13
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.12...v0.2.13)

Updates `heck` from 0.4.1 to 0.5.0
- [Changelog](https://github.com/withoutboats/heck/blob/master/CHANGELOG.md)
- [Commits](https://github.com/withoutboats/heck/commits)

Updates `serde_json` from 1.0.114 to 1.0.115
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.114...v1.0.115)

Updates `smallvec` from 1.13.1 to 1.13.2
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.13.1...v1.13.2)

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

Updates `indexmap` from 2.2.5 to 2.2.6
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.2.5...2.2.6)

Updates `syn` from 2.0.52 to 2.0.58
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.52...2.0.58)

Updates `ab_glyph` from 0.2.23 to 0.2.24
- [Release notes](https://github.com/alexheretic/ab-glyph/releases)
- [Commits](https://github.com/alexheretic/ab-glyph/compare/ab-glyph-0.2.23...ab-glyph-0.2.24)

Updates `aho-corasick` from 1.1.2 to 1.1.3
- [Commits](https://github.com/BurntSushi/aho-corasick/compare/1.1.2...1.1.3)

Updates `async-trait` from 0.1.77 to 0.1.79
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.77...0.1.79)

Updates `autocfg` from 1.1.0 to 1.2.0
- [Commits](https://github.com/cuviper/autocfg/compare/1.1.0...1.2.0)

Updates `backtrace` from 0.3.69 to 0.3.71
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.69...0.3.71)

Updates `bytes` from 1.5.0 to 1.6.0
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.5.0...v1.6.0)

Updates `cc` from 1.0.90 to 1.0.91
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.90...1.0.91)

Updates `clap` from 4.5.2 to 4.5.4
- [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.2...v4.5.4)

Updates `clap_derive` from 4.5.0 to 4.5.4
- [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.0...v4.5.4)

Updates `downcast-rs` from 1.2.0 to 1.2.1
- [Changelog](https://github.com/marcianx/downcast-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/marcianx/downcast-rs/compare/v1.2.0...v1.2.1)

Updates `fastrand` from 2.0.1 to 2.0.2
- [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.0.1...v2.0.2)

Updates `half` from 2.4.0 to 2.4.1
- [Release notes](https://github.com/starkat99/half-rs/releases)
- [Changelog](https://github.com/starkat99/half-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/starkat99/half-rs/compare/v2.4.0...v2.4.1)

Updates `itoa` from 1.0.10 to 1.0.11
- [Release notes](https://github.com/dtolnay/itoa/releases)
- [Commits](https://github.com/dtolnay/itoa/compare/1.0.10...1.0.11)

Updates `memchr` from 2.7.1 to 2.7.2
- [Commits](https://github.com/BurntSushi/memchr/compare/2.7.1...2.7.2)

Updates `pin-project-lite` from 0.2.13 to 0.2.14
- [Release notes](https://github.com/taiki-e/pin-project-lite/releases)
- [Changelog](https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project-lite/compare/v0.2.13...v0.2.14)

Updates `polling` from 3.5.0 to 3.6.0
- [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.5.0...v3.6.0)

Updates `rayon` from 1.9.0 to 1.10.0
- [Changelog](https://github.com/rayon-rs/rayon/blob/main/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.9.0...rayon-core-v1.10.0)

Updates `regex` from 1.10.3 to 1.10.4
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.10.3...1.10.4)

Updates `regex-syntax` from 0.8.2 to 0.8.3
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.8.2...regex-syntax-0.8.3)

Updates `rustix` from 0.38.31 to 0.38.32
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.31...v0.38.32)

Updates `rustversion` from 1.0.14 to 1.0.15
- [Release notes](https://github.com/dtolnay/rustversion/releases)
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.14...1.0.15)

Updates `uuid` from 1.7.0 to 1.8.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.7.0...1.8.0)

Updates `widestring` from 1.0.2 to 1.1.0
- [Release notes](https://github.com/starkat99/widestring-rs/releases)
- [Changelog](https://github.com/starkat99/widestring-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/starkat99/widestring-rs/compare/v1.0.2...v1.1.0)

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

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: futures-lite
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: getrandom
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: heck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: smallvec
  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-minor
  dependency-group: patch-updates
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  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: aho-corasick
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: async-trait
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: autocfg
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: backtrace
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytes
  dependency-type: indirect
  update-type: version-update:semver-minor
  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_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: downcast-rs
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: fastrand
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: half
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: itoa
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: memchr
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pin-project-lite
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: polling
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: rayon
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: regex
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: regex-syntax
  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: rustversion
  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
- dependency-name: widestring
  dependency-type: indirect
  update-type: version-update:semver-minor
  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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-04-09 00:20:27 -04:00
..
.cargo Move naga to subfolder 2023-10-25 14:25:04 -04:00
benches move the burden of evaluating override-expressions to users of naga's API 2024-04-05 18:07:41 +02:00
fuzz Release 0.19 (#5082) 2024-01-17 14:42:11 -05:00
hlsl-snapshots Bump Many Dependencies and MSRV (#5241) 2024-02-27 14:43:05 -05:00
src fix(spv-out): OpSourceContinued for large source (gfx-rs#5390) 2024-04-08 11:27:18 +02:00
tests fix(spv-out): OpSourceContinued for large source (gfx-rs#5390) 2024-04-08 11:27:18 +02:00
xtask Add Metal 3.0 and 3.1 detection (#5497) 2024-04-05 19:22:33 +02: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
Cargo.toml build(deps): bump the patch-updates group with 35 updates (#5507) 2024-04-09 00:20:27 -04:00
CHANGELOG.md Add typos to Repository CI (#5191) 2024-02-05 12:30:29 -05:00
README.md docs: Fix incorrect git URL for naga-cli installation (#5457) 2024-04-02 12:54:27 +02: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