diff --git a/samples/ComputeSharp.NativeLibrary/NativeLibrary.cs b/samples/ComputeSharp.NativeLibrary/NativeLibrary.cs
index dcc9637a..ce1c77a3 100644
--- a/samples/ComputeSharp.NativeLibrary/NativeLibrary.cs
+++ b/samples/ComputeSharp.NativeLibrary/NativeLibrary.cs
@@ -37,7 +37,7 @@ public static unsafe class Library
/// Sets the constant buffer for the input ID2D1Effect (assumed to be ).
///
///
- ///
+ ///
/// The horizontal dispatch size for the current output.
/// The vertical dispatch size for the current output.
///
@@ -57,6 +57,11 @@ public static unsafe class Library
}
}
+///
+/// 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(HelloWorld))]
[D2DEffectDescription("A hello world effect that displays a color gradient.")]
[D2DEffectCategory("Render")]
@@ -65,25 +70,14 @@ public static unsafe class Library
[D2DRequiresScenePosition]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DGeneratedPixelShaderDescriptor]
-[AutoConstructor]
-internal readonly partial struct HelloWorld : ID2D1PixelShader
+internal readonly partial struct HelloWorld(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);
}