You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb Steve.Smith #fyi Jules.Blok, Ryan.Durand, Ben.Marsh [CL 17295935 by Rolando Caloca in ue5-main branch]
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "RHI.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "Android/AndroidApplication.h"
|
|
|
|
FDynamicRHI* PlatformCreateDynamicRHI()
|
|
{
|
|
FDynamicRHI* DynamicRHI = NULL;
|
|
|
|
// Load the dynamic RHI module.
|
|
IDynamicRHIModule* DynamicRHIModule = NULL;
|
|
ERHIFeatureLevel::Type RequestedFeatureLevel = ERHIFeatureLevel::Num;
|
|
FString GraphicsRHI;
|
|
|
|
if (FPlatformMisc::ShouldUseVulkan() || FPlatformMisc::ShouldUseDesktopVulkan())
|
|
{
|
|
// Vulkan is required, release the EGL created by FAndroidAppEntry::PlatformInit.
|
|
FAndroidAppEntry::ReleaseEGL();
|
|
|
|
DynamicRHIModule = &FModuleManager::LoadModuleChecked<IDynamicRHIModule>(TEXT("VulkanRHI"));
|
|
if (!DynamicRHIModule->IsSupported())
|
|
{
|
|
DynamicRHIModule = &FModuleManager::LoadModuleChecked<IDynamicRHIModule>(TEXT("OpenGLDrv"));
|
|
GraphicsRHI = TEXT("OpenGL");
|
|
}
|
|
else
|
|
{
|
|
RequestedFeatureLevel = FPlatformMisc::ShouldUseDesktopVulkan() ? ERHIFeatureLevel::SM5 : ERHIFeatureLevel::ES3_1;
|
|
GraphicsRHI = TEXT("Vulkan");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DynamicRHIModule = &FModuleManager::LoadModuleChecked<IDynamicRHIModule>(TEXT("OpenGLDrv"));
|
|
GraphicsRHI = TEXT("OpenGL");
|
|
}
|
|
|
|
if (!DynamicRHIModule->IsSupported())
|
|
{
|
|
|
|
// FMessageDialog::Open(EAppMsgType::Ok, TEXT("OpenGL 3.2 is required to run the engine."));
|
|
FPlatformMisc::RequestExit(1);
|
|
DynamicRHIModule = NULL;
|
|
}
|
|
|
|
if (DynamicRHIModule)
|
|
{
|
|
FApp::SetGraphicsRHI(GraphicsRHI);
|
|
// Create the dynamic RHI.
|
|
DynamicRHI = DynamicRHIModule->CreateRHI(RequestedFeatureLevel);
|
|
}
|
|
|
|
FPlatformMisc::UnlockAndroidWindow();
|
|
|
|
return DynamicRHI;
|
|
}
|