Struct vulkano::shader::ShaderModule [−][src]
pub struct ShaderModule { /* fields omitted */ }
Expand description
Contains SPIR-V code with one or more entry points.
Implementations
pub unsafe fn from_words(
device: Arc<Device>,
words: &[u32]
) -> Result<Arc<ShaderModule>, ShaderCreationError>
pub unsafe fn from_words(
device: Arc<Device>,
words: &[u32]
) -> Result<Arc<ShaderModule>, ShaderCreationError>
Builds a new shader module from SPIR-V 32-bit words. The shader code is parsed and the necessary information is extracted from it.
Safety
- The SPIR-V code is not validated beyond the minimum needed to extract the information.
pub unsafe fn from_bytes(
device: Arc<Device>,
bytes: &[u8]
) -> Result<Arc<ShaderModule>, ShaderCreationError>
pub unsafe fn from_bytes(
device: Arc<Device>,
bytes: &[u8]
) -> Result<Arc<ShaderModule>, ShaderCreationError>
As from_words
, but takes a slice of bytes.
Panics
- Panics if the length of
bytes
is not a multiple of 4.
pub unsafe fn from_words_with_data<'a>(
device: Arc<Device>,
words: &[u32],
spirv_version: Version,
spirv_capabilities: impl IntoIterator<Item = &'a Capability>,
spirv_extensions: impl IntoIterator<Item = &'a str>,
entry_points: impl IntoIterator<Item = (String, ExecutionModel, EntryPointInfo)>
) -> Result<Arc<ShaderModule>, ShaderCreationError>
pub unsafe fn from_words_with_data<'a>(
device: Arc<Device>,
words: &[u32],
spirv_version: Version,
spirv_capabilities: impl IntoIterator<Item = &'a Capability>,
spirv_extensions: impl IntoIterator<Item = &'a str>,
entry_points: impl IntoIterator<Item = (String, ExecutionModel, EntryPointInfo)>
) -> Result<Arc<ShaderModule>, ShaderCreationError>
As from_words
, but does not parse the code. Instead, you must provide the needed
information yourself. This can be useful if you’ve already done parsing yourself and
want to prevent Vulkano from doing it a second time.
Safety
- The SPIR-V code is not validated at all.
- The provided information must match what the SPIR-V code contains.
pub unsafe fn from_bytes_with_data<'a>(
device: Arc<Device>,
bytes: &[u8],
spirv_version: Version,
spirv_capabilities: impl IntoIterator<Item = &'a Capability>,
spirv_extensions: impl IntoIterator<Item = &'a str>,
entry_points: impl IntoIterator<Item = (String, ExecutionModel, EntryPointInfo)>
) -> Result<Arc<ShaderModule>, ShaderCreationError>
pub unsafe fn from_bytes_with_data<'a>(
device: Arc<Device>,
bytes: &[u8],
spirv_version: Version,
spirv_capabilities: impl IntoIterator<Item = &'a Capability>,
spirv_extensions: impl IntoIterator<Item = &'a str>,
entry_points: impl IntoIterator<Item = (String, ExecutionModel, EntryPointInfo)>
) -> Result<Arc<ShaderModule>, ShaderCreationError>
As from_words_with_data
, but takes a slice of bytes.
Panics
- Panics if the length of
bytes
is not a multiple of 4.
Returns information about the entry point with the provided name. Returns None
if no entry
point with that name exists in the shader module or if multiple entry points with the same
name exist.
pub fn entry_point_with_execution<'a>(
&'a self,
name: &str,
execution: ExecutionModel
) -> Option<EntryPoint<'a>>
pub fn entry_point_with_execution<'a>(
&'a self,
name: &str,
execution: ExecutionModel
) -> Option<EntryPoint<'a>>
Returns information about the entry point with the provided name and execution model. Returns
None
if no entry and execution model exists in the shader module.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ShaderModule
impl Send for ShaderModule
impl Sync for ShaderModule
impl Unpin for ShaderModule
impl UnwindSafe for ShaderModule
Blanket Implementations
Mutably borrows from an owned value. Read more
Builds a pointer to this type from a raw pointer.
Returns true if the size is suitable to store a type like this.
Returns the size of an individual element.