public static DebugShaderMessageDeclarationToken Parse(DebugBytecodeReader reader)
        {
            var token0 = reader.ReadUInt32("token0");

            DebugOpcodeHeader.AddNotes(reader, token0);
            var member = reader.LocalMembers.Last();
            var length = reader.ReadUInt32("length") - 2;

            var result = new DebugShaderMessageDeclarationToken
            {
                DeclarationLength  = length,
                InfoQueueMessageID = reader.ReadUInt32("InfoQueueMessageID"),
                MessageFormat      = reader.ReadEnum32 <ShaderMessageFormat>("MessageFormat"),
                NumCharacters      = reader.ReadUInt32("NumCharacters"),
                NumOperands        = reader.ReadUInt32("NumOperands"),
                OperandsLength     = reader.ReadUInt32("OperandsLength")
            };

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

            result.Format = reader.ReadString("Format");

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

            reader.ReadBytes("StringPadding", (int)remainingBytes);

            return(result);
        }
Example #2
0
        public static DebugCustomDataToken Parse(DebugBytecodeReader reader, uint token0)
        {
            DebugOpcodeHeader.AddNotes(reader, token0);
            var customDataClass = token0.DecodeValue <CustomDataClass>(11, 31);
            var member          = reader.LocalMembers.Last();
            DebugCustomDataToken token;

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

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

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

            token.CustomDataClass = customDataClass;
            member.AddNote("CustomDataClass", customDataClass);
            return(token);
        }