LoadScheduler
A low-level utility used by loader implementations to execute blocking work off the main thread while ensuring that ownership transfer and engine-facing object creation occur on the main thread.
The runtime owns a single scheduler instance and calls Pump from the main loop to process completed loads. References to the scheduler are provided to loader instances when the shared context is constructed.
Applications built on top of the application runtime do not interact with this class directly. It is exposed primarily to support custom runtimes and direct integration scenarios.
To learn more about loaders see the Importing Assets Guide.
Types
CommitFn typedef
Function executed on the Pump thread to finalize and publish results.
Commit runs when Pump is called and is intended for main-thread-only performing final handoff to application-visible state.
using vglx::LoadScheduler::CommitFn = std::function<void()>WorkFn typedef
Function executed on a worker thread to perform blocking load work.
The work function should avoid touching scene state or GPU objects. It typically reads from disk and fills a shared handle state.
using vglx::LoadScheduler::WorkFn = std::function<void()>Functions
Enqueue() void
Enqueues a load job.
Schedules work to run asynchronously and registers commit to be executed later.
void LoadScheduler::Enqueue(WorkFn work, CommitFn commit);| Parameter | Description |
|---|---|
| work | Worker-thread phase. |
| commit | Main-thread commit phase. |
Pump() void
Executes pending commit functions.
Pumps the completion queue and runs commit callbacks on the calling thread. This is typically invoked once per frame by the runtime.
void LoadScheduler::Pump();