diff --git a/src/ComputeSharp.SourceGenerators/AnalyzerReleases.Shipped.md b/src/ComputeSharp.SourceGenerators/AnalyzerReleases.Shipped.md index 9507ad4e..74fadd53 100644 --- a/src/ComputeSharp.SourceGenerators/AnalyzerReleases.Shipped.md +++ b/src/ComputeSharp.SourceGenerators/AnalyzerReleases.Shipped.md @@ -43,16 +43,13 @@ CMPS0033 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentatio CMPS0034 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0035 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0036 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0037 | ComputeSharp.SourceGenerators.AutoConstructorGenerator | Warning | AutoConstructorGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0040 | ComputeSharp.SourceGenerators.IShaderGenerator | Warning | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0041 | ComputeSharp.SourceGenerators.ShaderMethodSourceGenerator | Warning | ShaderMethodSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) +CMPS0037 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) +CMPS0038 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) +CMPS0039 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) +CMPS0040 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) +CMPS0041 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0042 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0043 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0044 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0045 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) CMPS0046 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0047 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0048 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0049 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0050 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) -CMPS0051 | ComputeSharp.IComputeShader | Error | IShaderGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp) diff --git a/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs b/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs index 1e5cf347..7f11ded0 100644 --- a/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs +++ b/src/ComputeSharp.SourceGenerators/Diagnostics/DiagnosticDescriptors.cs @@ -496,59 +496,11 @@ internal static class DiagnosticDescriptors description: "String literal expressions cannot be used in a compute shader.", helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); - /// - /// Gets a for an internal error in . - /// - /// Format: "The generator AutoConstructorGenerator failed to execute on type {0}, and its constructor might not be available". - /// - /// - public static readonly DiagnosticDescriptor AutoConstructorGeneratorError = new( - id: "CMPS0037", - title: $"Internal error for {nameof(AutoConstructorGenerator)}", - messageFormat: $"The generator {nameof(AutoConstructorGenerator)} failed to execute on type {{0}}, and its constructor might not be available", - category: typeof(AutoConstructorGenerator).FullName, - defaultSeverity: DiagnosticSeverity.Warning, - isEnabledByDefault: true, - description: $"The {nameof(AutoConstructorGenerator)} generator encountered an error while processing a type, and its constructor might not be available. Please report this issue at https://github.com/Sergio0694/ComputeSharp/issues.", - helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); - - /// - /// Gets a for an internal error in . - /// - /// Format: "The generator IShaderGenerator failed to execute on type {0}, and trying to use that shader might result in a runtime crash". - /// - /// - public static readonly DiagnosticDescriptor IShaderGeneratorError = new( - id: "CMPS0040", - title: $"Internal error for {nameof(IShaderGenerator)}", - messageFormat: $"The generator {nameof(IShaderGenerator)} failed to execute on type {{0}}, and trying to use that shader might result in a runtime crash", - category: typeof(IShaderGenerator).FullName, - defaultSeverity: DiagnosticSeverity.Warning, - isEnabledByDefault: true, - description: $"The {nameof(IShaderGenerator)} generator encountered an error while processing a type, and trying to use that shader might result in a runtime crash. Please report this issue at https://github.com/Sergio0694/ComputeSharp/issues.", - helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); - - /// - /// Gets a for an internal error in . - /// - /// Format: "The generator ShaderMethodSourceGenerator failed to execute on method {0}, and using it in a shader might result in a runtime crash". - /// - /// - public static readonly DiagnosticDescriptor ShaderMethodSourceGeneratorError = new( - id: "CMPS0041", - title: $"Internal error for {nameof(ShaderMethodSourceGenerator)}", - messageFormat: $"The generator {nameof(ShaderMethodSourceGenerator)} failed to execute on method {{0}}, and using it in a shader might result in a runtime crash", - category: typeof(ShaderMethodSourceGenerator).FullName, - defaultSeverity: DiagnosticSeverity.Warning, - isEnabledByDefault: true, - description: $"The {nameof(ShaderMethodSourceGenerator)} generator encountered an error while processing a method, and using it in a shader might result in a runtime crash. Please report this issue at https://github.com/Sergio0694/ComputeSharp/issues.", - helpLinkUri: "https://github.com/Sergio0694/ComputeSharp"); - /// /// Gets a for an incorrect matrix swizzling property argument. /// public static readonly DiagnosticDescriptor NonConstantMatrixSwizzledIndex = new( - id: "CMPS0042", + id: "CMPS0037", title: "Non constant matrix swizzled property argument", messageFormat: "The arguments in a swizzled indexer for a matrix type must be compile-time constants", category: typeof(ShaderMethodSourceGenerator).FullName, @@ -564,7 +516,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor InvalidShaderStaticFieldType = new( - id: "CMPS0043", + id: "CMPS0038", title: "Invalid shader static field type", messageFormat: "The compute shader of type {0} contains a static field \"{1}\" of an invalid type {2} (only primitive, vector and matrix types are supported)", category: typeof(IComputeShader).FullName, @@ -577,7 +529,7 @@ internal static class DiagnosticDescriptors /// Gets a for an invalid usage. /// public static readonly DiagnosticDescriptor InvalidDispatchSizeUsage = new( - id: "CMPS0044", + id: "CMPS0039", title: "Invalid DispatchSize usage", messageFormat: "The DispatchSize type can only be used within the main body of a compute shader", category: typeof(IComputeShader).FullName, @@ -590,7 +542,7 @@ internal static class DiagnosticDescriptors /// Gets a for a property declaration. /// public static readonly DiagnosticDescriptor PropertyDeclaration = new( - id: "CMPS0045", + id: "CMPS0040", title: "Property declaration", messageFormat: "Property declarations cannot be used in a compute shader", category: typeof(IComputeShader).FullName, @@ -606,7 +558,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor ShaderDispatchDataSizeExceeded = new( - id: "CMPS0046", + id: "CMPS0041", title: "Shader dispatch data size exceeded", messageFormat: "The compute shader of type {0} has exceeded the maximum allowed size for captured values and resources", category: typeof(IComputeShader).FullName, @@ -622,7 +574,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor MultipleShaderTypesImplemented = new( - id: "CMPS0047", + id: "CMPS0042", title: "Multiple shader implementations for type declaration", messageFormat: $"The shader of type {{0}} cannot implement more than one shader interface", category: typeof(IShaderGenerator).FullName, @@ -638,7 +590,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor EmbeddedBytecodeWithDynamicShader = new( - id: "CMPS0048", + id: "CMPS0043", title: "Embedded bytecode for dynamic shader", messageFormat: $"The shader of type {{0}} cannot be precompiled, as it is dynamic (it captures delegate fields)", category: typeof(IShaderGenerator).FullName, @@ -654,7 +606,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor InvalidEmbeddedBytecodeThreadIds = new( - id: "CMPS0049", + id: "CMPS0044", title: "Invalid thread ids for shader with embedded bytecode", messageFormat: $"The shader of type {{0}} is annotated with invalid thread ids values ({{1}}, {{2}}, {{3}})", category: typeof(IShaderGenerator).FullName, @@ -670,7 +622,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor EmbeddedBytecodeFailedWithWin32Exception = new( - id: "CMPS0050", + id: "CMPS0045", title: "Embedded bytecode compilation failed due to Win32 exception", messageFormat: $"The shader of type {{0}} failed to compile due to a Win32 exception (HRESULT: {{1:X8}}, Message: \"{{2}}\")", category: typeof(IShaderGenerator).FullName, @@ -686,7 +638,7 @@ internal static class DiagnosticDescriptors /// /// public static readonly DiagnosticDescriptor EmbeddedBytecodeFailedWithHlslCompilationException = new( - id: "CMPS0051", + id: "CMPS0046", title: "Embedded bytecode compilation failed due to an HLSL compiler error", messageFormat: $"The shader of type {{0}} failed to compile due to an HLSL compiler error (Message: \"{{1}}\")", category: typeof(IShaderGenerator).FullName, diff --git a/src/ComputeSharp.SourceGenerators/Extensions/ISymbolExtensions.cs b/src/ComputeSharp.SourceGenerators/Extensions/ISymbolExtensions.cs index aade5e79..dac1c8f9 100644 --- a/src/ComputeSharp.SourceGenerators/Extensions/ISymbolExtensions.cs +++ b/src/ComputeSharp.SourceGenerators/Extensions/ISymbolExtensions.cs @@ -116,17 +116,6 @@ internal static class ISymbolExtensions return symbol.GetFullMetadataName().Replace('`', '-').Replace('+', '.'); } - /// - /// Gets a valid filename for a target symbol and generator type. - /// - /// The symbol being processed. - /// A filename in the form "<SYMBOL_FULLNAME>" - [Pure] - public static string GetGeneratedFileName(this IMethodSymbol symbol) - { - return symbol.GetFullMetadataName(true).Replace('`', '-').Replace('+', '.'); - } - /// /// Tracks an instance and returns an HLSL compatible object. /// diff --git a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs index 1943477d..4cb19f28 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs +++ b/tests/ComputeSharp.Tests.SourceGenerators/DiagnosticsTests.cs @@ -167,7 +167,7 @@ public class DiagnosticsTests [DataRow(nameof(GroupIds), "CMPS0007")] [DataRow(nameof(GroupSize), "CMPS0008")] [DataRow(nameof(GridIds), "CMPS0009")] - [DataRow(nameof(DispatchSize), "CMPS0044")] + [DataRow(nameof(DispatchSize), "CMPS0039")] public void InvalidDispatchInfoUsage_LocalFunction(string typeName, string diagnosticsId) { string source = $@" @@ -202,7 +202,7 @@ public class DiagnosticsTests [DataRow(nameof(GroupIds), "CMPS0007")] [DataRow(nameof(GroupSize), "CMPS0008")] [DataRow(nameof(GridIds), "CMPS0009")] - [DataRow(nameof(DispatchSize), "CMPS0044")] + [DataRow(nameof(DispatchSize), "CMPS0039")] public void InvalidDispatchInfoUsage_StaticMethod(string typeName, string diagnosticsId) { string source = $@" @@ -1194,7 +1194,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0042"); + VerifyGeneratedDiagnostics(source, "CMPS0037"); } [TestMethod] @@ -1222,7 +1222,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0043"); + VerifyGeneratedDiagnostics(source, "CMPS0038"); } [TestMethod] @@ -1250,7 +1250,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0045"); + VerifyGeneratedDiagnostics(source, "CMPS0040"); } [TestMethod] @@ -1281,7 +1281,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0045"); + VerifyGeneratedDiagnostics(source, "CMPS0040"); } [TestMethod] @@ -1309,7 +1309,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0045"); + VerifyGeneratedDiagnostics(source, "CMPS0040"); } [TestMethod] @@ -1337,7 +1337,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0045"); + VerifyGeneratedDiagnostics(source, "CMPS0040"); } [TestMethod] @@ -1371,7 +1371,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0046"); + VerifyGeneratedDiagnostics(source, "CMPS0041"); } [TestMethod] @@ -1396,7 +1396,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0047"); + VerifyGeneratedDiagnostics(source, "CMPS0042"); } [TestMethod] @@ -1430,7 +1430,7 @@ public class DiagnosticsTests } }"; - VerifyGeneratedDiagnostics(source, "CMPS0048"); + VerifyGeneratedDiagnostics(source, "CMPS0043"); } [TestMethod] @@ -1469,7 +1469,7 @@ public class DiagnosticsTests }} }}"; - VerifyGeneratedDiagnostics(source, "CMPS0049"); + VerifyGeneratedDiagnostics(source, "CMPS0044"); } ///