mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Destroy old swap chain before creating a new one
We no longer use the 'oldSwapchain' member in the swap chain description to replace an existing swap chain, but rather destroy it altogether and create a new swap chain. While this is less than optimal, it might help solve some swap chain-related issues such as #277.
This commit is contained in:
parent
24f0528b6f
commit
256645724b
@ -93,12 +93,14 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkSwapchain::recreateSwapchain() {
|
||||
VkSwapchainKHR oldSwapchain = m_handle;
|
||||
|
||||
// Wait until we can be certain that none of our
|
||||
// resources are still in use by the device.
|
||||
m_device->waitForIdle();
|
||||
|
||||
// Destroy previous swapchain object
|
||||
m_vkd->vkDestroySwapchainKHR(
|
||||
m_vkd->device(), m_handle, nullptr);
|
||||
|
||||
// Recreate the actual swapchain object
|
||||
auto caps = m_surface->getSurfaceCapabilities();
|
||||
auto fmt = m_surface->pickSurfaceFormat(1, &m_properties.preferredSurfaceFormat);
|
||||
@ -122,7 +124,7 @@ namespace dxvk {
|
||||
swapInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
swapInfo.presentMode = mode;
|
||||
swapInfo.clipped = VK_TRUE;
|
||||
swapInfo.oldSwapchain = oldSwapchain;
|
||||
swapInfo.oldSwapchain = VK_NULL_HANDLE;
|
||||
|
||||
Logger::debug(str::format(
|
||||
"DxvkSwapchain: Actual swap chain properties: ",
|
||||
@ -134,10 +136,6 @@ namespace dxvk {
|
||||
if (m_vkd->vkCreateSwapchainKHR(m_vkd->device(), &swapInfo, nullptr, &m_handle) != VK_SUCCESS)
|
||||
throw DxvkError("DxvkSwapchain: Failed to recreate swap chain");
|
||||
|
||||
// Destroy previous swapchain object
|
||||
m_vkd->vkDestroySwapchainKHR(
|
||||
m_vkd->device(), oldSwapchain, nullptr);
|
||||
|
||||
// Create the render pass object
|
||||
DxvkRenderPassFormat renderTargetFormat;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user