Vulkan/SwapChain: Recreate semaphores when resizing
Prevents us acquiring an image on an already-signaled semaphore.
This commit is contained in:
parent
b107cdee53
commit
b1d4d5db5e
|
@ -507,6 +507,7 @@ VkResult SwapChain::AcquireNextImage()
|
||||||
|
|
||||||
bool SwapChain::ResizeSwapChain(u32 new_width /* = 0 */, u32 new_height /* = 0 */)
|
bool SwapChain::ResizeSwapChain(u32 new_width /* = 0 */, u32 new_height /* = 0 */)
|
||||||
{
|
{
|
||||||
|
DestroySemaphores();
|
||||||
DestroySwapChainImages();
|
DestroySwapChainImages();
|
||||||
|
|
||||||
if (new_width != 0 && new_height != 0)
|
if (new_width != 0 && new_height != 0)
|
||||||
|
@ -515,7 +516,7 @@ bool SwapChain::ResizeSwapChain(u32 new_width /* = 0 */, u32 new_height /* = 0 *
|
||||||
m_wi.surface_height = new_height;
|
m_wi.surface_height = new_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CreateSwapChain() || !SetupSwapChainImages())
|
if (!CreateSwapChain() || !SetupSwapChainImages() || !CreateSemaphores())
|
||||||
{
|
{
|
||||||
Panic("Failed to re-configure swap chain images, this is fatal (for now)");
|
Panic("Failed to re-configure swap chain images, this is fatal (for now)");
|
||||||
return false;
|
return false;
|
||||||
|
@ -526,9 +527,10 @@ bool SwapChain::ResizeSwapChain(u32 new_width /* = 0 */, u32 new_height /* = 0 *
|
||||||
|
|
||||||
bool SwapChain::RecreateSwapChain()
|
bool SwapChain::RecreateSwapChain()
|
||||||
{
|
{
|
||||||
|
DestroySemaphores();
|
||||||
DestroySwapChainImages();
|
DestroySwapChainImages();
|
||||||
DestroySwapChain();
|
DestroySwapChain();
|
||||||
if (!CreateSwapChain() || !SetupSwapChainImages())
|
if (!CreateSwapChain() || !SetupSwapChainImages() || !CreateSemaphores())
|
||||||
{
|
{
|
||||||
Panic("Failed to re-configure swap chain images, this is fatal (for now)");
|
Panic("Failed to re-configure swap chain images, this is fatal (for now)");
|
||||||
return false;
|
return false;
|
||||||
|
@ -550,6 +552,7 @@ bool SwapChain::SetVSync(bool enabled)
|
||||||
bool SwapChain::RecreateSurface(const WindowInfo& new_wi)
|
bool SwapChain::RecreateSurface(const WindowInfo& new_wi)
|
||||||
{
|
{
|
||||||
// Destroy the old swap chain, images, and surface.
|
// Destroy the old swap chain, images, and surface.
|
||||||
|
DestroySemaphores();
|
||||||
DestroySwapChainImages();
|
DestroySwapChainImages();
|
||||||
DestroySwapChain();
|
DestroySwapChain();
|
||||||
DestroySurface();
|
DestroySurface();
|
||||||
|
@ -577,7 +580,7 @@ bool SwapChain::RecreateSurface(const WindowInfo& new_wi)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally re-create the swap chain
|
// Finally re-create the swap chain
|
||||||
if (!CreateSwapChain() || !SetupSwapChainImages())
|
if (!CreateSwapChain() || !SetupSwapChainImages() || !CreateSemaphores())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue