feat: Refactor RenderCommandService to use lazy initialization and remove Initialize method

This commit is contained in:
2026-01-04 14:08:32 +00:00
parent d30e423294
commit 2165fe99dd
5 changed files with 15 additions and 21 deletions

View File

@@ -16,16 +16,6 @@ RenderCommandService::~RenderCommandService() {
}
}
void RenderCommandService::Initialize() {
logging::TraceGuard trace;
CreateCommandPool();
CreateCommandBuffers();
CreateSyncObjects();
logging::Logger::GetInstance().Info("RenderCommandService initialized");
}
void RenderCommandService::Cleanup() {
CleanupCommandResources();
CleanupSyncObjects();
@@ -38,6 +28,14 @@ void RenderCommandService::Shutdown() noexcept {
bool RenderCommandService::BeginFrame(uint32_t& imageIndex) {
logging::TraceGuard trace;
// Lazy initialization
if (commandPool_ == VK_NULL_HANDLE) {
CreateCommandPool();
CreateCommandBuffers();
CreateSyncObjects();
logging::Logger::GetInstance().Info("RenderCommandService initialized lazily");
}
auto device = deviceService_->GetDevice();
// Wait for previous frame (with timeout)