Commit a3b16c6b by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Workaround vkCmdClearAttachment bug on Pixel

Adds a workaround to use draw calls to clear color instead of vkCmdClearAttachment when the clear happens in the middle of render pass. On Pixel phones, vkCmdClearAttachment races with the previous draw calls in the render pass. Bug: b/166809097 Change-Id: I8c96b87793da191757635658ad4ee2c3a7875aca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2382416 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 5173a8e1
...@@ -429,6 +429,14 @@ struct FeaturesVk : FeatureSetBase ...@@ -429,6 +429,14 @@ struct FeaturesVk : FeatureSetBase
"Compress vertex data to smaller data types when " "Compress vertex data to smaller data types when "
"possible. Using this feature makes ANGLE non-conformant.", "possible. Using this feature makes ANGLE non-conformant.",
&members}; &members};
// Qualcomm missynchronizes vkCmdClearAttachments in the middle of render pass.
// https://issuetracker.google.com/166809097
Feature preferDrawClearOverVkCmdClearAttachments = {
"prefer_draw_clear_over_vkCmdClearAttachments", FeatureCategory::VulkanWorkarounds,
"On some hardware, clear using a draw call instead of vkCmdClearAttachments in the middle "
"of render pass due to bugs",
&members, "https://issuetracker.google.com/166809097"};
}; };
inline FeaturesVk::FeaturesVk() = default; inline FeaturesVk::FeaturesVk() = default;
......
...@@ -484,10 +484,25 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -484,10 +484,25 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
"Clear effectively discarding previous draw call results. Suggest earlier Clear " "Clear effectively discarding previous draw call results. Suggest earlier Clear "
"followed by masked color or depth/stencil draw calls instead"); "followed by masked color or depth/stencil draw calls instead");
clearWithCommand(&contextVk->getStartedRenderPassCommands().getCommandBuffer(), RendererVk *renderer = contextVk->getRenderer();
scissoredRenderArea, clearColorDrawBuffersMask, bool clearAnyWithCommand = clearAnyWithRenderPassLoadOp;
clearDepthWithRenderPassLoadOp, clearStencilWithRenderPassLoadOp,
clearColorValue, clearDepthStencilValue); // On buggy hardware, prefer to clear color with a draw call instead of
// vkCmdClearAttachments.
if (renderer->getFeatures().preferDrawClearOverVkCmdClearAttachments.enabled)
{
clearColorDrawBuffersMask.reset();
clearAnyWithCommand =
clearDepthWithRenderPassLoadOp || clearStencilWithRenderPassLoadOp;
}
if (clearAnyWithCommand)
{
clearWithCommand(&contextVk->getStartedRenderPassCommands().getCommandBuffer(),
scissoredRenderArea, clearColorDrawBuffersMask,
clearDepthWithRenderPassLoadOp, clearStencilWithRenderPassLoadOp,
clearColorValue, clearDepthStencilValue);
}
} }
else else
{ {
...@@ -497,7 +512,7 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -497,7 +512,7 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
} }
// Fallback to other methods for whatever isn't cleared here. // Fallback to other methods for whatever isn't cleared here.
if (clearColorWithRenderPassLoadOp) if (clearColorDrawBuffersMask.any())
{ {
clearColorBuffers.reset(); clearColorBuffers.reset();
clearColor = false; clearColor = false;
......
...@@ -1940,6 +1940,8 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev ...@@ -1940,6 +1940,8 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev
ANGLE_FEATURE_CONDITION(&mFeatures, compressVertexData, false); ANGLE_FEATURE_CONDITION(&mFeatures, compressVertexData, false);
ANGLE_FEATURE_CONDITION(&mFeatures, preferDrawClearOverVkCmdClearAttachments, isQualcomm);
angle::PlatformMethods *platform = ANGLEPlatformCurrent(); angle::PlatformMethods *platform = ANGLEPlatformCurrent();
platform->overrideFeaturesVk(platform, &mFeatures); platform->overrideFeaturesVk(platform, &mFeatures);
......
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