Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[fix] The swapchain now unsubscribes itself from the window resize ev…
…ent when it's destroyed.
  • Loading branch information
reavencode committed Dec 17, 2025
commit 098b027bf5015889f185f0ca9cc75760d9025ea5
1 change: 1 addition & 0 deletions source/runtime/RHI/RHI_SwapChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace spartan
uint32_t m_image_index = 0;
uint32_t semaphore_index = 0;
void* m_sdl_window = nullptr;
subscription_handle m_window_resize_event_handle;
std::array<std::shared_ptr<RHI_SyncPrimitive>, buffer_count> m_image_acquired_semaphore;

// rhi
Expand Down
5 changes: 4 additions & 1 deletion source/runtime/RHI/Vulkan/Vulkan_SwapChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,14 @@ namespace spartan

Create();

SP_SUBSCRIBE_TO_EVENT(EventType::WindowResized, SP_EVENT_HANDLER(ResizeToWindowSize));
m_window_resize_event_handle = SP_SUBSCRIBE_TO_EVENT(EventType::WindowResized, SP_EVENT_HANDLER(ResizeToWindowSize));
}

RHI_SwapChain::~RHI_SwapChain()
{
SP_UNSUBSCRIBE_FROM_EVENT(EventType::WindowResized, m_window_resize_event_handle);
m_window_resize_event_handle = 0;

for (void*& image_view : m_rhi_rtv)
{
if (image_view)
Expand Down