From 0df9096e90642caabf93a8f24aa0d1c668a1bf92 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 10 May 2026 19:12:45 +0300 Subject: [PATCH] rsx/qt: Add depth compare emulation to the advanced tab --- rpcs3/Emu/RSX/RSXThread.cpp | 3 ++- rpcs3/Emu/system_config.h | 1 + rpcs3/rpcs3qt/emu_settings_type.cpp | 1 + rpcs3/rpcs3qt/emu_settings_type.h | 1 + rpcs3/rpcs3qt/settings_dialog.cpp | 3 +++ rpcs3/rpcs3qt/settings_dialog.ui | 7 +++++++ rpcs3/rpcs3qt/tooltips.h | 1 + 7 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index fa54fe1080..ddb9e0848d 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -2163,7 +2163,8 @@ namespace rsx } } - if (m_framebuffer_layout.zeta_address && + if (g_cfg.video.emulate_depth_compare && + m_framebuffer_layout.zeta_address && method_registers.depth_func() == rsx::comparison_function::equal) { current_fragment_program.ctrl |= RSX_SHADER_CONTROL_EMULATE_DEPTH_COMPARE; diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 08004f5a46..ab0f3fffd8 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -147,6 +147,7 @@ struct cfg_root : cfg::node cfg::_bool disable_video_output{ this, "Disable Video Output", false, true }; cfg::_bool disable_vertex_cache{ this, "Disable Vertex Cache", false }; cfg::_bool disable_FIFO_reordering{ this, "Disable FIFO Reordering", false }; + cfg::_bool emulate_depth_compare{ this, "Emulate Special Depth Comparison", false }; cfg::_bool frame_skip_enabled{ this, "Enable Frame Skip", false, true }; cfg::_bool force_cpu_blit_processing{ this, "Force CPU Blit", false, true }; // Debugging option cfg::_bool disable_on_disk_shader_cache{ this, "Disable On-Disk Shader Cache", false }; diff --git a/rpcs3/rpcs3qt/emu_settings_type.cpp b/rpcs3/rpcs3qt/emu_settings_type.cpp index 0307f764d5..ff9340aff6 100644 --- a/rpcs3/rpcs3qt/emu_settings_type.cpp +++ b/rpcs3/rpcs3qt/emu_settings_type.cpp @@ -84,6 +84,7 @@ const std::map settings_location = { emu_settings_type::DisableOcclusionQueries, get_cfg_location(local_cfg.video.disable_zcull_queries) }, { emu_settings_type::DisableVideoOutput, get_cfg_location(local_cfg.video.disable_video_output) }, { emu_settings_type::DisableFIFOReordering, get_cfg_location(local_cfg.video.disable_FIFO_reordering) }, + { emu_settings_type::EmulateDepthCompare, get_cfg_location(local_cfg.video.emulate_depth_compare) }, { emu_settings_type::StereoRenderEnabled, get_cfg_location(local_cfg.video.stereo_enabled) }, { emu_settings_type::StereoRenderMode, get_cfg_location(local_cfg.video.stereo_render_mode) }, { emu_settings_type::ScreenSize, get_cfg_location(local_cfg.video.screen_size) }, diff --git a/rpcs3/rpcs3qt/emu_settings_type.h b/rpcs3/rpcs3qt/emu_settings_type.h index fbc3996e03..c22f111c76 100644 --- a/rpcs3/rpcs3qt/emu_settings_type.h +++ b/rpcs3/rpcs3qt/emu_settings_type.h @@ -79,6 +79,7 @@ enum class emu_settings_type DisableOcclusionQueries, DisableVideoOutput, DisableFIFOReordering, + EmulateDepthCompare, StrictTextureFlushing, ShaderPrecisionQuality, StereoRenderEnabled, diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index dddb803c4f..6194a85fdb 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -2457,6 +2457,9 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std m_emu_settings->EnhanceCheckBox(ui->disableVertexCache, emu_settings_type::DisableVertexCache); SubscribeTooltip(ui->disableVertexCache, tooltips.settings.disable_vertex_cache); + m_emu_settings->EnhanceCheckBox(ui->emulateDepthCompare, emu_settings_type::EmulateDepthCompare); + SubscribeTooltip(ui->emulateDepthCompare, tooltips.settings.emulate_depth_compare); + m_emu_settings->EnhanceCheckBox(ui->forceHwMSAAResolve, emu_settings_type::ForceHwMSAAResolve); SubscribeTooltip(ui->forceHwMSAAResolve, tooltips.settings.force_hw_MSAA); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index d5024f4bef..8e674722c0 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -2727,6 +2727,13 @@ + + + + Emulate Special Depth Comparison + + + diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index dba2bd5c1d..760bfc1509 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -42,6 +42,7 @@ public: const QString disable_vertex_cache = tr("Disables the vertex cache.\nMight resolve missing or flickering graphics output.\nMay degrade performance."); const QString disable_async_host_mm = tr("Force host memory management calls to be inlined instead of handled asynchronously.\nThis can cause severe performance degradation and stuttering in some games.\nThis option is only needed by developers to debug problems with texture cache memory protection."); const QString disable_spin_optimization = tr("Disable SPU GETLLAR spin optimization.\nThis can cause severe performance degradation and stuttering in many games.\nThis option is only needed for a select number of games."); + const QString emulate_depth_compare = tr("Emulate depth comparison operations where desktop hardware behavior differs from PS3, usually EQUAL comparison modes.\nFixes excessive shadow flickering and Z-fighting in some games.\nThis is most obvious in some games where the Z prepass depth format is different from the rasterization depth format, a scenario that will never work out correctly on compliant desktop hardware."); const QString enable_spu_events_busy_loop = tr("Enable SPU RdEventStat spin.\nThis increases CPU usage, this setting is beneficial for high-threaded CPUs (12+) with select number of games."); const QString zcull_operation_mode = tr("Changes ZCULL report synchronization behaviour. Experiment to find the best option for your game. Approximate mode is recommended for most games.\n· Precise is the most accurate to PS3 behaviour. Required for accurate visuals in some titles such as Demon's Souls and The Darkness.\n· Approximate is a much faster way to generate occlusion data which may not always match what the PS3 would generate. Works well with most PS3 games.\n· Relaxed changes the synchronization method completely and can greatly improve performance in some games or completely break others."); const QString max_spurs_threads = tr("Limits the maximum number of SPURS threads in each thread group.\nMay improve performance in some cases, especially on systems with limited number of hardware threads.\nLimiting the number of threads is likely to cause crashes; it's recommended to keep this at the default value.");