Enum wgpu::ShaderSource
source · [−]#[non_exhaustive]
pub enum ShaderSource<'a> {
SpirV(Cow<'a, [u32]>),
Glsl {
shader: Cow<'a, str>,
stage: ShaderStage,
defines: FastHashMap<String, String>,
},
Wgsl(Cow<'a, str>),
Naga(Module),
}
Expand description
Source of a shader module.
The source will be parsed and validated.
Any necessary shader translation (e.g. from WGSL to SPIR-V or vice versa) will be done internally by wgpu.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
SpirV(Cow<'a, [u32]>)
Available on crate feature
spirv
only.SPIR-V module represented as a slice of words.
See also: util::make_spirv
, include_spirv
Glsl
Fields
stage: ShaderStage
The shader stage that the shader targets. For example, naga::ShaderStage::Vertex
defines: FastHashMap<String, String>
Defines to unlock configured shader features.
Available on crate feature
glsl
only.GLSL module as a string slice.
Note: GLSL is not yet fully supported and must be a specific ShaderStage.
Wgsl(Cow<'a, str>)
WGSL module as a string slice.
Naga(Module)
Available on crate feature
naga
only.Naga module.
Auto Trait Implementations
impl<'a> RefUnwindSafe for ShaderSource<'a>
impl<'a> Send for ShaderSource<'a>
impl<'a> Sync for ShaderSource<'a>
impl<'a> Unpin for ShaderSource<'a>
impl<'a> UnwindSafe for ShaderSource<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more