Commit 6b924160 by Charlie Lao Committed by Commit Bot

Vulkan: Split barriers into multiple calls to ensure no extra dependency

gets introduced This tracks barriers in an array based on dstPipelineStage. Bug: b/155341891 Change-Id: Icba2ef81530edcdb9ae363b00f0e7b9efe93d48f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2188955Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
parent fa507296
......@@ -623,14 +623,15 @@ class PipelineBarrier : angle::NonCopyable
}
// merge two barriers into one
void merge(const PipelineBarrier &other)
void merge(PipelineBarrier *other)
{
mSrcStageMask |= other.mSrcStageMask;
mDstStageMask |= other.mDstStageMask;
mMemoryBarrierSrcAccess |= other.mMemoryBarrierSrcAccess;
mMemoryBarrierDstAccess |= other.mMemoryBarrierDstAccess;
mImageMemoryBarriers.insert(mImageMemoryBarriers.end(), other.mImageMemoryBarriers.begin(),
other.mImageMemoryBarriers.end());
mSrcStageMask |= other->mSrcStageMask;
mDstStageMask |= other->mDstStageMask;
mMemoryBarrierSrcAccess |= other->mMemoryBarrierSrcAccess;
mMemoryBarrierDstAccess |= other->mMemoryBarrierDstAccess;
mImageMemoryBarriers.insert(mImageMemoryBarriers.end(), other->mImageMemoryBarriers.begin(),
other->mImageMemoryBarriers.end());
other->reset();
}
void mergeMemoryBarrier(VkPipelineStageFlags srcStageMask,
......@@ -775,11 +776,11 @@ class BufferHelper final : public Resource
bool canAccumulateRead(ContextVk *contextVk, VkAccessFlags readAccessType);
bool canAccumulateWrite(ContextVk *contextVk, VkAccessFlags writeAccessType);
void updateReadBarrier(VkAccessFlags readAccessType,
bool updateReadBarrier(VkAccessFlags readAccessType,
VkPipelineStageFlags readStage,
PipelineBarrier *barrier);
void updateWriteBarrier(VkAccessFlags writeAccessType,
bool updateWriteBarrier(VkAccessFlags writeAccessType,
VkPipelineStageFlags writeStage,
PipelineBarrier *barrier);
......@@ -842,10 +843,6 @@ struct CommandBufferHelper : angle::NonCopyable
vk::ImageLayout imageLayout,
vk::ImageHelper *image);
void imageBarrier(VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
const VkImageMemoryBarrier &imageMemoryBarrier);
vk::CommandBuffer &getCommandBuffer() { return mCommandBuffer; }
angle::Result flushToPrimary(ContextVk *contextVk, vk::PrimaryCommandBuffer *primary);
......@@ -929,7 +926,8 @@ struct CommandBufferHelper : angle::NonCopyable
void addCommandDiagnostics(ContextVk *contextVk);
// General state (non-renderPass related)
vk::PipelineBarrier mPipelineBarrier;
PipelineBarrierArray mPipelineBarriers;
PipelineStagesMask mPipelineBarrierMask;
vk::CommandBuffer mCommandBuffer;
// RenderPass state
......@@ -1278,6 +1276,10 @@ class ImageHelper final : public Resource, public angle::Subject
uint32_t newQueueFamilyIndex,
CommandBuffer *commandBuffer);
void updateLayoutAndBarrier(VkImageAspectFlags aspectMask,
ImageLayout newLayout,
PipelineBarrier *barrier);
// Performs an ownership transfer from an external instance or API.
void acquireFromExternal(ContextVk *contextVk,
uint32_t externalQueueFamilyIndex,
......@@ -1402,6 +1404,11 @@ class ImageHelper final : public Resource, public angle::Subject
};
};
void initImageMemoryBarrierStruct(VkImageAspectFlags aspectMask,
ImageLayout newLayout,
uint32_t newQueueFamilyIndex,
VkImageMemoryBarrier *imageMemoryBarrier) const;
// Generalized to accept both "primary" and "secondary" command buffers.
template <typename CommandBufferT>
void forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask,
......
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