コード例 #1
0
        public static InputRegisterDeclarationToken Parse(BytecodeReader reader)
        {
            uint token0     = reader.ReadUInt32();
            var  opcodeType = token0.DecodeValue <OpcodeType>(0, 10);

            InputRegisterDeclarationToken result;

            switch (opcodeType)
            {
            case OpcodeType.DclInput:
            case OpcodeType.DclInputSgv:
            case OpcodeType.DclInputSiv:
                result = new InputRegisterDeclarationToken();
                break;

            case OpcodeType.DclInputPs:
            case OpcodeType.DclInputPsSgv:
            case OpcodeType.DclInputPsSiv:
                result = new PixelShaderInputRegisterDeclarationToken
                {
                    InterpolationMode = token0.DecodeValue <InterpolationMode>(11, 14)
                };
                break;

            default:
                throw new ParseException("Unrecognised opcode type: " + opcodeType);
            }

            result.Operand = Operand.Parse(reader, opcodeType);

            switch (opcodeType)
            {
            case OpcodeType.DclInputSgv:
            case OpcodeType.DclInputSiv:
            case OpcodeType.DclInputPsSgv:
            case OpcodeType.DclInputPsSiv:
                result.SystemValueName = NameToken.Parse(reader);
                break;
            }

            return(result);
        }
コード例 #2
0
        public static OutputRegisterDeclarationToken Parse(BytecodeReader reader)
        {
            uint token0     = reader.ReadUInt32();
            var  opcodeType = token0.DecodeValue <OpcodeType>(0, 10);

            var result = new OutputRegisterDeclarationToken
            {
                Operand = Operand.Parse(reader, opcodeType)
            };

            switch (opcodeType)
            {
            case OpcodeType.DclOutputSgv:
            case OpcodeType.DclOutputSiv:
                result.SystemValueName = NameToken.Parse(reader);
                break;
            }

            return(result);
        }