2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Gl_Rasterizer: Protect CPU Memory mapping from multiple threads.

This commit is contained in:
Fernando Sahmkow 2019-09-27 09:39:42 -04:00 committed by FernandoS27
parent 3f104464de
commit 9f2719d1a4
2 changed files with 4 additions and 0 deletions

View file

@ -348,6 +348,7 @@ static constexpr auto RangeFromInterval(Map& map, const Interval& interval) {
} }
void RasterizerOpenGL::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) { void RasterizerOpenGL::UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {
std::lock_guard lock{pages_mutex};
const u64 page_start{addr >> Memory::PAGE_BITS}; const u64 page_start{addr >> Memory::PAGE_BITS};
const u64 page_end{(addr + size + Memory::PAGE_SIZE - 1) >> Memory::PAGE_BITS}; const u64 page_end{(addr + size + Memory::PAGE_SIZE - 1) >> Memory::PAGE_BITS};

View file

@ -9,6 +9,7 @@
#include <cstddef> #include <cstddef>
#include <map> #include <map>
#include <memory> #include <memory>
#include <mutex>
#include <optional> #include <optional>
#include <tuple> #include <tuple>
#include <utility> #include <utility>
@ -230,6 +231,8 @@ private:
using CachedPageMap = boost::icl::interval_map<u64, int>; using CachedPageMap = boost::icl::interval_map<u64, int>;
CachedPageMap cached_pages; CachedPageMap cached_pages;
std::mutex pages_mutex;
}; };
} // namespace OpenGL } // namespace OpenGL