pub struct SpirVInstruction {
pub result_id: Option<u32>,
pub result_type_id: Option<u32>,
pub opcode: SpirVOp,
pub operands: Vec<u32>,
}Expand description
A single SPIR-V instruction.
Every instruction has an opcode, optional result ID, and a list of word operands. The result type ID is stored as the first operand when the instruction produces a value.
Fields§
§result_id: Option<u32>Result ID assigned to this instruction (None for side-effecting ops)
result_type_id: Option<u32>Result type ID (present iff result_id is Some)
opcode: SpirVOpThe SPIR-V opcode
operands: Vec<u32>Additional word operands (IDs, literals, enumerants)
Implementations§
Source§impl SpirVInstruction
impl SpirVInstruction
Sourcepub fn with_result(
result_id: u32,
result_type_id: u32,
opcode: SpirVOp,
operands: Vec<u32>,
) -> Self
pub fn with_result( result_id: u32, result_type_id: u32, opcode: SpirVOp, operands: Vec<u32>, ) -> Self
Create an instruction that produces a result value.
Sourcepub fn no_result(opcode: SpirVOp, operands: Vec<u32>) -> Self
pub fn no_result(opcode: SpirVOp, operands: Vec<u32>) -> Self
Create an instruction without a result (e.g., OpStore, OpReturn).
Sourcepub fn word_count(&self) -> u32
pub fn word_count(&self) -> u32
Estimate the word count of this instruction.
Trait Implementations§
Source§impl Clone for SpirVInstruction
impl Clone for SpirVInstruction
Source§fn clone(&self) -> SpirVInstruction
fn clone(&self) -> SpirVInstruction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpirVInstruction
impl Debug for SpirVInstruction
Source§impl PartialEq for SpirVInstruction
impl PartialEq for SpirVInstruction
impl StructuralPartialEq for SpirVInstruction
Auto Trait Implementations§
impl Freeze for SpirVInstruction
impl RefUnwindSafe for SpirVInstruction
impl Send for SpirVInstruction
impl Sync for SpirVInstruction
impl Unpin for SpirVInstruction
impl UnsafeUnpin for SpirVInstruction
impl UnwindSafe for SpirVInstruction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more