yuzu-emu
/
yuzu
Archived
1
0
Fork 0

texture_cache: Implement Guard mechanism

This commit is contained in:
Fernando Sahmkow 2019-05-13 19:14:02 -04:00 committed by ReinUsesLisp
parent 7731a0e2d1
commit a79831d9d0
2 changed files with 12 additions and 1 deletions

View File

@ -424,6 +424,8 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
} }
current_framebuffer_config_state = fb_config_state; current_framebuffer_config_state = fb_config_state;
texture_cache.Guard(true);
View depth_surface{}; View depth_surface{};
if (using_depth_fb) { if (using_depth_fb) {
depth_surface = texture_cache.GetDepthBufferSurface(preserve_contents); depth_surface = texture_cache.GetDepthBufferSurface(preserve_contents);
@ -500,6 +502,8 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
depth_surface->GetSurfaceParams().type == SurfaceType::DepthStencil; depth_surface->GetSurfaceParams().type == SurfaceType::DepthStencil;
} }
texture_cache.Guard(false);
current_state.draw.draw_framebuffer = framebuffer_cache.GetFramebuffer(fbkey); current_state.draw.draw_framebuffer = framebuffer_cache.GetFramebuffer(fbkey);
SyncViewport(current_state); SyncViewport(current_state);

View File

@ -64,6 +64,10 @@ public:
} }
} }
void Guard(bool new_guard) {
guard_cache = new_guard;
}
void FlushRegion(CacheAddr addr, std::size_t size) { void FlushRegion(CacheAddr addr, std::size_t size) {
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
@ -251,7 +255,7 @@ protected:
void Unregister(TSurface surface) { void Unregister(TSurface surface) {
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
if (surface->IsProtected()) { if (guard_cache && surface->IsProtected()) {
return; return;
} }
const GPUVAddr gpu_addr = surface->GetGpuAddr(); const GPUVAddr gpu_addr = surface->GetGpuAddr();
@ -573,6 +577,9 @@ private:
u64 ticks{}; u64 ticks{};
// Guards the cache for protection conflicts.
bool guard_cache{};
// The internal Cache is different for the Texture Cache. It's based on buckets // The internal Cache is different for the Texture Cache. It's based on buckets
// of 1MB. This fits better for the purpose of this cache as textures are normaly // of 1MB. This fits better for the purpose of this cache as textures are normaly
// large in size. // large in size.