[][src]Struct shaderc::CompileOptions

pub struct CompileOptions<'a> { /* fields omitted */ }

An opaque object managing options to compilation.

Methods

impl<'a> CompileOptions<'a>[src]

pub fn new() -> Option<CompileOptions<'a>>[src]

Returns a default-initialized compilation options object.

The default options are:

  • Target environment: Vulkan
  • Source language: GLSL

A return of None indicates that there was an error initializing the underlying options object.

pub fn clone(&self) -> Option<CompileOptions>[src]

Returns a copy of the given compilation options object.

A return of None indicates that there was an error copying the underlying options object.

pub fn set_target_env(&mut self, env: TargetEnv, version: u32)[src]

Sets the target enviroment to env, affecting which warnings or errors will be issued.

The default is Vulkan if not set.

version will be used for distinguishing between different versions of the target environment. "0" is the only supported value right now.

pub fn set_source_language(&mut self, language: SourceLanguage)[src]

Sets the source language.

The default is GLSL if not set.

pub fn set_forced_version_profile(&mut self, version: u32, profile: GlslProfile)[src]

Forces the GLSL language version and profile.

The version number is the same as would appear in the #version directive in the source. Version and profile specified here overrides the #version directive in the source code. Use GlslProfile::None for GLSL versions that do not define profiles, e.g., version below 150.

pub fn set_include_callback<F>(&mut self, f: F) where
    F: Fn(&str, IncludeType, &str, usize) -> Result<ResolvedInclude, String> + 'a, 
[src]

Sets the callback for handling the #include directive.

The arguments to the callback are the name of the source being requested, the type of include directive (Relative for #include "foo", Standard for #include <foo>), the name of the source containing the directive and the current include depth from the original source.

The return value of the callback should be Ok if the source was successfully found, and an Err containing some suitable error message to display otherwise. If the result is Ok, the resolved_name of the ResolvedInclude must be non-empty. All strings returned from the callback must be convertible to CStrings, i.e. they must not contain the null character. If these conditions are not met compilation will panic.

Behaviour note: If Err is returned for a Relative include request, the callback will be tried again with Standard, which is similar to include directive behaviour in C.

pub fn set_limit(&mut self, limit: Limit, value: i32)[src]

Sets the resource limit to the given value.

pub fn set_auto_bind_uniforms(&mut self, auto_bind: bool)[src]

Sets whether the compiler should automatically assign bindings to uniforms that aren't already explicitly bound in the shader source.

pub fn set_hlsl_io_mapping(&mut self, hlsl_iomap: bool)[src]

Sets whether the compiler should use HLSL IO mapping rules for bindings.

Defaults to false.

pub fn set_hlsl_offsets(&mut self, hlsl_offsets: bool)[src]

Sets whether the compiler should determine block member offsets using HLSL packing rules instead of standard GLSL rules.

Defaults to false. Only affects GLSL compilation. HLSL rules are always used when compiling HLSL.

pub fn set_binding_base(&mut self, resource_kind: ResourceKind, base: u32)[src]

Sets the base binding number used for for a resource type when automatically assigning bindings.

For GLSL compilation, sets the lowest automatically assigned number. For HLSL compilation, the regsiter number assigned to the resource is added to this specified base.

pub fn set_binding_base_for_stage(
    &mut self,
    shader_kind: ShaderKind,
    resource_kind: ResourceKind,
    base: u32
)
[src]

Like set_binding_base, but only takes effect when compiling the given shader stage.

pub fn set_hlsl_register_set_and_binding(
    &mut self,
    register: &str,
    set: &str,
    binding: &str
)
[src]

Sets a descriptor set and binding for an HLSL register in all shader stages.

pub fn set_hlsl_register_set_and_binding_for_stage(
    &mut self,
    kind: ShaderKind,
    register: &str,
    set: &str,
    binding: &str
)
[src]

Like set_hlsl_register_set_and_binding, but only takes effect when compiling the given shader stage.

pub fn add_macro_definition(&mut self, name: &str, value: Option<&str>)[src]

Adds a predefined macro to the compilation options.

This has the same effect as passing -Dname=value to the command-line compiler. If value is None, it has the same effect as passing -Dname to the command-line compiler. If a macro definition with the same name has previously been added, the value is replaced with the new value.

pub fn set_optimization_level(&mut self, level: OptimizationLevel)[src]

Sets the optimization level to level.

If mulitple invocations for this method, only the last one takes effect.

pub fn set_generate_debug_info(&mut self)[src]

Sets the compiler mode to generate debug information in the output.

pub fn set_suppress_warnings(&mut self)[src]

Sets the compiler mode to suppress warnings.

This overrides warnings-as-errors mode: when both suppress-warnings and warnings-as-errors modes are turned on, warning messages will be inhibited, and will not be emitted as error messages.

pub fn set_warnings_as_errors(&mut self)[src]

Sets the compiler mode to treat all warnings as errors.

Note that the suppress-warnings mode overrides this.

Trait Implementations

impl<'a> Drop for CompileOptions<'a>[src]

Auto Trait Implementations

impl<'a> !Send for CompileOptions<'a>

impl<'a> Unpin for CompileOptions<'a>

impl<'a> !Sync for CompileOptions<'a>

impl<'a> !UnwindSafe for CompileOptions<'a>

impl<'a> !RefUnwindSafe for CompileOptions<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]