vk: Catch leaking imageview refs on resize
This commit is contained in:
@@ -913,7 +913,7 @@ namespace vk
|
|||||||
swap_info.imageFormat = m_surface_format;
|
swap_info.imageFormat = m_surface_format;
|
||||||
swap_info.imageColorSpace = m_color_space;
|
swap_info.imageColorSpace = m_color_space;
|
||||||
|
|
||||||
swap_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
swap_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||||
swap_info.preTransform = pre_transform;
|
swap_info.preTransform = pre_transform;
|
||||||
swap_info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
swap_info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||||
swap_info.imageArrayLayers = 1;
|
swap_info.imageArrayLayers = 1;
|
||||||
@@ -928,7 +928,17 @@ namespace vk
|
|||||||
createSwapchainKHR(dev, &swap_info, nullptr, &m_vk_swapchain);
|
createSwapchainKHR(dev, &swap_info, nullptr, &m_vk_swapchain);
|
||||||
|
|
||||||
if (old_swapchain)
|
if (old_swapchain)
|
||||||
|
{
|
||||||
|
if (m_swap_images.size())
|
||||||
|
{
|
||||||
|
for (auto &img : m_swap_images)
|
||||||
|
img.discard(dev);
|
||||||
|
|
||||||
|
m_swap_images.resize(0);
|
||||||
|
}
|
||||||
|
|
||||||
destroySwapchainKHR(dev, old_swapchain, nullptr);
|
destroySwapchainKHR(dev, old_swapchain, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
nb_swap_images = 0;
|
nb_swap_images = 0;
|
||||||
getSwapchainImagesKHR(dev, m_vk_swapchain, &nb_swap_images, nullptr);
|
getSwapchainImagesKHR(dev, m_vk_swapchain, &nb_swap_images, nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user