private static int GetNumInputs(D3D10Opcode opcode)
        {
            switch (opcode)
            {
            case D3D10Opcode.Frc:
            case D3D10Opcode.Mov:
            case D3D10Opcode.Rsq:
            case D3D10Opcode.Sqrt:
            case D3D10Opcode.SinCos:
                return(1);

            case D3D10Opcode.Add:
            case D3D10Opcode.Dp2:
            case D3D10Opcode.Dp3:
            case D3D10Opcode.Dp4:
            case D3D10Opcode.Max:
            case D3D10Opcode.Min:
            case D3D10Opcode.Mul:
                return(2);

            case D3D10Opcode.Mad:
                return(3);

            default:
                throw new NotImplementedException();
            }
        }
Exemple #2
0
        private D3D10Instruction ReadInstruction()
        {
            uint        opcodeToken = ReadUInt32();
            D3D10Opcode opcode      = (D3D10Opcode)(opcodeToken & 0x7FF);

            int operandCount = (int)((opcodeToken >> 24) & 0x7F) - 1;

            bool isExtended = (opcodeToken & 0x80000000) != 0;

            if (isExtended)
            {
                throw new NotImplementedException();
            }

            uint[] operandTokens = new uint[operandCount];
            for (int i = 0; i < operandCount; i++)
            {
                operandTokens[i] = ReadUInt32();
            }
            var instruction = new D3D10Instruction(opcode, operandTokens);

            return(instruction);
        }
 public D3D10Instruction(D3D10Opcode opcode, uint[] paramTokens)
 {
     Opcode        = opcode;
     OperandTokens = new D3D10OperandTokenCollection(paramTokens);
 }