From 7be94e429d4886e58a15887787550df5e91052e8 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 23 Nov 2023 12:13:02 +0100 Subject: [PATCH] Fix implementation of compute HelloWorld shader --- .../ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs index 5cbb4fde..6b7ca0b9 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs @@ -9,15 +9,20 @@ namespace ComputeSharp.SwapChain.Shaders.Compute; [AutoConstructor] [ThreadGroupSize(DefaultThreadGroupSizes.XY)] [GeneratedComputeShaderDescriptor] -internal readonly partial struct HelloWorld : IComputeShader +internal readonly partial struct HelloWorld : IComputeShader { + /// + /// The target texture. + /// + private readonly IReadWriteNormalizedTexture2D texture; + /// /// The current time since the start of the application. /// private readonly float time; /// - public float4 Execute() + public void Execute() { // Normalized screen space UV coordinates from 0.0 to 1.0 float2 uv = ThreadIds.Normalized.XY; @@ -26,6 +31,6 @@ internal readonly partial struct HelloWorld : IComputeShader float3 col = 0.5f + 0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)); // Output to screen - return new(col, 1f); + texture[ThreadIds.XY] = new float4(col, 1f); } } \ No newline at end of file