Jobify view culling (#3983)

* Jobify culling
* Move JobCompletion to stack

Signed-off-by: Tobias Alexander Franke <tobias.alexander.franke@huawei.com>

Co-authored-by: Tobias Alexander Franke <tobias.alexander.franke@huawei.com>
This commit is contained in:
Tobias Alexander Franke
2021-09-21 23:05:11 +02:00
committed by GitHub
parent 61a9223256
commit 9477da799b
@@ -730,12 +730,22 @@ namespace AZ
m_debugCtx.ResetCullStats();
m_debugCtx.m_numCullablesInScene = GetNumCullables();
AZ::JobCompletion beginCullingCompletion;
for (auto& view : views)
{
view->BeginCulling();
const auto cullingLambda = [&view]()
{
view->BeginCulling();
};
AZ::Job* cullingJob = AZ::CreateJobFunction(AZStd::move(cullingLambda), true, nullptr);
cullingJob->SetDependent(&beginCullingCompletion);
cullingJob->Start();
}
beginCullingCompletion.StartAndWaitForCompletion();
AuxGeomDrawPtr auxGeom;
if (m_debugCtx.m_debugDraw)
{