mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-01 00:12:55 +00:00
gl_rasterizer_cache: Avoid iterator invalidation issues within InvalidateRegion()
A range-based for loop can't be used when the container being iterated is also being erased from.
This commit is contained in:
parent
0bfe974281
commit
59ea37daa7
|
@ -761,10 +761,12 @@ void RasterizerCacheOpenGL::FlushRegion(Tegra::GPUVAddr /*addr*/, size_t /*size*
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerCacheOpenGL::InvalidateRegion(Tegra::GPUVAddr addr, size_t size) {
|
void RasterizerCacheOpenGL::InvalidateRegion(Tegra::GPUVAddr addr, size_t size) {
|
||||||
for (const auto& pair : surface_cache) {
|
for (auto iter = surface_cache.cbegin(); iter != surface_cache.cend();) {
|
||||||
const auto& surface{pair.second};
|
const auto& surface{iter->second};
|
||||||
const auto& params{surface->GetSurfaceParams()};
|
const auto& params{surface->GetSurfaceParams()};
|
||||||
|
|
||||||
|
++iter;
|
||||||
|
|
||||||
if (params.IsOverlappingRegion(addr, size)) {
|
if (params.IsOverlappingRegion(addr, size)) {
|
||||||
UnregisterSurface(surface);
|
UnregisterSurface(surface);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue