gl_rasterizer_cache: Remove all fully invalid surfaces from the cache

Some games (e.g. Pilotwings Resort) create many surfaces that are invalidated quickly but were never removed.
This occasionally lead to large lag spikes due to high lookup times and other data structure management overhead.
This commit is contained in:
BreadFish64 2021-02-02 20:43:41 -06:00
parent 8df502a688
commit 935e88a580
1 changed files with 3 additions and 3 deletions

View File

@ -1858,9 +1858,9 @@ void RasterizerCacheOpenGL::InvalidateRegion(PAddr addr, u32 size, const Surface
cached_surface->invalid_regions.insert(interval);
cached_surface->InvalidateAllWatcher();
// Remove only "empty" fill surfaces to avoid destroying and recreating OGL textures
if (cached_surface->type == SurfaceType::Fill &&
cached_surface->IsSurfaceFullyInvalid()) {
// If the surface has no salvageable data it should be removed from the cache to avoid
// clogging the data structure
if (cached_surface->IsSurfaceFullyInvalid()) {
remove_surfaces.emplace(cached_surface);
}
}