Fixed HLSL compilation when using nested struct types

このコミットが含まれているのは:
Sergio Pedri committed 2021-03-11 23:12:09 +01:00
1 親 cd8fb59593
コミット 9d41cbf94c
10ファイル変更
+104 -57

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

+3 -3
ファイルの表示
@@ -373,7 +373,7 @@ namespace ComputeSharp.SourceGenerators
{
foreach (var constant in constantDefinitions)
{
var ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().Replace(".", "__");
var ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
var constantName = $"__{ownerTypeName}__{constant.Key.Name}";
yield return new string[] { constantName, constant.Value };
@@ -389,7 +389,7 @@ namespace ComputeSharp.SourceGenerators
{
foreach (var type in HlslKnownTypes.GetCustomTypes(types))
{
var structType = type.GetFullMetadataName().Replace(".", "__");
var structType = type.GetFullMetadataName().ToHlslIdentifierName();
var structDeclaration = StructDeclaration(structType);
// Declare the fields of the current type
@@ -400,7 +400,7 @@ namespace ComputeSharp.SourceGenerators
// Convert the name to the fully qualified HLSL version
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullMetadataName(), out string? mapped))
{
mapped = fieldType.GetFullMetadataName().Replace(".", "__");
mapped = fieldType.GetFullMetadataName().ToHlslIdentifierName();
}
structDeclaration = structDeclaration.AddMembers(