merge from development

Signed-off-by: greerdv <greerdv@amazon.com>
This commit is contained in:
greerdv
2021-07-21 10:05:32 +01:00
109 changed files with 13840 additions and 14002 deletions
@@ -7,6 +7,7 @@
*/
#pragma once
#include <AzCore/Component/EntityId.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Memory/Memory.h>
@@ -7,6 +7,8 @@
*/
#pragma once
#include <AzCore/std/containers/stack.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
namespace UnitTest
@@ -8,6 +8,7 @@
#include <AzFramework/Visibility/OctreeSystemComponent.h>
#include <AzCore/Math/ShapeIntersection.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AzFramework
{
@@ -9,7 +9,12 @@
#pragma once
#include <AzCore/base.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/std/string/string.h>
namespace AZ
{
class ReflectContext;
} // namespace Az
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace AzFramework
@@ -6,6 +6,7 @@
*
*/
#include <AzCore/Console/IConsole.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/IO/SystemFile.h>
@@ -13,6 +14,9 @@
#include <Psapi.h>
AZ_CVAR(bool, ap_tether_lifetime, false, nullptr, AZ::ConsoleFunctorFlags::Null,
"If enabled, a parent process that launches the AP will terminate the AP on exit");
namespace AzFramework::AssetSystem::Platform
{
void AllowAssetProcessorToForeground()
@@ -100,6 +104,21 @@ namespace AzFramework::AssetSystem::Platform
fullLaunchCommand += '"';
}
// Create or retrieve the job handle associated with the asset processor
HANDLE apJob = nullptr;
if (ap_tether_lifetime)
{
apJob = ::CreateJobObjectA(nullptr, "AssetProcessorJob");
if (apJob && GetLastError() != ERROR_ALREADY_EXISTS)
{
// We're creating the job for the first time. Configure it to close child processes when this process exits.
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info = {};
info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
::SetInformationJobObject(apJob, JobObjectExtendedLimitInformation, &info, sizeof(info));
}
}
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
@@ -107,6 +126,14 @@ namespace AzFramework::AssetSystem::Platform
si.wShowWindow = SW_MINIMIZE;
PROCESS_INFORMATION pi;
return ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
bool createResult = ::CreateProcessA(nullptr, fullLaunchCommand.data(), nullptr, nullptr, FALSE, 0, nullptr, AZ::IO::FixedMaxPathString{ executableDirectory }.c_str(), &si, &pi) != 0;
if (ap_tether_lifetime && apJob && createResult)
{
// Save process and thread handle to terminate AP when the parent process exits
::AssignProcessToJobObject(apJob, pi.hProcess);
}
return createResult;
}
}