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 "settings_dialog.h"
|
||||
|
||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||
#ifdef ENABLE_DISCORD_RPC
|
||||
#include "common/discord_rpc_handler.h"
|
||||
#endif
|
||||
|
@ -53,7 +52,6 @@ bool MainWindow::Init() {
|
|||
CreateConnects();
|
||||
SetLastUsedTheme();
|
||||
SetLastIconSizeBullet();
|
||||
GetPhysicalDevices();
|
||||
// show ui
|
||||
setMinimumSize(720, 405);
|
||||
std::string window_title = "";
|
||||
|
@ -368,19 +366,6 @@ void MainWindow::CheckUpdateMain(bool checkSave) {
|
|||
}
|
||||
#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() {
|
||||
connect(this, &MainWindow::WindowResized, this, &MainWindow::HandleResize);
|
||||
connect(ui->mw_searchbar, &QLineEdit::textChanged, this, &MainWindow::SearchGameTable);
|
||||
|
@ -421,7 +406,7 @@ void MainWindow::CreateConnects() {
|
|||
&MainWindow::StartGame);
|
||||
|
||||
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,
|
||||
&MainWindow::OnLanguageChanged);
|
||||
|
@ -454,7 +439,7 @@ void MainWindow::CreateConnects() {
|
|||
});
|
||||
|
||||
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,
|
||||
&MainWindow::OnLanguageChanged);
|
||||
|
|
|
@ -60,7 +60,6 @@ private:
|
|||
void toggleFullscreen();
|
||||
void CreateRecentGameActions();
|
||||
void CreateDockWindows();
|
||||
void GetPhysicalDevices();
|
||||
void LoadGameLists();
|
||||
|
||||
#ifdef ENABLE_UPDATER
|
||||
|
@ -96,8 +95,6 @@ private:
|
|||
QScopedPointer<ElfViewer> m_elf_viewer;
|
||||
// Status Bar.
|
||||
QScopedPointer<QStatusBar> statusBar;
|
||||
// Available GPU devices
|
||||
std::vector<QString> m_physical_devices;
|
||||
|
||||
PSF psf;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <vector>
|
||||
#include <QCompleter>
|
||||
#include <QDirIterator>
|
||||
#include <QFileDialog>
|
||||
|
@ -25,6 +26,7 @@
|
|||
#include "common/logging/filter.h"
|
||||
#include "settings_dialog.h"
|
||||
#include "ui_settings_dialog.h"
|
||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||
QStringList languageNames = {"Arabic",
|
||||
"Czech",
|
||||
"Danish",
|
||||
|
@ -67,8 +69,9 @@ QMap<QString, QString> chooseHomeTabMap;
|
|||
int backgroundImageOpacitySlider_backup;
|
||||
int bgm_volume_backup;
|
||||
|
||||
SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||
static std::vector<QString> m_physical_devices;
|
||||
|
||||
SettingsDialog::SettingsDialog(std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||
QWidget* parent)
|
||||
: QDialog(parent), ui(new Ui::SettingsDialog) {
|
||||
ui->setupUi(this);
|
||||
|
@ -89,9 +92,23 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
|
|||
{tr("Input"), "Input"}, {tr("Paths"), "Paths"},
|
||||
{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
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ class SettingsDialog;
|
|||
class SettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsDialog(std::span<const QString> physical_devices,
|
||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||
explicit SettingsDialog(std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||
QWidget* parent = nullptr);
|
||||
~SettingsDialog();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue