You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Vulkan AMF support is currently unsupported and has been disabled. - Removed fatal error when trying to use AMF with Vulkan. #JIRA UE-133434 #rb Luke.Bermingham [FYI] Alejandro.Arango, Brandon Schaefer, Mattias.Jansson #preflight 61f882ed80608c7029a0add1 #ROBOMERGE-AUTHOR: aidan.possemiers #ROBOMERGE-SOURCE: CL 18803094 in //UE5/Release-5.0/... via CL 18803106 via CL 18821573 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545) [CL 18821656 by aidan possemiers in ue5-main branch]
78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
#include "VulkanRHIPrivate.h"
|
|
#include "VulkanRHIBridge.h"
|
|
|
|
#include "DynamicRHI.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("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();
|
|
|
|
VulkanRHIBridge::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);
|