mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:37:20 +02:00
Add specific caps for the render method deferred from the platform profiler, to prevent bad choice on mac book air
This commit is contained in:
parent
0c1df749b9
commit
b2feb0f920
3 changed files with 44 additions and 2 deletions
|
@ -63,9 +63,15 @@ PerformanceManager::PerformancePreset PerformanceManager::getPerformancePreset()
|
||||||
|
|
||||||
void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformancePreset preset) {
|
void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformancePreset preset) {
|
||||||
|
|
||||||
|
// Ugly case that prevent us to run deferred everywhere...
|
||||||
|
bool isDeferredCapable = platform::Profiler::isRenderMethodDeferredCapable();
|
||||||
|
|
||||||
switch (preset) {
|
switch (preset) {
|
||||||
case PerformancePreset::HIGH:
|
case PerformancePreset::HIGH:
|
||||||
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
|
RenderScriptingInterface::getInstance()->setRenderMethod( ( isDeferredCapable ?
|
||||||
|
RenderScriptingInterface::RenderMethod::DEFERRED :
|
||||||
|
RenderScriptingInterface::RenderMethod::FORWARD ) );
|
||||||
|
|
||||||
RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
|
RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
|
||||||
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME);
|
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME);
|
||||||
|
|
||||||
|
@ -73,7 +79,10 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PerformancePreset::MID:
|
case PerformancePreset::MID:
|
||||||
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
|
RenderScriptingInterface::getInstance()->setRenderMethod((isDeferredCapable ?
|
||||||
|
RenderScriptingInterface::RenderMethod::DEFERRED :
|
||||||
|
RenderScriptingInterface::RenderMethod::FORWARD));
|
||||||
|
|
||||||
RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
|
RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
|
||||||
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
|
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
|
||||||
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
|
DependencyManager::get<LODManager>()->setWorldDetailQuality(0.5f);
|
||||||
|
|
|
@ -124,4 +124,34 @@ bool filterOnProcessors(const platform::json& computer, const platform::json& cp
|
||||||
|
|
||||||
// Not able to profile
|
// Not able to profile
|
||||||
return false;
|
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<std::string>();
|
||||||
|
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<std::string>();
|
||||||
|
if (model.find("MacBookAir") != std::string::npos) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
#elif defined(Q_OS_ANDROID)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -28,6 +28,9 @@ public:
|
||||||
static const std::array<const char*, Tier::NumTiers> TierNames;
|
static const std::array<const char*, Tier::NumTiers> TierNames;
|
||||||
|
|
||||||
static Tier profilePlatform();
|
static Tier profilePlatform();
|
||||||
|
|
||||||
|
// Ugly very adhoc capability check to know if a particular hw can REnder with Deferred method or not
|
||||||
|
static bool isRenderMethodDeferredCapable();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue