Struct vulkano::shader::ShaderModule
source · [−]pub struct ShaderModule { /* private fields */ }
Expand description
Contains SPIR-V code with one or more entry points.
Implementations
sourceimpl ShaderModule
impl ShaderModule
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub fn entry_point<'a>(&'a self, name: &str) -> Option<EntryPoint<'a>>
pub fn entry_point<'a>(&'a self, name: &str) -> Option<EntryPoint<'a>>
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.
sourcepub 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
sourceimpl Debug for ShaderModule
impl Debug for ShaderModule
sourceimpl Drop for ShaderModule
impl Drop for ShaderModule
sourceimpl VulkanObject for ShaderModule
impl VulkanObject for ShaderModule
type Object = ShaderModule
type Object = ShaderModule
The type of the object.
sourcefn internal_object(&self) -> ShaderModule
fn internal_object(&self) -> ShaderModule
Returns a reference to the object.
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
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