pub trait Shader {
type Error: Debug;
// Required methods
fn spirv(&self) -> Result<Cow<'_, [u32]>, <Self as Shader>::Error>;
fn entry(&self) -> &str;
fn stage(&self) -> ShaderStageFlags;
// Provided method
unsafe fn module<B>(
&self,
factory: &Factory<B>,
) -> Result<B::ShaderModule, ShaderError>
where B: Backend { ... }
}
Expand description
Interface to create shader modules from shaders.
Implemented for static shaders via [compile_to_spirv!
] macro.
Required Associated Types§
Required Methods§
Sourcefn stage(&self) -> ShaderStageFlags
fn stage(&self) -> ShaderStageFlags
Get the rendy_core::hal representation of this shaders kind/stage.
Provided Methods§
Sourceunsafe fn module<B>(
&self,
factory: &Factory<B>,
) -> Result<B::ShaderModule, ShaderError>where
B: Backend,
unsafe fn module<B>(
&self,
factory: &Factory<B>,
) -> Result<B::ShaderModule, ShaderError>where
B: Backend,
Create shader module.
Spir-V bytecode must adhere valid usage on this Vulkan spec page: https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkShaderModuleCreateInfo.html
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.