mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 15:05:47 -04:00
Settings: Add GPU adapter option and hook up to D3D11/Vulkan
This commit is contained in:
@ -59,11 +59,14 @@ bool D3D11HostDisplay::hasDeviceContext() const
|
||||
return m_interface.HasContext();
|
||||
}
|
||||
|
||||
bool D3D11HostDisplay::createDeviceContext(bool debug_device)
|
||||
bool D3D11HostDisplay::createDeviceContext(const QString& adapter_name, bool debug_device)
|
||||
{
|
||||
std::optional<WindowInfo> wi = getWindowInfo();
|
||||
if (!wi || !m_interface.CreateContextAndSwapChain(wi.value(), shouldUseFlipModelSwapChain(), debug_device))
|
||||
if (!wi || !m_interface.CreateContextAndSwapChain(wi.value(), adapter_name.toStdString(),
|
||||
shouldUseFlipModelSwapChain(), debug_device))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_window_width = static_cast<s32>(m_interface.GetSwapChainWidth());
|
||||
m_window_height = static_cast<s32>(m_interface.GetSwapChainHeight());
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
~D3D11HostDisplay();
|
||||
|
||||
bool hasDeviceContext() const override;
|
||||
bool createDeviceContext(bool debug_device) override;
|
||||
bool createDeviceContext(const QString& adapter_name, bool debug_device) override;
|
||||
bool initializeDeviceContext(std::string_view shader_cache_directory, bool debug_device) override;
|
||||
bool activateDeviceContext() override;
|
||||
void deactivateDeviceContext() override;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "mainwindow.h"
|
||||
#include "aboutdialog.h"
|
||||
#include "common/assert.h"
|
||||
#include "core/game_list.h"
|
||||
#include "core/settings.h"
|
||||
#include "core/system.h"
|
||||
#include "aboutdialog.h"
|
||||
#include "gamelistsettingswidget.h"
|
||||
#include "gamelistwidget.h"
|
||||
#include "gamepropertiesdialog.h"
|
||||
@ -69,7 +69,8 @@ bool MainWindow::confirmMessage(const QString& message)
|
||||
return (result == QMessageBox::Yes);
|
||||
}
|
||||
|
||||
void MainWindow::createDisplay(QThread* worker_thread, bool use_debug_device, bool fullscreen, bool render_to_main)
|
||||
void MainWindow::createDisplay(QThread* worker_thread, const QString& adapter_name, bool use_debug_device,
|
||||
bool fullscreen, bool render_to_main)
|
||||
{
|
||||
Assert(!m_host_display && !m_display_widget);
|
||||
Assert(!fullscreen || !render_to_main);
|
||||
@ -97,7 +98,7 @@ void MainWindow::createDisplay(QThread* worker_thread, bool use_debug_device, bo
|
||||
// we need the surface visible.. this might be able to be replaced with something else
|
||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
if (!m_host_display->createDeviceContext(use_debug_device))
|
||||
if (!m_host_display->createDeviceContext(adapter_name, use_debug_device))
|
||||
{
|
||||
reportError(tr("Failed to create host display device context."));
|
||||
return;
|
||||
|
@ -29,7 +29,8 @@ private Q_SLOTS:
|
||||
void reportError(const QString& message);
|
||||
void reportMessage(const QString& message);
|
||||
bool confirmMessage(const QString& message);
|
||||
void createDisplay(QThread* worker_thread, bool use_debug_device, bool fullscreen, bool render_to_main);
|
||||
void createDisplay(QThread* worker_thread, const QString& adapter_name, bool use_debug_device, bool fullscreen,
|
||||
bool render_to_main);
|
||||
void updateDisplay(QThread* worker_thread, bool fullscreen, bool render_to_main);
|
||||
void destroyDisplay();
|
||||
void focusDisplayWidget();
|
||||
|
@ -188,7 +188,7 @@ bool OpenGLHostDisplay::hasDeviceContext() const
|
||||
return static_cast<bool>(m_gl_context);
|
||||
}
|
||||
|
||||
bool OpenGLHostDisplay::createDeviceContext(bool debug_device)
|
||||
bool OpenGLHostDisplay::createDeviceContext(const QString& adapter_name, bool debug_device)
|
||||
{
|
||||
m_window_width = m_widget->scaledWindowWidth();
|
||||
m_window_height = m_widget->scaledWindowHeight();
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
~OpenGLHostDisplay();
|
||||
|
||||
bool hasDeviceContext() const override;
|
||||
bool createDeviceContext(bool debug_device) override;
|
||||
bool createDeviceContext(const QString& adapter_name, bool debug_device) override;
|
||||
bool initializeDeviceContext(std::string_view shader_cache_directory, bool debug_device) override;
|
||||
bool activateDeviceContext() override;
|
||||
void deactivateDeviceContext() override;
|
||||
|
@ -42,7 +42,7 @@ bool QtHostDisplay::hasDeviceContext() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QtHostDisplay::createDeviceContext(bool debug_device)
|
||||
bool QtHostDisplay::createDeviceContext(const QString& adapter_name, bool debug_device)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
class QString;
|
||||
class QThread;
|
||||
class QWidget;
|
||||
|
||||
@ -24,7 +25,7 @@ public:
|
||||
virtual void destroyWidget();
|
||||
|
||||
virtual bool hasDeviceContext() const;
|
||||
virtual bool createDeviceContext(bool debug_device);
|
||||
virtual bool createDeviceContext(const QString& adapter_name, bool debug_device);
|
||||
virtual bool initializeDeviceContext(std::string_view shader_cache_directory, bool debug_device);
|
||||
virtual bool activateDeviceContext();
|
||||
virtual void deactivateDeviceContext();
|
||||
|
@ -316,8 +316,8 @@ bool QtHostInterface::AcquireHostDisplay()
|
||||
Assert(!m_display);
|
||||
|
||||
m_is_rendering_to_main = getSettingValue("Main/RenderToMainWindow", true).toBool();
|
||||
emit createDisplayRequested(m_worker_thread, m_settings.gpu_use_debug_device, m_is_fullscreen,
|
||||
m_is_rendering_to_main);
|
||||
emit createDisplayRequested(m_worker_thread, QString::fromStdString(m_settings.gpu_adapter),
|
||||
m_settings.gpu_use_debug_device, m_is_fullscreen, m_is_rendering_to_main);
|
||||
Assert(m_display);
|
||||
|
||||
if (!getHostDisplay()->hasDeviceContext())
|
||||
|
@ -96,7 +96,8 @@ Q_SIGNALS:
|
||||
void emulationPaused(bool paused);
|
||||
void stateSaved(const QString& game_code, bool global, qint32 slot);
|
||||
void gameListRefreshed();
|
||||
void createDisplayRequested(QThread* worker_thread, bool use_debug_device, bool fullscreen, bool render_to_main);
|
||||
void createDisplayRequested(QThread* worker_thread, const QString& adapter_name, bool use_debug_device,
|
||||
bool fullscreen, bool render_to_main);
|
||||
void updateDisplayRequested(QThread* worker_thread, bool fullscreen, bool render_to_main);
|
||||
void focusDisplayWidgetRequested();
|
||||
void destroyDisplayRequested();
|
||||
|
@ -52,10 +52,10 @@ bool VulkanHostDisplay::hasDeviceContext() const
|
||||
return m_vulkan_display.HasContext();
|
||||
}
|
||||
|
||||
bool VulkanHostDisplay::createDeviceContext(bool debug_device)
|
||||
bool VulkanHostDisplay::createDeviceContext(const QString& adapter_name, bool debug_device)
|
||||
{
|
||||
std::optional<WindowInfo> wi = getWindowInfo();
|
||||
if (!wi || !m_vulkan_display.CreateContextAndSwapChain(wi.value(), debug_device))
|
||||
if (!wi || !m_vulkan_display.CreateContextAndSwapChain(wi.value(), adapter_name.toStdString(), debug_device))
|
||||
return false;
|
||||
|
||||
m_window_width = static_cast<s32>(m_vulkan_display.GetSwapChainWidth());
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
~VulkanHostDisplay();
|
||||
|
||||
bool hasDeviceContext() const override;
|
||||
bool createDeviceContext(bool debug_device) override;
|
||||
bool createDeviceContext(const QString& adapter_name, bool debug_device) override;
|
||||
bool initializeDeviceContext(std::string_view shader_cache_directory, bool debug_device) override;
|
||||
bool activateDeviceContext() override;
|
||||
void deactivateDeviceContext() override;
|
||||
|
Reference in New Issue
Block a user