I have a single compute shader that has two distinct steps.
I need the first step to be finished, before starting the second step
(i.e. threads in the second step use data that could be produced by any thread in the previous step).
I have separated the two steps into two functions in my compute shader.
Is there a way to synchronize them inside the compute shader?
Or do I need to do it by calling Dispatch twice, and run one of the methods depending on the value in a cbuffer?
[numthreads(128, 1, 1)]
void CSMAIN(uint3 DispatchThreadID : SV_DispatchThreadID, uint GroupID : SV_GroupID)
{
if (DispatchThreadID.x < N)
{
StepOne(DispatchThreadID.x);
//synchronization here?
StepTwo(DispatchThreadID.x);
}
}