mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-01 15:02:40 +00:00
qt-gui: Added GPU device selection functionality
This commit is contained in:
parent
2ba3221fc9
commit
0bed4a91b9
@ -124,6 +124,10 @@ bool vkValidationGpuEnabled() {
|
|||||||
return vkValidationGpu;
|
return vkValidationGpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setGpuId(s32 selectedGpuId) {
|
||||||
|
gpuId = selectedGpuId;
|
||||||
|
}
|
||||||
|
|
||||||
void setScreenWidth(u32 width) {
|
void setScreenWidth(u32 width) {
|
||||||
screenWidth = width;
|
screenWidth = width;
|
||||||
}
|
}
|
||||||
@ -451,6 +455,7 @@ void setDefaultValues() {
|
|||||||
vkValidation = false;
|
vkValidation = false;
|
||||||
rdocEnable = false;
|
rdocEnable = false;
|
||||||
m_language = 1;
|
m_language = 1;
|
||||||
|
gpuId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Config
|
} // namespace Config
|
||||||
|
@ -36,6 +36,7 @@ void setNullGpu(bool enable);
|
|||||||
void setDumpShaders(bool enable);
|
void setDumpShaders(bool enable);
|
||||||
void setDumpPM4(bool enable);
|
void setDumpPM4(bool enable);
|
||||||
void setVblankDiv(u32 value);
|
void setVblankDiv(u32 value);
|
||||||
|
void setGpuId(s32 selectedGpuId);
|
||||||
void setScreenWidth(u32 width);
|
void setScreenWidth(u32 width);
|
||||||
void setScreenHeight(u32 height);
|
void setScreenHeight(u32 height);
|
||||||
void setFullscreenMode(bool enable);
|
void setFullscreenMode(bool enable);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#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"
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::SettingsDialog) {
|
SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::SettingsDialog) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -40,7 +41,10 @@ SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Se
|
|||||||
|
|
||||||
// GPU TAB
|
// GPU TAB
|
||||||
{
|
{
|
||||||
// TODO: Implement graphics device changing
|
// First options is auto selection -1, so gpuId on the GUI will always have to subtract 1
|
||||||
|
// when setting and add 1 when getting to select the correct gpu in Qt
|
||||||
|
connect(ui->graphicsAdapterBox, &QComboBox::currentIndexChanged, this,
|
||||||
|
[](int index) { Config::setGpuId(index - 1); });
|
||||||
|
|
||||||
connect(ui->widthSpinBox, &QSpinBox::valueChanged, this,
|
connect(ui->widthSpinBox, &QSpinBox::valueChanged, this,
|
||||||
[](int val) { Config::setScreenWidth(val); });
|
[](int val) { Config::setScreenWidth(val); });
|
||||||
@ -98,6 +102,16 @@ SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Se
|
|||||||
void SettingsDialog::LoadValuesFromConfig() {
|
void SettingsDialog::LoadValuesFromConfig() {
|
||||||
ui->consoleLanguageComboBox->setCurrentIndex(Config::GetLanguage());
|
ui->consoleLanguageComboBox->setCurrentIndex(Config::GetLanguage());
|
||||||
|
|
||||||
|
// Add list of available GPUs
|
||||||
|
ui->graphicsAdapterBox->addItem("Auto Select"); // -1, auto selection
|
||||||
|
Vulkan::Instance instance(false, false);
|
||||||
|
auto physical_devices = instance.GetPhysicalDevices();
|
||||||
|
for (const vk::PhysicalDevice physical_device : physical_devices) {
|
||||||
|
const QString name = QString::fromUtf8(physical_device.getProperties().deviceName, -1);
|
||||||
|
ui->graphicsAdapterBox->addItem(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->graphicsAdapterBox->setCurrentIndex(Config::getGpuId() + 1);
|
||||||
ui->widthSpinBox->setValue(Config::getScreenWidth());
|
ui->widthSpinBox->setValue(Config::getScreenWidth());
|
||||||
ui->heightSpinBox->setValue(Config::getScreenHeight());
|
ui->heightSpinBox->setValue(Config::getScreenHeight());
|
||||||
ui->vblankSpinBox->setValue(Config::vblankDiv());
|
ui->vblankSpinBox->setValue(Config::vblankDiv());
|
||||||
|
Loading…
Reference in New Issue
Block a user