Enable D3D12 validation layers

Run end2end tests with argument '-d' or '--enable-backend-validation'

Change-Id: I34a3f453dcd3a57d76301801ae2abe42f847cb1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Li Hao
2019-05-15 06:06:26 +00:00
committed by Commit Bot service account
parent 2e56970932
commit 0195dbf908
8 changed files with 58 additions and 21 deletions

View File

@@ -102,9 +102,17 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
continue;
}
if (strcmp("-d", argv[i]) == 0 || strcmp("--enable-backend-validation", argv[i]) == 0) {
mEnableBackendValidation = true;
continue;
}
if (strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
std::cout << "\n\nUsage: " << argv[0] << " [GTEST_FLAGS...] [-w] \n";
std::cout << " -w, --use-wire: Run the tests through the wire (defaults to no wire)";
std::cout << "\n\nUsage: " << argv[0]
<< " [GTEST_FLAGS...] [-w] [--enable-validation-layers]\n";
std::cout << " -w, --use-wire: Run the tests through the wire (defaults to no wire)\n";
std::cout << " -d, --enable-backend-validation: Enable backend validation (defaults"
<< " to disabled)\n";
std::cout << std::endl;
continue;
}
@@ -115,6 +123,7 @@ void DawnTestEnvironment::SetUp() {
ASSERT_TRUE(glfwInit());
mInstance = std::make_unique<dawn_native::Instance>();
mInstance->EnableBackendValidation(mEnableBackendValidation);
static constexpr dawn_native::BackendType kAllBackends[] = {
dawn_native::BackendType::D3D12,
@@ -134,6 +143,8 @@ void DawnTestEnvironment::SetUp() {
std::cout << "Testing configuration\n";
std::cout << "---------------------\n";
std::cout << "UseWire: " << (mUseWire ? "true" : "false") << "\n";
std::cout << "EnableBackendValidation: " << (mEnableBackendValidation ? "true" : "false")
<< "\n";
std::cout << "\n";
// Preparing for outputting hex numbers

View File

@@ -114,6 +114,7 @@ class DawnTestEnvironment : public testing::Environment {
void CreateBackendWindow(dawn_native::BackendType type);
bool mUseWire = false;
bool mEnableBackendValidation = false;
std::unique_ptr<dawn_native::Instance> mInstance;
// Windows don't usually like to be bound to one API than the other, for example switching