From f706427815e08fd2fb4b0b49d9f5f9a76a1222b2 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Thu, 1 May 2025 15:56:17 +1000 Subject: [PATCH] Disable GPU memory manager, memory snapshots, and NCE features This commit disables GPU memory management, memory snapshots, and NCE functionality by forcing these settings to false throughout the codebase. The changes include: - Hardcoding false values in renderer_vulkan.cpp initialization - Disabling UI controls for these features in configuration screens - Forcing settings to false during configuration read/write operations These features are being disabled to improve stability and prevent potential memory-related issues. Signed-off-by: Zephyron --- src/citron/configuration/configure_system.cpp | 7 +++++++ src/citron/configuration/qt_config.cpp | 10 ++++++++++ src/citron/configuration/shared_widget.cpp | 12 ++++++++++++ src/video_core/renderer_vulkan/renderer_vulkan.cpp | 10 +++++----- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/citron/configuration/configure_system.cpp b/src/citron/configuration/configure_system.cpp index 10a972acc..f208f7b11 100644 --- a/src/citron/configuration/configure_system.cpp +++ b/src/citron/configuration/configure_system.cpp @@ -131,6 +131,13 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { continue; } + // Skip memory snapshots and hybrid memory settings + if (setting->Id() == Settings::values.use_gpu_memory_manager.Id() || + setting->Id() == Settings::values.enable_memory_snapshots.Id() || + setting->Id() == Settings::values.use_nce.Id()) { + continue; + } + ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs); if (widget == nullptr) { diff --git a/src/citron/configuration/qt_config.cpp b/src/citron/configuration/qt_config.cpp index 37951b9c8..60bc04300 100644 --- a/src/citron/configuration/qt_config.cpp +++ b/src/citron/configuration/qt_config.cpp @@ -75,6 +75,11 @@ void QtConfig::ReadQtValues() { ReadUIValues(); } ReadQtControlValues(); + + // Always disable memory snapshots and hybrid memory + Settings::values.use_gpu_memory_manager.SetValue(false); + Settings::values.enable_memory_snapshots.SetValue(false); + Settings::values.use_nce.SetValue(false); } void QtConfig::ReadQtPlayerValues(const std::size_t player_index) { @@ -336,6 +341,11 @@ void QtConfig::SaveQtValues() { } SaveQtControlValues(); + // Ensure memory snapshots and hybrid memory are always disabled + Settings::values.use_gpu_memory_manager.SetValue(false); + Settings::values.enable_memory_snapshots.SetValue(false); + Settings::values.use_nce.SetValue(false); + WriteToIni(); } diff --git a/src/citron/configuration/shared_widget.cpp b/src/citron/configuration/shared_widget.cpp index 7e3bd11ae..e6eb22878 100644 --- a/src/citron/configuration/shared_widget.cpp +++ b/src/citron/configuration/shared_widget.cpp @@ -759,6 +759,18 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati if (setting.Switchable() && Settings::IsConfiguringGlobal() && !runtime_lock) { enable &= setting.UsingGlobal(); } + + // Disable memory snapshot and hybrid memory checkboxes + if (static_cast(id) == Settings::values.use_gpu_memory_manager.Id() || + static_cast(id) == Settings::values.enable_memory_snapshots.Id() || + static_cast(id) == Settings::values.use_nce.Id()) { + enable = false; + // Also disable the checkbox to prevent it from being changed + if (checkbox) { + checkbox->setEnabled(false); + } + } + this->setEnabled(enable); this->setToolTip(tooltip); diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index a15de9539..0c29bbeb7 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -137,7 +137,7 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, } // Initialize HybridMemory system - if (Settings::values.use_gpu_memory_manager.GetValue()) { + if (false && Settings::values.use_gpu_memory_manager.GetValue()) { #if defined(__linux__) || defined(__ANDROID__) || defined(_WIN32) try { // Define memory size with explicit types to avoid conversion warnings @@ -312,7 +312,7 @@ void RendererVulkan::RenderScreenshot(std::span } // If memory snapshots are enabled, take a snapshot with the screenshot - if (Settings::values.enable_memory_snapshots.GetValue() && hybrid_memory) { + if (false && Settings::values.enable_memory_snapshots.GetValue() && hybrid_memory) { try { const auto now = std::chrono::system_clock::now(); const auto now_time_t = std::chrono::system_clock::to_time_t(now); @@ -328,8 +328,8 @@ void RendererVulkan::RenderScreenshot(std::span std::string snapshot_path = fmt::format("snapshots/memory_snapshot_{}.bin", time_str); hybrid_memory->SaveSnapshot(snapshot_path); - // Also save a differential snapshot if there's been a previous snapshot - if (Settings::values.use_gpu_memory_manager.GetValue()) { + // Differential snapshot for tracking memory changes + if (false && Settings::values.use_gpu_memory_manager.GetValue()) { std::string diff_path = fmt::format("snapshots/diff_snapshot_{}.bin", time_str); hybrid_memory->SaveDifferentialSnapshot(diff_path); hybrid_memory->ResetDirtyTracking(); @@ -451,7 +451,7 @@ void RendererVulkan::InitializePlatformSpecific() { #endif // Create a compute buffer using the HybridMemory system if enabled - if (Settings::values.use_gpu_memory_manager.GetValue()) { + if (false && Settings::values.use_gpu_memory_manager.GetValue()) { try { // Create a small compute buffer for testing const VkDeviceSize buffer_size = 1 * 1024 * 1024; // 1 MB