Switched ThreadIds to static type

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-13 19:07:53 +01:00
1 親 bbc8832023
コミット c6aa194749
6ファイル変更
+73 -78

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

+9
ファイルの表示
@@ -190,6 +190,15 @@ namespace ComputeSharp.SourceGenerators.Mappings
knownMembers.Add($"{item.Type.FullName}{Type.Delimiter}{item.Property.Name}", $"{item.Property.Name.ToLower()}");
}
// Programmatically load mappings for the dispatch types
foreach (var item in
from type in HlslKnownTypes.HlslDispatchTypes
from property in type.GetProperties(BindingFlags.Static | BindingFlags.Public)
select (Type: type, Property: property))
{
knownMembers.Add($"{item.Type.FullName}{Type.Delimiter}{item.Property.Name}", $"{item.Type.Name}.{item.Property.Name.ToLower()}");
}
return knownMembers;
}
+10 -6
ファイルの表示
@@ -41,8 +41,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
[typeof(double).FullName] = "double",
[typeof(Double2).FullName] = "double2",
[typeof(Double3).FullName] = "double3",
[typeof(Double4).FullName] = "double4",
[typeof(ThreadIds).FullName] = "int3"
[typeof(Double4).FullName] = "double4"
};
/// <summary>
@@ -50,7 +49,6 @@ namespace ComputeSharp.SourceGenerators.Mappings
/// </summary>
public static IReadOnlyCollection<Type> HlslMappedVectorTypes { get; } = new[]
{
typeof(ThreadIds),
typeof(Bool2), typeof(Bool3), typeof(Bool4),
typeof(Int2), typeof(Int3), typeof(Int4),
typeof(UInt2), typeof(UInt3), typeof(UInt4),
@@ -58,6 +56,14 @@ namespace ComputeSharp.SourceGenerators.Mappings
typeof(Double2), typeof(Double3), typeof(Double4)
};
/// <summary>
/// Gets the known HLSL dispatch types.
/// </summary>
public static IReadOnlyCollection<Type> HlslDispatchTypes { get; } = new[]
{
typeof(ThreadIds)
};
/// <summary>
/// Checks whether or not a given type name matches a typed resource type.
/// </summary>
@@ -94,9 +100,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
/// <returns>Whether or not <paramref name="typeName"/> represents a typed resource type.</returns>
public static bool IsScalarOrVectorType(string typeName)
{
return
KnownTypes.ContainsKey(typeName) &&
typeName != typeof(ThreadIds).FullName;
return KnownTypes.ContainsKey(typeName);
}
/// <summary>