Skip to main content

Crate naga_rust_back

Crate naga_rust_back 

Source
Expand description

naga backend allowing you to translate shader (GPU) code in any language supported by Naga to Rust code.

The generated code requires the naga_rust_rt library. Alternatively, you can use naga_rust_embed, which combines this library with naga_rust_rt and provides convenient macros for embedding translated WGSL in your Rust code.

This library is in an early stage of development and many features do not work yet. Expect compilation failures, incorrect behaviors, and to have to tweak your code to fit, if you wish to use it. Broadly:

  • Simple mathematical functions will work.
  • Code involving pointers is likely to fail to compile.
  • Textures are supported but texture filtering (use of samplers) is not.
  • Storage buffers are not supported.
  • Atomics, derivatives, and workgroup operations are not supported.
  • Not only are whole pipelines not supported, there is no implementation of interpolation (as would occur when passing data from a vertex shader to a fragment shader).

Re-exports§

pub use naga;

Structs§

Config
Configuration/builder for options for Rust code generation.
Rule
Controls some aspect of the translation from shader code to Rust that needs Rust-specific choices that cannot be expressed inside the shader code.
Writer
naga backend allowing you to translate shader code in any language supported by Naga to Rust code.

Enums§

Condition
Specifies a condition under which a Rule applies to a part of the input shader code.
Effect
Specifies the effect of a Rule.
Error
Errors returned by the Rust-generating backend.
Inline
What #[inline] attribute Effect::Inline produces.

Constants§

CAPABILITIES
The Capabilities supported by our Rust runtime library.

Functions§

write_string
Converts module to a string of Rust code.