More unit tests added (3D dispatch failing)
このコミットが含まれているのは:
1 親
00d1c9ef5b
コミット
fb7b7bcd3d
2ファイル変更
+61
-2
検索条件に一致するファイルはありません
+3
-2
@@ -4,8 +4,8 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
namespace ComputeSharp.NetCore.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("ShaderCompile")]
|
||||
public class ShaderTests
|
||||
[TestCategory("InvalidShader")]
|
||||
public class InvalidShaderTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void EmptyShaderCompileError()
|
||||
@@ -16,3 +16,4 @@ namespace ComputeSharp.NetCore.Tests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ComputeSharp.Graphics.Buffers;
|
||||
using ComputeSharp.NetCore.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ComputeSharp.NetCore.Tests
|
||||
{
|
||||
[TestClass]
|
||||
[TestCategory("ShaderDispatch")]
|
||||
public class ShaderDispatch
|
||||
{
|
||||
[TestMethod]
|
||||
public void WriteToReadWriteBufferDispatch1D()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(100);
|
||||
|
||||
Action<ThreadIds> action = id => buffer[id.X] = id.X;
|
||||
|
||||
Gpu.Default.For(100, action);
|
||||
|
||||
float[] array = buffer.GetData();
|
||||
float[] expected = Enumerable.Range(0, 100).Select(i => (float)i).ToArray();
|
||||
|
||||
Assert.IsTrue(array.AsSpan().ContentEquals(expected));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WriteToReadWriteBufferDispatch2D()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(100);
|
||||
|
||||
Action<ThreadIds> action = id => buffer[id.X + id.Y * 10] = id.X + id.Y * 10;
|
||||
|
||||
Gpu.Default.For(10, 10, action);
|
||||
|
||||
float[] array = buffer.GetData();
|
||||
float[] expected = Enumerable.Range(0, 100).Select(i => (float)i).ToArray();
|
||||
|
||||
Assert.IsTrue(array.AsSpan().ContentEquals(expected));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WriteToReadWriteBufferDispatch3D()
|
||||
{
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1000);
|
||||
|
||||
Action<ThreadIds> action = id => buffer[id.X + id.Y * 10 + id.Z * 100] = id.X + id.Y * 10 + id.Z * 100;
|
||||
|
||||
Gpu.Default.For(10, 10, 10, action);
|
||||
|
||||
float[] array = buffer.GetData();
|
||||
float[] expected = Enumerable.Range(0, 1000).Select(i => (float)i).ToArray();
|
||||
|
||||
Assert.IsTrue(array.AsSpan().ContentEquals(expected));
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする