D3D12: Only keep buffer bounds checks when robustness is enabled

This patch removes the D3D12 root signature descriptor range flag
`DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS` when robustness
is disabled because we only need that flag when robustness is
enabled.

Bug: dawn:527
Change-Id: I4a5b595315e801091bbde06c4907e6b206cfb4de
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/191560
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp b/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp
index 73cacaa..ddaf8fe 100644
--- a/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp
+++ b/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp
@@ -143,17 +143,19 @@
                 // point to data.
                 return D3D12_DESCRIPTOR_RANGE_FLAG_NONE;
             },
-            [](const BufferBindingInfo&) -> D3D12_DESCRIPTOR_RANGE_FLAGS {
+            [&](const BufferBindingInfo&) -> D3D12_DESCRIPTOR_RANGE_FLAGS {
                 // In Dawn it's allowed to do state transitions on the buffers or textures after
-                // binding
-                // them on the current command list, which indicates a change to its data (or
-                // possibly resource metadata), so we cannot bind them as DATA_STATIC. We cannot
+                // binding them on the current command list, which indicates a change to its data
+                // (or possibly resource metadata), so we cannot bind them as DATA_STATIC. We cannot
                 // bind them as DATA_STATIC_WHILE_SET_AT_EXECUTE either because it is required to be
                 // rebound to the command list before the next (this) Draw/Dispatch call, while
                 // currently we may not rebind these resources if the current bind group is not
                 // changed.
-                return D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS |
-                       D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE;
+                if (GetDevice()->IsRobustnessEnabled()) {
+                    return D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS |
+                           D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE;
+                }
+                return D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE;
             },
             [](const TextureBindingInfo&) -> D3D12_DESCRIPTOR_RANGE_FLAGS {
                 return D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE;