public static ShaderMessageDeclarationToken Parse(BytecodeReader reader)
        {
            var token0 = reader.ReadUInt32();
            var length = reader.ReadUInt32() - 2;

            var result = new ShaderMessageDeclarationToken
            {
                DeclarationLength  = length,
                InfoQueueMessageID = reader.ReadUInt32(),
                MessageFormat      = (ShaderMessageFormat)reader.ReadUInt32(),
                NumCharacters      = reader.ReadUInt32(),
                NumOperands        = reader.ReadUInt32(),
                OperandsLength     = reader.ReadUInt32()
            };

            for (int i = 0; i < result.NumOperands; i++)
            {
                result.Operands.Add(Operand.Parse(reader, OpcodeType.CustomData));
            }

            result.Format = reader.ReadString();

            // String is padded to a multiple of DWORDs.
            uint remainingBytes = (4 - ((result.NumCharacters + 1) % 4)) % 4;

            reader.ReadBytes((int)remainingBytes);

            return(result);
        }
Exemple #2
0
        public static CustomDataToken Parse(BytecodeReader reader, uint token0)
        {
            var             customDataClass = token0.DecodeValue <CustomDataClass>(11, 31);
            CustomDataToken token;

            switch (customDataClass)
            {
            case CustomDataClass.DclImmediateConstantBuffer:
                token = ImmediateConstantBufferDeclarationToken.Parse(reader);
                break;

            case CustomDataClass.ShaderMessage:
                token = ShaderMessageDeclarationToken.Parse(reader);
                break;

            default:
                throw new ParseException("Unknown custom data class: " + customDataClass);
            }

            token.CustomDataClass = customDataClass;
            return(token);
        }