From 165ae823f522aa981129927f42e76763a9fa6006 Mon Sep 17 00:00:00 2001
From: Fernando Sahmkow <fsahmkow27@gmail.com>
Date: Mon, 17 Feb 2020 22:29:04 -0400
Subject: ThreadManager: Sync async reads on accurate gpu.

---
 src/video_core/gpu_thread.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src/video_core/gpu_thread.cpp')

diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp
index 251a9d911f..672f8d2fab 100644
--- a/src/video_core/gpu_thread.cpp
+++ b/src/video_core/gpu_thread.cpp
@@ -6,6 +6,7 @@
 #include "common/microprofile.h"
 #include "core/core.h"
 #include "core/frontend/emu_window.h"
+#include "core/settings.h"
 #include "video_core/dma_pusher.h"
 #include "video_core/gpu.h"
 #include "video_core/gpu_thread.h"
@@ -80,7 +81,11 @@ void ThreadManager::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
 }
 
 void ThreadManager::FlushRegion(VAddr addr, u64 size) {
-    PushCommand(FlushRegionCommand(addr, size));
+    if (system.Renderer().Rasterizer().MustFlushRegion(addr, size)) {
+        u64 fence = PushCommand(FlushRegionCommand(addr, size));
+        while (fence < state.signaled_fence.load(std::memory_order_relaxed)) {
+        }
+    }
 }
 
 void ThreadManager::InvalidateRegion(VAddr addr, u64 size) {
-- 
cgit v1.2.3-70-g09d2