Implement a --use-angle= argument in DawnTest.

This will allow the bots to specify a particular backend.

Change-Id: I9486019c3aef3f8aafb79e30dfc62d23ae9eefac
Bug: dawn:1420
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90320
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2022-05-16 15:36:21 +00:00 committed by Dawn LUCI CQ
parent 8556ae0061
commit cc8cc9c67b
2 changed files with 15 additions and 1 deletions

View File

@ -313,6 +313,13 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) {
continue;
}
constexpr const char kUseAngleArg[] = "--use-angle=";
argLen = sizeof(kUseAngleArg) - 1;
if (strncmp(argv[i], kUseAngleArg, argLen) == 0) {
mANGLEBackend = argv[i] + argLen;
continue;
}
constexpr const char kExclusiveDeviceTypePreferenceArg[] =
"--exclusive-device-type-preference=";
argLen = sizeof(kExclusiveDeviceTypePreferenceArg) - 1;
@ -440,7 +447,13 @@ std::unique_ptr<dawn::native::Instance> DawnTestEnvironment::CreateInstanceAndDi
ScopedEnvironmentVar angleDefaultPlatform;
if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) {
angleDefaultPlatform.Set("ANGLE_DEFAULT_PLATFORM", "swiftshader");
const char* platform;
if (!mANGLEBackend.empty()) {
platform = mANGLEBackend.c_str();
} else {
platform = "swiftshader";
}
angleDefaultPlatform.Set("ANGLE_DEFAULT_PLATFORM", platform);
}
if (!glfwInit()) {

View File

@ -257,6 +257,7 @@ class DawnTestEnvironment : public testing::Environment {
bool mUseWire = false;
dawn::native::BackendValidationLevel mBackendValidationLevel =
dawn::native::BackendValidationLevel::Disabled;
std::string mANGLEBackend;
bool mBeginCaptureOnStartup = false;
bool mHasVendorIdFilter = false;
uint32_t mVendorIdFilter = 0;