graphics() XML parser improvement (macOS)

This commit is contained in:
Sebastian Hildebrandt
2021-09-15 08:50:14 +02:00
parent 09775cd5bd
commit 17e4b7e70d
6 changed files with 121 additions and 15 deletions
+12 -1
View File
@@ -103,6 +103,17 @@ function getVendorFromId(id) {
return vendors[id] || '';
}
function vendorToId(str) {
let result = '';
str = (str || '').toLowerCase();
if (str.indexOf('apple') >= 0) { result = '0x05ac'; }
else if (str.indexOf('nvidia') >= 0) { result = '0x10de'; }
else if (str.indexOf('intel') >= 0) { result = '0x8086'; }
else if (str.indexOf('ati') >= 0 || str.indexOf('amd') >= 0) { result = '0x1002'; }
return result;
}
function getMetalVersion(id) {
const families = {
'spdisplays_mtlgpufamilymac1': 'mac1',
@@ -139,7 +150,7 @@ function graphics(callback) {
vramDynamic: bus === 'Built-In',
vram: vram || vramDyn || 0,
deviceId: item['spdisplays_device-id'] || '',
vendorId: item['spdisplays_vendor-id'] || '',
vendorId: item['spdisplays_vendor-id'] || vendorToId((item['spdisplays_vendor'] || '') + (item.sppci_model || '')),
external: (item.sppci_device_type === 'spdisplays_egpu'),
cores: item['sppci_cores'] || null,
metalVersion