Minor code refactorings
このコミットが含まれているのは:
1 親
c14dd305ae
コミット
b24e6b4c0d
27ファイル変更
+131
-121
検索条件に一致するファイルはありません
@@ -167,7 +167,7 @@ internal static partial class HlslKnownTypes
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
|
||||
public static string GetMappedElementName(IArrayTypeSymbol typeSymbol)
|
||||
{
|
||||
string elementTypeName = ((INamedTypeSymbol)typeSymbol.ElementType).GetFullMetadataName();
|
||||
string elementTypeName = ((INamedTypeSymbol)typeSymbol.ElementType).GetFullyQualifiedMetadataName();
|
||||
|
||||
if (KnownHlslTypes.TryGetValue(elementTypeName, out string? mapped))
|
||||
{
|
||||
@@ -227,7 +227,7 @@ internal static partial class HlslKnownTypes
|
||||
return;
|
||||
}
|
||||
|
||||
if (KnownHlslTypes.ContainsKey(type.GetFullMetadataName()))
|
||||
if (KnownHlslTypes.ContainsKey(type.GetFullyQualifiedMetadataName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ internal static partial class HlslKnownTypes
|
||||
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
if (!KnownHlslTypes.ContainsKey(fieldType.GetFullMetadataName()) &&
|
||||
if (!KnownHlslTypes.ContainsKey(fieldType.GetFullyQualifiedMetadataName()) &&
|
||||
!invalidTypes.Contains(fieldType))
|
||||
{
|
||||
_ = dependencies.Add(fieldType);
|
||||
|
||||
@@ -112,7 +112,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
|
||||
// Add explicit casts for matrix constructors to help the overload resolution
|
||||
if (SemanticModel.For(node).GetTypeInfo(node).Type is ITypeSymbol matrixType &&
|
||||
HlslKnownTypes.IsMatrixType(matrixType.GetFullMetadataName()))
|
||||
HlslKnownTypes.IsMatrixType(matrixType.GetFullyQualifiedMetadataName()))
|
||||
{
|
||||
for (int i = 0; i < node.ArgumentList!.Arguments.Count; i++)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
|
||||
// Add explicit casts like with the explicit object creation expressions above
|
||||
if (SemanticModel.For(node).GetTypeInfo(node).Type is ITypeSymbol matrixType &&
|
||||
HlslKnownTypes.IsMatrixType(matrixType.GetFullMetadataName()))
|
||||
HlslKnownTypes.IsMatrixType(matrixType.GetFullyQualifiedMetadataName()))
|
||||
{
|
||||
for (int i = 0; i < node.ArgumentList.Arguments.Count; i++)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
|
||||
if (SemanticModel.For(node).GetOperation(node) is IPropertyReferenceOperation operation)
|
||||
{
|
||||
string propertyName = operation.Property.GetFullMetadataName();
|
||||
string propertyName = operation.Property.GetFullyQualifiedMetadataName();
|
||||
|
||||
// Rewrite texture resource indices taking individual indices a vector argument, as per HLSL spec.
|
||||
// For instance: texture[ThreadIds.X, ThreadIds.Y] will be rewritten as texture[int2(ThreadIds.X, ThreadIds.Y)].
|
||||
@@ -261,7 +261,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
foreach (ArgumentSyntax argument in node.ArgumentList.Arguments)
|
||||
{
|
||||
if (SemanticModel.For(node).GetOperation(argument.Expression) is not IFieldReferenceOperation fieldReference ||
|
||||
!HlslKnownProperties.IsKnownMatrixIndex(fieldReference.Field.GetFullMetadataName()))
|
||||
!HlslKnownProperties.IsKnownMatrixIndex(fieldReference.Field.GetFullyQualifiedMetadataName()))
|
||||
{
|
||||
Diagnostics.Add(NonConstantMatrixSwizzledIndex, argument);
|
||||
|
||||
@@ -302,7 +302,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
// That is, do the following transformation:
|
||||
//
|
||||
// x *= y => x = <INTRINSIC>(x, y)
|
||||
if (HlslKnownOperators.TryGetMappedName(method.GetFullMetadataName(), method.Parameters.Select(static p => p.Type.Name), out string? mapped))
|
||||
if (HlslKnownOperators.TryGetMappedName(method.GetFullyQualifiedMetadataName(), method.Parameters.Select(static p => p.Type.Name), out string? mapped))
|
||||
{
|
||||
return
|
||||
AssignmentExpression(
|
||||
@@ -330,7 +330,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
// That is, do the following transformation:
|
||||
//
|
||||
// x * y => <INTRINSIC>(x, y)
|
||||
if (HlslKnownOperators.TryGetMappedName(method.GetFullMetadataName(), method.Parameters.Select(static p => p.Type.Name), out string? mapped))
|
||||
if (HlslKnownOperators.TryGetMappedName(method.GetFullyQualifiedMetadataName(), method.Parameters.Select(static p => p.Type.Name), out string? mapped))
|
||||
{
|
||||
return
|
||||
InvocationExpression(IdentifierName(mapped!))
|
||||
|
||||
@@ -369,7 +369,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
// property access into an invocation of an autogenerated static helper method to get the target
|
||||
// dimension for the buffer in use. The helper method is added to the list of static helpers.
|
||||
if (operation is IPropertyReferenceOperation propertyOperation &&
|
||||
HlslKnownProperties.TryGetAccessorRankAndAxis(propertyOperation.Property.GetFullMetadataName(), out int rank, out int axis))
|
||||
HlslKnownProperties.TryGetAccessorRankAndAxis(propertyOperation.Property.GetFullyQualifiedMetadataName(), out int rank, out int axis))
|
||||
{
|
||||
IMethodSymbol key = propertyOperation.Property.GetMethod!;
|
||||
|
||||
@@ -427,7 +427,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
{
|
||||
if (method.IsStatic)
|
||||
{
|
||||
string metadataName = method.GetFullMetadataName();
|
||||
string metadataName = method.GetFullyQualifiedMetadataName();
|
||||
|
||||
// If the invocation consists of invoking a static method that has a direct
|
||||
// mapping to HLSL, rewrite the expression in the current invocation node.
|
||||
@@ -460,7 +460,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
// type as well, as they will be processed by the generator in a different path.
|
||||
if (!SymbolEqualityComparer.Default.Equals(this.shaderType, method.ContainingType))
|
||||
{
|
||||
string methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName();
|
||||
string methodIdentifier = method.GetFullyQualifiedMetadataName().ToHlslIdentifierName();
|
||||
|
||||
if (!this.staticMethods.ContainsKey(method))
|
||||
{
|
||||
@@ -482,7 +482,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
}
|
||||
else
|
||||
{
|
||||
string metadataName = method.GetFullMetadataName(includeParameters: true);
|
||||
string metadataName = method.GetFullyQualifiedMetadataName(includeParameters: true);
|
||||
|
||||
// Check whether this is a Sample(...) call on a normalized texture type
|
||||
if (HlslKnownMethods.TryGetMappedResourceSamplerAccessType(metadataName, out string? mapping))
|
||||
@@ -505,7 +505,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
{
|
||||
DiscoveredTypes.Add(structTypeSymbol);
|
||||
|
||||
string methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName();
|
||||
string methodIdentifier = method.GetFullyQualifiedMetadataName().ToHlslIdentifierName();
|
||||
|
||||
// Same as for static methods, ensure the method is available in source, and process it if so
|
||||
if (!this.instanceMethods.ContainsKey(method))
|
||||
|
||||
@@ -101,7 +101,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter
|
||||
method.IsStatic)
|
||||
{
|
||||
// Rewrite HLSL intrinsic methods
|
||||
if (HlslKnownMethods.TryGetMappedName(method.GetFullMetadataName(), out string? mapping, out bool requiresParametersMapping))
|
||||
if (HlslKnownMethods.TryGetMappedName(method.GetFullyQualifiedMetadataName(), out string? mapping, out bool requiresParametersMapping))
|
||||
{
|
||||
if (requiresParametersMapping)
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする