LayerProcGen v0.1.0
Layer-based infinite procedural generation
|
Enqueue actions from generation threads to be processed on the main thread. More...
Static Public Member Functions | |
static void | Enqueue (Action action) |
Enqueue a System.Action on the regular queue, to be performed on the main thread. | |
static void | Enqueue (IQueuedAction action) |
Enqueue an IQueuedAction on the regular queue, to be performed on the main thread. | |
static void | EnqueueFastTrack (Action action) |
Enqueue a System.Action on the fast track queue, to be performed on the main thread prior to actions in the regular queue. | |
static void | EnqueueFastTrack (IQueuedAction action) |
Enqueue an IQueuedAction on the fast track queue, to be performed on the main thread prior to actions in the regular queue. | |
static void | EnqueueNextFrame (Action action) |
Enqueue a System.Action to be performed on the main thread next frame. | |
static void | EnqueueNextFrame (IQueuedAction action) |
Enqueue an IQueuedAction to be performed on the main thread next frame. | |
static void | ProcessQueue () |
ProcessQueue must be called once per frame on the main thread, typically handled by the engine-specific part of the framework. | |
Static Public Attributes | |
static readonly Stopwatch | watch = new Stopwatch() |
Timer that measures time spent on main thread actions. Reset at the end of ProcessQueue. | |
Enqueue actions from generation threads to be processed on the main thread.
Actions can be scheduled in the regular queue, in the fast track queue or for immediate processing next frame. Actions scheduled for next frame are always processed in that frame. If there is remaining budget after that, fast track actions are processed, and if further remaining budget, actions from the regular queue. Actions not processed remain in their respective queues for consideration in the following frame.
|
static |
Timer that measures time spent on main thread actions. Reset at the end of ProcessQueue.
If you perform other work on the main thread that you want to make use of the same per-frame buget as the main thread action queue actions, you can call Start and Stop on this timer before and after that work is performed, respectively. This will reduce the available budget for the queued main thread actions, possibly postponing them to later, except for the ones scheduled for next frame.