diff --git a/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs b/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs index c6552951c..f99063c17 100644 --- a/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs +++ b/samples/ComputeSharp.NativeLibrary.WinRT/HelloWorldEffect.cs @@ -14,10 +14,10 @@ public sealed partial class HelloWorldEffect : CanvasEffect /// private static readonly CanvasEffectNode> EffectNode = new(); - /// + /// private float time; - /// + /// private Rect dispatchArea; /// @@ -55,8 +55,10 @@ protected override void ConfigureEffectGraph(CanvasEffectGraph effectGraph) } /// - /// The D2D1 shader for . + /// A hello world effect that displays a color gradient. /// + /// The current time since the start of the application. + /// The dispatch size for the current output. [D2DEffectDisplayName(nameof(HelloWorldEffect))] [D2DEffectDescription("A hello world effect that displays a color gradient.")] [D2DEffectCategory("Render")] @@ -65,25 +67,14 @@ protected override void ConfigureEffectGraph(CanvasEffectGraph effectGraph) [D2DRequiresScenePosition] [D2DShaderProfile(D2D1ShaderProfile.PixelShader50)] [D2DGeneratedPixelShaderDescriptor] - [AutoConstructor] - internal readonly partial struct Shader : ID2D1PixelShader + internal readonly partial struct Shader(float time, int2 dispatchSize) : ID2D1PixelShader { - /// - /// The current time since the start of the application. - /// - private readonly float time; - - /// - /// The dispatch size for the current output. - /// - private readonly int2 dispatchSize; - /// public float4 Execute() { int2 xy = (int2)D2D.GetScenePosition().XY; - float2 uv = xy / (float2)this.dispatchSize; - float3 color = 0.5f + (0.5f * Hlsl.Cos(this.time + new float3(uv, uv.X) + new float3(0, 2, 4))); + float2 uv = xy / (float2)dispatchSize; + float3 color = 0.5f + (0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4))); return new(color, 1f); }