HostDisplay: Remove parameters which get pulled from config
No point duplicating them.
This commit is contained in:
parent
43e959bdc9
commit
11ba87059e
|
@ -67,10 +67,8 @@ public:
|
|||
virtual bool HasRenderDevice() const = 0;
|
||||
virtual bool HasRenderSurface() const = 0;
|
||||
|
||||
virtual bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation) = 0;
|
||||
virtual bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation) = 0;
|
||||
virtual bool CreateRenderDevice(const WindowInfo& wi) = 0;
|
||||
virtual bool InitializeRenderDevice() = 0;
|
||||
virtual bool MakeRenderContextCurrent() = 0;
|
||||
virtual bool DoneRenderContextCurrent() = 0;
|
||||
virtual void DestroyRenderSurface() = 0;
|
||||
|
|
|
@ -649,14 +649,8 @@ bool NoGUIHost::AcquireHostDisplay(RenderAPI api)
|
|||
if (wi.has_value())
|
||||
{
|
||||
g_host_display = Host::CreateDisplayForAPI(api);
|
||||
if (g_host_display)
|
||||
{
|
||||
if (!g_host_display->CreateRenderDevice(wi.value(), g_settings.gpu_adapter, g_settings.gpu_use_debug_device,
|
||||
g_settings.gpu_threaded_presentation))
|
||||
{
|
||||
g_host_display.reset();
|
||||
}
|
||||
}
|
||||
if (g_host_display && !g_host_display->CreateRenderDevice(wi.value()))
|
||||
g_host_display.reset();
|
||||
}
|
||||
|
||||
if (g_host_display)
|
||||
|
@ -676,9 +670,7 @@ bool NoGUIHost::AcquireHostDisplay(RenderAPI api)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!g_host_display->MakeRenderContextCurrent() ||
|
||||
!g_host_display->InitializeRenderDevice(EmuFolders::Cache, g_settings.gpu_use_debug_device,
|
||||
g_settings.gpu_threaded_presentation) ||
|
||||
if (!g_host_display->MakeRenderContextCurrent() || !g_host_display->InitializeRenderDevice() ||
|
||||
!ImGuiManager::Initialize() || !CommonHost::CreateHostDisplayResources())
|
||||
{
|
||||
ImGuiManager::Shutdown();
|
||||
|
|
|
@ -162,8 +162,7 @@ bool MainWindow::createDisplay(bool fullscreen, bool render_to_main)
|
|||
|
||||
g_emu_thread->connectDisplaySignals(m_display_widget);
|
||||
|
||||
if (!g_host_display->CreateRenderDevice(wi.value(), g_settings.gpu_adapter, g_settings.gpu_use_debug_device,
|
||||
g_settings.gpu_threaded_presentation))
|
||||
if (!g_host_display->CreateRenderDevice(wi.value()))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to create host display device context."));
|
||||
destroyDisplayWidget(true);
|
||||
|
|
|
@ -732,9 +732,7 @@ bool EmuThread::acquireHostDisplay(RenderAPI api)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!g_host_display->MakeRenderContextCurrent() ||
|
||||
!g_host_display->InitializeRenderDevice(EmuFolders::Cache, g_settings.gpu_use_debug_device,
|
||||
g_settings.gpu_threaded_presentation) ||
|
||||
if (!g_host_display->MakeRenderContextCurrent() || !g_host_display->InitializeRenderDevice() ||
|
||||
!ImGuiManager::Initialize() || !CommonHost::CreateHostDisplayResources())
|
||||
{
|
||||
ImGuiManager::Shutdown();
|
||||
|
|
|
@ -38,15 +38,13 @@ bool RegTestHostDisplay::HasRenderSurface() const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RegTestHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool RegTestHostDisplay::CreateRenderDevice(const WindowInfo& wi)
|
||||
{
|
||||
m_window_info = wi;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RegTestHostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool RegTestHostDisplay::InitializeRenderDevice()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,10 +15,8 @@ public:
|
|||
bool HasRenderDevice() const override;
|
||||
bool HasRenderSurface() const override;
|
||||
|
||||
bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool CreateRenderDevice(const WindowInfo& wi) override;
|
||||
bool InitializeRenderDevice() override;
|
||||
|
||||
bool MakeRenderContextCurrent() override;
|
||||
bool DoneRenderContextCurrent() override;
|
||||
|
|
|
@ -197,11 +197,10 @@ void D3D11HostDisplay::SetVSync(bool enabled)
|
|||
m_vsync = enabled;
|
||||
}
|
||||
|
||||
bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi)
|
||||
{
|
||||
UINT create_flags = 0;
|
||||
if (debug_device)
|
||||
if (g_settings.gpu_use_debug_device)
|
||||
create_flags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
|
||||
ComPtr<IDXGIFactory> temp_dxgi_factory;
|
||||
|
@ -217,17 +216,17 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
}
|
||||
|
||||
u32 adapter_index;
|
||||
if (!adapter_name.empty())
|
||||
if (!g_settings.gpu_adapter.empty())
|
||||
{
|
||||
AdapterAndModeList adapter_info(GetAdapterAndModeList(temp_dxgi_factory.Get()));
|
||||
for (adapter_index = 0; adapter_index < static_cast<u32>(adapter_info.adapter_names.size()); adapter_index++)
|
||||
{
|
||||
if (adapter_name == adapter_info.adapter_names[adapter_index])
|
||||
if (g_settings.gpu_adapter == adapter_info.adapter_names[adapter_index])
|
||||
break;
|
||||
}
|
||||
if (adapter_index == static_cast<u32>(adapter_info.adapter_names.size()))
|
||||
{
|
||||
Log_WarningPrintf("Could not find adapter '%s', using first (%s)", std::string(adapter_name).c_str(),
|
||||
Log_WarningPrintf("Could not find adapter '%s', using first (%s)", g_settings.gpu_adapter.c_str(),
|
||||
adapter_info.adapter_names[0].c_str());
|
||||
adapter_index = 0;
|
||||
}
|
||||
|
@ -261,7 +260,7 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
return false;
|
||||
}
|
||||
|
||||
if (debug_device && IsDebuggerPresent())
|
||||
if (g_settings.gpu_use_debug_device && IsDebuggerPresent())
|
||||
{
|
||||
ComPtr<ID3D11InfoQueue> info;
|
||||
hr = m_device.As(&info);
|
||||
|
@ -321,8 +320,7 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
return true;
|
||||
}
|
||||
|
||||
bool D3D11HostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool D3D11HostDisplay::InitializeRenderDevice()
|
||||
{
|
||||
if (!CreateResources())
|
||||
return false;
|
||||
|
|
|
@ -30,10 +30,8 @@ public:
|
|||
bool HasRenderDevice() const override;
|
||||
bool HasRenderSurface() const override;
|
||||
|
||||
bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool CreateRenderDevice(const WindowInfo& wi) override;
|
||||
bool InitializeRenderDevice() override;
|
||||
|
||||
bool MakeRenderContextCurrent() override;
|
||||
bool DoneRenderContextCurrent() override;
|
||||
|
|
|
@ -142,8 +142,7 @@ void D3D12HostDisplay::SetVSync(bool enabled)
|
|||
m_vsync = enabled;
|
||||
}
|
||||
|
||||
bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi)
|
||||
{
|
||||
ComPtr<IDXGIFactory> temp_dxgi_factory;
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
|
@ -159,18 +158,18 @@ bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
}
|
||||
|
||||
u32 adapter_index;
|
||||
if (!adapter_name.empty())
|
||||
if (!g_settings.gpu_adapter.empty())
|
||||
{
|
||||
AdapterAndModeList adapter_info(GetAdapterAndModeList(temp_dxgi_factory.Get()));
|
||||
for (adapter_index = 0; adapter_index < static_cast<u32>(adapter_info.adapter_names.size()); adapter_index++)
|
||||
{
|
||||
if (adapter_name == adapter_info.adapter_names[adapter_index])
|
||||
if (g_settings.gpu_adapter == adapter_info.adapter_names[adapter_index])
|
||||
break;
|
||||
}
|
||||
if (adapter_index == static_cast<u32>(adapter_info.adapter_names.size()))
|
||||
{
|
||||
Log_WarningPrintf("Could not find adapter '%*s', using first (%s)", static_cast<int>(adapter_name.size()),
|
||||
adapter_name.data(), adapter_info.adapter_names[0].c_str());
|
||||
Log_WarningPrintf("Could not find adapter '%s', using first (%s)", g_settings.gpu_adapter.c_str(),
|
||||
adapter_info.adapter_names[0].c_str());
|
||||
adapter_index = 0;
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +179,7 @@ bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
adapter_index = 0;
|
||||
}
|
||||
|
||||
if (!D3D12::Context::Create(temp_dxgi_factory.Get(), adapter_index, debug_device))
|
||||
if (!D3D12::Context::Create(temp_dxgi_factory.Get(), adapter_index, g_settings.gpu_use_debug_device))
|
||||
return false;
|
||||
|
||||
if (FAILED(hr))
|
||||
|
@ -214,8 +213,7 @@ bool D3D12HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
|||
return true;
|
||||
}
|
||||
|
||||
bool D3D12HostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool D3D12HostDisplay::InitializeRenderDevice()
|
||||
{
|
||||
if (!CreateResources())
|
||||
return false;
|
||||
|
|
|
@ -32,10 +32,8 @@ public:
|
|||
bool HasRenderDevice() const override;
|
||||
bool HasRenderSurface() const override;
|
||||
|
||||
bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool CreateRenderDevice(const WindowInfo& wi) override;
|
||||
bool InitializeRenderDevice() override;
|
||||
|
||||
bool MakeRenderContextCurrent() override;
|
||||
bool DoneRenderContextCurrent() override;
|
||||
|
|
|
@ -281,8 +281,7 @@ bool OpenGLHostDisplay::HasRenderSurface() const
|
|||
return m_window_info.type != WindowInfo::Type::Surfaceless;
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool OpenGLHostDisplay::CreateRenderDevice(const WindowInfo& wi)
|
||||
{
|
||||
m_gl_context = GL::Context::Create(wi);
|
||||
if (!m_gl_context)
|
||||
|
@ -296,8 +295,7 @@ bool OpenGLHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_vie
|
|||
return true;
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool OpenGLHostDisplay::InitializeRenderDevice()
|
||||
{
|
||||
m_use_gles2_draw_path = (GetRenderAPI() == RenderAPI::OpenGLES && !GLAD_GL_ES_VERSION_3_0);
|
||||
if (!m_use_gles2_draw_path)
|
||||
|
@ -316,7 +314,7 @@ bool OpenGLHostDisplay::InitializeRenderDevice(std::string_view shader_cache_dir
|
|||
Log_VerbosePrintf("Using GLES2 draw path: %s", m_use_gles2_draw_path ? "yes" : "no");
|
||||
Log_VerbosePrintf("Using PBO for streaming: %s", m_use_pbo_for_pixels ? "yes" : "no");
|
||||
|
||||
if (debug_device && GLAD_GL_KHR_debug)
|
||||
if (g_settings.gpu_use_debug_device && GLAD_GL_KHR_debug)
|
||||
{
|
||||
if (GetRenderAPI() == RenderAPI::OpenGLES)
|
||||
glDebugMessageCallbackKHR(GLDebugCallback, nullptr);
|
||||
|
|
|
@ -23,10 +23,8 @@ public:
|
|||
bool HasRenderDevice() const override;
|
||||
bool HasRenderSurface() const override;
|
||||
|
||||
bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool CreateRenderDevice(const WindowInfo& wi) override;
|
||||
bool InitializeRenderDevice() override;
|
||||
|
||||
bool MakeRenderContextCurrent() override;
|
||||
bool DoneRenderContextCurrent() override;
|
||||
|
|
|
@ -214,17 +214,19 @@ void VulkanHostDisplay::SetVSync(bool enabled)
|
|||
m_swap_chain->SetVSync(enabled);
|
||||
}
|
||||
|
||||
bool VulkanHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool VulkanHostDisplay::CreateRenderDevice(const WindowInfo& wi)
|
||||
{
|
||||
WindowInfo local_wi(wi);
|
||||
if (!Vulkan::Context::Create(adapter_name, &local_wi, &m_swap_chain, threaded_presentation, debug_device, false))
|
||||
if (!Vulkan::Context::Create(g_settings.gpu_adapter, &local_wi, &m_swap_chain, g_settings.gpu_threaded_presentation,
|
||||
g_settings.gpu_use_debug_device, false))
|
||||
{
|
||||
Log_ErrorPrintf("Failed to create Vulkan context");
|
||||
m_window_info = {};
|
||||
return false;
|
||||
}
|
||||
|
||||
Vulkan::ShaderCache::Create(EmuFolders::Cache, SHADER_CACHE_VERSION, g_settings.gpu_use_debug_device);
|
||||
|
||||
m_is_adreno = (g_vulkan_context->GetDeviceProperties().vendorID == 0x5143 ||
|
||||
g_vulkan_context->GetDeviceDriverProperties().driverID == VK_DRIVER_ID_QUALCOMM_PROPRIETARY);
|
||||
|
||||
|
@ -232,11 +234,8 @@ bool VulkanHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_vie
|
|||
return true;
|
||||
}
|
||||
|
||||
bool VulkanHostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation)
|
||||
bool VulkanHostDisplay::InitializeRenderDevice()
|
||||
{
|
||||
Vulkan::ShaderCache::Create(shader_cache_directory, SHADER_CACHE_VERSION, debug_device);
|
||||
|
||||
if (!CreateResources())
|
||||
return false;
|
||||
|
||||
|
|
|
@ -27,10 +27,8 @@ public:
|
|||
bool HasRenderDevice() const override;
|
||||
bool HasRenderSurface() const override;
|
||||
|
||||
bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
|
||||
bool threaded_presentation) override;
|
||||
bool CreateRenderDevice(const WindowInfo& wi) override;
|
||||
bool InitializeRenderDevice() override;
|
||||
|
||||
bool MakeRenderContextCurrent() override;
|
||||
bool DoneRenderContextCurrent() override;
|
||||
|
|
Loading…
Reference in New Issue