diff --git a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs index 9893e27b..d17c8344 100644 --- a/tests/ComputeSharp.Tests/ShaderCompilerTests.cs +++ b/tests/ComputeSharp.Tests/ShaderCompilerTests.cs @@ -467,6 +467,49 @@ namespace ComputeSharp.Tests results[ThreadIds.X] = result1 + result2 + bufferA[ThreadIds.X].Sum() + bufferB[0].Combine(); } } + + [TestMethod] + public void PixelShaderWithScopedParameterInMethods() + { + _ = ReflectionServices.GetShaderInfo(); + } + + internal static class HelpersForPixelShaderWithScopedParameterInMethods + { + public static void Baz(scoped in float a, scoped ref float b) + { + b = a; + } + } + + [AutoConstructor] + internal readonly partial struct PixelShaderWithScopedParameterInMethodsShader : IComputeShader + { + public readonly ReadWriteBuffer buffer; + public readonly float number; + + private static void Foo(scoped ref float a, ref float b) + { + b = a; + } + + private void Bar(scoped ref float a, scoped ref float b) + { + b = a; + } + + /// + public void Execute() + { + float number = this.number; + + Foo(ref this.buffer[ThreadIds.X], ref number); + Bar(ref this.buffer[ThreadIds.X], ref number); + HelpersForPixelShaderWithScopedParameterInMethods.Baz(in this.buffer[ThreadIds.X], ref number); + + this.buffer[ThreadIds.X] *= number; + } + } } }