summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2021-07-18 20:33:20 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 22:11:27 +0100
commit37ef9c913028e234509bcf70bad049b0210e4592 (patch)
tree4502ff26068fcbef55b36679c7afdc546182bf36
parentVideoCore: Initial Setup for the Resolution Scaler. (diff)
downloadyuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.gz
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.bz2
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.lz
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.xz
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.tar.zst
yuzu-37ef9c913028e234509bcf70bad049b0210e4592.zip
-rw-r--r--src/common/settings.cpp51
-rw-r--r--src/common/settings.h13
-rw-r--r--src/yuzu/configuration/config.cpp5
-rw-r--r--src/yuzu/configuration/config.h1
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp26
-rw-r--r--src/yuzu/configuration/configure_graphics.ui64
6 files changed, 155 insertions, 5 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 8c6be2c84..dd3a3d456 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -106,6 +106,57 @@ float Volume() {
return values.volume.GetValue() / 100.0f;
}
+void UpdateRescalingInfo() {
+ auto setup = values.resolution_setup.GetValue();
+ auto& info = values.resolution_info;
+ switch (setup) {
+ case ResolutionSetup::Res1_2X: {
+ info.up_scale = 1;
+ info.down_shift = 1;
+ break;
+ }
+ case ResolutionSetup::Res3_4X: {
+ info.up_scale = 3;
+ info.down_shift = 2;
+ break;
+ }
+ case ResolutionSetup::Res1X: {
+ info.up_scale = 1;
+ info.down_shift = 0;
+ break;
+ }
+ case ResolutionSetup::Res3_2X: {
+ info.up_scale = 3;
+ info.down_shift = 1;
+ break;
+ }
+ case ResolutionSetup::Res2X: {
+ info.up_scale = 2;
+ info.down_shift = 0;
+ break;
+ }
+ case ResolutionSetup::Res3X: {
+ info.up_scale = 3;
+ info.down_shift = 0;
+ break;
+ }
+ case ResolutionSetup::Res4X: {
+ info.up_scale = 4;
+ info.down_shift = 0;
+ break;
+ }
+ default: {
+ UNREACHABLE();
+ info.up_scale = 1;
+ info.down_shift = 0;
+ }
+ }
+ info.up_factor = static_cast<f32>(info.up_scale) / (1U << info.down_shift);
+ info.down_factor = static_cast<f32>(1U << info.down_shift) / info.up_scale;
+ info.size_up = info.up_scale * info.up_scale;
+ info.size_shift = info.down_shift * 2;
+}
+
void RestoreGlobalState(bool is_powered_on) {
// If a game is running, DO NOT restore the global settings state
if (is_powered_on) {
diff --git a/src/common/settings.h b/src/common/settings.h
index 08f3da055..f4df2fc95 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -56,16 +56,19 @@ enum class ResolutionSetup : u32 {
Res1_2X = 0,
Res3_4X = 1,
Res1X = 2,
- Res3_2K = 3,
+ Res3_2X = 3,
Res2X = 4,
Res3X = 5,
+ Res4X = 6,
};
struct ResolutionScalingInfo {
- u32 up_scale{2};
+ u32 up_scale{1};
u32 down_shift{0};
- f32 up_factor{2.0f};
- f32 down_factor{0.5f};
+ f32 up_factor{1.0f};
+ f32 down_factor{1.0f};
+ u32 size_up{1};
+ u32 size_shift{0};
};
/** The BasicSetting class is a simple resource manager. It defines a label and default value
@@ -613,6 +616,8 @@ std::string GetTimeZoneString();
void LogSettings();
+void UpdateRescalingInfo();
+
// Restore the global state of all applicable settings in the Values struct
void RestoreGlobalState(bool is_powered_on);
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index faea5dda1..7ddc40b00 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -824,6 +824,7 @@ void Config::ReadRendererValues() {
ReadGlobalSetting(Settings::values.vulkan_device);
ReadGlobalSetting(Settings::values.fullscreen_mode);
ReadGlobalSetting(Settings::values.aspect_ratio);
+ ReadGlobalSetting(Settings::values.resolution_setup);
ReadGlobalSetting(Settings::values.max_anisotropy);
ReadGlobalSetting(Settings::values.use_speed_limit);
ReadGlobalSetting(Settings::values.speed_limit);
@@ -1364,6 +1365,10 @@ void Config::SaveRendererValues() {
static_cast<u32>(Settings::values.fullscreen_mode.GetDefault()),
Settings::values.fullscreen_mode.UsingGlobal());
WriteGlobalSetting(Settings::values.aspect_ratio);
+ WriteSetting(QString::fromStdString(Settings::values.resolution_setup.GetLabel()),
+ static_cast<u32>(Settings::values.resolution_setup.GetValue(global)),
+ static_cast<u32>(Settings::values.resolution_setup.GetDefault()),
+ Settings::values.resolution_setup.UsingGlobal());
WriteGlobalSetting(Settings::values.max_anisotropy);
WriteGlobalSetting(Settings::values.use_speed_limit);
WriteGlobalSetting(Settings::values.speed_limit);
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index a7f4a6720..fbb91d312 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -189,5 +189,6 @@ Q_DECLARE_METATYPE(Settings::CPUAccuracy);
Q_DECLARE_METATYPE(Settings::GPUAccuracy);
Q_DECLARE_METATYPE(Settings::FullscreenMode);
Q_DECLARE_METATYPE(Settings::NvdecEmulation);
+Q_DECLARE_METATYPE(Settings::ResolutionSetup);
Q_DECLARE_METATYPE(Settings::RendererBackend);
Q_DECLARE_METATYPE(Settings::ShaderBackend);
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 8e20cc6f3..4f08ae3e0 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -102,6 +102,8 @@ void ConfigureGraphics::SetConfiguration() {
ui->nvdec_emulation->setCurrentIndex(
static_cast<int>(Settings::values.nvdec_emulation.GetValue()));
ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue());
+ ui->resolution_combobox->setCurrentIndex(
+ static_cast<int>(Settings::values.resolution_setup.GetValue()));
} else {
ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend);
ConfigurationShared::SetHighlight(ui->api_widget,
@@ -122,6 +124,11 @@ void ConfigureGraphics::SetConfiguration() {
ConfigurationShared::SetHighlight(ui->ar_label,
!Settings::values.aspect_ratio.UsingGlobal());
+ ConfigurationShared::SetPerGameSetting(ui->resolution_combobox,
+ &Settings::values.resolution_setup);
+ ConfigurationShared::SetHighlight(ui->resolution_label,
+ !Settings::values.resolution_setup.UsingGlobal());
+
ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1);
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
@@ -133,11 +140,14 @@ void ConfigureGraphics::SetConfiguration() {
}
void ConfigureGraphics::ApplyConfiguration() {
+ const auto resolution_setup = static_cast<Settings::ResolutionSetup>(
+ ui->resolution_combobox->currentIndex() -
+ ((Settings::IsConfiguringGlobal()) ? 0 : ConfigurationShared::USE_GLOBAL_OFFSET));
+
ConfigurationShared::ApplyPerGameSetting(&Settings::values.fullscreen_mode,
ui->fullscreen_mode_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.aspect_ratio,
ui->aspect_ratio_combobox);
-
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
ui->use_disk_shader_cache, use_disk_shader_cache);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation,
@@ -165,7 +175,16 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
}
+ if (Settings::values.resolution_setup.UsingGlobal()) {
+ Settings::values.resolution_setup.SetValue(resolution_setup);
+ }
} else {
+ if (ui->resolution_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
+ Settings::values.resolution_setup.SetGlobal(true);
+ } else {
+ Settings::values.resolution_setup.SetGlobal(false);
+ Settings::values.resolution_setup.SetValue(resolution_setup);
+ }
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.renderer_backend.SetGlobal(true);
Settings::values.shader_backend.SetGlobal(true);
@@ -207,6 +226,7 @@ void ConfigureGraphics::ApplyConfiguration() {
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
}
}
+ Settings::UpdateRescalingInfo();
}
void ConfigureGraphics::changeEvent(QEvent* event) {
@@ -312,6 +332,7 @@ void ConfigureGraphics::SetupPerGameUI() {
ui->device->setEnabled(Settings::values.renderer_backend.UsingGlobal());
ui->fullscreen_mode_combobox->setEnabled(Settings::values.fullscreen_mode.UsingGlobal());
ui->aspect_ratio_combobox->setEnabled(Settings::values.aspect_ratio.UsingGlobal());
+ ui->resolution_combobox->setEnabled(Settings::values.resolution_setup.UsingGlobal());
ui->use_asynchronous_gpu_emulation->setEnabled(
Settings::values.use_asynchronous_gpu_emulation.UsingGlobal());
ui->nvdec_emulation->setEnabled(Settings::values.nvdec_emulation.UsingGlobal());
@@ -340,6 +361,9 @@ void ConfigureGraphics::SetupPerGameUI() {
ConfigurationShared::SetColoredComboBox(
ui->fullscreen_mode_combobox, ui->fullscreen_mode_label,
static_cast<int>(Settings::values.fullscreen_mode.GetValue(true)));
+ ConfigurationShared::SetColoredComboBox(
+ ui->resolution_combobox, ui->resolution_label,
+ static_cast<int>(Settings::values.resolution_setup.GetValue(true)));
ConfigurationShared::InsertGlobalItem(
ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true)));
ConfigurationShared::InsertGlobalItem(
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui
index beae74344..1b6ac3cbb 100644
--- a/src/yuzu/configuration/configure_graphics.ui
+++ b/src/yuzu/configuration/configure_graphics.ui
@@ -310,6 +310,70 @@
</widget>
</item>
<item>
+ <widget class="QWidget" name="resolution_layout" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="resolution_label">
+ <property name="text">
+ <string>Resolution:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="resolution_combobox">
+ <item>
+ <property name="text">
+ <string>0.5X (360p/540p)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>0.75X (540p/810p)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1X (720p/1080p)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>1.5X (1080p/1620p)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>2X (1440p/2160[4K]p)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>3X (2160p[4K]/3240p[6K])</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>4X (2880p/4320p[8K])</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QWidget" name="bg_layout" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">