Files
UnrealEngineUWP/Engine/Source/Programs/DerivedDataBuildWorker/Private/DerivedDataBuildWorker.cpp
zousar shaker f701ac3244 -Fix bug in the interpretation of mip offset in FTextureBuildFunction (it is offset into uncomrpessed data, not offset into compressed data)
-Added more metadata to the output of the texture export feature.
-Make FTextureBuildFunction stateless and abstract.  Now must be derived to produce an instantiable build function.
-Made PS5TextureFormat, TextureFormatOodle, and TextureFormatUncompressed modules depend on TextureBuild module and implement concrete derivatives of FTextureBuildFunction.
-Made PS5TextureFormat, TextureFormatOodle, and TextureFormatUncompressed modules register their build functions through an IBuildFunctionFactory for the lifetime of the module.
-Removed all public interface for the DerivedDataBuild{Loop, Worker} and have them just use the IBuildFunctionFactory modular feature to find all linked build functions.

#rb devin.doucette
#preflight 60acfb486905a60001c3cd29

#ROBOMERGE-SOURCE: CL 16448407 in //UE5/Main/... via CL 16448442
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Release-Engine-Staging) (v818-16446889)

[CL 16448447 by zousar shaker in ue5-release-engine-staging branch]
2021-05-25 10:39:09 -04:00

65 lines
2.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "CoreMinimal.h"
#include "Containers/Array.h"
#include "CoreTypes.h"
#include "DerivedDataBuildFunction.h"
#include "DerivedDataBuildFunctionFactory.h"
#include "DerivedDataBuildLoop.h"
#include "Features/IModularFeatures.h"
#include "Logging/LogMacros.h"
#include "Misc/ScopeExit.h"
#include "RequiredProgramMainCPPInclude.h"
DEFINE_LOG_CATEGORY_STATIC(LogDerivedDataBuildWorker, Log, All);
//////////////////////////////////////////////////////////////////////////
INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
{
FTaskTagScope Scope(ETaskTag::EGameThread);
FString CmdLine = FCommandLine::BuildFromArgV(nullptr, ArgC, ArgV, nullptr);
GEngineLoop.PreInit(*CmdLine);
// Make sure the engine is properly cleaned up whenever we exit this function
ON_SCOPE_EXIT
{
FEngineLoop::AppPreExit();
FEngineLoop::AppExit();
};
UE::DerivedData::FBuildLoop BuildLoop;
if (!BuildLoop.Init())
{
return 1;
}
TMap<FName, const UE::DerivedData::IBuildFunction*> BuildFunctions;
for (UE::DerivedData::IBuildFunctionFactory* FunctionFactory : IModularFeatures::Get().GetModularFeatureImplementations<UE::DerivedData::IBuildFunctionFactory>(UE::DerivedData::IBuildFunctionFactory::GetFeatureName()))
{
const UE::DerivedData::IBuildFunction& BuildFunction = FunctionFactory->GetFunction();
BuildFunctions.FindOrAdd(FName(BuildFunction.GetName())) = &BuildFunction;
}
BuildLoop.PerformBuilds([&] (FName FunctionName, UE::DerivedData::FBuildContext& BuildContext)
{
if (const UE::DerivedData::IBuildFunction** FoundFunc = BuildFunctions.Find(FunctionName))
{
const UE::DerivedData::IBuildFunction* BuildFunction = *FoundFunc;
UE_LOG(LogDerivedDataBuildWorker, Display, TEXT("Starting build function '%s'"), *FunctionName.ToString());
uint64 BuildStartTime = FPlatformTime::Cycles64();
BuildFunction->Build(BuildContext);
UE_LOG(LogDerivedDataBuildWorker, Display, TEXT("Completed in %fms"), FPlatformTime::ToMilliseconds64(FPlatformTime::Cycles64()-BuildStartTime));
return true;
}
UE_LOG(LogDerivedDataBuildWorker, Error, TEXT("Unknown build function: %s"), *FunctionName.ToString());
return false;
});
BuildLoop.Teardown();
return 0;
}