1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

rsx: Brute-force removal of superseded surfaces

This commit is contained in:
kd-11 2020-07-15 20:45:09 +03:00 committed by kd-11
parent 182b20c33d
commit 42a9ac9e6c
3 changed files with 28 additions and 8 deletions

View File

@ -61,6 +61,9 @@ namespace rsx
// List of sections derived from a section that has been split and invalidated
std::vector<surface_type> orphaned_surfaces;
// List of sections that have been wholly inherited and invalidated
std::vector<surface_type> superseded_surfaces;
std::list<surface_storage_type> invalidated_resources;
u64 cache_tag = 1ull; // Use 1 as the start since 0 is default tag on new surfaces
u64 write_tag = 1ull;
@ -410,6 +413,7 @@ namespace rsx
invalidate(object);
storage.erase(e.first);
superseded_surfaces.push_back(surface);
}
}
}

View File

@ -753,14 +753,6 @@ namespace rsx
tex.is_flushable() &&
tex.get_section_base() != fault_range_in.start)
{
if (tex.get_context() == texture_upload_context::framebuffer_storage &&
tex.inside(fault_range, section_bounds::full_range))
{
// FBO data 'lives on' in the new region. Surface cache handles memory intersection for us.
verify(HERE), tex.inside(fault_range, section_bounds::locked_range);
tex.discard(false);
}
// HACK: When being superseded by an fbo, we preserve overlapped flushables unless the start addresses match
continue;
}
@ -1174,6 +1166,20 @@ namespace rsx
invalidate_range_impl_base(cmd, rsx_range, invalidation_cause::committed_as_fbo, std::forward<Args>(extras)...);
}
template <typename ...Args>
void discard_framebuffer_memory_region(commandbuffer_type& cmd, const address_range& rsx_range, Args&&... extras)
{
if (g_cfg.video.write_color_buffers || g_cfg.video.write_depth_buffer)
{
auto* region_ptr = find_cached_texture(rsx_range, RSX_GCM_FORMAT_IGNORED, false, false);
if (region_ptr && region_ptr->is_locked() && region_ptr->get_context() == texture_upload_context::framebuffer_storage)
{
verify(HERE), region_ptr->get_protection() == utils::protection::no;
region_ptr->discard(false);
}
}
}
void set_memory_read_flags(const address_range &memory_range, memory_read_flags flags)
{
std::lock_guard lock(m_cache_mutex);

View File

@ -329,6 +329,16 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool sk
m_gl_texture_cache.clear_ro_tex_invalidate_intr();
if (!m_rtts.superseded_surfaces.empty())
{
for (auto& surface : m_rtts.superseded_surfaces)
{
m_gl_texture_cache.discard_framebuffer_memory_region(cmd, surface->get_memory_range());
}
m_rtts.superseded_surfaces.clear();
}
const auto color_format = rsx::internals::surface_color_format_to_gl(m_framebuffer_layout.color_format);
for (u8 i = 0; i < rsx::limits::color_buffers_count; ++i)
{