Frontends: Pick best render API based on renderer

Stops unnecessary display recreation in big picture UI.
This commit is contained in:
Connor McLaughlin
2022-08-26 21:59:45 +10:00
parent 215cfd3daf
commit 1aa7facda8
24 changed files with 94 additions and 67 deletions

View File

@ -130,26 +130,26 @@ void CommonHost::PumpMessagesOnCPUThread()
#endif
}
std::unique_ptr<HostDisplay> Host::CreateDisplayForAPI(HostDisplay::RenderAPI api)
std::unique_ptr<HostDisplay> Host::CreateDisplayForAPI(RenderAPI api)
{
switch (api)
{
#ifdef WITH_VULKAN
case HostDisplay::RenderAPI::Vulkan:
case RenderAPI::Vulkan:
return std::make_unique<FrontendCommon::VulkanHostDisplay>();
#endif
#ifdef WITH_OPENGL
case HostDisplay::RenderAPI::OpenGL:
case HostDisplay::RenderAPI::OpenGLES:
case RenderAPI::OpenGL:
case RenderAPI::OpenGLES:
return std::make_unique<FrontendCommon::OpenGLHostDisplay>();
#endif
#ifdef _WIN32
case HostDisplay::RenderAPI::D3D12:
case RenderAPI::D3D12:
return std::make_unique<FrontendCommon::D3D12HostDisplay>();
case HostDisplay::RenderAPI::D3D11:
case RenderAPI::D3D11:
return std::make_unique<FrontendCommon::D3D11HostDisplay>();
#endif