For matching of known sampler methods
このコミットが含まれているのは:
1 親
ae23529485
コミット
7b46a7d527
2ファイル変更
+18
-24
検索条件に一致するファイルはありません
@@ -346,10 +346,10 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
|
||||
if (SemanticModel.For(node).GetOperation(node) is IInvocationOperation { TargetMethod: IMethodSymbol method } operation)
|
||||
{
|
||||
string metadataName = method.GetFullMetadataName();
|
||||
|
||||
if (method.IsStatic)
|
||||
{
|
||||
string metadataName = method.GetFullMetadataName();
|
||||
|
||||
// If the invocation consists of invoking a static method that has a direct
|
||||
// mapping to HLSL, rewrite the expression in the current invocation node.
|
||||
// For instance: Math.Abs(expr) => abs(expr).
|
||||
@@ -396,17 +396,22 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
return updatedNode.WithExpression(ParseExpression(methodIdentifier));
|
||||
}
|
||||
}
|
||||
else if (HlslKnownMethods.TryGetMappedResourceSamplerAccessType(metadataName, out string? mapping))
|
||||
else
|
||||
{
|
||||
// Get the syntax for the argument syntax transformation (adding the vector type constructor if needed)
|
||||
ArgumentSyntax coordinateSyntax = mapping switch
|
||||
{
|
||||
not null => Argument(InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments))),
|
||||
null => updatedNode.ArgumentList.Arguments[0]
|
||||
};
|
||||
string metadataName = method.GetFullMetadataName(includeParameters: true);
|
||||
|
||||
// Rewrite texture resource sampled accesses, if needed
|
||||
return RewriteSampledTextureAccess(operation, updatedNode.Expression, coordinateSyntax);
|
||||
if (HlslKnownMethods.TryGetMappedResourceSamplerAccessType(metadataName, out string? mapping))
|
||||
{
|
||||
// Get the syntax for the argument syntax transformation (adding the vector type constructor if needed)
|
||||
ArgumentSyntax coordinateSyntax = mapping switch
|
||||
{
|
||||
not null => Argument(InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments))),
|
||||
null => updatedNode.ArgumentList.Arguments[0]
|
||||
};
|
||||
|
||||
// Rewrite texture resource sampled accesses, if needed
|
||||
return RewriteSampledTextureAccess(operation, updatedNode.Expression, coordinateSyntax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,6 @@ internal static class ISymbolExtensions
|
||||
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
|
||||
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers);
|
||||
|
||||
/// <summary>
|
||||
/// A custom <see cref="SymbolDisplayFormat"/> instance with fully qualified style, without global:: and parameters.
|
||||
/// </summary>
|
||||
private static readonly SymbolDisplayFormat FullyQualifiedWithoutGlobalAndParametersFormat = new(
|
||||
globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Omitted,
|
||||
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
|
||||
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
|
||||
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers,
|
||||
memberOptions: SymbolDisplayMemberOptions.IncludeContainingType,
|
||||
parameterOptions: SymbolDisplayParameterOptions.None);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the fully qualified name for a given symbol.
|
||||
/// </summary>
|
||||
@@ -89,10 +78,10 @@ internal static class ISymbolExtensions
|
||||
{
|
||||
var parameters = string.Join(", ", symbol.Parameters.Select(static p => ((INamedTypeSymbol)p.Type).GetFullMetadataName()));
|
||||
|
||||
return $"{symbol.ToDisplayString(FullyQualifiedWithoutGlobalAndParametersFormat)}({parameters})";
|
||||
return $"{symbol.ContainingType.GetFullMetadataName()}.{symbol.Name}({parameters})";
|
||||
}
|
||||
|
||||
return symbol.ToDisplayString(FullyQualifiedWithoutGlobalAndParametersFormat);
|
||||
return $"{symbol.ContainingType.GetFullMetadataName()}.{symbol.Name}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする