mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
Make Surface reference its attached SwapChain
This solves an issues where when switching swapchains the previous one was destroyed before the new one was created, doing so detached itself from the Surface, which in turn made the new swapchain not do a graceful transition via vkSwapchainCreateInfoKHR::oldSwapchain. Keeping the reference on the surface makes sure we always have knowledge of the previous swapchain when replacing it. It requires re-working the lifetime model of NewSwapChainBase to not require a call to DetachFromSurface in the destructor, and having the Device explicitly tell a swapchain it got attached on creation (otherwise there are ASSERTs firing when swapchain creation fails). In addition, backends are changed to use a SwapChain::Create method and fail with a validation error (for now) when the previous swapchain didn't use the same API. vulkan::SwapChain is updated to use the previous swapchain's device's fenced deleter to destroy it which is important in the device switching tests. The SwapChainValidationTests are updated because with the lifetime changes the texture view can be kept alive after the application has lost the last reference to the wgpu::SwapChain. TBRing since it was reviewed in a different CL (but for the wrong branch). TBR=enga@chromium.org TBR=senorblanco@chromium.org Bug: dawn:269 Change-Id: Ie4374b5685af990d68969ab9cd7767e53c287ace Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31041 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
41c24933da
commit
25eeaa3d39
@@ -151,8 +151,8 @@ namespace dawn_native {
|
||||
}
|
||||
}
|
||||
|
||||
NewSwapChainBase* Surface::GetAttachedSwapChain() const {
|
||||
return mSwapChain;
|
||||
NewSwapChainBase* Surface::GetAttachedSwapChain() {
|
||||
return mSwapChain.Get();
|
||||
}
|
||||
|
||||
void Surface::SetAttachedSwapChain(NewSwapChainBase* swapChain) {
|
||||
|
||||
Reference in New Issue
Block a user