Enable dynamic storage buffers

Validation is implemented with CTS tests added in
https://github.com/gpuweb/cts/pull/850

Fixed: dawn:429
Change-Id: Iee570c712f81fbafc158c0ceec89a28011a3fed8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2021-12-10 01:50:08 +00:00 committed by Dawn LUCI CQ
parent a840574db0
commit 6ad6278bc5
2 changed files with 0 additions and 49 deletions

View File

@ -89,17 +89,6 @@ namespace dawn_native {
buffer.type == kInternalStorageBufferBinding) {
allowedStages &= ~wgpu::ShaderStage::Vertex;
}
// Dynamic storage buffers aren't bounds checked properly in D3D12. Disallow them as
// unsafe until the bounds checks are implemented.
DAWN_INVALID_IF(
device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs) &&
buffer.hasDynamicOffset &&
(buffer.type == wgpu::BufferBindingType::Storage ||
buffer.type == kInternalStorageBufferBinding ||
buffer.type == wgpu::BufferBindingType::ReadOnlyStorage),
"Dynamic storage buffers are disallowed because they aren't secure yet. "
"See https://crbug.com/dawn/429");
}
if (entry.sampler.type != wgpu::SamplerBindingType::Undefined) {
bindingMemberCount++;

View File

@ -28,44 +28,6 @@ class UnsafeAPIValidationTest : public ValidationTest {
}
};
// Check that dynamic storage buffers are disallowed.
TEST_F(UnsafeAPIValidationTest, DynamicStorageBuffer) {
wgpu::BindGroupLayoutEntry entry;
entry.visibility = wgpu::ShaderStage::Fragment;
wgpu::BindGroupLayoutDescriptor desc;
desc.entries = &entry;
desc.entryCount = 1;
// Control case: storage buffer without a dynamic offset is allowed.
{
entry.buffer.type = wgpu::BufferBindingType::Storage;
entry.buffer.hasDynamicOffset = false;
device.CreateBindGroupLayout(&desc);
}
// Control case: readonly storage buffer without a dynamic offset is allowed.
{
entry.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage;
entry.buffer.hasDynamicOffset = false;
device.CreateBindGroupLayout(&desc);
}
// Storage buffer with a dynamic offset is disallowed.
{
entry.buffer.type = wgpu::BufferBindingType::Storage;
entry.buffer.hasDynamicOffset = true;
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&desc));
}
// Readonly storage buffer with a dynamic offset is disallowed.
{
entry.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage;
entry.buffer.hasDynamicOffset = true;
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&desc));
}
}
// Check that pipeline overridable constants are disallowed as part of unsafe APIs.
// TODO(dawn:1041) Remove when implementation for all backend is added
TEST_F(UnsafeAPIValidationTest, PipelineOverridableConstants) {