Merge pull request #434 from Sergio0694/dev/add-scoped-parameter-tests

Add shader compiler tests for scoped parameters
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2022-11-20 06:41:13 -08:00
コミット 3115de76ba
1ファイル変更
+43
+43
ファイルの表示
@@ -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<PixelShaderWithScopedParameterInMethodsShader>();
}
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<float> 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;
}
/// <inheritdoc/>
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;
}
}
}
}