Minor code refactoring

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-29 02:50:22 +02:00
1 親 85be2c2135
コミット b971905fe6
1ファイル変更
+9 -21
+9 -21
ファイルの表示
@@ -44,17 +44,19 @@ namespace ComputeSharp.Shaders.Mappings
[typeof(ReadWriteBuffer<>).FullName] = "RWStructuredBuffer"
};
/// <summary>
/// Gets the known HLSL vector types available as mapped types
/// </summary>
public static IReadOnlyList<Type> HlslMappedVectorTypes { get; } = new[]
private static HashSet<Type> _HlslMappedVectorTypes { get; } = new HashSet<Type>(new[]
{
typeof(Bool2), typeof(Bool3), typeof(Bool4),
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>
/// Gets the known HLSL vector types available as mapped types
/// </summary>
public static IReadOnlyCollection<Type> HlslMappedVectorTypes => _HlslMappedVectorTypes;
/// <summary>
/// Checks whether or not the input type is a known scalar type
@@ -74,24 +76,10 @@ namespace ComputeSharp.Shaders.Mappings
/// <param name="type">The input <see cref="Type"/> instance to check</param>
/// <returns>A <see langword="bool"/> indicating whether the input <see cref="Type"/> is in fact a known HLSL vector type</returns>
[Pure]
public static bool IsKnownVectorType(Type type) => type == typeof(Bool2) ||
type == typeof(Bool3) ||
type == typeof(Bool4) ||
type == typeof(Int2) ||
type == typeof(Int3) ||
type == typeof(Int4) ||
type == typeof(UInt2) ||
type == typeof(UInt3) ||
type == typeof(UInt4) ||
type == typeof(Float2) ||
type == typeof(Float3) ||
type == typeof(Float4) ||
public static bool IsKnownVectorType(Type type) => _HlslMappedVectorTypes.Contains(type) ||
type == typeof(Vector2) ||
type == typeof(Vector3) ||
type == typeof(Vector4) ||
type == typeof(Double2) ||
type == typeof(Double3) ||
type == typeof(Double4);
type == typeof(Vector4);
/// <summary>
/// Checks whether or not the input type is a <see cref="ConstantBuffer{T}"/> value