mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	gl_rasterizer: Avoid scenario locking already owned mutex
gpu.TickWork() may lock the texture_cache and buffer_cache mutexes, which are owned by the thread prior to invoking TickWork(). Defer invoking gpu.TickWork() until the scope ends, where the owned mutexes are released.
This commit is contained in:
		@@ -15,8 +15,9 @@
 | 
				
			|||||||
#include "common/logging/log.h"
 | 
					#include "common/logging/log.h"
 | 
				
			||||||
#include "common/math_util.h"
 | 
					#include "common/math_util.h"
 | 
				
			||||||
#include "common/microprofile.h"
 | 
					#include "common/microprofile.h"
 | 
				
			||||||
 | 
					#include "common/scope_exit.h"
 | 
				
			||||||
#include "common/settings.h"
 | 
					#include "common/settings.h"
 | 
				
			||||||
#include "core/memory.h"
 | 
					
 | 
				
			||||||
#include "video_core/engines/kepler_compute.h"
 | 
					#include "video_core/engines/kepler_compute.h"
 | 
				
			||||||
#include "video_core/engines/maxwell_3d.h"
 | 
					#include "video_core/engines/maxwell_3d.h"
 | 
				
			||||||
#include "video_core/memory_manager.h"
 | 
					#include "video_core/memory_manager.h"
 | 
				
			||||||
@@ -210,6 +211,7 @@ void RasterizerOpenGL::Clear() {
 | 
				
			|||||||
void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
 | 
					void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
 | 
				
			||||||
    MICROPROFILE_SCOPE(OpenGL_Drawing);
 | 
					    MICROPROFILE_SCOPE(OpenGL_Drawing);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SCOPE_EXIT({ gpu.TickWork(); });
 | 
				
			||||||
    query_cache.UpdateCounters();
 | 
					    query_cache.UpdateCounters();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()};
 | 
					    GraphicsPipeline* const pipeline{shader_cache.CurrentGraphicsPipeline()};
 | 
				
			||||||
@@ -265,8 +267,6 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ++num_queued_commands;
 | 
					    ++num_queued_commands;
 | 
				
			||||||
    has_written_global_memory |= pipeline->WritesGlobalMemory();
 | 
					    has_written_global_memory |= pipeline->WritesGlobalMemory();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    gpu.TickWork();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RasterizerOpenGL::DispatchCompute() {
 | 
					void RasterizerOpenGL::DispatchCompute() {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user