pub fn variable(
        &mut self,
        result_type: spirv::Word,
        result_id: Option<spirv::Word>,
        storage_class: spirv::StorageClass,
        initializer: Option<spirv::Word>,
    ) -> spirv::Word {
        let id = match result_id {
            Some(v) => v,
            None => self.id(),
        };
        let mut operands = vec![dr::Operand::StorageClass(storage_class)];
        if let Some(val) = initializer {
            operands.push(dr::Operand::IdRef(val));
        }
        let inst = dr::Instruction::new(spirv::Op::Variable, Some(result_type), Some(id), operands);

        match (self.selected_function, self.selected_block) {
            (Some(selected_function), Some(selected_block)) => {
                self.module.functions[selected_function].blocks[selected_block]
                    .instructions
                    .push(inst)
            }
            _ => self.module.types_global_values.push(inst),
        }
        id
    }
/// Appends an OpVariable instruction to either the current block
/// or the module if no block is under construction.
Appends an OpVariable instruction to either the current block
or the module if no block is under construction.
Appends an OpVariable instruction to either the current block or the module if no block is under construction .
pub fn variable(
        &mut self,
        result_type: spirv::Word,
        result_id: Option<spirv::Word>,
        storage_class: spirv::StorageClass,
        initializer: Option<spirv::Word>,
    ) -> spirv::Word {
        let id = match result_id {
            Some(v) => v,
            None => self.id(),
        };
        let mut operands = vec![dr::Operand::StorageClass(storage_class)];
        if let Some(val) = initializer {
            operands.push(dr::Operand::IdRef(val));
        }
        let inst = dr::Instruction::new(spirv::Op::Variable, Some(result_type), Some(id), operands);
        match (self.selected_function, self.selected_block) {
            (Some(selected_function), Some(selected_block)) => {
                self.module.functions[selected_function].blocks[selected_block]
                    .instructions
                    .push(inst)
            }
            _ => self.module.types_global_values.push(inst),
        }
        id
    }
pub fn variable ( & mut self , result_type : spirv :: Word , result_id : Option < spirv :: Word > , storage_class : spirv :: StorageClass , initializer : Option < spirv :: Word > , ) -> spirv :: Word { let id = match result_id { Some ( v ) => v , None => self . id ( ) , } ; let mut operands = vec ! [ dr Operand StorageClass ( storage_class ) ] ; if let Some ( val ) = initializer { operands . push ( dr :: Operand :: IdRef ( val ) ) ; } let inst = dr :: Instruction :: new ( spirv :: Op :: Variable , Some ( result_type ) , Some ( id ) , operands ) ; match ( self . selected_function , self . selected_block ) { ( Some ( selected_function ) , Some ( selected_block ) ) => { self . module . functions [ selected_function ] . blocks [ selected_block ] . instructions . push ( inst ) } _ => self . module . types_global_values . push ( inst ) , } id }
Appends an OpVariable instruction to either the current block
or the module if no block is under construction.
Appends an OpVariable instruction to either the current block or the module if no block is under construction .
&mut self
result_type
spirv::Word
result_id
Option<spirv::Word>
storage_class
spirv::StorageClass
initializer
Option<spirv::Word>
&mut self
result_type
spirv::Word
result_id
Option<spirv::Word>
storage_class
spirv::StorageClass
initializer
Option<spirv::Word>