#[non_exhaustive]pub enum ShaderBuildError {
InvalidName {
path: PathBuf,
component: String,
},
NameCollision {
first: PathBuf,
second: PathBuf,
kind: &'static str,
name: String,
},
ReservedName {
path: PathBuf,
name: String,
},
ReservedImport {
path: PathBuf,
import_path: String,
name: String,
},
OutsideRoot {
path: PathBuf,
},
BindingLine {
path: PathBuf,
line: usize,
text: String,
reason: &'static str,
},
UnsupportedBinding {
path: PathBuf,
line: usize,
text: String,
reason: &'static str,
},
ModuleBinding {
path: PathBuf,
line: usize,
text: String,
},
BindingGap {
path: PathBuf,
indices: Vec<u32>,
},
Compose {
message: String,
},
Io {
path: PathBuf,
source: Error,
},
Environment {
variable: &'static str,
},
}Expand description
Reason a shader build fails.
Debug writes the same text as Display, so a build script that returns the error shows its guidance.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidName
A component of a .wgsl file’s path below the shader root is not a Rust identifier, or is a keyword.
The same error reports an entry point whose ShaderEntry variant is not a Rust identifier, as self_.wgsl
gives Self.
Fields
NameCollision
Two shaders give the same Rust name, or one shader’s module contains another shader’s module.
Fields
ReservedName
A shader path or root that uses a reserved name.
The name henad is reserved regardless of case, for the last component of the shader root and for every
component of a .wgsl file’s path below it. A name the generated bindings use, such as wgpu or _root, is
reserved for the first component of a .wgsl path.
Fields
ReservedImport
A file imported through an import path that makes it the module name at the root of the generated
bindings, where name is henad in any letter case or a name the generated bindings use.
The bindings name a quoted import after the stem of its file name. #import "std.inc" gives the module std.
Fields
OutsideRoot
An entry point given to ShaderBuild::entry_point lies outside the shader root.
BindingLine
A line holding @binding or @group in a form that the binding parser does not accept.
Fields
UnsupportedBinding
A @group(0) binding of a kind no Henad pass binds: a sampler, a sampled texture, or an address space other
than uniform, storage, read and storage, read_write.
Fields
ModuleBinding
A file that is not an entry point declares a binding on the given line.
Such a file is a module, with a #define_import_path line, or another file a shader imports.
Fields
BindingGap
The @group(0) indices of a shader, sorted, do not run from 0 with no gap or repeat.
Fields
Compose
wgsl_bindgen could not compose the shaders or generate their bindings.
Fields
Io
A file or directory could not be read or written.
Fields
Environment
Cargo did not set a variable a build script reads.
Trait Implementations§
Source§impl Debug for ShaderBuildError
impl Debug for ShaderBuildError
Source§impl Display for ShaderBuildError
impl Display for ShaderBuildError
Source§impl Error for ShaderBuildError
impl Error for ShaderBuildError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()