From 42b3b9c4131a151941d35c5a19070517ccb492a3 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Wed, 4 Dec 2019 20:05:36 +0000 Subject: [PATCH] Plumb UseSpvc toggle for tests BUG=dawn:273 Change-Id: I4660f0f984b6fb0103eafca9d674dcb4ed02cee4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14220 Reviewed-by: Austin Eng Reviewed-by: Kai Ninomiya Commit-Queue: Ryan Harrison --- src/tests/DawnTest.cpp | 22 ++++++++++++++++++++++ src/tests/DawnTest.h | 3 +++ 2 files changed, 25 insertions(+) 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();