Commit 01641c7a by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Fix UtilsVk clear in non-zero subpass

Mid-render-pass clears (through UtilsVk) run on the current subpass, which in the presence of multisampled-render-to-texture unresolve would be subpass 1. The graphics pipeline for that draw call should set the correct subpass index. Bug: angleproject:4836 Change-Id: Iba4a03ea96a63b0f5d09c27e5283ff8a8b534e05 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2441509 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 6534a6f8
...@@ -4687,6 +4687,11 @@ void ContextVk::restoreFinishedRenderPass(vk::Framebuffer *framebuffer) ...@@ -4687,6 +4687,11 @@ void ContextVk::restoreFinishedRenderPass(vk::Framebuffer *framebuffer)
} }
} }
uint32_t ContextVk::getCurrentSubpassIndex() const
{
return mGraphicsPipelineDesc->getSubpass();
}
angle::Result ContextVk::flushCommandsAndEndRenderPass() angle::Result ContextVk::flushCommandsAndEndRenderPass()
{ {
// Ensure we flush the RenderPass *after* the prior commands. // Ensure we flush the RenderPass *after* the prior commands.
......
...@@ -593,6 +593,8 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -593,6 +593,8 @@ class ContextVk : public ContextImpl, public vk::Context
// TODO(https://anglebug.com/4968): Support multiple open render passes. // TODO(https://anglebug.com/4968): Support multiple open render passes.
void restoreFinishedRenderPass(vk::Framebuffer *framebuffer); void restoreFinishedRenderPass(vk::Framebuffer *framebuffer);
uint32_t getCurrentSubpassIndex() const;
egl::ContextPriority getContextPriority() const override { return mContextPriority; } egl::ContextPriority getContextPriority() const override { return mContextPriority; }
angle::Result startRenderPass(gl::Rectangle renderArea, vk::CommandBuffer **commandBufferOut); angle::Result startRenderPass(gl::Rectangle renderArea, vk::CommandBuffer **commandBufferOut);
void startNextSubpass(); void startNextSubpass();
......
...@@ -1429,6 +1429,9 @@ angle::Result UtilsVk::clearFramebuffer(ContextVk *contextVk, ...@@ -1429,6 +1429,9 @@ angle::Result UtilsVk::clearFramebuffer(ContextVk *contextVk,
// Note: depth test is disabled by default so this should be unnecessary, but works around an // Note: depth test is disabled by default so this should be unnecessary, but works around an
// Intel bug on windows. http://anglebug.com/3348 // Intel bug on windows. http://anglebug.com/3348
pipelineDesc.setDepthWriteEnabled(false); pipelineDesc.setDepthWriteEnabled(false);
// Clears can be done on a currently open render pass, so make sure the correct subpass index is
// used.
pipelineDesc.setSubpass(contextVk->getCurrentSubpassIndex());
// Clear stencil by enabling stencil write with the right mask. // Clear stencil by enabling stencil write with the right mask.
if (params.clearStencil) if (params.clearStencil)
......
...@@ -2228,6 +2228,16 @@ void GraphicsPipelineDesc::nextSubpass(GraphicsPipelineTransitionBits *transitio ...@@ -2228,6 +2228,16 @@ void GraphicsPipelineDesc::nextSubpass(GraphicsPipelineTransitionBits *transitio
updateSubpass(transition, mRasterizationAndMultisampleStateInfo.bits.subpass + 1); updateSubpass(transition, mRasterizationAndMultisampleStateInfo.bits.subpass + 1);
} }
void GraphicsPipelineDesc::setSubpass(uint32_t subpass)
{
SetBitField(mRasterizationAndMultisampleStateInfo.bits.subpass, subpass);
}
uint32_t GraphicsPipelineDesc::getSubpass() const
{
return mRasterizationAndMultisampleStateInfo.bits.subpass;
}
void GraphicsPipelineDesc::updateRenderPassDesc(GraphicsPipelineTransitionBits *transition, void GraphicsPipelineDesc::updateRenderPassDesc(GraphicsPipelineTransitionBits *transition,
const RenderPassDesc &renderPassDesc) const RenderPassDesc &renderPassDesc)
{ {
......
...@@ -670,6 +670,8 @@ class GraphicsPipelineDesc final ...@@ -670,6 +670,8 @@ class GraphicsPipelineDesc final
// Subpass // Subpass
void resetSubpass(GraphicsPipelineTransitionBits *transition); void resetSubpass(GraphicsPipelineTransitionBits *transition);
void nextSubpass(GraphicsPipelineTransitionBits *transition); void nextSubpass(GraphicsPipelineTransitionBits *transition);
void setSubpass(uint32_t subpass);
uint32_t getSubpass() const;
private: private:
void updateSubpass(GraphicsPipelineTransitionBits *transition, uint32_t subpass); void updateSubpass(GraphicsPipelineTransitionBits *transition, uint32_t subpass);
......
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