diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-07-18 20:33:20 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:27 +0100 |
commit | 37ef9c913028e234509bcf70bad049b0210e4592 (patch) | |
tree | 4502ff26068fcbef55b36679c7afdc546182bf36 /src/common/settings.cpp | |
parent | VideoCore: Initial Setup for the Resolution Scaler. (diff) | |
download | yuzu-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 |
Diffstat (limited to 'src/common/settings.cpp')
-rw-r--r-- | src/common/settings.cpp | 51 |
1 files changed, 51 insertions, 0 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) { |