Added support for captured local functions cast to delegates
このコミットが含まれているのは:
1 親
a91b44a329
コミット
e512c5839e
2ファイル変更
+19
-5
検索条件に一致するファイルはありません
@@ -99,13 +99,27 @@ namespace ComputeSharp.Tests
|
||||
|
||||
Func<float, float> f = x => x * x;
|
||||
|
||||
Func<int, float> invert = x => -x;
|
||||
|
||||
Gpu.Default.For(1, id => buffer[0] = f(3) + invert(8));
|
||||
Gpu.Default.For(1, id => buffer[0] = f(3));
|
||||
|
||||
float[] result = buffer.GetData();
|
||||
|
||||
Assert.IsTrue(MathF.Abs(result[0] - 1) < 0.0001f);
|
||||
Assert.IsTrue(MathF.Abs(result[0] - 9) < 0.0001f);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void StatelessLocalFunctionToDelegate()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
float Func(float x) => x * x;
|
||||
|
||||
Func<float, float> f = Func;
|
||||
|
||||
Gpu.Default.For(1, id => buffer[0] = f(3));
|
||||
|
||||
float[] result = buffer.GetData();
|
||||
|
||||
Assert.IsTrue(MathF.Abs(result[0] - 9) < 0.0001f);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする