Added GroupSize type

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-14 17:53:54 +01:00
1 親 d01e9fbcdc
コミット 417d0af576
5ファイル変更
+246 -10

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

+2 -1
ファイルの表示
@@ -18,8 +18,9 @@
<Compile Include="..\ComputeSharp.Core\Attributes\ShaderMethodAttribute.cs" Link="Core\Attributes\ShaderMethodAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\__Internals\IComputeShaderSourceAttribute.cs" Link="Core\Attributes\__Internals\IComputeShaderSourceAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\__Internals\ShaderMethodSourceAttribute.cs" Link="Core\Attributes\__Internals\ShaderMethodSourceAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Dispatch\ThreadIds.cs" Link="Core\Dispatch\ThreadIds.cs" />
<Compile Include="..\ComputeSharp.Core\Dispatch\GroupIds.cs" Link="Core\Dispatch\GroupIds.cs" />
<Compile Include="..\ComputeSharp.Core\Dispatch\GroupSize.cs" Link="Core\Dispatch\GroupSize.cs" />
<Compile Include="..\ComputeSharp.Core\Dispatch\ThreadIds.cs" Link="Core\Dispatch\ThreadIds.cs" />
<Compile Include="..\ComputeSharp.Core\Dispatch\WarpIds.cs" Link="Core\Dispatch\WarpIds.cs" />
<Compile Include="..\ComputeSharp.Core\Exceptions\InvalidExecutionContextException.cs" Link="Core\Exceptions\InvalidExecutionContextException.cs" />
<Compile Include="..\ComputeSharp.Core\Exceptions\MissingMethodSourceException.cs" Link="Core\Exceptions\MissingMethodSourceException.cs" />
+22
ファイルの表示
@@ -211,6 +211,28 @@ namespace ComputeSharp.SourceGenerators.Mappings
}
}
// Programmatically load mappings for the group size
foreach (var property in typeof(GroupSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
{
string key = $"{typeof(GroupSize).FullName}{Type.Delimiter}{property.Name}";
switch (property.Name)
{
case nameof(GroupSize.Count):
knownMembers.Add(key, "__GroupSize__get_X * __GroupSize__get_Y * __GroupSize__get_Z");
break;
case string name when name.Length == 1:
knownMembers.Add(key, $"__GroupSize__get_{name}");
break;
case string name when name.Length == 1:
knownMembers.Add(key, $"__GroupSize__get_{name[0]} * __GroupSize__get_{name[1]}");
break;
case string name when name.Length == 1:
knownMembers.Add(key, $"__GroupSize__get_{name[0]} * __GroupSize__get_{name[1]} * __GroupSize__get_{name[2]}");
break;
}
}
return knownMembers;
}