Commit c7645886 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Remove the flipViewportY feature

This was featurized as a workaround for Intel/Windows drivers that did not render flipped in comparison to GL per Vulkan spec. This issue has long since been fixed, and due to missing parentheses the feature was accidentally unconditionally true for a long time already. Bug: angleproject:4896 Change-Id: I1db55d298bd47df649ff1f03d287d0cfa7453ea7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372632Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 230d5904
......@@ -41,22 +41,6 @@ struct FeaturesVk : FeatureSetBase
"Enable provoking vertex mode via VK_EXT_provoking_vertex extension",
&members};
// Flips the viewport to render upside-down. This has the effect to render the same way as
// OpenGL. If this feature gets enabled, we enable the KHR_MAINTENANCE_1 extension to allow
// negative viewports. We inverse rendering to the backbuffer by reversing the height of the
// viewport and increasing Y by the height. So if the viewport was (0,0,width,height), it
// becomes (0, height, width, -height). Unfortunately, when we start doing this, we also need
// to adjust a lot of places since the rendering now happens upside-down. Affected places so
// far:
// -readPixels
// -copyTexImage
// -framebuffer blit
// -generating mipmaps
// -Point sprites tests
// -texStorage
Feature flipViewportY = {"flip_viewport_y", FeatureCategory::VulkanFeatures,
"Flips the viewport to render upside-down", &members};
// Add an extra copy region when using vkCmdCopyBuffer as the Windows Intel driver seems
// to have a bug where the last region is ignored.
Feature extraCopyBufferRegion = {
......
......@@ -3146,11 +3146,10 @@ angle::Result ContextVk::onMakeCurrent(const gl::Context *context)
{
mRenderer->reloadVolkIfNeeded();
// Flip viewports if FeaturesVk::flipViewportY is enabled and the user did not request that
// the surface is flipped.
// Flip viewports if the user did not request that the surface is flipped.
egl::Surface *drawSurface = context->getCurrentDrawSurface();
mFlipYForCurrentSurface =
drawSurface != nullptr && mRenderer->getFeatures().flipViewportY.enabled &&
drawSurface != nullptr &&
!IsMaskFlagSet(drawSurface->getOrientation(), EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE);
if (drawSurface && drawSurface->getType() == EGL_WINDOW_BIT)
......@@ -3181,16 +3180,29 @@ angle::Result ContextVk::onUnMakeCurrent(const gl::Context *context)
void ContextVk::updateFlipViewportDrawFramebuffer(const gl::State &glState)
{
// The default framebuffer (originating from the swapchain) is rendered upside-down due to the
// difference in the coordinate systems of Vulkan and GLES. Rendering upside-down has the
// effect that rendering is done the same way as OpenGL. The KHR_MAINTENANCE_1 extension is
// subsequently enabled to allow negative viewports. We inverse rendering to the backbuffer by
// reversing the height of the viewport and increasing Y by the height. So if the viewport was
// (0, 0, width, height), it becomes (0, height, width, -height). Unfortunately, when we start
// doing this, we also need to adjust a number of places since the rendering now happens
// upside-down. Affected places so far:
//
// - readPixels
// - copyTexImage
// - framebuffer blit
// - generating mipmaps
// - Point sprites tests
// - texStorage
gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
mFlipViewportForDrawFramebuffer =
drawFramebuffer->isDefault() && mRenderer->getFeatures().flipViewportY.enabled;
mFlipViewportForDrawFramebuffer = drawFramebuffer->isDefault();
}
void ContextVk::updateFlipViewportReadFramebuffer(const gl::State &glState)
{
gl::Framebuffer *readFramebuffer = glState.getReadFramebuffer();
mFlipViewportForReadFramebuffer =
readFramebuffer->isDefault() && mRenderer->getFeatures().flipViewportY.enabled;
mFlipViewportForReadFramebuffer = readFramebuffer->isDefault();
}
void ContextVk::updateSurfaceRotationDrawFramebuffer(const gl::State &glState)
......
......@@ -1144,12 +1144,12 @@ angle::Result RendererVk::initializeDevice(DisplayVk *displayVk, uint32_t queueF
enabledDeviceExtensions.push_back(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME);
}
// Selectively enable KHR_MAINTENANCE1 to support viewport flipping.
if ((getFeatures().flipViewportY.enabled) &&
(mPhysicalDeviceProperties.apiVersion < VK_MAKE_VERSION(1, 1, 0)))
// Enable KHR_MAINTENANCE1 to support viewport flipping.
if (mPhysicalDeviceProperties.apiVersion < VK_MAKE_VERSION(1, 1, 0))
{
enabledDeviceExtensions.push_back(VK_KHR_MAINTENANCE1_EXTENSION_NAME);
}
if (getFeatures().supportsIncrementalPresent.enabled)
{
enabledDeviceExtensions.push_back(VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
......@@ -1660,14 +1660,6 @@ void RendererVk::initFeatures(DisplayVk *displayVk, const ExtensionNameList &dev
ANGLE_FEATURE_CONDITION(&mFeatures, provokingVertex, true);
}
// TODO(lucferron): Currently disabled on Intel only since many tests are failing and need
// investigation. http://anglebug.com/2728
ANGLE_FEATURE_CONDITION(
&mFeatures, flipViewportY,
!IsIntel(mPhysicalDeviceProperties.vendorID) &&
(mPhysicalDeviceProperties.apiVersion >= VK_MAKE_VERSION(1, 1, 0)) ||
ExtensionFound(VK_KHR_MAINTENANCE1_EXTENSION_NAME, deviceExtensionNames));
// http://anglebug.com/2838
ANGLE_FEATURE_CONDITION(&mFeatures, extraCopyBufferRegion, IsWindows() && isIntel);
......
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