qt: Add toggle in the settings window for readbacks (#3305)

* Add readback and readback linear image toggles to the settings window

* reuse and crowdin

* clang-format... my worst enemy...

* Experimental group box (#3)

* New Groupbox

* adjustments

* revised warning on experimental group box

---------

Co-authored-by: rainmakerv2 <30595646+rainmakerv3@users.noreply.github.com>
This commit is contained in:
tomboylover93 2025-07-24 08:02:29 -03:00 committed by GitHub
parent 7ef0cc0698
commit 6a476fdb42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 126 additions and 48 deletions

View File

@ -415,6 +415,10 @@ void setReadbacks(bool enable) {
readbacksEnabled = enable;
}
void setReadbackLinearImages(bool enable) {
readbackLinearImagesEnabled = enable;
}
void setDirectMemoryAccess(bool enable) {
directMemoryAccessEnabled = enable;
}

View File

@ -54,6 +54,7 @@ void setCopyGPUCmdBuffers(bool enable);
bool readbacks();
void setReadbacks(bool enable);
bool readbackLinearImages();
void setReadbackLinearImages(bool enable);
bool directMemoryAccess();
void setDirectMemoryAccess(bool enable);
bool dumpShaders();

View File

@ -424,6 +424,8 @@ SettingsDialog::SettingsDialog(std::shared_ptr<gui_settings> gui_settings,
ui->hostMarkersCheckBox->installEventFilter(this);
ui->collectShaderCheckBox->installEventFilter(this);
ui->copyGPUBuffersCheckBox->installEventFilter(this);
ui->readbacksCheckBox->installEventFilter(this);
ui->readbackLinearImagesCheckBox->installEventFilter(this);
}
}
@ -542,6 +544,9 @@ void SettingsDialog::LoadValuesFromConfig() {
toml::find_or<bool>(data, "GPU", "copyGPUBuffers", false));
ui->collectShaderCheckBox->setChecked(
toml::find_or<bool>(data, "Debug", "CollectShader", false));
ui->readbacksCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "readbacks", false));
ui->readbackLinearImagesCheckBox->setChecked(
toml::find_or<bool>(data, "GPU", "readbackLinearImages", false));
ui->enableCompatibilityCheckBox->setChecked(
toml::find_or<bool>(data, "General", "compatibilityEnabled", false));
ui->checkCompatibilityOnStartupCheckBox->setChecked(
@ -758,6 +763,10 @@ void SettingsDialog::updateNoteTextEdit(const QString& elementName) {
text = tr("Copy GPU Buffers:\\nGets around race conditions involving GPU submits.\\nMay or may not help with PM4 type 0 crashes.");
} else if (elementName == "collectShaderCheckBox") {
text = tr("Collect Shaders:\\nYou need this enabled to edit shaders with the debug menu (Ctrl + F10).");
} else if (elementName == "readbacksCheckBox") {
text = tr("Enable Readbacks:\\nEnable GPU memory readbacks and writebacks.\\nThis is required for proper behavior in some games.\\nMight cause stability and/or performance issues.");
} else if (elementName == "readbackLinearImagesCheckBox") {
text = tr("Enable Readback Linear Images:\\nEnables async downloading of GPU modified linear images.\\nMight fix issues in some games.");
} else if (elementName == "separateLogFilesCheckbox") {
text = tr("Separate Log Files:\\nWrites a separate logfile for each game.");}
// clang-format on
@ -828,6 +837,8 @@ void SettingsDialog::UpdateSettings() {
Config::setVkHostMarkersEnabled(ui->hostMarkersCheckBox->isChecked());
Config::setVkGuestMarkersEnabled(ui->guestMarkersCheckBox->isChecked());
Config::setVkCrashDiagnosticEnabled(ui->crashDiagnosticsCheckBox->isChecked());
Config::setReadbacks(ui->readbacksCheckBox->isChecked());
Config::setReadbackLinearImages(ui->readbackLinearImagesCheckBox->isChecked());
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked());
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked());
m_gui_settings->SetValue(gui::gen_checkForUpdates, ui->updateCheckBox->isChecked());

View File

@ -73,8 +73,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="generalTabVLayout" stretch="0">
@ -369,8 +369,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>414</width>
<height>69</height>
<width>375</width>
<height>68</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
@ -538,8 +538,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="guiTabVLayout" stretch="0">
@ -987,8 +987,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="graphicsTabVLayout" stretch="0,0">
@ -1282,8 +1282,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="userTabVLayout" stretch="0,0,1">
@ -1524,8 +1524,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0,0">
@ -1789,8 +1789,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="pathsTabLayout">
@ -1931,8 +1931,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>944</width>
<height>537</height>
<width>946</width>
<height>540</height>
</rect>
</property>
<layout class="QVBoxLayout" name="debugTabVLayout" stretch="0,0">
@ -2088,58 +2088,58 @@
</layout>
</item>
<item>
<widget class="QGroupBox" name="advancedGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Advanced</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="advancedLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QGroupBox" name="advancedGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Advanced</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QVBoxLayout" name="advancedLayout">
<item>
<widget class="QCheckBox" name="collectShaderCheckBox">
<property name="text">
<string>Collect Shaders</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="copyGPUBuffersCheckBox">
<property name="text">
<string>Copy GPU Buffers</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QCheckBox" name="crashDiagnosticsCheckBox">
<property name="text">
<string>Enable Crash Diagnostics</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item>
<widget class="QCheckBox" name="copyGPUBuffersCheckBox">
<property name="text">
<string>Copy GPU Buffers</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hostMarkersCheckBox">
<property name="text">
<string>Host Debug Markers</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item>
<widget class="QCheckBox" name="guestMarkersCheckBox">
<property name="text">
<string>Guest Debug Markers</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QCheckBox" name="separateLogFilesCheckbox">
<property name="text">
<string>Separate Log Files</string>
@ -2147,9 +2147,55 @@
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="ExperimentalGroupBox">
<property name="title">
<string>Experimental Features</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="readbacksCheckBox">
<property name="text">
<string>Enable Readbacks</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="readbackLinearImagesCheckBox">
<property name="text">
<string>Enable Readback Linear Images</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="ExperimentalLabel">
<property name="font">
<font>
<pointsize>11</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>WARNING: These features are experimental and should not be enabled unless you were told to, or a game requires it. Please ask in the shadPS4 Discord server if you have any questions.</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
@ -2188,4 +2234,4 @@
<include location="../shadps4.qrc"/>
</resources>
<connections/>
</ui>
</ui>

View File

@ -1694,6 +1694,14 @@
<source>Guest Debug Markers</source>
<translation>Guest Debug Markers</translation>
</message>
<message>
<source>Enable Readbacks</source>
<translation>Enable Readbacks</translation>
</message>
<message>
<source>Enable Readback Linear Images</source>
<translation>Enable Readback Linear Images</translation>
</message>
<message>
<source>Update</source>
<translation>Update</translation>
@ -1922,6 +1930,14 @@
<source>Crash Diagnostics:\nCreates a .yaml file with info about the Vulkan state at the time of crashing.\nUseful for debugging &apos;Device lost&apos; errors. If you have this enabled, you should enable Host AND Guest Debug Markers.\nDoes not work on Intel GPUs.\nYou need Vulkan Validation Layers enabled and the Vulkan SDK for this to work.</source>
<translation>Crash Diagnostics:\nCreates a .yaml file with info about the Vulkan state at the time of crashing.\nUseful for debugging &apos;Device lost&apos; errors. If you have this enabled, you should enable Host AND Guest Debug Markers.\nDoes not work on Intel GPUs.\nYou need Vulkan Validation Layers enabled and the Vulkan SDK for this to work.</translation>
</message>
<message>
<source>Enable Readbacks:\nEnable GPU memory readbacks and writebacks.\nThis is required for proper behavior in some games.\nMight cause stability and/or performance issues.</source>
<translation>Enable Readbacks:\nEnable GPU memory readbacks and writebacks.\nThis is required for proper behavior in some games.\nMight cause stability and/or performance issues.</translation>
</message>
<message>
<source>Enable Readback Linear Images:\nEnables async downloading of GPU modified linear images.\nMight fix issues in some games.</source>
<translation>Enable Readback Linear Images:\nEnables async downloading of GPU modified linear images.\nMight fix issues in some games.</translation>
</message>
<message>
<source>Copy GPU Buffers:\nGets around race conditions involving GPU submits.\nMay or may not help with PM4 type 0 crashes.</source>
<translation>Copy GPU Buffers:\nGets around race conditions involving GPU submits.\nMay or may not help with PM4 type 0 crashes.</translation>