1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 17:15:34 +00:00

Merge branch 'fix_gpu_osg_stats' into 'master'

Delay OSG stats reporting for 3 frames

See merge request OpenMW/openmw!2677
This commit is contained in:
psi29a 2023-02-01 22:49:18 +00:00
commit 9c92a8ab57

View file

@ -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);
}
}