VK_CHECK(swapchain_tpl->tpl_display, goto error, "vk_get_tpl_display() failed.\n");
native_window = vk_get_tpl_native_window(surface);
- swapchain_tpl->tpl_surface = tpl_surface_create(swapchain_tpl->tpl_display,
- native_window,
- TPL_SURFACE_TYPE_WINDOW, format);
+ swapchain_tpl->tpl_surface = tpl_surface_get(swapchain_tpl->tpl_display,
+ native_window);
+ if (swapchain_tpl->tpl_surface)
+ tpl_object_reference(swapchain_tpl->tpl_surface);
+ else
+ swapchain_tpl->tpl_surface = tpl_surface_create(swapchain_tpl->tpl_display,
+ native_window,
+ TPL_SURFACE_TYPE_WINDOW, format);
+
VK_CHECK(swapchain_tpl->tpl_surface, goto error, "tpl_surface_create() failed.\n");
switch(info->presentMode) {