Hi. I've been doing calculations with a compute shader and I stumbled across the issue that the thread size has to be a fixed value and can't be changed at runtime (at least I think). I got around the issue by using a thread size of 1 and instead using multible threads. I was wondering if that impacts performance and how to get around it.
Compute shader:
//Thread size of 1
[numthreads(1,1,1)]
void DoStuff(uint3 id : SV_DispatchThreadID)
{
//DoStuff
}
Run the shader:
void runShader(int numThreadsPerAxis){
//and instead multible thread groups here
DoStuffShader.Dispatch(0, numThreadsPerAxis, numThreadsPerAxis, numThreadsPerAxis);
}
Thanks for the help and sorry for the bad explanation.
↧