From da80ece8b9a1a6946072634e0025089143b368e1 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 6 Dec 2015 17:02:35 -0800 Subject: OpenGL: Rename cache functions to better match what they actually do --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 8 ++++---- src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 7 +++---- src/video_core/renderer_opengl/gl_rasterizer_cache.h | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 822739088..ca8247b86 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -135,7 +135,7 @@ void RasterizerOpenGL::Reset() { SetShader(); - res_cache.FullFlush(); + res_cache.InvalidateAll(); } void RasterizerOpenGL::AddTriangle(const Pica::Shader::OutputVertex& v0, @@ -176,8 +176,8 @@ void RasterizerOpenGL::DrawTriangles() { u32 cur_fb_depth_size = Pica::Regs::BytesPerDepthPixel(regs.framebuffer.depth_format) * regs.framebuffer.GetWidth() * regs.framebuffer.GetHeight(); - res_cache.NotifyFlush(cur_fb_color_addr, cur_fb_color_size, true); - res_cache.NotifyFlush(cur_fb_depth_addr, cur_fb_depth_size, true); + res_cache.InvalidateInRange(cur_fb_color_addr, cur_fb_color_size, true); + res_cache.InvalidateInRange(cur_fb_depth_addr, cur_fb_depth_size, true); } void RasterizerOpenGL::CommitFramebuffer() { @@ -328,7 +328,7 @@ void RasterizerOpenGL::NotifyFlush(PAddr addr, u32 size) { ReloadDepthBuffer(); // Notify cache of flush in case the region touches a cached resource - res_cache.NotifyFlush(addr, size); + res_cache.InvalidateInRange(addr, size); } void RasterizerOpenGL::SamplerInfo::Create() { diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 10d4ab0b6..a9ad46fe0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -15,7 +15,7 @@ #include "video_core/renderer_opengl/pica_to_gl.h" RasterizerCacheOpenGL::~RasterizerCacheOpenGL() { - FullFlush(); + InvalidateAll(); } MICROPROFILE_DEFINE(OpenGL_TextureUpload, "OpenGL", "Texture Upload", MP_RGB(128, 64, 192)); @@ -58,8 +58,7 @@ void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned text } } -void RasterizerCacheOpenGL::NotifyFlush(PAddr addr, u32 size, bool ignore_hash) { - // Flush any texture that falls in the flushed region +void RasterizerCacheOpenGL::InvalidateInRange(PAddr addr, u32 size, bool ignore_hash) { // TODO: Optimize by also inserting upper bound (addr + size) of each texture into the same map and also narrow using lower_bound auto cache_upper_bound = texture_cache.upper_bound(addr + size); @@ -77,6 +76,6 @@ void RasterizerCacheOpenGL::NotifyFlush(PAddr addr, u32 size, bool ignore_hash) } } -void RasterizerCacheOpenGL::FullFlush() { +void RasterizerCacheOpenGL::InvalidateAll() { texture_cache.clear(); } diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 98a48ffbe..b69651427 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -23,11 +23,11 @@ public: LoadAndBindTexture(state, texture_unit, Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format)); } - /// Flush any cached resource that touches the flushed region - void NotifyFlush(PAddr addr, u32 size, bool ignore_hash = false); + /// Invalidate any cached resource intersecting the specified region. + void InvalidateInRange(PAddr addr, u32 size, bool ignore_hash = false); - /// Flush all cached OpenGL resources tracked by this cache manager - void FullFlush(); + /// Invalidate all cached OpenGL resources tracked by this cache manager + void InvalidateAll(); private: struct CachedTexture { -- cgit v1.2.3