Tweak diagnostics, add SampleInputAtPosition checks too

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-07 18:04:24 +02:00
1 親 5777e17e03
コミット 55ad39b817
2ファイル変更
+4 -4

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

+3 -3
ファイルの表示
@@ -638,16 +638,16 @@ internal static class DiagnosticDescriptors
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for when the <c>[D2DRequiresPosition]</c> attribute is missing.
/// <para>
/// Format: <c>"The D2D1 shader of type {0} is calling a D2D1 API or another method that require the [D2DRequiresPosition] attribute to be used, but the shader type is not annotated accordingly"</c>.
/// Format: <c>"The D2D1 shader of type {0} is using D2D1 APIs that require the [D2DRequiresPosition] attribute to be used (that is, D2D1.GetScenePosition() and D2D1.SampleInputAtPosition(int, float2)), but the shader type is not annotated accordingly"</c>.
/// </para>
/// </summary>
public static readonly DiagnosticDescriptor MissingD2DRequiresPositionAttribute = new DiagnosticDescriptor(
id: "CMPSD2D0045",
title: "Missing [D2DRequiresPosition] attribute",
messageFormat: "The D2D1 shader of type {0} is calling a D2D1 API or another method that require the [D2DRequiresPosition] attribute to be used, but the shader type is not annotated accordingly",
messageFormat: "The D2D1 shader of type {0} is using D2D1 APIs that require the [D2DRequiresPosition] attribute to be used (that is, D2D.GetScenePosition() and D2D.SampleInputAtPosition(int, float2)), but the shader type is not annotated accordingly",
category: "ComputeSharp.D2D1.Shaders",
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "A D2D1 shader using functionality that needs position info (ie. when [D2DRequiresPosition] is used) needs to be annotated accordingly.",
description: "A D2D1 shader using functionality that needs position info (ie. when [D2DRequiresPosition] is used, which is mandatory when calling either D2D.GetScenePosition() or D2D.SampleInputAtPosition(int, float2)) needs to be annotated accordingly.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
}
+1 -1
ファイルの表示
@@ -18,7 +18,7 @@ partial class HlslKnownMethods
/// <returns>Whether the method needs the <c>[D2DRequiresPosition]</c> annotation.</returns>
public static bool NeedsD2DRequiresPositionAttribute(string name)
{
return name == "ComputeSharp.D2D1.D2D.GetScenePosition";
return name is "ComputeSharp.D2D1.D2D.GetScenePosition" or "ComputeSharp.D2D1.D2D.SampleInputAtPosition";
}
/// <inheritdoc/>