Commit 0aab41b7 by Jamie Madill Committed by Commit Bot

Vulkan: Make mapped memory available with graph disabled.

This copies functionality out of the command graph path. A preemptive barrier ensures we don't need to issue an availability barrier when we need to map buffer memory. Bug: angleproject:4029 Change-Id: I868ce8bdb3c452dccf35cc9e70adf81ad7905c66 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2065917 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com>
parent 166875eb
......@@ -3705,14 +3705,29 @@ angle::Result ContextVk::flushImpl(const vk::Semaphore *signalSemaphore)
mOutsideRenderPassCommands.flushToPrimary(&mPrimaryCommands);
ANGLE_TRY(endRenderPass());
if (mIsAnyHostVisibleBufferWritten)
{
// Make sure all writes to host-visible buffers are flushed. We have no way of knowing
// whether any buffer will be mapped for readback in the future, and we can't afford to
// flush and wait on a one-pipeline-barrier command buffer on every map().
VkMemoryBarrier memoryBarrier = {};
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
memoryBarrier.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT;
memoryBarrier.dstAccessMask = VK_ACCESS_HOST_READ_BIT;
mPrimaryCommands.memoryBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_HOST_BIT, &memoryBarrier);
mIsAnyHostVisibleBufferWritten = false;
}
ANGLE_VK_TRY(this, mPrimaryCommands.end());
// Free secondary command pool allocations and restart command buffers with the new page.
mPoolAllocator.pop();
mPoolAllocator.push();
mOutsideRenderPassCommands.reset();
mRenderPassCommands.reset();
ANGLE_VK_TRY(this, mPrimaryCommands.end());
Serial serial = getCurrentQueueSerial();
mResourceUseList.releaseResourceUsesAndUpdateSerials(serial);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment