Files
UnrealEngineUWP/Engine/Source/Programs/ShaderCompileWorker/ShaderCompileWorker.Target.cs
Arciel Rekman 337e706273 Optimize shader compilation through XGE (bringing CL 11084076)
- Avoid directory scanning for .ini files by restoring already initialized config cache state on the workers
  - Avoid directory scanning for modules by restoring already initialized modulemanager state on the workers
  - Avoid directory scanning for external profilers DLLs by disabling the option in the build config
  - 20s -> 319ms of FEngineLoop::PreInit which was caused by directory scan through XGE remote filesystem
  - 5% -> 96% efficiency when computing the effective work against process total time for remotely built shaders
  - 5m36 ->1m26s to run "recompileshaders all" console command including waiting on async built shaders

#rb Danny.Couture (authored), Luke.Thatcher, Steve.Robb, Josh.Adams
[FYI] Bob.Tellez, Danny.Couture


#ROBOMERGE-OWNER: Arciel.Rekman
#ROBOMERGE-AUTHOR: arciel.rekman
#ROBOMERGE-SOURCE: CL 11106212 via CL 11106216
#ROBOMERGE-BOT: (v640-11091645)

[CL 11106241 by Arciel Rekman in Main branch]
2020-01-24 12:16:02 -05:00

68 lines
2.7 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.Collections.Generic;
using System.IO;
using UnrealBuildTool;
[SupportedPlatforms(UnrealPlatformClass.Editor)]
public class ShaderCompileWorkerTarget : TargetRules
{
public ShaderCompileWorkerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Program;
LinkType = TargetLinkType.Modular;
LaunchModuleName = "ShaderCompileWorker";
if (bUseXGEController && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64) && Configuration == UnrealTargetConfiguration.Development)
{
// The interception interface in XGE requires that the parent and child processes have different filenames on disk.
// To avoid building an entire separate worker just for this, we duplicate the ShaderCompileWorker in a post build step.
const string SrcPath = "$(EngineDir)\\Binaries\\$(TargetPlatform)\\ShaderCompileWorker.exe";
const string DestPath = "$(EngineDir)\\Binaries\\$(TargetPlatform)\\XGEControlWorker.exe";
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}", SrcPath, DestPath));
PostBuildSteps.Add(string.Format("copy /Y /B \"{0}\" /B \"{1}\" >nul:", SrcPath, DestPath));
AdditionalBuildProducts.Add(DestPath);
}
// Turn off various third party features we don't need
// Currently we force Lean and Mean mode
bBuildDeveloperTools = false;
// ShaderCompileWorker isn't localized, so doesn't need ICU
bCompileICU = false;
// Currently this app is not linking against the engine, so we'll compile out references from Core to the rest of the engine
bCompileAgainstEngine = false;
bCompileAgainstCoreUObject = false;
bBuildWithEditorOnlyData = true;
bCompileCEF3 = false;
if (Target.Configuration == UnrealTargetConfiguration.Debug)
{
bDebugBuildsActuallyUseDebugCRT = true;
}
// Never use malloc profiling in ShaderCompileWorker.
bUseMallocProfiler = false;
// Force all shader formats to be built and included.
bForceBuildShaderFormats = true;
// ShaderCompileWorker is a console application, not a Windows app (sets entry point to main(), instead of WinMain())
bIsBuildingConsoleApplication = true;
// Disable logging, as the workers are spawned often and logging will just slow them down
GlobalDefinitions.Add("ALLOW_LOG_FILE=0");
// Linking against wer.lib/wer.dll causes XGE to bail when the worker is run on a Windows 8 machine, so turn this off.
GlobalDefinitions.Add("ALLOW_WINDOWS_ERROR_REPORT_LIB=0");
// Disable external profiling in ShaderCompiler to improve startup time
GlobalDefinitions.Add("UE_EXTERNAL_PROFILING_ENABLED=0");
}
}