Added test for the new Bool type
このコミットが含まれているのは:
1 親
562a467474
コミット
1a16b7df31
2ファイル変更
+32
検索条件に一致するファイルはありません
@@ -28,6 +28,9 @@ namespace ComputeSharp
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() => Value.ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether or not two <see cref="Bool"/> instances represent the same <see cref="bool"/> value
|
||||
/// </summary>
|
||||
|
||||
@@ -41,6 +41,35 @@ namespace ComputeSharp.Tests
|
||||
LocalScalarAssignToBuffer<Bool>(true, (a, b) => a == b);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShaderWithBoolType()
|
||||
{
|
||||
using ReadWriteBuffer<Bool> bools = Gpu.Default.AllocateReadWriteBuffer(new Bool[] { true, false, true, true });
|
||||
using ReadWriteBuffer<int> ints = Gpu.Default.AllocateReadWriteBuffer<int>(4);
|
||||
|
||||
void Foo(ThreadIds id)
|
||||
{
|
||||
if (bools[id.X]) ints[id.X] = id.X + 1;
|
||||
bools[id.X] = (id.X % 2) == 0;
|
||||
}
|
||||
|
||||
Gpu.Default.For(4, Foo);
|
||||
|
||||
Bool[] boolResults = bools.GetData();
|
||||
|
||||
Assert.IsTrue(boolResults[0]);
|
||||
Assert.IsFalse(boolResults[1]);
|
||||
Assert.IsTrue(boolResults[2]);
|
||||
Assert.IsFalse(boolResults[3]);
|
||||
|
||||
int[] intResults = ints.GetData();
|
||||
|
||||
Assert.IsTrue(intResults[0] == 1);
|
||||
Assert.IsTrue(intResults[1] == 0);
|
||||
Assert.IsTrue(intResults[2] == 3);
|
||||
Assert.IsTrue(intResults[3] == 4);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LocalScalarAssignToBufferWithinLocalMethod()
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする