Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all
Unified · Split
| @@ -44,6 +44,9 @@ · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | #include <QtNetwork/QNetworkDiskCache> |
| 46 | 46 | |
| 47 | +#include <gl/Config.h> | |
| 48 | +#include <QtGui/QOpenGLContext> | |
| 49 | + | |
| 47 | 50 | #include <AccountManager.h> |
| 48 | 51 | #include <AddressManager.h> |
| 49 | 52 | #include <ApplicationVersion.h> |
| @@ -150,8 +153,6 @@ · 100 unmodified lines | ||
| 150 | 153 | #include "InterfaceParentFinder.h" |
| 151 | 154 | |
| 152 | 155 | |
| 153 | −#include <gpu/GLBackend.h> | |
| 154 | −#include <QtGui/QOpenGLContext> | |
| 155 | 156 | |
| 156 | 157 | // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU |
| 157 | 158 | // FIXME seems to be broken. |
| @@ -1091,7 +1092,6 @@ void Application::paintGL() { · 933 unmodified lines | ||
| 1091 | 1092 | // update fps once a second |
| 1092 | 1093 | if (now - _lastFramesPerSecondUpdate > USECS_PER_SECOND) { |
| 1093 | 1094 | _fps = _framesPerSecond.getAverage(); |
| 1094 | − qDebug() << QString::number(_fps, 'g', 4); | |
| 1095 | 1095 | _lastFramesPerSecondUpdate = now; |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| @@ -1344,6 +1344,7 @@ void Application::paintGL() { · 246 unmodified lines | ||
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | 1346 | // Overlay Composition, needs to occur after screen space effects have completed |
| 1347 | + // FIXME migrate composition into the display plugins | |
| 1347 | 1348 | { |
| 1348 | 1349 | PROFILE_RANGE(__FUNCTION__ "/compositor"); |
| 1349 | 1350 | PerformanceTimer perfTimer("compositor"); |
| @@ -1372,7 +1373,6 @@ void Application::paintGL() { · 22 unmodified lines | ||
| 1372 | 1373 | { |
| 1373 | 1374 | PROFILE_RANGE(__FUNCTION__ "/pluginOutput"); |
| 1374 | 1375 | PerformanceTimer perfTimer("pluginOutput"); |
| 1375 | − uint64_t displayStart = usecTimestampNow(); | |
| 1376 | 1376 | auto primaryFramebuffer = framebufferCache->getPrimaryFramebuffer(); |
| 1377 | 1377 | auto scratchFramebuffer = framebufferCache->getFramebuffer(); |
| 1378 | 1378 | gpu::doInBatch(renderArgs._context, [=](gpu::Batch& batch) { |
| @@ -1386,12 +1386,18 @@ void Application::paintGL() { · 7 unmodified lines | ||
| 1386 | 1386 | }); |
| 1387 | 1387 | auto finalTexturePointer = scratchFramebuffer->getRenderBuffer(0); |
| 1388 | 1388 | GLuint finalTexture = gpu::GLBackend::getTextureID(finalTexturePointer); |
| 1389 | − | |
| 1390 | 1389 | Q_ASSERT(0 != finalTexture); |
| 1390 | + | |
| 1391 | 1391 | Q_ASSERT(!_lockedFramebufferMap.contains(finalTexture)); |
| 1392 | 1392 | _lockedFramebufferMap[finalTexture] = scratchFramebuffer; |
| 1393 | + | |
| 1394 | + uint64_t displayStart = usecTimestampNow(); | |
| 1393 | 1395 | Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext()); |
| 1394 | − displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size)); | |
| 1396 | + { | |
| 1397 | + PROFILE_RANGE(__FUNCTION__ "/pluginSubmitScene"); | |
| 1398 | + PerformanceTimer perfTimer("pluginSubmitScene"); | |
| 1399 | + displayPlugin->submitSceneTexture(_frameCount, finalTexture, toGlm(size)); | |
| 1400 | + } | |
| 1395 | 1401 | Q_ASSERT(QOpenGLContext::currentContext() == _offscreenContext->getContext()); |
| 1396 | 1402 | |
| 1397 | 1403 | uint64_t displayEnd = usecTimestampNow(); |
| @@ -4499,13 +4505,12 @@ void Application::toggleLogDialog() { · 3101 unmodified lines | ||
| 4499 | 4505 | } |
| 4500 | 4506 | |
| 4501 | 4507 | void Application::takeSnapshot() { |
| 4502 | −#if 0 | |
| 4503 | 4508 | QMediaPlayer* player = new QMediaPlayer(); |
| 4504 | 4509 | QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); |
| 4505 | 4510 | player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); |
| 4506 | 4511 | player->play(); |
| 4507 | 4512 | |
| 4508 | − QString fileName = Snapshot::saveSnapshot(_glWidget->grabFrameBuffer()); | |
| 4513 | + QString fileName = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot()); | |
| 4509 | 4514 | |
| 4510 | 4515 | AccountManager& accountManager = AccountManager::getInstance(); |
| 4511 | 4516 | if (!accountManager.isLoggedIn()) { |
| @@ -4516,7 +4521,6 @@ void Application::takeSnapshot() { · 4 unmodified lines | ||
| 4516 | 4521 | _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget); |
| 4517 | 4522 | } |
| 4518 | 4523 | _snapshotShareDialog->show(); |
| 4519 | −#endif | |
| 4520 | 4524 | } |
| 4521 | 4525 | |
| 4522 | 4526 | float Application::getRenderResolutionScale() const { |
| @@ -4728,6 +4732,7 @@ void Application::updateDisplayMode() { · 205 unmodified lines | ||
| 4728 | 4732 | bool first = true; |
| 4729 | 4733 | foreach(auto displayPlugin, displayPlugins) { |
| 4730 | 4734 | addDisplayPluginToMenu(displayPlugin, first); |
| 4735 | + // This must be a queued connection to avoid a deadlock | |
| 4731 | 4736 | QObject::connect(displayPlugin.get(), &DisplayPlugin::requestRender, |
| 4732 | 4737 | this, &Application::paintGL, Qt::QueuedConnection); |
| 4733 | 4738 | |