| 8 | #include "Engine/Graphics/GPUDevice.h" |
| 9 | |
| 10 | void GPUTask::Execute(GPUTasksContext* context) |
| 11 | { |
| 12 | ASSERT(IsQueued() && _context == nullptr); |
| 13 | SetState(TaskState::Running); |
| 14 | |
| 15 | // Perform an operation |
| 16 | const auto result = run(context); |
| 17 | |
| 18 | // Process result |
| 19 | if (IsCancelRequested()) |
| 20 | { |
| 21 | SetState(TaskState::Canceled); |
| 22 | } |
| 23 | else if (result != Result::Ok) |
| 24 | { |
| 25 | LOG(Warning, "\'{0}\' failed with result: {1}", ToString(), ToString(result)); |
| 26 | OnFail(); |
| 27 | } |
| 28 | else |
| 29 | { |
| 30 | // Save task completion point (for synchronization) |
| 31 | _syncPoint = context->GetCurrentSyncPoint(); |
| 32 | _context = context; |
| 33 | if (_syncLatency == 0) |
| 34 | { |
| 35 | // No delay on sync |
| 36 | Sync(); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | String GPUTask::ToString() const |
| 42 | { |
no test coverage detected