From a52074b746c534056992c5737c33c29a9ec49bb7 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 14 Aug 2019 22:26:41 +0200 Subject: [PATCH] Fixed automatic calculation of thread nums --- src/ComputeSharp.Shaders/ShaderRunner.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ComputeSharp.Shaders/ShaderRunner.cs b/src/ComputeSharp.Shaders/ShaderRunner.cs index 15fceec9..0f7351b0 100644 --- a/src/ComputeSharp.Shaders/ShaderRunner.cs +++ b/src/ComputeSharp.Shaders/ShaderRunner.cs @@ -28,10 +28,10 @@ namespace ComputeSharp.Shaders public static void Run(GraphicsDevice device, int x, int y, int z, Action action) { // Calculate the optimized thread num values - int - threadsX = device.WavefrontSize, - threadsY = y > 1 ? device.WavefrontSize : 1, - threadsZ = z > 1 ? device.WavefrontSize : 1; + int threadsX, threadsY = 1, threadsZ = 1; + if (y == 1 && z == 1) threadsX = device.WavefrontSize; + else if (z == 1) threadsX = threadsY = 8; + else threadsX = threadsY = threadsZ = 4; Run(device, x, y, z, threadsX, threadsY, threadsZ, action); }