mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
rsx: Free memory 'held hostage' by storage sections in the surface cache
- Once the memory has been captured by another surface, release the allocation
This commit is contained in:
parent
be98554b40
commit
9cd5325962
2 changed files with 22 additions and 1 deletions
|
@ -347,6 +347,27 @@ namespace rsx
|
|||
region.target = new_surface;
|
||||
|
||||
new_surface->set_old_contents_region(region, true);
|
||||
|
||||
if (surface->memory_usage_flags == surface_usage_flags::storage &&
|
||||
region.width == parent_w &&
|
||||
region.height == parent_h &&
|
||||
surface != prev_surface &&
|
||||
surface == e.second)
|
||||
{
|
||||
// This has been 'swallowed' by the new surface and can be safely freed
|
||||
auto &storage = surface->is_depth_surface() ? m_depth_stencil_storage : m_render_targets_storage;
|
||||
auto &object = storage[e.first];
|
||||
|
||||
verify(HERE), !src_offset.x, !src_offset.y, object;
|
||||
if (UNLIKELY(!surface->old_contents.empty()))
|
||||
{
|
||||
surface->read_barrier(cmd);
|
||||
}
|
||||
|
||||
Traits::notify_surface_invalidated(object);
|
||||
invalidated_resources.push_back(std::move(object));
|
||||
storage.erase(e.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace rsx
|
|||
struct render_target_descriptor
|
||||
{
|
||||
u64 last_use_tag = 0; // tag indicating when this block was last confirmed to have been written to
|
||||
u64 base_addr = 0;
|
||||
u32 base_addr = 0;
|
||||
|
||||
#if (ENABLE_SURFACE_CACHE_DEBUG)
|
||||
u64 memory_hash = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue