Enable generation for ID2D1Shader.GetPixelOptions API

このコミットが含まれているのは:
Sergio Pedri committed 2022-05-08 21:50:17 +02:00
1 親 6fbdef8ce4
コミット b211932881
3ファイル変更
+91

検索条件に一致するファイルはありません

@@ -0,0 +1,31 @@
using ComputeSharp.SourceGeneration.Extensions;
using Microsoft.CodeAnalysis;
namespace ComputeSharp.D2D1.SourceGenerators;
/// <inheritdoc/>
partial class ID2D1ShaderGenerator
{
/// <summary>
/// A helper with all logic to generate the <c>GetPixelOptions</c> method.
/// </summary>
private static partial class GetPixelOptions
{
/// <summary>
/// Extracts the pixel options for the current shader.
/// </summary>
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
/// <param name="pixelOptions">The pixel options for the shader.</param>
public static void GetInfo(INamedTypeSymbol structDeclarationSymbol, out D2D1PixelOption pixelOptions)
{
if (structDeclarationSymbol.TryGetAttributeWithFullMetadataName("ComputeSharp.D2D1.D2DPixelOptionsAttribute", out AttributeData? attributeData))
{
pixelOptions = (D2D1PixelOption)attributeData!.ConstructorArguments[0].Value!;
}
else
{
pixelOptions = D2D1PixelOption.None;
}
}
}
}