mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 08:14:48 +02:00
getting gpu name via profiler parsing
This commit is contained in:
parent
d924560af0
commit
c1c2efc71d
1 changed files with 24 additions and 1 deletions
|
@ -22,7 +22,10 @@
|
|||
|
||||
#elif defined(Q_OS_MAC)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include<sys/sysctl.h>
|
||||
#include <sstream>
|
||||
#include <QString>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
@ -57,6 +60,26 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get gpu name
|
||||
FILE* stream = popen("system_profiler SPDisplaysDataType | grep Chipset", "r");
|
||||
|
||||
std::ostringstream hostStream;
|
||||
while (!feof(stream) && !ferror(stream)) {
|
||||
char buf[128];
|
||||
int bytesRead = fread(buf, 1, 128, stream);
|
||||
hostStream.write(buf, bytesRead);
|
||||
}
|
||||
|
||||
QString result = QString::fromStdString(hostStream.str());
|
||||
QStringList parts = result.split('\n');
|
||||
std::string name;
|
||||
|
||||
for (int i = 0; i < parts.size(); ++i) {
|
||||
if (parts[i].toLower().contains("radeon") || parts[i].toLower().contains("nvidia")) {
|
||||
_name=parts[i];
|
||||
}
|
||||
}
|
||||
|
||||
_dedicatedMemoryMB = bestVRAM;
|
||||
CGLDestroyRendererInfo(rendererInfo);
|
||||
|
|
Loading…
Reference in a new issue