Added diagnostics for invalid DispatchSize usage

このコミットが含まれているのは:
Sergio Pedri committed 2021-03-08 14:38:35 +01:00
1 親 ced4a12afd
コミット 1b531f1dd7
5ファイル変更
+54 -1

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

+2 -1
ファイルの表示
@@ -50,4 +50,5 @@ CMPS0042 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator,
CMPS0043 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0044 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0045 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0046 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0046 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
CMPS0047 | ComputeSharp.IComputeShader | Error | IComputeShaderSourceGenerator, [Documentation](https://github.com/Sergio0694/ComputeSharp)
+13
ファイルの表示
@@ -652,5 +652,18 @@ namespace ComputeSharp.SourceGenerators.Diagnostics
isEnabledByDefault: true,
description: "A type representing a compute shader contains an instance property declaration.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for an invalid <see cref="DispatchSize"/> usage.
/// </summary>
public static readonly DiagnosticDescriptor InvalidDispatchSizeUsage = new(
id: "CMPS0047",
title: "Invalid DispatchSize usage",
messageFormat: "The DispatchSize type can only be used within the main body of a compute shader",
category: typeof(IComputeShader).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "The DispatchSize type can only be used within the main body of a compute shader.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
}
}
+1
ファイルの表示
@@ -87,6 +87,7 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
_ when typeName == typeof(GroupIds).FullName => InvalidGroupIdsUsage,
_ when typeName == typeof(GroupSize).FullName => InvalidGroupSizeUsage,
_ when typeName == typeof(GridIds).FullName => InvalidGridIdsUsage,
_ when typeName == typeof(DispatchSize).FullName => InvalidDispatchSizeUsage,
_ => null
};
+1
ファイルの表示
@@ -288,6 +288,7 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
_ when typeName == typeof(GroupIds).FullName => InvalidGroupIdsUsage,
_ when typeName == typeof(GroupSize).FullName => InvalidGroupSizeUsage,
_ when typeName == typeof(GridIds).FullName => InvalidGridIdsUsage,
_ when typeName == typeof(DispatchSize).FullName => InvalidDispatchSizeUsage,
_ => null
};