From 8b4e832c5fa6020e050213ed8ab48018d3be5187 Mon Sep 17 00:00:00 2001
From: wwylele <wwylele@gmail.com>
Date: Fri, 18 May 2018 23:57:55 +0300
Subject: [PATCH] gl_rasterizer_cache: add missing watcher invalidation

---
 src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 8def5e208..5ef5841b7 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -334,6 +334,8 @@ static bool FillSurface(const Surface& surface, const u8* fill_data,
     state.draw.draw_framebuffer = draw_fb_handle;
     state.Apply();
 
+    surface->InvalidateAllWatcher();
+
     if (surface->type == SurfaceType::Color || surface->type == SurfaceType::Texture) {
         glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
                                surface->texture.handle, 0);
@@ -1029,6 +1031,8 @@ bool RasterizerCacheOpenGL::BlitSurfaces(const Surface& src_surface,
     if (!SurfaceParams::CheckFormatsBlittable(src_surface->pixel_format, dst_surface->pixel_format))
         return false;
 
+    dst_surface->InvalidateAllWatcher();
+
     return BlitTextures(src_surface->texture.handle, src_rect, dst_surface->texture.handle,
                         dst_rect, src_surface->type, read_framebuffer.handle,
                         draw_framebuffer.handle);
@@ -1427,10 +1431,12 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(
     if (color_surface != nullptr) {
         ValidateSurface(color_surface, boost::icl::first(color_vp_interval),
                         boost::icl::length(color_vp_interval));
+        color_surface->InvalidateAllWatcher();
     }
     if (depth_surface != nullptr) {
         ValidateSurface(depth_surface, boost::icl::first(depth_vp_interval),
                         boost::icl::length(depth_vp_interval));
+        depth_surface->InvalidateAllWatcher();
     }
 
     return std::make_tuple(color_surface, depth_surface, fb_rect);