Finished refactoring in source generator for new intrinsics
このコミットが含まれているのは:
1 親
6798c625d5
コミット
7def0e6280
5ファイル変更
+38
-87
検索条件に一致するファイルはありません
@@ -26,8 +26,9 @@
|
||||
<Compile Include="..\ComputeSharp\Core\Extensions\MethodInfoExtensions.cs" Link="Core\Extensions\MethodInfoExtensions.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Helpers\AlignmentHelper.cs" Link="Core\Helpers\AlignmentHelper.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Interfaces\IComputeShader.cs" Link="Core\Interfaces\IComputeShader.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Intrinsics\Attributes\PreserveMemberNameAttribute.cs" Link="Core\Intrinsics\Attributes\PreserveMemberNameAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" Link="Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Intrinsics\Hlsl.cs" Link="Core\Intrinsics\Hlsl.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Intrinsics\Hlsl.g.cs" Link="Core\Intrinsics\Hlsl.g.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Primitives\Bool\Bool.cs" Link="Core\Primitives\Bool\Bool.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Primitives\Bool\Bool2.cs" Link="Core\Primitives\Bool\Bool2.cs" />
|
||||
<Compile Include="..\ComputeSharp\Core\Primitives\Bool\Bool3.cs" Link="Core\Primitives\Bool\Bool3.cs" />
|
||||
|
||||
@@ -42,17 +42,11 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
knownKeywords.Add(nameof(WarpIds));
|
||||
|
||||
// HLSL intrinsics method names
|
||||
foreach (var method in
|
||||
from method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static)
|
||||
group method by method.Name
|
||||
into groups
|
||||
select (Name: groups.Key, MethodInfo: groups.First()))
|
||||
foreach (var method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static))
|
||||
{
|
||||
string hlslName = method.MethodInfo.GetCustomAttribute<PreserveMemberNameAttribute>() != null
|
||||
? method.Name
|
||||
: method.Name.ToLowerInvariant();
|
||||
string name = method.GetCustomAttribute<HlslIntrinsicNameAttribute>()?.Name ?? method.Name;
|
||||
|
||||
knownKeywords.Add(hlslName);
|
||||
knownKeywords.Add(name);
|
||||
}
|
||||
|
||||
return knownKeywords;
|
||||
|
||||
@@ -107,14 +107,12 @@ namespace ComputeSharp.SourceGenerators.Mappings
|
||||
from method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static)
|
||||
group method by method.Name
|
||||
into groups
|
||||
select (Name: groups.Key, MethodInfo: groups.First()))
|
||||
select groups.First())
|
||||
{
|
||||
// Check whether the current method should be translated with the original name
|
||||
// or with the lowercase version. This is needed because all C# methods are exposed
|
||||
// with the upper camel case format, while HLSL intrinsics use multiple different formats.
|
||||
string hlslName = method.MethodInfo.GetCustomAttribute<PreserveMemberNameAttribute>() != null
|
||||
? method.Name
|
||||
: method.Name.ToLowerInvariant();
|
||||
string hlslName = method.GetCustomAttribute<HlslIntrinsicNameAttribute>()?.Name ?? method.Name;
|
||||
|
||||
knownMethods.Add($"{typeof(Hlsl).FullName}{Type.Delimiter}{method.Name}", hlslName);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする