Fix implementation of compute HelloWorld shader

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-23 12:13:02 +01:00
1 親 a947655342
コミット 7be94e429d
1ファイル変更
+8 -3
+8 -3
ファイルの表示
@@ -9,15 +9,20 @@ namespace ComputeSharp.SwapChain.Shaders.Compute;
[AutoConstructor]
[ThreadGroupSize(DefaultThreadGroupSizes.XY)]
[GeneratedComputeShaderDescriptor]
internal readonly partial struct HelloWorld : IComputeShader<float4>
internal readonly partial struct HelloWorld : IComputeShader
{
/// <summary>
/// The target texture.
/// </summary>
private readonly IReadWriteNormalizedTexture2D<float4> texture;
/// <summary>
/// The current time since the start of the application.
/// </summary>
private readonly float time;
/// <inheritdoc/>
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<float4>
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);
}
}