#embed #naga #naga-rust-embed

naga-rust-embed

Translates WGSL shader code to Rust embedded in your Rust code

1 unstable release

Uses new Rust 2024

new 0.1.0 Mar 26, 2025

#3 in #naga

MIT/Apache

125KB
2K SLoC

naga-rust-embed: embed WGSL code in your Rust code

Translates WGSL shader code to Rust embedded in your crate via macros.

This does not necessarily mean you can run your compute or render pipelines in Rust on your CPU unchanged; this is not a full “software renderer”. Rather, the primary goal of the library is to allow you to share simple functions between CPU and GPU code, so that the two parts of your code can agree on definitions.

If you need additional control over the translation or to use a different source language, use the naga-rust-back library directly instead.

This library is in an early stage of development and many features do not work yet. Expect compilation failures and to have to tweak your code to fit. Broadly, simple mathematical functions will work, and bindings, textures, atomics, derivatives, and workgroup operations will not.

License

Copyright 2025 Kevin Reid and the gfx-rs authors.

Licensed under either of

at your option.

Dependencies

~7–14MB
~178K SLoC