diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index adc75fce9b..79c441e566 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -832,6 +832,10 @@ namespace dawn_native { return !IsToggleEnabled(Toggle::SkipValidation); } + bool DeviceBase::IsRobustnessEnabled() const { + return !IsToggleEnabled(Toggle::DisableRobustness); + } + size_t DeviceBase::GetLazyClearCountForTesting() { return mLazyClearCountForTesting; } diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h index a513796e14..bcea26ffd7 100644 --- a/src/dawn_native/Device.h +++ b/src/dawn_native/Device.h @@ -216,6 +216,7 @@ namespace dawn_native { bool IsExtensionEnabled(Extension extension) const; bool IsToggleEnabled(Toggle toggle) const; bool IsValidationEnabled() const; + bool IsRobustnessEnabled() const; size_t GetLazyClearCountForTesting(); void IncrementLazyClearCountForTesting(); size_t GetDeprecationWarningCountForTesting(); diff --git a/src/dawn_native/Toggles.cpp b/src/dawn_native/Toggles.cpp index b4ec0db0e3..9eb526a2ec 100644 --- a/src/dawn_native/Toggles.cpp +++ b/src/dawn_native/Toggles.cpp @@ -131,6 +131,8 @@ namespace dawn_native { {Toggle::UseDXC, {"use_dxc", "Use DXC instead of FXC for compiling HLSL", "https://crbug.com/dawn/402"}}, + {Toggle::DisableRobustness, + {"disable_robustness", "Disable robust buffer access", "https://crbug.com/dawn/480"}}, }}; } // anonymous namespace diff --git a/src/dawn_native/Toggles.h b/src/dawn_native/Toggles.h index 18a26a9a63..1e7e3e3b7a 100644 --- a/src/dawn_native/Toggles.h +++ b/src/dawn_native/Toggles.h @@ -42,6 +42,7 @@ namespace dawn_native { DisableBaseInstance, UseD3D12SmallShaderVisibleHeapForTesting, UseDXC, + DisableRobustness, EnumCount, InvalidEnum = EnumCount, diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp index 921dd7341c..2415b49bc9 100644 --- a/src/dawn_native/vulkan/DeviceVk.cpp +++ b/src/dawn_native/vulkan/DeviceVk.cpp @@ -299,6 +299,10 @@ namespace dawn_native { namespace vulkan { // Always require fragmentStoresAndAtomics because it is required by end2end tests. usedKnobs.features.fragmentStoresAndAtomics = VK_TRUE; + if (IsRobustnessEnabled()) { + usedKnobs.features.robustBufferAccess = VK_TRUE; + } + if (mDeviceInfo.HasExt(DeviceExt::SubgroupSizeControl)) { ASSERT(usedKnobs.HasExt(DeviceExt::SubgroupSizeControl));