diff options
Diffstat (limited to 'src/common/settings.h')
| -rw-r--r-- | src/common/settings.h | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 9ff4cf85d..42f8b4a7d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -52,6 +52,56 @@ enum class NvdecEmulation : u32 { | |||
| 52 | GPU = 2, | 52 | GPU = 2, |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | enum class ResolutionSetup : u32 { | ||
| 56 | Res1_2X = 0, | ||
| 57 | Res3_4X = 1, | ||
| 58 | Res1X = 2, | ||
| 59 | Res2X = 3, | ||
| 60 | Res3X = 4, | ||
| 61 | Res4X = 5, | ||
| 62 | Res5X = 6, | ||
| 63 | Res6X = 7, | ||
| 64 | }; | ||
| 65 | |||
| 66 | enum class ScalingFilter : u32 { | ||
| 67 | NearestNeighbor = 0, | ||
| 68 | Bilinear = 1, | ||
| 69 | Bicubic = 2, | ||
| 70 | Gaussian = 3, | ||
| 71 | ScaleForce = 4, | ||
| 72 | Fsr = 5, | ||
| 73 | LastFilter = Fsr, | ||
| 74 | }; | ||
| 75 | |||
| 76 | enum class AntiAliasing : u32 { | ||
| 77 | None = 0, | ||
| 78 | Fxaa = 1, | ||
| 79 | LastAA = Fxaa, | ||
| 80 | }; | ||
| 81 | |||
| 82 | struct ResolutionScalingInfo { | ||
| 83 | u32 up_scale{1}; | ||
| 84 | u32 down_shift{0}; | ||
| 85 | f32 up_factor{1.0f}; | ||
| 86 | f32 down_factor{1.0f}; | ||
| 87 | bool active{}; | ||
| 88 | bool downscale{}; | ||
| 89 | |||
| 90 | s32 ScaleUp(s32 value) const { | ||
| 91 | if (value == 0) { | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | return std::max((value * static_cast<s32>(up_scale)) >> static_cast<s32>(down_shift), 1); | ||
| 95 | } | ||
| 96 | |||
| 97 | u32 ScaleUp(u32 value) const { | ||
| 98 | if (value == 0U) { | ||
| 99 | return 0U; | ||
| 100 | } | ||
| 101 | return std::max((value * up_scale) >> down_shift, 1U); | ||
| 102 | } | ||
| 103 | }; | ||
| 104 | |||
| 55 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | 105 | /** The BasicSetting class is a simple resource manager. It defines a label and default value |
| 56 | * alongside the actual value of the setting for simpler and less-error prone use with frontend | 106 | * alongside the actual value of the setting for simpler and less-error prone use with frontend |
| 57 | * configurations. Setting a default value and label is required, though subclasses may deviate from | 107 | * configurations. Setting a default value and label is required, though subclasses may deviate from |
| @@ -451,7 +501,10 @@ struct Values { | |||
| 451 | "disable_shader_loop_safety_checks"}; | 501 | "disable_shader_loop_safety_checks"}; |
| 452 | Setting<int> vulkan_device{0, "vulkan_device"}; | 502 | Setting<int> vulkan_device{0, "vulkan_device"}; |
| 453 | 503 | ||
| 454 | Setting<u16> resolution_factor{1, "resolution_factor"}; | 504 | ResolutionScalingInfo resolution_info{}; |
| 505 | Setting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; | ||
| 506 | Setting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; | ||
| 507 | Setting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"}; | ||
| 455 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 508 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 456 | // Default to exclusive fullscreen on these platforms for now. | 509 | // Default to exclusive fullscreen on these platforms for now. |
| 457 | RangedSetting<FullscreenMode> fullscreen_mode{ | 510 | RangedSetting<FullscreenMode> fullscreen_mode{ |
| @@ -462,7 +515,7 @@ struct Values { | |||
| 462 | #endif | 515 | #endif |
| 463 | FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; | 516 | FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; |
| 464 | RangedSetting<int> aspect_ratio{0, 0, 3, "aspect_ratio"}; | 517 | RangedSetting<int> aspect_ratio{0, 0, 3, "aspect_ratio"}; |
| 465 | RangedSetting<int> max_anisotropy{0, 0, 4, "max_anisotropy"}; | 518 | RangedSetting<int> max_anisotropy{0, 0, 5, "max_anisotropy"}; |
| 466 | Setting<bool> use_speed_limit{true, "use_speed_limit"}; | 519 | Setting<bool> use_speed_limit{true, "use_speed_limit"}; |
| 467 | RangedSetting<u16> speed_limit{100, 0, 9999, "speed_limit"}; | 520 | RangedSetting<u16> speed_limit{100, 0, 9999, "speed_limit"}; |
| 468 | Setting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; | 521 | Setting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; |
| @@ -595,6 +648,8 @@ std::string GetTimeZoneString(); | |||
| 595 | 648 | ||
| 596 | void LogSettings(); | 649 | void LogSettings(); |
| 597 | 650 | ||
| 651 | void UpdateRescalingInfo(); | ||
| 652 | |||
| 598 | // Restore the global state of all applicable settings in the Values struct | 653 | // Restore the global state of all applicable settings in the Values struct |
| 599 | void RestoreGlobalState(bool is_powered_on); | 654 | void RestoreGlobalState(bool is_powered_on); |
| 600 | 655 | ||