I'm using Unity to launch an HLSL kernel on the GPU. The function I'm using is ComputeShader.Dispatch
but if you're not familiar with Unity, this function only dispatches the shader on the GPU and it takes as parameters, the size x, y and z of the thread group you want.
Here is my problem, I sometimes want to run this kernel an odd amount of times.
I could call Dispatch
with an odd size, but doing so would mean defining my kernel like so [numthreads(1,1,1)]
which is known for being ineficient.
How do you manage your threads to treat odd textures, or other irregular shapes?
Many thanks