Commit 47c8ea3f by Jamie Madill Committed by Commit Bot

Vulkan: Fix looped clears.

These were broken by command re-ordering. The first problem was that the Framebuffer RenderNode was not correctly being flagged as dirty. This is fixed by keeping a serial instead of a bool to track the RenderNode's cleanliness. The second issue was that an image layout transition was being set with incorrect bits. Fix this by using the correct access mask. This fixes angle_perftests's Vulkan render test. Bug: angleproject:2264 Bug: chromium:798866 Change-Id: I268b0f7aeb2c5e22892f6ef59dec62391b30bfb4 Reviewed-on: https://chromium-review.googlesource.com/848539Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 6df487ef
......@@ -61,7 +61,7 @@ FramebufferVk::FramebufferVk(const gl::FramebufferState &state)
mBackbuffer(nullptr),
mRenderPassDesc(),
mFramebuffer(),
mRenderNodeDirty(false)
mLastRenderNodeSerial()
{
}
......@@ -70,7 +70,7 @@ FramebufferVk::FramebufferVk(const gl::FramebufferState &state, WindowSurfaceVk
mBackbuffer(backbuffer),
mRenderPassDesc(),
mFramebuffer(),
mRenderNodeDirty(false)
mLastRenderNodeSerial()
{
}
......@@ -161,8 +161,11 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
{
RenderTargetVk *renderTarget = nullptr;
ANGLE_TRY(colorAttachment.getRenderTarget(context, &renderTarget));
renderTarget->image->changeLayoutTop(
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, commandBuffer);
renderTarget->image->changeLayoutWithStages(
VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer);
commandBuffer->clearSingleColorImage(*renderTarget->image, clearColorValue);
}
}
......@@ -348,7 +351,7 @@ void FramebufferVk::syncState(const gl::Context *context,
renderer->releaseResource(*this, &mFramebuffer);
// Trigger a new set of secondary commands next time we render to this FBO,.
mRenderNodeDirty = true;
mLastRenderNodeSerial = Serial();
// TODO(jmadill): Use pipeline cache.
contextVk->invalidateCurrentPipeline();
......@@ -471,7 +474,7 @@ gl::Error FramebufferVk::getRenderNode(const gl::Context *context, vk::CommandBu
RendererVk *renderer = contextVk->getRenderer();
Serial currentSerial = renderer->getCurrentQueueSerial();
if (isCurrentlyRecording(currentSerial) && !mRenderNodeDirty)
if (isCurrentlyRecording(currentSerial) && mLastRenderNodeSerial == currentSerial)
{
*nodeOut = getCurrentWriteNode(currentSerial);
ASSERT((*nodeOut)->getInsideRenderPassCommands()->valid());
......@@ -527,7 +530,7 @@ gl::Error FramebufferVk::getRenderNode(const gl::Context *context, vk::CommandBu
node->appendDepthStencilRenderTarget(currentSerial, renderTarget);
}
mRenderNodeDirty = false;
mLastRenderNodeSerial = currentSerial;
*nodeOut = node;
return gl::NoError();
......
......@@ -98,7 +98,7 @@ class FramebufferVk : public FramebufferImpl, public ResourceVk
Optional<vk::RenderPassDesc> mRenderPassDesc;
vk::Framebuffer mFramebuffer;
bool mRenderNodeDirty;
Serial mLastRenderNodeSerial;
};
} // namespace rx
......
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