diff options
-rw-r--r-- | src/common/settings.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 11 | ||||
-rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm.cpp | 2 | ||||
-rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_instructions.h | 2 | ||||
-rw-r--r-- | src/shader_recompiler/frontend/maxwell/control_flow.cpp | 2 | ||||
-rw-r--r-- | src/shader_recompiler/object_pool.h | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 4 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.ui | 30 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 2 | ||||
-rw-r--r-- | src/yuzu_cmd/config.cpp | 1 | ||||
-rw-r--r-- | src/yuzu_cmd/default_ini.h | 4 |
13 files changed, 55 insertions, 9 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 32dfb1d9f..df1762d1b 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -339,6 +339,7 @@ struct Values { Setting<bool> use_nvdec_emulation{true, "use_nvdec_emulation"}; Setting<bool> accelerate_astc{true, "accelerate_astc"}; Setting<bool> use_vsync{true, "use_vsync"}; + BasicSetting<u16> fps_cap{1000, "fps_cap"}; BasicSetting<bool> disable_fps_limit{false, "disable_fps_limit"}; Setting<ShaderBackend> shader_backend{ShaderBackend::GLASM, "shader_backend"}; Setting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 1d810562f..941748970 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -307,11 +307,12 @@ void NVFlinger::Compose() { } s64 NVFlinger::GetNextTicks() const { - if (Settings::values.disable_fps_limit.GetValue()) { - return 0; - } - constexpr s64 max_hertz = 120LL; - return (1000000000 * (1LL << swap_interval)) / max_hertz; + static constexpr s64 max_hertz = 120LL; + + const auto& settings = Settings::values; + const bool unlocked_fps = settings.disable_fps_limit.GetValue(); + const s64 fps_cap = unlocked_fps ? static_cast<s64>(settings.fps_cap.GetValue()) : 1; + return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap); } } // namespace Service::NVFlinger diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index a5e8c9b6e..4ce1c4f54 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp @@ -350,7 +350,7 @@ std::string_view InputPrimitive(InputTopology topology) { case InputTopology::Lines: return "LINES"; case InputTopology::LinesAdjacency: - return "LINESS_ADJACENCY"; + return "LINES_ADJACENCY"; case InputTopology::Triangles: return "TRIANGLES"; case InputTopology::TrianglesAdjacency: diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h index f99c02848..c9db1c164 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#pragma once + #include <sirit/sirit.h> #include "common/common_types.h" diff --git a/src/shader_recompiler/frontend/maxwell/control_flow.cpp b/src/shader_recompiler/frontend/maxwell/control_flow.cpp index 1a954a509..efe457baa 100644 --- a/src/shader_recompiler/frontend/maxwell/control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/control_flow.cpp @@ -73,7 +73,7 @@ Token OpcodeToken(Opcode opcode) { return Token::PBK; case Opcode::PCNT: case Opcode::CONT: - return Token::PBK; + return Token::PCNT; case Opcode::PEXIT: case Opcode::EXIT: return Token::PEXIT; diff --git a/src/shader_recompiler/object_pool.h b/src/shader_recompiler/object_pool.h index f8b255b66..f3b12d04b 100644 --- a/src/shader_recompiler/object_pool.h +++ b/src/shader_recompiler/object_pool.h @@ -63,6 +63,7 @@ private: used_objects = std::exchange(rhs.used_objects, 0); num_objects = std::exchange(rhs.num_objects, 0); storage = std::move(rhs.storage); + return *this; } Chunk(Chunk&& rhs) noexcept diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 52b3ed02e..4d89b00e9 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -823,6 +823,7 @@ void Config::ReadRendererValues() { ReadGlobalSetting(Settings::values.bg_blue); if (global) { + ReadBasicSetting(Settings::values.fps_cap); ReadBasicSetting(Settings::values.renderer_debug); ReadBasicSetting(Settings::values.enable_nsight_aftermath); ReadBasicSetting(Settings::values.disable_shader_loop_safety_checks); @@ -1357,6 +1358,7 @@ void Config::SaveRendererValues() { WriteGlobalSetting(Settings::values.bg_blue); if (global) { + WriteBasicSetting(Settings::values.fps_cap); WriteBasicSetting(Settings::values.renderer_debug); WriteBasicSetting(Settings::values.enable_nsight_aftermath); WriteBasicSetting(Settings::values.disable_shader_loop_safety_checks); diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 18f25def6..d79d2e23e 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -48,6 +48,8 @@ void ConfigureGeneral::SetConfiguration() { ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); + ui->fps_cap->setValue(Settings::values.fps_cap.GetValue()); + ui->button_reset_defaults->setEnabled(runtime_lock); if (Settings::IsConfiguringGlobal()) { @@ -87,6 +89,8 @@ void ConfigureGeneral::ApplyConfiguration() { UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked(); + Settings::values.fps_cap.SetValue(ui->fps_cap->value()); + // Guard if during game and set to game-specific value if (Settings::values.use_frame_limit.UsingGlobal()) { Settings::values.use_frame_limit.SetValue(ui->toggle_frame_limit->checkState() == diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index bc7041090..bc3c4b481 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui @@ -52,6 +52,36 @@ </layout> </item> <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="fps_cap_label"> + <property name="text"> + <string>Framerate Cap</string> + </property> + <property name="toolTip"> + <string>Requires the use of the FPS Limiter Toggle hotkey to take effect.</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="fps_cap"> + <property name="suffix"> + <string>x</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>1000</number> + </property> + <property name="value"> + <number>500</number> + </property> + </widget> + </item> + </layout> + </item> + <item> <widget class="QCheckBox" name="use_multi_core"> <property name="text"> <string>Multicore CPU Emulation</string> diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index fef211707..1bc477c96 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -31,7 +31,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) } ui->backend->addItem(QStringLiteral("GLSL")); - ui->backend->addItem(tr("GLASM (NVIDIA Only)")); + ui->backend->addItem(tr("GLASM (Assembly Shaders, NVIDIA Only)")); ui->backend->addItem(QStringLiteral("SPIR-V (Experimental, Mesa Only)")); SetupPerGameUI(); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2f84ada73..3d747e8d9 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2919,7 +2919,7 @@ void GMainWindow::UpdateStatusBar() { } if (Settings::values.disable_fps_limit) { game_fps_label->setText( - tr("Game: %1 FPS (Limit off)").arg(results.average_game_fps, 0, 'f', 0)); + tr("Game: %1 FPS (Unlocked)").arg(results.average_game_fps, 0, 'f', 0)); } else { game_fps_label->setText(tr("Game: %1 FPS").arg(results.average_game_fps, 0, 'f', 0)); } diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 640d7d111..d4ca6bb57 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -457,6 +457,7 @@ void Config::ReadValues() { ReadSetting("Renderer", Settings::values.gpu_accuracy); ReadSetting("Renderer", Settings::values.use_asynchronous_gpu_emulation); ReadSetting("Renderer", Settings::values.use_vsync); + ReadSetting("Renderer", Settings::values.fps_cap); ReadSetting("Renderer", Settings::values.disable_fps_limit); ReadSetting("Renderer", Settings::values.shader_backend); ReadSetting("Renderer", Settings::values.use_asynchronous_shaders); diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index b7115b06a..b2b2095d1 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h @@ -299,6 +299,10 @@ bg_red = bg_blue = bg_green = +# Caps the unlocked framerate to a multiple of the title's target FPS. +# 1 - 1000: Target FPS multiple cap. 1000 (default) +fps_cap = + [Audio] # Which audio output engine to use. # auto (default): Auto-select |