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); } /// 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() {