diff --git a/parallel-rdp-standalone/COMMIT b/parallel-rdp-standalone/COMMIT index f4f2ea7..90ed36c 100644 --- a/parallel-rdp-standalone/COMMIT +++ b/parallel-rdp-standalone/COMMIT @@ -1 +1 @@ -a691960e8d4f72fea6a384fd89881cbdb8a78a0b +f187ecba0df48e3185ac61e5516c34f903c7a095 diff --git a/parallel-rdp-standalone/vulkan/wsi.cpp b/parallel-rdp-standalone/vulkan/wsi.cpp index aec526e..903b471 100644 --- a/parallel-rdp-standalone/vulkan/wsi.cpp +++ b/parallel-rdp-standalone/vulkan/wsi.cpp @@ -46,6 +46,11 @@ void WSIPlatform::set_window_title(const std::string &) { } +void WSIPlatform::destroy_surface(VkInstance instance, VkSurfaceKHR surface) +{ + vkDestroySurfaceKHR(instance, surface, nullptr); +} + uintptr_t WSIPlatform::get_fullscreen_monitor() { return 0; @@ -294,8 +299,10 @@ void WSI::deinit_surface_and_swapchain() tear_down_swapchain(); if (surface != VK_NULL_HANDLE) - vkDestroySurfaceKHR(context->get_instance(), surface, nullptr); - surface = VK_NULL_HANDLE; + { + platform->destroy_surface(context->get_instance(), surface); + surface = VK_NULL_HANDLE; + } platform->event_swapchain_destroyed(); } @@ -676,7 +683,7 @@ void WSI::teardown() if (surface != VK_NULL_HANDLE) { - vkDestroySurfaceKHR(context->get_instance(), surface, nullptr); + platform->destroy_surface(context->get_instance(), surface); surface = VK_NULL_HANDLE; } diff --git a/parallel-rdp-standalone/vulkan/wsi.hpp b/parallel-rdp-standalone/vulkan/wsi.hpp index 6f72840..8f2c1a9 100644 --- a/parallel-rdp-standalone/vulkan/wsi.hpp +++ b/parallel-rdp-standalone/vulkan/wsi.hpp @@ -41,6 +41,8 @@ public: virtual ~WSIPlatform() = default; virtual VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice gpu) = 0; + // This is virtual so that application can hold ownership over the surface handle, for e.g. Qt interop. + virtual void destroy_surface(VkInstance instance, VkSurfaceKHR surface); virtual std::vector get_instance_extensions() = 0; virtual std::vector get_device_extensions() {