From 1458dbf51865bd6d92def7d505a3b79f5b2f56db Mon Sep 17 00:00:00 2001 From: Li Hao Date: Mon, 20 May 2019 02:35:04 +0000 Subject: [PATCH] Enable Vulkan validation layers BUG=dawn:150 Change-Id: Ie1b252f7fecb323badb40a226e185390d0c241e4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7281 Reviewed-by: Kai Ninomiya Reviewed-by: Corentin Wallez Commit-Queue: Hao Li --- src/dawn_native/vulkan/BackendVk.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/dawn_native/vulkan/BackendVk.cpp b/src/dawn_native/vulkan/BackendVk.cpp index ecd263f92e..6ca0a26ca3 100644 --- a/src/dawn_native/vulkan/BackendVk.cpp +++ b/src/dawn_native/vulkan/BackendVk.cpp @@ -120,16 +120,18 @@ namespace dawn_native { namespace vulkan { usedKnobs.renderDocCapture = true; } #endif -#if defined(DAWN_ENABLE_ASSERTS) - if (mGlobalInfo.standardValidation) { - layersToRequest.push_back(kLayerNameLunargStandardValidation); - usedKnobs.standardValidation = true; + + if (GetInstance()->IsBackendValidationEnabled()) { + if (mGlobalInfo.standardValidation) { + layersToRequest.push_back(kLayerNameLunargStandardValidation); + usedKnobs.standardValidation = true; + } + if (mGlobalInfo.debugReport) { + extensionsToRequest.push_back(kExtensionNameExtDebugReport); + usedKnobs.debugReport = true; + } } - if (mGlobalInfo.debugReport) { - extensionsToRequest.push_back(kExtensionNameExtDebugReport); - usedKnobs.debugReport = true; - } -#endif + // Always request all extensions used to create VkSurfaceKHR objects so that they are // always available for embedders looking to create VkSurfaceKHR on our VkInstance. if (mGlobalInfo.macosSurface) {