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 ...@@ -623,14 +623,15 @@ class PipelineBarrier : angle::NonCopyable
} }
// merge two barriers into one // merge two barriers into one
void merge(const PipelineBarrier &other) void merge(PipelineBarrier *other)
{ {
mSrcStageMask |= other.mSrcStageMask; mSrcStageMask |= other->mSrcStageMask;
mDstStageMask |= other.mDstStageMask; mDstStageMask |= other->mDstStageMask;
mMemoryBarrierSrcAccess |= other.mMemoryBarrierSrcAccess; mMemoryBarrierSrcAccess |= other->mMemoryBarrierSrcAccess;
mMemoryBarrierDstAccess |= other.mMemoryBarrierDstAccess; mMemoryBarrierDstAccess |= other->mMemoryBarrierDstAccess;
mImageMemoryBarriers.insert(mImageMemoryBarriers.end(), other.mImageMemoryBarriers.begin(), mImageMemoryBarriers.insert(mImageMemoryBarriers.end(), other->mImageMemoryBarriers.begin(),
other.mImageMemoryBarriers.end()); other->mImageMemoryBarriers.end());
other->reset();
} }
void mergeMemoryBarrier(VkPipelineStageFlags srcStageMask, void mergeMemoryBarrier(VkPipelineStageFlags srcStageMask,
...@@ -775,11 +776,11 @@ class BufferHelper final : public Resource ...@@ -775,11 +776,11 @@ class BufferHelper final : public Resource
bool canAccumulateRead(ContextVk *contextVk, VkAccessFlags readAccessType); bool canAccumulateRead(ContextVk *contextVk, VkAccessFlags readAccessType);
bool canAccumulateWrite(ContextVk *contextVk, VkAccessFlags writeAccessType); bool canAccumulateWrite(ContextVk *contextVk, VkAccessFlags writeAccessType);
void updateReadBarrier(VkAccessFlags readAccessType, bool updateReadBarrier(VkAccessFlags readAccessType,
VkPipelineStageFlags readStage, VkPipelineStageFlags readStage,
PipelineBarrier *barrier); PipelineBarrier *barrier);
void updateWriteBarrier(VkAccessFlags writeAccessType, bool updateWriteBarrier(VkAccessFlags writeAccessType,
VkPipelineStageFlags writeStage, VkPipelineStageFlags writeStage,
PipelineBarrier *barrier); PipelineBarrier *barrier);
...@@ -842,10 +843,6 @@ struct CommandBufferHelper : angle::NonCopyable ...@@ -842,10 +843,6 @@ struct CommandBufferHelper : angle::NonCopyable
vk::ImageLayout imageLayout, vk::ImageLayout imageLayout,
vk::ImageHelper *image); vk::ImageHelper *image);
void imageBarrier(VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
const VkImageMemoryBarrier &imageMemoryBarrier);
vk::CommandBuffer &getCommandBuffer() { return mCommandBuffer; } vk::CommandBuffer &getCommandBuffer() { return mCommandBuffer; }
angle::Result flushToPrimary(ContextVk *contextVk, vk::PrimaryCommandBuffer *primary); angle::Result flushToPrimary(ContextVk *contextVk, vk::PrimaryCommandBuffer *primary);
...@@ -929,7 +926,8 @@ struct CommandBufferHelper : angle::NonCopyable ...@@ -929,7 +926,8 @@ struct CommandBufferHelper : angle::NonCopyable
void addCommandDiagnostics(ContextVk *contextVk); void addCommandDiagnostics(ContextVk *contextVk);
// General state (non-renderPass related) // General state (non-renderPass related)
vk::PipelineBarrier mPipelineBarrier; PipelineBarrierArray mPipelineBarriers;
PipelineStagesMask mPipelineBarrierMask;
vk::CommandBuffer mCommandBuffer; vk::CommandBuffer mCommandBuffer;
// RenderPass state // RenderPass state
...@@ -1278,6 +1276,10 @@ class ImageHelper final : public Resource, public angle::Subject ...@@ -1278,6 +1276,10 @@ class ImageHelper final : public Resource, public angle::Subject
uint32_t newQueueFamilyIndex, uint32_t newQueueFamilyIndex,
CommandBuffer *commandBuffer); CommandBuffer *commandBuffer);
void updateLayoutAndBarrier(VkImageAspectFlags aspectMask,
ImageLayout newLayout,
PipelineBarrier *barrier);
// Performs an ownership transfer from an external instance or API. // Performs an ownership transfer from an external instance or API.
void acquireFromExternal(ContextVk *contextVk, void acquireFromExternal(ContextVk *contextVk,
uint32_t externalQueueFamilyIndex, uint32_t externalQueueFamilyIndex,
...@@ -1402,6 +1404,11 @@ class ImageHelper final : public Resource, public angle::Subject ...@@ -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. // Generalized to accept both "primary" and "secondary" command buffers.
template <typename CommandBufferT> template <typename CommandBufferT>
void forceChangeLayoutAndQueue(VkImageAspectFlags aspectMask, 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