Add [RequiresDoublePrecisionSupport] diagnostics
このコミットが含まれているのは:
1 親
aa127b8f09
コミット
2c6eb178d5
5ファイル変更
+78
-5
検索条件に一致するファイルはありません
@@ -139,5 +139,43 @@ partial class ComputeShaderDescriptorGenerator
|
||||
diagnostics.Add(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the diagnostics for when double precision support is configured incorrectly.
|
||||
/// </summary>
|
||||
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
|
||||
/// <param name="info">The source <see cref="HlslBytecodeInfo"/> instance.</param>
|
||||
/// <param name="diagnostics">The collection of produced <see cref="DiagnosticInfo"/> instances.</param>
|
||||
public static void GetDoublePrecisionSupportDiagnostics(
|
||||
INamedTypeSymbol structDeclarationSymbol,
|
||||
HlslBytecodeInfo info,
|
||||
ImmutableArrayBuilder<DiagnosticInfo> diagnostics)
|
||||
{
|
||||
// If we have no compiled HLSL bytecode, there is nothing more to do
|
||||
if (info is not HlslBytecodeInfo.Success success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool hasD2DRequiresDoublePrecisionSupportAttribute = structDeclarationSymbol.TryGetAttributeWithFullyQualifiedMetadataName(
|
||||
"ComputeSharp.RequiresDoublePrecisionSupportAttribute",
|
||||
out AttributeData? attributeData);
|
||||
|
||||
// Check the two cases where diagnostics are necessary (same as the D2D generator)
|
||||
if (!hasD2DRequiresDoublePrecisionSupportAttribute && success.RequiresDoublePrecisionSupport)
|
||||
{
|
||||
diagnostics.Add(DiagnosticInfo.Create(
|
||||
MissingRequiresDoublePrecisionSupportAttribute,
|
||||
structDeclarationSymbol,
|
||||
structDeclarationSymbol));
|
||||
}
|
||||
else if (hasD2DRequiresDoublePrecisionSupportAttribute && !success.RequiresDoublePrecisionSupport)
|
||||
{
|
||||
diagnostics.Add(DiagnosticInfo.Create(
|
||||
UnnecessaryRequiresDoublePrecisionSupportAttribute,
|
||||
attributeData!.GetLocation(),
|
||||
structDeclarationSymbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする