Vulkan: Fix buffer barriers for readonly storage.

Some of the helper methods to compute buffer barriers didn't handle the
kReadOnlyStorage usage, which made barriers issued too small.

Issue was caught by running the GpuMemorySynchronizationTests with the
Vulkan barrier validation enabled.

Bug: dawn:635
Change-Id: Ice76edd21b2fa1c25cf9922418f65cfa7d802bdb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38100
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-01-20 19:29:38 +00:00 committed by Commit Bot service account
parent f83df90fae
commit 40422659d4
1 changed files with 4 additions and 1 deletions

View File

@ -45,7 +45,7 @@ namespace dawn_native { namespace vulkan {
if (usage & wgpu::BufferUsage::Uniform) {
flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
}
if (usage & wgpu::BufferUsage::Storage) {
if (usage & (wgpu::BufferUsage::Storage | kReadOnlyStorageBuffer)) {
flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
if (usage & wgpu::BufferUsage::Indirect) {
@ -116,6 +116,9 @@ namespace dawn_native { namespace vulkan {
if (usage & wgpu::BufferUsage::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
if (usage & kReadOnlyStorageBuffer) {
flags |= VK_ACCESS_SHADER_READ_BIT;
}
if (usage & wgpu::BufferUsage::Indirect) {
flags |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
}