You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This can be enabled by modifying `UnrealEngine\Engine\Saved\UnrealBuildTool\BuildConfiguration.xml` like so:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<bShaderCompilerWorkerTrace>true</bShaderCompilerWorkerTrace>
</BuildConfiguration>
</Configuration>
- Added a build configuration xml value, `bShaderCompilerWorkerTrace`.
- Turning this on will set USE_SHADER_COMPILER_WORKER_TRACE=1
- Move the parameter -nothreading to be set when we launch the process instead of internally as an extra cmd line arg.
- Unreal Insights uses a separate thread to send events so threading support is needed for the program. When we have USE_SHADER_COMPILER_WORKER_TRACE enabled we need to turn off `-nothreading`.
- When USE_SHADER_COMPILER_WORKER_TRACE is enabled we pass in `-trace=default` to get CPU event markers.
- The SCW program needs to turn on the following defines to be able to perform CPU and memory traces:
ENABLE_LOW_LEVEL_MEM_TRACKER=1
UE_MEMORY_TAGS_TRACE_ENABLED=1
UE_TRACE_ENABLED=1
- Instrument Shader Compiler Worker with TRACE_CPUPROFILER_EVENT_SCOPE. This are no-ops when this is turned off.
todo: Make the shader compiler worker inherit the trace args from the main process it was launched from.
#rb Yuriy.ODonnell
#jira none
#preflight 634ef80269246074db9637c2
[CL 22625183 by Jason Nadro in ue5-main branch]
74 lines
2.9 KiB
C#
74 lines
2.9 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;
|
|
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
|
|
|
|
LaunchModuleName = "ShaderCompileWorker";
|
|
|
|
if (bUseXGEController && (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;
|
|
|
|
// 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");
|
|
|
|
// This removes another thread being created even when -nocrashreports is specified
|
|
GlobalDefinitions.Add("NOINITCRASHREPORTER=1");
|
|
|
|
if (bShaderCompilerWorkerTrace)
|
|
{
|
|
GlobalDefinitions.Add("ENABLE_LOW_LEVEL_MEM_TRACKER=1");
|
|
GlobalDefinitions.Add("UE_MEMORY_TAGS_TRACE_ENABLED=1");
|
|
GlobalDefinitions.Add("UE_TRACE_ENABLED=1");
|
|
}
|
|
}
|
|
}
|