mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 23:12:16 +02:00
Merge pull request #15755 from samcake/nut
BUGZ-637: Detecting the problematic GPU on MAC not running properly Deferred render method right now
This commit is contained in:
commit
b4f708f4ad
6 changed files with 57 additions and 11 deletions
|
@ -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<LODManager>()->setWorldDetailQuality(0.5f);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "Platform.h"
|
||||
#include "PlatformKeys.h"
|
||||
#include <qglobal.h>
|
||||
|
||||
using namespace platform;
|
||||
|
||||
|
@ -124,4 +125,35 @@ 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 computer = platform::getComputer();
|
||||
const auto computerModel = (computer.count(keys::computer::model) ? computer[keys::computer::model].get<std::string>() : "");
|
||||
|
||||
auto gpuInfo = platform::getGPU(0);
|
||||
const auto gpuModel = (gpuInfo.count(keys::gpu::model) ? gpuInfo[keys::gpu::model].get<std::string>() : "");
|
||||
|
||||
|
||||
// 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 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)
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ public:
|
|||
static const std::array<const char*, Tier::NumTiers> 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();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,9 @@ Rectangle {
|
|||
color: global.color
|
||||
|
||||
ScrollView {
|
||||
id: control
|
||||
id: scrollView
|
||||
anchors.fill: parent
|
||||
contentWidth: parent.width
|
||||
clip: true
|
||||
|
||||
Column {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue