Enable Metal validation layers

BUG=dawn:150

Change-Id: Id3e9dd7a99e8a195fddb98026ddf256d82a4b1ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7300
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Li Hao 2019-05-20 02:35:24 +00:00 committed by Commit Bot service account
parent 1458dbf518
commit 027a8f6464
1 changed files with 4 additions and 0 deletions

View File

@ -14,6 +14,7 @@
#include "dawn_native/metal/BackendMTL.h" #include "dawn_native/metal/BackendMTL.h"
#include "dawn_native/Instance.h"
#include "dawn_native/MetalBackend.h" #include "dawn_native/MetalBackend.h"
#include "dawn_native/metal/DeviceMTL.h" #include "dawn_native/metal/DeviceMTL.h"
@ -152,6 +153,9 @@ namespace dawn_native { namespace metal {
// Implementation of the Metal backend's BackendConnection // Implementation of the Metal backend's BackendConnection
Backend::Backend(InstanceBase* instance) : BackendConnection(instance, BackendType::Metal) { Backend::Backend(InstanceBase* instance) : BackendConnection(instance, BackendType::Metal) {
if (GetInstance()->IsBackendValidationEnabled()) {
setenv("METAL_DEVICE_WRAPPER_TYPE", "1", 1);
}
} }
std::vector<std::unique_ptr<AdapterBase>> Backend::DiscoverDefaultAdapters() { std::vector<std::unique_ptr<AdapterBase>> Backend::DiscoverDefaultAdapters() {