2021-11-22 15:33:48 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "ComputeSystemInterface.h"
|
|
|
|
|
|
|
|
|
|
namespace ComputeSystemInterface
|
|
|
|
|
{
|
|
|
|
|
TArray<IComputeSystem*> GRegisteredSystems;
|
|
|
|
|
|
|
|
|
|
void RegisterSystem(IComputeSystem* InSystem)
|
|
|
|
|
{
|
|
|
|
|
GRegisteredSystems.AddUnique(InSystem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UnregisterSystem(IComputeSystem* InSystem)
|
|
|
|
|
{
|
|
|
|
|
for (int32 SystemIndex = 0; SystemIndex < GRegisteredSystems.Num(); ++SystemIndex)
|
|
|
|
|
{
|
|
|
|
|
if (GRegisteredSystems[SystemIndex] == InSystem)
|
|
|
|
|
{
|
2024-02-19 16:51:58 -05:00
|
|
|
GRegisteredSystems.RemoveAtSwap(SystemIndex, EAllowShrinking::No);
|
2021-11-22 15:33:48 -05:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CreateWorkers(FSceneInterface const* InScene, TArray<IComputeTaskWorker*>& OutWorkders)
|
|
|
|
|
{
|
|
|
|
|
for (IComputeSystem* System : GRegisteredSystems)
|
|
|
|
|
{
|
|
|
|
|
System->CreateWorkers(InScene, OutWorkders);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DestroyWorkers(FSceneInterface const* InScene, TArray<IComputeTaskWorker*>& InOutWorkders)
|
|
|
|
|
{
|
|
|
|
|
for (IComputeSystem* System : GRegisteredSystems)
|
|
|
|
|
{
|
|
|
|
|
System->DestroyWorkers(InScene, InOutWorkders);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ensure(InOutWorkders.Num() == 0);
|
|
|
|
|
}
|
|
|
|
|
}
|