Plug constructors support into D2D generator too

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-02 19:46:55 +01:00
1 親 1660c8ca1b
コミット 7a1aed7890
3ファイル変更
+14 -8

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

+7 -1
ファイルの表示
@@ -51,6 +51,7 @@ partial class D2DPixelShaderDescriptorGenerator
HashSet<INamedTypeSymbol> discoveredTypes = new(SymbolEqualityComparer.Default);
Dictionary<IMethodSymbol, MethodDeclarationSyntax> staticMethods = new(SymbolEqualityComparer.Default);
Dictionary<IMethodSymbol, MethodDeclarationSyntax> instanceMethods = new(SymbolEqualityComparer.Default);
Dictionary<IMethodSymbol, (MethodDeclarationSyntax, MethodDeclarationSyntax)> constructors = new(SymbolEqualityComparer.Default);
Dictionary<IFieldSymbol, string> 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
/// <param name="discoveredTypes">The collection of currently discovered types.</param>
/// <param name="staticMethods">The set of discovered and processed static methods.</param>
/// <param name="instanceMethods">The collection of discovered instance methods for custom struct types.</param>
/// <param name="constructors">The collection of discovered constructors for custom struct types.</param>
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
/// <param name="needsD2D1RequiresScenePosition">Whether or not the shader needs the <c>[D2DRequiresScenePosition]</c> annotation.</param>
/// <param name="token">The <see cref="CancellationToken"/> used to cancel the operation, if needed.</param>
@@ -317,6 +321,7 @@ partial class D2DPixelShaderDescriptorGenerator
ICollection<INamedTypeSymbol> discoveredTypes,
IDictionary<IMethodSymbol, MethodDeclarationSyntax> staticMethods,
IDictionary<IMethodSymbol, MethodDeclarationSyntax> instanceMethods,
IDictionary<IMethodSymbol, (MethodDeclarationSyntax, MethodDeclarationSyntax)> constructors,
IDictionary<IFieldSymbol, string> constantDefinitions,
CancellationToken token,
out bool needsD2D1RequiresScenePosition)
@@ -360,6 +365,7 @@ partial class D2DPixelShaderDescriptorGenerator
discoveredTypes,
staticMethods,
instanceMethods,
constructors,
constantDefinitions,
diagnostics,
isShaderEntryPoint);
+6 -6
ファイルの表示
@@ -557,19 +557,19 @@ partial class DiagnosticDescriptors
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for a method invocation that is not valid from a shader.
/// Gets a <see cref="DiagnosticDescriptor"/> for a method or constructor invocation that is not valid from a shader.
/// <para>
/// Format: <c>"The method {0} cannot be used in a D2D1 shader (methods need to either be HLSL intrinsics or with source available for analysis)"</c>.
/// Format: <c>"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)"</c>.
/// </para>
/// </summary>
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");
/// <summary>
+1 -1
ファイルの表示
@@ -672,7 +672,7 @@ partial class DiagnosticDescriptors
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for a method or constructor invocation that is not valid from a shader.
/// <para>
/// Format: <c>"The method or constructor {0} cannot be used in a shader (methods need to either be HLSL intrinsics or with source available for analysis)"</c>.
/// Format: <c>"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)"</c>.
/// </para>
/// </summary>
public static readonly DiagnosticDescriptor InvalidMethodOrConstructorCall = new(