Added known method mappings for properties of HLSL vectors

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-26 00:52:22 +02:00
1 親 705c9c0a94
コミット c646174021
2ファイル変更
+20

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

+9
ファイルの表示
@@ -218,6 +218,15 @@ namespace ComputeSharp.Shaders.Mappings
knownMethods.Add($"{typeof(Hlsl).FullName}{Type.Delimiter}{name}", name.ToLowerInvariant());
}
// Programmatically load mappings for the vector types
foreach (var item in
from type in HlslKnownTypes.KnownVectorTypes
from property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
select (Type: type, Property: property))
{
knownMethods.Add($"{item.Type.FullName}{Type.Delimiter}{item.Property.Name}", item.Property.Name.ToLowerInvariant());
}
return _KnownMethods = knownMethods;
}
}
+11
ファイルの表示
@@ -42,6 +42,17 @@ namespace ComputeSharp.Shaders.Mappings
[typeof(ReadWriteBuffer<>).FullName] = "RWStructuredBuffer"
};
/// <summary>
/// Gets the known HLSL vector types available as mapped types
/// </summary>
public static IReadOnlyList<Type> KnownVectorTypes { get; } = new[]
{
typeof(Int2), typeof(Int3), typeof(Int4),
typeof(UInt2), typeof(UInt3), typeof(UInt4),
typeof(Float2), typeof(Float3), typeof(Float4),
typeof(Double2), typeof(Double3), typeof(Double4)
};
/// <summary>
/// Checks whether or not the input type is a known scalar type
/// </summary>