Пример #1
0
        public static DebugLibraryParameterDescription Parse(DebugBytecodeReader reader,
                                                             DebugBytecodeReader paramReader)
        {
            var nameOffset         = paramReader.ReadUInt32("NameOffset");
            var semanticNameOffset = paramReader.ReadUInt32("SemanticNameOffset");
            var result             = new DebugLibraryParameterDescription()
            {
                VariableType      = paramReader.ReadEnum32 <ShaderVariableType>("VariableType"),
                VariableClass     = paramReader.ReadEnum32 <ShaderVariableClass>("VariableClass"),
                Rows              = paramReader.ReadUInt32("Rows"),
                Column            = paramReader.ReadUInt32("Column"),
                InterpolationMode = paramReader.ReadEnum32 <InterpolationMode>("InterpolationMode"),
                Flags             = paramReader.ReadEnum32 <ParameterFlags>("Flags"),
                FirstInRegister   = paramReader.ReadUInt32("FirstInRegister"),
                FirstInComponent  = paramReader.ReadUInt32("FirstInComponent"),
                FirstOutRegister  = paramReader.ReadUInt32("FirstOutRegister"),
                FirstOutComponent = paramReader.ReadUInt32("FirstOutComponent"),
            };
            var nameReader = reader.CopyAtOffset("NameReader", paramReader, (int)nameOffset);

            result.Name = nameReader.ReadString("Name");

            if (semanticNameOffset != 0)
            {
                var semanticNameReader = reader.CopyAtOffset("SemanticNameReader", paramReader, (int)semanticNameOffset);
                result.SemanticName = semanticNameReader.ReadString("SemanticName");
            }
            else
            {
                result.SemanticName = "";
            }
            return(result);
        }
        public static DebugLibraryParameterSignatureChunk Parse(DebugBytecodeReader reader, uint chunkSize)
        {
            var result          = new DebugLibraryParameterSignatureChunk();
            var chunkReader     = reader.CopyAtCurrentPosition("LibraryParameterSignatureChunkReader", reader);
            var parameterCount  = chunkReader.ReadUInt32("ParameterCount");
            var parameterOffset = chunkReader.ReadUInt32("ParameterOffset");

            for (int i = 0; i < parameterCount; i++)
            {
                var parameterReader = chunkReader.CopyAtOffset($"ParameterReader{i}", chunkReader, (int)parameterOffset + 12 * 4 * i);
                result.Parameters.Add(DebugLibraryParameterDescription.Parse(reader, parameterReader));
            }
            return(result);
        }