Commit dae77893 by Charlie Lao Committed by Commit Bot

Vulkan: Avoid clearWithClearAttachment if RP command buffer is empty

If renderpass has started but no command has been issued, we should chose to use loadOp to do clear instead of clearWithClearAttachment. Bug: b/162521656 Change-Id: Ia681fc96442c7916b4b92c48e970d9ed239a28c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2330225 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com>
parent 9b1cab0d
...@@ -529,6 +529,10 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -529,6 +529,10 @@ class ContextVk : public ContextImpl, public vk::Context
vk::CommandBuffer **commandBufferOut); vk::CommandBuffer **commandBufferOut);
bool hasStartedRenderPass() const { return mRenderPassCommands->started(); } bool hasStartedRenderPass() const { return mRenderPassCommands->started(); }
bool hasStartedRenderPassWithCommands() const
{
return mRenderPassCommands->started() && !mRenderPassCommands->getCommandBuffer().empty();
}
vk::CommandBufferHelper &getStartedRenderPassCommands() vk::CommandBufferHelper &getStartedRenderPassCommands()
{ {
......
...@@ -384,8 +384,9 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -384,8 +384,9 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer)); ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer));
bool framebufferIsCurrent = contextVk->isCurrentRenderPassOfFramebuffer(currentFramebuffer); bool framebufferIsCurrent = contextVk->isCurrentRenderPassOfFramebuffer(currentFramebuffer);
// If we are in an active renderpass and the framebuffer hasn't changed, inline the clear // If we are in an active renderpass that has recorded commands and the framebuffer hasn't
if (contextVk->hasStartedRenderPass() && framebufferIsCurrent) // changed, inline the clear
if (contextVk->hasStartedRenderPassWithCommands() && framebufferIsCurrent)
{ {
// Have active renderpass, add inline clear // Have active renderpass, add inline clear
gl::DrawBufferMask clearBuffersWithInlineClear; gl::DrawBufferMask clearBuffersWithInlineClear;
......
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