Commit 8a90378c by Jamie Madill Committed by Commit Bot

Vulkan: Remove hasPrimaryCommands().

We now create empty primary command buffers when there are no existing commands to submit. The main reason to remove this is so that we don't have to make a synchronous call to CommandQueue or the async command processor to determine if there are queued primary commands. Bug: b/172704839 Change-Id: I53f65eaa187b618e4ed82a5d2805a76e6a9e036c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2524547 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 03f3ba5b
......@@ -1228,11 +1228,7 @@ angle::Result CommandQueue::submitFrame(
CommandPool *commandPool)
{
// Start an empty primary buffer if we have an empty submit.
if (!hasPrimaryCommands())
{
ANGLE_TRY(startPrimaryCommandBuffer(context));
}
ANGLE_TRY(ensurePrimaryCommandBufferValid(context));
ANGLE_VK_TRY(context, mPrimaryCommands.end());
VkSubmitInfo submitInfo = {};
......@@ -1289,9 +1285,12 @@ Shared<Fence> CommandQueue::getLastSubmittedFence(const Context *context) const
return fence;
}
angle::Result CommandQueue::startPrimaryCommandBuffer(Context *context)
angle::Result CommandQueue::ensurePrimaryCommandBufferValid(Context *context)
{
ASSERT(!mPrimaryCommands.valid());
if (mPrimaryCommands.valid())
{
return angle::Result::Continue;
}
ANGLE_TRY(allocatePrimaryCommandBuffer(context, &mPrimaryCommands));
......@@ -1307,30 +1306,18 @@ angle::Result CommandQueue::startPrimaryCommandBuffer(Context *context)
angle::Result CommandQueue::flushOutsideRPCommands(Context *context,
CommandBufferHelper *outsideRPCommands)
{
if (!mPrimaryCommands.valid())
{
ANGLE_TRY(startPrimaryCommandBuffer(context));
}
ANGLE_TRY(outsideRPCommands->flushToPrimary(context->getRenderer()->getFeatures(),
&mPrimaryCommands, nullptr));
return angle::Result::Continue;
ANGLE_TRY(ensurePrimaryCommandBufferValid(context));
return outsideRPCommands->flushToPrimary(context->getRenderer()->getFeatures(),
&mPrimaryCommands, nullptr);
}
angle::Result CommandQueue::flushRenderPassCommands(Context *context,
const RenderPass &renderPass,
CommandBufferHelper *renderPassCommands)
{
if (!mPrimaryCommands.valid())
{
ANGLE_TRY(startPrimaryCommandBuffer(context));
}
ANGLE_TRY(renderPassCommands->flushToPrimary(context->getRenderer()->getFeatures(),
&mPrimaryCommands, &renderPass));
return angle::Result::Continue;
ANGLE_TRY(ensurePrimaryCommandBufferValid(context));
return renderPassCommands->flushToPrimary(context->getRenderer()->getFeatures(),
&mPrimaryCommands, &renderPass);
}
} // namespace vk
} // namespace rx
......@@ -201,16 +201,13 @@ class CommandQueue final : angle::NonCopyable
const RenderPass &renderPass,
CommandBufferHelper *renderPassCommands);
// TODO(jmadill): Remove this. b/172678125
bool hasPrimaryCommands() const { return mPrimaryCommands.valid(); }
private:
angle::Result releaseToCommandBatch(Context *context,
PrimaryCommandBuffer &&commandBuffer,
CommandPool *commandPool,
CommandBatch *batch);
angle::Result retireFinishedCommands(Context *context, size_t finishedCount);
angle::Result startPrimaryCommandBuffer(Context *context);
angle::Result ensurePrimaryCommandBufferValid(Context *context);
angle::Result allocatePrimaryCommandBuffer(Context *context,
PrimaryCommandBuffer *commandBufferOut);
angle::Result releasePrimaryCommandBuffer(Context *context,
......
......@@ -4061,20 +4061,12 @@ angle::Result ContextVk::updateActiveImages(const gl::Context *context,
bool ContextVk::hasRecordedCommands()
{
ASSERT(mOutsideRenderPassCommands && mRenderPassCommands);
return !mOutsideRenderPassCommands->empty() || mRenderPassCommands->started() ||
mCommandQueue.hasPrimaryCommands();
return !mOutsideRenderPassCommands->empty() || mRenderPassCommands->started();
}
angle::Result ContextVk::flushImpl(const vk::Semaphore *signalSemaphore)
{
bool hasPendingSemaphore = signalSemaphore || !mWaitSemaphores.empty();
if (!hasRecordedCommands() && !hasPendingSemaphore && !mGpuEventsEnabled)
{
ASSERT(!mDeferredFlushCount);
return angle::Result::Continue;
}
ANGLE_TRACE_EVENT0("gpu.angle", "ContextVk::flush");
ANGLE_TRACE_EVENT0("gpu.angle", "ContextVk::flushImpl");
// We must set this to zero before calling flushCommandsAndEndRenderPass to prevent it from
// calling back to flushImpl.
......@@ -4141,7 +4133,7 @@ angle::Result ContextVk::flushImpl(const vk::Semaphore *signalSemaphore)
angle::Result ContextVk::finishImpl()
{
ANGLE_TRACE_EVENT0("gpu.angle", "ContextVk::finish");
ANGLE_TRACE_EVENT0("gpu.angle", "ContextVk::finishImpl");
ANGLE_TRY(flushImpl(nullptr));
......
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