diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs index 53127aed..77864746 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateInputDescriptionsProperty.Syntax.cs @@ -20,16 +20,16 @@ partial class ID2D1ShaderGenerator /// /// Creates a instance for the InputDescriptions property. /// - /// The input descriptions info gathered for the current shader. + /// The input descriptions info gathered for the current shader. /// Any additional instances needed by the generated code, if needed. /// The resulting instance for the InputDescriptions property. - public static PropertyDeclarationSyntax GetSyntax(InputDescriptionsInfo inputDescriptionsInfo, out TypeDeclarationSyntax[] additionalTypes) + public static PropertyDeclarationSyntax GetSyntax(EquatableArray inputDescriptions, out TypeDeclarationSyntax[] additionalTypes) { ExpressionSyntax memoryExpression; // If there are no input descriptions, just return a default expression. // Otherwise, declare the shared array and return it from the property. - if (inputDescriptionsInfo.InputDescriptions.Length == 0) + if (inputDescriptions.Length == 0) { memoryExpression = LiteralExpression(SyntaxKind.DefaultLiteralExpression, Token(SyntaxKind.DefaultKeyword)); additionalTypes = Array.Empty(); @@ -41,7 +41,7 @@ partial class ID2D1ShaderGenerator IdentifierName("Data"), IdentifierName(nameof(InputDescriptions))); - additionalTypes = new[] { GetArrayDeclaration(inputDescriptionsInfo) }; + additionalTypes = new[] { GetArrayDeclaration(inputDescriptions) }; } // This code produces a method declaration as follows: @@ -61,13 +61,13 @@ partial class ID2D1ShaderGenerator /// /// Gets the array declaration for the given input descriptions. /// - /// The input descriptions info gathered for the current shader. + /// The input descriptions info gathered for the current shader. /// The array declaration for the given input descriptions. - private static TypeDeclarationSyntax GetArrayDeclaration(InputDescriptionsInfo inputDescriptionsInfo) + private static TypeDeclarationSyntax GetArrayDeclaration(EquatableArray inputDescriptions) { using ImmutableArrayBuilder inputDescriptionExpressions = ImmutableArrayBuilder.Rent(); - foreach (InputDescription inputDescription in inputDescriptionsInfo.InputDescriptions) + foreach (InputDescription inputDescription in inputDescriptions) { // Create the description expression (excluding level of detail): // diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs index 479bcf69..eacecc0e 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.cs @@ -156,7 +156,7 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator HasErrors: diagnostics.Count > 0), BufferPrecision: bufferPrecision, ChannelDepth: channelDepth, - InputDescriptions: new InputDescriptionsInfo(inputDescriptions), + InputDescriptions: inputDescriptions, PixelOptions: pixelOptions, Diagnostcs: diagnostics.ToImmutable()); }) @@ -401,7 +401,7 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator }); // Get the InputDescriptions info (hierarchy and input descriptions) - IncrementalValuesProvider<(HierarchyInfo Hierarchy, InputDescriptionsInfo InputDescriptions)> inputDescriptionsInfo = + IncrementalValuesProvider<(HierarchyInfo Hierarchy, EquatableArray InputDescriptions)> inputDescriptionsInfo = shaderInfoWithErrors .Select(static (item, _) => (item.Hierarchy, item.InputDescriptions)); diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs index f0374179..b67295c7 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Models/D2D1ShaderInfo.cs @@ -36,6 +36,6 @@ internal sealed record D2D1ShaderInfo( HlslShaderSourceInfo HlslShaderSource, D2D1BufferPrecision BufferPrecision, D2D1ChannelDepth ChannelDepth, - InputDescriptionsInfo InputDescriptions, + EquatableArray InputDescriptions, D2D1PixelOptions PixelOptions, EquatableArray Diagnostcs); \ No newline at end of file diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs b/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs deleted file mode 100644 index 2ddb65f3..00000000 --- a/src/ComputeSharp.D2D1.SourceGenerators/Models/InputDescriptionsInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using ComputeSharp.SourceGeneration.Helpers; - -namespace ComputeSharp.D2D1.SourceGenerators.Models; - -/// -/// A model representing gathered input descriptions for a shader. -/// -/// The input descriptions for a given shader. -internal sealed record InputDescriptionsInfo(EquatableArray InputDescriptions); \ No newline at end of file