Commit 0c8f66c7 by Jiawei Shao Committed by Commit Bot

OpenGL: Get VendorID and DeviceID with angle::GetSystemInfo()

Previously on the OpenGL backend we get the device ID with funtion GetDeviceID() which just supports a few types of devices. This patch fixes this issue by using angle::GetSystemInfo() instead. Bug: angleproject:5011 Change-Id: Ief0e1228bb1871a73755f05f2debd3a8e5c75597 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2392634Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
parent 3486ec96
...@@ -1555,8 +1555,22 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -1555,8 +1555,22 @@ void GenerateCaps(const FunctionsGL *functions,
void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features) void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features)
{ {
VendorID vendor = GetVendorID(functions); angle::VendorID vendor;
uint32_t device = GetDeviceID(functions); angle::DeviceID device;
angle::SystemInfo systemInfo;
bool isGetSystemInfoSuccess = angle::GetSystemInfo(&systemInfo);
if (isGetSystemInfoSuccess)
{
vendor = systemInfo.gpus[systemInfo.activeGPUIndex].vendorId;
device = systemInfo.gpus[systemInfo.activeGPUIndex].deviceId;
}
else
{
vendor = GetVendorID(functions);
device = GetDeviceID(functions);
}
bool isAMD = IsAMD(vendor); bool isAMD = IsAMD(vendor);
bool isIntel = IsIntel(vendor); bool isIntel = IsIntel(vendor);
bool isNvidia = IsNvidia(vendor); bool isNvidia = IsNvidia(vendor);
...@@ -1770,13 +1784,12 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ...@@ -1770,13 +1784,12 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
bool isDualGPUMacWithNVIDIA = false; bool isDualGPUMacWithNVIDIA = false;
if (IsApple() && functions->standard == STANDARD_GL_DESKTOP) if (IsApple() && functions->standard == STANDARD_GL_DESKTOP)
{ {
angle::SystemInfo info; if (isGetSystemInfoSuccess)
if (angle::GetSystemInfo(&info))
{ {
// The full system information must be queried to see whether it's a dual-GPU // The full system information must be queried to see whether it's a dual-GPU
// NVIDIA MacBook Pro since it's likely that the integrated GPU will be active // NVIDIA MacBook Pro since it's likely that the integrated GPU will be active
// when these features are initialized. // when these features are initialized.
isDualGPUMacWithNVIDIA = info.isMacSwitchable && info.hasNVIDIAGPU(); isDualGPUMacWithNVIDIA = systemInfo.isMacSwitchable && systemInfo.hasNVIDIAGPU();
} }
} }
ANGLE_FEATURE_CONDITION(features, disableGPUSwitchingSupport, isDualGPUMacWithNVIDIA); ANGLE_FEATURE_CONDITION(features, disableGPUSwitchingSupport, isDualGPUMacWithNVIDIA);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment