Commit f7033c55 by Ian Elliott Committed by Commit Bot

Vulkan: Request at least 3 images for MAILBOX.

The glmark2 benchmark score went down (on Android with Pixel devices) when ANGLE changed VkSwapchainCreateInfoKHR::minImageCount from 3 down to 2, when using VK_PRESENT_MODE_MAILBOX_KHR. In experimenting, this was confirmed. This CL changes minImageCount back to 3. Vulkan spec issue #1671 was filed in order to understand whether this is a good/bad approach for other drivers/platforms. Test: glmark2 on Pixel2. Bug: angleproject: 3400 Change-Id: Ia4a72733eb648e4f53feeb8833b174d653fa5766 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1610242 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org>
parent 7d798558
...@@ -913,24 +913,17 @@ void WindowSurfaceVk::setSwapInterval(EGLint interval) ...@@ -913,24 +913,17 @@ void WindowSurfaceVk::setSwapInterval(EGLint interval)
mDesiredSwapchainPresentMode = GetDesiredPresentMode(mPresentModes, interval); mDesiredSwapchainPresentMode = GetDesiredPresentMode(mPresentModes, interval);
// Determine the number of swapchain images: // - On mailbox, we need at least three images; one is being displayed to the user until the
// // next v-sync, and the application alternatingly renders to the other two, one being
// - On mailbox, we use minImageCount. The drivers may increase the number so that non-blocking // recorded, and the other queued for presentation if v-sync happens in the meantime.
// mailbox actually makes sense. // - On immediate, we need at least two images; the application alternates between the two
// - On immediate, we use max(2, minImageCount). The vkQueuePresentKHR call immediately frees // images.
// up the other image, so there is no point in having any more images. // - On fifo, we use at least three images. Triple-buffering allows us to present an image,
// - On fifo, we use max(3, minImageCount). Triple-buffering allows us to present an image, // have one in the queue, and record in another. Note: on certain configurations (windows +
// have one in the queue and record in another. Note: on certain configurations (windows +
// nvidia + windowed mode), we could get away with a smaller number. // nvidia + windowed mode), we could get away with a smaller number.
mMinImageCount = mSurfaceCaps.minImageCount; //
if (mDesiredSwapchainPresentMode == VK_PRESENT_MODE_IMMEDIATE_KHR) // For simplicity, we always allocate at least three images.
{ mMinImageCount = std::max(3u, mSurfaceCaps.minImageCount);
mMinImageCount = std::max(2u, mMinImageCount);
}
else if (mDesiredSwapchainPresentMode == VK_PRESENT_MODE_FIFO_KHR)
{
mMinImageCount = std::max(3u, mMinImageCount);
}
// Make sure we don't exceed maxImageCount. // Make sure we don't exceed maxImageCount.
if (mSurfaceCaps.maxImageCount > 0 && mMinImageCount > mSurfaceCaps.maxImageCount) if (mSurfaceCaps.maxImageCount > 0 && mMinImageCount > mSurfaceCaps.maxImageCount)
......
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