diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 25654bab84..786520534c 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -142,6 +142,11 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) { continue; } + if (strcmp("--use-spvc", argv[i]) == 0) { + mUseSpvc = true; + continue; + } + constexpr const char kVendorIdFilterArg[] = "--adapter-vendor-id="; if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) { const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg); @@ -193,6 +198,9 @@ void DawnTestEnvironment::SetUp() { << "\n" "SkipDawnValidation: " << (mSkipDawnValidation ? "true" : "false") + << "\n" + "UseSpvc: " + << (mUseSpvc ? "true" : "false") << "\n" "BeginCaptureOnStartup: " << (mBeginCaptureOnStartup ? "true" : "false") @@ -241,6 +249,10 @@ bool DawnTestEnvironment::IsDawnValidationSkipped() const { return mSkipDawnValidation; } +bool DawnTestEnvironment::IsSpvcBeingUsed() const { + return mUseSpvc; +} + dawn_native::Instance* DawnTestEnvironment::GetInstance() const { return mInstance.get(); } @@ -370,6 +382,10 @@ bool DawnTestBase::IsDawnValidationSkipped() const { return gTestEnv->IsDawnValidationSkipped(); } +bool DawnTestBase::IsSpvcBeingUsed() const { + return gTestEnv->IsSpvcBeingUsed(); +} + bool DawnTestBase::HasVendorIdFilter() const { return gTestEnv->HasVendorIdFilter(); } @@ -455,6 +471,12 @@ void DawnTestBase::SetUp() { deviceDescriptor.forceEnabledToggles.push_back(kSkipValidationToggle); } + static constexpr char kUseSpvcToggle[] = "use_spvc"; + if (gTestEnv->IsSpvcBeingUsed()) { + ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr); + deviceDescriptor.forceEnabledToggles.push_back(kUseSpvcToggle); + } + backendDevice = mBackendAdapter.CreateDevice(&deviceDescriptor); ASSERT_NE(nullptr, backendDevice); diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index 96ff946d80..e693641733 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -135,6 +135,7 @@ class DawnTestEnvironment : public testing::Environment { bool UsesWire() const; bool IsBackendValidationEnabled() const; bool IsDawnValidationSkipped() const; + bool IsSpvcBeingUsed() const; dawn_native::Instance* GetInstance() const; bool HasVendorIdFilter() const; uint32_t GetVendorIdFilter() const; @@ -148,6 +149,7 @@ class DawnTestEnvironment : public testing::Environment { bool mUseWire = false; bool mEnableBackendValidation = false; bool mSkipDawnValidation = false; + bool mUseSpvc = false; bool mBeginCaptureOnStartup = false; bool mHasVendorIdFilter = false; uint32_t mVendorIdFilter = 0; @@ -182,6 +184,7 @@ class DawnTestBase { bool UsesWire() const; bool IsBackendValidationEnabled() const; bool IsDawnValidationSkipped() const; + bool IsSpvcBeingUsed() const; void StartExpectDeviceError(); bool EndExpectDeviceError();