diff --git a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs index 8e60a9ff..b3ab8088 100644 --- a/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.Shared/HelloWorld.cs @@ -1,28 +1,27 @@ -namespace ComputeSharp.SwapChain.Shaders +namespace ComputeSharp.SwapChain.Shaders; + +/// +/// A simple shader to get started with based on shadertoy new shader template. +/// Ported from . +/// +[AutoConstructor] +internal readonly partial struct HelloWorld : IPixelShader { /// - /// A simple shader to get started with based on shadertoy new shader template. - /// Ported from . + /// The current time since the start of the application. /// - [AutoConstructor] - internal readonly partial struct HelloWorld : IPixelShader + public readonly float time; + + /// + public float4 Execute() { - /// - /// The current time since the start of the application. - /// - public readonly float time; + // Normalized screen space UV coordinates from 0.0 to 1.0 + float2 uv = ThreadIds.Normalized.XY; - /// - public float4 Execute() - { - // Normalized screen space UV coordinates from 0.0 to 1.0 - float2 uv = ThreadIds.Normalized.XY; + // Time varying pixel color + float3 col = 0.5f + 0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)); - // Time varying pixel color - 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); - } + // Output to screen + return new(col, 1f); } } diff --git a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs index aab1ab01..09e3e831 100644 --- a/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs +++ b/tests/ComputeSharp.Tests/Shaders/Compute/HelloWorld.cs @@ -1,28 +1,27 @@ -namespace ComputeSharp.SwapChain.Shaders.Compute +namespace ComputeSharp.SwapChain.Shaders.Compute; + +/// +/// A simple shader to get started with based on shadertoy new shader template. +/// Ported from . +/// +[AutoConstructor] +internal readonly partial struct HelloWorld : IPixelShader { /// - /// A simple shader to get started with based on shadertoy new shader template. - /// Ported from . + /// The current time since the start of the application. /// - [AutoConstructor] - internal readonly partial struct HelloWorld : IPixelShader + public readonly float time; + + /// + public float4 Execute() { - /// - /// The current time since the start of the application. - /// - public readonly float time; + // Normalized screen space UV coordinates from 0.0 to 1.0 + float2 uv = ThreadIds.Normalized.XY; - /// - public float4 Execute() - { - // Normalized screen space UV coordinates from 0.0 to 1.0 - float2 uv = ThreadIds.Normalized.XY; + // Time varying pixel color + float3 col = 0.5f + 0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)); - // Time varying pixel color - 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); - } + // Output to screen + return new(col, 1f); } }