feat: add JobSystem

This commit is contained in:
2026-10-24 00:59:22 +02:00
parent b798ed0378
commit 9c5a97cfbd
7 changed files with 502 additions and 1 deletions
+4
View File
@@ -16,6 +16,7 @@
#include <destrum/Scene/ResourceCollector.h>
#include <destrum/Scene/Scene.h>
#include <destrum/Scene/SceneManager.h>
#include <destrum/Threading/JobSystem.h>
#include <destrum/Util/DeltaTime.h>
namespace {
@@ -60,6 +61,7 @@ void App::init(const AppParams& params)
tracy::SetThreadName("Main Thread");
TracySetProgramName(params.appName.c_str());
AssetFS::GetInstance().Init(params.exeDir);
JobSystem::GetInstance().Init();
window.Create({
.title = params.windowTitle,
@@ -171,6 +173,7 @@ void App::run()
continue;
}
JobSystem::GetInstance().DrainMainThreadQueue();
if (layer) {
layer->onBeginFrame();
}
@@ -386,6 +389,7 @@ void App::cleanup()
// The one place we wait for the GPU on shutdown: the cleanup calls below destroy
// pipelines and other objects directly, which is only valid once nothing is in flight.
attempt([this] { gfxDevice.waitIdle(); });
attempt([] { JobSystem::GetInstance().Shutdown(); });
attempt([this] {
if (layer) {