From b2feb0f9201a8b6bc62fb452b78aa6a18fc200bd Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 12 Jun 2019 16:48:36 -0700 Subject: [PATCH 1/6] Add specific caps for the render method deferred from the platform profiler, to prevent bad choice on mac book air --- interface/src/PerformanceManager.cpp | 13 +++++++-- libraries/platform/src/platform/Profiler.cpp | 30 ++++++++++++++++++++ libraries/platform/src/platform/Profiler.h | 3 ++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index cf6da11aeb..0a028f95cc 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -63,9 +63,15 @@ PerformanceManager::PerformancePreset PerformanceManager::getPerformancePreset() void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformancePreset preset) { + // Ugly case that prevent us to run deferred everywhere... + bool isDeferredCapable = platform::Profiler::isRenderMethodDeferredCapable(); + switch (preset) { case PerformancePreset::HIGH: - RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); + RenderScriptingInterface::getInstance()->setRenderMethod( ( isDeferredCapable ? + RenderScriptingInterface::RenderMethod::DEFERRED : + RenderScriptingInterface::RenderMethod::FORWARD ) ); + RenderScriptingInterface::getInstance()->setShadowsEnabled(true); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); @@ -73,7 +79,10 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP break; case PerformancePreset::MID: - RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); + RenderScriptingInterface::getInstance()->setRenderMethod((isDeferredCapable ? + RenderScriptingInterface::RenderMethod::DEFERRED : + RenderScriptingInterface::RenderMethod::FORWARD)); + RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); DependencyManager::get()->setWorldDetailQuality(0.5f); diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index f77bbec46b..96c9feaa36 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -124,4 +124,34 @@ bool filterOnProcessors(const platform::json& computer, const platform::json& cp // Not able to profile return false; +} + +// Ugly very adhoc capability check to know if a particular hw can REnder with Deferred method or not +// YES for PC windows and linux +// NO for android +// YES on macos EXCEPT for macbookair with gpu intel iris or intel HD 6000 +bool Profiler::isRenderMethodDeferredCapable() { +#if defined(Q_OS_MAC) + auto computerInfo = platform::getComputer(); + if (computer.count(keys::computer::model)) { + const auto model = computer[keys::computer::model].get(); + if (model.find("MacBookAir") != std::string::npos) { + return false; + } + } + + +/* auto gpuInfo = platform::getGPU(0); + if (gpuInfo.count(keys::gpu::model)) { + const auto model = computer[keys::gpu::model].get(); + if (model.find("MacBookAir") != std::string::npos) { + } + } +*/ + return true; +#elif defined(Q_OS_ANDROID) + return false; +#else + return true; +#endif } \ No newline at end of file diff --git a/libraries/platform/src/platform/Profiler.h b/libraries/platform/src/platform/Profiler.h index fea0622c89..c47f2587f2 100644 --- a/libraries/platform/src/platform/Profiler.h +++ b/libraries/platform/src/platform/Profiler.h @@ -28,6 +28,9 @@ public: static const std::array TierNames; static Tier profilePlatform(); + + // Ugly very adhoc capability check to know if a particular hw can REnder with Deferred method or not + static bool isRenderMethodDeferredCapable(); }; } From 5004070af9ffdd0b18c9dd0bee58db4712515752 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 12 Jun 2019 17:14:44 -0700 Subject: [PATCH 2/6] Grab the name of the renderer no matter what --- libraries/shared/src/GPUIdent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/shared/src/GPUIdent.cpp b/libraries/shared/src/GPUIdent.cpp index d5c2f3ec6c..f092a56c17 100644 --- a/libraries/shared/src/GPUIdent.cpp +++ b/libraries/shared/src/GPUIdent.cpp @@ -47,6 +47,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) GLint rendererInfoCount; CGLError err = CGLQueryRendererInfo(cglDisplayMask, &rendererInfo, &rendererInfoCount); GLint j, numRenderers = 0, deviceVRAM, bestVRAM = 0; + int bestGPUid = 0; err = CGLQueryRendererInfo(cglDisplayMask, &rendererInfo, &numRenderers); if (0 == err) { // Iterate over all of them and use the figure for the one with the most VRAM, @@ -55,6 +56,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) for (j = 0; j < numRenderers; j++) { CGLDescribeRenderer(rendererInfo, j, kCGLRPVideoMemoryMegabytes, &deviceVRAM); if (deviceVRAM > bestVRAM) { + bestGPUid = j; bestVRAM = deviceVRAM; _isValid = true; } @@ -78,6 +80,8 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) for (int i = 0; i < parts.size(); ++i) { if (parts[i].toLower().contains("radeon") || parts[i].toLower().contains("nvidia")) { _name=parts[i]; + } else if (i == bestGPUid) { + _name=parts[i]; } } From b132a42e899d9b9b7a65ab5aa93cfab0fa22b132 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 12 Jun 2019 22:42:05 -0700 Subject: [PATCH 3/6] fixing the scroll view --- scripts/developer/utilities/render/luci.qml | 3 ++- .../developer/utilities/render/performanceSetup.qml | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/developer/utilities/render/luci.qml b/scripts/developer/utilities/render/luci.qml index 2dc8fda081..98fd3039d1 100644 --- a/scripts/developer/utilities/render/luci.qml +++ b/scripts/developer/utilities/render/luci.qml @@ -26,8 +26,9 @@ Rectangle { color: global.color ScrollView { - id: control + id: scrollView anchors.fill: parent + contentWidth: parent.width clip: true Column { diff --git a/scripts/developer/utilities/render/performanceSetup.qml b/scripts/developer/utilities/render/performanceSetup.qml index ab00d31f2b..4654736f72 100644 --- a/scripts/developer/utilities/render/performanceSetup.qml +++ b/scripts/developer/utilities/render/performanceSetup.qml @@ -24,9 +24,12 @@ Rectangle { color: global.colorBack ScrollView { + id: scrollView anchors.fill: parent + contentWidth: parent.width clip: true - Column { + + Column { anchors.left: parent.left anchors.right: parent.right @@ -35,8 +38,6 @@ Rectangle { isUnfold: true panelFrameData: Component { PerformanceSettings { - anchors.left: parent.left - anchors.right: parent.right } } } @@ -45,8 +46,6 @@ Rectangle { isUnfold: true panelFrameData: Component { RenderSettings { - anchors.left: parent.left - anchors.right: parent.right } } } @@ -54,8 +53,6 @@ Rectangle { label: "Platform" panelFrameData: Component { Platform { - anchors.left: parent.left - anchors.right: parent.right } } } From 43a119cbbcb4d72978eb84ed5b1febdf70a079bc Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 12 Jun 2019 23:15:53 -0700 Subject: [PATCH 4/6] just adding the correct include tobring th edefines --- libraries/platform/src/platform/Profiler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index 96c9feaa36..8d1ed40e30 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -12,6 +12,7 @@ #include "Platform.h" #include "PlatformKeys.h" +#include using namespace platform; @@ -132,7 +133,7 @@ bool filterOnProcessors(const platform::json& computer, const platform::json& cp // YES on macos EXCEPT for macbookair with gpu intel iris or intel HD 6000 bool Profiler::isRenderMethodDeferredCapable() { #if defined(Q_OS_MAC) - auto computerInfo = platform::getComputer(); + auto computer = platform::getComputer(); if (computer.count(keys::computer::model)) { const auto model = computer[keys::computer::model].get(); if (model.find("MacBookAir") != std::string::npos) { @@ -154,4 +155,4 @@ bool Profiler::isRenderMethodDeferredCapable() { #else return true; #endif -} \ No newline at end of file +} From d6f90c497f78dcbfe7020f03423828019c63c794 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 13 Jun 2019 10:16:57 -0700 Subject: [PATCH 5/6] FIlter on the gpu model name for ththe 2 known cases --- libraries/platform/src/platform/Profiler.cpp | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index 8d1ed40e30..0e8b9a65a8 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -134,21 +134,22 @@ bool filterOnProcessors(const platform::json& computer, const platform::json& cp bool Profiler::isRenderMethodDeferredCapable() { #if defined(Q_OS_MAC) auto computer = platform::getComputer(); - if (computer.count(keys::computer::model)) { - const auto model = computer[keys::computer::model].get(); - if (model.find("MacBookAir") != std::string::npos) { - return false; - } + const auto computerModel = (computer.count(keys::computer::model) ? computer[keys::computer::model].get() : ""); + + auto gpuInfo = platform::getGPU(0); + const auto gpuModel = (gpuInfo.count(keys::gpu::model) ? gpuInfo[keys::gpu::model].get() : ""); + + + // Macbook air 2018 are a problem + if ((computerModel.find("MacBookAir") != std::string::npos) && (gpuModel.find("Intel HD Graphics 6000") != std::string::npos)) { + return false; + } + + // We know for fact that the INtel Iris is problematic... + if ((gpuModel.find("Intel Iris") != std::string::npos)) { + return false; } - -/* auto gpuInfo = platform::getGPU(0); - if (gpuInfo.count(keys::gpu::model)) { - const auto model = computer[keys::gpu::model].get(); - if (model.find("MacBookAir") != std::string::npos) { - } - } -*/ return true; #elif defined(Q_OS_ANDROID) return false; From 97236570d8572dff514809fa55dcd8fb96e5fd75 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Thu, 13 Jun 2019 10:28:34 -0700 Subject: [PATCH 6/6] FIlter on the gpu model name for ththe 2 known cases --- libraries/platform/src/platform/Profiler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index 0e8b9a65a8..bd8efb9097 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -145,10 +145,10 @@ bool Profiler::isRenderMethodDeferredCapable() { return false; } - // We know for fact that the INtel Iris is problematic... - if ((gpuModel.find("Intel Iris") != std::string::npos)) { - return false; - } + // We know for fact that one INtel Iris is problematic, not enough info yet for sure + // if ((gpuModel.find("Intel Iris ....") != std::string::npos)) { + // return false; + //} return true; #elif defined(Q_OS_ANDROID)