Files
UnrealEngineUWP/Engine/Source/Runtime/GameplayMediaEncoder/Private/GameplayMediaEncoderCommon.cpp
josh adams 019c12863e - Merging Dev-Kairos/Engine/... to Main/Engine/...
- Brings over the necessary engine changes for embedding UE4 mobile as a dylib/so in native mobile app
- Various changes for facial animation, screen recording, others
- ARKit and ARCore plugins were removed, as deemed "not ready"
#rb many people

#ROBOMERGE-OWNER: ryan.vance
#ROBOMERGE-AUTHOR: josh.adams
#ROBOMERGE-SOURCE: CL 5201138 via CL 5203024 via CL 5226277
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 5244512 by josh adams in Dev-VR branch]
2019-02-28 17:06:02 -05:00

83 lines
2.0 KiB
C++

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#include "GameplayMediaEncoderCommon.h"
#include "RHI.h"
#if WMFMEDIA_SUPPORTED_PLATFORM
#pragma comment(lib, "mfplat")
#pragma comment(lib, "mfuuid")
#pragma comment(lib, "Mfreadwrite")
#endif
GAMEPLAYMEDIAENCODER_START
//
// Windows only code
//
#if PLATFORM_WINDOWS
ID3D11Device* GetUE4DxDevice()
{
auto Device = static_cast<ID3D11Device*>(GDynamicRHI->RHIGetNativeDevice());
checkf(Device != nullptr, TEXT("Failed to get UE4's ID3D11Device"));
return Device;
}
#endif
//
// XboxOne only code
//
#if PLATFORM_XBOXONE
ID3D12Device* GetUE4DxDevice()
{
auto Device = static_cast<ID3D12Device*>(GDynamicRHI->RHIGetNativeDevice());
checkf(Device != nullptr, TEXT("Failed to get UE4's ID3D12Device"));
return Device;
}
#endif
// #RVF : Remove these once the code is production ready
TArray<FMemoryCheckpoint> gMemoryCheckpoints;
uint64 MemoryCheckpoint(const FString& Name)
{
#if PLATFORM_WINDOWS
return 0;
#else
TITLEMEMORYSTATUS TitleStatus;
TitleStatus.dwLength = sizeof(TitleStatus);
TitleMemoryStatus(&TitleStatus);
static uint64 PeakMemory = 0;
FMemoryCheckpoint Check;
Check.Name = Name;
uint64_t UsedPhysical = TitleStatus.ullLegacyUsed + TitleStatus.ullTitleUsed;
static uint64_t FirstUsedPhysical = UsedPhysical;
Check.UsedPhysicalMB = UsedPhysical / double(1024 * 1024);
Check.DeltaMB = 0;
Check.AccumulatedMB = (UsedPhysical - FirstUsedPhysical) / double(1024 * 1024);
if (gMemoryCheckpoints.Num())
{
Check.DeltaMB = Check.UsedPhysicalMB - gMemoryCheckpoints.Last().UsedPhysicalMB;
}
gMemoryCheckpoints.Add(Check);
return UsedPhysical;
#endif
}
void LogMemoryCheckpoints(const FString& Name)
{
UE_LOG(GameplayMediaEncoder, Log, TEXT("Memory breakdown: %s..."), *Name);
for (const FMemoryCheckpoint& a : gMemoryCheckpoints)
{
UE_LOG(GameplayMediaEncoder, Log, TEXT("%s: UsedPhysicalMB=%4.3f, DeltaMB=%4.3f, AccumulatedMB=%4.3f"),
*a.Name, a.UsedPhysicalMB, a.DeltaMB, a.AccumulatedMB);
}
}
GAMEPLAYMEDIAENCODER_END