citra-emu
/
citra-canary
Archived
1
0
Fork 0

android: video_core: gl_rasterizer_cache: Make cache access thread safe.

This commit is contained in:
bunnei 2019-10-01 23:53:43 -04:00 committed by SachinVin
parent 4f737c329e
commit 5a31aa175d
2 changed files with 11 additions and 0 deletions

View File

@ -1832,6 +1832,8 @@ void RasterizerCacheOpenGL::ClearAll(bool flush) {
}
void RasterizerCacheOpenGL::FlushRegion(PAddr addr, u32 size, Surface flush_surface) {
std::lock_guard lock{mutex};
if (size == 0)
return;
@ -1868,6 +1870,8 @@ void RasterizerCacheOpenGL::FlushAll() {
}
void RasterizerCacheOpenGL::InvalidateRegion(PAddr addr, u32 size, const Surface& region_owner) {
std::lock_guard lock{mutex};
if (size == 0)
return;
@ -1943,6 +1947,8 @@ Surface RasterizerCacheOpenGL::CreateSurface(const SurfaceParams& params) {
}
void RasterizerCacheOpenGL::RegisterSurface(const Surface& surface) {
std::lock_guard lock{mutex};
if (surface->registered) {
return;
}
@ -1952,6 +1958,8 @@ void RasterizerCacheOpenGL::RegisterSurface(const Surface& surface) {
}
void RasterizerCacheOpenGL::UnregisterSurface(const Surface& surface) {
std::lock_guard lock{mutex};
if (!surface->registered) {
return;
}

View File

@ -7,6 +7,7 @@
#include <array>
#include <list>
#include <memory>
#include <mutex>
#include <set>
#include <tuple>
#ifdef __GNUC__
@ -365,6 +366,8 @@ private:
std::unordered_map<TextureCubeConfig, CachedTextureCube> texture_cube_cache;
std::recursive_mutex mutex;
public:
OGLTexture AllocateSurfaceTexture(const FormatTuple& format_tuple, u32 width, u32 height);