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 <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ryan Harrison 2019-12-04 20:05:36 +00:00 committed by Commit Bot service account
parent 53782d60dc
commit 42b3b9c413
2 changed files with 25 additions and 0 deletions

View File

@ -142,6 +142,11 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
continue; continue;
} }
if (strcmp("--use-spvc", argv[i]) == 0) {
mUseSpvc = true;
continue;
}
constexpr const char kVendorIdFilterArg[] = "--adapter-vendor-id="; constexpr const char kVendorIdFilterArg[] = "--adapter-vendor-id=";
if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) { if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) {
const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg); const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg);
@ -193,6 +198,9 @@ void DawnTestEnvironment::SetUp() {
<< "\n" << "\n"
"SkipDawnValidation: " "SkipDawnValidation: "
<< (mSkipDawnValidation ? "true" : "false") << (mSkipDawnValidation ? "true" : "false")
<< "\n"
"UseSpvc: "
<< (mUseSpvc ? "true" : "false")
<< "\n" << "\n"
"BeginCaptureOnStartup: " "BeginCaptureOnStartup: "
<< (mBeginCaptureOnStartup ? "true" : "false") << (mBeginCaptureOnStartup ? "true" : "false")
@ -241,6 +249,10 @@ bool DawnTestEnvironment::IsDawnValidationSkipped() const {
return mSkipDawnValidation; return mSkipDawnValidation;
} }
bool DawnTestEnvironment::IsSpvcBeingUsed() const {
return mUseSpvc;
}
dawn_native::Instance* DawnTestEnvironment::GetInstance() const { dawn_native::Instance* DawnTestEnvironment::GetInstance() const {
return mInstance.get(); return mInstance.get();
} }
@ -370,6 +382,10 @@ bool DawnTestBase::IsDawnValidationSkipped() const {
return gTestEnv->IsDawnValidationSkipped(); return gTestEnv->IsDawnValidationSkipped();
} }
bool DawnTestBase::IsSpvcBeingUsed() const {
return gTestEnv->IsSpvcBeingUsed();
}
bool DawnTestBase::HasVendorIdFilter() const { bool DawnTestBase::HasVendorIdFilter() const {
return gTestEnv->HasVendorIdFilter(); return gTestEnv->HasVendorIdFilter();
} }
@ -455,6 +471,12 @@ void DawnTestBase::SetUp() {
deviceDescriptor.forceEnabledToggles.push_back(kSkipValidationToggle); 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); backendDevice = mBackendAdapter.CreateDevice(&deviceDescriptor);
ASSERT_NE(nullptr, backendDevice); ASSERT_NE(nullptr, backendDevice);

View File

@ -135,6 +135,7 @@ class DawnTestEnvironment : public testing::Environment {
bool UsesWire() const; bool UsesWire() const;
bool IsBackendValidationEnabled() const; bool IsBackendValidationEnabled() const;
bool IsDawnValidationSkipped() const; bool IsDawnValidationSkipped() const;
bool IsSpvcBeingUsed() const;
dawn_native::Instance* GetInstance() const; dawn_native::Instance* GetInstance() const;
bool HasVendorIdFilter() const; bool HasVendorIdFilter() const;
uint32_t GetVendorIdFilter() const; uint32_t GetVendorIdFilter() const;
@ -148,6 +149,7 @@ class DawnTestEnvironment : public testing::Environment {
bool mUseWire = false; bool mUseWire = false;
bool mEnableBackendValidation = false; bool mEnableBackendValidation = false;
bool mSkipDawnValidation = false; bool mSkipDawnValidation = false;
bool mUseSpvc = false;
bool mBeginCaptureOnStartup = false; bool mBeginCaptureOnStartup = false;
bool mHasVendorIdFilter = false; bool mHasVendorIdFilter = false;
uint32_t mVendorIdFilter = 0; uint32_t mVendorIdFilter = 0;
@ -182,6 +184,7 @@ class DawnTestBase {
bool UsesWire() const; bool UsesWire() const;
bool IsBackendValidationEnabled() const; bool IsBackendValidationEnabled() const;
bool IsDawnValidationSkipped() const; bool IsDawnValidationSkipped() const;
bool IsSpvcBeingUsed() const;
void StartExpectDeviceError(); void StartExpectDeviceError();
bool EndExpectDeviceError(); bool EndExpectDeviceError();