mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:08:00 +02:00
uint64
This commit is contained in:
parent
904e87313e
commit
c274df6066
1 changed files with 7 additions and 2 deletions
|
@ -20,6 +20,8 @@
|
||||||
GPUIdent GPUIdent::_instance {};
|
GPUIdent GPUIdent::_instance {};
|
||||||
|
|
||||||
GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) {
|
GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) {
|
||||||
|
// Expects vendor and render to be supplied on first call. Results are cached and the arguments can then be dropped.
|
||||||
|
// Too bad OpenGL doesn't seem to have a way to get the specific device id.
|
||||||
if (_isQueried) {
|
if (_isQueried) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +63,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
// I'd love to find a better way to learn which graphics adapter is the one we're using.
|
// I'd love to find a better way to learn which graphics adapter is the one we're using.
|
||||||
// Alas, no combination of vendor, renderer, and adapter name seems to be a substring of the others.
|
// Alas, no combination of vendor, renderer, and adapter name seems to be a substring of the others.
|
||||||
// Here we get a list of words that we'll match adapter names against. Most matches wins.
|
// Here we get a list of words that we'll match adapter names against. Most matches wins.
|
||||||
|
// Alas, this won't work when someone has multiple variants of the same card installed.
|
||||||
QRegExp wordMatcher{ "\\W" };
|
QRegExp wordMatcher{ "\\W" };
|
||||||
QStringList words;
|
QStringList words;
|
||||||
words << vendor.toUpper().split(wordMatcher) << renderer.toUpper().split(wordMatcher);
|
words << vendor.toUpper().split(wordMatcher) << renderer.toUpper().split(wordMatcher);
|
||||||
|
@ -107,8 +110,10 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
|
|
||||||
hr = spInstance->Get(CComBSTR(_T("AdapterRAM")), 0, &var, 0, 0);
|
hr = spInstance->Get(CComBSTR(_T("AdapterRAM")), 0, &var, 0, 0);
|
||||||
if (hr == S_OK) {
|
if (hr == S_OK) {
|
||||||
var.ChangeType(CIM_UINT32); // We're going to receive some integral type, but it might not be uint.
|
var.ChangeType(CIM_UINT64); // We're going to receive some integral type, but it might not be uint.
|
||||||
_dedicatedMemoryMB = var.uintVal / (1024 * 1024);
|
// We might be hosed here. The parameter is documented to be UINT32, but that's only 4 GB!
|
||||||
|
const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024;
|
||||||
|
_dedicatedMemoryMB = (uint) (var.ullVal / BYTES_PER_MEGABYTE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qCDebug(shared) << "Unable to get video AdapterRAM";
|
qCDebug(shared) << "Unable to get video AdapterRAM";
|
||||||
|
|
Loading…
Reference in a new issue