pub trait FromCompilation<T, S> {
type Target: OutputTarget;
type Options;
type Context;
type Output: CompileShader<Self::Target, Context = Self::Context, Options = Self::Options> + ReflectShader;
// Required method
fn from_compilation(
compile: T,
) -> Result<CompilerBackend<Self::Output>, ShaderReflectError>;
}
Expand description
A trait for reflectable compilations that can be transformed into an object ready for reflection or compilation.
T
is the compiled reflectable form of the shader.
S
is the semantics under which the shader is reflected.
librashader currently supports two semantics, SpirvCross
Required Associated Types§
Sourcetype Target: OutputTarget
type Target: OutputTarget
The target that the transformed object is expected to compile for.
Sourcetype Output: CompileShader<Self::Target, Context = Self::Context, Options = Self::Options> + ReflectShader
type Output: CompileShader<Self::Target, Context = Self::Context, Options = Self::Options> + ReflectShader
The output type after conversion.
Required Methods§
Sourcefn from_compilation(
compile: T,
) -> Result<CompilerBackend<Self::Output>, ShaderReflectError>
fn from_compilation( compile: T, ) -> Result<CompilerBackend<Self::Output>, ShaderReflectError>
Tries to convert the input object into an object ready for compilation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl FromCompilation<SpirvCompilation, SpirvCross> for GLSL
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, SpirvCross> for GLSL
Available on non-crate feature
stable
only.type Target = GLSL
type Options = GlslVersion
type Context = CrossGlslContext
type Output = impl CompileReflectShader<<GLSL as FromCompilation<SpirvCompilation, SpirvCross>>::Target, SpirvCompilation, SpirvCross>
Source§impl FromCompilation<SpirvCompilation, SpirvCross> for HLSL
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, SpirvCross> for HLSL
Available on non-crate feature
stable
only.type Target = HLSL
type Options = Option<HlslShaderModel>
type Context = CrossHlslContext
type Output = impl CompileReflectShader<<HLSL as FromCompilation<SpirvCompilation, SpirvCross>>::Target, SpirvCompilation, SpirvCross>
Source§impl FromCompilation<SpirvCompilation, SpirvCross> for MSL
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, SpirvCross> for MSL
Available on non-crate feature
stable
only.type Target = MSL
type Options = Option<MslVersion>
type Context = CrossMslContext
type Output = impl CompileReflectShader<<MSL as FromCompilation<SpirvCompilation, SpirvCross>>::Target, SpirvCompilation, SpirvCross>
Source§impl FromCompilation<SpirvCompilation, SpirvCross> for SPIRV
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, SpirvCross> for SPIRV
Available on non-crate feature
stable
only.type Target = SPIRV
type Options = Option<()>
type Context = ()
type Output = impl CompileReflectShader<<SPIRV as FromCompilation<SpirvCompilation, SpirvCross>>::Target, SpirvCompilation, SpirvCross>
Source§impl FromCompilation<SpirvCompilation, Naga> for MSL
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, Naga> for MSL
Available on non-crate feature
stable
only.type Target = MSL
type Options = Option<MslVersion>
type Context = NagaMslContext
type Output = impl CompileReflectShader<<MSL as FromCompilation<SpirvCompilation, Naga>>::Target, SpirvCompilation, Naga>
Source§impl FromCompilation<SpirvCompilation, Naga> for SPIRV
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, Naga> for SPIRV
Available on non-crate feature
stable
only.type Target = SPIRV
type Options = NagaSpirvOptions
type Context = NagaSpirvContext
type Output = impl CompileReflectShader<<SPIRV as FromCompilation<SpirvCompilation, Naga>>::Target, SpirvCompilation, Naga>
Source§impl FromCompilation<SpirvCompilation, Naga> for WGSL
Available on non-crate feature stable
only.
impl FromCompilation<SpirvCompilation, Naga> for WGSL
Available on non-crate feature
stable
only.