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
{
///
/// The current time since the start of the application.
///
public readonly float time;
///
public Float4 Execute()
{
// Normalized ScreenSpace UV coordinates from 0.0f to 1.0f
Float2 uv = new Float2(ThreadIds.Normalized.X, ThreadIds.Normalized.Y);
// 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);
}
}
}