Commit 09dad082 by Charlie Lao Committed by Commit Bot

Vulkan: Add feature flag to flush at framebuffer boundary

Testing shows most app traces seeing performance improved on ARM GPU when we flush at FBO boundary instead of one submit per frame. This likely due to more frequent submission means less chance of GPU starvation. This also helps ANGLE to detect GPU finish at finer grain since the queue serial is per submission. Finer grain detection of object completion means memory gets recycled quicker and mapBufferRange able to hit fast code path more often. With this CL, manhattan 3.1 offscreen score also score improves 7%. This may also helps onscreen performance if frame time is on the edge of 16ms by submit FBO rendering earlier instead of been blocked by vkAcquireNextImage. Bug: b/187993625 Bug: angleproject:5295 Change-Id: I2946a7159231d36019ace89805a69ac8e906ce94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2888709Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Commit-Queue: Charlie Lao <cclao@google.com>
parent 6f35e366
...@@ -515,6 +515,12 @@ struct FeaturesVk : FeatureSetBase ...@@ -515,6 +515,12 @@ struct FeaturesVk : FeatureSetBase
"forceFragmentShaderPrecisionHighpToMediump", FeatureCategory::VulkanWorkarounds, "forceFragmentShaderPrecisionHighpToMediump", FeatureCategory::VulkanWorkarounds,
"Forces highp precision in fragment shader to mediump.", &members, "Forces highp precision in fragment shader to mediump.", &members,
"https://issuetracker.google.com/184850002"}; "https://issuetracker.google.com/184850002"};
// Whether we should submit at each FBO boundary.
Feature preferSubmitAtFBOBoundary = {
"preferSubmitAtFBOBoundary", FeatureCategory::VulkanWorkarounds,
"Submit commands to driver at each FBO boundary for performance improvements.", &members,
"https://issuetracker.google.com/187425444"};
}; };
inline FeaturesVk::FeaturesVk() = default; inline FeaturesVk::FeaturesVk() = default;
......
...@@ -3477,7 +3477,12 @@ angle::Result ContextVk::syncState(const gl::Context *context, ...@@ -3477,7 +3477,12 @@ angle::Result ContextVk::syncState(const gl::Context *context,
// open, such as invalidate or blit. Note that we always start a new command buffer // open, such as invalidate or blit. Note that we always start a new command buffer
// because we currently can only support one open RenderPass at a time. // because we currently can only support one open RenderPass at a time.
onRenderPassFinished(); onRenderPassFinished();
if (mRenderer->getFeatures().preferSubmitAtFBOBoundary.enabled)
{
// This will behave as if user called glFlush, but the actual flush will be
// triggered at endRenderPass time.
mHasDeferredFlush = true;
}
gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer(); gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
mDrawFramebuffer = vk::GetImpl(drawFramebuffer); mDrawFramebuffer = vk::GetImpl(drawFramebuffer);
mDrawFramebuffer->setReadOnlyDepthFeedbackLoopMode(false); mDrawFramebuffer->setReadOnlyDepthFeedbackLoopMode(false);
......
...@@ -2438,6 +2438,11 @@ void RendererVk::initFeatures(DisplayVk *displayVk, ...@@ -2438,6 +2438,11 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
// tests to fail. // tests to fail.
ANGLE_FEATURE_CONDITION(&mFeatures, forceFragmentShaderPrecisionHighpToMediump, false); ANGLE_FEATURE_CONDITION(&mFeatures, forceFragmentShaderPrecisionHighpToMediump, false);
// Testing shows that on ARM GPU, doing implicit flush at framebuffer boundary improves
// performance. Most app traces shows frame time reduced and manhattan 3.1 offscreen score
// improves 7%.
ANGLE_FEATURE_CONDITION(&mFeatures, preferSubmitAtFBOBoundary, isARM);
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