1
0
Fork 0

Control number of database pager threads from prop

Previously we were hardcoded to 2 database pager threads,
one for files and one for http.

This commit adds a new property /sim/rendering/database-pager/threads
to control the number of threads on startup.

It also re-orders the code to set the database pager so that such
a setting has an effect.
This commit is contained in:
Stuart Buchanan 2022-12-01 16:37:35 +00:00
parent ff5752d1dd
commit ebe511439a

View file

@ -1435,20 +1435,22 @@ void fgStartNewReset()
sgUserDataInit( globals->get_props() );
unsigned int numDBPagerThreads = fgGetNode("/sim/rendering/database-pager/threads", true)->getIntValue(2);
if (composite_viewer) {
composite_viewer_view->getDatabasePager()->setUpThreads(2, 1);
composite_viewer_view->setDatabasePager(FGScenery::getPagerSingleton());
composite_viewer_view->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true, false);
composite_viewer_view->getDatabasePager()->setUpThreads(numDBPagerThreads, 1);
composite_viewer_view->getDatabasePager()->setAcceptNewDatabaseRequests(true);
flightgear::CameraGroup::buildDefaultGroup(composite_viewer_view);
composite_viewer_view->setFrameStamp(composite_viewer->getFrameStamp());
composite_viewer_view->setDatabasePager(FGScenery::getPagerSingleton());
composite_viewer_view->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true, false);
osg::GraphicsContext::createNewContextID();
render->setView(composite_viewer_view);
render->preinit();
composite_viewer->startThreading();
}
else {
viewer->getDatabasePager()->setUpThreads(2, 1);
viewer->getDatabasePager()->setUpThreads(numDBPagerThreads, 1);
viewer->getDatabasePager()->setAcceptNewDatabaseRequests(true);
// must do this before preinit for Rembrandthe
flightgear::CameraGroup::buildDefaultGroup(viewer.get());