Add a Toggle for CPU Inner invalidation

This commit is contained in:
Gamer64 2025-06-30 17:22:17 +02:00 committed by edendev
parent 7c3142f7e9
commit 92c38b97f7
7 changed files with 24 additions and 3 deletions

View file

@ -17,6 +17,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
RENDERER_USE_SPEED_LIMIT("use_speed_limit"), RENDERER_USE_SPEED_LIMIT("use_speed_limit"),
USE_FAST_CPU_TIME("use_fast_cpu_time"), USE_FAST_CPU_TIME("use_fast_cpu_time"),
USE_CUSTOM_CPU_TICKS("use_custom_cpu_ticks"), USE_CUSTOM_CPU_TICKS("use_custom_cpu_ticks"),
CPU_INNER_INVALIDATION("cpu_inner_invalidation"),
USE_DOCKED_MODE("use_docked_mode"), USE_DOCKED_MODE("use_docked_mode"),
USE_AUTO_STUB("use_auto_stub"), USE_AUTO_STUB("use_auto_stub"),
RENDERER_USE_DISK_SHADER_CACHE("use_disk_shader_cache"), RENDERER_USE_DISK_SHADER_CACHE("use_disk_shader_cache"),

View file

@ -638,6 +638,13 @@ abstract class SettingsItem(
max = 65535 max = 65535
) )
) )
put(
SwitchSetting(
BooleanSetting.CPU_INNER_INVALIDATION,
titleId = R.string.cpu_inner_invalidation,
descriptionId = R.string.cpu_inner_invalidation_description
)
)
put( put(
SwitchSetting( SwitchSetting(
BooleanSetting.RENDERER_REACTIVE_FLUSHING, BooleanSetting.RENDERER_REACTIVE_FLUSHING,

View file

@ -462,6 +462,7 @@ class SettingsFragmentPresenter(
add(IntSetting.FAST_CPU_TIME.key) add(IntSetting.FAST_CPU_TIME.key)
add(BooleanSetting.USE_CUSTOM_CPU_TICKS.key) add(BooleanSetting.USE_CUSTOM_CPU_TICKS.key)
add(IntSetting.CPU_TICKS.key) add(IntSetting.CPU_TICKS.key)
add(BooleanSetting.CPU_INNER_INVALIDATION.key)
add(BooleanSetting.USE_LRU_CACHE.key) add(BooleanSetting.USE_LRU_CACHE.key)
add(BooleanSetting.CORE_SYNC_CORE_SPEED.key) add(BooleanSetting.CORE_SYNC_CORE_SPEED.key)
add(IntSetting.MEMORY_LAYOUT.key) add(IntSetting.MEMORY_LAYOUT.key)

View file

@ -99,6 +99,8 @@
<string name="custom_cpu_ticks">Custom CPU Ticks</string> <string name="custom_cpu_ticks">Custom CPU Ticks</string>
<string name="custom_cpu_ticks_description">Set a custom value of CPU ticks. Higher values can increase performance, but may also cause the game to freeze. A range of 7721000 is recommended.</string> <string name="custom_cpu_ticks_description">Set a custom value of CPU ticks. Higher values can increase performance, but may also cause the game to freeze. A range of 7721000 is recommended.</string>
<string name="cpu_ticks">Ticks</string> <string name="cpu_ticks">Ticks</string>
<string name="cpu_inner_invalidation">CPU Inner Invalidation</string>
<string name="cpu_inner_invalidation_description">Ensures that any memory regions that are marked for invalidation get cleared from the cache. Reduces the performance, as long as invalidating memory regions takes up valuable processing time and CPU resources, and having it off may cause glitches on some games.</string>
<string name="fast_cpu_time">CPU Clock</string> <string name="fast_cpu_time">CPU Clock</string>
<string name="fast_cpu_time_description">Use Boost (1700MHz) to run at the Switch\'s highest native clock, or Fast (2000MHz) to run at 2x clock.</string> <string name="fast_cpu_time_description">Use Boost (1700MHz) to run at the Switch\'s highest native clock, or Fast (2000MHz) to run at 2x clock.</string>
<string name="memory_layout">Memory Layout</string> <string name="memory_layout">Memory Layout</string>

View file

@ -450,6 +450,7 @@ struct Values {
VramUsageMode::Aggressive, VramUsageMode::Aggressive,
"vram_usage_mode", "vram_usage_mode",
Category::RendererAdvanced}; Category::RendererAdvanced};
SwitchableSetting<bool> cpu_inner_invalidation{linkage, false, "cpu_inner_invalidation", Category::RendererAdvanced};
SwitchableSetting<bool> async_presentation{linkage, SwitchableSetting<bool> async_presentation{linkage,
#ifdef ANDROID #ifdef ANDROID
true, true,

View file

@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
#include "common/settings.h"
#include "video_core/cache_types.h" #include "video_core/cache_types.h"
#include "video_core/engines/fermi_2d.h" #include "video_core/engines/fermi_2d.h"
#include "video_core/gpu.h" #include "video_core/gpu.h"
@ -100,9 +101,11 @@ public:
VideoCommon::CacheType which = VideoCommon::CacheType::All) = 0; VideoCommon::CacheType which = VideoCommon::CacheType::All) = 0;
virtual void InnerInvalidation(std::span<const std::pair<DAddr, std::size_t>> sequences) { virtual void InnerInvalidation(std::span<const std::pair<DAddr, std::size_t>> sequences) {
/*for (const auto& [cpu_addr, size] : sequences) { if (Settings::values.cpu_inner_invalidation.GetValue()) {
for (const auto& [cpu_addr, size] : sequences) {
InvalidateRegion(cpu_addr, size); InvalidateRegion(cpu_addr, size);
}*/ }
}
} }
/// Notify rasterizer that any caches of the specified region are desync with guest /// Notify rasterizer that any caches of the specified region are desync with guest

View file

@ -250,6 +250,12 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent)
"of available video memory for performance. Has no effect on integrated graphics. " "of available video memory for performance. Has no effect on integrated graphics. "
"Aggressive mode may severely impact the performance of other applications such as " "Aggressive mode may severely impact the performance of other applications such as "
"recording software.")); "recording software."));
INSERT(Settings,
cpu_inner_invalidation,
tr("CPU Inner Invalidation"),
tr("Ensures that any memory regions that are marked for invalidation get cleared from the cache.\n"
"Reduces the performance, as long as invalidating memory regions takes up valuable processing "
"time and CPU resources, and having it off may cause glitches on some games."));
INSERT( INSERT(
Settings, Settings,
vsync_mode, vsync_mode,