Commit 8836f631 by Luc Ferron Committed by Commit Bot

Vulkan: Bugfix in depth/stencil clearing

In the situation when we try to clear the depth OR the stencil buffer but we have a packed depth/stencil attachment, we were still clearing both of them since Vulkan doesn't allow setting just the depth or the stencil image aspect bit on the clear call. The workaround is to use the vkCmdClearAttachments command that allows us to clear one or the other easily. Bug: angleproject:2443 Change-Id: I6814e1927c019d9ec9255d79c6bc7b913a8c99e9 Reviewed-on: https://chromium-review.googlesource.com/997752 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 4002e92a
...@@ -134,7 +134,14 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask) ...@@ -134,7 +134,14 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
bool clearColor = IsMaskFlagSet(static_cast<int>(mask), GL_COLOR_BUFFER_BIT); bool clearColor = IsMaskFlagSet(static_cast<int>(mask), GL_COLOR_BUFFER_BIT);
if (context->getGLState().isScissorTestEnabled()) const gl::FramebufferAttachment *depthStencilAttachment = mState.getDepthStencilAttachment();
// If we clear the depth OR the stencil but not both, and we have a packed depth stencil
// attachment, we need to use clearAttachment instead of clearDepthStencil since Vulkan won't
// allow us to clear one or the other separately.
bool isSingleClearOnPackedDepthStencilAttachment =
depthStencilAttachment && (clearDepth != clearStencil);
if (context->getGLState().isScissorTestEnabled() || isSingleClearOnPackedDepthStencilAttachment)
{ {
// With scissor test enabled, we clear very differently and we don't need to access // With scissor test enabled, we clear very differently and we don't need to access
// the image inside each attachment we can just use clearCmdAttachments with our // the image inside each attachment we can just use clearCmdAttachments with our
...@@ -153,7 +160,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask) ...@@ -153,7 +160,7 @@ gl::Error FramebufferVk::clear(const gl::Context *context, GLbitfield mask)
contextVk->getClearDepthStencilValue().depthStencil; contextVk->getClearDepthStencilValue().depthStencil;
// We only support packed depth/stencil, not separate. // We only support packed depth/stencil, not separate.
ASSERT(!(clearDepth && clearStencil) || mState.getDepthStencilAttachment()); ASSERT(!(clearDepth && clearStencil) || depthStencilAttachment);
const VkImageAspectFlags aspectFlags = const VkImageAspectFlags aspectFlags =
(depthAttachment ? VK_IMAGE_ASPECT_DEPTH_BIT : 0) | (depthAttachment ? VK_IMAGE_ASPECT_DEPTH_BIT : 0) |
......
...@@ -193,7 +193,6 @@ ...@@ -193,7 +193,6 @@
2161 VULKAN : dEQP-GLES2.functional.color_clear.long_masked_* = SKIP 2161 VULKAN : dEQP-GLES2.functional.color_clear.long_masked_* = SKIP
2161 VULKAN : dEQP-GLES2.functional.prerequisite.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.prerequisite.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.implementation_limits.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.implementation_limits.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.depth_stencil_clear.depth_stencil = SKIP
2161 VULKAN : dEQP-GLES2.functional.buffer.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.buffer.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.light_amount.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.light_amount.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP
......
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