diff --git a/src/dawn/tests/DawnTest.cpp b/src/dawn/tests/DawnTest.cpp index 8b63b31059..148bf0a5aa 100644 --- a/src/dawn/tests/DawnTest.cpp +++ b/src/dawn/tests/DawnTest.cpp @@ -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 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()) { diff --git a/src/dawn/tests/DawnTest.h b/src/dawn/tests/DawnTest.h index ba79e06f31..c917fe3995 100644 --- a/src/dawn/tests/DawnTest.h +++ b/src/dawn/tests/DawnTest.h @@ -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;