Commit cba9bbbe by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Fix resolve-with-subpass retaining resolve attachment

The temporary resolve attachment used to optimize blit was not removed from the framebuffer and render pass descriptions, resulting in subsequent draws to be resolved again. Bug: b/159903491 Change-Id: I9a9c90d25cb07ba9a25999f808b164f9085387d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2390441 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarCharlie Lao <cclao@google.com>
parent 0c25fbe3
...@@ -1239,6 +1239,14 @@ void FramebufferVk::updateColorResolveAttachment( ...@@ -1239,6 +1239,14 @@ void FramebufferVk::updateColorResolveAttachment(
mRenderPassDesc.packColorResolveAttachment(colorIndexGL); mRenderPassDesc.packColorResolveAttachment(colorIndexGL);
} }
void FramebufferVk::removeColorResolveAttachment(uint32_t colorIndexGL)
{
mCurrentFramebufferDesc.updateColorResolve(colorIndexGL,
vk::kInvalidImageViewSubresourceSerial);
mFramebuffer = nullptr;
mRenderPassDesc.removeColorResolveAttachment(colorIndexGL);
}
angle::Result FramebufferVk::resolveColorWithSubpass(ContextVk *contextVk, angle::Result FramebufferVk::resolveColorWithSubpass(ContextVk *contextVk,
const UtilsVk::BlitResolveParameters &params) const UtilsVk::BlitResolveParameters &params)
{ {
...@@ -1284,6 +1292,9 @@ angle::Result FramebufferVk::resolveColorWithSubpass(ContextVk *contextVk, ...@@ -1284,6 +1292,9 @@ angle::Result FramebufferVk::resolveColorWithSubpass(ContextVk *contextVk,
&readRenderTarget->getImageForRenderPass()); &readRenderTarget->getImageForRenderPass());
ANGLE_TRY(contextVk->flushCommandsAndEndRenderPass()); ANGLE_TRY(contextVk->flushCommandsAndEndRenderPass());
// Remove the resolve attachment from the source framebuffer.
srcFramebufferVk->removeColorResolveAttachment(readColorIndexGL);
return angle::Result::Continue; return angle::Result::Continue;
} }
......
...@@ -235,6 +235,7 @@ class FramebufferVk : public FramebufferImpl ...@@ -235,6 +235,7 @@ class FramebufferVk : public FramebufferImpl
void updateColorResolveAttachment(uint32_t colorIndexGL, void updateColorResolveAttachment(uint32_t colorIndexGL,
vk::ImageViewSubresourceSerial resolveImageViewSerial); vk::ImageViewSubresourceSerial resolveImageViewSerial);
void removeColorResolveAttachment(uint32_t colorIndexGL);
WindowSurfaceVk *mBackbuffer; WindowSurfaceVk *mBackbuffer;
......
...@@ -552,10 +552,17 @@ void RenderPassDesc::packDepthStencilAttachment(angle::FormatID formatID, Resour ...@@ -552,10 +552,17 @@ void RenderPassDesc::packDepthStencilAttachment(angle::FormatID formatID, Resour
void RenderPassDesc::packColorResolveAttachment(size_t colorIndexGL) void RenderPassDesc::packColorResolveAttachment(size_t colorIndexGL)
{ {
ASSERT(isColorAttachmentEnabled(colorIndexGL)); ASSERT(isColorAttachmentEnabled(colorIndexGL));
ASSERT(!mColorResolveAttachmentMask.test(colorIndexGL));
ASSERT(mLogSamples > 0); ASSERT(mLogSamples > 0);
mColorResolveAttachmentMask.set(colorIndexGL); mColorResolveAttachmentMask.set(colorIndexGL);
} }
void RenderPassDesc::removeColorResolveAttachment(size_t colorIndexGL)
{
ASSERT(mColorResolveAttachmentMask.test(colorIndexGL));
mColorResolveAttachmentMask.reset(colorIndexGL);
}
RenderPassDesc &RenderPassDesc::operator=(const RenderPassDesc &other) RenderPassDesc &RenderPassDesc::operator=(const RenderPassDesc &other)
{ {
memcpy(this, &other, sizeof(RenderPassDesc)); memcpy(this, &other, sizeof(RenderPassDesc));
......
...@@ -123,6 +123,9 @@ class alignas(4) RenderPassDesc final ...@@ -123,6 +123,9 @@ class alignas(4) RenderPassDesc final
void packDepthStencilAttachment(angle::FormatID angleFormatID, ResourceAccess access); void packDepthStencilAttachment(angle::FormatID angleFormatID, ResourceAccess access);
// Indicate that a color attachment should have a corresponding resolve attachment. // Indicate that a color attachment should have a corresponding resolve attachment.
void packColorResolveAttachment(size_t colorIndexGL); void packColorResolveAttachment(size_t colorIndexGL);
// Remove the resolve attachment. Used when optimizing blit through resolve attachment to
// temporarily pack a resolve attachment and then remove it.
void removeColorResolveAttachment(size_t colorIndexGL);
size_t hash() const; size_t hash() const;
......
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