Add ID2D1Shader.ChannelDepth property and generate it
このコミットが含まれているのは:
1 親
81dd2e2b7e
コミット
a71c4db7dd
3ファイル変更
+47
検索条件に一致するファイルはありません
+35
@@ -50,6 +50,41 @@ partial class ID2D1ShaderGenerator
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="PropertyDeclarationSyntax"/> instance for the <c>ChannelDepth</c> property.
|
||||
/// </summary>
|
||||
/// <param name="info">The input info for the shader output buffer.</param>
|
||||
/// <returns>The resulting <see cref="PropertyDeclarationSyntax"/> instance for the <c>ChannelDepth</c> property.</returns>
|
||||
public static PropertyDeclarationSyntax GetChannelDepthSyntax(OutputBufferInfo info)
|
||||
{
|
||||
ExpressionSyntax channelDepthExpression;
|
||||
|
||||
// Set the right expression if the buffer options are valid
|
||||
if (Enum.IsDefined(typeof(D2D1ChannelDepth), info.ChannelDepth))
|
||||
{
|
||||
channelDepthExpression =
|
||||
MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName("ComputeSharp.D2D1.D2D1ChannelDepth"),
|
||||
IdentifierName(info.ChannelDepth.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise just return default (the analyzer will emit a diagnostic)
|
||||
channelDepthExpression = LiteralExpression(SyntaxKind.DefaultLiteralExpression, Token(SyntaxKind.DefaultKeyword));
|
||||
}
|
||||
|
||||
// This code produces a property declaration as follows:
|
||||
//
|
||||
// readonly ComputeSharp.D2D1.D2D1ChannelDepth global::ComputeSharp.D2D1.__Internals.ID2D1Shader.ChannelDepth => <CHANNEL_DEPTH>;
|
||||
return
|
||||
PropertyDeclaration(IdentifierName("ComputeSharp.D2D1.D2D1ChannelDepth"), Identifier("ChannelDepth"))
|
||||
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
|
||||
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
|
||||
.WithExpressionBody(ArrowExpressionClause(channelDepthExpression))
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="MethodDeclarationSyntax"/> instance for the <c>GetOutputBuffer</c> method.
|
||||
/// </summary>
|
||||
|
||||
@@ -403,6 +403,11 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
|
||||
CompilationUnitSyntax bufferPrecisionCompilationUnit = GetCompilationUnitFromMember(item.Hierarchy, bufferPrecisionProperty, canUseSkipLocalsInit: false);
|
||||
|
||||
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.BufferPrecision.g.cs", bufferPrecisionCompilationUnit.GetText(Encoding.UTF8));
|
||||
|
||||
PropertyDeclarationSyntax channelDepthProperty = GetOutputBuffer.GetChannelDepthSyntax(item.OutputBuffer);
|
||||
CompilationUnitSyntax channelDepthCompilationUnit = GetCompilationUnitFromMember(item.Hierarchy, channelDepthProperty, canUseSkipLocalsInit: false);
|
||||
|
||||
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.ChannelDepth.g.cs", channelDepthCompilationUnit.GetText(Encoding.UTF8));
|
||||
});
|
||||
|
||||
// Get the InputDescriptions info (hierarchy and input descriptions)
|
||||
|
||||
@@ -104,6 +104,13 @@ public interface ID2D1Shader
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1BufferPrecision BufferPrecision { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel depth for the shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
D2D1ChannelDepth ChannelDepth { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the output buffer precision and depth for the shader.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする