pub struct SpirvBuilder {
    pub shader_panic_strategy: ShaderPanicStrategy,
    pub relax_struct_store: bool,
    pub relax_logical_pointer: bool,
    pub relax_block_layout: bool,
    pub uniform_buffer_standard_layout: bool,
    pub scalar_block_layout: bool,
    pub skip_block_layout: bool,
    pub preserve_bindings: bool,
    /* private fields */
}

Fields§

§shader_panic_strategy: ShaderPanicStrategy§relax_struct_store: bool§relax_logical_pointer: bool§relax_block_layout: bool§uniform_buffer_standard_layout: bool§scalar_block_layout: bool§skip_block_layout: bool§preserve_bindings: bool

Implementations§

source§

impl SpirvBuilder

source

pub fn new(path_to_crate: impl AsRef<Path>, target: impl Into<String>) -> Self

source

pub fn print_metadata(self, v: MetadataPrintout) -> Self

Whether to print build.rs cargo metadata (e.g. cargo:rustc-env=var=val). Defaults to MetadataPrintout::Full.

source

pub fn deny_warnings(self, v: bool) -> Self

source

pub fn release(self, v: bool) -> Self

Build in release. Defaults to true.

source

pub fn multimodule(self, v: bool) -> Self

Splits the resulting SPIR-V file into one module per entry point. This is useful in cases where ecosystem tooling has bugs around multiple entry points per module - having all entry points bundled into a single file is the preferred system.

source

pub fn spirv_metadata(self, v: SpirvMetadata) -> Self

Sets the level of metadata (primarily OpName and OpLine) included in the SPIR-V binary. Including metadata significantly increases binary size.

source

pub fn capability(self, capability: Capability) -> Self

Adds a capability to the SPIR-V module. Checking if a capability is enabled in code can be done via #[cfg(target_feature = "TheCapability")].

source

pub fn extension(self, extension: impl Into<String>) -> Self

Adds an extension to the SPIR-V module. Checking if an extension is enabled in code can be done via #[cfg(target_feature = "ext:the_extension")].

source

pub fn shader_panic_strategy( self, shader_panic_strategy: ShaderPanicStrategy ) -> Self

Change the shader panic! handling strategy (see ShaderPanicStrategy).

source

pub fn relax_struct_store(self, v: bool) -> Self

Allow store from one struct type to a different type with compatible layout and members.

source

pub fn relax_logical_pointer(self, v: bool) -> Self

Allow allocating an object of a pointer type and returning a pointer value from a function in logical addressing mode

source

pub fn relax_block_layout(self, v: bool) -> Self

Enable VK_KHR_relaxed_block_layout when checking standard uniform, storage buffer, and push constant layouts. This is the default when targeting Vulkan 1.1 or later.

source

pub fn uniform_buffer_standard_layout(self, v: bool) -> Self

Enable VK_KHR_uniform_buffer_standard_layout when checking standard uniform buffer layouts.

source

pub fn scalar_block_layout(self, v: bool) -> Self

Enable VK_EXT_scalar_block_layout when checking standard uniform, storage buffer, and push constant layouts. Scalar layout rules are more permissive than relaxed block layout so in effect this will override the –relax-block-layout option.

source

pub fn skip_block_layout(self, v: bool) -> Self

Skip checking standard uniform/storage buffer layout. Overrides any –relax-block-layout or –scalar-block-layout option.

source

pub fn preserve_bindings(self, v: bool) -> Self

Preserve unused descriptor bindings. Useful for reflection.

source

pub fn extra_arg(self, arg: impl Into<String>) -> Self

Set additional “codegen arg”. Note: the RUSTGPU_CODEGEN_ARGS environment variable takes precedence over any set arguments using this function.

source

pub fn build(self) -> Result<CompileResult, SpirvBuilderError>

Builds the module. If print_metadata is MetadataPrintout::Full, you usually don’t have to inspect the path in the result, as the environment variable for the path to the module will already be set.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.