Files
UnrealEngineUWP/Engine/Plugins/Media/HardwareEncoders/Source/EncoderNVENC/Private/NVENC_EncoderModule.cpp
christopher waters 2a8f9987cb Adding minimal interface to VulkanRHI
- 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]
2022-03-09 11:16:51 -05:00

48 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Modules/ModuleManager.h"
#include "IVulkanDynamicRHI.h"
#include "NVENC_Common.h"
#include "NVENC_EncoderH264.h"
#include "VideoEncoderFactory.h"
#include "Misc/CoreDelegates.h"
class FNVENCEncoderModule : public IModuleInterface
{
public:
void StartupModule()
{
using namespace AVEncoder;
if (FApp::CanEverRender())
{
FNVENCCommon& NVENC = FNVENCCommon::Setup();
if (NVENC.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
const TArray<const ANSICHAR*> ExtentionsToAdd{ VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME };
#elif PLATFORM_LINUX
const TArray<const ANSICHAR*> ExtentionsToAdd{ VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME };
#endif
IVulkanDynamicRHI::AddEnabledDeviceExtensionsAndLayers(ExtentionsToAdd, TArray<const ANSICHAR*>());
}
FModuleManager::LoadModuleChecked<FCUDAModule>("CUDA").OnPostCUDAInit.AddLambda([]() {FVideoEncoderNVENC_H264::Register(FVideoEncoderFactory::Get());});
}
}
}
};
IMPLEMENT_MODULE(FNVENCEncoderModule, EncoderNVENC);