mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2026-05-08 03:18:05 +02:00
Remove swapchain from device_data after destruction
Fixes an issue, where the swapchain addresses weren't removed from the device_private_data::swapchains member after swapchain destruction. This could cause clashes with swapchains handled by different components (e.g. ICD). Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com> Change-Id: I0e05734368ef6100b67ded973283f99ef248e540
This commit is contained in:
parent
626e40ba96
commit
32c5ad9d1b
3 changed files with 20 additions and 0 deletions
|
|
@ -392,6 +392,16 @@ VkResult device_private_data::add_layer_swapchain(VkSwapchainKHR swapchain)
|
|||
return result.has_value() ? VK_SUCCESS : VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
void device_private_data::remove_layer_swapchain(VkSwapchainKHR swapchain)
|
||||
{
|
||||
scoped_mutex lock(swapchains_lock);
|
||||
auto it = swapchains.find(swapchain);
|
||||
if (it != swapchains.end())
|
||||
{
|
||||
swapchains.erase(swapchain);
|
||||
}
|
||||
}
|
||||
|
||||
bool device_private_data::layer_owns_all_swapchains(const VkSwapchainKHR *swapchain, uint32_t swapchain_count) const
|
||||
{
|
||||
scoped_mutex lock(swapchains_lock);
|
||||
|
|
|
|||
|
|
@ -429,8 +429,16 @@ public:
|
|||
*/
|
||||
static device_private_data &get(VkQueue queue);
|
||||
|
||||
/**
|
||||
* @brief Add a swapchain to the swapchains member variable.
|
||||
*/
|
||||
VkResult add_layer_swapchain(VkSwapchainKHR swapchain);
|
||||
|
||||
/**
|
||||
* @brief Remove a swapchain from the swapchains member variable.
|
||||
*/
|
||||
void remove_layer_swapchain(VkSwapchainKHR swapchain);
|
||||
|
||||
/**
|
||||
* @brief Return whether all the provided swapchains are owned by us (the WSI Layer).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ wsi_layer_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapc,
|
|||
assert(swapc != VK_NULL_HANDLE);
|
||||
auto *sc = reinterpret_cast<wsi::swapchain_base *>(swapc);
|
||||
wsi::destroy_surface_swapchain(sc, device_data, pAllocator);
|
||||
|
||||
device_data.remove_layer_swapchain(swapc);
|
||||
}
|
||||
|
||||
VWL_VKAPI_CALL(VkResult)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue