Commit b17a9317 by Ian Elliott Committed by Commit Bot

Vulkan: damage rectangles must never be pre-rotated

Remove the SurfaceVk::present() code that rotated damage rectangles and the feature flag that controlled that rotation. The Vulkan specification was changed so that the rectangles provided to the VK_KHR_incremental_present extension must never be pre-rotated. The spec change requires the same behavior on all platforms (just in case), even though Android is the only platform known to support rotation. FYI: the Vulkan spec change was merge request 4442. Bug: b/182930524 Change-Id: I5128fd76e718f3d964c9091830bcc5886d265543 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2818826 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent fedb85b7
...@@ -90,16 +90,6 @@ struct FeaturesVk : FeatureSetBase ...@@ -90,16 +90,6 @@ struct FeaturesVk : FeatureSetBase
"supportsIncrementalPresent", FeatureCategory::VulkanFeatures, "supportsIncrementalPresent", FeatureCategory::VulkanFeatures,
"VkDevice supports the VK_KHR_incremental_present extension", &members}; "VkDevice supports the VK_KHR_incremental_present extension", &members};
// Whether the Vulkan presentation engine rotates the present region rectangles of the
// VK_KHR_incremental_present extension in pre-rotation situations. The Android presentation
// engine assumes that these rectangles need to be rotated, and thus ANGLE should not also
// pre-rotate them.
Feature disablePreRotateIncrementalPresentRectangles = {
"disablePreRotateIncrementalPresentRectangles", FeatureCategory::VulkanFeatures,
"Presentation engine performs necessary rotation for present region rectangles of the "
"VK_KHR_incremental_present extension",
&members};
// Whether texture copies on cube map targets should be done on GPU. This is a workaround for // Whether texture copies on cube map targets should be done on GPU. This is a workaround for
// Intel drivers on windows that have an issue with creating single-layer views on cube map // Intel drivers on windows that have an issue with creating single-layer views on cube map
// textures. // textures.
......
...@@ -2132,13 +2132,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk, ...@@ -2132,13 +2132,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
&mFeatures, supportsIncrementalPresent, &mFeatures, supportsIncrementalPresent,
ExtensionFound(VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME, deviceExtensionNames)); ExtensionFound(VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME, deviceExtensionNames));
// The Vulkan specification for the VK_KHR_incremental_present extension does not address
// rotation. In Android, this extension is implemented on top of the same platform code as
// eglSwapBuffersWithDamageKHR(), which code assumes that it should rotate each rectangle. To
// avoid double-rotating damage rectangles on Android, we must avoid pre-rotating
// application-provided rectangles. See: https://issuetracker.google.com/issues/181796746
ANGLE_FEATURE_CONDITION(&mFeatures, disablePreRotateIncrementalPresentRectangles, IsAndroid());
#if defined(ANGLE_PLATFORM_ANDROID) #if defined(ANGLE_PLATFORM_ANDROID)
ANGLE_FEATURE_CONDITION( ANGLE_FEATURE_CONDITION(
&mFeatures, supportsAndroidHardwareBuffer, &mFeatures, supportsAndroidHardwareBuffer,
......
...@@ -1421,12 +1421,7 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk, ...@@ -1421,12 +1421,7 @@ angle::Result WindowSurfaceVk::present(ContextVk *contextVk,
rect.extent.width = gl::clamp(*eglRects++, 0, width - rect.offset.x); rect.extent.width = gl::clamp(*eglRects++, 0, width - rect.offset.x);
rect.extent.height = gl::clamp(*eglRects++, 0, height - rect.offset.y); rect.extent.height = gl::clamp(*eglRects++, 0, height - rect.offset.y);
rect.layer = 0; rect.layer = 0;
if (Is90DegreeRotation(getPreTransform()) && // No rotation is done to these damage rectangles per the Vulkan spec.
!contextVk->getFeatures().disablePreRotateIncrementalPresentRectangles.enabled)
{
std::swap(rect.offset.x, rect.offset.y);
std::swap(rect.extent.width, rect.extent.height);
}
} }
presentRegion.pRectangles = vkRects.data(); presentRegion.pRectangles = vkRects.data();
......
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