From 332701c0fa383ac245b1c6cf837dbbff9a3cbe4a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 25 Aug 2019 00:08:18 +0200 Subject: [PATCH] Added more tests for discard out parameters in intrinsic functions --- tests/ComputeSharp.Tests/IntrinsicTests.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/ComputeSharp.Tests/IntrinsicTests.cs b/tests/ComputeSharp.Tests/IntrinsicTests.cs index 32af95a1..f1b2be1f 100644 --- a/tests/ComputeSharp.Tests/IntrinsicTests.cs +++ b/tests/ComputeSharp.Tests/IntrinsicTests.cs @@ -31,6 +31,26 @@ namespace ComputeSharp.Tests Assert.IsTrue(MathF.Abs(result[1] - result[3]) < 0.0001f); } + [TestMethod] + public void IntrinsicWithInlineOutParamaterAndDiscard() + { + float angle = 80; + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(2); + + Action action = id => + { + buffer[0] = Hlsl.Sin(angle); + Hlsl.SinCos(angle, out float sine, out _); + buffer[1] = sine; + }; + + Gpu.Default.For(1, action); + + float[] result = buffer.GetData(); + + Assert.IsTrue(MathF.Abs(result[0] - result[1]) < 0.0001f); + } + [TestMethod] public void IntrinsicWithOutParamaters() {