Skip to main content

Crate wgsl_rs

Crate wgsl_rs 

Source
Expand description

Keep your WGSL in Rust.

This crate answers the following questions:

  1. How do I write shaders?
  1. How do I package my shaders?
  • They are already packaged in that same module, automatically. No need to deal with shader source files. Instead, you access the module at runtime.
  1. How do I run my shaders?
  • That’s still up to you, but if your runtime is wgpu, then with the linkage-wgpu feature provided by this crate you can avoid a lot of boiler plate by having your linkage auto-generated.

For more info see the Operator’s Manual.

Re-exports§

pub use extension::WgslExtension;
pub use extension::any_ext_claims;
pub use extension::contains_str;
pub use source_error::SourceError;
pub use wgsl_rs_ir as ir;

Modules§

extension
Extension trait for downstream crates to modify WGSL IR after transpilation but before rendering/instantiation.
linkage
Linkage machinery for wgsl-rs.
source_error
Errors produced by Source-level operations.
std
The WGSL standard library, for Rust.

Macros§

discard
Marks the current fragment invocation as discarded.
get
Provides access to a storage, uniform, or workgroup variable.
get_mut
Provides mutable access to a storage or workgroup variable.
load
Copies the value of a uniform, storage, or workgroup variable into a local.
slab_copy
Copy $size elements from $src starting at $src_offset into $dest starting at $dest_offset.

Structs§

GenericTemplate
A generic function (or struct) template defined within a module.
Source
A WGSL source.
TemplateDependency
A transitive dependency from one generic template to another.
TemplateInstantiation
A request to instantiate a generic template with concrete types.

Functions§

validate_wgsl_source
Validates arbitrary WGSL source text using naga.

Attribute Macros§

wgsl
Transpiles a Rust module to WGSL.
wgsl_allow
Suppresses specific wgsl-rs warnings/errors on annotated statements.
wgsl_ignore
Ignores any item following the attribute during parsing, skipping WGSL code generation.