Compiler

Trait Compiler 

Source
pub trait Compiler<'a>: Sized {
    // Required methods
    fn set_uint(
        self,
        option: spvc_compiler_option,
        value: c_uint,
    ) -> Result<Self>;
    fn set_bool(self, option: spvc_compiler_option, value: bool) -> Result<Self>;
    fn raw_compile(self) -> Result<&'a CStr>;

    // Provided methods
    fn force_temporary(self, force_temporary: bool) -> Result<Self> { ... }
    fn flatten_multidimensional_arrays(
        self,
        flatten_multidimensional_arrays: bool,
    ) -> Result<Self> { ... }
    fn fixup_depth_convention(
        self,
        fixup_depth_convention: bool,
    ) -> Result<Self> { ... }
    fn flip_vertex_y(self, flip_vertex_y: bool) -> Result<Self> { ... }
    fn emit_line_directives(self, emit_line_directives: bool) -> Result<Self> { ... }
    fn enable_storage_image_qualifier_deduction(
        self,
        enable_storage_image_qualifier_deduction: bool,
    ) -> Result<Self> { ... }
    fn force_zero_initialized_variables(
        self,
        force_zero_initialized_variables: bool,
    ) -> Result<Self> { ... }
    fn compile(self) -> Result<String> { ... }
}
Expand description

A SPIRV-Cross compiler to an unkown target.

Required Methods§

Source

fn set_uint(self, option: spvc_compiler_option, value: c_uint) -> Result<Self>

Sets the compiler’s option property to the specified integer value.

Source

fn set_bool(self, option: spvc_compiler_option, value: bool) -> Result<Self>

Sets the compiler’s option property to the specified boolean value.

Source

fn raw_compile(self) -> Result<&'a CStr>

Compiles the program with the specified options, returning a reference to the context’s resulting C string.

This method is usefull if you want to avoid extra allocations, or intend to pass the result to another C function.

Provided Methods§

Source

fn force_temporary(self, force_temporary: bool) -> Result<Self>

Source

fn flatten_multidimensional_arrays( self, flatten_multidimensional_arrays: bool, ) -> Result<Self>

Source

fn fixup_depth_convention(self, fixup_depth_convention: bool) -> Result<Self>

Source

fn flip_vertex_y(self, flip_vertex_y: bool) -> Result<Self>

Source

fn emit_line_directives(self, emit_line_directives: bool) -> Result<Self>

Source

fn enable_storage_image_qualifier_deduction( self, enable_storage_image_qualifier_deduction: bool, ) -> Result<Self>

Source

fn force_zero_initialized_variables( self, force_zero_initialized_variables: bool, ) -> Result<Self>

Source

fn compile(self) -> Result<String>

Compiles the program with the specified options, returning a UTF-8 encoded copy of the result.

This method makes use of CStr::to_string_lossy, so if the resulting source code returns invalid UTF-8, it will be replaced with the REPLACEMENT_CHARACTER (�).

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<'a> Compiler<'a> for GenericCompiler<'a>

Source§

impl<'a> Compiler<'a> for GlslCompiler<'a>

Available on crate feature glsl only.
Source§

impl<'a> Compiler<'a> for HlslCompiler<'a>

Available on crate feature hlsl only.
Source§

impl<'a> Compiler<'a> for MslCompiler<'a>

Available on crate feature msl only.