mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-26 14:44:58 +00:00
feat: Refactor RenderCommandService to use lazy initialization and remove Initialize method
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user