Commit 39ce0f67 by Michael Spang Committed by Commit Bot

Skip swiftshader tests based on active GPU

Currently Swiftshader tests are skipped only if a swiftshader device is requested. We should also skip swiftshader tests if the default GPU on the system is swiftshader, as is the case in certain emulated systems. Bug: angleproject:4626 Change-Id: I3ee83c43d35eb4f94b516e80689b241d53bbfb62 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2192090 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent d654234e
...@@ -334,8 +334,8 @@ class ANGLETestBase ...@@ -334,8 +334,8 @@ class ANGLETestBase
bool isSwiftshader() const bool isSwiftshader() const
{ {
return mCurrentParams->eglParameters.deviceType == // Renderer might be swiftshader even if local swiftshader not used.
EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE; return mCurrentParams->isSwiftshader() || angle::IsSwiftshaderDevice();
} }
protected: protected:
......
...@@ -109,15 +109,29 @@ bool IsAndroidDevice(const std::string &deviceName) ...@@ -109,15 +109,29 @@ bool IsAndroidDevice(const std::string &deviceName)
return false; return false;
} }
bool HasSystemVendorID(VendorID vendorID) GPUDeviceInfo *GetActiveGPUDeviceInfo()
{ {
SystemInfo *systemInfo = GetTestSystemInfo(); SystemInfo *systemInfo = GetTestSystemInfo();
// Unfortunately sometimes GPU info collection can fail. // Unfortunately sometimes GPU info collection can fail.
if (systemInfo->gpus.empty()) if (systemInfo->gpus.empty())
{ {
return false; return nullptr;
} }
return systemInfo->gpus[systemInfo->activeGPUIndex].vendorId == vendorID; return &systemInfo->gpus[systemInfo->activeGPUIndex];
}
bool HasSystemVendorID(VendorID vendorID)
{
GPUDeviceInfo *gpuInfo = GetActiveGPUDeviceInfo();
return gpuInfo && gpuInfo->vendorId == vendorID;
}
bool HasSystemDeviceID(VendorID vendorID, DeviceID deviceID)
{
GPUDeviceInfo *gpuInfo = GetActiveGPUDeviceInfo();
return gpuInfo && gpuInfo->vendorId == vendorID && gpuInfo->deviceId == deviceID;
} }
using ParamAvailabilityCache = std::map<PlatformParameters, bool>; using ParamAvailabilityCache = std::map<PlatformParameters, bool>;
...@@ -284,6 +298,11 @@ bool IsARM() ...@@ -284,6 +298,11 @@ bool IsARM()
return HasSystemVendorID(kVendorID_ARM); return HasSystemVendorID(kVendorID_ARM);
} }
bool IsSwiftshaderDevice()
{
return HasSystemDeviceID(kVendorID_GOOGLE, kDeviceID_Swiftshader);
}
bool IsNVIDIA() bool IsNVIDIA()
{ {
#if defined(ANGLE_PLATFORM_ANDROID) #if defined(ANGLE_PLATFORM_ANDROID)
...@@ -319,6 +338,19 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters ...@@ -319,6 +338,19 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters
return true; return true;
} }
// TODO: http://crbug.com/swiftshader/145
// Swiftshader does not currently have all the robustness features
// we need for ANGLE. In particular, it is unable to detect and recover
// from infinitely looping shaders. That bug is the tracker for fixing
// that and when resolved we can remove the following code.
// This test will disable tests marked with the config WithRobustness
// when run with the swiftshader Vulkan driver and on Android.
if ((param.isSwiftshader() || IsSwiftshaderDevice()) &&
param.eglParameters.robustness == EGL_TRUE)
{
return false;
}
if (IsWindows()) if (IsWindows())
{ {
switch (param.driver) switch (param.driver)
...@@ -472,21 +504,6 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters ...@@ -472,21 +504,6 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters
} }
} }
// TODO: http://crbug.com/swiftshader/145
// Swiftshader does not currently have all the robustness features
// we need for ANGLE. In particular, it is unable to detect and recover
// from infinitely looping shaders. That bug is the tracker for fixing
// that and when resolved we can remove the following code.
// This test will disable tests marked with the config WithRobustness
// when run with the swiftshader Vulkan driver and on Android.
DeviceID deviceID =
systemInfo.gpus.empty() ? 0 : systemInfo.gpus[systemInfo.activeGPUIndex].deviceId;
if ((param.isSwiftshader() || (IsGoogle(vendorID) && deviceID == kDeviceID_Swiftshader)) &&
param.eglParameters.robustness)
{
return false;
}
// Currently we support the GLES and Vulkan back-ends on Android. // Currently we support the GLES and Vulkan back-ends on Android.
switch (param.getRenderer()) switch (param.getRenderer())
{ {
......
...@@ -44,6 +44,9 @@ bool IsNVIDIA(); ...@@ -44,6 +44,9 @@ bool IsNVIDIA();
bool IsARM(); bool IsARM();
bool IsARM64(); bool IsARM64();
// GPU devices.
bool IsSwiftshaderDevice();
inline bool IsASan() inline bool IsASan()
{ {
#if defined(ANGLE_WITH_ASAN) #if defined(ANGLE_WITH_ASAN)
......
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