/// Begins building of a new block.
///
/// If `label_id` is `Some(val)`, then `val` will be used as the result
/// id for the `OpLabel` instruction begining this block; otherwise,
/// a unused result id will be automatically assigned.
Begins building of a new block.
Begins building of a new block .
pub fn begin_block(&mut self, label_id: Option<spirv::Word>) -> BuildResult<spirv::Word> {
        let selected_function = match self.selected_function {
            Some(f) => f,
            None => return Err(Error::DetachedBlock),
        };
        if self.selected_block.is_some() {
            return Err(Error::NestedBlock);
        }
        let id = match label_id {
            Some(v) => v,
            None => self.id(),
        };
        let mut bb = dr::Block::new();
        bb.label = Some(dr::Instruction::new(
            spirv::Op::Label,
            None,
            Some(id),
            vec![],
        ));
        let blocks = &mut self.module.functions[selected_function].blocks;
        blocks.push(bb);
        self.selected_block = Some(blocks.len() - 1);
        Ok(id)
    }
pub fn begin_block ( & mut self , label_id : Option < spirv :: Word > ) -> BuildResult < spirv :: Word > { let selected_function = match self . selected_function { Some ( f ) => f , None => return Err ( Error :: DetachedBlock ) , } ; if self . selected_block . is_some ( ) { return Err ( Error :: NestedBlock ) ; } let id = match label_id { Some ( v ) => v , None => self . id ( ) , } ; let mut bb = dr :: Block :: new ( ) ; bb . label = Some ( dr :: Instruction :: new ( spirv :: Op :: Label , None , Some ( id ) , vec ! [ ] , ) ) ; let blocks = & mut self . module . functions [ selected_function ] . blocks ; blocks . push ( bb ) ; self . selected_block = Some ( blocks . len ( ) - 1 ) ; Ok ( id ) }
Begins building of a new block.
Begins building of a new block .
&mut self
label_id
Option<spirv::Word>