From a18f8eba33043dcbc9c5dc142baabae7be760ff7 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 16 Sep 2019 19:48:27 +0200 Subject: [PATCH 1/2] Added test for sequential shader compilation --- tests/ComputeSharp.Tests/HlslVectorTypesTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs index 4e1cf505..def28124 100644 --- a/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs +++ b/tests/ComputeSharp.Tests/HlslVectorTypesTests.cs @@ -7,6 +7,20 @@ namespace ComputeSharp.Tests [TestCategory("HlslVectorTypes")] public class HlslVectorTypesTests { + [TestMethod] + public void SequentialCompilation() + { + Float2 f2 = new Float2(1, 2); + using ReadWriteBuffer buffer = Gpu.Default.AllocateReadWriteBuffer(2); + + Action action1 = id => buffer[0] = f2.YX; + + Action action2 = id => buffer[1] = f2.YX; + + Gpu.Default.For(1, action1); + Gpu.Default.For(1, action2); + } + [TestMethod] public void LocalFloatAssignToFloat2Buffer() { From e5a4822ee7b2c6b9edd1218bac8043b3ddf88dfe Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 17 Sep 2019 01:13:25 +0200 Subject: [PATCH 2/2] Fixed symbol loading issue for HLSL vector types --- src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs b/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs index cd48a6bf..5c10cd5b 100644 --- a/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs +++ b/src/ComputeSharp.Shaders/Translation/MethodDecompiler.cs @@ -150,8 +150,8 @@ namespace ComputeSharp.Shaders.Translation rootNode = syntaxTree.GetRoot().DescendantNodes().OfType().First(node => node.GetLeadingTrivia().ToFullString().Contains(methodInfo.Name)); // Update the incremental compilation and retrieve the syntax tree for the method - _Compilation = _Compilation.AddSyntaxTrees(syntaxTree); - semanticModel = _Compilation.GetSemanticModel(syntaxTree); + Compilation compilation = _Compilation.AddSyntaxTrees(syntaxTree); + semanticModel = compilation.GetSemanticModel(syntaxTree); } ///