You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Also removed the previous FastBuild shader compiler integration based on an older API. - Made Distributed Build controller selection OS-agnostic. #review-16452691 @Ben.Ingram, @Jason.Nadro, @Will.Damon, @Brandon.Schaefer, @James.Singer, @Rolando.Caloca [CL 16476321 by savagecodes in ue5-main branch]
101 lines
2.7 KiB
C++
101 lines
2.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "DistributedBuildInterface/Public/DistributedBuildControllerInterface.h"
|
|
#include "Containers/Array.h"
|
|
|
|
class FFastBuildJobProcessor;
|
|
|
|
class FFastBuildControllerModule : public IDistributedBuildController
|
|
{
|
|
bool bSupported;
|
|
bool bModuleInitialized;
|
|
bool bControllerInitialized;
|
|
|
|
FThreadSafeCounter NextFileID;
|
|
FThreadSafeCounter NextTaskID;
|
|
|
|
FThreadSafeCounter PendingTasksCounter;
|
|
|
|
/** The thread spawned for shader compiling. */
|
|
TUniquePtr<FFastBuildJobProcessor> JobDispatcherThread;
|
|
|
|
// Taken when accessing the PendingTasks and DispatchedTasks members.
|
|
TSharedPtr<FCriticalSection> TasksCS;
|
|
|
|
// Queue of tasks submitted by the engine, but not yet dispatched to the controller.
|
|
TQueue<FTask*> PendingTasks;
|
|
|
|
// Map of tasks dispatched to the controller and running within FastBuild, that have not yet finished.
|
|
TMap<uint32,FTask*> DispatchedTasks;
|
|
|
|
const FString RootWorkingDirectory;
|
|
|
|
const FString WorkingDirectory;
|
|
|
|
bool bShutdown;
|
|
|
|
void CleanWorkingDirectory();
|
|
|
|
public:
|
|
FFastBuildControllerModule();
|
|
virtual ~FFastBuildControllerModule();
|
|
|
|
virtual void StartupModule() override final;
|
|
virtual void ShutdownModule() override final;
|
|
|
|
virtual bool RequiresRelativePaths() override final{ return true; };
|
|
|
|
virtual void InitializeController() override final;
|
|
|
|
virtual const FString GetName() override final { return FString("FastBuild Controller"); };
|
|
|
|
virtual bool IsSupported() override final;
|
|
|
|
virtual FString CreateUniqueFilePath() override final;
|
|
virtual TFuture<FDistributedBuildTaskResult> EnqueueTask(const FTaskCommandData& CommandData) override final;
|
|
void EnqueueTask(FTask* Task);
|
|
FTask* DequeueTask();
|
|
|
|
void RegisterDispatchedTask(FTask* DispatchedTask);
|
|
void ReEnqueueDispatchedTasks();
|
|
void DeRegisterDispatchedTasks(const TArray<uint32>& InTasksID);
|
|
void ReportJobProcessed(FTask* CompletedTask, const FTaskResponse& InTaskResponse);
|
|
|
|
static FFastBuildControllerModule& Get();
|
|
|
|
inline bool AreTasksPending() const
|
|
{
|
|
FScopeLock Lock(TasksCS.Get());
|
|
return !PendingTasks.IsEmpty();
|
|
}
|
|
|
|
inline bool AreTasksDispatched() const
|
|
{
|
|
FScopeLock Lock(TasksCS.Get());
|
|
return DispatchedTasks.Num() > 0;
|
|
}
|
|
|
|
inline bool AreTasksDispatchedOrPending() const
|
|
{
|
|
FScopeLock Lock(TasksCS.Get());
|
|
return DispatchedTasks.Num() > 0 || !PendingTasks.IsEmpty();
|
|
}
|
|
|
|
int32 GetPendingTasksAmount() const { return PendingTasksCounter.GetValue();}
|
|
|
|
FString GetRootWorkingDirectory() const { return RootWorkingDirectory;}
|
|
|
|
FString GetWorkingDirectory() const { return WorkingDirectory;}
|
|
|
|
const TMap<uint32, FTask*>& GetDispatchedTasks() const
|
|
{
|
|
return DispatchedTasks;
|
|
}
|
|
|
|
FCriticalSection* GetTasksCS() const
|
|
{
|
|
return TasksCS.Get();
|
|
}
|
|
}; |