using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; namespace ComputeSharp.D2D1.SourceGenerators; /// partial class D2DPixelShaderDescriptorGenerator { /// /// A helper with all logic to generate the PixelOptions property. /// private static partial class PixelOptions { /// /// Extracts the pixel options for the current shader. /// /// The input instance to process. /// The pixel options for the shader. public static void GetInfo(INamedTypeSymbol structDeclarationSymbol, out D2D1PixelOptions pixelOptions) { if (structDeclarationSymbol.TryGetAttributeWithFullyQualifiedMetadataName("ComputeSharp.D2D1.D2DPixelOptionsAttribute", out AttributeData? attributeData)) { pixelOptions = (D2D1PixelOptions)attributeData.ConstructorArguments[0].Value!; } else { pixelOptions = D2D1PixelOptions.None; } } } }