Пример #1
0
 /// <summary>
 /// Creates a <see cref="MethodDeclarationSyntax"/> instance for the <c>GetOutputBuffer</c> method.
 /// </summary>
 /// <param name="info">The input info for the shader output buffer.</param>
 /// <returns>The resulting <see cref="MethodDeclarationSyntax"/> instance for the <c>GetOutputBuffer</c> method.</returns>
 public static MethodDeclarationSyntax GetSyntax(OutputBufferInfo info)
 {
     // This code produces a method declaration as follows:
     //
     // readonly void global::ComputeSharp.D2D1.__Internals.ID2D1Shader.GetOutputBuffer(out uint precision, out uint depth)
     // {
     //     precision = <BUFFER_PRECISION>;
     //     depth = <CHANNEL_DEPTH>;
     // }
     return
         (MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(nameof(GetOutputBuffer)))
          .WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
          .AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
          .AddParameterListParameters(
              Parameter(Identifier("precision")).AddModifiers(Token(SyntaxKind.OutKeyword)).WithType(PredefinedType(Token(SyntaxKind.UIntKeyword))),
              Parameter(Identifier("depth")).AddModifiers(Token(SyntaxKind.OutKeyword)).WithType(PredefinedType(Token(SyntaxKind.UIntKeyword))))
          .WithBody(Block(
                        ExpressionStatement(
                            AssignmentExpression(
                                SyntaxKind.SimpleAssignmentExpression,
                                IdentifierName("precision"),
                                LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal((int)info.BufferPrecision)))),
                        ExpressionStatement(
                            AssignmentExpression(
                                SyntaxKind.SimpleAssignmentExpression,
                                IdentifierName("depth"),
                                LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal((int)info.ChannelDepth)))))));
 }
Пример #2
0
        public TaskInfo(
            TaskStatus taskStatus,
            DateTime lastHeartbeat,
            OutputBufferInfo outputBuffers,
            HashSet <PlanNodeId> noMoreSplits,
            TaskStats stats,
            bool needsPlan,
            bool complete
            )
        {
            this.TaskStatus    = taskStatus ?? throw new ArgumentNullException("taskStatus");
            this.LastHeartbeat = lastHeartbeat;
            this.OutputBuffers = outputBuffers ?? throw new ArgumentNullException("outputBuffers");
            this.NoMoreSplits  = noMoreSplits ?? throw new ArgumentNullException("noMoreSplits");
            this.Stats         = stats ?? throw new ArgumentNullException("stats");

            this.NeedsPlan = needsPlan;
            this.Complete  = complete;
        }