pub fn select_function_by_name(&mut self, name: &str) -> BuildResult<()> {
        for dbg in &self.module.debug_names {
            if dbg.class.opcode == spirv::Op::Name {
                if let dr::Operand::IdRef(target_id) = dbg.operands[0] {
                    if let dr::Operand::LiteralString(found_name) = &dbg.operands[1] {
                        if found_name == name {
                            for (idx, func) in self.module.functions.iter().enumerate() {
                                if func.def.as_ref().unwrap().result_id.unwrap() == target_id {
                                    return self.select_function(Some(idx));
                                }
                            }
                        }
                    }
                }
            }
        }

        Err(Error::FunctionNotFound)
    }
/// Select a function to insert instructions into by name
Select a function to insert instructions into by name
Select a function to insert instructions into by name
pub fn select_function_by_name(&mut self, name: &str) -> BuildResult<()> {
        for dbg in &self.module.debug_names {
            if dbg.class.opcode == spirv::Op::Name {
                if let dr::Operand::IdRef(target_id) = dbg.operands[0] {
                    if let dr::Operand::LiteralString(found_name) = &dbg.operands[1] {
                        if found_name == name {
                            for (idx, func) in self.module.functions.iter().enumerate() {
                                if func.def.as_ref().unwrap().result_id.unwrap() == target_id {
                                    return self.select_function(Some(idx));
                                }
                            }
                        }
                    }
                }
            }
        }
        Err(Error::FunctionNotFound)
    }
pub fn select_function_by_name ( & mut self , name : & str ) -> BuildResult < ( ) > { for dbg in & self . module . debug_names { if dbg . class . opcode == spirv :: Op :: Name { if let dr :: Operand :: IdRef ( target_id ) = dbg . operands [ 0 ] { if let dr :: Operand :: LiteralString ( found_name ) = & dbg . operands [ 1 ] { if found_name == name { for ( idx , func ) in self . module . functions . iter ( ) . enumerate ( ) { if func . def . as_ref ( ) . unwrap ( ) . result_id . unwrap ( ) == target_id { return self . select_function ( Some ( idx ) ) ; } } } } } } } Err ( Error :: FunctionNotFound ) }
Select a function to insert instructions into by name
Select a function to insert instructions into by name
&mut self
name
&str
&mut self
name
&str