[dawn][vk] Fix uses of pipeline robustness when robustness is disabled.
When Dawn's robustness is disabled we use pipeline robustness to tell
the driver to not do any robustness if it can, so we still need to
enable the Vulkan extension in that case, to allow passing
VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT.
When robustness is disabled we also need to skip setting the
VulkanUse*RobustAccess2 toggles since the relevant features are not
enabled, which would cause a VVL error when they make pipeline
robustness request "robust access 2".
Fixed: 443940959
Change-Id: Icb91b2b316b2a543240e5522f9d631862a7cd8a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/261175
Reviewed-by: Kyle Charbonneau <kylechar@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn/native/vulkan/DeviceVk.cpp b/src/dawn/native/vulkan/DeviceVk.cpp
index adba909..5317ec7 100644
--- a/src/dawn/native/vulkan/DeviceVk.cpp
+++ b/src/dawn/native/vulkan/DeviceVk.cpp
@@ -449,6 +449,15 @@
usedKnobs.features.shaderSampledImageArrayDynamicIndexing = VK_TRUE;
usedKnobs.features.shaderStorageImageArrayDynamicIndexing = VK_TRUE;
+ // Always enable pipeline robustness if available as it allows both better control of robustness
+ // when we want it, and to give hints to not do any robustness when we don't need it.
+ if (mDeviceInfo.HasExt(DeviceExt::PipelineRobustness)) {
+ DAWN_ASSERT(usedKnobs.HasExt(DeviceExt::PipelineRobustness));
+
+ usedKnobs.pipelineRobustnessFeatures = mDeviceInfo.pipelineRobustnessFeatures;
+ featuresChain.Add(&usedKnobs.pipelineRobustnessFeatures);
+ }
+
if (IsRobustnessEnabled()) {
usedKnobs.features.robustBufferAccess = VK_TRUE;
@@ -462,14 +471,6 @@
featuresChain.Add(&usedKnobs.robustness2Features);
}
- // Enable pipelineRobustness to better control where robustness happens.
- if (mDeviceInfo.HasExt(DeviceExt::PipelineRobustness)) {
- DAWN_ASSERT(usedKnobs.HasExt(DeviceExt::PipelineRobustness));
-
- usedKnobs.pipelineRobustnessFeatures = mDeviceInfo.pipelineRobustnessFeatures;
- featuresChain.Add(&usedKnobs.pipelineRobustnessFeatures);
- }
-
// robustBufferAccess requires robustBufferAccessUpdateAfterBind to be used with bindless
// enabled. If it is not available, we manual implement robustness for shader buffers and
// rely on pipelineRobustness for vertex buffer robustness.
diff --git a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
index e39e29b..f8d532a 100644
--- a/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
+++ b/src/dawn/native/vulkan/PhysicalDeviceVk.cpp
@@ -1109,7 +1109,8 @@
// By default try to skip injecting robustness checks on textures using VK_EXT_robustness2. But
// disable that optimization when the feature is not available.
- if (!GetDeviceInfo().HasExt(DeviceExt::Robustness2) ||
+ if (deviceToggles->IsSet(Toggle::DisableRobustness) ||
+ !GetDeviceInfo().HasExt(DeviceExt::Robustness2) ||
GetDeviceInfo().robustness2Features.robustImageAccess2 == VK_FALSE) {
deviceToggles->ForceSet(Toggle::VulkanUseImageRobustAccess2, false);
} else {
@@ -1119,7 +1120,8 @@
// By default try to skip injecting robustness checks on buffers using VK_EXT_robustness2. But
// disable that optimization when the feature is not available or if it conflicts with bindless
// support (see comment in the detection of bindless support for more details).
- if (!GetDeviceInfo().HasExt(DeviceExt::Robustness2) ||
+ if (deviceToggles->IsSet(Toggle::DisableRobustness) ||
+ !GetDeviceInfo().HasExt(DeviceExt::Robustness2) ||
GetDeviceInfo().robustness2Features.robustBufferAccess2 == VK_FALSE) {
deviceToggles->ForceSet(Toggle::VulkanUseBufferRobustAccess2, false);
} else if (GetDeviceInfo().HasExt(DeviceExt::DescriptorIndexing) &&