mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	android: video_core: gl_rasterizer_cache: Make cache access thread safe.
This commit is contained in:
		
							parent
							
								
									4f737c329e
								
							
						
					
					
						commit
						5a31aa175d
					
				
					 2 changed files with 11 additions and 0 deletions
				
			
		|  | @ -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; | ||||
|     } | ||||
|  |  | |||
|  | @ -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); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue