Attempt to fix game cooking regression from ef188d06c4

This commit is contained in:
Wojtek Figat
2025-04-22 23:28:21 +02:00
parent ac3c4a4b30
commit 992b08025f
3 changed files with 12 additions and 8 deletions

View File

@@ -67,6 +67,14 @@ public:
return _type; return _type;
} }
/// <summary>
/// Gets work synchronization start point
/// </summary>
FORCE_INLINE GPUSyncPoint GetSyncStart() const
{
return _syncPoint;
}
/// <summary> /// <summary>
/// Gets work finish synchronization point /// Gets work finish synchronization point
/// </summary> /// </summary>

View File

@@ -36,7 +36,7 @@ GPUTasksContext::~GPUTasksContext()
if (task->GetSyncPoint() <= _currentSyncPoint && task->GetState() != TaskState::Finished) if (task->GetSyncPoint() <= _currentSyncPoint && task->GetState() != TaskState::Finished)
{ {
if (!Engine::IsRequestingExit) if (!Engine::IsRequestingExit)
LOG(Warning, "{0} has been canceled before a sync", task->ToString()); LOG(Warning, "'{0}' has been canceled before a sync", task->ToString());
task->CancelSync(); task->CancelSync();
} }
} }
@@ -51,18 +51,15 @@ void GPUTasksContext::Run(GPUTask* task)
ASSERT(task != nullptr); ASSERT(task != nullptr);
task->Execute(this); task->Execute(this);
if (task->IsSyncing()) if (task->GetSyncStart() != 0)
_tasksSyncing.Add(task); _tasksSyncing.Add(task);
} }
void GPUTasksContext::OnCancelSync(GPUTask* task) void GPUTasksContext::OnCancelSync(GPUTask* task)
{ {
ASSERT(task != nullptr);
_tasksSyncing.Remove(task); _tasksSyncing.Remove(task);
if (!Engine::IsRequestingExit) if (!Engine::IsRequestingExit)
LOG(Warning, "{0} has been canceled before a sync", task->ToString()); LOG(Warning, "'{0}' has been canceled before a sync", task->ToString());
} }
void GPUTasksContext::OnFrameBegin() void GPUTasksContext::OnFrameBegin()

View File

@@ -51,10 +51,9 @@ void GPUTask::Enqueue()
void GPUTask::OnCancel() void GPUTask::OnCancel()
{ {
// Check if task is waiting for sync (very likely situation) // Check if task is waiting for sync (very likely situation)
if (IsSyncing()) if (IsSyncing() && _context)
{ {
// Task has been performed but is waiting for a CPU/GPU sync so we have to cancel that // Task has been performed but is waiting for a CPU/GPU sync so we have to cancel that
ASSERT(_context != nullptr);
_context->OnCancelSync(this); _context->OnCancelSync(this);
_context = nullptr; _context = nullptr;
} }