Merge branch 'fix_gpu_osg_stats' into 'master'

Delay OSG stats reporting for 3 frames

See merge request OpenMW/openmw!2677
7220-lua-add-a-general-purpose-lexical-parser
psi29a 2 years ago
commit 9c92a8ab57

@ -939,14 +939,16 @@ void OMW::Engine::go()
if (stats)
{
constexpr unsigned statsReportDelay = 3;
const auto frameNumber = mViewer->getFrameStamp()->getFrameNumber();
if (frameNumber >= 2)
if (frameNumber >= statsReportDelay)
{
mViewer->getViewerStats()->report(stats, frameNumber - 2);
const unsigned reportFrameNumber = frameNumber - statsReportDelay;
mViewer->getViewerStats()->report(stats, reportFrameNumber);
osgViewer::Viewer::Cameras cameras;
mViewer->getCameras(cameras);
for (auto camera : cameras)
camera->getStats()->report(stats, frameNumber - 2);
camera->getStats()->report(stats, reportFrameNumber);
}
}

Loading…
Cancel
Save