You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Adding IVulkanDynamicRHI interface for plugins that want to touch Vulkan resources/handles directly. - Modifying plugins that were using VulkanRHIPrivate.h to use the interface instead. - Removing plugin references to UE Modules and ThirdParty libraries that were only needed because they included the private RHI headers. - Removing VulkanRHI/Private from plugin include paths. - Deprecating VulkanRHIBridge and moved its functionality into the new interface. #jira none #rb jeannoe.morissette, mihnea.balta, robert.srinivasiah #preflight 62281ec531133a23da642007 #robomerge FNNC [CL 19320995 by christopher waters in ue5-main branch]
75 lines
1.8 KiB
C++
75 lines
1.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
#include "IVulkanDynamicRHI.h"
|
|
|
|
#include "Amf_Common.h"
|
|
#include "Amf_EncoderH264.h"
|
|
#include "VideoEncoderFactory.h"
|
|
|
|
#include "Misc/CoreDelegates.h"
|
|
|
|
class FAMFEncoderModule : public IModuleInterface
|
|
{
|
|
public:
|
|
void StartupModule()
|
|
{
|
|
using namespace AVEncoder;
|
|
if(FApp::CanEverRender())
|
|
{
|
|
FAmfCommon& AMF = FAmfCommon::Setup();
|
|
|
|
if(AMF.GetIsAvailable())
|
|
{
|
|
#if PLATFORM_WINDOWS
|
|
const TCHAR* DynamicRHIModuleName = GetSelectedDynamicRHIModuleName(false);
|
|
#elif PLATFORM_LINUX
|
|
const TCHAR* DynamicRHIModuleName = TEXT("VulkanRHI");
|
|
#endif
|
|
if(FString("VulkanRHI") == FString(DynamicRHIModuleName))
|
|
{
|
|
#if PLATFORM_WINDOWS || PLATFORM_LINUX
|
|
UE_LOG(LogEncoderAMF, Error, TEXT("Vulkan AMF is currently unsuported and has been disabled."));
|
|
return;
|
|
#endif
|
|
AMF.InitializeContext(ERHIInterfaceType::Vulkan, "Vulkan", NULL);
|
|
amf::AMFContext1Ptr pContext1(AMF.GetContext());
|
|
|
|
amf_size NumDeviceExtensions = 0;
|
|
pContext1->GetVulkanDeviceExtensions(&NumDeviceExtensions, nullptr);
|
|
|
|
TArray<const ANSICHAR*> ExtentionsToAdd;
|
|
ExtentionsToAdd.AddUninitialized(5);
|
|
|
|
pContext1->GetVulkanDeviceExtensions(&NumDeviceExtensions, ExtentionsToAdd.GetData());
|
|
|
|
AMF.DestroyContext();
|
|
|
|
IVulkanDynamicRHI::AddEnabledDeviceExtensionsAndLayers(ExtentionsToAdd, TArray<const ANSICHAR*>());
|
|
}
|
|
|
|
FCoreDelegates::OnPostEngineInit.AddLambda([]() {FVideoEncoderAmf_H264::Register(FVideoEncoderFactory::Get());});
|
|
|
|
AMFStarted = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
void ShutdownModule()
|
|
{
|
|
using namespace AVEncoder;
|
|
if(AMFStarted)
|
|
{
|
|
FAmfCommon& AMF = FAmfCommon::Setup();
|
|
AMF.Shutdown();
|
|
AMFStarted = false;
|
|
}
|
|
}
|
|
|
|
private:
|
|
bool AMFStarted = false;
|
|
};
|
|
|
|
IMPLEMENT_MODULE(FAMFEncoderModule, EncoderAMF);
|