From b2feb0f9201a8b6bc62fb452b78aa6a18fc200bd Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Wed, 12 Jun 2019 16:48:36 -0700 Subject: [PATCH] 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(); }; }