diff --git a/src/dawn_native/vulkan/BackendVk.cpp b/src/dawn_native/vulkan/BackendVk.cpp index 6e431f15a6..c9bcdcc494 100644 --- a/src/dawn_native/vulkan/BackendVk.cpp +++ b/src/dawn_native/vulkan/BackendVk.cpp @@ -298,6 +298,21 @@ namespace dawn_native { namespace vulkan { VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT); } + // Try to turn on synchronization validation if the instance was created with backend + // validation enabled. + VkValidationFeaturesEXT validationFeatures; + VkValidationFeatureEnableEXT kEnableSynchronizationValidation = + VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT; + if (GetInstance()->IsBackendValidationEnabled() && + usedKnobs.HasExt(InstanceExt::ValidationFeatures)) { + validationFeatures.enabledValidationFeatureCount = 1; + validationFeatures.pEnabledValidationFeatures = &kEnableSynchronizationValidation; + validationFeatures.disabledValidationFeatureCount = 0; + validationFeatures.pDisabledValidationFeatures = nullptr; + + createInfoChain.Add(&validationFeatures, VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT); + } + DAWN_TRY(CheckVkSuccess(mFunctions.CreateInstance(&createInfo, nullptr, &mInstance), "vkCreateInstance")); diff --git a/src/dawn_native/vulkan/VulkanExtensions.cpp b/src/dawn_native/vulkan/VulkanExtensions.cpp index 4c07d69f99..3073625ce3 100644 --- a/src/dawn_native/vulkan/VulkanExtensions.cpp +++ b/src/dawn_native/vulkan/VulkanExtensions.cpp @@ -48,6 +48,7 @@ namespace dawn_native { namespace vulkan { {InstanceExt::XlibSurface, "VK_KHR_xlib_surface", NeverPromoted}, {InstanceExt::DebugUtils, "VK_EXT_debug_utils", NeverPromoted}, + {InstanceExt::ValidationFeatures, "VK_EXT_validation_features", NeverPromoted}, // }}; @@ -88,6 +89,7 @@ namespace dawn_native { namespace vulkan { case InstanceExt::GetPhysicalDeviceProperties2: case InstanceExt::Surface: case InstanceExt::DebugUtils: + case InstanceExt::ValidationFeatures: hasDependencies = true; break; diff --git a/src/dawn_native/vulkan/VulkanExtensions.h b/src/dawn_native/vulkan/VulkanExtensions.h index 91af192e21..bd87527945 100644 --- a/src/dawn_native/vulkan/VulkanExtensions.h +++ b/src/dawn_native/vulkan/VulkanExtensions.h @@ -40,6 +40,7 @@ namespace dawn_native { namespace vulkan { // Others DebugUtils, + ValidationFeatures, EnumCount, }; diff --git a/src/tests/end2end/QueueTests.cpp b/src/tests/end2end/QueueTests.cpp index 5ebb86bbda..1ed3fab907 100644 --- a/src/tests/end2end/QueueTests.cpp +++ b/src/tests/end2end/QueueTests.cpp @@ -118,6 +118,11 @@ TEST_P(QueueWriteBufferTests, ManyWriteBuffer) { // once the issue with Metal on 10.14.6 is fixed. DAWN_SKIP_TEST_IF(IsMacOS() && IsIntel() && IsMetal()); + // The Vulkan Validation Layers' memory barrier validation keeps track of every range written + // to independently which causes validation of each WriteBuffer to take increasing time, and + // this test to take forever. Skip it when VVLs are enabled. + DAWN_SKIP_TEST_IF(IsVulkan() && IsBackendValidationEnabled()); + constexpr uint64_t kSize = 4000 * 1000; constexpr uint32_t kElements = 250 * 250; wgpu::BufferDescriptor descriptor;