Commit 040e4f6f by Tobin Ehlis Committed by Commit Bot

Vulkan: Minor command buffer refactor

Fix a couple minor nits with command buffer handling in ANGLE: 1. Make initialize() common CommandBufferHelper function 2. Reduce some common code when starting renderpass Bug: b/154030403 Change-Id: Ie9cfcd7c053c8605b16bc2dee7f8d69418922492 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2175106Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com> Commit-Queue: Tobin Ehlis <tobine@google.com>
parent 10ee839c
......@@ -889,7 +889,7 @@ angle::Result ContextVk::initialize()
// Push a scope in the pool allocator so we can easily reinitialize on flush.
mPoolAllocator.push();
mOutsideRenderPassCommands.getCommandBuffer().initialize(&mPoolAllocator);
mOutsideRenderPassCommands.initialize(&mPoolAllocator);
mRenderPassCommands.initialize(&mPoolAllocator);
ANGLE_TRY(startPrimaryCommandBuffer());
......@@ -4489,6 +4489,11 @@ CommandBufferHelper::CommandBufferHelper()
CommandBufferHelper::~CommandBufferHelper() = default;
void CommandBufferHelper::initialize(angle::PoolAllocator *poolAllocator)
{
mCommandBuffer.initialize(poolAllocator);
}
void CommandBufferHelper::bufferRead(vk::ResourceUseList *resourceUseList,
VkAccessFlags readAccessType,
VkPipelineStageFlags readStage,
......@@ -4630,11 +4635,6 @@ RenderPassCommandBuffer::~RenderPassCommandBuffer()
mFramebuffer.setHandle(VK_NULL_HANDLE);
}
void RenderPassCommandBuffer::initialize(angle::PoolAllocator *poolAllocator)
{
mCommandBuffer.initialize(poolAllocator);
}
void RenderPassCommandBuffer::beginRenderPass(const vk::Framebuffer &framebuffer,
const gl::Rectangle &renderArea,
const vk::RenderPassDesc &renderPassDesc,
......@@ -4703,17 +4703,11 @@ angle::Result RenderPassCommandBuffer::flushToPrimary(ContextVk *contextVk,
// Run commands inside the RenderPass.
primary->beginRenderPass(beginInfo, VK_SUBPASS_CONTENTS_INLINE);
mCommandBuffer.executeCommands(primary->getHandle());
primary->endRenderPass();
if (mValidTransformFeedbackBufferCount == 0)
if (mValidTransformFeedbackBufferCount != 0)
{
mCommandBuffer.executeCommands(primary->getHandle());
primary->endRenderPass();
}
else
{
mCommandBuffer.executeCommands(primary->getHandle());
primary->endRenderPass();
// Would be better to accumulate this barrier using the command APIs.
// TODO: Clean thus up before we close http://anglebug.com/3206
VkBufferMemoryBarrier bufferBarrier = {};
......
......@@ -115,6 +115,8 @@ class CommandQueue final : angle::NonCopyable
struct CommandBufferHelper : angle::NonCopyable
{
public:
void initialize(angle::PoolAllocator *poolAllocator);
void bufferRead(vk::ResourceUseList *resourceUseList,
VkAccessFlags readAccessType,
VkPipelineStageFlags readStage,
......@@ -174,8 +176,6 @@ class RenderPassCommandBuffer final : public CommandBufferHelper
RenderPassCommandBuffer();
~RenderPassCommandBuffer();
void initialize(angle::PoolAllocator *poolAllocator);
void beginRenderPass(const vk::Framebuffer &framebuffer,
const gl::Rectangle &renderArea,
const vk::RenderPassDesc &renderPassDesc,
......
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