diff --git a/tests/ComputeSharp.Tests/DispatchTests.cs b/tests/ComputeSharp.Tests/DispatchTests.cs index a454c2e7..030adbbd 100644 --- a/tests/ComputeSharp.Tests/DispatchTests.cs +++ b/tests/ComputeSharp.Tests/DispatchTests.cs @@ -153,5 +153,32 @@ namespace ComputeSharp.Tests buffer[3] = GroupSize.Count; } } + + [CombinatorialTestMethod] + [AllDevices] + public void Verify_GridIds(Device device) + { + using ReadWriteBuffer buffer = device.Get().AllocateReadWriteBuffer(256); + + device.Get().For(256, 1, 1, 32, 1, 1, new GridIdsShader(buffer)); + + int[] data = buffer.ToArray(); + + for (int i = 0; i < data.Length; i++) + { + Assert.AreEqual(data[i], i / 32); + } + } + + [AutoConstructor] + internal readonly partial struct GridIdsShader : IComputeShader + { + public readonly ReadWriteBuffer buffer; + + public void Execute() + { + buffer[ThreadIds.X] = GridIds.X; + } + } } }