mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
Limit the number of concurrent file parsing threads
This commit is contained in:
parent
421160eeb6
commit
6a66d74e19
1 changed files with 18 additions and 3 deletions
|
@ -12,13 +12,13 @@
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include <gl/Config.h>
|
#include <gl/Config.h>
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/component_wise.hpp>
|
#include <glm/gtx/component_wise.hpp>
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
#include <glm/gtx/vector_angle.hpp>
|
#include <glm/gtx/vector_angle.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
|
#include <Qt>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QJsonDocument>
|
#include <QtCore/QJsonDocument>
|
||||||
#include <QtCore/QJsonObject>
|
#include <QtCore/QJsonObject>
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtCore/QAbstractNativeEventFilter>
|
#include <QtCore/QAbstractNativeEventFilter>
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
|
#include <QtCore/QThreadPool>
|
||||||
|
|
||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
#include <QtGui/QImage>
|
#include <QtGui/QImage>
|
||||||
|
@ -419,6 +420,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||||
_lastFaceTrackerUpdate(0)
|
_lastFaceTrackerUpdate(0)
|
||||||
{
|
{
|
||||||
|
// FIXME this may be excessivly conservative. On the other hand
|
||||||
|
// maybe I'm used to having an 8-core machine
|
||||||
|
// Perhaps find the ideal thread count and subtract 2 or 3
|
||||||
|
// (main thread, present thread, random OS load)
|
||||||
|
// More threads == faster concurrent loads, but also more concurrent
|
||||||
|
// load on the GPU until we can serialize GPU transfers (off the main thread)
|
||||||
|
QThreadPool::globalInstance()->setMaxThreadCount(2);
|
||||||
|
thread()->setPriority(QThread::HighPriority);
|
||||||
thread()->setObjectName("Main Thread");
|
thread()->setObjectName("Main Thread");
|
||||||
|
|
||||||
setInstance(this);
|
setInstance(this);
|
||||||
|
@ -1287,6 +1296,9 @@ void Application::initializeUi() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::paintGL() {
|
void Application::paintGL() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// paintGL uses a queued connection, so we can get messages from the queue even after we've quit
|
// paintGL uses a queued connection, so we can get messages from the queue even after we've quit
|
||||||
// and the plugins have shutdown
|
// and the plugins have shutdown
|
||||||
if (_aboutToQuit) {
|
if (_aboutToQuit) {
|
||||||
|
@ -4762,8 +4774,11 @@ void Application::updateDisplayMode() {
|
||||||
foreach(auto displayPlugin, standard) {
|
foreach(auto displayPlugin, standard) {
|
||||||
addDisplayPluginToMenu(displayPlugin, first);
|
addDisplayPluginToMenu(displayPlugin, first);
|
||||||
// This must be a queued connection to avoid a deadlock
|
// This must be a queued connection to avoid a deadlock
|
||||||
QObject::connect(displayPlugin.get(), &DisplayPlugin::requestRender,
|
QObject::connect(displayPlugin.get(), &DisplayPlugin::requestRender, [=] {
|
||||||
this, &Application::paintGL, Qt::QueuedConnection);
|
postEvent(this, new LambdaEvent([=] {
|
||||||
|
paintGL();
|
||||||
|
}), Qt::HighEventPriority);
|
||||||
|
});
|
||||||
|
|
||||||
QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) {
|
QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) {
|
||||||
resizeGL();
|
resizeGL();
|
||||||
|
|
Loading…
Reference in a new issue