summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-05-13 19:14:02 -0400
committerGravatar ReinUsesLisp2019-06-20 21:36:12 -0300
commita79831d9d02f7c42d82ea36210cac7952a3ef16e (patch)
treeee201e6957b5018159eafe01b6378c11fef8c4cf /src
parenttexture_cache: General Fixes (diff)
downloadyuzu-a79831d9d02f7c42d82ea36210cac7952a3ef16e.tar.gz
yuzu-a79831d9d02f7c42d82ea36210cac7952a3ef16e.tar.xz
yuzu-a79831d9d02f7c42d82ea36210cac7952a3ef16e.zip
texture_cache: Implement Guard mechanism
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp4
-rw-r--r--src/video_core/texture_cache/texture_cache.h9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 8218c5143..afacc3fbd 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -424,6 +424,8 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
424 } 424 }
425 current_framebuffer_config_state = fb_config_state; 425 current_framebuffer_config_state = fb_config_state;
426 426
427 texture_cache.Guard(true);
428
427 View depth_surface{}; 429 View depth_surface{};
428 if (using_depth_fb) { 430 if (using_depth_fb) {
429 depth_surface = texture_cache.GetDepthBufferSurface(preserve_contents); 431 depth_surface = texture_cache.GetDepthBufferSurface(preserve_contents);
@@ -500,6 +502,8 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
500 depth_surface->GetSurfaceParams().type == SurfaceType::DepthStencil; 502 depth_surface->GetSurfaceParams().type == SurfaceType::DepthStencil;
501 } 503 }
502 504
505 texture_cache.Guard(false);
506
503 current_state.draw.draw_framebuffer = framebuffer_cache.GetFramebuffer(fbkey); 507 current_state.draw.draw_framebuffer = framebuffer_cache.GetFramebuffer(fbkey);
504 SyncViewport(current_state); 508 SyncViewport(current_state);
505 509
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 419c0de5e..2ad6210dd 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -64,6 +64,10 @@ public:
64 } 64 }
65 } 65 }
66 66
67 void Guard(bool new_guard) {
68 guard_cache = new_guard;
69 }
70
67 void FlushRegion(CacheAddr addr, std::size_t size) { 71 void FlushRegion(CacheAddr addr, std::size_t size) {
68 std::lock_guard lock{mutex}; 72 std::lock_guard lock{mutex};
69 73
@@ -251,7 +255,7 @@ protected:
251 void Unregister(TSurface surface) { 255 void Unregister(TSurface surface) {
252 std::lock_guard lock{mutex}; 256 std::lock_guard lock{mutex};
253 257
254 if (surface->IsProtected()) { 258 if (guard_cache && surface->IsProtected()) {
255 return; 259 return;
256 } 260 }
257 const GPUVAddr gpu_addr = surface->GetGpuAddr(); 261 const GPUVAddr gpu_addr = surface->GetGpuAddr();
@@ -573,6 +577,9 @@ private:
573 577
574 u64 ticks{}; 578 u64 ticks{};
575 579
580 // Guards the cache for protection conflicts.
581 bool guard_cache{};
582
576 // The internal Cache is different for the Texture Cache. It's based on buckets 583 // The internal Cache is different for the Texture Cache. It's based on buckets
577 // of 1MB. This fits better for the purpose of this cache as textures are normaly 584 // of 1MB. This fits better for the purpose of this cache as textures are normaly
578 // large in size. 585 // large in size.