diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f6cffb7c1..9876a0d7ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,7 @@ option(BUILD_MANUAL_TESTS "Build manual tests" ${BUILD_MANUAL_TESTS_OPTION}) option(BUILD_TOOLS "Build tools" ${BUILD_TOOLS_OPTION}) option(BUILD_INSTALLER "Build installer" ${BUILD_INSTALLER_OPTION}) option(USE_GLES "Use OpenGL ES" ${GLES_OPTION}) +option(USE_KHR_ROBUSTNESS "Use KHR_robustness" OFF) option(DISABLE_QML "Disable QML" ${DISABLE_QML_OPTION}) option(DISABLE_KTX_CACHE "Disable KTX Cache" OFF) option( @@ -149,6 +150,10 @@ option( set(PLATFORM_QT_GL OpenGL) +if (USE_KHR_ROBUSTNESS) + add_definitions(-DUSE_KHR_ROBUSTNESS) +endif() + if (USE_GLES) add_definitions(-DUSE_GLES) add_definitions(-DGPU_POINTER_STORAGE_SHARED) diff --git a/interface/resources/qml/AnimStats.qml b/interface/resources/qml/AnimStats.qml index d06a0484cb..70f2e37927 100644 --- a/interface/resources/qml/AnimStats.qml +++ b/interface/resources/qml/AnimStats.qml @@ -53,6 +53,9 @@ Item { StatText { text: root.recenterText } + StatText { + text: root.overrideJointText + } StatText { text: "Anim Vars:--------------------------------------------------------------------------------" } @@ -98,6 +101,9 @@ Item { StatText { text: root.sittingText } + StatText { + text: root.flowText + } StatText { text: "State Machines:---------------------------------------------------------------------------" } @@ -131,6 +137,9 @@ Item { StatText { text: root.walkingText } + StatText { + text: root.networkGraphText + } StatText { text: "Alpha Values:--------------------------------------------------------------------------" } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index bda06392ed..0bec38205e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2935,8 +2935,10 @@ void Application::initializeGL() { #if !defined(DISABLE_QML) QStringList chromiumFlags; + // HACK: re-expose mic and camera to prevent crash on domain-change in chromium's media::FakeAudioInputStream::ReadAudioFromSource() // Bug 21993: disable microphone and camera input - chromiumFlags << "--use-fake-device-for-media-stream"; + //chromiumFlags << "--use-fake-device-for-media-stream"; + // Disable signed distance field font rendering on ATI/AMD GPUs, due to // https://highfidelity.manuscript.com/f/cases/13677/Text-showing-up-white-on-Marketplace-app std::string vendor{ (const char*)glGetString(GL_VENDOR) }; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index aba74806c0..cce2af466d 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -6100,6 +6100,30 @@ QVariantList MyAvatar::getCollidingFlowJoints() { return result; } +int MyAvatar::getOverrideJointCount() const { + if (_skeletonModel) { + return _skeletonModel->getRig().getOverrideJointCount(); + } else { + return 0; + } +} + +bool MyAvatar::getFlowActive() const { + if (_skeletonModel) { + return _skeletonModel->getRig().getFlowActive(); + } else { + return false; + } +} + +bool MyAvatar::getNetworkGraphActive() const { + if (_skeletonModel) { + return _skeletonModel->getRig().getNetworkGraphActive(); + } else { + return false; + } +} + void MyAvatar::initFlowFromFST() { if (_skeletonModel->isLoaded()) { auto &flowData = _skeletonModel->getHFMModel().flowData; diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 8cd2c44088..d092122863 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -1835,6 +1835,10 @@ public: */ Q_INVOKABLE QVariantList getCollidingFlowJoints(); + int getOverrideJointCount() const; + bool getFlowActive() const; + bool getNetworkGraphActive() const; + public slots: /**jsdoc diff --git a/interface/src/ui/AnimStats.cpp b/interface/src/ui/AnimStats.cpp index 6317c069f4..d4696a8c04 100644 --- a/interface/src/ui/AnimStats.cpp +++ b/interface/src/ui/AnimStats.cpp @@ -94,6 +94,21 @@ void AnimStats::updateStats(bool force) { } emit walkingTextChanged(); + // print current overrideJointText + int overrideJointCount = myAvatar->getOverrideJointCount(); + _overrideJointText = QString("Override Joint Count: %1").arg(overrideJointCount); + emit overrideJointTextChanged(); + + // print current flowText + bool flowActive = myAvatar->getFlowActive(); + _flowText = QString("Flow: %1").arg(flowActive ? "enabled" : "disabled"); + emit flowTextChanged(); + + // print current networkGraphText + bool networkGraphActive = myAvatar->getNetworkGraphActive(); + _networkGraphText = QString("Network Graph: %1").arg(networkGraphActive ? "enabled" : "disabled"); + emit networkGraphTextChanged(); + // update animation debug alpha values QStringList newAnimAlphaValues; qint64 now = usecTimestampNow(); diff --git a/interface/src/ui/AnimStats.h b/interface/src/ui/AnimStats.h index 57d2a4f1a6..ccd7187d9b 100644 --- a/interface/src/ui/AnimStats.h +++ b/interface/src/ui/AnimStats.h @@ -25,6 +25,9 @@ class AnimStats : public QQuickItem { Q_PROPERTY(QString recenterText READ recenterText NOTIFY recenterTextChanged) Q_PROPERTY(QString sittingText READ sittingText NOTIFY sittingTextChanged) Q_PROPERTY(QString walkingText READ walkingText NOTIFY walkingTextChanged) + Q_PROPERTY(QString overrideJointText READ overrideJointText NOTIFY overrideJointTextChanged) + Q_PROPERTY(QString flowText READ flowText NOTIFY flowTextChanged) + Q_PROPERTY(QString networkGraphText READ networkGraphText NOTIFY networkGraphTextChanged) public: static AnimStats* getInstance(); @@ -43,6 +46,9 @@ public: QString recenterText() const { return _recenterText; } QString sittingText() const { return _sittingText; } QString walkingText() const { return _walkingText; } + QString overrideJointText() const { return _overrideJointText; } + QString flowText() const { return _flowText; } + QString networkGraphText() const { return _networkGraphText; } public slots: void forceUpdateStats() { updateStats(true); } @@ -58,6 +64,9 @@ signals: void recenterTextChanged(); void sittingTextChanged(); void walkingTextChanged(); + void overrideJointTextChanged(); + void flowTextChanged(); + void networkGraphTextChanged(); private: QStringList _animAlphaValues; @@ -76,6 +85,9 @@ private: QString _recenterText; QString _sittingText; QString _walkingText; + QString _overrideJointText; + QString _flowText; + QString _networkGraphText; }; #endif // hifi_AnimStats_h diff --git a/launchers/darwin/src/LatestBuildRequest.m b/launchers/darwin/src/LatestBuildRequest.m index 019637ed55..5119efa8f6 100644 --- a/launchers/darwin/src/LatestBuildRequest.m +++ b/launchers/darwin/src/LatestBuildRequest.m @@ -14,16 +14,26 @@ NSURLSession* session = [NSURLSession sharedSession]; NSURLSessionDataTask* dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + NSLog(@"Latest Build Request error: %@", error); + NSLog(@"Latest Build Request Data: %@", data); + NSHTTPURLResponse *ne = (NSHTTPURLResponse *)response; + NSLog(@"Latest Build Request Response: %ld", [ne statusCode]); Launcher* sharedLauncher = [Launcher sharedLauncher]; - NSLog(@"credentials request finished"); NSMutableData* webData = [NSMutableData data]; [webData appendData:data]; NSString* jsonString = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[data length] encoding:NSUTF8StringEncoding]; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - id json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil]; + NSLog(@"Latest Build Request -> json string: %@", jsonString); + NSError *jsonError = nil; + id json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError]; + + if (jsonError) { + NSLog(@"Latest Build request: Failed to convert Json to data"); + } NSFileManager* fileManager = [NSFileManager defaultManager]; - NSArray *values = [json valueForKey:@"results"]; + NSArray *values = [json valueForKey:@"results"]; NSDictionary *value = [values objectAtIndex:0]; @@ -37,10 +47,15 @@ dispatch_async(dispatch_get_main_queue(), ^{ Settings* settings = [Settings sharedSettings]; NSInteger currentVersion = [settings latestBuildVersion]; + NSLog(@"Latest Build Request -> does build directory exist: %@", appDirectoryExist ? @"TRUE" : @"FALSE"); + NSLog(@"Latest Build Request -> current version: %ld", currentVersion); + NSLog(@"Latest Build Request -> latest version: %ld", buildNumber.integerValue); + NSLog(@"Latest Build Request -> mac url: %@", macInstallerUrl); BOOL latestVersionAvailable = (currentVersion != buildNumber.integerValue); [[Settings sharedSettings] buildVersion:buildNumber.integerValue]; BOOL shouldDownloadInterface = (latestVersionAvailable || !appDirectoryExist); + NSLog(@"Latest Build Request -> SHOULD DOWNLOAD: %@", shouldDownloadInterface ? @"TRUE" : @"FALSE"); [sharedLauncher shouldDownloadLatestBuild:shouldDownloadInterface :macInstallerUrl]; }); }]; diff --git a/launchers/win32/LauncherDlg.cpp b/launchers/win32/LauncherDlg.cpp index d3cae39013..98c61794a0 100644 --- a/launchers/win32/LauncherDlg.cpp +++ b/launchers/win32/LauncherDlg.cpp @@ -213,6 +213,9 @@ BOOL CLauncherDlg::getHQInfo(const CString& orgname) { CString lowerOrgName = orgname; lowerOrgName.MakeLower(); LauncherUtils::hMac256(lowerOrgName, LAUNCHER_HMAC_SECRET, hash); + CString msg; + msg.Format(_T("Calculated hash: \"%s\" => \"%s\""), lowerOrgName, hash); + theApp._manager.addToLog(msg); return theApp._manager.readOrganizationJSON(hash) == LauncherUtils::ResponseError::NoError; } diff --git a/launchers/win32/LauncherManager.cpp b/launchers/win32/LauncherManager.cpp index fc79287457..47c84f1124 100644 --- a/launchers/win32/LauncherManager.cpp +++ b/launchers/win32/LauncherManager.cpp @@ -427,6 +427,11 @@ BOOL LauncherManager::extractApplication() { LauncherUtils::cStringToStd(installPath), [&](int type, int size) { onZipExtracted((ZipType)type, size); }); + if (success) { + addToLog(_T("Created thread for unzipping application.")); + } else { + addToLog(_T("Failed to create thread for unzipping application.")); + } return success; } @@ -449,6 +454,11 @@ BOOL LauncherManager::installContent() { LauncherUtils::cStringToStd(contentPath), [&](int type, int size) { onZipExtracted((ZipType)type, size); }); + if (success) { + addToLog(_T("Created thread for unzipping content.")); + } else { + addToLog(_T("Failed to create thread for unzipping content.")); + } return success; } diff --git a/launchers/win32/LauncherUtils.cpp b/launchers/win32/LauncherUtils.cpp index cfb8b765c5..11ac10b5f2 100644 --- a/launchers/win32/LauncherUtils.cpp +++ b/launchers/win32/LauncherUtils.cpp @@ -16,6 +16,7 @@ #pragma comment(lib, "winhttp") +#include "LauncherApp.h" #include "LauncherUtils.h" CString LauncherUtils::urlEncodeString(const CString& url) { @@ -230,14 +231,24 @@ uint64_t LauncherUtils::extractZip(const std::string& zipFile, const std::string auto status = mz_zip_reader_init_file(&zip_archive, zipFile.c_str(), 0); + { + CString msg; + msg.Format(_T("Reading zip file %s, extracting to %s"), CString(zipFile.c_str()), CString(path.c_str())); + theApp._manager.addToLog(msg); + } + if (!status) return 0; int fileCount = (int)mz_zip_reader_get_num_files(&zip_archive); if (fileCount == 0) { + theApp._manager.addToLog(_T("Zip archive has a file count of 0")); + mz_zip_reader_end(&zip_archive); return 0; } mz_zip_archive_file_stat file_stat; if (!mz_zip_reader_file_stat(&zip_archive, 0, &file_stat)) { + theApp._manager.addToLog(_T("Zip archive cannot be stat'd")); + mz_zip_reader_end(&zip_archive); return 0; } @@ -263,6 +274,12 @@ uint64_t LauncherUtils::extractZip(const std::string& zipFile, const std::string } } + { + CString msg; + msg.Format(_T("Done unzipping archive, total size: %llu"), totalSize); + theApp._manager.addToLog(msg); + } + // Close the archive, freeing any resources it was using mz_zip_reader_end(&zip_archive); return totalSize; diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index a58b8745d7..0f0c67b846 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -2025,6 +2025,9 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo if (params.isTalking) { if (_talkIdleInterpTime < 1.0f) { _talkIdleInterpTime += dt / TOTAL_EASE_IN_TIME; + if (_talkIdleInterpTime > 1.0f) { + _talkIdleInterpTime = 1.0f; + } float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f; _animVars.set("idleOverlayAlpha", easeOutInValue); } else { @@ -2033,6 +2036,9 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo } else { if (_talkIdleInterpTime < 1.0f) { _talkIdleInterpTime += dt / TOTAL_EASE_OUT_TIME; + if (_talkIdleInterpTime > 1.0f) { + _talkIdleInterpTime = 1.0f; + } float easeOutInValue = _talkIdleInterpTime < 0.5f ? 4.0f * powf(_talkIdleInterpTime, 3.0f) : 4.0f * powf((_talkIdleInterpTime - 1.0f), 3.0f) + 1.0f; float talkAlpha = 1.0f - easeOutInValue; _animVars.set("idleOverlayAlpha", talkAlpha); @@ -2287,6 +2293,24 @@ void Rig::buildAbsoluteRigPoses(const AnimPoseVec& relativePoses, AnimPoseVec& a } } +int Rig::getOverrideJointCount() const { + int count = 0; + for (size_t i = 0; i < _internalPoseSet._overrideFlags.size(); i++) { + if (_internalPoseSet._overrideFlags[i]) { + count++; + } + } + return count; +} + +bool Rig::getFlowActive() const { + return _internalFlow.getActive(); +} + +bool Rig::getNetworkGraphActive() const { + return _sendNetworkNode; +} + glm::mat4 Rig::getJointTransform(int jointIndex) const { static const glm::mat4 IDENTITY; if (isIndexValid(jointIndex)) { diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 02fa965f64..9baf4644f2 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -246,6 +246,10 @@ public: float getUnscaledEyeHeight() const; void buildAbsoluteRigPoses(const AnimPoseVec& relativePoses, AnimPoseVec& absolutePosesOut) const; + int getOverrideJointCount() const; + bool getFlowActive() const; + bool getNetworkGraphActive() const; + signals: void onLoadComplete(); diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 1ecbcb0c8b..5ac6e4f642 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -256,18 +256,28 @@ void EntityTreeRenderer::clear() { } // reset the engine - if (_wantScripts && !_shuttingDown) { - resetEntitiesScriptEngine(); - } - // remove all entities from the scene auto scene = _viewState->getMain3DScene(); - if (scene) { - for (const auto& entry : _entitiesInScene) { - const auto& renderer = entry.second; - fadeOutRenderable(renderer); + if (_shuttingDown) { + if (scene) { + render::Transaction transaction; + for (const auto& entry : _entitiesInScene) { + const auto& renderer = entry.second; + renderer->removeFromScene(scene, transaction); + } + scene->enqueueTransaction(transaction); } } else { - qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene, possibly during application shutdown"; + if (_wantScripts) { + resetEntitiesScriptEngine(); + } + if (scene) { + for (const auto& entry : _entitiesInScene) { + const auto& renderer = entry.second; + fadeOutRenderable(renderer); + } + } else { + qCWarning(entitiesrenderer) << "EntitityTreeRenderer::clear(), Unexpected null scene"; + } } _entitiesInScene.clear(); _renderablesToUpdate.clear(); @@ -1056,10 +1066,14 @@ void EntityTreeRenderer::fadeOutRenderable(const EntityRendererPointer& renderab render::Transaction transaction; auto scene = _viewState->getMain3DScene(); - transaction.setTransitionFinishedOperator(renderable->getRenderItemID(), [scene, renderable]() { - render::Transaction transaction; - renderable->removeFromScene(scene, transaction); - scene->enqueueTransaction(transaction); + EntityRendererWeakPointer weakRenderable = renderable; + transaction.setTransitionFinishedOperator(renderable->getRenderItemID(), [scene, weakRenderable]() { + auto renderable = weakRenderable.lock(); + if (renderable) { + render::Transaction transaction; + renderable->removeFromScene(scene, transaction); + scene->enqueueTransaction(transaction); + } }); scene->enqueueTransaction(transaction); diff --git a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp index 3b615ba467..bb3e99157e 100644 --- a/libraries/entities-renderer/src/RenderableWebEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableWebEntityItem.cpp @@ -7,6 +7,7 @@ // #include "RenderableWebEntityItem.h" +#include #include #include @@ -46,7 +47,7 @@ static uint64_t MAX_NO_RENDER_INTERVAL = 30 * USECS_PER_SECOND; static uint8_t YOUTUBE_MAX_FPS = 30; // Don't allow more than 20 concurrent web views -static uint32_t _currentWebCount { 0 }; +static std::atomic _currentWebCount(0); static const uint32_t MAX_CONCURRENT_WEB_VIEWS = 20; static QTouchDevice _touchDevice; @@ -356,16 +357,15 @@ void WebEntityRenderer::buildWebSurface(const EntityItemPointer& entity, const Q void WebEntityRenderer::destroyWebSurface() { QSharedPointer webSurface; - ContentType contentType = ContentType::NoContent; withWriteLock([&] { webSurface.swap(_webSurface); - _contentType = contentType; - }); + _contentType = ContentType::NoContent; - if (webSurface) { - --_currentWebCount; - WebEntityRenderer::releaseWebSurface(webSurface, _cachedWebSurface, _connections); - } + if (webSurface) { + --_currentWebCount; + WebEntityRenderer::releaseWebSurface(webSurface, _cachedWebSurface, _connections); + } + }); } glm::vec2 WebEntityRenderer::getWindowSize(const TypedEntityPointer& entity) const { diff --git a/libraries/gl/src/gl/Context.cpp b/libraries/gl/src/gl/Context.cpp index a0d52ee223..d5d06d1195 100644 --- a/libraries/gl/src/gl/Context.cpp +++ b/libraries/gl/src/gl/Context.cpp @@ -27,6 +27,10 @@ #include "GLHelpers.h" #include "QOpenGLContextWrapper.h" +#if defined(GL_CUSTOM_CONTEXT) +#include +#endif + using namespace gl; #if defined(GL_CUSTOM_CONTEXT) @@ -42,7 +46,10 @@ std::atomic Context::_totalSwapchainMemoryUsage { 0 }; size_t Context::getSwapchainMemoryUsage() { return _totalSwapchainMemoryUsage.load(); } size_t Context::evalSurfaceMemoryUsage(uint32_t width, uint32_t height, uint32_t pixelSize) { - return width * height * pixelSize; + size_t result = width; + result *= height; + result *= pixelSize; + return result; } void Context::updateSwapchainMemoryUsage(size_t prevSize, size_t newSize) { @@ -126,7 +133,7 @@ void Context::clear() { #if defined(GL_CUSTOM_CONTEXT) static void setupPixelFormatSimple(HDC hdc) { - // FIXME build the PFD based on the + // FIXME build the PFD based on the static const PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor @@ -176,6 +183,7 @@ static void setupPixelFormatSimple(HDC hdc) { #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 // Context create flag bits +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 @@ -196,17 +204,17 @@ GLAPI PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB; Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); #if defined(GL_CUSTOM_CONTEXT) -bool Context::makeCurrent() { - BOOL result = wglMakeCurrent(_hdc, _hglrc); - assert(result); - updateSwapchainMemoryCounter(); - return result; -} - void Context::swapBuffers() { - SwapBuffers(_hdc); -} - void Context::doneCurrent() { - wglMakeCurrent(0, 0); +bool Context::makeCurrent() { + BOOL result = wglMakeCurrent(_hdc, _hglrc); + assert(result); + updateSwapchainMemoryCounter(); + return result; +} +void Context::swapBuffers() { + SwapBuffers(_hdc); +} +void Context::doneCurrent() { + wglMakeCurrent(0, 0); } #endif @@ -305,11 +313,18 @@ void Context::create(QOpenGLContext* shareContext) { #else contextAttribs.push_back(WGL_CONTEXT_CORE_PROFILE_BIT_ARB); #endif - contextAttribs.push_back(WGL_CONTEXT_FLAGS_ARB); - if (enableDebugLogger()) { - contextAttribs.push_back(WGL_CONTEXT_DEBUG_BIT_ARB); - } else { - contextAttribs.push_back(0); + { + int contextFlags = 0; + if (enableDebugLogger()) { + contextFlags |= WGL_CONTEXT_DEBUG_BIT_ARB; + } +#ifdef USE_KHR_ROBUSTNESS + contextFlags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB; +#endif + if (contextFlags != 0) { + contextAttribs.push_back(WGL_CONTEXT_FLAGS_ARB); + contextAttribs.push_back(contextFlags); + } } contextAttribs.push_back(0); HGLRC shareHglrc = nullptr; @@ -323,8 +338,8 @@ void Context::create(QOpenGLContext* shareContext) { if (_hglrc != 0) { createWrapperContext(); } - } - + } + if (_hglrc == 0) { // fallback, if the context creation failed, or USE_CUSTOM_CONTEXT is false qtCreate(shareContext); diff --git a/libraries/gl/src/gl/Context.h b/libraries/gl/src/gl/Context.h index 5254d58d38..7beb59e33f 100644 --- a/libraries/gl/src/gl/Context.h +++ b/libraries/gl/src/gl/Context.h @@ -23,7 +23,7 @@ class QOpenGLContext; class QThread; class QOpenGLDebugMessage; -#if defined(Q_OS_WIN) && defined(USE_GLES) +#if defined(Q_OS_WIN) && (defined(USE_GLES) || defined(USE_KHR_ROBUSTNESS)) //#if defined(Q_OS_WIN) #define GL_CUSTOM_CONTEXT #endif diff --git a/libraries/platform/src/platform/backend/PlatformInstance.cpp b/libraries/platform/src/platform/backend/PlatformInstance.cpp index f3a82f8cc4..41786bca1f 100644 --- a/libraries/platform/src/platform/backend/PlatformInstance.cpp +++ b/libraries/platform/src/platform/backend/PlatformInstance.cpp @@ -121,7 +121,7 @@ const char* Instance::findGPUVendorInDescription(const std::string& description) return keys::gpu::vendor_Intel; } // AMD gpu - else if (description.find(keys::gpu::vendor_AMD) != std::string::npos) { + else if ((description.find(keys::gpu::vendor_AMD) != std::string::npos) || (description.find("Radeon") != std::string::npos)) { return keys::gpu::vendor_AMD; } // NVIDIA gpu diff --git a/libraries/qml/src/qml/impl/RenderEventHandler.cpp b/libraries/qml/src/qml/impl/RenderEventHandler.cpp index a1edfd6789..cc9fe34edc 100644 --- a/libraries/qml/src/qml/impl/RenderEventHandler.cpp +++ b/libraries/qml/src/qml/impl/RenderEventHandler.cpp @@ -49,8 +49,8 @@ bool RenderEventHandler::event(QEvent* e) { return QObject::event(e); } -RenderEventHandler::RenderEventHandler(SharedObject* shared, QThread* targetThread) - : _shared(shared) { +RenderEventHandler::RenderEventHandler(SharedObject* shared, QThread* targetThread) : + _shared(shared) { // Create the GL canvas in the same thread as the share canvas if (!_canvas.create(SharedObject::getSharedContext())) { qFatal("Unable to create new offscreen GL context"); @@ -136,7 +136,8 @@ void RenderEventHandler::qmlRender(bool sceneGraphSync) { resize(); - { + + if (_currentSize != QSize()) { PROFILE_RANGE(render_qml_gl, "render"); GLuint texture = SharedObject::getTextureCache().acquireTexture(_currentSize); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _fbo); @@ -146,7 +147,7 @@ void RenderEventHandler::qmlRender(bool sceneGraphSync) { glClear(GL_COLOR_BUFFER_BIT); } else { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - _shared->_quickWindow->setRenderTarget(_fbo, _currentSize); + _shared->setRenderTarget(_fbo, _currentSize); _shared->_renderControl->render(); } _shared->_lastRenderTime = usecTimestampNow(); @@ -179,7 +180,7 @@ void RenderEventHandler::onQuit() { _fbo = 0; } - _shared->shutdownRendering(_canvas, _currentSize); + _shared->shutdownRendering(_currentSize); _canvas.doneCurrent(); } _canvas.moveToThreadWithContext(qApp->thread()); diff --git a/libraries/qml/src/qml/impl/SharedObject.cpp b/libraries/qml/src/qml/impl/SharedObject.cpp index b72f37481b..55788c8a02 100644 --- a/libraries/qml/src/qml/impl/SharedObject.cpp +++ b/libraries/qml/src/qml/impl/SharedObject.cpp @@ -78,7 +78,6 @@ SharedObject::SharedObject() { QObject::connect(qApp, &QCoreApplication::aboutToQuit, this, &SharedObject::onAboutToQuit); } - SharedObject::~SharedObject() { // After destroy returns, the rendering thread should be gone destroy(); @@ -173,7 +172,6 @@ void SharedObject::setRootItem(QQuickItem* rootItem) { QObject::connect(_renderControl, &QQuickRenderControl::renderRequested, this, &SharedObject::requestRender); QObject::connect(_renderControl, &QQuickRenderControl::sceneChanged, this, &SharedObject::requestRenderSync); #endif - } void SharedObject::destroy() { @@ -210,7 +208,7 @@ void SharedObject::destroy() { } // Block until the rendering thread has stopped // FIXME this is undesirable because this is blocking the main thread, - // but I haven't found a reliable way to do this only at application + // but I haven't found a reliable way to do this only at application // shutdown if (_renderThread) { _renderThread->wait(); @@ -220,10 +218,8 @@ void SharedObject::destroy() { #endif } - #define SINGLE_QML_ENGINE 0 - #if SINGLE_QML_ENGINE static QQmlEngine* globalEngine{ nullptr }; static size_t globalEngineRefCount{ 0 }; @@ -344,6 +340,11 @@ void SharedObject::setSize(const QSize& size) { #endif } +void SharedObject::setMaxFps(uint8_t maxFps) { + QMutexLocker locker(&_mutex); + _maxFps = maxFps; +} + bool SharedObject::preRender(bool sceneGraphSync) { #ifndef DISABLE_QML QMutexLocker lock(&_mutex); @@ -370,9 +371,9 @@ bool SharedObject::preRender(bool sceneGraphSync) { return true; } -void SharedObject::shutdownRendering(OffscreenGLCanvas& canvas, const QSize& size) { +void SharedObject::shutdownRendering(const QSize& size) { QMutexLocker locker(&_mutex); - if (size != QSize(0, 0)) { + if (size != QSize()) { getTextureCache().releaseSize(size); if (_latestTextureAndFence.first) { getTextureCache().releaseTexture(_latestTextureAndFence); @@ -380,19 +381,17 @@ void SharedObject::shutdownRendering(OffscreenGLCanvas& canvas, const QSize& siz } #ifndef DISABLE_QML _renderControl->invalidate(); - canvas.doneCurrent(); #endif wake(); } -bool SharedObject::isQuit() { +bool SharedObject::isQuit() const { QMutexLocker locker(&_mutex); return _quit; } void SharedObject::requestRender() { - // Don't queue multiple renders - if (_renderRequested) { + if (_quit) { return; } _renderRequested = true; @@ -402,18 +401,13 @@ void SharedObject::requestRenderSync() { if (_quit) { return; } - - { - QMutexLocker lock(&_mutex); - _syncRequested = true; - } - - requestRender(); + _renderRequested = true; + _syncRequested = true; } bool SharedObject::fetchTexture(TextureAndFence& textureAndFence) { QMutexLocker locker(&_mutex); - if (0 == _latestTextureAndFence.first) { + if (!_latestTextureAndFence.first) { return false; } textureAndFence = { 0, 0 }; @@ -421,8 +415,7 @@ bool SharedObject::fetchTexture(TextureAndFence& textureAndFence) { return true; } -void hifi::qml::impl::SharedObject::addToDeletionList(QObject * object) -{ +void SharedObject::addToDeletionList(QObject* object) { _deletionList.append(QPointer(object)); } @@ -469,11 +462,9 @@ void SharedObject::onRender() { return; } - QMutexLocker lock(&_mutex); if (_syncRequested) { - lock.unlock(); _renderControl->polishItems(); - lock.relock(); + QMutexLocker lock(&_mutex); QCoreApplication::postEvent(_renderObject, new OffscreenEvent(OffscreenEvent::RenderSync)); // sync and render request, main and render threads must be synchronized wait(); @@ -494,13 +485,11 @@ void SharedObject::onTimer() { { QMutexLocker locker(&_mutex); // Don't queue more than one frame at a time - if (0 != _latestTextureAndFence.first) { + if (_latestTextureAndFence.first) { return; } - } - { - if (_maxFps == 0) { + if (!_maxFps) { return; } auto minRenderInterval = USECS_PER_SECOND / _maxFps; diff --git a/libraries/qml/src/qml/impl/SharedObject.h b/libraries/qml/src/qml/impl/SharedObject.h index c9c0ef7bd0..50c56ad714 100644 --- a/libraries/qml/src/qml/impl/SharedObject.h +++ b/libraries/qml/src/qml/impl/SharedObject.h @@ -16,7 +16,6 @@ #include "TextureCache.h" - class QWindow; class QTimer; class QQuickWindow; @@ -24,7 +23,6 @@ class QQuickItem; class QOpenGLContext; class QQmlEngine; class QQmlContext; -class OffscreenGLCanvas; namespace hifi { namespace qml { @@ -51,11 +49,11 @@ public: void create(OffscreenSurface* surface); void setRootItem(QQuickItem* rootItem); void destroy(); - bool isQuit(); + bool isQuit() const; QSize getSize() const; void setSize(const QSize& size); - void setMaxFps(uint8_t maxFps) { _maxFps = maxFps; } + void setMaxFps(uint8_t maxFps); QQuickWindow* getWindow() { return _quickWindow; } QQuickItem* getRootItem() { return _rootItem; } @@ -72,7 +70,7 @@ private: bool event(QEvent* e) override; bool preRender(bool sceneGraphSync); - void shutdownRendering(OffscreenGLCanvas& canvas, const QSize& size); + void shutdownRendering(const QSize& size); // Called by the render event handler, from the render thread void initializeRenderControl(QOpenGLContext* context); void releaseTextureAndFence(); @@ -94,31 +92,30 @@ private: QList> _deletionList; // Texture management - TextureAndFence _latestTextureAndFence{ 0, 0 }; - QQuickItem* _item{ nullptr }; - QQuickItem* _rootItem{ nullptr }; - QQuickWindow* _quickWindow{ nullptr }; - QQmlContext* _qmlContext{ nullptr }; + TextureAndFence _latestTextureAndFence { 0, 0 }; + QQuickItem* _rootItem { nullptr }; + QQuickWindow* _quickWindow { nullptr }; + QQmlContext* _qmlContext { nullptr }; mutable QMutex _mutex; QWaitCondition _cond; #ifndef DISABLE_QML - QWindow* _proxyWindow{ nullptr }; - RenderControl* _renderControl{ nullptr }; - RenderEventHandler* _renderObject{ nullptr }; + QWindow* _proxyWindow { nullptr }; + RenderControl* _renderControl { nullptr }; + RenderEventHandler* _renderObject { nullptr }; - QTimer* _renderTimer{ nullptr }; - QThread* _renderThread{ nullptr }; + QTimer* _renderTimer { nullptr }; + QThread* _renderThread { nullptr }; #endif - uint64_t _lastRenderTime{ 0 }; - QSize _size{ 100, 100 }; - uint8_t _maxFps{ 60 }; + uint64_t _lastRenderTime { 0 }; + QSize _size { 100, 100 }; + uint8_t _maxFps { 60 }; - bool _renderRequested{ false }; - bool _syncRequested{ false }; - bool _quit{ false }; - bool _paused{ false }; + bool _renderRequested { false }; + bool _syncRequested { false }; + bool _quit { false }; + bool _paused { false }; }; } // namespace impl diff --git a/libraries/qml/src/qml/impl/TextureCache.h b/libraries/qml/src/qml/impl/TextureCache.h index c146d0bdbf..29f88955a4 100644 --- a/libraries/qml/src/qml/impl/TextureCache.h +++ b/libraries/qml/src/qml/impl/TextureCache.h @@ -35,9 +35,8 @@ public: using Size = uint64_t; struct TextureSet { - Size textureSize; // The number of surfaces with this size - size_t clientCount{ 0 }; + size_t clientCount { 0 }; ValueList returnedTextures; }; @@ -66,7 +65,7 @@ private: std::unordered_map _textureSizes; Mutex _mutex; std::list _returnedTextures; - size_t _totalTextureUsage{ 0 }; + size_t _totalTextureUsage { 0 }; }; }}} // namespace hifi::qml::impl diff --git a/scripts/simplifiedUI/system/controllers/handTouch.js b/scripts/simplifiedUI/system/controllers/handTouch.js index c706d054c1..5939c6e3d2 100644 --- a/scripts/simplifiedUI/system/controllers/handTouch.js +++ b/scripts/simplifiedUI/system/controllers/handTouch.js @@ -17,7 +17,8 @@ (function () { var LEAP_MOTION_NAME = "LeapMotion"; - var handTouchEnabled = true; + // Hand touch is disabled due to twitchy finger bug when walking near walls or tables. see BUGZ-154. + var handTouchEnabled = false; var leapMotionEnabled = Controller.getRunningInputDeviceNames().indexOf(LEAP_MOTION_NAME) >= 0; var MSECONDS_AFTER_LOAD = 2000; var updateFingerWithIndex = 0; diff --git a/scripts/system/controllers/handTouch.js b/scripts/system/controllers/handTouch.js index c706d054c1..5939c6e3d2 100644 --- a/scripts/system/controllers/handTouch.js +++ b/scripts/system/controllers/handTouch.js @@ -17,7 +17,8 @@ (function () { var LEAP_MOTION_NAME = "LeapMotion"; - var handTouchEnabled = true; + // Hand touch is disabled due to twitchy finger bug when walking near walls or tables. see BUGZ-154. + var handTouchEnabled = false; var leapMotionEnabled = Controller.getRunningInputDeviceNames().indexOf(LEAP_MOTION_NAME) >= 0; var MSECONDS_AFTER_LOAD = 2000; var updateFingerWithIndex = 0; diff --git a/scripts/system/create/NewMaterialDialog.qml b/scripts/system/create/NewMaterialDialog.qml index 75570327e0..1631632fb4 100644 --- a/scripts/system/create/NewMaterialDialog.qml +++ b/scripts/system/create/NewMaterialDialog.qml @@ -15,7 +15,7 @@ import QtQuick.Dialogs 1.2 as OriginalDialogs import stylesUit 1.0 import controlsUit 1.0 -import dialogs 1.0 +import hifi.dialogs 1.0 Rectangle { id: newMaterialDialog diff --git a/scripts/system/create/NewModelDialog.qml b/scripts/system/create/NewModelDialog.qml index 1ded00d701..92a08df10d 100644 --- a/scripts/system/create/NewModelDialog.qml +++ b/scripts/system/create/NewModelDialog.qml @@ -14,7 +14,7 @@ import QtQuick.Dialogs 1.2 as OriginalDialogs import stylesUit 1.0 import controlsUit 1.0 -import dialogs 1.0 +import hifi.dialogs 1.0 Rectangle { id: newModelDialog