From 9d166c5bed089ddb7d64e0ea0894b0f9ed0db3a9 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 11 Jun 2019 20:06:48 +0300 Subject: [PATCH] rsx: Force invalidate of children by issuing a resolve notification whenever the parent is written to - Fixes successive reads of an antialiased surface that is still bound between reads --- rpcs3/Emu/RSX/Common/surface_store.h | 19 ++++++++++++++++++- rpcs3/Emu/RSX/Common/surface_utils.h | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 8cde579508..5505183e35 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -58,6 +58,8 @@ namespace rsx rsx::address_range m_render_targets_memory_range; rsx::address_range m_depth_stencil_memory_range; + bool m_invalidate_on_write = false; + public: std::pair m_bound_render_targets_config = {}; std::array, 4> m_bound_render_targets = {}; @@ -531,6 +533,7 @@ namespace rsx u32 clip_height = clip_vertical_reg; cache_tag = rsx::get_shared_tag(); + m_invalidate_on_write = (antialias != rsx::surface_antialiasing::center_1_sample); // Make previous RTTs sampleable for (int i = m_bound_render_targets_config.first, count = 0; @@ -800,7 +803,21 @@ namespace rsx { if (write_tag == cache_tag) { - // Nothing to do + if (m_invalidate_on_write) + { + for (int i = m_bound_render_targets_config.first, count = 0; + count < m_bound_render_targets_config.second; + ++i, ++count) + { + m_bound_render_targets[i].second->on_invalidate_children(); + } + + if (m_bound_depth_stencil.first) + { + m_bound_depth_stencil.second->on_invalidate_children(); + } + } + return; } else diff --git a/rpcs3/Emu/RSX/Common/surface_utils.h b/rpcs3/Emu/RSX/Common/surface_utils.h index 0129f16493..7419473ef4 100644 --- a/rpcs3/Emu/RSX/Common/surface_utils.h +++ b/rpcs3/Emu/RSX/Common/surface_utils.h @@ -474,6 +474,14 @@ namespace rsx } } + void on_invalidate_children() + { + if (resolve_surface) + { + msaa_flags = rsx::surface_state_flags::require_resolve; + } + } + // Returns the rect area occupied by this surface expressed as an 8bpp image with no AA areau get_normalized_memory_area() const {