using ComputeSharp.SourceGeneration.Extensions; using Microsoft.CodeAnalysis; namespace ComputeSharp.D2D1.SourceGenerators; /// partial class ID2D1ShaderGenerator { /// /// A helper with all logic to generate the GetPixelOptions method. /// private static partial class GetPixelOptions { /// /// 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 D2D1PixelOption pixelOptions) { if (structDeclarationSymbol.TryGetAttributeWithFullMetadataName("ComputeSharp.D2D1.D2DPixelOptionsAttribute", out AttributeData? attributeData)) { pixelOptions = (D2D1PixelOption)attributeData!.ConstructorArguments[0].Value!; } else { pixelOptions = D2D1PixelOption.None; } } } }