mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 05:05:46 -04:00
Frontends: Pick best render API based on renderer
Stops unnecessary display recreation in big picture UI.
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -59,9 +59,9 @@ D3D11HostDisplay::~D3D11HostDisplay()
|
||||
AssertMsg(!m_swap_chain, "Swap chain should have been destroyed by now");
|
||||
}
|
||||
|
||||
HostDisplay::RenderAPI D3D11HostDisplay::GetRenderAPI() const
|
||||
RenderAPI D3D11HostDisplay::GetRenderAPI() const
|
||||
{
|
||||
return HostDisplay::RenderAPI::D3D11;
|
||||
return RenderAPI::D3D11;
|
||||
}
|
||||
|
||||
void* D3D11HostDisplay::GetRenderDevice() const
|
||||
@ -1026,7 +1026,7 @@ bool D3D11HostDisplay::SetPostProcessingChain(const std::string_view& config)
|
||||
shader_cache.Open(EmuFolders::Cache, m_device->GetFeatureLevel(), SHADER_CACHE_VERSION,
|
||||
g_settings.gpu_use_debug_device);
|
||||
|
||||
FrontendCommon::PostProcessingShaderGen shadergen(HostDisplay::RenderAPI::D3D11, true);
|
||||
FrontendCommon::PostProcessingShaderGen shadergen(RenderAPI::D3D11, true);
|
||||
u32 max_ubo_size = 0;
|
||||
|
||||
for (u32 i = 0; i < m_post_processing_chain.GetStageCount(); i++)
|
||||
|
@ -60,9 +60,9 @@ D3D12HostDisplay::~D3D12HostDisplay()
|
||||
AssertMsg(!m_swap_chain, "Swap chain should have been destroyed by now");
|
||||
}
|
||||
|
||||
HostDisplay::RenderAPI D3D12HostDisplay::GetRenderAPI() const
|
||||
RenderAPI D3D12HostDisplay::GetRenderAPI() const
|
||||
{
|
||||
return HostDisplay::RenderAPI::D3D12;
|
||||
return RenderAPI::D3D12;
|
||||
}
|
||||
|
||||
void* D3D12HostDisplay::GetRenderDevice() const
|
||||
|
@ -44,7 +44,7 @@ OpenGLHostDisplay::~OpenGLHostDisplay()
|
||||
AssertMsg(!m_gl_context, "Context should have been destroyed by now");
|
||||
}
|
||||
|
||||
HostDisplay::RenderAPI OpenGLHostDisplay::GetRenderAPI() const
|
||||
RenderAPI OpenGLHostDisplay::GetRenderAPI() const
|
||||
{
|
||||
return m_gl_context->IsGLES() ? RenderAPI::OpenGLES : RenderAPI::OpenGL;
|
||||
}
|
||||
@ -947,7 +947,7 @@ bool OpenGLHostDisplay::SetPostProcessingChain(const std::string_view& config)
|
||||
|
||||
m_post_processing_stages.clear();
|
||||
|
||||
FrontendCommon::PostProcessingShaderGen shadergen(HostDisplay::RenderAPI::OpenGL, false);
|
||||
FrontendCommon::PostProcessingShaderGen shadergen(RenderAPI::OpenGL, false);
|
||||
|
||||
for (u32 i = 0; i < m_post_processing_chain.GetStageCount(); i++)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
||||
PostProcessingShaderGen::PostProcessingShaderGen(HostDisplay::RenderAPI render_api, bool supports_dual_source_blend)
|
||||
PostProcessingShaderGen::PostProcessingShaderGen(RenderAPI render_api, bool supports_dual_source_blend)
|
||||
: ShaderGen(render_api, supports_dual_source_blend)
|
||||
{
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace FrontendCommon {
|
||||
class PostProcessingShaderGen : public ShaderGen
|
||||
{
|
||||
public:
|
||||
PostProcessingShaderGen(HostDisplay::RenderAPI render_api, bool supports_dual_source_blend);
|
||||
PostProcessingShaderGen(RenderAPI render_api, bool supports_dual_source_blend);
|
||||
~PostProcessingShaderGen();
|
||||
|
||||
std::string GeneratePostProcessingVertexShader(const PostProcessingShader& shader);
|
||||
|
@ -55,9 +55,9 @@ VulkanHostDisplay::~VulkanHostDisplay()
|
||||
AssertMsg(!m_swap_chain, "Swap chain should have been destroyed by now");
|
||||
}
|
||||
|
||||
HostDisplay::RenderAPI VulkanHostDisplay::GetRenderAPI() const
|
||||
RenderAPI VulkanHostDisplay::GetRenderAPI() const
|
||||
{
|
||||
return HostDisplay::RenderAPI::Vulkan;
|
||||
return RenderAPI::Vulkan;
|
||||
}
|
||||
|
||||
void* VulkanHostDisplay::GetRenderDevice() const
|
||||
@ -950,7 +950,7 @@ bool VulkanHostDisplay::SetPostProcessingChain(const std::string_view& config)
|
||||
|
||||
m_post_processing_stages.clear();
|
||||
|
||||
FrontendCommon::PostProcessingShaderGen shadergen(HostDisplay::RenderAPI::Vulkan, false);
|
||||
FrontendCommon::PostProcessingShaderGen shadergen(RenderAPI::Vulkan, false);
|
||||
bool only_use_push_constants = true;
|
||||
|
||||
for (u32 i = 0; i < m_post_processing_chain.GetStageCount(); i++)
|
||||
|
Reference in New Issue
Block a user