diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.HlslSource.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.HlslSource.cs index e6c8dc8b..8372f9a7 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.HlslSource.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.HlslSource.cs @@ -51,6 +51,7 @@ partial class D2DPixelShaderDescriptorGenerator HashSet discoveredTypes = new(SymbolEqualityComparer.Default); Dictionary staticMethods = new(SymbolEqualityComparer.Default); Dictionary instanceMethods = new(SymbolEqualityComparer.Default); + Dictionary constructors = new(SymbolEqualityComparer.Default); Dictionary constantDefinitions = new(SymbolEqualityComparer.Default); token.ThrowIfCancellationRequested(); @@ -75,6 +76,7 @@ partial class D2DPixelShaderDescriptorGenerator discoveredTypes, staticMethods, instanceMethods, + constructors, constantDefinitions, token, out bool methodsNeedD2D1RequiresScenePosition); @@ -97,7 +99,8 @@ partial class D2DPixelShaderDescriptorGenerator diagnostics, structDeclarationSymbol, discoveredTypes, - instanceMethods); + instanceMethods, + constructors); token.ThrowIfCancellationRequested(); @@ -306,6 +309,7 @@ partial class D2DPixelShaderDescriptorGenerator /// The collection of currently discovered types. /// The set of discovered and processed static methods. /// The collection of discovered instance methods for custom struct types. + /// The collection of discovered constructors for custom struct types. /// The collection of discovered constant definitions. /// Whether or not the shader needs the [D2DRequiresScenePosition] annotation. /// The used to cancel the operation, if needed. @@ -317,6 +321,7 @@ partial class D2DPixelShaderDescriptorGenerator ICollection discoveredTypes, IDictionary staticMethods, IDictionary instanceMethods, + IDictionary constructors, IDictionary constantDefinitions, CancellationToken token, out bool needsD2D1RequiresScenePosition) @@ -360,6 +365,7 @@ partial class D2DPixelShaderDescriptorGenerator discoveredTypes, staticMethods, instanceMethods, + constructors, constantDefinitions, diagnostics, isShaderEntryPoint); diff --git a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs index 9444cf9a..825ce3f9 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs @@ -557,19 +557,19 @@ partial class DiagnosticDescriptors helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); /// - /// Gets a for a method invocation that is not valid from a shader. + /// Gets a for a method or constructor invocation that is not valid from a shader. /// - /// Format: "The method {0} cannot be used in a D2D1 shader (methods need to either be HLSL intrinsics or with source available for analysis)". + /// Format: "The method or constructor {0} cannot be used in a D2D1 shader (methods or constructors need to either be HLSL intrinsics or with source available for analysis)". /// /// - public static readonly DiagnosticDescriptor InvalidMethodCall = new( + public static readonly DiagnosticDescriptor InvalidMethodOrConstructorCall = new( id: "CMPSD2D0040", - title: "Invalid method invocation from a D2D1 shader", - messageFormat: "The method {0} cannot be used in a D2D1 shader (methods need to either be HLSL intrinsics or with source available for analysis)", + title: "Invalid method or constructor invocation from a D2D1 shader", + messageFormat: "The method or constructor {0} cannot be used in a D2D1 shader (methods or constructors need to either be HLSL intrinsics or with source available for analysis)", category: "ComputeSharp.D2D1.Shaders", defaultSeverity: DiagnosticSeverity.Error, isEnabledByDefault: true, - description: "A D2D1 shader can only invoke methods that are either HLSL intrinsics or with source available for analysis.", + description: "A D2D1 shader can only invoke methods or constructors that are either HLSL intrinsics or with source available for analysis.", helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); /// diff --git a/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs index e4f5f35e..c4992e5b 100644 --- a/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs @@ -672,7 +672,7 @@ partial class DiagnosticDescriptors /// /// Gets a for a method or constructor invocation that is not valid from a shader. /// - /// Format: "The method or constructor {0} cannot be used in a shader (methods need to either be HLSL intrinsics or with source available for analysis)". + /// Format: "The method or constructor {0} cannot be used in a shader (methods or constructors need to either be HLSL intrinsics or with source available for analysis)". /// /// public static readonly DiagnosticDescriptor InvalidMethodOrConstructorCall = new(