diff options
| author | 2021-10-22 22:56:08 +0200 | |
|---|---|---|
| committer | 2021-11-16 22:11:32 +0100 | |
| commit | a96c9c803be9aca0b9775c37c1e77e13cca56c80 (patch) | |
| tree | 240ef01d27c9c69fae7af236d005c2e7f318e779 /src | |
| parent | Vulkan: Fix FXAA in AMD. (diff) | |
| download | yuzu-a96c9c803be9aca0b9775c37c1e77e13cca56c80.tar.gz yuzu-a96c9c803be9aca0b9775c37c1e77e13cca56c80.tar.xz yuzu-a96c9c803be9aca0b9775c37c1e77e13cca56c80.zip | |
Yuzu UI: Add button for Anti Alias
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/settings.h | 1 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 42 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 |
3 files changed, 45 insertions, 0 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index ca1c3c1aa..c7610ef1c 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -76,6 +76,7 @@ enum class ScalingFilter : u32 { | |||
| 76 | enum class AntiAliasing : u32 { | 76 | enum class AntiAliasing : u32 { |
| 77 | None = 0, | 77 | None = 0, |
| 78 | Fxaa = 1, | 78 | Fxaa = 1, |
| 79 | LastAA = Fxaa, | ||
| 79 | }; | 80 | }; |
| 80 | 81 | ||
| 81 | struct ResolutionScalingInfo { | 82 | struct ResolutionScalingInfo { |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 379bd0b17..d057dc889 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -774,6 +774,26 @@ void GMainWindow::InitializeWidgets() { | |||
| 774 | tas_label->setFocusPolicy(Qt::NoFocus); | 774 | tas_label->setFocusPolicy(Qt::NoFocus); |
| 775 | statusBar()->insertPermanentWidget(0, tas_label); | 775 | statusBar()->insertPermanentWidget(0, tas_label); |
| 776 | 776 | ||
| 777 | // setup AA button | ||
| 778 | aa_status_button = new QPushButton(); | ||
| 779 | aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); | ||
| 780 | aa_status_button->setFocusPolicy(Qt::NoFocus); | ||
| 781 | connect(aa_status_button, &QPushButton::clicked, [&] { | ||
| 782 | auto aa_mode = Settings::values.anti_aliasing.GetValue(); | ||
| 783 | if (aa_mode == Settings::AntiAliasing::LastAA) { | ||
| 784 | aa_mode = Settings::AntiAliasing::None; | ||
| 785 | } else { | ||
| 786 | aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1); | ||
| 787 | } | ||
| 788 | Settings::values.anti_aliasing.SetValue(aa_mode); | ||
| 789 | aa_status_button->setChecked(true); | ||
| 790 | UpdateAAText(); | ||
| 791 | }); | ||
| 792 | UpdateAAText(); | ||
| 793 | aa_status_button->setCheckable(true); | ||
| 794 | aa_status_button->setChecked(true); | ||
| 795 | statusBar()->insertPermanentWidget(0, aa_status_button); | ||
| 796 | |||
| 777 | // Setup Filter button | 797 | // Setup Filter button |
| 778 | filter_status_button = new QPushButton(); | 798 | filter_status_button = new QPushButton(); |
| 779 | filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); | 799 | filter_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); |
| @@ -800,6 +820,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 800 | } | 820 | } |
| 801 | UpdateFilterText(); | 821 | UpdateFilterText(); |
| 802 | filter_status_button->setCheckable(true); | 822 | filter_status_button->setCheckable(true); |
| 823 | filter_status_button->setChecked(true); | ||
| 803 | statusBar()->insertPermanentWidget(0, filter_status_button); | 824 | statusBar()->insertPermanentWidget(0, filter_status_button); |
| 804 | 825 | ||
| 805 | // Setup Dock button | 826 | // Setup Dock button |
| @@ -872,6 +893,11 @@ void GMainWindow::InitializeWidgets() { | |||
| 872 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan); | 893 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan); |
| 873 | } else { | 894 | } else { |
| 874 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); | 895 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); |
| 896 | const auto filter = Settings::values.scaling_filter.GetValue(); | ||
| 897 | if (filter == Settings::ScalingFilter::Fsr) { | ||
| 898 | Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor); | ||
| 899 | UpdateFilterText(); | ||
| 900 | } | ||
| 875 | } | 901 | } |
| 876 | 902 | ||
| 877 | system->ApplySettings(); | 903 | system->ApplySettings(); |
| @@ -3088,12 +3114,28 @@ void GMainWindow::UpdateFilterText() { | |||
| 3088 | } | 3114 | } |
| 3089 | } | 3115 | } |
| 3090 | 3116 | ||
| 3117 | void GMainWindow::UpdateAAText() { | ||
| 3118 | const auto aa_mode = Settings::values.anti_aliasing.GetValue(); | ||
| 3119 | switch (aa_mode) { | ||
| 3120 | case Settings::AntiAliasing::Fxaa: | ||
| 3121 | aa_status_button->setText(tr("FXAA")); | ||
| 3122 | break; | ||
| 3123 | case Settings::AntiAliasing::None: | ||
| 3124 | aa_status_button->setText(tr("NO AA")); | ||
| 3125 | break; | ||
| 3126 | default: | ||
| 3127 | aa_status_button->setText(tr("FXAA")); | ||
| 3128 | break; | ||
| 3129 | } | ||
| 3130 | } | ||
| 3131 | |||
| 3091 | void GMainWindow::UpdateStatusButtons() { | 3132 | void GMainWindow::UpdateStatusButtons() { |
| 3092 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); | 3133 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); |
| 3093 | renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == | 3134 | renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == |
| 3094 | Settings::RendererBackend::Vulkan); | 3135 | Settings::RendererBackend::Vulkan); |
| 3095 | UpdateGPUAccuracyButton(); | 3136 | UpdateGPUAccuracyButton(); |
| 3096 | UpdateFilterText(); | 3137 | UpdateFilterText(); |
| 3138 | UpdateAAText(); | ||
| 3097 | } | 3139 | } |
| 3098 | 3140 | ||
| 3099 | void GMainWindow::UpdateUISettings() { | 3141 | void GMainWindow::UpdateUISettings() { |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index d4d2f3d58..24633ff2d 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -303,6 +303,7 @@ private: | |||
| 303 | void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, | 303 | void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, |
| 304 | std::string_view gpu_vendor = {}); | 304 | std::string_view gpu_vendor = {}); |
| 305 | void UpdateFilterText(); | 305 | void UpdateFilterText(); |
| 306 | void UpdateAAText(); | ||
| 306 | void UpdateStatusBar(); | 307 | void UpdateStatusBar(); |
| 307 | void UpdateGPUAccuracyButton(); | 308 | void UpdateGPUAccuracyButton(); |
| 308 | void UpdateStatusButtons(); | 309 | void UpdateStatusButtons(); |
| @@ -338,6 +339,7 @@ private: | |||
| 338 | QPushButton* renderer_status_button = nullptr; | 339 | QPushButton* renderer_status_button = nullptr; |
| 339 | QPushButton* dock_status_button = nullptr; | 340 | QPushButton* dock_status_button = nullptr; |
| 340 | QPushButton* filter_status_button = nullptr; | 341 | QPushButton* filter_status_button = nullptr; |
| 342 | QPushButton* aa_status_button = nullptr; | ||
| 341 | QTimer status_bar_update_timer; | 343 | QTimer status_bar_update_timer; |
| 342 | 344 | ||
| 343 | std::unique_ptr<Config> config; | 345 | std::unique_ptr<Config> config; |