Minor code refactorings
このコミットが含まれているのは:
1 親
c14dd305ae
コミット
b24e6b4c0d
27ファイル変更
+131
-121
検索条件に一致するファイルはありません
@@ -134,7 +134,7 @@ partial class IShaderGenerator
|
||||
continue;
|
||||
}
|
||||
|
||||
string metadataName = typeSymbol.GetFullMetadataName();
|
||||
string metadataName = typeSymbol.GetFullyQualifiedMetadataName();
|
||||
string typeName = HlslKnownTypes.GetMappedName(typeSymbol);
|
||||
|
||||
_ = HlslKnownKeywords.TryGetMappedName(fieldSymbol.Name, out string? mapping);
|
||||
@@ -222,7 +222,7 @@ partial class IShaderGenerator
|
||||
|
||||
// Constant properties must be of a primitive, vector or matrix type
|
||||
if (fieldSymbol.Type is not INamedTypeSymbol typeSymbol ||
|
||||
!HlslKnownTypes.IsKnownHlslType(typeSymbol.GetFullMetadataName()))
|
||||
!HlslKnownTypes.IsKnownHlslType(typeSymbol.GetFullyQualifiedMetadataName()))
|
||||
{
|
||||
diagnostics.Add(InvalidShaderStaticFieldType, variableDeclarator, structDeclarationSymbol, fieldSymbol.Name, fieldSymbol.Type);
|
||||
|
||||
@@ -460,7 +460,7 @@ partial class IShaderGenerator
|
||||
// Process the discovered types
|
||||
foreach (INamedTypeSymbol type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes))
|
||||
{
|
||||
string structType = type.GetFullMetadataName().ToHlslIdentifierName();
|
||||
string structType = type.GetFullyQualifiedMetadataName().ToHlslIdentifierName();
|
||||
StructDeclarationSyntax structDeclaration = StructDeclaration(structType);
|
||||
|
||||
// Declare the fields of the current type
|
||||
@@ -474,9 +474,9 @@ partial class IShaderGenerator
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
// Convert the name to the fully qualified HLSL version
|
||||
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullMetadataName(), out string? mappedType))
|
||||
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullyQualifiedMetadataName(), out string? mappedType))
|
||||
{
|
||||
mappedType = fieldType.GetFullMetadataName().ToHlslIdentifierName();
|
||||
mappedType = fieldType.GetFullyQualifiedMetadataName().ToHlslIdentifierName();
|
||||
}
|
||||
|
||||
// Get the field name as a valid HLSL identifier
|
||||
|
||||
@@ -45,7 +45,7 @@ partial class IShaderGenerator
|
||||
bool supportsDynamicShaders)
|
||||
{
|
||||
// Try to get the attribute that controls shader precompilation (has to be present when ComputeSharp.Dynamic is not referenced)
|
||||
if (!structDeclarationSymbol.TryGetAttributeWithFullMetadataName(typeof(EmbeddedBytecodeAttribute).FullName, out AttributeData? attribute))
|
||||
if (!structDeclarationSymbol.TryGetAttributeWithFullyQualifiedMetadataName(typeof(EmbeddedBytecodeAttribute).FullName, out AttributeData? attribute))
|
||||
{
|
||||
// Emit the diagnostics if dynamic shaders are not supported
|
||||
if (!supportsDynamicShaders)
|
||||
|
||||
@@ -54,7 +54,7 @@ partial class IShaderGenerator
|
||||
select fieldSymbol)
|
||||
{
|
||||
string fieldName = fieldSymbol.Name;
|
||||
string typeName = fieldSymbol.Type.GetFullMetadataName();
|
||||
string typeName = fieldSymbol.Type.GetFullyQualifiedMetadataName();
|
||||
|
||||
// Disambiguates the name of target fields against the current input parameters
|
||||
if (fieldName is "loader" or "device" or "x" or "y" or "z")
|
||||
|
||||
@@ -141,12 +141,12 @@ partial class HlslKnownTypes
|
||||
return "";
|
||||
}
|
||||
|
||||
string typeName = typeSymbol.GetFullMetadataName();
|
||||
string typeName = typeSymbol.GetFullyQualifiedMetadataName();
|
||||
|
||||
// Special case for the resource types
|
||||
if (IsTypedResourceType(typeName))
|
||||
{
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.Last()).GetFullMetadataName();
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.Last()).GetFullyQualifiedMetadataName();
|
||||
|
||||
// If the current type is a custom type, format it as needed
|
||||
if (!KnownHlslTypes.TryGetValue(genericArgumentName, out string? mappedElementType))
|
||||
@@ -202,7 +202,7 @@ partial class HlslKnownTypes
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
|
||||
public static string GetMappedNameForPixelShaderType(INamedTypeSymbol typeSymbol)
|
||||
{
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.First()).GetFullMetadataName();
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.First()).GetFullyQualifiedMetadataName();
|
||||
|
||||
// If the current type is a custom type, format it as needed
|
||||
if (!KnownHlslTypes.TryGetValue(genericArgumentName, out string? mappedElementType))
|
||||
|
||||
@@ -94,7 +94,7 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator
|
||||
diagnostics = builder.ToImmutable();
|
||||
|
||||
return new(
|
||||
methodSymbol.GetFullMetadataName(includeParameters: true),
|
||||
methodSymbol.GetFullyQualifiedMetadataName(includeParameters: true),
|
||||
entryPoint,
|
||||
definedTypes,
|
||||
definedConstants,
|
||||
|
||||
@@ -53,7 +53,7 @@ partial class ShaderSourceRewriter
|
||||
// Mark which dispatch properties have been used, to optimize the declaration afterwards
|
||||
if (operation.Member.IsStatic)
|
||||
{
|
||||
string typeName = operation.Member.ContainingType.GetFullMetadataName();
|
||||
string typeName = operation.Member.ContainingType.GetFullyQualifiedMetadataName();
|
||||
|
||||
if (mappedName == $"__{nameof(GroupIds)}__get_Index")
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ partial class StaticFieldRewriter
|
||||
{
|
||||
if (operation.Member.IsStatic)
|
||||
{
|
||||
string typeName = operation.Member.ContainingType.GetFullMetadataName();
|
||||
string typeName = operation.Member.ContainingType.GetFullyQualifiedMetadataName();
|
||||
|
||||
// Special dispatch types are not supported from static constants
|
||||
DiagnosticDescriptor? descriptor = typeName switch
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする