Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/BuildTargetCommand.Automation.cs
Josh Adams cf651e0c63 Change 2898947 on 2016/03/08 by Mark.Satterthwaite
Move the Apple Driver Monitor stats into their own stat groups, DriverMonitor has the common stats, DriverMonitorAMD/Intel/Nvidia have the vendor/GPU specific stats. The Metal and OpenGL RHIs update the driver monitor stats group for the current GPU at the appropriate time.

Change 2898950 on 2016/03/08 by Mark.Satterthwaite

	More shader cache code documentation.

Change 2898952 on 2016/03/08 by Michael.Trepka

	Check GPU driver version and warn of bad drivers only on Windows

Change 2898964 on 2016/03/08 by Mark.Satterthwaite

	Only verify the vertex attribute layout for Metal in debug builds or when using development with the debug layer turned on. It reduces performance significantly and isn't all that helpful unless you are attempting to debug a mismatch.

Change 2898973 on 2016/03/08 by Mark.Satterthwaite

	Switch uniform buffers to managed memory on Mac as this is more appropriate for AMD & Nvidia GPUs.

Change 2898988 on 2016/03/08 by Mark.Satterthwaite

	Simplify MetalContext by having only one SubmitCommandsHint implementation.

Change 2899011 on 2016/03/08 by Mark.Satterthwaite

	Duplicate 4.11 CL #2898988:

	Proper fix for UE-25804 - we have to manually expand PF_G8 + SRGB to RGBA8_sRGB - this then fixes UE-27483.
	#jira UE-25804
	#jira UE-27483

Change 2899024 on 2016/03/08 by Mark.Satterthwaite

	Duplicate 4.11 CL #2887365 & CL #2887583:

	Allow InfiltratorDemoEditor under Metal to issue a query buffer reset without crashing - the function that switches to the new query buffer needs to reapply some of the draw-state so that future commands don't dereference nil.
	#jira UE-27513

	My earlier fix for UE-27513 overlooked various internal details that meant it wouldn't restore state correctly, would fail validation and could crash in a new place. This version will ensure that cached state is only reset when it is appropriate to do so and will restore it correct when doing a query buffer reset.
	#jira UE-27513

Change 2899418 on 2016/03/08 by Daniel.Lamb

	Added support for textboxes in the editor to convert uasset filenames into long package names. As this is more useful to the cooker and more portable for projects.
	#codereview Matt.Kuhlenschmidt
	#jira UE-27785

Change 2899419 on 2016/03/08 by Daniel.Lamb

	Added support for passing -opengl command through to launch on if the editor is started with it.
	#codereview Michael.Trepka

Change 2900846 on 2016/03/09 by Mark.Satterthwaite

	Reimplement Metal object lifetime tracking as stats in the stat-group, though the old system is maintained as a debug-only tool that could (and probably should) be extended to track over/under-release bugs. Currently the texture count will be distorted by texture SRVs so will need improvement but other stats should be reliable. In order to properly report the number of buffers the TResourcePool policy class must now define a FreeResource function, so I've added them to the appropriate places too.

Change 2900853 on 2016/03/09 by Mark.Satterthwaite

	Optimise away empty encoders that don't perform a clear operation on AMD & Intel, but not Nvidia or non-Mac Metal devices. This should slightly improve performance.

Change 2900927 on 2016/03/09 by Mark.Satterthwaite

	Implemented operation threshold submission of Metal command buffers to keep the GPU busier and not just idle waiting for the CPU. Whenever rhi.Metal.CommandBufferCommitThreshold is set to a value >0 and the current command buffer has >= draw/dispatch operations outstanding then the command-buffer will be committed at the next encoder boundary. The default value is 100 operations which is currently arbitrary and the feature can be disabled by setting the value to <= 0 in which case only explicit submissions will occur as previously.

Change 2901310 on 2016/03/09 by Mark.Satterthwaite

	Change OneColor clear shader setup so that it works with parallel encoding in Metal.

Change 2903002 on 2016/03/10 by Mark.Satterthwaite

	Instantiate the OneColor shaders once in Metal.

Change 2903274 on 2016/03/10 by Mark.Satterthwaite

	Remove more unnecessary parallel execution stalls from MetalRHI.

Change 2903402 on 2016/03/10 by Mark.Satterthwaite

	Implement Metal support for index buffer SRVs.

Change 2903419 on 2016/03/10 by Mark.Satterthwaite

	Always use Managed memory on Mac Metal for buffers.

Change 2905206 on 2016/03/11 by Mark.Satterthwaite

	Worked around UE-27818 "ElementalDemo Causes Invalid Rendering on AMD GPUs" - recent changes to allow mesh particles to write to velocity leave a texture-buffer unbound & then use a uniform value & an if-branch to guard against access but AMD's Mac GL driver notices that the buffer is referenced in the shader but not bound & promptly tries to fallback to Apple's S/W renderer regardless of what the uniform value is. That's legal behaviour for an OpenGL implementation so the C++ code has been changed to allocate and write the current transforms into the buffer for OpenGL when they wouldn't otherwise be provided. This is sufficient to avoid the problem without affecting any other API.

Change 2906217 on 2016/03/11 by Nick.Shin

	re-enabled http network file server
	it was disabled in CL: #2790193

	#jira UE-22166 HTML5 Cook on the fly will launch and then close browser

Change 2908203 on 2016/03/14 by Michael.Trepka

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform). Everything but SSF lib.

Change 2908553 on 2016/03/14 by Mark.Satterthwaite

	Force a submit & wait in Metal when contexts are being destroyed to prevent kernel panics in drivers which continue to process the now abandoned command-queue and encounter invalid resources (because we destroy them on shutdown).

Change 2908595 on 2016/03/14 by Michael.Trepka

	Fixed iOS compile error in MetalUniformBuffer.cpp

	#codereview Mark.Satterthwaite

Change 2910106 on 2016/03/15 by Mark.Satterthwaite

	Use a dispatch_semaphore not an FEvent for Metal free-list synchronisation as the dispatch_worker threads can't be properly setup for FStats and this causes problems.

Change 2910107 on 2016/03/15 by Mark.Satterthwaite

	Fix Metal reporting of GPU memory through the RHI as it is in bytes, not MB.

Change 2910138 on 2016/03/15 by Mark.Satterthwaite

	Properly retain/release dispatch_semaphore for Metal command buffer completion block & allow uniform buffer creation on parallel encoding thread.

Change 2911735 on 2016/03/16 by Nick.Shin

	housekeeping

	removing extra and inconsistant whitespace as well as making tabs & spaces consistant

[CL 2936662 by Josh Adams in Main branch]
2016-04-07 12:59:50 -04:00

242 lines
8.5 KiB
C#

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Reflection;
using System.Linq;
using AutomationTool;
using UnrealBuildTool;
[Help("Builds a target")]
[Help("Project", "Specify the project with the targets to build.")]
[Help("Target", "Specify a list of target descriptor files for the targets to build, separated by '+' characters (eg. -Target=Game+Client+Editor)")]
[Help("TargetPlatforms", "Specify a list of target platforms to build, separated by '+' characters (eg. -TargetPlatforms=Win32+Win64+IOS). Default is Win64.")]
[Help("Config", "Specify a list of target build configurations to build against, separated by '+' characters (eg. -Config=Debug+Test). Default is Development")]
class BuildTarget : BuildCommand
{
private ParamList<string> ParseParamList(string InArgument, string InDefault = null)
{
var ArgumentList = ParseParamValue(InArgument);
if (ArgumentList != null)
{
return new ParamList<string>(ArgumentList.Split('+'));
}
else if (!String.IsNullOrEmpty(InDefault))
{
return new ParamList<string>(InDefault);
}
return null;
}
public override void ExecuteBuild()
{
// get the project
var UProjectFileName = ParseParamValue("Project");
if (UProjectFileName == null)
{
throw new AutomationException("Project was not specified via the -project argument.");
}
// Get the list of targets
var TargetList = ParseParamList("Target");
if (TargetList == null)
{
throw new AutomationException("Target was not specified via the -target argument.");
}
// get the list of platforms
var PlatformList = ParseParamList("TargetPlatforms", "Win64");
List<UnrealTargetPlatform> TargetPlatforms = new List<UnrealTargetPlatform>();
foreach(string Platform in PlatformList)
{
TargetPlatforms.Add((UnrealTargetPlatform)Enum.Parse(typeof(UnrealTargetPlatform), Platform, true));
}
// get the list configurations
var ConfigList = ParseParamList("Config", "Development");
List<UnrealTargetConfiguration> ConfigsToBuild = new List<UnrealTargetConfiguration>();
foreach(string Config in ConfigList)
{
ConfigsToBuild.Add((UnrealTargetConfiguration)Enum.Parse(typeof(UnrealTargetConfiguration), Config, true));
}
// parse any extra parameters
bool bClean = ParseParam("Clean");
int WorkingCL = ParseParamInt("P4Change");
FileReference UProjectFileReference = new FileReference( UProjectFileName);
// add the targets to the agenda
// verify the targets and add them to the agenda
var Properties = ProjectUtils.GetProjectProperties(UProjectFileReference);
UE4Build.BuildAgenda Agenda = new UE4Build.BuildAgenda();
foreach (string Target in TargetList)
{
SingleTargetProperties TargetData;
if (!Properties.Targets.TryGetValue((TargetRules.TargetType)Enum.Parse(typeof(TargetRules.TargetType), Target), out TargetData))
{
throw new AutomationException("Project does not support specified target: {0}", Target);
}
foreach (UnrealTargetPlatform TargetPlatform in TargetPlatforms)
{
if (TargetData.Rules.SupportsPlatform(TargetPlatform))
{
List<UnrealTargetConfiguration> SupportedConfigurations = new List<UnrealTargetConfiguration>();
TargetData.Rules.GetSupportedConfigurations(ref SupportedConfigurations, true);
foreach (UnrealTargetConfiguration TargetConfig in ConfigsToBuild)
{
if (SupportedConfigurations.Contains(TargetConfig))
{
Agenda.AddTarget(TargetData.TargetName, TargetPlatform, TargetConfig, UProjectFileReference);
}
else
{
Log("{0} doesn't support the {1} configuration. It will not be built.", TargetData.TargetName, TargetConfig);
}
}
}
else
{
Log("{0} doesn't support the {1} platform. It will not be built.", TargetData.TargetName, TargetPlatform);
}
}
}
// build it
UE4Build Build = new UE4Build(this);
Build.Build(Agenda, InDeleteBuildProducts: bClean, InUpdateVersionFiles: WorkingCL > 0);
if (WorkingCL > 0) // only move UAT files if we intend to check in some build products
{
Build.AddUATFilesToBuildProducts();
}
UE4Build.CheckBuildProducts(Build.BuildProductFiles);
if (WorkingCL > 0)
{
// Sign everything we built
CodeSign.SignMultipleIfEXEOrDLL(this, Build.BuildProductFiles);
// Open files for add or edit
UE4Build.AddBuildProductsToChangelist(WorkingCL, Build.BuildProductFiles);
}
}
#region Build Command
/* public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1)
{
Log("********** BUILD COMMAND STARTED **********");
var UE4Build = new UE4Build(Command);
var Agenda = new UE4Build.BuildAgenda();
var CrashReportPlatforms = new HashSet<UnrealTargetPlatform>();
// Setup editor targets
if (Params.HasEditorTargets && !Params.Rocket)
{
// @todo Mac: proper platform detection
UnrealTargetPlatform EditorPlatform = HostPlatform.Current.HostEditorPlatform;
const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development;
CrashReportPlatforms.Add(EditorPlatform);
Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath);
if (Params.EditorTargets.Contains("UnrealHeaderTool") == false)
{
Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration);
}
if (Params.EditorTargets.Contains("ShaderCompileWorker") == false)
{
Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration);
}
if (Params.Pak && Params.EditorTargets.Contains("UnrealPak") == false)
{
Agenda.AddTargets(new string[] { "UnrealPak" }, EditorPlatform, EditorConfiguration);
}
if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false)
{
Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration);
}
}
// Setup cooked targets
if (Params.HasClientCookedTargets)
{
foreach (var BuildConfig in Params.ClientConfigsToBuild)
{
foreach (var ClientPlatform in Params.ClientTargetPlatforms)
{
CrashReportPlatforms.Add(ClientPlatform);
Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath);
}
}
}
if (Params.HasServerCookedTargets)
{
foreach (var BuildConfig in Params.ServerConfigsToBuild)
{
foreach (var ServerPlatform in Params.ServerTargetPlatforms)
{
CrashReportPlatforms.Add(ServerPlatform);
Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatform, BuildConfig, Params.CodeBasedUprojectPath);
}
}
}
if (!Params.NoBootstrapExe && !Params.Rocket)
{
UnrealBuildTool.UnrealTargetPlatform[] BootstrapPackagedGamePlatforms = { UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetPlatform.Win64 };
foreach(UnrealBuildTool.UnrealTargetPlatform BootstrapPackagedGamePlatform in BootstrapPackagedGamePlatforms)
{
if(Params.ClientTargetPlatforms.Contains(BootstrapPackagedGamePlatform))
{
Agenda.AddTarget("BootstrapPackagedGame", BootstrapPackagedGamePlatform, UnrealBuildTool.UnrealTargetConfiguration.Shipping);
}
}
}
if (Params.CrashReporter && !Params.Rocket)
{
foreach (var CrashReportPlatform in CrashReportPlatforms)
{
if (UnrealBuildTool.UnrealBuildTool.PlatformSupportsCrashReporter(CrashReportPlatform))
{
Agenda.AddTarget("CrashReportClient", CrashReportPlatform, UnrealTargetConfiguration.Shipping);
}
}
}
if (Params.HasProgramTargets && !Params.Rocket)
{
foreach (var BuildConfig in Params.ClientConfigsToBuild)
{
foreach (var ClientPlatform in Params.ClientTargetPlatforms)
{
Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath);
}
}
}
UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0);
if (WorkingCL > 0) // only move UAT files if we intend to check in some build products
{
UE4Build.AddUATFilesToBuildProducts();
}
UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles);
if (WorkingCL > 0)
{
// Sign everything we built
CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles);
// Open files for add or edit
UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles);
}
Log("********** BUILD COMMAND COMPLETED **********");
}*/
#endregion
}