OcclusionCullPipe stalls render thread

We’re doing some profiling on our latest game and if we have r.allowocclusionqueries 1 with r.hzbocclusion 0 then we get 200ms hitches on the render thread while it waits on occlusioncullpipe. Looking at the insights trace it doesn’t actually look like a problem where we’re waiting on the gpu either. It looks like the task is stalling because it’s waiting on recast, which is a completely unrelated system.

[Image Removed]

[Image Removed]

This thread seems relevant and it’s even mentioned that there’s a threading paradigm pre 5.5 that was responsible for this.

[Content removed]

We’re on 5.4 and too close to ship to be comfortable with an engine upgrade. I was wondering if this implementation has a CL which I could cherry pick and backport? Generally the occlusion system without hzb seems to be faster and better built with exception of these hitches. For now we’re using hzb because it’s more consistently hitch free, even though (I have mentioned this in another thread), hzb can cause the renderthread to wait for several ms due to waiting for the RHI to flush. The optimal scenario would would be to not run hzb and also address this hitch.

Thanks,

Brenden

Hi there,

You have a couple of options here. The easiest is to do what is suggested in the other thread using the ETaskFlags::DoNotRunInsideBusyWait flag for long running tasks like this that end up in your occlusion cull pipe. This should actually be quite easy for the recast tile generator, since it uses an AsyncTask, which already supports ETaskFlags. Look for:

RunningElement.AsyncTask->StartBackgroundTask()

in RecastNavMeshGenerator.cpp, and change it to:

RunningElement.AsyncTask->StartBackgroundTask(GThreadPool, EQueuedWorkPriority::Normal, EQueuedWorkFlags::DoNotRunInsideBusyWait);

The other option is to try to backport the CL like you suggested. This might be quite difficult though if the CL has too many dependencies or subsequent fixes. The main CL for this change is this one. You can try to cherry pick it to see if it applies cleanly, or without requiring too much conflict resolution.

Regards,

Lance Chaney