Hash :
ab5acbd5
Author :
Date :
2019-01-23T13:58:09
Vulkan: implement swapchain resizing Vulkan allows a swapchain to be created based off of an older swapchain that's still presenting, to support seamless window resizing. The old swapchain will remain alive (though no image can be acquired from it) and automatically cleaned once no image is being presented from it. The retired swapchain can be destroyed once all operations on its images are completed. We store the old swapchain next to the serial of submission that's used for CPU throttling and defer the destroy call until after `finishToSerial` for that serial is called. Bug: angleproject:2942 Change-Id: Ic62a5a57b712ffa2b087f5fecde0dc8942194075 Reviewed-on: https://chromium-review.googlesource.com/c/1435634 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WindowSurfaceVkXcb.cpp:
// Implements the class methods for WindowSurfaceVkXcb.
//
#include "libANGLE/renderer/vulkan/xcb/WindowSurfaceVkXcb.h"
#include "libANGLE/renderer/vulkan/RendererVk.h"
namespace rx
{
WindowSurfaceVkXcb::WindowSurfaceVkXcb(const egl::SurfaceState &surfaceState,
EGLNativeWindowType window,
EGLint width,
EGLint height,
xcb_connection_t *conn)
: WindowSurfaceVk(surfaceState, window, width, height), mXcbConnection(conn)
{}
angle::Result WindowSurfaceVkXcb::createSurfaceVk(vk::Context *context, gl::Extents *extentsOut)
{
VkXcbSurfaceCreateInfoKHR createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
createInfo.flags = 0;
createInfo.connection = mXcbConnection;
createInfo.window = mNativeWindowType;
ANGLE_VK_TRY(context, vkCreateXcbSurfaceKHR(context->getRenderer()->getInstance(), &createInfo,
nullptr, &mSurface));
return getCurrentWindowSize(context, extentsOut);
}
angle::Result WindowSurfaceVkXcb::getCurrentWindowSize(vk::Context *context,
gl::Extents *extentsOut)
{
xcb_get_geometry_cookie_t cookie = xcb_get_geometry(mXcbConnection, mNativeWindowType);
xcb_get_geometry_reply_t *reply = xcb_get_geometry_reply(mXcbConnection, cookie, nullptr);
ASSERT(reply);
*extentsOut = gl::Extents(reply->width, reply->height, 0);
free(reply);
return angle::Result::Continue;
}
} // namespace rx