From f268724034a2ceb63b90dc13aedf86a1eecac62e Mon Sep 17 00:00:00 2001 From: light7734 Date: Wed, 24 Sep 2025 15:08:15 +0330 Subject: [PATCH] fix(renderer): calling vkDestroyInstance causes XCloseWindow to segfault ref: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/commit/0017308648b6bf8eef10ef0ffb9470576c0c2e9e ref: https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/1894 ref: https://www.xfree86.org/4.7.0/DRI11.html --- modules/renderer/private/vk/context.cpp | 14 ++------------ modules/surface/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/renderer/private/vk/context.cpp b/modules/renderer/private/vk/context.cpp index 5138b55..3a1365d 100644 --- a/modules/renderer/private/vk/context.cpp +++ b/modules/renderer/private/vk/context.cpp @@ -131,9 +131,6 @@ Context::~Context() { try { - log_trc("Fucking destructing shit at address: {}", (size_t)this); - - if (m_device) { vkc(vk_device_wait_idle(m_device)); @@ -146,13 +143,7 @@ Context::~Context() { vk_destroy_surface_khr(m_instance, m_surface, nullptr); vk_destroy_debug_messenger(m_instance, m_debug_messenger, nullptr); - vk_destroy_instance(m_instance, nullptr); - } - - if (library) - { - dlclose(library); - library = nullptr; + // vk_destroy_instance(m_instance, nullptr); } } catch (const std::exception &exp) @@ -307,7 +298,6 @@ void Context::initialize_surface(const ecs::Entity &surface_entity) vkc(vk_create_xlib_surface_khr(m_instance, &create_info, nullptr, &m_surface)); const auto &[width, height] = component.get_resolution(); - log_dbg("{} x {}", width, height); m_framebuffer_size = { .width = width, .height = height, @@ -636,7 +626,7 @@ auto validation_layers_callback( ) -> VkBool32 { log_dbg("VALIDATION: {}", callback_data->pMessage); - return VK_FALSE; + return VK_FALSE; // TODO(Light): fix this mess! auto stats = *(Ref *)vulkan_user_data; // NOLINT diff --git a/modules/surface/CMakeLists.txt b/modules/surface/CMakeLists.txt index 4ca36ca..6d4ef3c 100644 --- a/modules/surface/CMakeLists.txt +++ b/modules/surface/CMakeLists.txt @@ -11,6 +11,7 @@ target_link_libraries(surface PUBLIC ecs app math + memory PRIVATE logger lt_debug