public bool Remove(InstructionWithId instruction)
 {
     if (instruction.IdResult == 0)
     {
         throw new ArgumentException("Instruction should have not zeo IdResult");
     }
     return(_instructions.Remove(instruction.IdResult));
 }
Exemple #2
0
 public void Add(InstructionWithId instruction)
 {
     if (instruction.IdResult == 0)
     {
         throw new ArgumentException("Instruction should have not zeo IdResult");
     }
     _instructions.Add(instruction.IdResult, instruction);
 }
 public static LiteralContextDependentNumber ParseOptional(WordReader reader, uint wordCount,
                                                           InstructionWithId type)
 {
     if (wordCount == 0)
     {
         return(null);
     }
     return(Parse(reader, wordCount, type));
 }
Exemple #4
0
 public IdRef(InstructionWithId instruction)
 {
     _id = instruction.IdResult;
     if (_id == 0)
     {
         throw new ArgumentException("Instruction IdResult should not be zeo.");
     }
     _instruction = instruction;
     _registry    = null;
 }
        public static IList <LiteralContextDependentNumber> ParseCollection(WordReader reader, uint wordCount,
                                                                            InstructionWithId type)
        {
            var end = reader.Position + wordCount;
            var res = new PrintableList <LiteralContextDependentNumber>();

            while (reader.Position < end)
            {
                res.Add(Parse(reader, end - reader.Position, type));
            }
            return(res);
        }
        public static LiteralContextDependentNumber Parse(WordReader reader, uint wordCount, InstructionWithId type)
        {
            var typeInstruction = (TypeInstruction)type;
            var size            = typeInstruction.SizeInWords;

            return(new LiteralContextDependentNumber(new Value(reader.ReadBytes(size), typeInstruction)));
        }
Exemple #7
0
 public IdRef(InstructionWithId instruction, InstructionRegistry registry)
 {
     _id          = instruction.IdResult;
     _instruction = instruction;
     _registry    = registry;
 }
Exemple #8
0
 public IdRef(uint id, InstructionRegistry registry)
 {
     _id          = id;
     _registry    = registry;
     _instruction = null;
 }
Exemple #9
0
 public void AddType(InstructionWithId instruction, SpirvTypeBase type)
 {
     _nodeMap.Add(instruction.IdResult, type);
     TypeInstructions.Add(type);
 }