From 2f8adcb9504f0bc386674d9f0701cb81b0ede69a Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Fri, 30 Aug 2019 18:46:15 +0200 Subject: [PATCH] Minor tweak to the bokeh blur processor --- .../Processor/HlslBokehBlurProcessor{TPixel}.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/samples/ComputeSharp.BokehBlur/Processor/HlslBokehBlurProcessor{TPixel}.cs b/samples/ComputeSharp.BokehBlur/Processor/HlslBokehBlurProcessor{TPixel}.cs index e9ccc416..82ca2d3c 100644 --- a/samples/ComputeSharp.BokehBlur/Processor/HlslBokehBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.BokehBlur/Processor/HlslBokehBlurProcessor{TPixel}.cs @@ -442,15 +442,13 @@ namespace ComputeSharp.BokehBlur.Processor float w, int width, int height) { - Gpu.Default.For(height, id => + Gpu.Default.For(width, height, id => { - for (int x = 0; x < width; x++) - { - Vector4 real = source[id.X * width * 2 + x * 2]; - Vector4 imaginary = source[id.X * width * 2 + x * 2 + 1]; + int offsetXY = id.Y * width * 2 + id.X * 2; + Vector4 real = source[offsetXY]; + Vector4 imaginary = source[offsetXY + 1]; - target[id.X * width + x] += real * z + imaginary * w; - } + target[id.Y * width + id.X] += real * z + imaginary * w; }); } }