![]() |
ezEngine
Release 25.03
|
Describes the priority with which to execute a task. More...
#include <TaskSystemDeclarations.h>
Public Types | |
enum | Enum : ezUInt8 { EarlyThisFrame, ThisFrame, LateThisFrame, EarlyNextFrame, NextFrame, LateNextFrame, In2Frames, In3Frames, In4Frames, In5Frames, In6Frames, In7Frames, In8Frames, In9Frames, LongRunningHighPriority, LongRunning, FileAccessHighPriority, FileAccess, ThisFrameMainThread, SomeFrameMainThread, ENUM_COUNT } |
Describes the priority with which to execute a task.
For tasks that you start this frame and that need to finish within the same frame, use 'EarlyThisFrame', 'ThisFrame' or 'LateThisFrame'.
However you should generally not rely on starting tasks in the same frame in which they need to finish.
Instead prefer to start a task, whose result you need in the next frame or even later.
For those tasks, use 'EarlyNextFrame', 'NextFrame', 'LateNextFrame' and 'InNFrames'.
Once 'ezTaskSystem::FinishFrameTasks' is called, all those tasks will be moved into the 'XYZThisFrame' categories.
For tasks that run over a longer period (e.g. path searches, procedural data creation), use 'LongRunning'. Only use 'LongRunningHighPriority' for tasks that occur rarely, otherwise 'LongRunning' tasks might not get processed, at all.
For tasks that need to access files, prefer to use 'FileAccess', this way all file accesses get executed sequentially.
Use 'FileAccessHighPriority' to get very important file accesses done sooner. For example writing out a save-game should finish quickly.
For tasks that need to execute on the main thread (e.g. uploading GPU resources) use 'ThisFrameMainThread' or 'SomeFrameMainThread' depending on how urgent it is. 'SomeFrameMainThread' tasks might get delayed for quite a while, depending on the system load. For tasks that need to do several things (e.g. reading from a file AND uploading something on the main thread), split them up into several tasks that depend on each other (or just let the first task start the next step once it is finished). There is no guarantee WHEN (within a frame) main thread tasks get executed. Most of them will get executed upon a 'FinishFrameTasks' call. However they are also run whenever the main thread needs to wait or cancel some other task and has nothing else to do. So tasks that get executed on the main thread should never assume a certain state of other systems.
enum ezTaskPriority::Enum : ezUInt8 |