Showing the changes to interface/src/Application.cpp (1 of 218 files). Show all
Unified · Split
| @@ -14,17 +14,20 @@ · 13 unmodified lines | |||
| 14 | #include <chrono> | 14 | #include <chrono> |
| 15 | #include <thread> | 15 | #include <thread> |
| 16 | 16 | ||
| 17 | #include <gl/Config.h> | ||
| 18 | #include <glm/glm.hpp> | 17 | #include <glm/glm.hpp> |
| 19 | #include <glm/gtx/component_wise.hpp> | 18 | #include <glm/gtx/component_wise.hpp> |
| 20 | #include <glm/gtx/quaternion.hpp> | 19 | #include <glm/gtx/quaternion.hpp> |
| 21 | #include <glm/gtx/vector_angle.hpp> | 20 | #include <glm/gtx/vector_angle.hpp> |
| 22 | #include <glm/gtc/type_ptr.hpp> | 21 | #include <glm/gtc/type_ptr.hpp> |
| 23 | 22 | ||
| 23 | #include <gl/Config.h> | ||
| 24 | |||
| 25 | #include <QtCore/QResource> | ||
| 24 | #include <QtCore/QAbstractNativeEventFilter> | 26 | #include <QtCore/QAbstractNativeEventFilter> |
| 25 | #include <QtCore/QCommandLineParser> | 27 | #include <QtCore/QCommandLineParser> |
| 26 | #include <QtCore/QMimeData> | 28 | #include <QtCore/QMimeData> |
| 27 | #include <QtCore/QThreadPool> | 29 | #include <QtCore/QThreadPool> |
| 30 | #include <QtCore/QFileSelector> | ||
| 28 | #include <QtConcurrent/QtConcurrentRun> | 31 | #include <QtConcurrent/QtConcurrentRun> |
| 29 | 32 | ||
| 30 | #include <QtGui/QScreen> | 33 | #include <QtGui/QScreen> |
| @@ -49,6 +52,7 @@ · 18 unmodified lines | |||
| 49 | 52 | ||
| 50 | #include <gl/QOpenGLContextWrapper.h> | 53 | #include <gl/QOpenGLContextWrapper.h> |
| 51 | 54 | ||
| 55 | #include <shared/FileUtils.h> | ||
| 52 | #include <shared/QtHelpers.h> | 56 | #include <shared/QtHelpers.h> |
| 53 | #include <shared/GlobalAppProperties.h> | 57 | #include <shared/GlobalAppProperties.h> |
| 54 | #include <StatTracker.h> | 58 | #include <StatTracker.h> |
| @@ -211,8 +215,6 @@ · 156 unmodified lines | |||
| 211 | #include "webbrowser/WebBrowserSuggestionsEngine.h" | 215 | #include "webbrowser/WebBrowserSuggestionsEngine.h" |
| 212 | #include <DesktopPreviewProvider.h> | 216 | #include <DesktopPreviewProvider.h> |
| 213 | 217 | ||
| 214 | // On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU | ||
| 215 | // FIXME seems to be broken. | ||
| 216 | #if defined(Q_OS_WIN) | 218 | #if defined(Q_OS_WIN) |
| 217 | #include <VersionHelpers.h> | 219 | #include <VersionHelpers.h> |
| 218 | 220 | ||
| @@ -227,11 +229,17 @@ · 8 unmodified lines | |||
| 227 | #undef QT_BOOTSTRAPPED | 229 | #undef QT_BOOTSTRAPPED |
| 228 | #endif | 230 | #endif |
| 229 | 231 | ||
| 232 | // On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU | ||
| 233 | // FIXME seems to be broken. | ||
| 230 | extern "C" { | 234 | extern "C" { |
| 231 | _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; | 235 | _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; |
| 232 | } | 236 | } |
| 233 | #endif | 237 | #endif |
| 234 | 238 | ||
| 239 | #if defined(Q_OS_ANDROID) | ||
| 240 | #include <android/log.h> | ||
| 241 | #endif | ||
| 242 | |||
| 235 | enum ApplicationEvent { | 243 | enum ApplicationEvent { |
| 236 | // Execute a lambda function | 244 | // Execute a lambda function |
| 237 | Lambda = QEvent::User + 1, | 245 | Lambda = QEvent::User + 1, |
| @@ -241,7 +249,6 @@ enum ApplicationEvent { · 3 unmodified lines | |||
| 241 | Idle, | 249 | Idle, |
| 242 | }; | 250 | }; |
| 243 | 251 | ||
| 244 | |||
| 245 | class RenderEventHandler : public QObject { | 252 | class RenderEventHandler : public QObject { |
| 246 | using Parent = QObject; | 253 | using Parent = QObject; |
| 247 | Q_OBJECT | 254 | Q_OBJECT |
| @@ -305,9 +312,19 @@ static QTimer locationUpdateTimer; · 57 unmodified lines | |||
| 305 | static QTimer identityPacketTimer; | 312 | static QTimer identityPacketTimer; |
| 306 | static QTimer pingTimer; | 313 | static QTimer pingTimer; |
| 307 | 314 | ||
| 308 | static const QString DISABLE_WATCHDOG_FLAG("HIFI_DISABLE_WATCHDOG"); | 315 | #if defined(Q_OS_ANDROID) |
| 316 | static bool DISABLE_WATCHDOG = true; | ||
| 317 | #else | ||
| 318 | static const QString DISABLE_WATCHDOG_FLAG{ "HIFI_DISABLE_WATCHDOG" }; | ||
| 309 | static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); | 319 | static bool DISABLE_WATCHDOG = QProcessEnvironment::systemEnvironment().contains(DISABLE_WATCHDOG_FLAG); |
| 320 | #endif | ||
| 310 | 321 | ||
| 322 | #if defined(USE_GLES) | ||
| 323 | static bool DISABLE_DEFERRED = true; | ||
| 324 | #else | ||
| 325 | static const QString RENDER_FORWARD{ "HIFI_RENDER_FORWARD" }; | ||
| 326 | static bool DISABLE_DEFERRED = QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD); | ||
| 327 | #endif | ||
| 311 | 328 | ||
| 312 | static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; | 329 | static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16; |
| 313 | 330 | ||
| @@ -504,7 +521,13 @@ public: · 190 unmodified lines | |||
| 504 | } | 521 | } |
| 505 | 522 | ||
| 506 | if (message->message == WM_DEVICECHANGE) { | 523 | if (message->message == WM_DEVICECHANGE) { |
| 507 | Midi::USBchanged(); // re-scan the MIDI bus | 524 | const float MIN_DELTA_SECONDS = 2.0f; // de-bounce signal |
| 525 | static float lastTriggerTime = 0.0f; | ||
| 526 | const float deltaSeconds = secTimestampNow() - lastTriggerTime; | ||
| 527 | lastTriggerTime = secTimestampNow(); | ||
| 528 | if (deltaSeconds > MIN_DELTA_SECONDS) { | ||
| 529 | Midi::USBchanged(); // re-scan the MIDI bus | ||
| 530 | } | ||
| 508 | } | 531 | } |
| 509 | } | 532 | } |
| 510 | return false; | 533 | return false; |
| @@ -531,6 +554,26 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 20 unmodified lines | |||
| 531 | #ifdef Q_OS_WIN | 554 | #ifdef Q_OS_WIN |
| 532 | OutputDebugStringA(logMessage.toLocal8Bit().constData()); | 555 | OutputDebugStringA(logMessage.toLocal8Bit().constData()); |
| 533 | OutputDebugStringA("\n"); | 556 | OutputDebugStringA("\n"); |
| 557 | #elif defined Q_OS_ANDROID | ||
| 558 | const char * local=logMessage.toStdString().c_str(); | ||
| 559 | switch (type) { | ||
| 560 | case QtDebugMsg: | ||
| 561 | __android_log_write(ANDROID_LOG_DEBUG,"Interface",local); | ||
| 562 | break; | ||
| 563 | case QtInfoMsg: | ||
| 564 | __android_log_write(ANDROID_LOG_INFO,"Interface",local); | ||
| 565 | break; | ||
| 566 | case QtWarningMsg: | ||
| 567 | __android_log_write(ANDROID_LOG_WARN,"Interface",local); | ||
| 568 | break; | ||
| 569 | case QtCriticalMsg: | ||
| 570 | __android_log_write(ANDROID_LOG_ERROR,"Interface",local); | ||
| 571 | break; | ||
| 572 | case QtFatalMsg: | ||
| 573 | default: | ||
| 574 | __android_log_write(ANDROID_LOG_FATAL,"Interface",local); | ||
| 575 | abort(); | ||
| 576 | } | ||
| 534 | #endif | 577 | #endif |
| 535 | qApp->getLogger()->addMessage(qPrintable(logMessage + "\n")); | 578 | qApp->getLogger()->addMessage(qPrintable(logMessage + "\n")); |
| 536 | } | 579 | } |
| @@ -594,6 +637,24 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 57 unmodified lines | |||
| 594 | qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, cacheDir); | 637 | qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, cacheDir); |
| 595 | } | 638 | } |
| 596 | 639 | ||
| 640 | // FIXME fix the OSX installer to install the resources.rcc binary instead of resource files and remove | ||
| 641 | // this conditional exclusion | ||
| 642 | #if !defined(Q_OS_OSX) | ||
| 643 | { | ||
| 644 | #if defined(Q_OS_ANDROID) | ||
| 645 | const QString resourcesBinaryFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/resources.rcc"; | ||
| 646 | #else | ||
| 647 | const QString resourcesBinaryFile = QCoreApplication::applicationDirPath() + "/resources.rcc"; | ||
| 648 | #endif | ||
| 649 | if (!QFile::exists(resourcesBinaryFile)) { | ||
| 650 | throw std::runtime_error("Unable to find primary resources"); | ||
| 651 | } | ||
| 652 | if (!QResource::registerResource(resourcesBinaryFile)) { | ||
| 653 | throw std::runtime_error("Unable to load primary resources"); | ||
| 654 | } | ||
| 655 | } | ||
| 656 | #endif | ||
| 657 | |||
| 597 | Setting::init(); | 658 | Setting::init(); |
| 598 | 659 | ||
| 599 | // Tell the plugin manager about our statically linked plugins | 660 | // Tell the plugin manager about our statically linked plugins |
| @@ -637,11 +698,11 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 37 unmodified lines | |||
| 637 | DependencyManager::set<StatTracker>(); | 698 | DependencyManager::set<StatTracker>(); |
| 638 | DependencyManager::set<ScriptEngines>(ScriptEngine::CLIENT_SCRIPT); | 699 | DependencyManager::set<ScriptEngines>(ScriptEngine::CLIENT_SCRIPT); |
| 639 | DependencyManager::set<Preferences>(); | 700 | DependencyManager::set<Preferences>(); |
| 640 | DependencyManager::set<recording::ClipCache>(); | ||
| 641 | DependencyManager::set<recording::Deck>(); | 701 | DependencyManager::set<recording::Deck>(); |
| 642 | DependencyManager::set<recording::Recorder>(); | 702 | DependencyManager::set<recording::Recorder>(); |
| 643 | DependencyManager::set<AddressManager>(); | 703 | DependencyManager::set<AddressManager>(); |
| 644 | DependencyManager::set<NodeList>(NodeType::Agent, listenPort); | 704 | DependencyManager::set<NodeList>(NodeType::Agent, listenPort); |
| 705 | DependencyManager::set<recording::ClipCache>(); | ||
| 645 | DependencyManager::set<GeometryCache>(); | 706 | DependencyManager::set<GeometryCache>(); |
| 646 | DependencyManager::set<ModelCache>(); | 707 | DependencyManager::set<ModelCache>(); |
| 647 | DependencyManager::set<ScriptCache>(); | 708 | DependencyManager::set<ScriptCache>(); |
| @@ -730,8 +791,10 @@ OverlayID _keyboardFocusHighlightID{ UNKNOWN_OVERLAY_ID }; · 82 unmodified lines | |||
| 730 | // | 791 | // |
| 731 | // So instead we create a new offscreen context to share with the QGLWidget, | 792 | // So instead we create a new offscreen context to share with the QGLWidget, |
| 732 | // and manually set THAT to be the shared context for the Chromium helper | 793 | // and manually set THAT to be the shared context for the Chromium helper |
| 794 | #if !defined(DISABLE_QML) | ||
| 733 | OffscreenGLCanvas* _chromiumShareContext { nullptr }; | 795 | OffscreenGLCanvas* _chromiumShareContext { nullptr }; |
| 734 | Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); | 796 | Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); |
| 797 | #endif | ||
| 735 | 798 | ||
| 736 | Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 }; | 799 | Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 }; |
| 737 | 800 | ||
| @@ -777,6 +840,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 39 unmodified lines | |||
| 777 | _sampleSound(nullptr) | 840 | _sampleSound(nullptr) |
| 778 | 841 | ||
| 779 | { | 842 | { |
| 843 | |||
| 780 | auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); | 844 | auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); |
| 781 | setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); | 845 | setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); |
| 782 | setProperty(hifi::properties::CRASHED, _previousSessionCrashed); | 846 | setProperty(hifi::properties::CRASHED, _previousSessionCrashed); |
| @@ -997,8 +1061,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 214 unmodified lines | |||
| 997 | DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress); | 1061 | DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress); |
| 998 | 1062 | ||
| 999 | // Inititalize sample before registering | 1063 | // Inititalize sample before registering |
| 1000 | QFileInfo infSample = QFileInfo(PathUtils::resourcesPath() + "sounds/sample.wav"); | 1064 | _sampleSound = DependencyManager::get<SoundCache>()->getSound(PathUtils::resourcesUrl("sounds/sample.wav")); |
| 1001 | _sampleSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(infSample.absoluteFilePath())); | ||
| 1002 | 1065 | ||
| 1003 | auto scriptEngines = DependencyManager::get<ScriptEngines>().data(); | 1066 | auto scriptEngines = DependencyManager::get<ScriptEngines>().data(); |
| 1004 | scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){ | 1067 | scriptEngines->registerScriptInitializer([this](ScriptEnginePointer engine){ |
| @@ -1083,9 +1146,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 78 unmodified lines | |||
| 1083 | // Make sure we don't time out during slow operations at startup | 1146 | // Make sure we don't time out during slow operations at startup |
| 1084 | updateHeartbeat(); | 1147 | updateHeartbeat(); |
| 1085 | 1148 | ||
| 1086 | // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. | ||
| 1087 | DependencyManager::get<GeometryCache>()->initializeShapePipelines(); | ||
| 1088 | |||
| 1089 | // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. | 1149 | // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. |
| 1090 | // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. | 1150 | // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. |
| 1091 | static const QString TESTER = "HIFI_TESTER"; | 1151 | static const QString TESTER = "HIFI_TESTER"; |
| @@ -1731,7 +1791,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 639 unmodified lines | |||
| 1731 | static int lastCountOfNearbyAvatars = -1; | 1791 | static int lastCountOfNearbyAvatars = -1; |
| 1732 | QTimer* checkNearbyAvatarsTimer = new QTimer(this); | 1792 | QTimer* checkNearbyAvatarsTimer = new QTimer(this); |
| 1733 | checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok | 1793 | checkNearbyAvatarsTimer->setInterval(CHECK_NEARBY_AVATARS_INTERVAL_MS); // 10 seconds, Qt::CoarseTimer ok |
| 1734 | connect(checkNearbyAvatarsTimer, &QTimer::timeout, this, [this]() { | 1794 | connect(checkNearbyAvatarsTimer, &QTimer::timeout, this, []() { |
| 1735 | auto avatarManager = DependencyManager::get<AvatarManager>(); | 1795 | auto avatarManager = DependencyManager::get<AvatarManager>(); |
| 1736 | int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getWorldPosition(), | 1796 | int nearbyAvatars = avatarManager->numberOfAvatarsInRange(avatarManager->getMyAvatar()->getWorldPosition(), |
| 1737 | NEARBY_AVATAR_RADIUS_METERS) - 1; | 1797 | NEARBY_AVATAR_RADIUS_METERS) - 1; |
| @@ -1770,9 +1830,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 32 unmodified lines | |||
| 1770 | PROFILE_RANGE(render, "Process Default Skybox"); | 1830 | PROFILE_RANGE(render, "Process Default Skybox"); |
| 1771 | auto textureCache = DependencyManager::get<TextureCache>(); | 1831 | auto textureCache = DependencyManager::get<TextureCache>(); |
| 1772 | 1832 | ||
| 1773 | auto skyboxUrl = PathUtils::resourcesPath().toStdString() + "images/Default-Sky-9-cubemap.ktx"; | 1833 | QFileSelector fileSelector; |
| 1834 | fileSelector.setExtraSelectors(FileUtils::getFileSelectors()); | ||
| 1835 | auto skyboxUrl = fileSelector.select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx"); | ||
| 1774 | 1836 | ||
| 1775 | _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl); | 1837 | _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl.toStdString()); |
| 1776 | _defaultSkyboxAmbientTexture = _defaultSkyboxTexture; | 1838 | _defaultSkyboxAmbientTexture = _defaultSkyboxTexture; |
| 1777 | 1839 | ||
| 1778 | _defaultSkybox->setCubemap(_defaultSkyboxTexture); | 1840 | _defaultSkybox->setCubemap(_defaultSkyboxTexture); |
| @@ -1783,8 +1845,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 4 unmodified lines | |||
| 1783 | return entityServerNode && !isPhysicsEnabled(); | 1845 | return entityServerNode && !isPhysicsEnabled(); |
| 1784 | }); | 1846 | }); |
| 1785 | 1847 | ||
| 1786 | QFileInfo infSnap = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); | 1848 | _snapshotSound = DependencyManager::get<SoundCache>()->getSound(PathUtils::resourcesUrl("sounds/snap.wav")); |
| 1787 | _snapshotSound = DependencyManager::get<SoundCache>()->getSound(QUrl::fromLocalFile(infSnap.absoluteFilePath())); | ||
| 1788 | 1849 | ||
| 1789 | QVariant testProperty = property(hifi::properties::TEST); | 1850 | QVariant testProperty = property(hifi::properties::TEST); |
| 1790 | qDebug() << testProperty; | 1851 | qDebug() << testProperty; |
| @@ -2182,11 +2243,16 @@ void Application::initializeGL() { · 391 unmodified lines | |||
| 2182 | } | 2243 | } |
| 2183 | 2244 | ||
| 2184 | _glWidget->makeCurrent(); | 2245 | _glWidget->makeCurrent(); |
| 2185 | _chromiumShareContext = new OffscreenGLCanvas(); | 2246 | |
| 2186 | _chromiumShareContext->setObjectName("ChromiumShareContext"); | 2247 | #if !defined(DISABLE_QML) |
| 2187 | _chromiumShareContext->create(_glWidget->qglContext()); | 2248 | if (!nsightActive()) { |
| 2188 | _chromiumShareContext->makeCurrent(); | 2249 | _chromiumShareContext = new OffscreenGLCanvas(); |
| 2189 | qt_gl_set_global_share_context(_chromiumShareContext->getContext()); | 2250 | _chromiumShareContext->setObjectName("ChromiumShareContext"); |
| 2251 | _chromiumShareContext->create(_glWidget->qglContext()); | ||
| 2252 | _chromiumShareContext->makeCurrent(); | ||
| 2253 | qt_gl_set_global_share_context(_chromiumShareContext->getContext()); | ||
| 2254 | } | ||
| 2255 | #endif | ||
| 2190 | 2256 | ||
| 2191 | _glWidget->makeCurrent(); | 2257 | _glWidget->makeCurrent(); |
| 2192 | gpu::Context::init<gpu::gl::GLBackend>(); | 2258 | gpu::Context::init<gpu::gl::GLBackend>(); |
| @@ -2203,13 +2269,17 @@ void Application::initializeGL() { · 10 unmodified lines | |||
| 2203 | // Set up the render engine | 2269 | // Set up the render engine |
| 2204 | render::CullFunctor cullFunctor = LODManager::shouldRender; | 2270 | render::CullFunctor cullFunctor = LODManager::shouldRender; |
| 2205 | static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; | 2271 | static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD"; |
| 2206 | bool isDeferred = !QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD); | ||
| 2207 | _renderEngine->addJob<UpdateSceneTask>("UpdateScene"); | 2272 | _renderEngine->addJob<UpdateSceneTask>("UpdateScene"); |
| 2208 | _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor); | 2273 | #ifndef Q_OS_ANDROID |
| 2209 | _renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, isDeferred, render::ItemKey::VISIBLE_MASK_0, render::ItemKey::VISIBLE_MASK_0); | 2274 | _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED); |
| 2275 | #endif | ||
| 2276 | _renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::VISIBLE_MASK_0, render::ItemKey::VISIBLE_MASK_0); | ||
| 2210 | _renderEngine->load(); | 2277 | _renderEngine->load(); |
| 2211 | _renderEngine->registerScene(_main3DScene); | 2278 | _renderEngine->registerScene(_main3DScene); |
| 2212 | 2279 | ||
| 2280 | // Now that OpenGL is initialized, we are sure we have a valid context and can create the various pipeline shaders with success. | ||
| 2281 | DependencyManager::get<GeometryCache>()->initializeShapePipelines(); | ||
| 2282 | |||
| 2213 | _offscreenContext = new OffscreenGLCanvas(); | 2283 | _offscreenContext = new OffscreenGLCanvas(); |
| 2214 | _offscreenContext->setObjectName("MainThreadContext"); | 2284 | _offscreenContext->setObjectName("MainThreadContext"); |
| 2215 | _offscreenContext->create(_glWidget->qglContext()); | 2285 | _offscreenContext->create(_glWidget->qglContext()); |
| @@ -2314,8 +2384,7 @@ void Application::initializeUi() { · 98 unmodified lines | |||
| 2314 | offscreenUi->setProxyWindow(_window->windowHandle()); | 2384 | offscreenUi->setProxyWindow(_window->windowHandle()); |
| 2315 | // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to | 2385 | // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to |
| 2316 | // support the window management and scripting proxies for VR use | 2386 | // support the window management and scripting proxies for VR use |
| 2317 | offscreenUi->createDesktop(QString("hifi/Desktop.qml")); | 2387 | offscreenUi->createDesktop(PathUtils::qmlUrl("hifi/Desktop.qml")); |
| 2318 | |||
| 2319 | // FIXME either expose so that dialogs can set this themselves or | 2388 | // FIXME either expose so that dialogs can set this themselves or |
| 2320 | // do better detection in the offscreen UI of what has focus | 2389 | // do better detection in the offscreen UI of what has focus |
| 2321 | offscreenUi->setNavigationFocused(false); | 2390 | offscreenUi->setNavigationFocused(false); |
| @@ -3910,12 +3979,18 @@ void Application::idle() { · 1588 unmodified lines | |||
| 3910 | PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get<StatTracker>()->getStat("PendingProcessing").toInt()); | 3979 | PROFILE_COUNTER_IF_CHANGED(app, "pendingProcessing", int, DependencyManager::get<StatTracker>()->getStat("PendingProcessing").toInt()); |
| 3911 | auto renderConfig = _renderEngine->getConfiguration(); | 3980 | auto renderConfig = _renderEngine->getConfiguration(); |
| 3912 | PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_gpuContext->getFrameTimerGPUAverage()); | 3981 | PROFILE_COUNTER_IF_CHANGED(render, "gpuTime", float, (float)_gpuContext->getFrameTimerGPUAverage()); |
| 3982 | auto opaqueRangeTimer = renderConfig->getConfig("OpaqueRangeTimer"); | ||
| 3983 | auto linearDepth = renderConfig->getConfig("LinearDepth"); | ||
| 3984 | auto surfaceGeometry = renderConfig->getConfig("SurfaceGeometry"); | ||
| 3985 | auto renderDeferred = renderConfig->getConfig("RenderDeferred"); | ||
| 3986 | auto toneAndPostRangeTimer = renderConfig->getConfig("ToneAndPostRangeTimer"); | ||
| 3987 | |||
| 3913 | PROFILE_COUNTER(render_detail, "gpuTimes", { | 3988 | PROFILE_COUNTER(render_detail, "gpuTimes", { |
| 3914 | { "OpaqueRangeTimer", renderConfig->getConfig("OpaqueRangeTimer")->property("gpuRunTime") }, | 3989 | { "OpaqueRangeTimer", opaqueRangeTimer ? opaqueRangeTimer->property("gpuRunTime") : 0 }, |
| 3915 | { "LinearDepth", renderConfig->getConfig("LinearDepth")->property("gpuRunTime") }, | 3990 | { "LinearDepth", linearDepth ? linearDepth->property("gpuRunTime") : 0 }, |
| 3916 | { "SurfaceGeometry", renderConfig->getConfig("SurfaceGeometry")->property("gpuRunTime") }, | 3991 | { "SurfaceGeometry", surfaceGeometry ? surfaceGeometry->property("gpuRunTime") : 0 }, |
| 3917 | { "RenderDeferred", renderConfig->getConfig("RenderDeferred")->property("gpuRunTime") }, | 3992 | { "RenderDeferred", renderDeferred ? renderDeferred->property("gpuRunTime") : 0 }, |
| 3918 | { "ToneAndPostRangeTimer", renderConfig->getConfig("ToneAndPostRangeTimer")->property("gpuRunTime") } | 3993 | { "ToneAndPostRangeTimer", toneAndPostRangeTimer ? toneAndPostRangeTimer->property("gpuRunTime") : 0 } |
| 3919 | }); | 3994 | }); |
| 3920 | 3995 | ||
| 3921 | PROFILE_RANGE(app, __FUNCTION__); | 3996 | PROFILE_RANGE(app, __FUNCTION__); |
| @@ -4280,9 +4355,9 @@ void Application::init() { · 358 unmodified lines | |||
| 4280 | 4355 | ||
| 4281 | // Make sure Login state is up to date | 4356 | // Make sure Login state is up to date |
| 4282 | DependencyManager::get<DialogsManager>()->toggleLoginDialog(); | 4357 | DependencyManager::get<DialogsManager>()->toggleLoginDialog(); |
| 4283 | 4358 | if (!DISABLE_DEFERRED) { | |
| 4284 | DependencyManager::get<DeferredLightingEffect>()->init(); | 4359 | DependencyManager::get<DeferredLightingEffect>()->init(); |
| 4285 | 4360 | } | |
| 4286 | DependencyManager::get<AvatarManager>()->init(); | 4361 | DependencyManager::get<AvatarManager>()->init(); |
| 4287 | 4362 | ||
| 4288 | _timerStart.start(); | 4363 | _timerStart.start(); |
| @@ -5761,7 +5836,9 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 1472 unmodified lines | |||
| 5761 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, | 5836 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, |
| 5762 | LocationScriptingInterface::locationSetter); | 5837 | LocationScriptingInterface::locationSetter); |
| 5763 | 5838 | ||
| 5839 | #if !defined(Q_OS_ANDROID) | ||
| 5764 | scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor); | 5840 | scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor); |
| 5841 | #endif | ||
| 5765 | scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor); | 5842 | scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor); |
| 5766 | 5843 | ||
| 5767 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); | 5844 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); |