Ast

Struct Ast 

Source
pub struct Ast<TTarget>
where TTarget: Target,
{ /* private fields */ }
Expand description

An abstract syntax tree that corresponds to a SPIR-V module.

Implementations§

Source§

impl<TTarget> Ast<TTarget>
where Self: Parse<TTarget> + Compile<TTarget>, TTarget: Target,

Source

pub fn get_decoration( &self, id: u32, decoration: Decoration, ) -> Result<u32, ErrorCode>

Gets a decoration.

Source

pub fn get_name(&mut self, id: u32) -> Result<String, ErrorCode>

Gets a name. If not defined, an empty string will be returned.

Source

pub fn set_name(&mut self, id: u32, name: &str) -> Result<(), ErrorCode>

Sets a name.

Source

pub fn set_member_name( &mut self, id: u32, index: u32, name: &str, ) -> Result<(), ErrorCode>

Sets a member name.

Source

pub fn unset_decoration( &mut self, id: u32, decoration: Decoration, ) -> Result<(), ErrorCode>

Unsets a decoration.

Source

pub fn set_decoration( &mut self, id: u32, decoration: Decoration, argument: u32, ) -> Result<(), ErrorCode>

Sets a decoration.

Source

pub fn get_entry_points(&self) -> Result<Vec<EntryPoint>, ErrorCode>

Gets entry points.

Source

pub fn get_cleansed_entry_point_name( &self, entry_point_name: &str, execution_model: ExecutionModel, ) -> Result<String, ErrorCode>

Gets cleansed entry point names. compile must be called first.

Source

pub fn get_active_buffer_ranges( &self, id: u32, ) -> Result<Vec<BufferRange>, ErrorCode>

Gets active buffer ragnes. Useful for push constants.

Source

pub fn get_specialization_constants( &self, ) -> Result<Vec<SpecializationConstant>, ErrorCode>

Gets all specialization constants.

Source

pub fn set_scalar_constant( &mut self, id: u32, value: u64, ) -> Result<(), ErrorCode>

Set reference of a scalar constant to a value, overriding the default.

Can be used to override specialization constants.

Source

pub fn get_shader_resources(&self) -> Result<ShaderResources, ErrorCode>

Gets shader resources.

Source

pub fn get_type(&self, id: u32) -> Result<Type, ErrorCode>

Gets the SPIR-V type associated with an ID.

Source

pub fn get_member_name(&self, id: u32, index: u32) -> Result<String, ErrorCode>

Gets the identifier for a member located at index within an OpTypeStruct.

Source

pub fn get_member_decoration( &self, id: u32, index: u32, decoration: Decoration, ) -> Result<u32, ErrorCode>

Gets a decoration for a member located at index within an OpTypeStruct.

Source

pub fn set_member_decoration( &mut self, id: u32, index: u32, decoration: Decoration, argument: u32, ) -> Result<(), ErrorCode>

Sets a decoration for a member located at index within an OpTypeStruct.

Source

pub fn get_declared_struct_size(&self, id: u32) -> Result<u32, ErrorCode>

Gets the effective size of a buffer block.

Source

pub fn get_declared_struct_member_size( &self, id: u32, index: u32, ) -> Result<u32, ErrorCode>

Gets the effective size of a buffer block struct member.

Source

pub fn rename_interface_variable( &mut self, resources: &[Resource], location: u32, name: &str, ) -> Result<(), ErrorCode>

Renames an interface variable.

Source

pub fn get_active_interface_variables( &mut self, ) -> Result<HashSet<u32>, ErrorCode>

get the active interface variable.

Source

pub fn get_work_group_size_specialization_constants( &self, ) -> Result<WorkGroupSizeSpecializationConstants, ErrorCode>

Gets work group size specialization constants.

Source

pub fn parse(module: &Module<'_>) -> Result<Self, ErrorCode>

Parses a module into Ast.

Source

pub fn set_compiler_options( &mut self, options: &<Self as Compile<TTarget>>::CompilerOptions, ) -> Result<(), ErrorCode>

Sets compile options.

Source

pub fn compile(&mut self) -> Result<String, ErrorCode>

Compiles an abstract syntax tree to a String in the specified TTarget language.

Auto Trait Implementations§

§

impl<TTarget> Freeze for Ast<TTarget>
where <TTarget as Target>::Data: Freeze,

§

impl<TTarget> RefUnwindSafe for Ast<TTarget>
where <TTarget as Target>::Data: RefUnwindSafe, TTarget: RefUnwindSafe,

§

impl<TTarget> !Send for Ast<TTarget>

§

impl<TTarget> !Sync for Ast<TTarget>

§

impl<TTarget> Unpin for Ast<TTarget>
where <TTarget as Target>::Data: Unpin, TTarget: Unpin,

§

impl<TTarget> UnwindSafe for Ast<TTarget>
where <TTarget as Target>::Data: UnwindSafe, TTarget: UnwindSafe,

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.