Enable GBV by default for correctness tests.

Dawn apps using debug builds may hang due to
GBV being always on by default. This change turns
on GBV for correctness tests only.

BUG=dawn:490

Change-Id: I2728d834ed53f9acc7556f8d1178d718c0b49457
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25421
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This commit is contained in:
Bryan Bernhart 2020-07-29 19:44:41 +00:00 committed by Commit Bot service account
parent 2c8e1f2f11
commit 03cf7c3eae
6 changed files with 26 additions and 3 deletions

View File

@ -149,6 +149,10 @@ namespace dawn_native {
mImpl->EnableBackendValidation(enableBackendValidation); mImpl->EnableBackendValidation(enableBackendValidation);
} }
void Instance::EnableGPUBasedBackendValidation(bool enableGPUBasedBackendValidation) {
mImpl->EnableGPUBasedBackendValidation(enableGPUBasedBackendValidation);
}
void Instance::EnableBeginCaptureOnStartup(bool beginCaptureOnStartup) { void Instance::EnableBeginCaptureOnStartup(bool beginCaptureOnStartup) {
mImpl->EnableBeginCaptureOnStartup(beginCaptureOnStartup); mImpl->EnableBeginCaptureOnStartup(beginCaptureOnStartup);
} }

View File

@ -202,6 +202,14 @@ namespace dawn_native {
return mEnableBackendValidation; return mEnableBackendValidation;
} }
void InstanceBase::EnableGPUBasedBackendValidation(bool enableGPUBasedBackendValidation) {
mEnableGPUValidation = enableGPUBasedBackendValidation;
}
bool InstanceBase::IsGPUBasedBackendValidationEnabled() const {
return mEnableGPUValidation;
}
void InstanceBase::EnableBeginCaptureOnStartup(bool beginCaptureOnStartup) { void InstanceBase::EnableBeginCaptureOnStartup(bool beginCaptureOnStartup) {
mBeginCaptureOnStartup = beginCaptureOnStartup; mBeginCaptureOnStartup = beginCaptureOnStartup;
} }

View File

@ -60,6 +60,9 @@ namespace dawn_native {
void EnableBackendValidation(bool enableBackendValidation); void EnableBackendValidation(bool enableBackendValidation);
bool IsBackendValidationEnabled() const; bool IsBackendValidationEnabled() const;
void EnableGPUBasedBackendValidation(bool enableGPUBasedBackendValidation);
bool IsGPUBasedBackendValidationEnabled() const;
void EnableBeginCaptureOnStartup(bool beginCaptureOnStartup); void EnableBeginCaptureOnStartup(bool beginCaptureOnStartup);
bool IsBeginCaptureOnStartupEnabled() const; bool IsBeginCaptureOnStartupEnabled() const;
@ -88,6 +91,7 @@ namespace dawn_native {
bool mEnableBackendValidation = false; bool mEnableBackendValidation = false;
bool mBeginCaptureOnStartup = false; bool mBeginCaptureOnStartup = false;
bool mEnableGPUValidation = false;
dawn_platform::Platform* mPlatform = nullptr; dawn_platform::Platform* mPlatform = nullptr;

View File

@ -26,7 +26,8 @@ namespace dawn_native { namespace d3d12 {
ResultOrError<ComPtr<IDXGIFactory4>> CreateFactory(const PlatformFunctions* functions, ResultOrError<ComPtr<IDXGIFactory4>> CreateFactory(const PlatformFunctions* functions,
bool enableBackendValidation, bool enableBackendValidation,
bool beginCaptureOnStartup) { bool beginCaptureOnStartup,
bool enableGPUBasedBackendValidation) {
ComPtr<IDXGIFactory4> factory; ComPtr<IDXGIFactory4> factory;
uint32_t dxgiFactoryFlags = 0; uint32_t dxgiFactoryFlags = 0;
@ -39,7 +40,8 @@ namespace dawn_native { namespace d3d12 {
functions->d3d12GetDebugInterface(IID_PPV_ARGS(&debugController)))) { functions->d3d12GetDebugInterface(IID_PPV_ARGS(&debugController)))) {
ASSERT(debugController != nullptr); ASSERT(debugController != nullptr);
debugController->EnableDebugLayer(); debugController->EnableDebugLayer();
debugController->SetEnableGPUBasedValidation(true); debugController->SetEnableGPUBasedValidation(
enableGPUBasedBackendValidation);
// Enable additional debug layers. // Enable additional debug layers.
dxgiFactoryFlags |= DXGI_CREATE_FACTORY_DEBUG; dxgiFactoryFlags |= DXGI_CREATE_FACTORY_DEBUG;
@ -96,7 +98,8 @@ namespace dawn_native { namespace d3d12 {
DAWN_TRY_ASSIGN(mFactory, DAWN_TRY_ASSIGN(mFactory,
CreateFactory(mFunctions.get(), instance->IsBackendValidationEnabled(), CreateFactory(mFunctions.get(), instance->IsBackendValidationEnabled(),
instance->IsBeginCaptureOnStartupEnabled())); instance->IsBeginCaptureOnStartupEnabled(),
instance->IsGPUBasedBackendValidationEnabled()));
return {}; return {};
} }

View File

@ -157,6 +157,9 @@ namespace dawn_native {
// Enable debug capture on Dawn startup // Enable debug capture on Dawn startup
void EnableBeginCaptureOnStartup(bool beginCaptureOnStartup); void EnableBeginCaptureOnStartup(bool beginCaptureOnStartup);
// Enable GPU based backend validation if it has.
void EnableGPUBasedBackendValidation(bool enableGPUBasedBackendValidation);
void SetPlatform(dawn_platform::Platform* platform); void SetPlatform(dawn_platform::Platform* platform);
// Returns the underlying WGPUInstance object. // Returns the underlying WGPUInstance object.

View File

@ -368,6 +368,7 @@ std::unique_ptr<dawn_native::Instance> DawnTestEnvironment::CreateInstanceAndDis
const { const {
auto instance = std::make_unique<dawn_native::Instance>(); auto instance = std::make_unique<dawn_native::Instance>();
instance->EnableBackendValidation(mEnableBackendValidation); instance->EnableBackendValidation(mEnableBackendValidation);
instance->EnableGPUBasedBackendValidation(mEnableBackendValidation);
instance->EnableBeginCaptureOnStartup(mBeginCaptureOnStartup); instance->EnableBeginCaptureOnStartup(mBeginCaptureOnStartup);
instance->DiscoverDefaultAdapters(); instance->DiscoverDefaultAdapters();