Struct CompilerOptions

Source
#[non_exhaustive]
pub struct CompilerOptions { pub common: CommonOptions, pub shader_model: HlslShaderModel, pub point_size_compat: bool, pub point_coord_compat: bool, pub support_nonzero_base_vertex_base_instance: bool, pub force_storage_buffer_as_uav: bool, pub nonwritable_uav_texture_as_srv: bool, pub flatten_matrix_vertex_input_semantics: bool, pub enable_16bit_types: bool, pub use_entry_point_name: bool, pub preserve_structured_buffers: bool, }
Available on crate feature hlsl only.
Expand description

HLSL compiler options

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§common: CommonOptions

Compile options common to GLSL, HLSL, and MSL.

§shader_model: HlslShaderModel

The HLSL shader model version to output. The default is SM 3.0

§point_size_compat: bool

Allows the PointSize builtin in SM 4.0+, and ignores it, as PointSize is not supported in SM 4+.

§point_coord_compat: bool

Allows the PointCoord builtin, returns float2(0.5, 0.5), as PointCoord is not supported in HLSL.

§support_nonzero_base_vertex_base_instance: bool

If true, the backend will assume that VertexIndex and InstanceIndex will need to apply a base offset, and you will need to fill in a cbuffer with offsets.

Set to false if you know you will never use base instance or base vertex functionality as it might remove an internal cbuffer.

§force_storage_buffer_as_uav: bool

Forces a storage buffer to always be declared as UAV, even if the readonly decoration is used. By default, a readonly storage buffer will be declared as ByteAddressBuffer (SRV) instead.

§nonwritable_uav_texture_as_srv: bool

Forces any storage image type marked as NonWritable to be considered an SRV instead. For this to work with function call parameters, NonWritable must be considered to be part of the type system so that NonWritable image arguments are also translated to Texture rather than RWTexture.

§flatten_matrix_vertex_input_semantics: bool

If matrices are used as IO variables, flatten the attribute declaration to use TEXCOORD{N,N+1,N+2,...} rather than TEXCOORDN_{0,1,2,3}. If add_vertex_attribute_remap is used and this feature is used, the semantic name will be queried once per active location.

§enable_16bit_types: bool

Enables native 16-bit types. Needs SM 6.2. Uses half/int16_t/uint16_t instead of min16* types. Also adds support for 16-bit load-store from (RW)ByteAddressBuffer.

§use_entry_point_name: bool

Rather than emitting main() for the entry point, use the name in SPIR-V.

§preserve_structured_buffers: bool

Preserve (RW)StructuredBuffer types if the input source was HLSL.

This relies on UserTypeGOOGLE to encode the buffer type either as structuredbuffer or rwstructuredbuffer whereas the type can be extended with an optional subtype, e.g. structuredbuffer:int.

Trait Implementations§

Source§

impl Debug for CompilerOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CompilerOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl CompilerOptions for CompilerOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.