Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx: Add an option to force hardware MSAA resolve #15000

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion rpcs3/Emu/RSX/Common/texture_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ namespace rsx
* 3. Surface is swapped back in. Surface cache resets layout to optimal rasterization layout
* 4. During bind, the surface is converted to shader layout because it is not in GENERAL layout
*/
if (!g_cfg.video.strict_rendering_mode)
if (!texture_cache_helpers::force_strict_fbo_sampling(result.second->samples()))
{
insert_texture_barrier(cmd, result.second, false);
}
Expand Down
20 changes: 19 additions & 1 deletion rpcs3/Emu/RSX/Common/texture_cache_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ namespace rsx

namespace texture_cache_helpers
{
static inline bool force_strict_fbo_sampling(u8 samples)
{
if (g_cfg.video.strict_rendering_mode)
{
// Strict mode. All access is strict.
return true;
}

if (g_cfg.video.antialiasing_level == msaa_level::none)
{
// MSAA disabled. All access is fast.
return false;
}

// Strict access if MSAA only.
return samples > 1 && !!g_cfg.video.force_hw_MSAA_resolve;
}

static inline bool is_gcm_depth_format(u32 format)
{
switch (format)
Expand Down Expand Up @@ -665,7 +683,7 @@ namespace rsx
}
}

if (surface_is_rop_target && g_cfg.video.strict_rendering_mode)
if (surface_is_rop_target && texture_cache_helpers::force_strict_fbo_sampling(texptr->samples()))
{
// Framebuffer feedback avoidance. For MSAA, we do not need to make copies; just use the resolve target
if (texptr->samples() == 1)
Expand Down
1 change: 1 addition & 0 deletions rpcs3/Emu/system_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ struct cfg_root : cfg::node
cfg::_bool strict_texture_flushing{ this, "Strict Texture Flushing", false };
cfg::_bool multithreaded_rsx{ this, "Multithreaded RSX", false };
cfg::_bool relaxed_zcull_sync{ this, "Relaxed ZCULL Sync", false };
cfg::_bool force_hw_MSAA_resolve{ this, "Force Hardware MSAA Resolve", false, true };
cfg::_enum<stereo_render_mode_options> stereo_render_mode{ this, "3D Display Mode", stereo_render_mode_options::disabled };
cfg::_bool debug_program_analyser{ this, "Debug Program Analyser", false };
cfg::_bool precise_zpass_count{ this, "Accurate ZCULL stats", true };
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/rpcs3qt/emu_settings_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ enum class emu_settings_type
AllowHostGPULabels,
DisableMSLFastMath,
OutputScalingMode,
ForceHwMSAAResolve,

// Performance Overlay
PerfOverlayEnabled,
Expand Down Expand Up @@ -282,6 +283,7 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::AllowHostGPULabels, { "Video", "Allow Host GPU Labels"}},
{ emu_settings_type::DisableMSLFastMath, { "Video", "Disable MSL Fast Math"}},
{ emu_settings_type::OutputScalingMode, { "Video", "Output Scaling Mode"}},
{ emu_settings_type::ForceHwMSAAResolve, { "Video", "Force Hardware MSAA Resolve"}},

// Vulkan
{ emu_settings_type::VulkanAsyncTextureUploads, { "Video", "Vulkan", "Asynchronous Texture Streaming 2"}},
Expand Down
3 changes: 3 additions & 0 deletions rpcs3/rpcs3qt/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> 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->forceHwMSAAResolve, emu_settings_type::ForceHwMSAAResolve);
SubscribeTooltip(ui->forceHwMSAAResolve, tooltips.settings.force_hw_MSAA);

// Checkboxes: core debug options
m_emu_settings->EnhanceCheckBox(ui->alwaysStart, emu_settings_type::StartOnBoot);
SubscribeTooltip(ui->alwaysStart, tooltips.settings.start_on_boot);
Expand Down
7 changes: 7 additions & 0 deletions rpcs3/rpcs3qt/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2657,6 +2657,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="forceHwMSAAResolve">
<property name="text">
<string>Force Hardware MSAA Resolve</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableMslFastMath">
<property name="text">
Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/tooltips.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Tooltips : public QObject
const QString handle_tiled_memory = tr("Obey RSX memory tiling configuration when writing GPU data to vm memory.\nThis can fix graphics corruption observed when Read Color or Read Depth options are enabled.");
const QString disable_on_disk_shader_cache = tr("Disables the loading and saving of shaders from and to the shader cache in the data directory.");
const QString allow_host_labels = tr("Allows the host GPU to synchronize with CELL directly. This incurs a performance penalty, but exposes the true state of GPU objects to the guest CPU. Can help eliminate visual noise and glitching at the cost of performance. Use with caution.");
const QString force_hw_MSAA = tr("Forces MSAA to use the host GPU's resolve capabilities for all sampling operations.\nThis option incurs a performance penalty as well as the risk of visual artifacts but can yield crisper visuals when MSAA is enabled.");
const QString disable_vertex_cache = tr("Disables the vertex cache.\nMight resolve missing or flickering graphics output.\nMay degrade performance.");
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.");
Expand Down