Added support for all types of delegates with a return type

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-05 14:47:01 +02:00
1 親 541f0b425c
コミット 2c44c8fdbd
1ファイル変更
+2 -19
+2 -19
ファイルの表示
@@ -249,28 +249,11 @@ namespace ComputeSharp.Shaders.Translation
else if (fieldType.IsClass && fieldType.IsGenericType &&
fieldType.IsSubclassOf(typeof(Delegate)) &&
memberInfo.GetValue(Action.Target) is Delegate func && func.Method.IsStatic &&
fieldType.GetGenericTypeDefinition() is Type fieldTypeDefinition && (
fieldTypeDefinition == typeof(Func<>) ||
fieldTypeDefinition == typeof(Func<,>) ||
fieldTypeDefinition == typeof(Func<,,>) ||
fieldTypeDefinition == typeof(Func<,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,,,,,,>) ||
fieldTypeDefinition == typeof(Func<,,,,,,,,,,,,,,,,>)) &&
(HlslKnownTypes.IsKnownScalarType(func.Method.ReturnType) || HlslKnownTypes.IsKnownVectorType(func.Method.ReturnType)) &&
fieldType.GenericTypeArguments.All(type => HlslKnownTypes.IsKnownScalarType(type) ||
HlslKnownTypes.IsKnownVectorType(type)))
{
// Captured static Func<T> (and available generic type combinations)
// Captured static delegates with a return type
LoadStaticMethodSource(fieldName, func.Method);
}
}