pub struct ShaderSource {
pub vertex: String,
pub fragment: String,
pub name: Option<ParamString>,
pub parameters: SizedHashMap<ParamString, ShaderParameter, BuildHasherDefault<FxHasher>>,
pub format: ImageFormat,
}Available on crate feature
preprocess only.Expand description
The source file for a single shader pass.
Fields§
§vertex: StringThe source contents for the vertex shader.
fragment: StringThe source contents for the fragment shader.
name: Option<ParamString>The alias of the shader if available.
parameters: SizedHashMap<ParamString, ShaderParameter, BuildHasherDefault<FxHasher>>The list of shader parameters found in the shader source.
format: ImageFormatThe image format the shader expects.
Implementations§
Source§impl ShaderSource
impl ShaderSource
Sourcepub fn load(
path: impl AsRef<Path>,
features: ShaderFeatures,
) -> Result<ShaderSource, PreprocessError>
pub fn load( path: impl AsRef<Path>, features: ShaderFeatures, ) -> Result<ShaderSource, PreprocessError>
Load the source file at the given path, resolving includes relative to the location of the source file.
Trait Implementations§
Source§impl Clone for ShaderSource
impl Clone for ShaderSource
Source§fn clone(&self) -> ShaderSource
fn clone(&self) -> ShaderSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShaderSource
impl Debug for ShaderSource
Source§impl<'de> Deserialize<'de> for ShaderSource
impl<'de> Deserialize<'de> for ShaderSource
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ShaderSource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ShaderSource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ShaderSource
impl PartialEq for ShaderSource
Source§fn eq(&self, other: &ShaderSource) -> bool
fn eq(&self, other: &ShaderSource) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ShaderSource
impl Serialize for ShaderSource
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ShaderSource
Source§impl TryFrom<&ShaderSource> for SpirvCompilation
impl TryFrom<&ShaderSource> for SpirvCompilation
Source§fn try_from(
source: &ShaderSource,
) -> Result<SpirvCompilation, <SpirvCompilation as TryFrom<&ShaderSource>>::Error>
fn try_from( source: &ShaderSource, ) -> Result<SpirvCompilation, <SpirvCompilation as TryFrom<&ShaderSource>>::Error>
Tries to compile SPIR-V from the provided shader source.
Source§type Error = ShaderCompileError
type Error = ShaderCompileError
The type returned in the event of a conversion error.
Source§impl TryFrom<&ShaderSource> for WgslCompilation
impl TryFrom<&ShaderSource> for WgslCompilation
Source§fn try_from(
source: &ShaderSource,
) -> Result<WgslCompilation, <WgslCompilation as TryFrom<&ShaderSource>>::Error>
fn try_from( source: &ShaderSource, ) -> Result<WgslCompilation, <WgslCompilation as TryFrom<&ShaderSource>>::Error>
Tries to compile from the provided shader source.
Source§type Error = ShaderCompileError
type Error = ShaderCompileError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for ShaderSource
impl RefUnwindSafe for ShaderSource
impl Send for ShaderSource
impl Sync for ShaderSource
impl Unpin for ShaderSource
impl UnsafeUnpin for ShaderSource
impl UnwindSafe for ShaderSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more