Skip to content

feat: replace deletion_queue with smart pointers#98

Merged
anunknowperson merged 1 commit into
anunknowperson:mainfrom
Gr-i-niy:main
Jun 2, 2025
Merged

feat: replace deletion_queue with smart pointers#98
anunknowperson merged 1 commit into
anunknowperson:mainfrom
Gr-i-niy:main

Conversation

@Gr-i-niy

Copy link
Copy Markdown
Collaborator

Replace raw Vulkan handles with smart wrapper classes for automatic resource management. Updates command pools, images, and fences to use RAII pattern, eliminating manual cleanup code and reducing memory leaks.

@Gr-i-niy Gr-i-niy requested review from Tydik42 and Copilot June 2, 2025 09:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces manual deletion queues with RAII smart pointer wrappers for Vulkan resources to simplify cleanup and reduce memory leaks. Key changes include the introduction of Vulkan smart wrapper classes for fences, semaphores, command pools, images, and buffers, as well as updates throughout the engine to use these wrappers in place of raw Vulkan handles.

  • Introduced RAII wrapper classes in vk_smart_wrappers.h
  • Updated vk_engine.h and vk_engine.cpp to use smart pointers for resource management
  • Modified command buffer and pipeline initialization to work with the new smart wrappers

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/include/graphics/vulkan/vk_smart_wrappers.h New RAII wrappers for Vulkan objects ensuring automatic cleanup
src/include/graphics/vulkan/vk_engine.h Switched deletion queue to smart pointers for frame data cleanup
src/graphics/vulkan/vk_loader.cpp Updated image retrieval to use the smart pointer getters
src/graphics/vulkan/vk_engine.cpp Replaced raw handles with smart pointer calls across resource creation, submission, and cleanup
src/graphics/vulkan/vk_command_buffers.cpp Updated command pool and fence creation to use smart pointers
src/graphics/vulkan/pipelines.cpp Adapted pipeline resource usage to work with smart pointers
Comments suppressed due to low confidence (1)

src/graphics/vulkan/vk_engine.cpp:625

  • Manual destruction of command pools in the cleanup routine is redundant since the VulkanCommandPool destructor already handles resource deletion. Removing this manual call will help prevent potential double free errors.
if (_frame._commandPool) { vkDestroyCommandPool(_device, _frame._commandPool->get(), nullptr); }

@anunknowperson anunknowperson merged commit 87d7ab7 into anunknowperson:main Jun 2, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants