mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-14 08:12:16 +00:00
qt: Delay physical device enumeration to settings open. (#2908)
Some checks are pending
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
This commit is contained in:
parent
3a090e988c
commit
c0562a6b1b
4 changed files with 23 additions and 25 deletions
|
@ -24,7 +24,6 @@
|
||||||
#include "main_window.h"
|
#include "main_window.h"
|
||||||
#include "settings_dialog.h"
|
#include "settings_dialog.h"
|
||||||
|
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
|
||||||
#ifdef ENABLE_DISCORD_RPC
|
#ifdef ENABLE_DISCORD_RPC
|
||||||
#include "common/discord_rpc_handler.h"
|
#include "common/discord_rpc_handler.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +52,6 @@ bool MainWindow::Init() {
|
||||||
CreateConnects();
|
CreateConnects();
|
||||||
SetLastUsedTheme();
|
SetLastUsedTheme();
|
||||||
SetLastIconSizeBullet();
|
SetLastIconSizeBullet();
|
||||||
GetPhysicalDevices();
|
|
||||||
// show ui
|
// show ui
|
||||||
setMinimumSize(720, 405);
|
setMinimumSize(720, 405);
|
||||||
std::string window_title = "";
|
std::string window_title = "";
|
||||||
|
@ -368,19 +366,6 @@ void MainWindow::CheckUpdateMain(bool checkSave) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MainWindow::GetPhysicalDevices() {
|
|
||||||
Vulkan::Instance instance(false, false);
|
|
||||||
auto physical_devices = instance.GetPhysicalDevices();
|
|
||||||
for (const vk::PhysicalDevice physical_device : physical_devices) {
|
|
||||||
auto prop = physical_device.getProperties();
|
|
||||||
QString name = QString::fromUtf8(prop.deviceName, -1);
|
|
||||||
if (prop.apiVersion < Vulkan::TargetVulkanApiVersion) {
|
|
||||||
name += tr(" * Unsupported Vulkan Version");
|
|
||||||
}
|
|
||||||
m_physical_devices.push_back(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::CreateConnects() {
|
void MainWindow::CreateConnects() {
|
||||||
connect(this, &MainWindow::WindowResized, this, &MainWindow::HandleResize);
|
connect(this, &MainWindow::WindowResized, this, &MainWindow::HandleResize);
|
||||||
connect(ui->mw_searchbar, &QLineEdit::textChanged, this, &MainWindow::SearchGameTable);
|
connect(ui->mw_searchbar, &QLineEdit::textChanged, this, &MainWindow::SearchGameTable);
|
||||||
|
@ -421,7 +406,7 @@ void MainWindow::CreateConnects() {
|
||||||
&MainWindow::StartGame);
|
&MainWindow::StartGame);
|
||||||
|
|
||||||
connect(ui->configureAct, &QAction::triggered, this, [this]() {
|
connect(ui->configureAct, &QAction::triggered, this, [this]() {
|
||||||
auto settingsDialog = new SettingsDialog(m_physical_devices, m_compat_info, this);
|
auto settingsDialog = new SettingsDialog(m_compat_info, this);
|
||||||
|
|
||||||
connect(settingsDialog, &SettingsDialog::LanguageChanged, this,
|
connect(settingsDialog, &SettingsDialog::LanguageChanged, this,
|
||||||
&MainWindow::OnLanguageChanged);
|
&MainWindow::OnLanguageChanged);
|
||||||
|
@ -454,7 +439,7 @@ void MainWindow::CreateConnects() {
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->settingsButton, &QPushButton::clicked, this, [this]() {
|
connect(ui->settingsButton, &QPushButton::clicked, this, [this]() {
|
||||||
auto settingsDialog = new SettingsDialog(m_physical_devices, m_compat_info, this);
|
auto settingsDialog = new SettingsDialog(m_compat_info, this);
|
||||||
|
|
||||||
connect(settingsDialog, &SettingsDialog::LanguageChanged, this,
|
connect(settingsDialog, &SettingsDialog::LanguageChanged, this,
|
||||||
&MainWindow::OnLanguageChanged);
|
&MainWindow::OnLanguageChanged);
|
||||||
|
|
|
@ -60,7 +60,6 @@ private:
|
||||||
void toggleFullscreen();
|
void toggleFullscreen();
|
||||||
void CreateRecentGameActions();
|
void CreateRecentGameActions();
|
||||||
void CreateDockWindows();
|
void CreateDockWindows();
|
||||||
void GetPhysicalDevices();
|
|
||||||
void LoadGameLists();
|
void LoadGameLists();
|
||||||
|
|
||||||
#ifdef ENABLE_UPDATER
|
#ifdef ENABLE_UPDATER
|
||||||
|
@ -96,8 +95,6 @@ private:
|
||||||
QScopedPointer<ElfViewer> m_elf_viewer;
|
QScopedPointer<ElfViewer> m_elf_viewer;
|
||||||
// Status Bar.
|
// Status Bar.
|
||||||
QScopedPointer<QStatusBar> statusBar;
|
QScopedPointer<QStatusBar> statusBar;
|
||||||
// Available GPU devices
|
|
||||||
std::vector<QString> m_physical_devices;
|
|
||||||
|
|
||||||
PSF psf;
|
PSF psf;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
#include "common/logging/filter.h"
|
#include "common/logging/filter.h"
|
||||||
#include "settings_dialog.h"
|
#include "settings_dialog.h"
|
||||||
#include "ui_settings_dialog.h"
|
#include "ui_settings_dialog.h"
|
||||||
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
QStringList languageNames = {"Arabic",
|
QStringList languageNames = {"Arabic",
|
||||||
"Czech",
|
"Czech",
|
||||||
"Danish",
|
"Danish",
|
||||||
|
@ -67,8 +69,9 @@ QMap<QString, QString> chooseHomeTabMap;
|
||||||
int backgroundImageOpacitySlider_backup;
|
int backgroundImageOpacitySlider_backup;
|
||||||
int bgm_volume_backup;
|
int bgm_volume_backup;
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
static std::vector<QString> m_physical_devices;
|
||||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
|
||||||
|
SettingsDialog::SettingsDialog(std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||||
QWidget* parent)
|
QWidget* parent)
|
||||||
: QDialog(parent), ui(new Ui::SettingsDialog) {
|
: QDialog(parent), ui(new Ui::SettingsDialog) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -89,9 +92,23 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||||
{tr("Input"), "Input"}, {tr("Paths"), "Paths"},
|
{tr("Input"), "Input"}, {tr("Paths"), "Paths"},
|
||||||
{tr("Debug"), "Debug"}};
|
{tr("Debug"), "Debug"}};
|
||||||
|
|
||||||
|
if (m_physical_devices.empty()) {
|
||||||
|
// Populate cache of physical devices.
|
||||||
|
Vulkan::Instance instance(false, false);
|
||||||
|
auto physical_devices = instance.GetPhysicalDevices();
|
||||||
|
for (const vk::PhysicalDevice physical_device : physical_devices) {
|
||||||
|
auto prop = physical_device.getProperties();
|
||||||
|
QString name = QString::fromUtf8(prop.deviceName, -1);
|
||||||
|
if (prop.apiVersion < Vulkan::TargetVulkanApiVersion) {
|
||||||
|
name += tr(" * Unsupported Vulkan Version");
|
||||||
|
}
|
||||||
|
m_physical_devices.push_back(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add list of available GPUs
|
// Add list of available GPUs
|
||||||
ui->graphicsAdapterBox->addItem(tr("Auto Select")); // -1, auto selection
|
ui->graphicsAdapterBox->addItem(tr("Auto Select")); // -1, auto selection
|
||||||
for (const auto& device : physical_devices) {
|
for (const auto& device : m_physical_devices) {
|
||||||
ui->graphicsAdapterBox->addItem(device);
|
ui->graphicsAdapterBox->addItem(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@ class SettingsDialog;
|
||||||
class SettingsDialog : public QDialog {
|
class SettingsDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SettingsDialog(std::span<const QString> physical_devices,
|
explicit SettingsDialog(std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
|
||||||
QWidget* parent = nullptr);
|
QWidget* parent = nullptr);
|
||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue