[−][src]Struct shaderc::Compiler
An opaque object managing all compiler states.
Creating an Compiler
object has substantial resource costs; so it is
recommended to keep one object around for all tasks.
Methods
impl Compiler
[src]
pub fn new() -> Option<Compiler>
[src]
Returns an compiler object that can be used to compile SPIR-V modules.
A return of None
indicates that there was an error initializing
the underlying compiler.
pub fn compile_into_spirv(
&mut self,
source_text: &str,
shader_kind: ShaderKind,
input_file_name: &str,
entry_point_name: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
[src]
&mut self,
source_text: &str,
shader_kind: ShaderKind,
input_file_name: &str,
entry_point_name: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
Compiles the given source string source_text
to a SPIR-V binary
module according to the given additional_options
.
The source string will be compiled into a SPIR-V binary module
contained in a CompilationArtifact
object if no error happens.
The source string is treated as the given shader kind shader_kind
.
If InferFromSource
is given, the compiler will try to deduce the
shader kind from the source string via #pragma
directives and a
failure in deducing will generate an error. If the shader kind is
set to one of the default shader kinds, the compiler will fall back
to the default shader kind in case it failed to deduce the shader
kind from the source string.
input_file_name
is a string used as a tag to identify the source
string in cases like emitting error messages. It doesn't have to be
a canonical "file name".
entry_point_name
is a string defines the name of the entry point
to associate with the source string.
pub fn compile_into_spirv_assembly(
&mut self,
source_text: &str,
shader_kind: ShaderKind,
input_file_name: &str,
entry_point_name: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
[src]
&mut self,
source_text: &str,
shader_kind: ShaderKind,
input_file_name: &str,
entry_point_name: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
Like compile_into_spirv
but the result contains SPIR-V assembly text
instead of a SPIR-V binary module.
The output SPIR-V assembly string will be of the format defined in the SPIRV-Tools project.
pub fn preprocess(
&mut self,
source_text: &str,
input_file_name: &str,
entry_point_name: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
[src]
&mut self,
source_text: &str,
input_file_name: &str,
entry_point_name: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
Like compile_into_spirv
but the result contains preprocessed source
code instead of a SPIR-V binary module.
pub fn assemble(
&mut self,
source_assembly: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
[src]
&mut self,
source_assembly: &str,
additional_options: Option<&CompileOptions>
) -> Result<CompilationArtifact>
Assembles the given SPIR-V assembly string source_assembly
into a
SPIR-V binary module according to the given additional_options
.
The input SPIR-V assembly string should be of the format defined in the SPIRV-Tools project.
For options specified in additional_options
, the assembling will
only pick those ones suitable for assembling.
Trait Implementations
Auto Trait Implementations
impl !Send for Compiler
impl Unpin for Compiler
impl !Sync for Compiler
impl UnwindSafe for Compiler
impl RefUnwindSafe for Compiler
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,