Fixed HLSL compilation when using nested struct types
このコミットが含まれているのは:
1 親
cd8fb59593
コミット
9d41cbf94c
10ファイル変更
+104
-57
検索条件に一致するファイルはありません
@@ -155,7 +155,7 @@ namespace ComputeSharp.SourceGenerators.Extensions
|
||||
return ParseTypeName(mappedName!);
|
||||
}
|
||||
|
||||
return ParseTypeName(typeName.Replace(".", "__"));
|
||||
return ParseTypeName(typeName.ToHlslIdentifierName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace ComputeSharp.SourceGenerators.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="string"/> types.
|
||||
/// </summary>
|
||||
internal static class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a given <see cref="string"/> instance to a valid HLSL identifier name.
|
||||
/// </summary>
|
||||
/// <param name="text">The input <see cref="string"/> instance to convert.</param>
|
||||
/// <returns>An valid HLSL identifier name from <paramref name="text"/>.</returns>
|
||||
[Pure]
|
||||
public static string ToHlslIdentifierName(this string text)
|
||||
{
|
||||
return text.Replace('.', '_').Replace('+', '_');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace ComputeSharp.SourceGenerators.Extensions
|
||||
return node.ReplaceNode(targetType, newType);
|
||||
}
|
||||
|
||||
return node.ReplaceNode(targetType, ParseTypeName(typeName.Replace(".", "__")));
|
||||
return node.ReplaceNode(targetType, ParseTypeName(typeName.ToHlslIdentifierName()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -98,7 +98,7 @@ namespace ComputeSharp.SourceGenerators.Extensions
|
||||
return ParseTypeName(mappedName!);
|
||||
}
|
||||
|
||||
return ParseTypeName(typeName.Replace(".", "__"));
|
||||
return ParseTypeName(typeName.ToHlslIdentifierName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする