From 8309431b7ef520d0c7a29a85db540132184ee307 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 19 Nov 2020 12:41:17 +0100 Subject: [PATCH] Fixed the sample shader --- samples/ComputeSharp.Sample/Program.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/samples/ComputeSharp.Sample/Program.cs b/samples/ComputeSharp.Sample/Program.cs index 5d2cfcf5..b8911879 100644 --- a/samples/ComputeSharp.Sample/Program.cs +++ b/samples/ComputeSharp.Sample/Program.cs @@ -27,7 +27,7 @@ namespace ComputeSharp.Sample using ReadWriteBuffer gpuBuffer = Gpu.Default.AllocateReadWriteBuffer(array); // Run the shader - Gpu.Default.For(100, new MainKernel(width, gpuBuffer)); + Gpu.Default.For(100, new MainKernel(gpuBuffer)); // Get the data back gpuBuffer.GetData(array); @@ -43,22 +43,18 @@ namespace ComputeSharp.Sample /// private readonly struct MainKernel : IComputeShader { - private readonly int width; - private readonly ReadWriteBuffer buffer; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public MainKernel(int width, ReadWriteBuffer buffer) + public MainKernel(ReadWriteBuffer buffer) { - this.width = width; this.buffer = buffer; } /// public void Execute(ThreadIds ids) { - int offset = ids.X + ids.Y * width; - buffer[offset] *= 2; + buffer[ids.X] *= 2; } }