MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / OnFrameBegin

Method OnFrameBegin

Source/Engine/Graphics/Async/GPUTasksContext.cpp:65–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void GPUTasksContext::OnFrameBegin()
66{
67#if GPU_TASKS_USE_DEDICATED_CONTEXT
68 GPU->FrameBegin();
69#endif
70
71 // Move forward one frame
72 ++_currentSyncPoint;
73
74 // Try to flush done jobs
75 for (int32 i = 0; i < _tasksSyncing.Count(); i++)
76 {
77 auto task = _tasksSyncing[i];
78 auto state = task->GetState();
79 if (task->GetSyncPoint() <= _currentSyncPoint && state != TaskState::Finished)
80 {
81 // TODO: add stats counter and count performed jobs, print to log on exit.
82 task->Sync();
83 }
84 if (state == TaskState::Failed || state == TaskState::Canceled)
85 {
86 _tasksSyncing.RemoveAt(i);
87 i--;
88 }
89 if (state == TaskState::Finished)
90 {
91 _tasksSyncing.RemoveAt(i);
92 i--;
93 _totalTasksDoneCount++;
94 }
95 }
96}
97
98void GPUTasksContext::OnFrameEnd()
99{

Callers 1

FrameBeginMethod · 0.80

Calls 6

FrameBeginMethod · 0.45
CountMethod · 0.45
GetStateMethod · 0.45
GetSyncPointMethod · 0.45
SyncMethod · 0.45
RemoveAtMethod · 0.45

Tested by

no test coverage detected