Fix vulkan::Buffer::TransitionUsageAndGetResourceBarrier()

Do not transition if the buffer usage is already MapWrite

Change-Id: I16cf68501e19a5b60d6c6f28eaa539df691f14fd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117240
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
Peng Huang 2023-01-17 23:40:41 +00:00 committed by Dawn LUCI CQ
parent 36c37906f3
commit 429c2f93f4
1 changed files with 4 additions and 3 deletions
src/dawn/native/vulkan

View File

@ -262,10 +262,11 @@ bool Buffer::TransitionUsageAndGetResourceBarrier(wgpu::BufferUsage usage,
VkPipelineStageFlags* srcStages,
VkPipelineStageFlags* dstStages) {
bool lastIncludesTarget = IsSubset(usage, mLastUsage);
bool lastReadOnly = IsSubset(mLastUsage, kReadOnlyBufferUsages);
constexpr wgpu::BufferUsage kReuseNoBarrierBufferUsages =
kReadOnlyBufferUsages | wgpu::BufferUsage::MapWrite;
bool lastCanBeReusedWithoutBarrier = IsSubset(mLastUsage, kReuseNoBarrierBufferUsages);
// We can skip transitions to already current read-only usages.
if (lastIncludesTarget && lastReadOnly) {
if (lastIncludesTarget && lastCanBeReusedWithoutBarrier) {
return false;
}