-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt: Implement graphics window #5615
Conversation
Could you break this into separate commits, please? 1,700 LOC is a lot to review at once :( |
@ligfx I would. Except for the fact that reverting past commits that are buried under commits you don't want to touch, is not something I have figured out yet. |
Kinda bugs me that we went with a sidebar tab system for Config, but a topbar tab system for Graphics. Ultimately I don't really care enough for this to block this PR, but grr. |
@Helios747 I discussed this on |
Some small nitpicks: The backend/fullscreen res/aspect ratio etc settings are divided a bit differently than WX. And eeeh, it matches the other windows more so I don't really care. Just noting it. The hacks tab Texture Cache setting is missing the "Accuracy:" line. It's kind of important to say what safe and fast are related to! In the XFB section, please don't have XFB in the individual setting names, it's already stated at the top, and it's only there so users know what devs are talking about when they talk about XFB. Also, please place Virtual on the left, for the whole left is less right is more thing. And if you are about to say that Texture Cache Accuracy has more accurate to the left... you're right! And it bugs me. It should be the other way around. But if you just copy what WX does or address it, it's fine. Just don't make it worse please! @spycrab @Helios747 I don't think graphics should be integrated with the main settings, honestly, because divisions like that really help keep it from being intimidating. But that's an argument for another time! |
Source/Core/DolphinQt2/Settings.cpp
Outdated
return SConfig::GetInstance().bRenderToMain; | ||
} | ||
|
||
void Settings::SetRenderToMain(bool rendertomain) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/Settings.cpp
Outdated
return SConfig::GetInstance().bRenderWindowAutoSize; | ||
} | ||
|
||
void Settings::SetAutoadjustWindowSize(bool autoadjust) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/Settings.h
Outdated
@@ -70,10 +70,22 @@ class Settings final : public QSettings, NonCopyable | |||
|
|||
// Graphics | |||
bool GetRenderToMain() const; | |||
void SetRenderToMain(bool rendertomain); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
public: | ||
explicit GraphicsWidget(QWidget* parent); | ||
|
||
bool eventFilter(QObject* obj, QEvent* event); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
#include <QDir> | ||
#include <QFileDialog> | ||
#include <QIcon> | ||
#include <QMessageBox> | ||
|
||
#include <qpa/qplatformnativeinterface.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
// We need QObject::tr | ||
#if defined(_WIN32) | ||
static const QString TR_BACKEND_DESCRIPTION = | ||
tr("Selects what graphics API to use internally.\nThe software renderer is extremely " |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
QCheckBox* m_show_fps; | ||
QCheckBox* m_show_ping; | ||
QCheckBox* m_log_rendertime; | ||
QCheckBox* m_autoadjust_windowsize; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
// Options | ||
QCheckBox* m_show_fps; | ||
QCheckBox* m_show_ping; | ||
QCheckBox* m_log_rendertime; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
QCheckBox* m_show_messages; | ||
QCheckBox* m_keep_window_top; | ||
QCheckBox* m_hide_cursor; | ||
QCheckBox* m_render_mainwindow; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void HacksWidget::AddDescriptions() | ||
{ | ||
static const QString TR_SKIP_EFB_CPU_ACCESS_DESCRIPTION = | ||
tr("Ignore any requests from the CPU to read from or write to the EFB.\nImproves " |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
8d2eed6
to
ec40213
Compare
@@ -0,0 +1,73 @@ | |||
#include "VideoCommon/VideoUtils.h" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/VideoCommon/VideoUtils.h
Outdated
@@ -0,0 +1,15 @@ | |||
#pragma once |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/VideoCommon/VideoUtils.h
Outdated
|
||
namespace VideoUtils | ||
{ | ||
std::vector<std::string> GetAvailableResolutions(X11Utils::XRRConfiguration* xrr_config); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/VideoCommon/VideoUtils.h
Outdated
namespace VideoUtils | ||
{ | ||
std::vector<std::string> GetAvailableResolutions(X11Utils::XRRConfiguration* xrr_config); | ||
std::vector<std::string> GetAvailableAntialiasingModes(int& m_msaa_modes); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Source/Core/DolphinQt2/Settings.cpp
Outdated
return SConfig::GetInstance().bRenderToMain; | ||
} | ||
|
||
void Settings::SetRenderToMain(bool rendertomain) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
About textures, one small thing, keep in mind to make some space for the "Preload custom textures to VRAM" that I talked about with Stenzek, no I didn't mention to be an option at the time, but I can see it now that with bigger custom texture packs, it could be hitting over VRAM for some mid-to-lower end cards, certainly 3GB or lower of VRAM won't be enough for Hypatia's Zelda WW HD pack, which is at 3 GB (there's at least 150-300 MB VRAM overhead from browsers/desktop/etc) This option would would be more suited to be where the "Prefetch custom Textures" (to RAM) is, but now I seem to not agree where it is currently in 5.0 - Advanced Tab in the Utilities group, for some reason it just doesn't agree with my taste, since "dumping textures" and wireframe mode are more developer oriented things, but using the custom textures is meant for end users so it just doesn't fit imo. There should also be a debate wether to unify this "Prefetch custom textures to RAM/VRAM" from being two checkboxes to double radiobuttons in one line as in "Prefetch custom textures to: o RAM o VRAM" Also the current description should be updated, since Native custom texture support is here, there is no more exponential memory requirement. The exponential part should be removed and the sentence rewritten. Sidenote: "prefetching" more fits for usually system/OS cache stuff, the term "preload" may be more fitting as the textures become a solid part of the program and will never get flushed out in a session. TODO: Need to resolve potential conflict with "Texture Cache" ... |
m_graphics_window = new GraphicsWindow( | ||
this, | ||
new X11Utils::XRRConfiguration( | ||
static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
#include <QDir> | ||
#include <QFileDialog> | ||
#include <QIcon> | ||
#include <QMessageBox> | ||
|
||
#include <qpa/qplatformnativeinterface.h> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
{ | ||
Q_OBJECT | ||
public: | ||
explicit GraphicsWindow(QWidget* parent, X11Utils::XRRConfiguration* xrr_config); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
main_layout->addWidget(m_tab_widget); | ||
main_layout->addWidget(m_button_box); | ||
|
||
auto* general_widget = new GeneralWidget(this, m_xrr_config); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
ConnectWidgets(); | ||
|
||
setWindowTitle(tr("Graphics")); | ||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -0,0 +1,23 @@ | |||
// Copyright 2017 Dolphin Emulator Project |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
class QGroupBox; | ||
class QLabel; | ||
|
||
class GraphicsWidget : public QWidget |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@ZexaronS Please keep the bikeshedding away from Qt work, we're trying to get what we have in WX copied over to Qt, and bikeshedding subjective UI elements is a deathkneel for UI PRs! |
4edf65a
to
d5fd043
Compare
@MayImilae Implemented the changes you requested. |
478a230
to
86fcf42
Compare
void EnhancementsWidget::SaveSettings() | ||
{ | ||
bool is_ssaa = m_aa_combo->currentText().startsWith(QStringLiteral("SSAA")); | ||
g_Config.iMultisamples = m_aa_combo->currentIndex() - (is_ssaa ? m_msaa_modes : 0); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
bool is_ssaa = m_aa_combo->currentText().startsWith(QStringLiteral("SSAA")); | ||
g_Config.iMultisamples = m_aa_combo->currentIndex() - (is_ssaa ? m_msaa_modes : 0); | ||
|
||
g_Config.sPostProcessingShader = m_pp_effect->currentText().toStdString(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Sorry looks like there's another conflict? |
per irc there is some disagreement... |
Did you fix saving the wireframe option? It seems to be working now, and the info about it being broken could be removed. The only thing i don't like is the inconsistency on the spacing of the checkboxes, especially on the last tab. But that's not a blocker for me, it could be addressed later in another pr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall comments:
- A more appropriate place for the
BackendChanged
signals is in a model likeSettings
, rather than connecting all the views correctly (which is prone to mistakes). - The
XRRConfiguration
stuff still looks weird to me. I don't think non-X11 platforms should have to pass aroundXRRConfiguration
pointers, or even know they exist. - Signals sent from parent objects to children, like the EmulationStarted/Stopped signals, should be hooked up in the parents, not the children (happens in constructors).
- Rows and indices for
QGridLayout
should start at 0. - Labels before comboboxes and sliders need to be suffixed with colons.
- Lambdas that are used to drop arguments from signals can be replaced with direct pointer functions, since Qt knows how to drop arguments already.
- The common pattern
combobox->setCurrentIndex(combobox->findItem(text))
(or the variant, finding the item manually as part of a loop) can be replaced withcombobox->setCurrentText
.
|
||
m_enable_cropping = new GraphicsBool(tr("Crop"), Config::GFX_CROP); | ||
m_enable_prog_scan = new QCheckBox(tr("Enable Progressive Scan (Currently broken)")); | ||
m_borderless_fullscreen = |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
{ | ||
connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); | ||
connect(m_load_custom_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); | ||
connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
misc_box->setLayout(misc_layout); | ||
|
||
m_enable_cropping = new GraphicsBool(tr("Crop"), Config::GFX_CROP); | ||
m_enable_prog_scan = new QCheckBox(tr("Enable Progressive Scan (Currently broken)")); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
SConfig::GetInstance().bProgressive = m_enable_prog_scan->isChecked(); | ||
const auto hires_enabled = Config::Get(Config::GFX_HIRES_TEXTURES); | ||
m_prefetch_custom_textures->setEnabled(hires_enabled); | ||
if (!hires_enabled) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
void AdvancedWidget::OnBackendChanged() | ||
{ | ||
const auto supports_fr_framedumps = g_Config.backend_info.bSupportsInternalResolutionFrameDumps; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
void EnhancementsWidget::LoadSettings() | ||
{ | ||
m_block_save = true; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
GraphicsWidget::GraphicsWidget(GraphicsWindow* parent) | ||
{ | ||
parent->RegisterWidget(this); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
parent->RegisterWidget(this); | ||
} | ||
|
||
void GraphicsWidget::AddDescription(QWidget* widget, const char* description) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
||
// Video Section | ||
auto* m_video_box = new QGroupBox(tr("Video")); | ||
m_video_layout = new QFormLayout(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
void GraphicsWindow::OnBackendChanged(const QString& backend) | ||
{ | ||
setWindowTitle(tr("Dolphin %1 Graphics Configuration").arg(backend)); | ||
if (backend == QStringLiteral("Software Renderer") && m_tab_widget->count() > 1) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
e5d4b5c
to
eb30e29
Compare
@@ -0,0 +1,208 @@ | |||
// Copyright 2017 Dolphin5~ Emulator Project |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
16a5865
to
26f4845
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to ignore these comments if these modifications were done by Visual Studio itself. If so, I'll have to check my config. If not, revert them please otherwise they'll be reverted by anyone else using VS even if they aren't planning to modify these files.
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<?xml version="1.0" encoding="utf-8"?> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
</Project> |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Lets just get this merged, and iterations on it can be done in successive prs? This is looking to become the victim of bike shedding. |
@@ -0,0 +1,301 @@ | |||
// Copyright 2015~7 Dolphin Emulator Project |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Screenshots:
TODO:
Implement Shader Configuration Window (Low priority; Separate PR?)(Currently not testable on my end).Testing:
Test if every element has a descriptionCheck if there are any mistakes in those descriptionsCheck if all options behave as they should(All do except two; Though seemingly not the fault of this PR, has to be investigated)Check if you can crash Dolphin by changing certain settings