Commit 54a3d7cb by Charlie Lao Committed by Commit Bot

Vulkan: Use DontCare for the presentable surface's last renderpass depth/stencil storeOp

The EGL spec says depth/stencil value are undefined after swap. We dont need to store depth/stencil value if this is the very last renderpass of a presentable surface and the endRenderpass call is from swap call. Bug: b/153885625 Change-Id: Ie853d2686c8eb15a4fa9dbdd80eb66e9fc037d24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2157886Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
parent 39efa4df
...@@ -2380,6 +2380,17 @@ void ContextVk::optimizeRenderPassForPresent(VkFramebuffer framebufferHandle) ...@@ -2380,6 +2380,17 @@ void ContextVk::optimizeRenderPassForPresent(VkFramebuffer framebufferHandle)
return; return;
} }
// EGL1.5 spec: The contents of ancillary buffers are always undefined after calling
// eglSwapBuffers
RenderTargetVk *depthStencilRenderTarget = mDrawFramebuffer->getDepthStencilRenderTarget();
if (depthStencilRenderTarget)
{
size_t depthStencilAttachmentIndexVk = mDrawFramebuffer->getDepthStencilAttachmentIndexVk();
// Change depthstencil attachment storeOp to DONT_CARE
mRenderPassCommands.invalidateRenderPassStencilAttachment(depthStencilAttachmentIndexVk);
mRenderPassCommands.invalidateRenderPassDepthAttachment(depthStencilAttachmentIndexVk);
}
// Use finalLayout instead of extra barrier for layout change to present // Use finalLayout instead of extra barrier for layout change to present
vk::ImageHelper &image = color0RenderTarget->getImage(); vk::ImageHelper &image = color0RenderTarget->getImage();
image.setCurrentImageLayout(vk::ImageLayout::Present); image.setCurrentImageLayout(vk::ImageLayout::Present);
......
...@@ -119,6 +119,12 @@ class FramebufferVk : public FramebufferImpl ...@@ -119,6 +119,12 @@ class FramebufferVk : public FramebufferImpl
const vk::RenderPassDesc &getRenderPassDesc() const { return mRenderPassDesc; } const vk::RenderPassDesc &getRenderPassDesc() const { return mRenderPassDesc; }
const vk::FramebufferDesc &getFramebufferDesc() const { return mCurrentFramebufferDesc; } const vk::FramebufferDesc &getFramebufferDesc() const { return mCurrentFramebufferDesc; }
// We only support depth/stencil packed format and depthstencil attachment always follow all
// color attachments
size_t getDepthStencilAttachmentIndexVk() const
{
return getState().getEnabledDrawBuffers().count();
}
private: private:
FramebufferVk(RendererVk *renderer, FramebufferVk(RendererVk *renderer,
......
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