Added parsing method for static buffer fields

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-11 20:27:14 +01:00
1 親 d6228da210
コミット 80fd4d96e0
3ファイル変更
+51

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

+18
ファイルの表示
@@ -149,6 +149,24 @@ namespace ComputeSharp.SourceGenerators.Mappings
return KnownTypes[typeName];
}
/// <summary>
/// Gets the mapped HLSL-compatible type name for the input element type symbol.
/// </summary>
/// <param name="typeSymbol">The input type to map.</param>
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
[Pure]
public static string GetMappedElementName(IArrayTypeSymbol typeSymbol)
{
string elementTypeName = ((INamedTypeSymbol)typeSymbol.ElementType).GetFullMetadataName();
if (KnownTypes.TryGetValue(elementTypeName, out string? mapped))
{
return mapped;
}
return elementTypeName.Replace(".", "__");
}
/// <summary>
/// Gets the mapped HLSL-compatible type name for the input type name.
/// </summary>