Fix rare crash on division by 0

This commit is contained in:
Wojtek Figat
2022-02-20 20:28:19 +01:00
parent 111a2f3b25
commit 3a07d767fb

View File

@@ -423,7 +423,7 @@ void ShadowsOfMordor::Builder::onJobRender(GPUContext* context)
#endif
// Report progress
float hemispheresProgress = static_cast<float>(_workerStagePosition1) / lightmapEntry.Hemispheres.Count();
float hemispheresProgress = static_cast<float>(_workerStagePosition1) / Math::Max(lightmapEntry.Hemispheres.Count(), 1);
float lightmapsProgress = static_cast<float>(_workerStagePosition0 + hemispheresProgress) / scene->Lightmaps.Count();
float bouncesProgress = static_cast<float>(_giBounceRunningIndex) / _bounceCount;
reportProgress(BuildProgressStep::RenderHemispheres, lightmapsProgress / _bounceCount + bouncesProgress);