From 027a8f6464c56c7294a622118d5c1f0fbf9cf58f Mon Sep 17 00:00:00 2001 From: Li Hao Date: Mon, 20 May 2019 02:35:24 +0000 Subject: [PATCH] Enable Metal validation layers BUG=dawn:150 Change-Id: Id3e9dd7a99e8a195fddb98026ddf256d82a4b1ba Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7300 Reviewed-by: Kai Ninomiya Reviewed-by: Corentin Wallez Commit-Queue: Hao Li --- src/dawn_native/metal/BackendMTL.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dawn_native/metal/BackendMTL.mm b/src/dawn_native/metal/BackendMTL.mm index a605b1d938..7e1be79743 100644 --- a/src/dawn_native/metal/BackendMTL.mm +++ b/src/dawn_native/metal/BackendMTL.mm @@ -14,6 +14,7 @@ #include "dawn_native/metal/BackendMTL.h" +#include "dawn_native/Instance.h" #include "dawn_native/MetalBackend.h" #include "dawn_native/metal/DeviceMTL.h" @@ -152,6 +153,9 @@ namespace dawn_native { namespace metal { // Implementation of the Metal backend's BackendConnection Backend::Backend(InstanceBase* instance) : BackendConnection(instance, BackendType::Metal) { + if (GetInstance()->IsBackendValidationEnabled()) { + setenv("METAL_DEVICE_WRAPPER_TYPE", "1", 1); + } } std::vector> Backend::DiscoverDefaultAdapters() {