vk_swapchain_tpl_t *swapchain_tpl;
tpl_handle_t native_window;
int tpl_present_mode;
+ vk_bool_t need_to_create = VK_TRUE;
VkResult error = VK_ERROR_DEVICE_LOST;
swapchain_tpl->tpl_surface = tpl_surface_get(swapchain_tpl->tpl_display,
native_window);
- if (swapchain_tpl->tpl_surface && chain->oldSwapchain == VK_NULL_HANDLE)
- tpl_object_reference((tpl_object_t *)swapchain_tpl->tpl_surface);
- else
+ if (swapchain_tpl->tpl_surface) {
+ if (chain->oldSwapchain != VK_NULL_HANDLE) {
+ vk_swapchain_tpl_t *oldSwapchain_tpl =
+ (vk_swapchain_tpl_t *)chain->oldSwapchain->backend_data;
+ if (tpl_surface_validate(oldSwapchain_tpl->tpl_surface))
+ need_to_create = VK_TRUE;
+ else
+ need_to_create = VK_FALSE;
+ } else {
+ need_to_create = VK_FALSE;
+ }
+ }
+
+ if (need_to_create)
swapchain_tpl->tpl_surface = tpl_surface_create(swapchain_tpl->tpl_display,
native_window,
TPL_SURFACE_TYPE_WINDOW, format);
+ else
+ tpl_object_reference((tpl_object_t *)swapchain_tpl->tpl_surface);
+
VK_CHECK(swapchain_tpl->tpl_surface, goto error, "tpl_surface_create() failed.\n");