Commit 3d17084d by Jamie Madill Committed by Commit Bot

Vulkan: Simpify check for started RenderPass + FB.

We can check the RenderPass CB helper directly instead of caching a separate variable. Bug: angleproject:4911 Change-Id: Ic953c101c64fd5142e2dedfd06e3fea287331fd4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2341761Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarCharlie Lao <cclao@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 8956bfb9
......@@ -650,7 +650,6 @@ ContextVk::ContextVk(const gl::State &state, gl::ErrorSet *errorSet, RendererVk
mUseOldRewriteStructSamplers(false),
mOutsideRenderPassCommands(nullptr),
mRenderPassCommands(nullptr),
mRenderPassFramebuffer(VK_NULL_HANDLE),
mHasPrimaryCommands(false),
mGpuEventsEnabled(false),
mGpuClockSync{std::numeric_limits<double>::max(), std::numeric_limits<double>::max()},
......@@ -1649,8 +1648,6 @@ angle::Result ContextVk::submitFrame(const VkSubmitInfo &submitInfo,
ANGLE_TRY(mCommandQueue.submitFrame(this, mContextPriority, submitInfo, mSubmitFence,
&mCurrentGarbage, &mCommandPool, std::move(commandBuffer)));
// we need to explicitly notify every other Context using this VkQueue that their current
// command buffer is no longer valid.
onRenderPassFinished();
mComputeDirtyBits |= mNewComputeCommandBufferDirtyBits;
......@@ -4411,7 +4408,6 @@ angle::Result ContextVk::flushAndBeginRenderPass(
mRenderPassCommands->beginRenderPass(framebuffer, renderArea, renderPassDesc,
renderPassAttachmentOps, depthStencilAttachmentIndex,
clearValues, commandBufferOut);
mRenderPassFramebuffer = framebuffer.getHandle();
return angle::Result::Continue;
}
......
......@@ -454,11 +454,6 @@ class ContextVk : public ContextImpl, public vk::Context
}
RenderPassCache &getRenderPassCache() { return mRenderPassCache; }
bool isCurrentRenderPassOfFramebuffer(vk::Framebuffer *framebuffer)
{
return mRenderPassFramebuffer != VK_NULL_HANDLE && framebuffer != nullptr &&
mRenderPassFramebuffer == framebuffer->getHandle();
}
vk::DescriptorSetLayoutDesc getDriverUniformsDescriptorSetDesc(
VkShaderStageFlags shaderStages) const;
......@@ -538,10 +533,22 @@ class ContextVk : public ContextImpl, public vk::Context
const vk::ClearValuesArray &clearValues,
vk::CommandBuffer **commandBufferOut);
bool hasStartedRenderPass() const { return mRenderPassCommands->started(); }
// Only returns true if we have a started RP and we've run setupDraw.
bool hasStartedRenderPass() const
{
// Checking mRenderPassCommandBuffer ensures we've called setupDraw.
return mRenderPassCommandBuffer && mRenderPassCommands->started();
}
bool hasStartedRenderPassWithFramebuffer(vk::Framebuffer *framebuffer)
{
return hasStartedRenderPass() &&
mRenderPassCommands->getFramebufferHandle() == framebuffer->getHandle();
}
bool hasStartedRenderPassWithCommands() const
{
return mRenderPassCommands->started() && !mRenderPassCommands->getCommandBuffer().empty();
return hasStartedRenderPass() && !mRenderPassCommands->getCommandBuffer().empty();
}
vk::CommandBufferHelper &getStartedRenderPassCommands()
......@@ -861,11 +868,7 @@ class ContextVk : public ContextImpl, public vk::Context
angle::Result flushOutsideRenderPassCommands();
void flushDescriptorSetUpdates();
ANGLE_INLINE void onRenderPassFinished()
{
mRenderPassCommandBuffer = nullptr;
mRenderPassFramebuffer = VK_NULL_HANDLE;
}
ANGLE_INLINE void onRenderPassFinished() { mRenderPassCommandBuffer = nullptr; }
angle::Result onBufferRead(VkAccessFlags readAccessType,
vk::PipelineStage readStage,
......@@ -1021,7 +1024,6 @@ class ContextVk : public ContextImpl, public vk::Context
vk::CommandBufferHelper *mOutsideRenderPassCommands;
vk::CommandBufferHelper *mRenderPassCommands;
VkFramebuffer mRenderPassFramebuffer;
vk::PrimaryCommandBuffer mPrimaryCommands;
// Function recycleCommandBuffer() is public above
bool mHasPrimaryCommands;
......
......@@ -464,11 +464,11 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
{
vk::Framebuffer *currentFramebuffer = nullptr;
ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer));
bool framebufferIsCurrent = contextVk->isCurrentRenderPassOfFramebuffer(currentFramebuffer);
// If we are in an active renderpass that has recorded commands and the framebuffer hasn't
// changed, inline the clear
if (contextVk->hasStartedRenderPassWithCommands() && framebufferIsCurrent)
if (contextVk->hasStartedRenderPassWithCommands() &&
contextVk->hasStartedRenderPassWithFramebuffer(currentFramebuffer))
{
// Have active renderpass, add inline clear
gl::DrawBufferMask clearBuffersWithInlineClear;
......@@ -1364,8 +1364,7 @@ angle::Result FramebufferVk::invalidateImpl(ContextVk *contextVk,
vk::Framebuffer *currentFramebuffer = nullptr;
ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer));
if (contextVk->hasStartedRenderPass() &&
contextVk->isCurrentRenderPassOfFramebuffer(currentFramebuffer))
if (contextVk->hasStartedRenderPassWithFramebuffer(currentFramebuffer))
{
// Set the appropriate storeOp for attachments.
size_t attachmentIndexVk = 0;
......
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