Vulkan: Enable robust buffer access if validation is on

Bug: dawn:480
Change-Id: Id145fab2fe24b70a063c3cc1f75f0a565635abf8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24182
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Idan Raiter 2020-07-01 21:37:57 +00:00 committed by Commit Bot service account
parent 509b811a75
commit bcc65f2d48
5 changed files with 12 additions and 0 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -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

View File

@ -42,6 +42,7 @@ namespace dawn_native {
DisableBaseInstance,
UseD3D12SmallShaderVisibleHeapForTesting,
UseDXC,
DisableRobustness,
EnumCount,
InvalidEnum = EnumCount,

View File

@ -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));